app.js 2.0 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693
  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. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  1989. components: {
  1990. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  1991. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  1992. },
  1993. props: {
  1994. populateWith: {
  1995. type: Object,
  1996. "default": function _default() {
  1997. return {
  1998. creddesc: null,
  1999. creduser: null,
  2000. credpass: null,
  2001. groupid: null,
  2002. pcid: null,
  2003. credtype: null
  2004. };
  2005. }
  2006. },
  2007. modalId: {
  2008. type: String,
  2009. required: true
  2010. },
  2011. descriptions: {
  2012. type: Object,
  2013. required: true
  2014. },
  2015. create: {
  2016. type: Boolean
  2017. },
  2018. pcid: {
  2019. type: Number
  2020. },
  2021. groupid: {
  2022. type: Number
  2023. }
  2024. },
  2025. data: function data() {
  2026. return {
  2027. data: JSON.parse(JSON.stringify(this.populateWith)),
  2028. creddesc: {},
  2029. id: this.modalId,
  2030. errors: []
  2031. };
  2032. },
  2033. mounted: function mounted() {
  2034. this.creddesc = {
  2035. 'id': this.data.credtype,
  2036. 'name': this.data.creddesc
  2037. };
  2038. },
  2039. methods: {
  2040. rndStr: function rndStr(len) {
  2041. var text = "";
  2042. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  2043. for (var i = 0; i < len; i++) {
  2044. text += chars.charAt(Math.floor(Math.random() * chars.length));
  2045. }
  2046. return text;
  2047. },
  2048. getRandomPassword: function getRandomPassword(id) {
  2049. this.data.credpass = this.rndStr(16);
  2050. },
  2051. updateCredential: function updateCredential() {
  2052. var _this = this;
  2053. if (this.creddesc.id === "custom") {
  2054. this.data.credtype = 1;
  2055. this.data.creddesc = this.creddesc.name;
  2056. } else {
  2057. this.data.credtype = this.creddesc.id;
  2058. this.data.creddesc = this.creddesc.name;
  2059. }
  2060. if (this.create) {
  2061. if (this.pcid) {
  2062. this.data.pcid = this.pcid;
  2063. }
  2064. if (this.groupid) {
  2065. this.data.groupid = this.groupid;
  2066. }
  2067. axios.post('/api/credentials/', this.data).then(function (response) {
  2068. $('#' + _this.id).modal('hide');
  2069. });
  2070. } else {
  2071. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2072. $('#' + _this.id).modal('hide');
  2073. })["catch"](function (error) {
  2074. console.error(error);
  2075. });
  2076. }
  2077. }
  2078. }
  2079. });
  2080. /***/ }),
  2081. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/CredentialList.vue?vue&type=script&lang=js&":
  2082. /*!*************************************************************************************************************************************************************************!*\
  2083. !*** ./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& ***!
  2084. \*************************************************************************************************************************************************************************/
  2085. /*! exports provided: default */
  2086. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2087. "use strict";
  2088. __webpack_require__.r(__webpack_exports__);
  2089. /* harmony import */ var _components_Credential_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Credential.vue */ "./resources/js/components/Credential.vue");
  2090. /* harmony import */ var _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/CredentialFormModal.vue */ "./resources/js/components/CredentialFormModal.vue");
  2091. //
  2092. //
  2093. //
  2094. //
  2095. //
  2096. //
  2097. //
  2098. //
  2099. //
  2100. /* harmony default export */ __webpack_exports__["default"] = ({
  2101. components: {
  2102. Credential: _components_Credential_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2103. CredentialFormModal: _components_CredentialFormModal_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  2104. },
  2105. props: {
  2106. credentials: {
  2107. type: Array,
  2108. required: true
  2109. },
  2110. descriptions: {
  2111. type: Array,
  2112. required: true
  2113. },
  2114. pcid: {
  2115. type: Number
  2116. },
  2117. groupid: {
  2118. type: Number
  2119. }
  2120. },
  2121. computed: {
  2122. creddescList: function creddescList() {
  2123. var list = {};
  2124. this.descriptions.map(function (val) {
  2125. list[val.creddescid] = val.credtitle;
  2126. });
  2127. return list;
  2128. }
  2129. },
  2130. methods: {
  2131. deleteCred: function deleteCred(index) {
  2132. this.credentials.splice(index, 1);
  2133. }
  2134. },
  2135. mounted: function mounted() {
  2136. var _this = this;
  2137. if (this.pcid) {
  2138. Echo.channel('credlist.pcid.' + this.pcid).listen('CredentialDeleted', function (e) {
  2139. var deletedCred = e.credential;
  2140. var index = _this.credentials.findIndex(function (credential) {
  2141. return credential.credid === deletedCred['credid'];
  2142. });
  2143. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2144. _this.deleteCred(index);
  2145. }).listen('CredentialAdded', function (e) {
  2146. _this.credentials.unshift(e.credential);
  2147. });
  2148. }
  2149. if (this.groupid) {
  2150. Echo.channel('credlist.groupid.' + this.groupid).listen('CredentialDeleted', function (e) {
  2151. var deletedCred = e.credential;
  2152. var index = _this.credentials.findIndex(function (credential) {
  2153. return credential.groupid === deletedCred['groupid'];
  2154. });
  2155. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2156. _this.deleteCred(index);
  2157. }).listen('CredentialAdded', function (e) {
  2158. _this.credentials.unshift(e.credential);
  2159. });
  2160. }
  2161. }
  2162. });
  2163. /***/ }),
  2164. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ErrorList.vue?vue&type=script&lang=js&":
  2165. /*!********************************************************************************************************************************************************************!*\
  2166. !*** ./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& ***!
  2167. \********************************************************************************************************************************************************************/
  2168. /*! exports provided: default */
  2169. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2170. "use strict";
  2171. __webpack_require__.r(__webpack_exports__);
  2172. //
  2173. //
  2174. //
  2175. //
  2176. //
  2177. /* harmony default export */ __webpack_exports__["default"] = ({
  2178. props: ['errors'],
  2179. data: function data() {
  2180. return {
  2181. errorList: this.errors
  2182. };
  2183. },
  2184. watch: {
  2185. errors: function errors(newErrors) {
  2186. this.errorList = newErrors;
  2187. }
  2188. }
  2189. });
  2190. /***/ }),
  2191. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js&":
  2192. /*!************************************************************************************************************************************************************************!*\
  2193. !*** ./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& ***!
  2194. \************************************************************************************************************************************************************************/
  2195. /*! exports provided: default */
  2196. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2197. "use strict";
  2198. __webpack_require__.r(__webpack_exports__);
  2199. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  2200. //
  2201. //
  2202. //
  2203. //
  2204. //
  2205. //
  2206. //
  2207. //
  2208. //
  2209. //
  2210. //
  2211. //
  2212. //
  2213. //
  2214. //
  2215. //
  2216. //
  2217. /* harmony default export */ __webpack_exports__["default"] = ({
  2218. components: {
  2219. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  2220. },
  2221. props: {
  2222. populateWith: {
  2223. type: Object,
  2224. require: true
  2225. },
  2226. modalId: {
  2227. type: String,
  2228. require: true
  2229. },
  2230. noteType: {
  2231. type: Number
  2232. },
  2233. noteUser: {
  2234. type: String
  2235. },
  2236. woid: {
  2237. type: Number
  2238. }
  2239. },
  2240. data: function data() {
  2241. return {
  2242. note: JSON.parse(JSON.stringify(this.populateWith))
  2243. };
  2244. },
  2245. methods: {
  2246. updateNote: function updateNote(note) {
  2247. var _this = this;
  2248. axios.put('/api/workorders/notes/' + note.noteid, note).then(function (response) {
  2249. _this.hideModal();
  2250. });
  2251. },
  2252. hideModal: function hideModal() {
  2253. $('#' + this.modalId).modal('hide');
  2254. }
  2255. }
  2256. });
  2257. /***/ }),
  2258. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/Notes.vue?vue&type=script&lang=js&":
  2259. /*!****************************************************************************************************************************************************************!*\
  2260. !*** ./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& ***!
  2261. \****************************************************************************************************************************************************************/
  2262. /*! exports provided: default */
  2263. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2264. "use strict";
  2265. __webpack_require__.r(__webpack_exports__);
  2266. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2267. /* harmony import */ var _components_NoteFormModal_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/NoteFormModal.vue */ "./resources/js/components/NoteFormModal.vue");
  2268. //
  2269. //
  2270. //
  2271. //
  2272. //
  2273. //
  2274. //
  2275. //
  2276. //
  2277. //
  2278. //
  2279. //
  2280. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  2307. components: {
  2308. NoteFormModal: _components_NoteFormModal_vue__WEBPACK_IMPORTED_MODULE_1__["default"]
  2309. },
  2310. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2311. props: {
  2312. notes: {
  2313. type: Array,
  2314. "default": []
  2315. },
  2316. authusername: {
  2317. type: String,
  2318. required: true
  2319. },
  2320. noteType: {
  2321. type: Number,
  2322. required: true
  2323. },
  2324. woid: {
  2325. type: String,
  2326. required: true
  2327. }
  2328. },
  2329. data: function data() {
  2330. return {
  2331. newNote: {
  2332. notetype: this.noteType,
  2333. thenote: '',
  2334. noteuser: this.authusername,
  2335. woid: this.woid
  2336. }
  2337. };
  2338. },
  2339. computed: {
  2340. noteOrders: function noteOrders() {
  2341. return this.getNoteOrders(this.notes);
  2342. }
  2343. },
  2344. methods: {
  2345. createNote: function createNote() {
  2346. var _this = this;
  2347. axios.post('/api/workorders/notes', this.newNote).then(function (response) {
  2348. $('#note' + _this.noteType + 'add').collapse('hide');
  2349. _this.newNote.thenote = '';
  2350. });
  2351. },
  2352. getNoteOrders: function getNoteOrders(notes) {
  2353. var noteOrders = [];
  2354. notes.forEach(function (note, index) {
  2355. if (index === 0) {
  2356. noteOrders[index] = 'order-first';
  2357. } else if (note.noteuser !== notes[index - 1].noteuser) {
  2358. if (noteOrders[index - 1] === 'order-first') {
  2359. noteOrders[index] = 'order-last';
  2360. } else {
  2361. noteOrders[index] = 'order-first';
  2362. }
  2363. } else {
  2364. noteOrders[index] = noteOrders[index - 1];
  2365. }
  2366. });
  2367. return noteOrders;
  2368. }
  2369. }
  2370. });
  2371. /***/ }),
  2372. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  2373. /*!**************************************************************************************************************************************************************************!*\
  2374. !*** ./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& ***!
  2375. \**************************************************************************************************************************************************************************/
  2376. /*! exports provided: default */
  2377. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2378. "use strict";
  2379. __webpack_require__.r(__webpack_exports__);
  2380. /* harmony import */ var _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Modal.vue */ "./resources/js/components/Modal.vue");
  2381. /* harmony import */ var _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AutocompleteCustomDropdown.vue */ "./resources/js/components/AutocompleteCustomDropdown.vue");
  2382. /* harmony import */ var _components_ErrorList_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/ErrorList.vue */ "./resources/js/components/ErrorList.vue");
  2383. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2384. //
  2385. //
  2386. //
  2387. //
  2388. //
  2389. //
  2390. //
  2391. //
  2392. //
  2393. //
  2394. //
  2395. //
  2396. //
  2397. //
  2398. //
  2399. //
  2400. //
  2401. //
  2402. //
  2403. //
  2404. //
  2405. //
  2406. //
  2407. //
  2408. //
  2409. //
  2410. //
  2411. //
  2412. //
  2413. //
  2414. //
  2415. //
  2416. //
  2417. //
  2418. //
  2419. //
  2420. /* harmony default export */ __webpack_exports__["default"] = ({
  2421. components: {
  2422. Modal: _components_Modal_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2423. AutocompleteCustomDropdown: _components_AutocompleteCustomDropdown_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  2424. ErrorList: _components_ErrorList_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  2425. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_3__["default"]
  2426. },
  2427. props: {
  2428. populateWith: {
  2429. type: Object,
  2430. required: true
  2431. },
  2432. storeList: {
  2433. type: Object,
  2434. required: true
  2435. },
  2436. modalId: {
  2437. type: String,
  2438. required: true
  2439. }
  2440. },
  2441. data: function data() {
  2442. return {
  2443. // Copies object from prop, so it doesn't mutate the object
  2444. // from the parent component. Parent component will be updated via
  2445. // Websocket if updateWorkOrder is successful.
  2446. data: JSON.parse(JSON.stringify(this.populateWith)),
  2447. id: this.modalId,
  2448. store: {},
  2449. errors: [],
  2450. woInfoSaving: false
  2451. };
  2452. },
  2453. methods: {
  2454. updateWorkOrder: function updateWorkOrder() {
  2455. var _this = this;
  2456. this.woInfoSaving = true;
  2457. this.data.storeid = this.store.id;
  2458. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2459. _this.woInfoSaving = false;
  2460. $('#workordereditModal').modal('hide');
  2461. })["catch"](function (error) {
  2462. _this.woInfoSaving = false;
  2463. _this.errors = JSON.parse(error.response.request.response).errors;
  2464. });
  2465. }
  2466. },
  2467. mounted: function mounted() {
  2468. this.store = {
  2469. 'id': this.data.storeid,
  2470. 'name': this.storeList[this.data.storeid]
  2471. };
  2472. },
  2473. // This was originally here because the populateWith info would originally
  2474. // not necessarily be loaded when this component was mounted. That is no
  2475. // longer the case as I now don't render the parent component until the
  2476. // ajax request is finised. The watch statements are still here to cover
  2477. // the case where someone else updates the populateWith values while
  2478. // someone is editing, although it probably should be edited so it doesn't
  2479. // immediately overwrite the unsaved edits of the current user.
  2480. watch: {
  2481. populateWith: function populateWith(value) {
  2482. this.data = JSON.parse(JSON.stringify(this.populateWith));
  2483. this.store = {
  2484. 'id': this.data.storeid,
  2485. 'name': this.storeList[this.data.storeid]
  2486. };
  2487. },
  2488. storeList: function storeList(value) {
  2489. this.store = {
  2490. 'id': this.data.storeid,
  2491. 'name': this.storeList[this.data.storeid]
  2492. };
  2493. }
  2494. }
  2495. });
  2496. /***/ }),
  2497. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  2498. /*!************************************************************************************************************************************************************************!*\
  2499. !*** ./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& ***!
  2500. \************************************************************************************************************************************************************************/
  2501. /*! exports provided: default */
  2502. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2503. "use strict";
  2504. __webpack_require__.r(__webpack_exports__);
  2505. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2506. /* harmony import */ var _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/WoInfoEditModal */ "./resources/js/components/WoInfoEditModal.vue");
  2507. //
  2508. //
  2509. //
  2510. //
  2511. //
  2512. //
  2513. //
  2514. //
  2515. //
  2516. //
  2517. //
  2518. //
  2519. //
  2520. //
  2521. //
  2522. //
  2523. //
  2524. //
  2525. //
  2526. //
  2527. /* harmony default export */ __webpack_exports__["default"] = ({
  2528. components: {
  2529. WoInfoEditModal: _components_WoInfoEditModal__WEBPACK_IMPORTED_MODULE_1__["default"]
  2530. },
  2531. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2532. props: ['workOrder', 'stores'],
  2533. computed: {
  2534. storeList: function storeList() {
  2535. var list = {};
  2536. Object.values(this.stores).map(function (val) {
  2537. list[val.storeid] = val.storesname;
  2538. });
  2539. return list;
  2540. }
  2541. }
  2542. });
  2543. /***/ }),
  2544. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/App.vue?vue&type=script&lang=js&":
  2545. /*!*********************************************************************************************************************************************************!*\
  2546. !*** ./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& ***!
  2547. \*********************************************************************************************************************************************************/
  2548. /*! exports provided: default */
  2549. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2550. "use strict";
  2551. __webpack_require__.r(__webpack_exports__);
  2552. //
  2553. //
  2554. //
  2555. //
  2556. //
  2557. //
  2558. //
  2559. //
  2560. //
  2561. //
  2562. //
  2563. //
  2564. //
  2565. //
  2566. //
  2567. //
  2568. //
  2569. //
  2570. //
  2571. //
  2572. //
  2573. //
  2574. //
  2575. //
  2576. //
  2577. //
  2578. //
  2579. //
  2580. //
  2581. //
  2582. //
  2583. //
  2584. //
  2585. //
  2586. //
  2587. //
  2588. //
  2589. //
  2590. //
  2591. //
  2592. //
  2593. //
  2594. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  2624. data: function data() {
  2625. return {
  2626. isLoggedIn: null,
  2627. username: null
  2628. };
  2629. },
  2630. mounted: function mounted() {
  2631. this.isLoggedIn = localStorage.getItem('jwt');
  2632. this.username = localStorage.getItem('user');
  2633. }
  2634. });
  2635. /***/ }),
  2636. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  2637. /*!***************************************************************************************************************************************************************!*\
  2638. !*** ./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& ***!
  2639. \***************************************************************************************************************************************************************/
  2640. /*! exports provided: default */
  2641. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2642. "use strict";
  2643. __webpack_require__.r(__webpack_exports__);
  2644. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2645. //
  2646. //
  2647. //
  2648. //
  2649. //
  2650. //
  2651. //
  2652. //
  2653. //
  2654. //
  2655. //
  2656. //
  2657. //
  2658. //
  2659. //
  2660. //
  2661. //
  2662. //
  2663. //
  2664. //
  2665. //
  2666. //
  2667. //
  2668. //
  2669. //
  2670. //
  2671. /* harmony default export */ __webpack_exports__["default"] = ({
  2672. components: {
  2673. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_0__["default"]
  2674. },
  2675. data: function data() {
  2676. return {
  2677. workOrders: [],
  2678. isLoading: true
  2679. };
  2680. },
  2681. mounted: function mounted() {
  2682. var _this = this;
  2683. var token = localStorage.getItem('jwt');
  2684. var user = localStorage.getItem('user');
  2685. axios.defaults.headers.common['Content-Type'] = 'application/json';
  2686. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;
  2687. axios.get('api/users/' + user + '/workorders').then(function (response) {
  2688. _this.workOrders = response.data;
  2689. _this.isLoading = false;
  2690. })["catch"](function (error) {
  2691. console.log(error);
  2692. });
  2693. },
  2694. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2695. if (!localStorage.getItem('jwt')) {
  2696. return next('login');
  2697. }
  2698. next();
  2699. }
  2700. });
  2701. /***/ }),
  2702. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Login.vue?vue&type=script&lang=js&":
  2703. /*!***********************************************************************************************************************************************************!*\
  2704. !*** ./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& ***!
  2705. \***********************************************************************************************************************************************************/
  2706. /*! exports provided: default */
  2707. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2708. "use strict";
  2709. __webpack_require__.r(__webpack_exports__);
  2710. //
  2711. //
  2712. //
  2713. //
  2714. //
  2715. //
  2716. //
  2717. //
  2718. //
  2719. //
  2720. //
  2721. //
  2722. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  2750. data: function data() {
  2751. return {
  2752. username: "",
  2753. password: ""
  2754. };
  2755. },
  2756. methods: {
  2757. handleSubmit: function handleSubmit(e) {
  2758. var _this = this;
  2759. e.preventDefault();
  2760. if (this.password.length > 0) {
  2761. axios.post('api/login', {
  2762. username: this.username,
  2763. password: this.password
  2764. }).then(function (response) {
  2765. localStorage.setItem('user', response.data.success.username);
  2766. localStorage.setItem('jwt', response.data.success.token);
  2767. if (localStorage.getItem('jwt') != null) {
  2768. _this.$router.go('/dashboard');
  2769. }
  2770. })["catch"](function (error) {
  2771. console.error(error);
  2772. });
  2773. }
  2774. }
  2775. },
  2776. beforeRouteEnter: function beforeRouteEnter(to, from, next) {
  2777. if (localStorage.getItem('jwt')) {
  2778. return next('dashboard');
  2779. }
  2780. next();
  2781. }
  2782. });
  2783. /***/ }),
  2784. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  2785. /*!*************************************************************************************************************************************************************!*\
  2786. !*** ./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& ***!
  2787. \*************************************************************************************************************************************************************/
  2788. /*! exports provided: default */
  2789. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2790. "use strict";
  2791. __webpack_require__.r(__webpack_exports__);
  2792. //
  2793. //
  2794. //
  2795. //
  2796. //
  2797. //
  2798. //
  2799. //
  2800. //
  2801. //
  2802. //
  2803. //
  2804. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({});
  2844. /***/ }),
  2845. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  2846. /*!***************************************************************************************************************************************************************!*\
  2847. !*** ./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& ***!
  2848. \***************************************************************************************************************************************************************/
  2849. /*! exports provided: default */
  2850. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2851. "use strict";
  2852. __webpack_require__.r(__webpack_exports__);
  2853. /* harmony import */ var _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/WorkOrderInfo.vue */ "./resources/js/components/WorkOrderInfo.vue");
  2854. /* harmony import */ var _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/AssetInfo.vue */ "./resources/js/components/AssetInfo.vue");
  2855. /* harmony import */ var _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/CircleSpinner.vue */ "./resources/js/components/CircleSpinner.vue");
  2856. /* harmony import */ var _components_CredentialList_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/CredentialList.vue */ "./resources/js/components/CredentialList.vue");
  2857. /* harmony import */ var _components_Notes_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../components/Notes.vue */ "./resources/js/components/Notes.vue");
  2858. //
  2859. //
  2860. //
  2861. //
  2862. //
  2863. //
  2864. //
  2865. //
  2866. //
  2867. //
  2868. //
  2869. //
  2870. //
  2871. //
  2872. //
  2873. //
  2874. //
  2875. //
  2876. //
  2877. //
  2878. //
  2879. //
  2880. //
  2881. //
  2882. //
  2883. //
  2884. //
  2885. //
  2886. //
  2887. //
  2888. //
  2889. //
  2890. //
  2891. //
  2892. //
  2893. //
  2894. //
  2895. //
  2896. //
  2897. //
  2898. //
  2899. //
  2900. //
  2901. //
  2902. //
  2903. //
  2904. //
  2905. //
  2906. //
  2907. //
  2908. //
  2909. //
  2910. //
  2911. //
  2912. //
  2913. //
  2914. //
  2915. //
  2916. //
  2917. //
  2918. //
  2919. //
  2920. //
  2921. //
  2922. //
  2923. //
  2924. //
  2925. //
  2926. //
  2927. //
  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. /* harmony default export */ __webpack_exports__["default"] = ({
  2960. components: {
  2961. WorkOrderInfo: _components_WorkOrderInfo_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
  2962. AssetInfo: _components_AssetInfo_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
  2963. CircleSpinner: _components_CircleSpinner_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
  2964. CredentialList: _components_CredentialList_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
  2965. Notes: _components_Notes_vue__WEBPACK_IMPORTED_MODULE_4__["default"]
  2966. },
  2967. props: {
  2968. id: {
  2969. type: String,
  2970. required: true
  2971. }
  2972. },
  2973. data: function data() {
  2974. return {
  2975. workOrder: {},
  2976. asset: {},
  2977. stores: {},
  2978. credentials: {},
  2979. credentialDescriptions: {},
  2980. workOrderNotes: [],
  2981. woLoading: true,
  2982. assetLoading: true,
  2983. storesLoading: true,
  2984. credentialsLoading: true,
  2985. credentialDescriptionsLoading: true,
  2986. workOrderNotesLoading: true,
  2987. authUser: localStorage.getItem('user')
  2988. };
  2989. },
  2990. computed: {
  2991. publicNotes: function publicNotes() {
  2992. var notes = [];
  2993. notes = this.workOrderNotes.filter(function (note) {
  2994. return note.notetype === 0;
  2995. });
  2996. return notes;
  2997. },
  2998. privateNotes: function privateNotes() {
  2999. var notes = [];
  3000. notes = this.workOrderNotes.filter(function (note) {
  3001. return note.notetype === 1;
  3002. });
  3003. return notes;
  3004. }
  3005. },
  3006. mounted: function mounted() {
  3007. var _this = this;
  3008. // Get authentication info from current user from local storage
  3009. var token = localStorage.getItem('jwt');
  3010. var user = localStorage.getItem('user'); // Set some axios config options for Content-Type and Authentication.
  3011. axios.defaults.headers.common['Content-Type'] = 'application/json';
  3012. axios.defaults.headers.common['Authorization'] = 'Bearer ' + token; // Get WorkOrder from API
  3013. axios.get('/api/workorders/' + this.id).then(function (response) {
  3014. _this.workOrder = response.data;
  3015. _this.woLoading = false;
  3016. })["catch"](function (error) {
  3017. console.log(error);
  3018. }); // Get list of stores from API
  3019. axios.get('/api/stores/').then(function (response) {
  3020. _this.stores = response.data;
  3021. _this.storesLoading = false;
  3022. })["catch"](function (error) {
  3023. console.log(error);
  3024. }); // Get Asset from API (will most likely be replaced with list of assets
  3025. // in the future. Current each WO can only have one but that is likely
  3026. // to change)
  3027. axios.get("/api/workorders/".concat(this.id, "/asset")).then(function (response) {
  3028. _this.asset = response.data;
  3029. _this.assetLoading = false; // Establish listener for liveupdate broadcasts.
  3030. // Must be done here or we can't guarantee this.asset
  3031. // exists by the time we execute this code.
  3032. Echo.channel('asset.' + _this.asset.pcid).listen('AssetUpdated', function (e) {
  3033. _this.asset = e.data;
  3034. }); // Get Credentials for this asset. May be relocated to be part of asset
  3035. // Component when WOs can have more than one asset.
  3036. axios.get("/api/assets/".concat(_this.asset.pcid, "/credentials")).then(function (response) {
  3037. _this.credentials = response.data;
  3038. _this.credentialsLoading = false;
  3039. })["catch"](function (error) {
  3040. console.log(error);
  3041. }); // Get default list of Credential Descriptions. May be relocated along with
  3042. // the above.
  3043. axios.get('/api/credentials/descriptions').then(function (response) {
  3044. _this.credentialDescriptions = response.data;
  3045. _this.credentialDescriptionsLoading = false;
  3046. })["catch"](function (error) {
  3047. console.log(error);
  3048. });
  3049. })["catch"](function (error) {
  3050. console.log(error);
  3051. });
  3052. axios.get("/api/workorders/".concat(this.id, "/notes")).then(function (response) {
  3053. _this.workOrderNotes = response.data;
  3054. _this.workOrderNotesLoading = false;
  3055. })["catch"](function (error) {
  3056. console.log(error);
  3057. });
  3058. Echo.channel('work-order.' + this.id).listen('WorkOrderUpdated', function (e) {
  3059. _this.workOrder = e.data;
  3060. });
  3061. Echo.channel('wonotes.' + this.id).listen('WorkOrderNoteAdded', function (e) {
  3062. _this.workOrderNotes.push(e.note);
  3063. }).listen('WorkOrderNoteUpdated', function (e) {
  3064. var index = _this.workOrderNotes.findIndex(function (note) {
  3065. return note.noteid === e.note.noteid;
  3066. }); // Note has to be edited this way, or else Vue cannot
  3067. // see it to recompute the computed values.
  3068. _this.workOrderNotes.splice(index, 1, e.note);
  3069. }).listen('WorkOrderNoteDeleted', function (e) {
  3070. var index = _this.notes.findIndex(function (note) {
  3071. return note.noteid === e.noteid;
  3072. });
  3073. _this.notes.splice(index, 1);
  3074. });
  3075. }
  3076. });
  3077. /***/ }),
  3078. /***/ "./node_modules/base64-js/index.js":
  3079. /*!*****************************************!*\
  3080. !*** ./node_modules/base64-js/index.js ***!
  3081. \*****************************************/
  3082. /*! no static exports found */
  3083. /***/ (function(module, exports, __webpack_require__) {
  3084. "use strict";
  3085. exports.byteLength = byteLength
  3086. exports.toByteArray = toByteArray
  3087. exports.fromByteArray = fromByteArray
  3088. var lookup = []
  3089. var revLookup = []
  3090. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  3091. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  3092. for (var i = 0, len = code.length; i < len; ++i) {
  3093. lookup[i] = code[i]
  3094. revLookup[code.charCodeAt(i)] = i
  3095. }
  3096. // Support decoding URL-safe base64 strings, as Node.js does.
  3097. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  3098. revLookup['-'.charCodeAt(0)] = 62
  3099. revLookup['_'.charCodeAt(0)] = 63
  3100. function getLens (b64) {
  3101. var len = b64.length
  3102. if (len % 4 > 0) {
  3103. throw new Error('Invalid string. Length must be a multiple of 4')
  3104. }
  3105. // Trim off extra bytes after placeholder bytes are found
  3106. // See: https://github.com/beatgammit/base64-js/issues/42
  3107. var validLen = b64.indexOf('=')
  3108. if (validLen === -1) validLen = len
  3109. var placeHoldersLen = validLen === len
  3110. ? 0
  3111. : 4 - (validLen % 4)
  3112. return [validLen, placeHoldersLen]
  3113. }
  3114. // base64 is 4/3 + up to two characters of the original data
  3115. function byteLength (b64) {
  3116. var lens = getLens(b64)
  3117. var validLen = lens[0]
  3118. var placeHoldersLen = lens[1]
  3119. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  3120. }
  3121. function _byteLength (b64, validLen, placeHoldersLen) {
  3122. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  3123. }
  3124. function toByteArray (b64) {
  3125. var tmp
  3126. var lens = getLens(b64)
  3127. var validLen = lens[0]
  3128. var placeHoldersLen = lens[1]
  3129. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  3130. var curByte = 0
  3131. // if there are placeholders, only get up to the last complete 4 chars
  3132. var len = placeHoldersLen > 0
  3133. ? validLen - 4
  3134. : validLen
  3135. var i
  3136. for (i = 0; i < len; i += 4) {
  3137. tmp =
  3138. (revLookup[b64.charCodeAt(i)] << 18) |
  3139. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  3140. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  3141. revLookup[b64.charCodeAt(i + 3)]
  3142. arr[curByte++] = (tmp >> 16) & 0xFF
  3143. arr[curByte++] = (tmp >> 8) & 0xFF
  3144. arr[curByte++] = tmp & 0xFF
  3145. }
  3146. if (placeHoldersLen === 2) {
  3147. tmp =
  3148. (revLookup[b64.charCodeAt(i)] << 2) |
  3149. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  3150. arr[curByte++] = tmp & 0xFF
  3151. }
  3152. if (placeHoldersLen === 1) {
  3153. tmp =
  3154. (revLookup[b64.charCodeAt(i)] << 10) |
  3155. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  3156. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  3157. arr[curByte++] = (tmp >> 8) & 0xFF
  3158. arr[curByte++] = tmp & 0xFF
  3159. }
  3160. return arr
  3161. }
  3162. function tripletToBase64 (num) {
  3163. return lookup[num >> 18 & 0x3F] +
  3164. lookup[num >> 12 & 0x3F] +
  3165. lookup[num >> 6 & 0x3F] +
  3166. lookup[num & 0x3F]
  3167. }
  3168. function encodeChunk (uint8, start, end) {
  3169. var tmp
  3170. var output = []
  3171. for (var i = start; i < end; i += 3) {
  3172. tmp =
  3173. ((uint8[i] << 16) & 0xFF0000) +
  3174. ((uint8[i + 1] << 8) & 0xFF00) +
  3175. (uint8[i + 2] & 0xFF)
  3176. output.push(tripletToBase64(tmp))
  3177. }
  3178. return output.join('')
  3179. }
  3180. function fromByteArray (uint8) {
  3181. var tmp
  3182. var len = uint8.length
  3183. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  3184. var parts = []
  3185. var maxChunkLength = 16383 // must be multiple of 3
  3186. // go through the array every three bytes, we'll deal with trailing stuff later
  3187. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  3188. parts.push(encodeChunk(
  3189. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  3190. ))
  3191. }
  3192. // pad the end with zeros, but make sure to not forget the extra bytes
  3193. if (extraBytes === 1) {
  3194. tmp = uint8[len - 1]
  3195. parts.push(
  3196. lookup[tmp >> 2] +
  3197. lookup[(tmp << 4) & 0x3F] +
  3198. '=='
  3199. )
  3200. } else if (extraBytes === 2) {
  3201. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  3202. parts.push(
  3203. lookup[tmp >> 10] +
  3204. lookup[(tmp >> 4) & 0x3F] +
  3205. lookup[(tmp << 2) & 0x3F] +
  3206. '='
  3207. )
  3208. }
  3209. return parts.join('')
  3210. }
  3211. /***/ }),
  3212. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  3213. /*!*****************************************************!*\
  3214. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  3215. \*****************************************************/
  3216. /*! no static exports found */
  3217. /***/ (function(module, exports, __webpack_require__) {
  3218. /*!
  3219. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  3220. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  3221. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3222. */
  3223. (function (global, factory) {
  3224. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  3225. undefined;
  3226. }(this, (function (exports, $, Popper) { 'use strict';
  3227. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  3228. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  3229. function _defineProperties(target, props) {
  3230. for (var i = 0; i < props.length; i++) {
  3231. var descriptor = props[i];
  3232. descriptor.enumerable = descriptor.enumerable || false;
  3233. descriptor.configurable = true;
  3234. if ("value" in descriptor) descriptor.writable = true;
  3235. Object.defineProperty(target, descriptor.key, descriptor);
  3236. }
  3237. }
  3238. function _createClass(Constructor, protoProps, staticProps) {
  3239. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  3240. if (staticProps) _defineProperties(Constructor, staticProps);
  3241. return Constructor;
  3242. }
  3243. function _defineProperty(obj, key, value) {
  3244. if (key in obj) {
  3245. Object.defineProperty(obj, key, {
  3246. value: value,
  3247. enumerable: true,
  3248. configurable: true,
  3249. writable: true
  3250. });
  3251. } else {
  3252. obj[key] = value;
  3253. }
  3254. return obj;
  3255. }
  3256. function ownKeys(object, enumerableOnly) {
  3257. var keys = Object.keys(object);
  3258. if (Object.getOwnPropertySymbols) {
  3259. var symbols = Object.getOwnPropertySymbols(object);
  3260. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  3261. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  3262. });
  3263. keys.push.apply(keys, symbols);
  3264. }
  3265. return keys;
  3266. }
  3267. function _objectSpread2(target) {
  3268. for (var i = 1; i < arguments.length; i++) {
  3269. var source = arguments[i] != null ? arguments[i] : {};
  3270. if (i % 2) {
  3271. ownKeys(Object(source), true).forEach(function (key) {
  3272. _defineProperty(target, key, source[key]);
  3273. });
  3274. } else if (Object.getOwnPropertyDescriptors) {
  3275. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  3276. } else {
  3277. ownKeys(Object(source)).forEach(function (key) {
  3278. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  3279. });
  3280. }
  3281. }
  3282. return target;
  3283. }
  3284. function _inheritsLoose(subClass, superClass) {
  3285. subClass.prototype = Object.create(superClass.prototype);
  3286. subClass.prototype.constructor = subClass;
  3287. subClass.__proto__ = superClass;
  3288. }
  3289. /**
  3290. * --------------------------------------------------------------------------
  3291. * Bootstrap (v4.4.1): util.js
  3292. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  3293. * --------------------------------------------------------------------------
  3294. */
  3295. /**
  3296. * ------------------------------------------------------------------------
  3297. * Private TransitionEnd Helpers
  3298. * ------------------------------------------------------------------------
  3299. */
  3300. var TRANSITION_END = 'transitionend';
  3301. var MAX_UID = 1000000;
  3302. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  3303. function toType(obj) {
  3304. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  3305. }
  3306. function getSpecialTransitionEndEvent() {
  3307. return {
  3308. bindType: TRANSITION_END,
  3309. delegateType: TRANSITION_END,
  3310. handle: function handle(event) {
  3311. if ($(event.target).is(this)) {
  3312. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  3313. }
  3314. return undefined; // eslint-disable-line no-undefined
  3315. }
  3316. };
  3317. }
  3318. function transitionEndEmulator(duration) {
  3319. var _this = this;
  3320. var called = false;
  3321. $(this).one(Util.TRANSITION_END, function () {
  3322. called = true;
  3323. });
  3324. setTimeout(function () {
  3325. if (!called) {
  3326. Util.triggerTransitionEnd(_this);
  3327. }
  3328. }, duration);
  3329. return this;
  3330. }
  3331. function setTransitionEndSupport() {
  3332. $.fn.emulateTransitionEnd = transitionEndEmulator;
  3333. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  3334. }
  3335. /**
  3336. * --------------------------------------------------------------------------
  3337. * Public Util Api
  3338. * --------------------------------------------------------------------------
  3339. */
  3340. var Util = {
  3341. TRANSITION_END: 'bsTransitionEnd',
  3342. getUID: function getUID(prefix) {
  3343. do {
  3344. // eslint-disable-next-line no-bitwise
  3345. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  3346. } while (document.getElementById(prefix));
  3347. return prefix;
  3348. },
  3349. getSelectorFromElement: function getSelectorFromElement(element) {
  3350. var selector = element.getAttribute('data-target');
  3351. if (!selector || selector === '#') {
  3352. var hrefAttr = element.getAttribute('href');
  3353. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  3354. }
  3355. try {
  3356. return document.querySelector(selector) ? selector : null;
  3357. } catch (err) {
  3358. return null;
  3359. }
  3360. },
  3361. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  3362. if (!element) {
  3363. return 0;
  3364. } // Get transition-duration of the element
  3365. var transitionDuration = $(element).css('transition-duration');
  3366. var transitionDelay = $(element).css('transition-delay');
  3367. var floatTransitionDuration = parseFloat(transitionDuration);
  3368. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  3369. if (!floatTransitionDuration && !floatTransitionDelay) {
  3370. return 0;
  3371. } // If multiple durations are defined, take the first
  3372. transitionDuration = transitionDuration.split(',')[0];
  3373. transitionDelay = transitionDelay.split(',')[0];
  3374. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  3375. },
  3376. reflow: function reflow(element) {
  3377. return element.offsetHeight;
  3378. },
  3379. triggerTransitionEnd: function triggerTransitionEnd(element) {
  3380. $(element).trigger(TRANSITION_END);
  3381. },
  3382. // TODO: Remove in v5
  3383. supportsTransitionEnd: function supportsTransitionEnd() {
  3384. return Boolean(TRANSITION_END);
  3385. },
  3386. isElement: function isElement(obj) {
  3387. return (obj[0] || obj).nodeType;
  3388. },
  3389. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  3390. for (var property in configTypes) {
  3391. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  3392. var expectedTypes = configTypes[property];
  3393. var value = config[property];
  3394. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  3395. if (!new RegExp(expectedTypes).test(valueType)) {
  3396. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  3397. }
  3398. }
  3399. }
  3400. },
  3401. findShadowRoot: function findShadowRoot(element) {
  3402. if (!document.documentElement.attachShadow) {
  3403. return null;
  3404. } // Can find the shadow root otherwise it'll return the document
  3405. if (typeof element.getRootNode === 'function') {
  3406. var root = element.getRootNode();
  3407. return root instanceof ShadowRoot ? root : null;
  3408. }
  3409. if (element instanceof ShadowRoot) {
  3410. return element;
  3411. } // when we don't find a shadow root
  3412. if (!element.parentNode) {
  3413. return null;
  3414. }
  3415. return Util.findShadowRoot(element.parentNode);
  3416. },
  3417. jQueryDetection: function jQueryDetection() {
  3418. if (typeof $ === 'undefined') {
  3419. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  3420. }
  3421. var version = $.fn.jquery.split(' ')[0].split('.');
  3422. var minMajor = 1;
  3423. var ltMajor = 2;
  3424. var minMinor = 9;
  3425. var minPatch = 1;
  3426. var maxMajor = 4;
  3427. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  3428. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  3429. }
  3430. }
  3431. };
  3432. Util.jQueryDetection();
  3433. setTransitionEndSupport();
  3434. /**
  3435. * ------------------------------------------------------------------------
  3436. * Constants
  3437. * ------------------------------------------------------------------------
  3438. */
  3439. var NAME = 'alert';
  3440. var VERSION = '4.4.1';
  3441. var DATA_KEY = 'bs.alert';
  3442. var EVENT_KEY = "." + DATA_KEY;
  3443. var DATA_API_KEY = '.data-api';
  3444. var JQUERY_NO_CONFLICT = $.fn[NAME];
  3445. var Selector = {
  3446. DISMISS: '[data-dismiss="alert"]'
  3447. };
  3448. var Event = {
  3449. CLOSE: "close" + EVENT_KEY,
  3450. CLOSED: "closed" + EVENT_KEY,
  3451. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  3452. };
  3453. var ClassName = {
  3454. ALERT: 'alert',
  3455. FADE: 'fade',
  3456. SHOW: 'show'
  3457. };
  3458. /**
  3459. * ------------------------------------------------------------------------
  3460. * Class Definition
  3461. * ------------------------------------------------------------------------
  3462. */
  3463. var Alert =
  3464. /*#__PURE__*/
  3465. function () {
  3466. function Alert(element) {
  3467. this._element = element;
  3468. } // Getters
  3469. var _proto = Alert.prototype;
  3470. // Public
  3471. _proto.close = function close(element) {
  3472. var rootElement = this._element;
  3473. if (element) {
  3474. rootElement = this._getRootElement(element);
  3475. }
  3476. var customEvent = this._triggerCloseEvent(rootElement);
  3477. if (customEvent.isDefaultPrevented()) {
  3478. return;
  3479. }
  3480. this._removeElement(rootElement);
  3481. };
  3482. _proto.dispose = function dispose() {
  3483. $.removeData(this._element, DATA_KEY);
  3484. this._element = null;
  3485. } // Private
  3486. ;
  3487. _proto._getRootElement = function _getRootElement(element) {
  3488. var selector = Util.getSelectorFromElement(element);
  3489. var parent = false;
  3490. if (selector) {
  3491. parent = document.querySelector(selector);
  3492. }
  3493. if (!parent) {
  3494. parent = $(element).closest("." + ClassName.ALERT)[0];
  3495. }
  3496. return parent;
  3497. };
  3498. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  3499. var closeEvent = $.Event(Event.CLOSE);
  3500. $(element).trigger(closeEvent);
  3501. return closeEvent;
  3502. };
  3503. _proto._removeElement = function _removeElement(element) {
  3504. var _this = this;
  3505. $(element).removeClass(ClassName.SHOW);
  3506. if (!$(element).hasClass(ClassName.FADE)) {
  3507. this._destroyElement(element);
  3508. return;
  3509. }
  3510. var transitionDuration = Util.getTransitionDurationFromElement(element);
  3511. $(element).one(Util.TRANSITION_END, function (event) {
  3512. return _this._destroyElement(element, event);
  3513. }).emulateTransitionEnd(transitionDuration);
  3514. };
  3515. _proto._destroyElement = function _destroyElement(element) {
  3516. $(element).detach().trigger(Event.CLOSED).remove();
  3517. } // Static
  3518. ;
  3519. Alert._jQueryInterface = function _jQueryInterface(config) {
  3520. return this.each(function () {
  3521. var $element = $(this);
  3522. var data = $element.data(DATA_KEY);
  3523. if (!data) {
  3524. data = new Alert(this);
  3525. $element.data(DATA_KEY, data);
  3526. }
  3527. if (config === 'close') {
  3528. data[config](this);
  3529. }
  3530. });
  3531. };
  3532. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  3533. return function (event) {
  3534. if (event) {
  3535. event.preventDefault();
  3536. }
  3537. alertInstance.close(this);
  3538. };
  3539. };
  3540. _createClass(Alert, null, [{
  3541. key: "VERSION",
  3542. get: function get() {
  3543. return VERSION;
  3544. }
  3545. }]);
  3546. return Alert;
  3547. }();
  3548. /**
  3549. * ------------------------------------------------------------------------
  3550. * Data Api implementation
  3551. * ------------------------------------------------------------------------
  3552. */
  3553. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  3554. /**
  3555. * ------------------------------------------------------------------------
  3556. * jQuery
  3557. * ------------------------------------------------------------------------
  3558. */
  3559. $.fn[NAME] = Alert._jQueryInterface;
  3560. $.fn[NAME].Constructor = Alert;
  3561. $.fn[NAME].noConflict = function () {
  3562. $.fn[NAME] = JQUERY_NO_CONFLICT;
  3563. return Alert._jQueryInterface;
  3564. };
  3565. /**
  3566. * ------------------------------------------------------------------------
  3567. * Constants
  3568. * ------------------------------------------------------------------------
  3569. */
  3570. var NAME$1 = 'button';
  3571. var VERSION$1 = '4.4.1';
  3572. var DATA_KEY$1 = 'bs.button';
  3573. var EVENT_KEY$1 = "." + DATA_KEY$1;
  3574. var DATA_API_KEY$1 = '.data-api';
  3575. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  3576. var ClassName$1 = {
  3577. ACTIVE: 'active',
  3578. BUTTON: 'btn',
  3579. FOCUS: 'focus'
  3580. };
  3581. var Selector$1 = {
  3582. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  3583. DATA_TOGGLES: '[data-toggle="buttons"]',
  3584. DATA_TOGGLE: '[data-toggle="button"]',
  3585. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  3586. INPUT: 'input:not([type="hidden"])',
  3587. ACTIVE: '.active',
  3588. BUTTON: '.btn'
  3589. };
  3590. var Event$1 = {
  3591. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  3592. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  3593. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  3594. };
  3595. /**
  3596. * ------------------------------------------------------------------------
  3597. * Class Definition
  3598. * ------------------------------------------------------------------------
  3599. */
  3600. var Button =
  3601. /*#__PURE__*/
  3602. function () {
  3603. function Button(element) {
  3604. this._element = element;
  3605. } // Getters
  3606. var _proto = Button.prototype;
  3607. // Public
  3608. _proto.toggle = function toggle() {
  3609. var triggerChangeEvent = true;
  3610. var addAriaPressed = true;
  3611. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  3612. if (rootElement) {
  3613. var input = this._element.querySelector(Selector$1.INPUT);
  3614. if (input) {
  3615. if (input.type === 'radio') {
  3616. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  3617. triggerChangeEvent = false;
  3618. } else {
  3619. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  3620. if (activeElement) {
  3621. $(activeElement).removeClass(ClassName$1.ACTIVE);
  3622. }
  3623. }
  3624. } else if (input.type === 'checkbox') {
  3625. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  3626. triggerChangeEvent = false;
  3627. }
  3628. } else {
  3629. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  3630. triggerChangeEvent = false;
  3631. }
  3632. if (triggerChangeEvent) {
  3633. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  3634. $(input).trigger('change');
  3635. }
  3636. input.focus();
  3637. addAriaPressed = false;
  3638. }
  3639. }
  3640. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  3641. if (addAriaPressed) {
  3642. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  3643. }
  3644. if (triggerChangeEvent) {
  3645. $(this._element).toggleClass(ClassName$1.ACTIVE);
  3646. }
  3647. }
  3648. };
  3649. _proto.dispose = function dispose() {
  3650. $.removeData(this._element, DATA_KEY$1);
  3651. this._element = null;
  3652. } // Static
  3653. ;
  3654. Button._jQueryInterface = function _jQueryInterface(config) {
  3655. return this.each(function () {
  3656. var data = $(this).data(DATA_KEY$1);
  3657. if (!data) {
  3658. data = new Button(this);
  3659. $(this).data(DATA_KEY$1, data);
  3660. }
  3661. if (config === 'toggle') {
  3662. data[config]();
  3663. }
  3664. });
  3665. };
  3666. _createClass(Button, null, [{
  3667. key: "VERSION",
  3668. get: function get() {
  3669. return VERSION$1;
  3670. }
  3671. }]);
  3672. return Button;
  3673. }();
  3674. /**
  3675. * ------------------------------------------------------------------------
  3676. * Data Api implementation
  3677. * ------------------------------------------------------------------------
  3678. */
  3679. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3680. var button = event.target;
  3681. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  3682. button = $(button).closest(Selector$1.BUTTON)[0];
  3683. }
  3684. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  3685. event.preventDefault(); // work around Firefox bug #1540995
  3686. } else {
  3687. var inputBtn = button.querySelector(Selector$1.INPUT);
  3688. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  3689. event.preventDefault(); // work around Firefox bug #1540995
  3690. return;
  3691. }
  3692. Button._jQueryInterface.call($(button), 'toggle');
  3693. }
  3694. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3695. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  3696. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  3697. });
  3698. $(window).on(Event$1.LOAD_DATA_API, function () {
  3699. // ensure correct active class is set to match the controls' actual values/states
  3700. // find all checkboxes/readio buttons inside data-toggle groups
  3701. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  3702. for (var i = 0, len = buttons.length; i < len; i++) {
  3703. var button = buttons[i];
  3704. var input = button.querySelector(Selector$1.INPUT);
  3705. if (input.checked || input.hasAttribute('checked')) {
  3706. button.classList.add(ClassName$1.ACTIVE);
  3707. } else {
  3708. button.classList.remove(ClassName$1.ACTIVE);
  3709. }
  3710. } // find all button toggles
  3711. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  3712. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  3713. var _button = buttons[_i];
  3714. if (_button.getAttribute('aria-pressed') === 'true') {
  3715. _button.classList.add(ClassName$1.ACTIVE);
  3716. } else {
  3717. _button.classList.remove(ClassName$1.ACTIVE);
  3718. }
  3719. }
  3720. });
  3721. /**
  3722. * ------------------------------------------------------------------------
  3723. * jQuery
  3724. * ------------------------------------------------------------------------
  3725. */
  3726. $.fn[NAME$1] = Button._jQueryInterface;
  3727. $.fn[NAME$1].Constructor = Button;
  3728. $.fn[NAME$1].noConflict = function () {
  3729. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  3730. return Button._jQueryInterface;
  3731. };
  3732. /**
  3733. * ------------------------------------------------------------------------
  3734. * Constants
  3735. * ------------------------------------------------------------------------
  3736. */
  3737. var NAME$2 = 'carousel';
  3738. var VERSION$2 = '4.4.1';
  3739. var DATA_KEY$2 = 'bs.carousel';
  3740. var EVENT_KEY$2 = "." + DATA_KEY$2;
  3741. var DATA_API_KEY$2 = '.data-api';
  3742. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  3743. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  3744. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  3745. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  3746. var SWIPE_THRESHOLD = 40;
  3747. var Default = {
  3748. interval: 5000,
  3749. keyboard: true,
  3750. slide: false,
  3751. pause: 'hover',
  3752. wrap: true,
  3753. touch: true
  3754. };
  3755. var DefaultType = {
  3756. interval: '(number|boolean)',
  3757. keyboard: 'boolean',
  3758. slide: '(boolean|string)',
  3759. pause: '(string|boolean)',
  3760. wrap: 'boolean',
  3761. touch: 'boolean'
  3762. };
  3763. var Direction = {
  3764. NEXT: 'next',
  3765. PREV: 'prev',
  3766. LEFT: 'left',
  3767. RIGHT: 'right'
  3768. };
  3769. var Event$2 = {
  3770. SLIDE: "slide" + EVENT_KEY$2,
  3771. SLID: "slid" + EVENT_KEY$2,
  3772. KEYDOWN: "keydown" + EVENT_KEY$2,
  3773. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3774. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3775. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3776. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3777. TOUCHEND: "touchend" + EVENT_KEY$2,
  3778. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3779. POINTERUP: "pointerup" + EVENT_KEY$2,
  3780. DRAG_START: "dragstart" + EVENT_KEY$2,
  3781. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3782. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3783. };
  3784. var ClassName$2 = {
  3785. CAROUSEL: 'carousel',
  3786. ACTIVE: 'active',
  3787. SLIDE: 'slide',
  3788. RIGHT: 'carousel-item-right',
  3789. LEFT: 'carousel-item-left',
  3790. NEXT: 'carousel-item-next',
  3791. PREV: 'carousel-item-prev',
  3792. ITEM: 'carousel-item',
  3793. POINTER_EVENT: 'pointer-event'
  3794. };
  3795. var Selector$2 = {
  3796. ACTIVE: '.active',
  3797. ACTIVE_ITEM: '.active.carousel-item',
  3798. ITEM: '.carousel-item',
  3799. ITEM_IMG: '.carousel-item img',
  3800. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3801. INDICATORS: '.carousel-indicators',
  3802. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3803. DATA_RIDE: '[data-ride="carousel"]'
  3804. };
  3805. var PointerType = {
  3806. TOUCH: 'touch',
  3807. PEN: 'pen'
  3808. };
  3809. /**
  3810. * ------------------------------------------------------------------------
  3811. * Class Definition
  3812. * ------------------------------------------------------------------------
  3813. */
  3814. var Carousel =
  3815. /*#__PURE__*/
  3816. function () {
  3817. function Carousel(element, config) {
  3818. this._items = null;
  3819. this._interval = null;
  3820. this._activeElement = null;
  3821. this._isPaused = false;
  3822. this._isSliding = false;
  3823. this.touchTimeout = null;
  3824. this.touchStartX = 0;
  3825. this.touchDeltaX = 0;
  3826. this._config = this._getConfig(config);
  3827. this._element = element;
  3828. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3829. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3830. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3831. this._addEventListeners();
  3832. } // Getters
  3833. var _proto = Carousel.prototype;
  3834. // Public
  3835. _proto.next = function next() {
  3836. if (!this._isSliding) {
  3837. this._slide(Direction.NEXT);
  3838. }
  3839. };
  3840. _proto.nextWhenVisible = function nextWhenVisible() {
  3841. // Don't call next when the page isn't visible
  3842. // or the carousel or its parent isn't visible
  3843. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3844. this.next();
  3845. }
  3846. };
  3847. _proto.prev = function prev() {
  3848. if (!this._isSliding) {
  3849. this._slide(Direction.PREV);
  3850. }
  3851. };
  3852. _proto.pause = function pause(event) {
  3853. if (!event) {
  3854. this._isPaused = true;
  3855. }
  3856. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3857. Util.triggerTransitionEnd(this._element);
  3858. this.cycle(true);
  3859. }
  3860. clearInterval(this._interval);
  3861. this._interval = null;
  3862. };
  3863. _proto.cycle = function cycle(event) {
  3864. if (!event) {
  3865. this._isPaused = false;
  3866. }
  3867. if (this._interval) {
  3868. clearInterval(this._interval);
  3869. this._interval = null;
  3870. }
  3871. if (this._config.interval && !this._isPaused) {
  3872. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3873. }
  3874. };
  3875. _proto.to = function to(index) {
  3876. var _this = this;
  3877. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3878. var activeIndex = this._getItemIndex(this._activeElement);
  3879. if (index > this._items.length - 1 || index < 0) {
  3880. return;
  3881. }
  3882. if (this._isSliding) {
  3883. $(this._element).one(Event$2.SLID, function () {
  3884. return _this.to(index);
  3885. });
  3886. return;
  3887. }
  3888. if (activeIndex === index) {
  3889. this.pause();
  3890. this.cycle();
  3891. return;
  3892. }
  3893. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3894. this._slide(direction, this._items[index]);
  3895. };
  3896. _proto.dispose = function dispose() {
  3897. $(this._element).off(EVENT_KEY$2);
  3898. $.removeData(this._element, DATA_KEY$2);
  3899. this._items = null;
  3900. this._config = null;
  3901. this._element = null;
  3902. this._interval = null;
  3903. this._isPaused = null;
  3904. this._isSliding = null;
  3905. this._activeElement = null;
  3906. this._indicatorsElement = null;
  3907. } // Private
  3908. ;
  3909. _proto._getConfig = function _getConfig(config) {
  3910. config = _objectSpread2({}, Default, {}, config);
  3911. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3912. return config;
  3913. };
  3914. _proto._handleSwipe = function _handleSwipe() {
  3915. var absDeltax = Math.abs(this.touchDeltaX);
  3916. if (absDeltax <= SWIPE_THRESHOLD) {
  3917. return;
  3918. }
  3919. var direction = absDeltax / this.touchDeltaX;
  3920. this.touchDeltaX = 0; // swipe left
  3921. if (direction > 0) {
  3922. this.prev();
  3923. } // swipe right
  3924. if (direction < 0) {
  3925. this.next();
  3926. }
  3927. };
  3928. _proto._addEventListeners = function _addEventListeners() {
  3929. var _this2 = this;
  3930. if (this._config.keyboard) {
  3931. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3932. return _this2._keydown(event);
  3933. });
  3934. }
  3935. if (this._config.pause === 'hover') {
  3936. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3937. return _this2.pause(event);
  3938. }).on(Event$2.MOUSELEAVE, function (event) {
  3939. return _this2.cycle(event);
  3940. });
  3941. }
  3942. if (this._config.touch) {
  3943. this._addTouchEventListeners();
  3944. }
  3945. };
  3946. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3947. var _this3 = this;
  3948. if (!this._touchSupported) {
  3949. return;
  3950. }
  3951. var start = function start(event) {
  3952. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3953. _this3.touchStartX = event.originalEvent.clientX;
  3954. } else if (!_this3._pointerEvent) {
  3955. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3956. }
  3957. };
  3958. var move = function move(event) {
  3959. // ensure swiping with one touch and not pinching
  3960. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3961. _this3.touchDeltaX = 0;
  3962. } else {
  3963. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3964. }
  3965. };
  3966. var end = function end(event) {
  3967. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3968. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3969. }
  3970. _this3._handleSwipe();
  3971. if (_this3._config.pause === 'hover') {
  3972. // If it's a touch-enabled device, mouseenter/leave are fired as
  3973. // part of the mouse compatibility events on first tap - the carousel
  3974. // would stop cycling until user tapped out of it;
  3975. // here, we listen for touchend, explicitly pause the carousel
  3976. // (as if it's the second time we tap on it, mouseenter compat event
  3977. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3978. // events to fire) we explicitly restart cycling
  3979. _this3.pause();
  3980. if (_this3.touchTimeout) {
  3981. clearTimeout(_this3.touchTimeout);
  3982. }
  3983. _this3.touchTimeout = setTimeout(function (event) {
  3984. return _this3.cycle(event);
  3985. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3986. }
  3987. };
  3988. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3989. return e.preventDefault();
  3990. });
  3991. if (this._pointerEvent) {
  3992. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3993. return start(event);
  3994. });
  3995. $(this._element).on(Event$2.POINTERUP, function (event) {
  3996. return end(event);
  3997. });
  3998. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3999. } else {
  4000. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  4001. return start(event);
  4002. });
  4003. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  4004. return move(event);
  4005. });
  4006. $(this._element).on(Event$2.TOUCHEND, function (event) {
  4007. return end(event);
  4008. });
  4009. }
  4010. };
  4011. _proto._keydown = function _keydown(event) {
  4012. if (/input|textarea/i.test(event.target.tagName)) {
  4013. return;
  4014. }
  4015. switch (event.which) {
  4016. case ARROW_LEFT_KEYCODE:
  4017. event.preventDefault();
  4018. this.prev();
  4019. break;
  4020. case ARROW_RIGHT_KEYCODE:
  4021. event.preventDefault();
  4022. this.next();
  4023. break;
  4024. }
  4025. };
  4026. _proto._getItemIndex = function _getItemIndex(element) {
  4027. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  4028. return this._items.indexOf(element);
  4029. };
  4030. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  4031. var isNextDirection = direction === Direction.NEXT;
  4032. var isPrevDirection = direction === Direction.PREV;
  4033. var activeIndex = this._getItemIndex(activeElement);
  4034. var lastItemIndex = this._items.length - 1;
  4035. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  4036. if (isGoingToWrap && !this._config.wrap) {
  4037. return activeElement;
  4038. }
  4039. var delta = direction === Direction.PREV ? -1 : 1;
  4040. var itemIndex = (activeIndex + delta) % this._items.length;
  4041. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  4042. };
  4043. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  4044. var targetIndex = this._getItemIndex(relatedTarget);
  4045. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  4046. var slideEvent = $.Event(Event$2.SLIDE, {
  4047. relatedTarget: relatedTarget,
  4048. direction: eventDirectionName,
  4049. from: fromIndex,
  4050. to: targetIndex
  4051. });
  4052. $(this._element).trigger(slideEvent);
  4053. return slideEvent;
  4054. };
  4055. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  4056. if (this._indicatorsElement) {
  4057. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  4058. $(indicators).removeClass(ClassName$2.ACTIVE);
  4059. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  4060. if (nextIndicator) {
  4061. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  4062. }
  4063. }
  4064. };
  4065. _proto._slide = function _slide(direction, element) {
  4066. var _this4 = this;
  4067. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  4068. var activeElementIndex = this._getItemIndex(activeElement);
  4069. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  4070. var nextElementIndex = this._getItemIndex(nextElement);
  4071. var isCycling = Boolean(this._interval);
  4072. var directionalClassName;
  4073. var orderClassName;
  4074. var eventDirectionName;
  4075. if (direction === Direction.NEXT) {
  4076. directionalClassName = ClassName$2.LEFT;
  4077. orderClassName = ClassName$2.NEXT;
  4078. eventDirectionName = Direction.LEFT;
  4079. } else {
  4080. directionalClassName = ClassName$2.RIGHT;
  4081. orderClassName = ClassName$2.PREV;
  4082. eventDirectionName = Direction.RIGHT;
  4083. }
  4084. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  4085. this._isSliding = false;
  4086. return;
  4087. }
  4088. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  4089. if (slideEvent.isDefaultPrevented()) {
  4090. return;
  4091. }
  4092. if (!activeElement || !nextElement) {
  4093. // Some weirdness is happening, so we bail
  4094. return;
  4095. }
  4096. this._isSliding = true;
  4097. if (isCycling) {
  4098. this.pause();
  4099. }
  4100. this._setActiveIndicatorElement(nextElement);
  4101. var slidEvent = $.Event(Event$2.SLID, {
  4102. relatedTarget: nextElement,
  4103. direction: eventDirectionName,
  4104. from: activeElementIndex,
  4105. to: nextElementIndex
  4106. });
  4107. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  4108. $(nextElement).addClass(orderClassName);
  4109. Util.reflow(nextElement);
  4110. $(activeElement).addClass(directionalClassName);
  4111. $(nextElement).addClass(directionalClassName);
  4112. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  4113. if (nextElementInterval) {
  4114. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  4115. this._config.interval = nextElementInterval;
  4116. } else {
  4117. this._config.interval = this._config.defaultInterval || this._config.interval;
  4118. }
  4119. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  4120. $(activeElement).one(Util.TRANSITION_END, function () {
  4121. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  4122. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  4123. _this4._isSliding = false;
  4124. setTimeout(function () {
  4125. return $(_this4._element).trigger(slidEvent);
  4126. }, 0);
  4127. }).emulateTransitionEnd(transitionDuration);
  4128. } else {
  4129. $(activeElement).removeClass(ClassName$2.ACTIVE);
  4130. $(nextElement).addClass(ClassName$2.ACTIVE);
  4131. this._isSliding = false;
  4132. $(this._element).trigger(slidEvent);
  4133. }
  4134. if (isCycling) {
  4135. this.cycle();
  4136. }
  4137. } // Static
  4138. ;
  4139. Carousel._jQueryInterface = function _jQueryInterface(config) {
  4140. return this.each(function () {
  4141. var data = $(this).data(DATA_KEY$2);
  4142. var _config = _objectSpread2({}, Default, {}, $(this).data());
  4143. if (typeof config === 'object') {
  4144. _config = _objectSpread2({}, _config, {}, config);
  4145. }
  4146. var action = typeof config === 'string' ? config : _config.slide;
  4147. if (!data) {
  4148. data = new Carousel(this, _config);
  4149. $(this).data(DATA_KEY$2, data);
  4150. }
  4151. if (typeof config === 'number') {
  4152. data.to(config);
  4153. } else if (typeof action === 'string') {
  4154. if (typeof data[action] === 'undefined') {
  4155. throw new TypeError("No method named \"" + action + "\"");
  4156. }
  4157. data[action]();
  4158. } else if (_config.interval && _config.ride) {
  4159. data.pause();
  4160. data.cycle();
  4161. }
  4162. });
  4163. };
  4164. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  4165. var selector = Util.getSelectorFromElement(this);
  4166. if (!selector) {
  4167. return;
  4168. }
  4169. var target = $(selector)[0];
  4170. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  4171. return;
  4172. }
  4173. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  4174. var slideIndex = this.getAttribute('data-slide-to');
  4175. if (slideIndex) {
  4176. config.interval = false;
  4177. }
  4178. Carousel._jQueryInterface.call($(target), config);
  4179. if (slideIndex) {
  4180. $(target).data(DATA_KEY$2).to(slideIndex);
  4181. }
  4182. event.preventDefault();
  4183. };
  4184. _createClass(Carousel, null, [{
  4185. key: "VERSION",
  4186. get: function get() {
  4187. return VERSION$2;
  4188. }
  4189. }, {
  4190. key: "Default",
  4191. get: function get() {
  4192. return Default;
  4193. }
  4194. }]);
  4195. return Carousel;
  4196. }();
  4197. /**
  4198. * ------------------------------------------------------------------------
  4199. * Data Api implementation
  4200. * ------------------------------------------------------------------------
  4201. */
  4202. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  4203. $(window).on(Event$2.LOAD_DATA_API, function () {
  4204. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  4205. for (var i = 0, len = carousels.length; i < len; i++) {
  4206. var $carousel = $(carousels[i]);
  4207. Carousel._jQueryInterface.call($carousel, $carousel.data());
  4208. }
  4209. });
  4210. /**
  4211. * ------------------------------------------------------------------------
  4212. * jQuery
  4213. * ------------------------------------------------------------------------
  4214. */
  4215. $.fn[NAME$2] = Carousel._jQueryInterface;
  4216. $.fn[NAME$2].Constructor = Carousel;
  4217. $.fn[NAME$2].noConflict = function () {
  4218. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  4219. return Carousel._jQueryInterface;
  4220. };
  4221. /**
  4222. * ------------------------------------------------------------------------
  4223. * Constants
  4224. * ------------------------------------------------------------------------
  4225. */
  4226. var NAME$3 = 'collapse';
  4227. var VERSION$3 = '4.4.1';
  4228. var DATA_KEY$3 = 'bs.collapse';
  4229. var EVENT_KEY$3 = "." + DATA_KEY$3;
  4230. var DATA_API_KEY$3 = '.data-api';
  4231. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  4232. var Default$1 = {
  4233. toggle: true,
  4234. parent: ''
  4235. };
  4236. var DefaultType$1 = {
  4237. toggle: 'boolean',
  4238. parent: '(string|element)'
  4239. };
  4240. var Event$3 = {
  4241. SHOW: "show" + EVENT_KEY$3,
  4242. SHOWN: "shown" + EVENT_KEY$3,
  4243. HIDE: "hide" + EVENT_KEY$3,
  4244. HIDDEN: "hidden" + EVENT_KEY$3,
  4245. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  4246. };
  4247. var ClassName$3 = {
  4248. SHOW: 'show',
  4249. COLLAPSE: 'collapse',
  4250. COLLAPSING: 'collapsing',
  4251. COLLAPSED: 'collapsed'
  4252. };
  4253. var Dimension = {
  4254. WIDTH: 'width',
  4255. HEIGHT: 'height'
  4256. };
  4257. var Selector$3 = {
  4258. ACTIVES: '.show, .collapsing',
  4259. DATA_TOGGLE: '[data-toggle="collapse"]'
  4260. };
  4261. /**
  4262. * ------------------------------------------------------------------------
  4263. * Class Definition
  4264. * ------------------------------------------------------------------------
  4265. */
  4266. var Collapse =
  4267. /*#__PURE__*/
  4268. function () {
  4269. function Collapse(element, config) {
  4270. this._isTransitioning = false;
  4271. this._element = element;
  4272. this._config = this._getConfig(config);
  4273. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  4274. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  4275. for (var i = 0, len = toggleList.length; i < len; i++) {
  4276. var elem = toggleList[i];
  4277. var selector = Util.getSelectorFromElement(elem);
  4278. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  4279. return foundElem === element;
  4280. });
  4281. if (selector !== null && filterElement.length > 0) {
  4282. this._selector = selector;
  4283. this._triggerArray.push(elem);
  4284. }
  4285. }
  4286. this._parent = this._config.parent ? this._getParent() : null;
  4287. if (!this._config.parent) {
  4288. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  4289. }
  4290. if (this._config.toggle) {
  4291. this.toggle();
  4292. }
  4293. } // Getters
  4294. var _proto = Collapse.prototype;
  4295. // Public
  4296. _proto.toggle = function toggle() {
  4297. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  4298. this.hide();
  4299. } else {
  4300. this.show();
  4301. }
  4302. };
  4303. _proto.show = function show() {
  4304. var _this = this;
  4305. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  4306. return;
  4307. }
  4308. var actives;
  4309. var activesData;
  4310. if (this._parent) {
  4311. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  4312. if (typeof _this._config.parent === 'string') {
  4313. return elem.getAttribute('data-parent') === _this._config.parent;
  4314. }
  4315. return elem.classList.contains(ClassName$3.COLLAPSE);
  4316. });
  4317. if (actives.length === 0) {
  4318. actives = null;
  4319. }
  4320. }
  4321. if (actives) {
  4322. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  4323. if (activesData && activesData._isTransitioning) {
  4324. return;
  4325. }
  4326. }
  4327. var startEvent = $.Event(Event$3.SHOW);
  4328. $(this._element).trigger(startEvent);
  4329. if (startEvent.isDefaultPrevented()) {
  4330. return;
  4331. }
  4332. if (actives) {
  4333. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  4334. if (!activesData) {
  4335. $(actives).data(DATA_KEY$3, null);
  4336. }
  4337. }
  4338. var dimension = this._getDimension();
  4339. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  4340. this._element.style[dimension] = 0;
  4341. if (this._triggerArray.length) {
  4342. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  4343. }
  4344. this.setTransitioning(true);
  4345. var complete = function complete() {
  4346. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  4347. _this._element.style[dimension] = '';
  4348. _this.setTransitioning(false);
  4349. $(_this._element).trigger(Event$3.SHOWN);
  4350. };
  4351. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  4352. var scrollSize = "scroll" + capitalizedDimension;
  4353. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4354. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4355. this._element.style[dimension] = this._element[scrollSize] + "px";
  4356. };
  4357. _proto.hide = function hide() {
  4358. var _this2 = this;
  4359. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  4360. return;
  4361. }
  4362. var startEvent = $.Event(Event$3.HIDE);
  4363. $(this._element).trigger(startEvent);
  4364. if (startEvent.isDefaultPrevented()) {
  4365. return;
  4366. }
  4367. var dimension = this._getDimension();
  4368. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  4369. Util.reflow(this._element);
  4370. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  4371. var triggerArrayLength = this._triggerArray.length;
  4372. if (triggerArrayLength > 0) {
  4373. for (var i = 0; i < triggerArrayLength; i++) {
  4374. var trigger = this._triggerArray[i];
  4375. var selector = Util.getSelectorFromElement(trigger);
  4376. if (selector !== null) {
  4377. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  4378. if (!$elem.hasClass(ClassName$3.SHOW)) {
  4379. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  4380. }
  4381. }
  4382. }
  4383. }
  4384. this.setTransitioning(true);
  4385. var complete = function complete() {
  4386. _this2.setTransitioning(false);
  4387. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  4388. };
  4389. this._element.style[dimension] = '';
  4390. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4391. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4392. };
  4393. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  4394. this._isTransitioning = isTransitioning;
  4395. };
  4396. _proto.dispose = function dispose() {
  4397. $.removeData(this._element, DATA_KEY$3);
  4398. this._config = null;
  4399. this._parent = null;
  4400. this._element = null;
  4401. this._triggerArray = null;
  4402. this._isTransitioning = null;
  4403. } // Private
  4404. ;
  4405. _proto._getConfig = function _getConfig(config) {
  4406. config = _objectSpread2({}, Default$1, {}, config);
  4407. config.toggle = Boolean(config.toggle); // Coerce string values
  4408. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  4409. return config;
  4410. };
  4411. _proto._getDimension = function _getDimension() {
  4412. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  4413. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  4414. };
  4415. _proto._getParent = function _getParent() {
  4416. var _this3 = this;
  4417. var parent;
  4418. if (Util.isElement(this._config.parent)) {
  4419. parent = this._config.parent; // It's a jQuery object
  4420. if (typeof this._config.parent.jquery !== 'undefined') {
  4421. parent = this._config.parent[0];
  4422. }
  4423. } else {
  4424. parent = document.querySelector(this._config.parent);
  4425. }
  4426. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  4427. var children = [].slice.call(parent.querySelectorAll(selector));
  4428. $(children).each(function (i, element) {
  4429. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  4430. });
  4431. return parent;
  4432. };
  4433. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  4434. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  4435. if (triggerArray.length) {
  4436. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  4437. }
  4438. } // Static
  4439. ;
  4440. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  4441. var selector = Util.getSelectorFromElement(element);
  4442. return selector ? document.querySelector(selector) : null;
  4443. };
  4444. Collapse._jQueryInterface = function _jQueryInterface(config) {
  4445. return this.each(function () {
  4446. var $this = $(this);
  4447. var data = $this.data(DATA_KEY$3);
  4448. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  4449. if (!data && _config.toggle && /show|hide/.test(config)) {
  4450. _config.toggle = false;
  4451. }
  4452. if (!data) {
  4453. data = new Collapse(this, _config);
  4454. $this.data(DATA_KEY$3, data);
  4455. }
  4456. if (typeof config === 'string') {
  4457. if (typeof data[config] === 'undefined') {
  4458. throw new TypeError("No method named \"" + config + "\"");
  4459. }
  4460. data[config]();
  4461. }
  4462. });
  4463. };
  4464. _createClass(Collapse, null, [{
  4465. key: "VERSION",
  4466. get: function get() {
  4467. return VERSION$3;
  4468. }
  4469. }, {
  4470. key: "Default",
  4471. get: function get() {
  4472. return Default$1;
  4473. }
  4474. }]);
  4475. return Collapse;
  4476. }();
  4477. /**
  4478. * ------------------------------------------------------------------------
  4479. * Data Api implementation
  4480. * ------------------------------------------------------------------------
  4481. */
  4482. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  4483. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  4484. if (event.currentTarget.tagName === 'A') {
  4485. event.preventDefault();
  4486. }
  4487. var $trigger = $(this);
  4488. var selector = Util.getSelectorFromElement(this);
  4489. var selectors = [].slice.call(document.querySelectorAll(selector));
  4490. $(selectors).each(function () {
  4491. var $target = $(this);
  4492. var data = $target.data(DATA_KEY$3);
  4493. var config = data ? 'toggle' : $trigger.data();
  4494. Collapse._jQueryInterface.call($target, config);
  4495. });
  4496. });
  4497. /**
  4498. * ------------------------------------------------------------------------
  4499. * jQuery
  4500. * ------------------------------------------------------------------------
  4501. */
  4502. $.fn[NAME$3] = Collapse._jQueryInterface;
  4503. $.fn[NAME$3].Constructor = Collapse;
  4504. $.fn[NAME$3].noConflict = function () {
  4505. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  4506. return Collapse._jQueryInterface;
  4507. };
  4508. /**
  4509. * ------------------------------------------------------------------------
  4510. * Constants
  4511. * ------------------------------------------------------------------------
  4512. */
  4513. var NAME$4 = 'dropdown';
  4514. var VERSION$4 = '4.4.1';
  4515. var DATA_KEY$4 = 'bs.dropdown';
  4516. var EVENT_KEY$4 = "." + DATA_KEY$4;
  4517. var DATA_API_KEY$4 = '.data-api';
  4518. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  4519. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  4520. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  4521. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  4522. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  4523. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  4524. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  4525. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  4526. var Event$4 = {
  4527. HIDE: "hide" + EVENT_KEY$4,
  4528. HIDDEN: "hidden" + EVENT_KEY$4,
  4529. SHOW: "show" + EVENT_KEY$4,
  4530. SHOWN: "shown" + EVENT_KEY$4,
  4531. CLICK: "click" + EVENT_KEY$4,
  4532. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  4533. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  4534. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  4535. };
  4536. var ClassName$4 = {
  4537. DISABLED: 'disabled',
  4538. SHOW: 'show',
  4539. DROPUP: 'dropup',
  4540. DROPRIGHT: 'dropright',
  4541. DROPLEFT: 'dropleft',
  4542. MENURIGHT: 'dropdown-menu-right',
  4543. MENULEFT: 'dropdown-menu-left',
  4544. POSITION_STATIC: 'position-static'
  4545. };
  4546. var Selector$4 = {
  4547. DATA_TOGGLE: '[data-toggle="dropdown"]',
  4548. FORM_CHILD: '.dropdown form',
  4549. MENU: '.dropdown-menu',
  4550. NAVBAR_NAV: '.navbar-nav',
  4551. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  4552. };
  4553. var AttachmentMap = {
  4554. TOP: 'top-start',
  4555. TOPEND: 'top-end',
  4556. BOTTOM: 'bottom-start',
  4557. BOTTOMEND: 'bottom-end',
  4558. RIGHT: 'right-start',
  4559. RIGHTEND: 'right-end',
  4560. LEFT: 'left-start',
  4561. LEFTEND: 'left-end'
  4562. };
  4563. var Default$2 = {
  4564. offset: 0,
  4565. flip: true,
  4566. boundary: 'scrollParent',
  4567. reference: 'toggle',
  4568. display: 'dynamic',
  4569. popperConfig: null
  4570. };
  4571. var DefaultType$2 = {
  4572. offset: '(number|string|function)',
  4573. flip: 'boolean',
  4574. boundary: '(string|element)',
  4575. reference: '(string|element)',
  4576. display: 'string',
  4577. popperConfig: '(null|object)'
  4578. };
  4579. /**
  4580. * ------------------------------------------------------------------------
  4581. * Class Definition
  4582. * ------------------------------------------------------------------------
  4583. */
  4584. var Dropdown =
  4585. /*#__PURE__*/
  4586. function () {
  4587. function Dropdown(element, config) {
  4588. this._element = element;
  4589. this._popper = null;
  4590. this._config = this._getConfig(config);
  4591. this._menu = this._getMenuElement();
  4592. this._inNavbar = this._detectNavbar();
  4593. this._addEventListeners();
  4594. } // Getters
  4595. var _proto = Dropdown.prototype;
  4596. // Public
  4597. _proto.toggle = function toggle() {
  4598. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  4599. return;
  4600. }
  4601. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  4602. Dropdown._clearMenus();
  4603. if (isActive) {
  4604. return;
  4605. }
  4606. this.show(true);
  4607. };
  4608. _proto.show = function show(usePopper) {
  4609. if (usePopper === void 0) {
  4610. usePopper = false;
  4611. }
  4612. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  4613. return;
  4614. }
  4615. var relatedTarget = {
  4616. relatedTarget: this._element
  4617. };
  4618. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  4619. var parent = Dropdown._getParentFromElement(this._element);
  4620. $(parent).trigger(showEvent);
  4621. if (showEvent.isDefaultPrevented()) {
  4622. return;
  4623. } // Disable totally Popper.js for Dropdown in Navbar
  4624. if (!this._inNavbar && usePopper) {
  4625. /**
  4626. * Check for Popper dependency
  4627. * Popper - https://popper.js.org
  4628. */
  4629. if (typeof Popper === 'undefined') {
  4630. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  4631. }
  4632. var referenceElement = this._element;
  4633. if (this._config.reference === 'parent') {
  4634. referenceElement = parent;
  4635. } else if (Util.isElement(this._config.reference)) {
  4636. referenceElement = this._config.reference; // Check if it's jQuery element
  4637. if (typeof this._config.reference.jquery !== 'undefined') {
  4638. referenceElement = this._config.reference[0];
  4639. }
  4640. } // If boundary is not `scrollParent`, then set position to `static`
  4641. // to allow the menu to "escape" the scroll parent's boundaries
  4642. // https://github.com/twbs/bootstrap/issues/24251
  4643. if (this._config.boundary !== 'scrollParent') {
  4644. $(parent).addClass(ClassName$4.POSITION_STATIC);
  4645. }
  4646. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  4647. } // If this is a touch-enabled device we add extra
  4648. // empty mouseover listeners to the body's immediate children;
  4649. // only needed because of broken event delegation on iOS
  4650. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4651. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  4652. $(document.body).children().on('mouseover', null, $.noop);
  4653. }
  4654. this._element.focus();
  4655. this._element.setAttribute('aria-expanded', true);
  4656. $(this._menu).toggleClass(ClassName$4.SHOW);
  4657. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  4658. };
  4659. _proto.hide = function hide() {
  4660. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  4661. return;
  4662. }
  4663. var relatedTarget = {
  4664. relatedTarget: this._element
  4665. };
  4666. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4667. var parent = Dropdown._getParentFromElement(this._element);
  4668. $(parent).trigger(hideEvent);
  4669. if (hideEvent.isDefaultPrevented()) {
  4670. return;
  4671. }
  4672. if (this._popper) {
  4673. this._popper.destroy();
  4674. }
  4675. $(this._menu).toggleClass(ClassName$4.SHOW);
  4676. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4677. };
  4678. _proto.dispose = function dispose() {
  4679. $.removeData(this._element, DATA_KEY$4);
  4680. $(this._element).off(EVENT_KEY$4);
  4681. this._element = null;
  4682. this._menu = null;
  4683. if (this._popper !== null) {
  4684. this._popper.destroy();
  4685. this._popper = null;
  4686. }
  4687. };
  4688. _proto.update = function update() {
  4689. this._inNavbar = this._detectNavbar();
  4690. if (this._popper !== null) {
  4691. this._popper.scheduleUpdate();
  4692. }
  4693. } // Private
  4694. ;
  4695. _proto._addEventListeners = function _addEventListeners() {
  4696. var _this = this;
  4697. $(this._element).on(Event$4.CLICK, function (event) {
  4698. event.preventDefault();
  4699. event.stopPropagation();
  4700. _this.toggle();
  4701. });
  4702. };
  4703. _proto._getConfig = function _getConfig(config) {
  4704. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  4705. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4706. return config;
  4707. };
  4708. _proto._getMenuElement = function _getMenuElement() {
  4709. if (!this._menu) {
  4710. var parent = Dropdown._getParentFromElement(this._element);
  4711. if (parent) {
  4712. this._menu = parent.querySelector(Selector$4.MENU);
  4713. }
  4714. }
  4715. return this._menu;
  4716. };
  4717. _proto._getPlacement = function _getPlacement() {
  4718. var $parentDropdown = $(this._element.parentNode);
  4719. var placement = AttachmentMap.BOTTOM; // Handle dropup
  4720. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  4721. placement = AttachmentMap.TOP;
  4722. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4723. placement = AttachmentMap.TOPEND;
  4724. }
  4725. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  4726. placement = AttachmentMap.RIGHT;
  4727. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  4728. placement = AttachmentMap.LEFT;
  4729. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4730. placement = AttachmentMap.BOTTOMEND;
  4731. }
  4732. return placement;
  4733. };
  4734. _proto._detectNavbar = function _detectNavbar() {
  4735. return $(this._element).closest('.navbar').length > 0;
  4736. };
  4737. _proto._getOffset = function _getOffset() {
  4738. var _this2 = this;
  4739. var offset = {};
  4740. if (typeof this._config.offset === 'function') {
  4741. offset.fn = function (data) {
  4742. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  4743. return data;
  4744. };
  4745. } else {
  4746. offset.offset = this._config.offset;
  4747. }
  4748. return offset;
  4749. };
  4750. _proto._getPopperConfig = function _getPopperConfig() {
  4751. var popperConfig = {
  4752. placement: this._getPlacement(),
  4753. modifiers: {
  4754. offset: this._getOffset(),
  4755. flip: {
  4756. enabled: this._config.flip
  4757. },
  4758. preventOverflow: {
  4759. boundariesElement: this._config.boundary
  4760. }
  4761. }
  4762. }; // Disable Popper.js if we have a static display
  4763. if (this._config.display === 'static') {
  4764. popperConfig.modifiers.applyStyle = {
  4765. enabled: false
  4766. };
  4767. }
  4768. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4769. } // Static
  4770. ;
  4771. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4772. return this.each(function () {
  4773. var data = $(this).data(DATA_KEY$4);
  4774. var _config = typeof config === 'object' ? config : null;
  4775. if (!data) {
  4776. data = new Dropdown(this, _config);
  4777. $(this).data(DATA_KEY$4, data);
  4778. }
  4779. if (typeof config === 'string') {
  4780. if (typeof data[config] === 'undefined') {
  4781. throw new TypeError("No method named \"" + config + "\"");
  4782. }
  4783. data[config]();
  4784. }
  4785. });
  4786. };
  4787. Dropdown._clearMenus = function _clearMenus(event) {
  4788. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4789. return;
  4790. }
  4791. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4792. for (var i = 0, len = toggles.length; i < len; i++) {
  4793. var parent = Dropdown._getParentFromElement(toggles[i]);
  4794. var context = $(toggles[i]).data(DATA_KEY$4);
  4795. var relatedTarget = {
  4796. relatedTarget: toggles[i]
  4797. };
  4798. if (event && event.type === 'click') {
  4799. relatedTarget.clickEvent = event;
  4800. }
  4801. if (!context) {
  4802. continue;
  4803. }
  4804. var dropdownMenu = context._menu;
  4805. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4806. continue;
  4807. }
  4808. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4809. continue;
  4810. }
  4811. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4812. $(parent).trigger(hideEvent);
  4813. if (hideEvent.isDefaultPrevented()) {
  4814. continue;
  4815. } // If this is a touch-enabled device we remove the extra
  4816. // empty mouseover listeners we added for iOS support
  4817. if ('ontouchstart' in document.documentElement) {
  4818. $(document.body).children().off('mouseover', null, $.noop);
  4819. }
  4820. toggles[i].setAttribute('aria-expanded', 'false');
  4821. if (context._popper) {
  4822. context._popper.destroy();
  4823. }
  4824. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4825. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4826. }
  4827. };
  4828. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4829. var parent;
  4830. var selector = Util.getSelectorFromElement(element);
  4831. if (selector) {
  4832. parent = document.querySelector(selector);
  4833. }
  4834. return parent || element.parentNode;
  4835. } // eslint-disable-next-line complexity
  4836. ;
  4837. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4838. // If not input/textarea:
  4839. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4840. // If input/textarea:
  4841. // - If space key => not a dropdown command
  4842. // - If key is other than escape
  4843. // - If key is not up or down => not a dropdown command
  4844. // - If trigger inside the menu => not a dropdown command
  4845. 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)) {
  4846. return;
  4847. }
  4848. event.preventDefault();
  4849. event.stopPropagation();
  4850. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4851. return;
  4852. }
  4853. var parent = Dropdown._getParentFromElement(this);
  4854. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4855. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4856. return;
  4857. }
  4858. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4859. if (event.which === ESCAPE_KEYCODE) {
  4860. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4861. $(toggle).trigger('focus');
  4862. }
  4863. $(this).trigger('click');
  4864. return;
  4865. }
  4866. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4867. return $(item).is(':visible');
  4868. });
  4869. if (items.length === 0) {
  4870. return;
  4871. }
  4872. var index = items.indexOf(event.target);
  4873. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4874. // Up
  4875. index--;
  4876. }
  4877. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4878. // Down
  4879. index++;
  4880. }
  4881. if (index < 0) {
  4882. index = 0;
  4883. }
  4884. items[index].focus();
  4885. };
  4886. _createClass(Dropdown, null, [{
  4887. key: "VERSION",
  4888. get: function get() {
  4889. return VERSION$4;
  4890. }
  4891. }, {
  4892. key: "Default",
  4893. get: function get() {
  4894. return Default$2;
  4895. }
  4896. }, {
  4897. key: "DefaultType",
  4898. get: function get() {
  4899. return DefaultType$2;
  4900. }
  4901. }]);
  4902. return Dropdown;
  4903. }();
  4904. /**
  4905. * ------------------------------------------------------------------------
  4906. * Data Api implementation
  4907. * ------------------------------------------------------------------------
  4908. */
  4909. $(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) {
  4910. event.preventDefault();
  4911. event.stopPropagation();
  4912. Dropdown._jQueryInterface.call($(this), 'toggle');
  4913. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4914. e.stopPropagation();
  4915. });
  4916. /**
  4917. * ------------------------------------------------------------------------
  4918. * jQuery
  4919. * ------------------------------------------------------------------------
  4920. */
  4921. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4922. $.fn[NAME$4].Constructor = Dropdown;
  4923. $.fn[NAME$4].noConflict = function () {
  4924. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4925. return Dropdown._jQueryInterface;
  4926. };
  4927. /**
  4928. * ------------------------------------------------------------------------
  4929. * Constants
  4930. * ------------------------------------------------------------------------
  4931. */
  4932. var NAME$5 = 'modal';
  4933. var VERSION$5 = '4.4.1';
  4934. var DATA_KEY$5 = 'bs.modal';
  4935. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4936. var DATA_API_KEY$5 = '.data-api';
  4937. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4938. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4939. var Default$3 = {
  4940. backdrop: true,
  4941. keyboard: true,
  4942. focus: true,
  4943. show: true
  4944. };
  4945. var DefaultType$3 = {
  4946. backdrop: '(boolean|string)',
  4947. keyboard: 'boolean',
  4948. focus: 'boolean',
  4949. show: 'boolean'
  4950. };
  4951. var Event$5 = {
  4952. HIDE: "hide" + EVENT_KEY$5,
  4953. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4954. HIDDEN: "hidden" + EVENT_KEY$5,
  4955. SHOW: "show" + EVENT_KEY$5,
  4956. SHOWN: "shown" + EVENT_KEY$5,
  4957. FOCUSIN: "focusin" + EVENT_KEY$5,
  4958. RESIZE: "resize" + EVENT_KEY$5,
  4959. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4960. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4961. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4962. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4963. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4964. };
  4965. var ClassName$5 = {
  4966. SCROLLABLE: 'modal-dialog-scrollable',
  4967. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4968. BACKDROP: 'modal-backdrop',
  4969. OPEN: 'modal-open',
  4970. FADE: 'fade',
  4971. SHOW: 'show',
  4972. STATIC: 'modal-static'
  4973. };
  4974. var Selector$5 = {
  4975. DIALOG: '.modal-dialog',
  4976. MODAL_BODY: '.modal-body',
  4977. DATA_TOGGLE: '[data-toggle="modal"]',
  4978. DATA_DISMISS: '[data-dismiss="modal"]',
  4979. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4980. STICKY_CONTENT: '.sticky-top'
  4981. };
  4982. /**
  4983. * ------------------------------------------------------------------------
  4984. * Class Definition
  4985. * ------------------------------------------------------------------------
  4986. */
  4987. var Modal =
  4988. /*#__PURE__*/
  4989. function () {
  4990. function Modal(element, config) {
  4991. this._config = this._getConfig(config);
  4992. this._element = element;
  4993. this._dialog = element.querySelector(Selector$5.DIALOG);
  4994. this._backdrop = null;
  4995. this._isShown = false;
  4996. this._isBodyOverflowing = false;
  4997. this._ignoreBackdropClick = false;
  4998. this._isTransitioning = false;
  4999. this._scrollbarWidth = 0;
  5000. } // Getters
  5001. var _proto = Modal.prototype;
  5002. // Public
  5003. _proto.toggle = function toggle(relatedTarget) {
  5004. return this._isShown ? this.hide() : this.show(relatedTarget);
  5005. };
  5006. _proto.show = function show(relatedTarget) {
  5007. var _this = this;
  5008. if (this._isShown || this._isTransitioning) {
  5009. return;
  5010. }
  5011. if ($(this._element).hasClass(ClassName$5.FADE)) {
  5012. this._isTransitioning = true;
  5013. }
  5014. var showEvent = $.Event(Event$5.SHOW, {
  5015. relatedTarget: relatedTarget
  5016. });
  5017. $(this._element).trigger(showEvent);
  5018. if (this._isShown || showEvent.isDefaultPrevented()) {
  5019. return;
  5020. }
  5021. this._isShown = true;
  5022. this._checkScrollbar();
  5023. this._setScrollbar();
  5024. this._adjustDialog();
  5025. this._setEscapeEvent();
  5026. this._setResizeEvent();
  5027. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  5028. return _this.hide(event);
  5029. });
  5030. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  5031. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  5032. if ($(event.target).is(_this._element)) {
  5033. _this._ignoreBackdropClick = true;
  5034. }
  5035. });
  5036. });
  5037. this._showBackdrop(function () {
  5038. return _this._showElement(relatedTarget);
  5039. });
  5040. };
  5041. _proto.hide = function hide(event) {
  5042. var _this2 = this;
  5043. if (event) {
  5044. event.preventDefault();
  5045. }
  5046. if (!this._isShown || this._isTransitioning) {
  5047. return;
  5048. }
  5049. var hideEvent = $.Event(Event$5.HIDE);
  5050. $(this._element).trigger(hideEvent);
  5051. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  5052. return;
  5053. }
  5054. this._isShown = false;
  5055. var transition = $(this._element).hasClass(ClassName$5.FADE);
  5056. if (transition) {
  5057. this._isTransitioning = true;
  5058. }
  5059. this._setEscapeEvent();
  5060. this._setResizeEvent();
  5061. $(document).off(Event$5.FOCUSIN);
  5062. $(this._element).removeClass(ClassName$5.SHOW);
  5063. $(this._element).off(Event$5.CLICK_DISMISS);
  5064. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  5065. if (transition) {
  5066. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5067. $(this._element).one(Util.TRANSITION_END, function (event) {
  5068. return _this2._hideModal(event);
  5069. }).emulateTransitionEnd(transitionDuration);
  5070. } else {
  5071. this._hideModal();
  5072. }
  5073. };
  5074. _proto.dispose = function dispose() {
  5075. [window, this._element, this._dialog].forEach(function (htmlElement) {
  5076. return $(htmlElement).off(EVENT_KEY$5);
  5077. });
  5078. /**
  5079. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  5080. * Do not move `document` in `htmlElements` array
  5081. * It will remove `Event.CLICK_DATA_API` event that should remain
  5082. */
  5083. $(document).off(Event$5.FOCUSIN);
  5084. $.removeData(this._element, DATA_KEY$5);
  5085. this._config = null;
  5086. this._element = null;
  5087. this._dialog = null;
  5088. this._backdrop = null;
  5089. this._isShown = null;
  5090. this._isBodyOverflowing = null;
  5091. this._ignoreBackdropClick = null;
  5092. this._isTransitioning = null;
  5093. this._scrollbarWidth = null;
  5094. };
  5095. _proto.handleUpdate = function handleUpdate() {
  5096. this._adjustDialog();
  5097. } // Private
  5098. ;
  5099. _proto._getConfig = function _getConfig(config) {
  5100. config = _objectSpread2({}, Default$3, {}, config);
  5101. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  5102. return config;
  5103. };
  5104. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  5105. var _this3 = this;
  5106. if (this._config.backdrop === 'static') {
  5107. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  5108. $(this._element).trigger(hideEventPrevented);
  5109. if (hideEventPrevented.defaultPrevented) {
  5110. return;
  5111. }
  5112. this._element.classList.add(ClassName$5.STATIC);
  5113. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  5114. $(this._element).one(Util.TRANSITION_END, function () {
  5115. _this3._element.classList.remove(ClassName$5.STATIC);
  5116. }).emulateTransitionEnd(modalTransitionDuration);
  5117. this._element.focus();
  5118. } else {
  5119. this.hide();
  5120. }
  5121. };
  5122. _proto._showElement = function _showElement(relatedTarget) {
  5123. var _this4 = this;
  5124. var transition = $(this._element).hasClass(ClassName$5.FADE);
  5125. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  5126. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  5127. // Don't move modal's DOM position
  5128. document.body.appendChild(this._element);
  5129. }
  5130. this._element.style.display = 'block';
  5131. this._element.removeAttribute('aria-hidden');
  5132. this._element.setAttribute('aria-modal', true);
  5133. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  5134. modalBody.scrollTop = 0;
  5135. } else {
  5136. this._element.scrollTop = 0;
  5137. }
  5138. if (transition) {
  5139. Util.reflow(this._element);
  5140. }
  5141. $(this._element).addClass(ClassName$5.SHOW);
  5142. if (this._config.focus) {
  5143. this._enforceFocus();
  5144. }
  5145. var shownEvent = $.Event(Event$5.SHOWN, {
  5146. relatedTarget: relatedTarget
  5147. });
  5148. var transitionComplete = function transitionComplete() {
  5149. if (_this4._config.focus) {
  5150. _this4._element.focus();
  5151. }
  5152. _this4._isTransitioning = false;
  5153. $(_this4._element).trigger(shownEvent);
  5154. };
  5155. if (transition) {
  5156. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  5157. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  5158. } else {
  5159. transitionComplete();
  5160. }
  5161. };
  5162. _proto._enforceFocus = function _enforceFocus() {
  5163. var _this5 = this;
  5164. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  5165. .on(Event$5.FOCUSIN, function (event) {
  5166. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  5167. _this5._element.focus();
  5168. }
  5169. });
  5170. };
  5171. _proto._setEscapeEvent = function _setEscapeEvent() {
  5172. var _this6 = this;
  5173. if (this._isShown && this._config.keyboard) {
  5174. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  5175. if (event.which === ESCAPE_KEYCODE$1) {
  5176. _this6._triggerBackdropTransition();
  5177. }
  5178. });
  5179. } else if (!this._isShown) {
  5180. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  5181. }
  5182. };
  5183. _proto._setResizeEvent = function _setResizeEvent() {
  5184. var _this7 = this;
  5185. if (this._isShown) {
  5186. $(window).on(Event$5.RESIZE, function (event) {
  5187. return _this7.handleUpdate(event);
  5188. });
  5189. } else {
  5190. $(window).off(Event$5.RESIZE);
  5191. }
  5192. };
  5193. _proto._hideModal = function _hideModal() {
  5194. var _this8 = this;
  5195. this._element.style.display = 'none';
  5196. this._element.setAttribute('aria-hidden', true);
  5197. this._element.removeAttribute('aria-modal');
  5198. this._isTransitioning = false;
  5199. this._showBackdrop(function () {
  5200. $(document.body).removeClass(ClassName$5.OPEN);
  5201. _this8._resetAdjustments();
  5202. _this8._resetScrollbar();
  5203. $(_this8._element).trigger(Event$5.HIDDEN);
  5204. });
  5205. };
  5206. _proto._removeBackdrop = function _removeBackdrop() {
  5207. if (this._backdrop) {
  5208. $(this._backdrop).remove();
  5209. this._backdrop = null;
  5210. }
  5211. };
  5212. _proto._showBackdrop = function _showBackdrop(callback) {
  5213. var _this9 = this;
  5214. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  5215. if (this._isShown && this._config.backdrop) {
  5216. this._backdrop = document.createElement('div');
  5217. this._backdrop.className = ClassName$5.BACKDROP;
  5218. if (animate) {
  5219. this._backdrop.classList.add(animate);
  5220. }
  5221. $(this._backdrop).appendTo(document.body);
  5222. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  5223. if (_this9._ignoreBackdropClick) {
  5224. _this9._ignoreBackdropClick = false;
  5225. return;
  5226. }
  5227. if (event.target !== event.currentTarget) {
  5228. return;
  5229. }
  5230. _this9._triggerBackdropTransition();
  5231. });
  5232. if (animate) {
  5233. Util.reflow(this._backdrop);
  5234. }
  5235. $(this._backdrop).addClass(ClassName$5.SHOW);
  5236. if (!callback) {
  5237. return;
  5238. }
  5239. if (!animate) {
  5240. callback();
  5241. return;
  5242. }
  5243. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  5244. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  5245. } else if (!this._isShown && this._backdrop) {
  5246. $(this._backdrop).removeClass(ClassName$5.SHOW);
  5247. var callbackRemove = function callbackRemove() {
  5248. _this9._removeBackdrop();
  5249. if (callback) {
  5250. callback();
  5251. }
  5252. };
  5253. if ($(this._element).hasClass(ClassName$5.FADE)) {
  5254. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  5255. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  5256. } else {
  5257. callbackRemove();
  5258. }
  5259. } else if (callback) {
  5260. callback();
  5261. }
  5262. } // ----------------------------------------------------------------------
  5263. // the following methods are used to handle overflowing modals
  5264. // todo (fat): these should probably be refactored out of modal.js
  5265. // ----------------------------------------------------------------------
  5266. ;
  5267. _proto._adjustDialog = function _adjustDialog() {
  5268. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  5269. if (!this._isBodyOverflowing && isModalOverflowing) {
  5270. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  5271. }
  5272. if (this._isBodyOverflowing && !isModalOverflowing) {
  5273. this._element.style.paddingRight = this._scrollbarWidth + "px";
  5274. }
  5275. };
  5276. _proto._resetAdjustments = function _resetAdjustments() {
  5277. this._element.style.paddingLeft = '';
  5278. this._element.style.paddingRight = '';
  5279. };
  5280. _proto._checkScrollbar = function _checkScrollbar() {
  5281. var rect = document.body.getBoundingClientRect();
  5282. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  5283. this._scrollbarWidth = this._getScrollbarWidth();
  5284. };
  5285. _proto._setScrollbar = function _setScrollbar() {
  5286. var _this10 = this;
  5287. if (this._isBodyOverflowing) {
  5288. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  5289. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  5290. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  5291. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  5292. $(fixedContent).each(function (index, element) {
  5293. var actualPadding = element.style.paddingRight;
  5294. var calculatedPadding = $(element).css('padding-right');
  5295. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  5296. }); // Adjust sticky content margin
  5297. $(stickyContent).each(function (index, element) {
  5298. var actualMargin = element.style.marginRight;
  5299. var calculatedMargin = $(element).css('margin-right');
  5300. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  5301. }); // Adjust body padding
  5302. var actualPadding = document.body.style.paddingRight;
  5303. var calculatedPadding = $(document.body).css('padding-right');
  5304. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  5305. }
  5306. $(document.body).addClass(ClassName$5.OPEN);
  5307. };
  5308. _proto._resetScrollbar = function _resetScrollbar() {
  5309. // Restore fixed content padding
  5310. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  5311. $(fixedContent).each(function (index, element) {
  5312. var padding = $(element).data('padding-right');
  5313. $(element).removeData('padding-right');
  5314. element.style.paddingRight = padding ? padding : '';
  5315. }); // Restore sticky content
  5316. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  5317. $(elements).each(function (index, element) {
  5318. var margin = $(element).data('margin-right');
  5319. if (typeof margin !== 'undefined') {
  5320. $(element).css('margin-right', margin).removeData('margin-right');
  5321. }
  5322. }); // Restore body padding
  5323. var padding = $(document.body).data('padding-right');
  5324. $(document.body).removeData('padding-right');
  5325. document.body.style.paddingRight = padding ? padding : '';
  5326. };
  5327. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  5328. // thx d.walsh
  5329. var scrollDiv = document.createElement('div');
  5330. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  5331. document.body.appendChild(scrollDiv);
  5332. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  5333. document.body.removeChild(scrollDiv);
  5334. return scrollbarWidth;
  5335. } // Static
  5336. ;
  5337. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  5338. return this.each(function () {
  5339. var data = $(this).data(DATA_KEY$5);
  5340. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  5341. if (!data) {
  5342. data = new Modal(this, _config);
  5343. $(this).data(DATA_KEY$5, data);
  5344. }
  5345. if (typeof config === 'string') {
  5346. if (typeof data[config] === 'undefined') {
  5347. throw new TypeError("No method named \"" + config + "\"");
  5348. }
  5349. data[config](relatedTarget);
  5350. } else if (_config.show) {
  5351. data.show(relatedTarget);
  5352. }
  5353. });
  5354. };
  5355. _createClass(Modal, null, [{
  5356. key: "VERSION",
  5357. get: function get() {
  5358. return VERSION$5;
  5359. }
  5360. }, {
  5361. key: "Default",
  5362. get: function get() {
  5363. return Default$3;
  5364. }
  5365. }]);
  5366. return Modal;
  5367. }();
  5368. /**
  5369. * ------------------------------------------------------------------------
  5370. * Data Api implementation
  5371. * ------------------------------------------------------------------------
  5372. */
  5373. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  5374. var _this11 = this;
  5375. var target;
  5376. var selector = Util.getSelectorFromElement(this);
  5377. if (selector) {
  5378. target = document.querySelector(selector);
  5379. }
  5380. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  5381. if (this.tagName === 'A' || this.tagName === 'AREA') {
  5382. event.preventDefault();
  5383. }
  5384. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  5385. if (showEvent.isDefaultPrevented()) {
  5386. // Only register focus restorer if modal will actually get shown
  5387. return;
  5388. }
  5389. $target.one(Event$5.HIDDEN, function () {
  5390. if ($(_this11).is(':visible')) {
  5391. _this11.focus();
  5392. }
  5393. });
  5394. });
  5395. Modal._jQueryInterface.call($(target), config, this);
  5396. });
  5397. /**
  5398. * ------------------------------------------------------------------------
  5399. * jQuery
  5400. * ------------------------------------------------------------------------
  5401. */
  5402. $.fn[NAME$5] = Modal._jQueryInterface;
  5403. $.fn[NAME$5].Constructor = Modal;
  5404. $.fn[NAME$5].noConflict = function () {
  5405. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  5406. return Modal._jQueryInterface;
  5407. };
  5408. /**
  5409. * --------------------------------------------------------------------------
  5410. * Bootstrap (v4.4.1): tools/sanitizer.js
  5411. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  5412. * --------------------------------------------------------------------------
  5413. */
  5414. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  5415. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  5416. var DefaultWhitelist = {
  5417. // Global attributes allowed on any supplied element below.
  5418. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  5419. a: ['target', 'href', 'title', 'rel'],
  5420. area: [],
  5421. b: [],
  5422. br: [],
  5423. col: [],
  5424. code: [],
  5425. div: [],
  5426. em: [],
  5427. hr: [],
  5428. h1: [],
  5429. h2: [],
  5430. h3: [],
  5431. h4: [],
  5432. h5: [],
  5433. h6: [],
  5434. i: [],
  5435. img: ['src', 'alt', 'title', 'width', 'height'],
  5436. li: [],
  5437. ol: [],
  5438. p: [],
  5439. pre: [],
  5440. s: [],
  5441. small: [],
  5442. span: [],
  5443. sub: [],
  5444. sup: [],
  5445. strong: [],
  5446. u: [],
  5447. ul: []
  5448. };
  5449. /**
  5450. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  5451. *
  5452. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  5453. */
  5454. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  5455. /**
  5456. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  5457. *
  5458. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  5459. */
  5460. 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;
  5461. function allowedAttribute(attr, allowedAttributeList) {
  5462. var attrName = attr.nodeName.toLowerCase();
  5463. if (allowedAttributeList.indexOf(attrName) !== -1) {
  5464. if (uriAttrs.indexOf(attrName) !== -1) {
  5465. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  5466. }
  5467. return true;
  5468. }
  5469. var regExp = allowedAttributeList.filter(function (attrRegex) {
  5470. return attrRegex instanceof RegExp;
  5471. }); // Check if a regular expression validates the attribute.
  5472. for (var i = 0, l = regExp.length; i < l; i++) {
  5473. if (attrName.match(regExp[i])) {
  5474. return true;
  5475. }
  5476. }
  5477. return false;
  5478. }
  5479. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  5480. if (unsafeHtml.length === 0) {
  5481. return unsafeHtml;
  5482. }
  5483. if (sanitizeFn && typeof sanitizeFn === 'function') {
  5484. return sanitizeFn(unsafeHtml);
  5485. }
  5486. var domParser = new window.DOMParser();
  5487. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  5488. var whitelistKeys = Object.keys(whiteList);
  5489. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  5490. var _loop = function _loop(i, len) {
  5491. var el = elements[i];
  5492. var elName = el.nodeName.toLowerCase();
  5493. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  5494. el.parentNode.removeChild(el);
  5495. return "continue";
  5496. }
  5497. var attributeList = [].slice.call(el.attributes);
  5498. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  5499. attributeList.forEach(function (attr) {
  5500. if (!allowedAttribute(attr, whitelistedAttributes)) {
  5501. el.removeAttribute(attr.nodeName);
  5502. }
  5503. });
  5504. };
  5505. for (var i = 0, len = elements.length; i < len; i++) {
  5506. var _ret = _loop(i);
  5507. if (_ret === "continue") continue;
  5508. }
  5509. return createdDocument.body.innerHTML;
  5510. }
  5511. /**
  5512. * ------------------------------------------------------------------------
  5513. * Constants
  5514. * ------------------------------------------------------------------------
  5515. */
  5516. var NAME$6 = 'tooltip';
  5517. var VERSION$6 = '4.4.1';
  5518. var DATA_KEY$6 = 'bs.tooltip';
  5519. var EVENT_KEY$6 = "." + DATA_KEY$6;
  5520. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  5521. var CLASS_PREFIX = 'bs-tooltip';
  5522. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  5523. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  5524. var DefaultType$4 = {
  5525. animation: 'boolean',
  5526. template: 'string',
  5527. title: '(string|element|function)',
  5528. trigger: 'string',
  5529. delay: '(number|object)',
  5530. html: 'boolean',
  5531. selector: '(string|boolean)',
  5532. placement: '(string|function)',
  5533. offset: '(number|string|function)',
  5534. container: '(string|element|boolean)',
  5535. fallbackPlacement: '(string|array)',
  5536. boundary: '(string|element)',
  5537. sanitize: 'boolean',
  5538. sanitizeFn: '(null|function)',
  5539. whiteList: 'object',
  5540. popperConfig: '(null|object)'
  5541. };
  5542. var AttachmentMap$1 = {
  5543. AUTO: 'auto',
  5544. TOP: 'top',
  5545. RIGHT: 'right',
  5546. BOTTOM: 'bottom',
  5547. LEFT: 'left'
  5548. };
  5549. var Default$4 = {
  5550. animation: true,
  5551. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  5552. trigger: 'hover focus',
  5553. title: '',
  5554. delay: 0,
  5555. html: false,
  5556. selector: false,
  5557. placement: 'top',
  5558. offset: 0,
  5559. container: false,
  5560. fallbackPlacement: 'flip',
  5561. boundary: 'scrollParent',
  5562. sanitize: true,
  5563. sanitizeFn: null,
  5564. whiteList: DefaultWhitelist,
  5565. popperConfig: null
  5566. };
  5567. var HoverState = {
  5568. SHOW: 'show',
  5569. OUT: 'out'
  5570. };
  5571. var Event$6 = {
  5572. HIDE: "hide" + EVENT_KEY$6,
  5573. HIDDEN: "hidden" + EVENT_KEY$6,
  5574. SHOW: "show" + EVENT_KEY$6,
  5575. SHOWN: "shown" + EVENT_KEY$6,
  5576. INSERTED: "inserted" + EVENT_KEY$6,
  5577. CLICK: "click" + EVENT_KEY$6,
  5578. FOCUSIN: "focusin" + EVENT_KEY$6,
  5579. FOCUSOUT: "focusout" + EVENT_KEY$6,
  5580. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  5581. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  5582. };
  5583. var ClassName$6 = {
  5584. FADE: 'fade',
  5585. SHOW: 'show'
  5586. };
  5587. var Selector$6 = {
  5588. TOOLTIP: '.tooltip',
  5589. TOOLTIP_INNER: '.tooltip-inner',
  5590. ARROW: '.arrow'
  5591. };
  5592. var Trigger = {
  5593. HOVER: 'hover',
  5594. FOCUS: 'focus',
  5595. CLICK: 'click',
  5596. MANUAL: 'manual'
  5597. };
  5598. /**
  5599. * ------------------------------------------------------------------------
  5600. * Class Definition
  5601. * ------------------------------------------------------------------------
  5602. */
  5603. var Tooltip =
  5604. /*#__PURE__*/
  5605. function () {
  5606. function Tooltip(element, config) {
  5607. if (typeof Popper === 'undefined') {
  5608. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  5609. } // private
  5610. this._isEnabled = true;
  5611. this._timeout = 0;
  5612. this._hoverState = '';
  5613. this._activeTrigger = {};
  5614. this._popper = null; // Protected
  5615. this.element = element;
  5616. this.config = this._getConfig(config);
  5617. this.tip = null;
  5618. this._setListeners();
  5619. } // Getters
  5620. var _proto = Tooltip.prototype;
  5621. // Public
  5622. _proto.enable = function enable() {
  5623. this._isEnabled = true;
  5624. };
  5625. _proto.disable = function disable() {
  5626. this._isEnabled = false;
  5627. };
  5628. _proto.toggleEnabled = function toggleEnabled() {
  5629. this._isEnabled = !this._isEnabled;
  5630. };
  5631. _proto.toggle = function toggle(event) {
  5632. if (!this._isEnabled) {
  5633. return;
  5634. }
  5635. if (event) {
  5636. var dataKey = this.constructor.DATA_KEY;
  5637. var context = $(event.currentTarget).data(dataKey);
  5638. if (!context) {
  5639. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5640. $(event.currentTarget).data(dataKey, context);
  5641. }
  5642. context._activeTrigger.click = !context._activeTrigger.click;
  5643. if (context._isWithActiveTrigger()) {
  5644. context._enter(null, context);
  5645. } else {
  5646. context._leave(null, context);
  5647. }
  5648. } else {
  5649. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  5650. this._leave(null, this);
  5651. return;
  5652. }
  5653. this._enter(null, this);
  5654. }
  5655. };
  5656. _proto.dispose = function dispose() {
  5657. clearTimeout(this._timeout);
  5658. $.removeData(this.element, this.constructor.DATA_KEY);
  5659. $(this.element).off(this.constructor.EVENT_KEY);
  5660. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  5661. if (this.tip) {
  5662. $(this.tip).remove();
  5663. }
  5664. this._isEnabled = null;
  5665. this._timeout = null;
  5666. this._hoverState = null;
  5667. this._activeTrigger = null;
  5668. if (this._popper) {
  5669. this._popper.destroy();
  5670. }
  5671. this._popper = null;
  5672. this.element = null;
  5673. this.config = null;
  5674. this.tip = null;
  5675. };
  5676. _proto.show = function show() {
  5677. var _this = this;
  5678. if ($(this.element).css('display') === 'none') {
  5679. throw new Error('Please use show on visible elements');
  5680. }
  5681. var showEvent = $.Event(this.constructor.Event.SHOW);
  5682. if (this.isWithContent() && this._isEnabled) {
  5683. $(this.element).trigger(showEvent);
  5684. var shadowRoot = Util.findShadowRoot(this.element);
  5685. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  5686. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  5687. return;
  5688. }
  5689. var tip = this.getTipElement();
  5690. var tipId = Util.getUID(this.constructor.NAME);
  5691. tip.setAttribute('id', tipId);
  5692. this.element.setAttribute('aria-describedby', tipId);
  5693. this.setContent();
  5694. if (this.config.animation) {
  5695. $(tip).addClass(ClassName$6.FADE);
  5696. }
  5697. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  5698. var attachment = this._getAttachment(placement);
  5699. this.addAttachmentClass(attachment);
  5700. var container = this._getContainer();
  5701. $(tip).data(this.constructor.DATA_KEY, this);
  5702. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  5703. $(tip).appendTo(container);
  5704. }
  5705. $(this.element).trigger(this.constructor.Event.INSERTED);
  5706. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  5707. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  5708. // empty mouseover listeners to the body's immediate children;
  5709. // only needed because of broken event delegation on iOS
  5710. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  5711. if ('ontouchstart' in document.documentElement) {
  5712. $(document.body).children().on('mouseover', null, $.noop);
  5713. }
  5714. var complete = function complete() {
  5715. if (_this.config.animation) {
  5716. _this._fixTransition();
  5717. }
  5718. var prevHoverState = _this._hoverState;
  5719. _this._hoverState = null;
  5720. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  5721. if (prevHoverState === HoverState.OUT) {
  5722. _this._leave(null, _this);
  5723. }
  5724. };
  5725. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5726. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  5727. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5728. } else {
  5729. complete();
  5730. }
  5731. }
  5732. };
  5733. _proto.hide = function hide(callback) {
  5734. var _this2 = this;
  5735. var tip = this.getTipElement();
  5736. var hideEvent = $.Event(this.constructor.Event.HIDE);
  5737. var complete = function complete() {
  5738. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  5739. tip.parentNode.removeChild(tip);
  5740. }
  5741. _this2._cleanTipClass();
  5742. _this2.element.removeAttribute('aria-describedby');
  5743. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  5744. if (_this2._popper !== null) {
  5745. _this2._popper.destroy();
  5746. }
  5747. if (callback) {
  5748. callback();
  5749. }
  5750. };
  5751. $(this.element).trigger(hideEvent);
  5752. if (hideEvent.isDefaultPrevented()) {
  5753. return;
  5754. }
  5755. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5756. // empty mouseover listeners we added for iOS support
  5757. if ('ontouchstart' in document.documentElement) {
  5758. $(document.body).children().off('mouseover', null, $.noop);
  5759. }
  5760. this._activeTrigger[Trigger.CLICK] = false;
  5761. this._activeTrigger[Trigger.FOCUS] = false;
  5762. this._activeTrigger[Trigger.HOVER] = false;
  5763. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5764. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5765. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5766. } else {
  5767. complete();
  5768. }
  5769. this._hoverState = '';
  5770. };
  5771. _proto.update = function update() {
  5772. if (this._popper !== null) {
  5773. this._popper.scheduleUpdate();
  5774. }
  5775. } // Protected
  5776. ;
  5777. _proto.isWithContent = function isWithContent() {
  5778. return Boolean(this.getTitle());
  5779. };
  5780. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5781. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5782. };
  5783. _proto.getTipElement = function getTipElement() {
  5784. this.tip = this.tip || $(this.config.template)[0];
  5785. return this.tip;
  5786. };
  5787. _proto.setContent = function setContent() {
  5788. var tip = this.getTipElement();
  5789. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5790. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5791. };
  5792. _proto.setElementContent = function setElementContent($element, content) {
  5793. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5794. // Content is a DOM node or a jQuery
  5795. if (this.config.html) {
  5796. if (!$(content).parent().is($element)) {
  5797. $element.empty().append(content);
  5798. }
  5799. } else {
  5800. $element.text($(content).text());
  5801. }
  5802. return;
  5803. }
  5804. if (this.config.html) {
  5805. if (this.config.sanitize) {
  5806. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5807. }
  5808. $element.html(content);
  5809. } else {
  5810. $element.text(content);
  5811. }
  5812. };
  5813. _proto.getTitle = function getTitle() {
  5814. var title = this.element.getAttribute('data-original-title');
  5815. if (!title) {
  5816. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5817. }
  5818. return title;
  5819. } // Private
  5820. ;
  5821. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5822. var _this3 = this;
  5823. var defaultBsConfig = {
  5824. placement: attachment,
  5825. modifiers: {
  5826. offset: this._getOffset(),
  5827. flip: {
  5828. behavior: this.config.fallbackPlacement
  5829. },
  5830. arrow: {
  5831. element: Selector$6.ARROW
  5832. },
  5833. preventOverflow: {
  5834. boundariesElement: this.config.boundary
  5835. }
  5836. },
  5837. onCreate: function onCreate(data) {
  5838. if (data.originalPlacement !== data.placement) {
  5839. _this3._handlePopperPlacementChange(data);
  5840. }
  5841. },
  5842. onUpdate: function onUpdate(data) {
  5843. return _this3._handlePopperPlacementChange(data);
  5844. }
  5845. };
  5846. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5847. };
  5848. _proto._getOffset = function _getOffset() {
  5849. var _this4 = this;
  5850. var offset = {};
  5851. if (typeof this.config.offset === 'function') {
  5852. offset.fn = function (data) {
  5853. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5854. return data;
  5855. };
  5856. } else {
  5857. offset.offset = this.config.offset;
  5858. }
  5859. return offset;
  5860. };
  5861. _proto._getContainer = function _getContainer() {
  5862. if (this.config.container === false) {
  5863. return document.body;
  5864. }
  5865. if (Util.isElement(this.config.container)) {
  5866. return $(this.config.container);
  5867. }
  5868. return $(document).find(this.config.container);
  5869. };
  5870. _proto._getAttachment = function _getAttachment(placement) {
  5871. return AttachmentMap$1[placement.toUpperCase()];
  5872. };
  5873. _proto._setListeners = function _setListeners() {
  5874. var _this5 = this;
  5875. var triggers = this.config.trigger.split(' ');
  5876. triggers.forEach(function (trigger) {
  5877. if (trigger === 'click') {
  5878. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5879. return _this5.toggle(event);
  5880. });
  5881. } else if (trigger !== Trigger.MANUAL) {
  5882. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5883. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5884. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5885. return _this5._enter(event);
  5886. }).on(eventOut, _this5.config.selector, function (event) {
  5887. return _this5._leave(event);
  5888. });
  5889. }
  5890. });
  5891. this._hideModalHandler = function () {
  5892. if (_this5.element) {
  5893. _this5.hide();
  5894. }
  5895. };
  5896. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5897. if (this.config.selector) {
  5898. this.config = _objectSpread2({}, this.config, {
  5899. trigger: 'manual',
  5900. selector: ''
  5901. });
  5902. } else {
  5903. this._fixTitle();
  5904. }
  5905. };
  5906. _proto._fixTitle = function _fixTitle() {
  5907. var titleType = typeof this.element.getAttribute('data-original-title');
  5908. if (this.element.getAttribute('title') || titleType !== 'string') {
  5909. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5910. this.element.setAttribute('title', '');
  5911. }
  5912. };
  5913. _proto._enter = function _enter(event, context) {
  5914. var dataKey = this.constructor.DATA_KEY;
  5915. context = context || $(event.currentTarget).data(dataKey);
  5916. if (!context) {
  5917. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5918. $(event.currentTarget).data(dataKey, context);
  5919. }
  5920. if (event) {
  5921. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5922. }
  5923. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5924. context._hoverState = HoverState.SHOW;
  5925. return;
  5926. }
  5927. clearTimeout(context._timeout);
  5928. context._hoverState = HoverState.SHOW;
  5929. if (!context.config.delay || !context.config.delay.show) {
  5930. context.show();
  5931. return;
  5932. }
  5933. context._timeout = setTimeout(function () {
  5934. if (context._hoverState === HoverState.SHOW) {
  5935. context.show();
  5936. }
  5937. }, context.config.delay.show);
  5938. };
  5939. _proto._leave = function _leave(event, context) {
  5940. var dataKey = this.constructor.DATA_KEY;
  5941. context = context || $(event.currentTarget).data(dataKey);
  5942. if (!context) {
  5943. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5944. $(event.currentTarget).data(dataKey, context);
  5945. }
  5946. if (event) {
  5947. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5948. }
  5949. if (context._isWithActiveTrigger()) {
  5950. return;
  5951. }
  5952. clearTimeout(context._timeout);
  5953. context._hoverState = HoverState.OUT;
  5954. if (!context.config.delay || !context.config.delay.hide) {
  5955. context.hide();
  5956. return;
  5957. }
  5958. context._timeout = setTimeout(function () {
  5959. if (context._hoverState === HoverState.OUT) {
  5960. context.hide();
  5961. }
  5962. }, context.config.delay.hide);
  5963. };
  5964. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5965. for (var trigger in this._activeTrigger) {
  5966. if (this._activeTrigger[trigger]) {
  5967. return true;
  5968. }
  5969. }
  5970. return false;
  5971. };
  5972. _proto._getConfig = function _getConfig(config) {
  5973. var dataAttributes = $(this.element).data();
  5974. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5975. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5976. delete dataAttributes[dataAttr];
  5977. }
  5978. });
  5979. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5980. if (typeof config.delay === 'number') {
  5981. config.delay = {
  5982. show: config.delay,
  5983. hide: config.delay
  5984. };
  5985. }
  5986. if (typeof config.title === 'number') {
  5987. config.title = config.title.toString();
  5988. }
  5989. if (typeof config.content === 'number') {
  5990. config.content = config.content.toString();
  5991. }
  5992. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5993. if (config.sanitize) {
  5994. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5995. }
  5996. return config;
  5997. };
  5998. _proto._getDelegateConfig = function _getDelegateConfig() {
  5999. var config = {};
  6000. if (this.config) {
  6001. for (var key in this.config) {
  6002. if (this.constructor.Default[key] !== this.config[key]) {
  6003. config[key] = this.config[key];
  6004. }
  6005. }
  6006. }
  6007. return config;
  6008. };
  6009. _proto._cleanTipClass = function _cleanTipClass() {
  6010. var $tip = $(this.getTipElement());
  6011. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  6012. if (tabClass !== null && tabClass.length) {
  6013. $tip.removeClass(tabClass.join(''));
  6014. }
  6015. };
  6016. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  6017. var popperInstance = popperData.instance;
  6018. this.tip = popperInstance.popper;
  6019. this._cleanTipClass();
  6020. this.addAttachmentClass(this._getAttachment(popperData.placement));
  6021. };
  6022. _proto._fixTransition = function _fixTransition() {
  6023. var tip = this.getTipElement();
  6024. var initConfigAnimation = this.config.animation;
  6025. if (tip.getAttribute('x-placement') !== null) {
  6026. return;
  6027. }
  6028. $(tip).removeClass(ClassName$6.FADE);
  6029. this.config.animation = false;
  6030. this.hide();
  6031. this.show();
  6032. this.config.animation = initConfigAnimation;
  6033. } // Static
  6034. ;
  6035. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  6036. return this.each(function () {
  6037. var data = $(this).data(DATA_KEY$6);
  6038. var _config = typeof config === 'object' && config;
  6039. if (!data && /dispose|hide/.test(config)) {
  6040. return;
  6041. }
  6042. if (!data) {
  6043. data = new Tooltip(this, _config);
  6044. $(this).data(DATA_KEY$6, data);
  6045. }
  6046. if (typeof config === 'string') {
  6047. if (typeof data[config] === 'undefined') {
  6048. throw new TypeError("No method named \"" + config + "\"");
  6049. }
  6050. data[config]();
  6051. }
  6052. });
  6053. };
  6054. _createClass(Tooltip, null, [{
  6055. key: "VERSION",
  6056. get: function get() {
  6057. return VERSION$6;
  6058. }
  6059. }, {
  6060. key: "Default",
  6061. get: function get() {
  6062. return Default$4;
  6063. }
  6064. }, {
  6065. key: "NAME",
  6066. get: function get() {
  6067. return NAME$6;
  6068. }
  6069. }, {
  6070. key: "DATA_KEY",
  6071. get: function get() {
  6072. return DATA_KEY$6;
  6073. }
  6074. }, {
  6075. key: "Event",
  6076. get: function get() {
  6077. return Event$6;
  6078. }
  6079. }, {
  6080. key: "EVENT_KEY",
  6081. get: function get() {
  6082. return EVENT_KEY$6;
  6083. }
  6084. }, {
  6085. key: "DefaultType",
  6086. get: function get() {
  6087. return DefaultType$4;
  6088. }
  6089. }]);
  6090. return Tooltip;
  6091. }();
  6092. /**
  6093. * ------------------------------------------------------------------------
  6094. * jQuery
  6095. * ------------------------------------------------------------------------
  6096. */
  6097. $.fn[NAME$6] = Tooltip._jQueryInterface;
  6098. $.fn[NAME$6].Constructor = Tooltip;
  6099. $.fn[NAME$6].noConflict = function () {
  6100. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  6101. return Tooltip._jQueryInterface;
  6102. };
  6103. /**
  6104. * ------------------------------------------------------------------------
  6105. * Constants
  6106. * ------------------------------------------------------------------------
  6107. */
  6108. var NAME$7 = 'popover';
  6109. var VERSION$7 = '4.4.1';
  6110. var DATA_KEY$7 = 'bs.popover';
  6111. var EVENT_KEY$7 = "." + DATA_KEY$7;
  6112. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  6113. var CLASS_PREFIX$1 = 'bs-popover';
  6114. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  6115. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  6116. placement: 'right',
  6117. trigger: 'click',
  6118. content: '',
  6119. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  6120. });
  6121. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  6122. content: '(string|element|function)'
  6123. });
  6124. var ClassName$7 = {
  6125. FADE: 'fade',
  6126. SHOW: 'show'
  6127. };
  6128. var Selector$7 = {
  6129. TITLE: '.popover-header',
  6130. CONTENT: '.popover-body'
  6131. };
  6132. var Event$7 = {
  6133. HIDE: "hide" + EVENT_KEY$7,
  6134. HIDDEN: "hidden" + EVENT_KEY$7,
  6135. SHOW: "show" + EVENT_KEY$7,
  6136. SHOWN: "shown" + EVENT_KEY$7,
  6137. INSERTED: "inserted" + EVENT_KEY$7,
  6138. CLICK: "click" + EVENT_KEY$7,
  6139. FOCUSIN: "focusin" + EVENT_KEY$7,
  6140. FOCUSOUT: "focusout" + EVENT_KEY$7,
  6141. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  6142. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  6143. };
  6144. /**
  6145. * ------------------------------------------------------------------------
  6146. * Class Definition
  6147. * ------------------------------------------------------------------------
  6148. */
  6149. var Popover =
  6150. /*#__PURE__*/
  6151. function (_Tooltip) {
  6152. _inheritsLoose(Popover, _Tooltip);
  6153. function Popover() {
  6154. return _Tooltip.apply(this, arguments) || this;
  6155. }
  6156. var _proto = Popover.prototype;
  6157. // Overrides
  6158. _proto.isWithContent = function isWithContent() {
  6159. return this.getTitle() || this._getContent();
  6160. };
  6161. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  6162. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  6163. };
  6164. _proto.getTipElement = function getTipElement() {
  6165. this.tip = this.tip || $(this.config.template)[0];
  6166. return this.tip;
  6167. };
  6168. _proto.setContent = function setContent() {
  6169. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  6170. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  6171. var content = this._getContent();
  6172. if (typeof content === 'function') {
  6173. content = content.call(this.element);
  6174. }
  6175. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  6176. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  6177. } // Private
  6178. ;
  6179. _proto._getContent = function _getContent() {
  6180. return this.element.getAttribute('data-content') || this.config.content;
  6181. };
  6182. _proto._cleanTipClass = function _cleanTipClass() {
  6183. var $tip = $(this.getTipElement());
  6184. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  6185. if (tabClass !== null && tabClass.length > 0) {
  6186. $tip.removeClass(tabClass.join(''));
  6187. }
  6188. } // Static
  6189. ;
  6190. Popover._jQueryInterface = function _jQueryInterface(config) {
  6191. return this.each(function () {
  6192. var data = $(this).data(DATA_KEY$7);
  6193. var _config = typeof config === 'object' ? config : null;
  6194. if (!data && /dispose|hide/.test(config)) {
  6195. return;
  6196. }
  6197. if (!data) {
  6198. data = new Popover(this, _config);
  6199. $(this).data(DATA_KEY$7, data);
  6200. }
  6201. if (typeof config === 'string') {
  6202. if (typeof data[config] === 'undefined') {
  6203. throw new TypeError("No method named \"" + config + "\"");
  6204. }
  6205. data[config]();
  6206. }
  6207. });
  6208. };
  6209. _createClass(Popover, null, [{
  6210. key: "VERSION",
  6211. // Getters
  6212. get: function get() {
  6213. return VERSION$7;
  6214. }
  6215. }, {
  6216. key: "Default",
  6217. get: function get() {
  6218. return Default$5;
  6219. }
  6220. }, {
  6221. key: "NAME",
  6222. get: function get() {
  6223. return NAME$7;
  6224. }
  6225. }, {
  6226. key: "DATA_KEY",
  6227. get: function get() {
  6228. return DATA_KEY$7;
  6229. }
  6230. }, {
  6231. key: "Event",
  6232. get: function get() {
  6233. return Event$7;
  6234. }
  6235. }, {
  6236. key: "EVENT_KEY",
  6237. get: function get() {
  6238. return EVENT_KEY$7;
  6239. }
  6240. }, {
  6241. key: "DefaultType",
  6242. get: function get() {
  6243. return DefaultType$5;
  6244. }
  6245. }]);
  6246. return Popover;
  6247. }(Tooltip);
  6248. /**
  6249. * ------------------------------------------------------------------------
  6250. * jQuery
  6251. * ------------------------------------------------------------------------
  6252. */
  6253. $.fn[NAME$7] = Popover._jQueryInterface;
  6254. $.fn[NAME$7].Constructor = Popover;
  6255. $.fn[NAME$7].noConflict = function () {
  6256. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  6257. return Popover._jQueryInterface;
  6258. };
  6259. /**
  6260. * ------------------------------------------------------------------------
  6261. * Constants
  6262. * ------------------------------------------------------------------------
  6263. */
  6264. var NAME$8 = 'scrollspy';
  6265. var VERSION$8 = '4.4.1';
  6266. var DATA_KEY$8 = 'bs.scrollspy';
  6267. var EVENT_KEY$8 = "." + DATA_KEY$8;
  6268. var DATA_API_KEY$6 = '.data-api';
  6269. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  6270. var Default$6 = {
  6271. offset: 10,
  6272. method: 'auto',
  6273. target: ''
  6274. };
  6275. var DefaultType$6 = {
  6276. offset: 'number',
  6277. method: 'string',
  6278. target: '(string|element)'
  6279. };
  6280. var Event$8 = {
  6281. ACTIVATE: "activate" + EVENT_KEY$8,
  6282. SCROLL: "scroll" + EVENT_KEY$8,
  6283. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  6284. };
  6285. var ClassName$8 = {
  6286. DROPDOWN_ITEM: 'dropdown-item',
  6287. DROPDOWN_MENU: 'dropdown-menu',
  6288. ACTIVE: 'active'
  6289. };
  6290. var Selector$8 = {
  6291. DATA_SPY: '[data-spy="scroll"]',
  6292. ACTIVE: '.active',
  6293. NAV_LIST_GROUP: '.nav, .list-group',
  6294. NAV_LINKS: '.nav-link',
  6295. NAV_ITEMS: '.nav-item',
  6296. LIST_ITEMS: '.list-group-item',
  6297. DROPDOWN: '.dropdown',
  6298. DROPDOWN_ITEMS: '.dropdown-item',
  6299. DROPDOWN_TOGGLE: '.dropdown-toggle'
  6300. };
  6301. var OffsetMethod = {
  6302. OFFSET: 'offset',
  6303. POSITION: 'position'
  6304. };
  6305. /**
  6306. * ------------------------------------------------------------------------
  6307. * Class Definition
  6308. * ------------------------------------------------------------------------
  6309. */
  6310. var ScrollSpy =
  6311. /*#__PURE__*/
  6312. function () {
  6313. function ScrollSpy(element, config) {
  6314. var _this = this;
  6315. this._element = element;
  6316. this._scrollElement = element.tagName === 'BODY' ? window : element;
  6317. this._config = this._getConfig(config);
  6318. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  6319. this._offsets = [];
  6320. this._targets = [];
  6321. this._activeTarget = null;
  6322. this._scrollHeight = 0;
  6323. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  6324. return _this._process(event);
  6325. });
  6326. this.refresh();
  6327. this._process();
  6328. } // Getters
  6329. var _proto = ScrollSpy.prototype;
  6330. // Public
  6331. _proto.refresh = function refresh() {
  6332. var _this2 = this;
  6333. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  6334. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  6335. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  6336. this._offsets = [];
  6337. this._targets = [];
  6338. this._scrollHeight = this._getScrollHeight();
  6339. var targets = [].slice.call(document.querySelectorAll(this._selector));
  6340. targets.map(function (element) {
  6341. var target;
  6342. var targetSelector = Util.getSelectorFromElement(element);
  6343. if (targetSelector) {
  6344. target = document.querySelector(targetSelector);
  6345. }
  6346. if (target) {
  6347. var targetBCR = target.getBoundingClientRect();
  6348. if (targetBCR.width || targetBCR.height) {
  6349. // TODO (fat): remove sketch reliance on jQuery position/offset
  6350. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  6351. }
  6352. }
  6353. return null;
  6354. }).filter(function (item) {
  6355. return item;
  6356. }).sort(function (a, b) {
  6357. return a[0] - b[0];
  6358. }).forEach(function (item) {
  6359. _this2._offsets.push(item[0]);
  6360. _this2._targets.push(item[1]);
  6361. });
  6362. };
  6363. _proto.dispose = function dispose() {
  6364. $.removeData(this._element, DATA_KEY$8);
  6365. $(this._scrollElement).off(EVENT_KEY$8);
  6366. this._element = null;
  6367. this._scrollElement = null;
  6368. this._config = null;
  6369. this._selector = null;
  6370. this._offsets = null;
  6371. this._targets = null;
  6372. this._activeTarget = null;
  6373. this._scrollHeight = null;
  6374. } // Private
  6375. ;
  6376. _proto._getConfig = function _getConfig(config) {
  6377. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  6378. if (typeof config.target !== 'string') {
  6379. var id = $(config.target).attr('id');
  6380. if (!id) {
  6381. id = Util.getUID(NAME$8);
  6382. $(config.target).attr('id', id);
  6383. }
  6384. config.target = "#" + id;
  6385. }
  6386. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  6387. return config;
  6388. };
  6389. _proto._getScrollTop = function _getScrollTop() {
  6390. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  6391. };
  6392. _proto._getScrollHeight = function _getScrollHeight() {
  6393. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  6394. };
  6395. _proto._getOffsetHeight = function _getOffsetHeight() {
  6396. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  6397. };
  6398. _proto._process = function _process() {
  6399. var scrollTop = this._getScrollTop() + this._config.offset;
  6400. var scrollHeight = this._getScrollHeight();
  6401. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  6402. if (this._scrollHeight !== scrollHeight) {
  6403. this.refresh();
  6404. }
  6405. if (scrollTop >= maxScroll) {
  6406. var target = this._targets[this._targets.length - 1];
  6407. if (this._activeTarget !== target) {
  6408. this._activate(target);
  6409. }
  6410. return;
  6411. }
  6412. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  6413. this._activeTarget = null;
  6414. this._clear();
  6415. return;
  6416. }
  6417. var offsetLength = this._offsets.length;
  6418. for (var i = offsetLength; i--;) {
  6419. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  6420. if (isActiveTarget) {
  6421. this._activate(this._targets[i]);
  6422. }
  6423. }
  6424. };
  6425. _proto._activate = function _activate(target) {
  6426. this._activeTarget = target;
  6427. this._clear();
  6428. var queries = this._selector.split(',').map(function (selector) {
  6429. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  6430. });
  6431. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  6432. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  6433. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  6434. $link.addClass(ClassName$8.ACTIVE);
  6435. } else {
  6436. // Set triggered link as active
  6437. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  6438. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  6439. $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
  6440. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  6441. }
  6442. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  6443. relatedTarget: target
  6444. });
  6445. };
  6446. _proto._clear = function _clear() {
  6447. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  6448. return node.classList.contains(ClassName$8.ACTIVE);
  6449. }).forEach(function (node) {
  6450. return node.classList.remove(ClassName$8.ACTIVE);
  6451. });
  6452. } // Static
  6453. ;
  6454. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  6455. return this.each(function () {
  6456. var data = $(this).data(DATA_KEY$8);
  6457. var _config = typeof config === 'object' && config;
  6458. if (!data) {
  6459. data = new ScrollSpy(this, _config);
  6460. $(this).data(DATA_KEY$8, data);
  6461. }
  6462. if (typeof config === 'string') {
  6463. if (typeof data[config] === 'undefined') {
  6464. throw new TypeError("No method named \"" + config + "\"");
  6465. }
  6466. data[config]();
  6467. }
  6468. });
  6469. };
  6470. _createClass(ScrollSpy, null, [{
  6471. key: "VERSION",
  6472. get: function get() {
  6473. return VERSION$8;
  6474. }
  6475. }, {
  6476. key: "Default",
  6477. get: function get() {
  6478. return Default$6;
  6479. }
  6480. }]);
  6481. return ScrollSpy;
  6482. }();
  6483. /**
  6484. * ------------------------------------------------------------------------
  6485. * Data Api implementation
  6486. * ------------------------------------------------------------------------
  6487. */
  6488. $(window).on(Event$8.LOAD_DATA_API, function () {
  6489. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  6490. var scrollSpysLength = scrollSpys.length;
  6491. for (var i = scrollSpysLength; i--;) {
  6492. var $spy = $(scrollSpys[i]);
  6493. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  6494. }
  6495. });
  6496. /**
  6497. * ------------------------------------------------------------------------
  6498. * jQuery
  6499. * ------------------------------------------------------------------------
  6500. */
  6501. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  6502. $.fn[NAME$8].Constructor = ScrollSpy;
  6503. $.fn[NAME$8].noConflict = function () {
  6504. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  6505. return ScrollSpy._jQueryInterface;
  6506. };
  6507. /**
  6508. * ------------------------------------------------------------------------
  6509. * Constants
  6510. * ------------------------------------------------------------------------
  6511. */
  6512. var NAME$9 = 'tab';
  6513. var VERSION$9 = '4.4.1';
  6514. var DATA_KEY$9 = 'bs.tab';
  6515. var EVENT_KEY$9 = "." + DATA_KEY$9;
  6516. var DATA_API_KEY$7 = '.data-api';
  6517. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  6518. var Event$9 = {
  6519. HIDE: "hide" + EVENT_KEY$9,
  6520. HIDDEN: "hidden" + EVENT_KEY$9,
  6521. SHOW: "show" + EVENT_KEY$9,
  6522. SHOWN: "shown" + EVENT_KEY$9,
  6523. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  6524. };
  6525. var ClassName$9 = {
  6526. DROPDOWN_MENU: 'dropdown-menu',
  6527. ACTIVE: 'active',
  6528. DISABLED: 'disabled',
  6529. FADE: 'fade',
  6530. SHOW: 'show'
  6531. };
  6532. var Selector$9 = {
  6533. DROPDOWN: '.dropdown',
  6534. NAV_LIST_GROUP: '.nav, .list-group',
  6535. ACTIVE: '.active',
  6536. ACTIVE_UL: '> li > .active',
  6537. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  6538. DROPDOWN_TOGGLE: '.dropdown-toggle',
  6539. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  6540. };
  6541. /**
  6542. * ------------------------------------------------------------------------
  6543. * Class Definition
  6544. * ------------------------------------------------------------------------
  6545. */
  6546. var Tab =
  6547. /*#__PURE__*/
  6548. function () {
  6549. function Tab(element) {
  6550. this._element = element;
  6551. } // Getters
  6552. var _proto = Tab.prototype;
  6553. // Public
  6554. _proto.show = function show() {
  6555. var _this = this;
  6556. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  6557. return;
  6558. }
  6559. var target;
  6560. var previous;
  6561. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  6562. var selector = Util.getSelectorFromElement(this._element);
  6563. if (listElement) {
  6564. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  6565. previous = $.makeArray($(listElement).find(itemSelector));
  6566. previous = previous[previous.length - 1];
  6567. }
  6568. var hideEvent = $.Event(Event$9.HIDE, {
  6569. relatedTarget: this._element
  6570. });
  6571. var showEvent = $.Event(Event$9.SHOW, {
  6572. relatedTarget: previous
  6573. });
  6574. if (previous) {
  6575. $(previous).trigger(hideEvent);
  6576. }
  6577. $(this._element).trigger(showEvent);
  6578. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  6579. return;
  6580. }
  6581. if (selector) {
  6582. target = document.querySelector(selector);
  6583. }
  6584. this._activate(this._element, listElement);
  6585. var complete = function complete() {
  6586. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  6587. relatedTarget: _this._element
  6588. });
  6589. var shownEvent = $.Event(Event$9.SHOWN, {
  6590. relatedTarget: previous
  6591. });
  6592. $(previous).trigger(hiddenEvent);
  6593. $(_this._element).trigger(shownEvent);
  6594. };
  6595. if (target) {
  6596. this._activate(target, target.parentNode, complete);
  6597. } else {
  6598. complete();
  6599. }
  6600. };
  6601. _proto.dispose = function dispose() {
  6602. $.removeData(this._element, DATA_KEY$9);
  6603. this._element = null;
  6604. } // Private
  6605. ;
  6606. _proto._activate = function _activate(element, container, callback) {
  6607. var _this2 = this;
  6608. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  6609. var active = activeElements[0];
  6610. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  6611. var complete = function complete() {
  6612. return _this2._transitionComplete(element, active, callback);
  6613. };
  6614. if (active && isTransitioning) {
  6615. var transitionDuration = Util.getTransitionDurationFromElement(active);
  6616. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6617. } else {
  6618. complete();
  6619. }
  6620. };
  6621. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  6622. if (active) {
  6623. $(active).removeClass(ClassName$9.ACTIVE);
  6624. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  6625. if (dropdownChild) {
  6626. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  6627. }
  6628. if (active.getAttribute('role') === 'tab') {
  6629. active.setAttribute('aria-selected', false);
  6630. }
  6631. }
  6632. $(element).addClass(ClassName$9.ACTIVE);
  6633. if (element.getAttribute('role') === 'tab') {
  6634. element.setAttribute('aria-selected', true);
  6635. }
  6636. Util.reflow(element);
  6637. if (element.classList.contains(ClassName$9.FADE)) {
  6638. element.classList.add(ClassName$9.SHOW);
  6639. }
  6640. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  6641. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  6642. if (dropdownElement) {
  6643. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  6644. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  6645. }
  6646. element.setAttribute('aria-expanded', true);
  6647. }
  6648. if (callback) {
  6649. callback();
  6650. }
  6651. } // Static
  6652. ;
  6653. Tab._jQueryInterface = function _jQueryInterface(config) {
  6654. return this.each(function () {
  6655. var $this = $(this);
  6656. var data = $this.data(DATA_KEY$9);
  6657. if (!data) {
  6658. data = new Tab(this);
  6659. $this.data(DATA_KEY$9, data);
  6660. }
  6661. if (typeof config === 'string') {
  6662. if (typeof data[config] === 'undefined') {
  6663. throw new TypeError("No method named \"" + config + "\"");
  6664. }
  6665. data[config]();
  6666. }
  6667. });
  6668. };
  6669. _createClass(Tab, null, [{
  6670. key: "VERSION",
  6671. get: function get() {
  6672. return VERSION$9;
  6673. }
  6674. }]);
  6675. return Tab;
  6676. }();
  6677. /**
  6678. * ------------------------------------------------------------------------
  6679. * Data Api implementation
  6680. * ------------------------------------------------------------------------
  6681. */
  6682. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  6683. event.preventDefault();
  6684. Tab._jQueryInterface.call($(this), 'show');
  6685. });
  6686. /**
  6687. * ------------------------------------------------------------------------
  6688. * jQuery
  6689. * ------------------------------------------------------------------------
  6690. */
  6691. $.fn[NAME$9] = Tab._jQueryInterface;
  6692. $.fn[NAME$9].Constructor = Tab;
  6693. $.fn[NAME$9].noConflict = function () {
  6694. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  6695. return Tab._jQueryInterface;
  6696. };
  6697. /**
  6698. * ------------------------------------------------------------------------
  6699. * Constants
  6700. * ------------------------------------------------------------------------
  6701. */
  6702. var NAME$a = 'toast';
  6703. var VERSION$a = '4.4.1';
  6704. var DATA_KEY$a = 'bs.toast';
  6705. var EVENT_KEY$a = "." + DATA_KEY$a;
  6706. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  6707. var Event$a = {
  6708. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  6709. HIDE: "hide" + EVENT_KEY$a,
  6710. HIDDEN: "hidden" + EVENT_KEY$a,
  6711. SHOW: "show" + EVENT_KEY$a,
  6712. SHOWN: "shown" + EVENT_KEY$a
  6713. };
  6714. var ClassName$a = {
  6715. FADE: 'fade',
  6716. HIDE: 'hide',
  6717. SHOW: 'show',
  6718. SHOWING: 'showing'
  6719. };
  6720. var DefaultType$7 = {
  6721. animation: 'boolean',
  6722. autohide: 'boolean',
  6723. delay: 'number'
  6724. };
  6725. var Default$7 = {
  6726. animation: true,
  6727. autohide: true,
  6728. delay: 500
  6729. };
  6730. var Selector$a = {
  6731. DATA_DISMISS: '[data-dismiss="toast"]'
  6732. };
  6733. /**
  6734. * ------------------------------------------------------------------------
  6735. * Class Definition
  6736. * ------------------------------------------------------------------------
  6737. */
  6738. var Toast =
  6739. /*#__PURE__*/
  6740. function () {
  6741. function Toast(element, config) {
  6742. this._element = element;
  6743. this._config = this._getConfig(config);
  6744. this._timeout = null;
  6745. this._setListeners();
  6746. } // Getters
  6747. var _proto = Toast.prototype;
  6748. // Public
  6749. _proto.show = function show() {
  6750. var _this = this;
  6751. var showEvent = $.Event(Event$a.SHOW);
  6752. $(this._element).trigger(showEvent);
  6753. if (showEvent.isDefaultPrevented()) {
  6754. return;
  6755. }
  6756. if (this._config.animation) {
  6757. this._element.classList.add(ClassName$a.FADE);
  6758. }
  6759. var complete = function complete() {
  6760. _this._element.classList.remove(ClassName$a.SHOWING);
  6761. _this._element.classList.add(ClassName$a.SHOW);
  6762. $(_this._element).trigger(Event$a.SHOWN);
  6763. if (_this._config.autohide) {
  6764. _this._timeout = setTimeout(function () {
  6765. _this.hide();
  6766. }, _this._config.delay);
  6767. }
  6768. };
  6769. this._element.classList.remove(ClassName$a.HIDE);
  6770. Util.reflow(this._element);
  6771. this._element.classList.add(ClassName$a.SHOWING);
  6772. if (this._config.animation) {
  6773. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6774. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6775. } else {
  6776. complete();
  6777. }
  6778. };
  6779. _proto.hide = function hide() {
  6780. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6781. return;
  6782. }
  6783. var hideEvent = $.Event(Event$a.HIDE);
  6784. $(this._element).trigger(hideEvent);
  6785. if (hideEvent.isDefaultPrevented()) {
  6786. return;
  6787. }
  6788. this._close();
  6789. };
  6790. _proto.dispose = function dispose() {
  6791. clearTimeout(this._timeout);
  6792. this._timeout = null;
  6793. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6794. this._element.classList.remove(ClassName$a.SHOW);
  6795. }
  6796. $(this._element).off(Event$a.CLICK_DISMISS);
  6797. $.removeData(this._element, DATA_KEY$a);
  6798. this._element = null;
  6799. this._config = null;
  6800. } // Private
  6801. ;
  6802. _proto._getConfig = function _getConfig(config) {
  6803. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6804. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6805. return config;
  6806. };
  6807. _proto._setListeners = function _setListeners() {
  6808. var _this2 = this;
  6809. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6810. return _this2.hide();
  6811. });
  6812. };
  6813. _proto._close = function _close() {
  6814. var _this3 = this;
  6815. var complete = function complete() {
  6816. _this3._element.classList.add(ClassName$a.HIDE);
  6817. $(_this3._element).trigger(Event$a.HIDDEN);
  6818. };
  6819. this._element.classList.remove(ClassName$a.SHOW);
  6820. if (this._config.animation) {
  6821. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6822. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6823. } else {
  6824. complete();
  6825. }
  6826. } // Static
  6827. ;
  6828. Toast._jQueryInterface = function _jQueryInterface(config) {
  6829. return this.each(function () {
  6830. var $element = $(this);
  6831. var data = $element.data(DATA_KEY$a);
  6832. var _config = typeof config === 'object' && config;
  6833. if (!data) {
  6834. data = new Toast(this, _config);
  6835. $element.data(DATA_KEY$a, data);
  6836. }
  6837. if (typeof config === 'string') {
  6838. if (typeof data[config] === 'undefined') {
  6839. throw new TypeError("No method named \"" + config + "\"");
  6840. }
  6841. data[config](this);
  6842. }
  6843. });
  6844. };
  6845. _createClass(Toast, null, [{
  6846. key: "VERSION",
  6847. get: function get() {
  6848. return VERSION$a;
  6849. }
  6850. }, {
  6851. key: "DefaultType",
  6852. get: function get() {
  6853. return DefaultType$7;
  6854. }
  6855. }, {
  6856. key: "Default",
  6857. get: function get() {
  6858. return Default$7;
  6859. }
  6860. }]);
  6861. return Toast;
  6862. }();
  6863. /**
  6864. * ------------------------------------------------------------------------
  6865. * jQuery
  6866. * ------------------------------------------------------------------------
  6867. */
  6868. $.fn[NAME$a] = Toast._jQueryInterface;
  6869. $.fn[NAME$a].Constructor = Toast;
  6870. $.fn[NAME$a].noConflict = function () {
  6871. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6872. return Toast._jQueryInterface;
  6873. };
  6874. exports.Alert = Alert;
  6875. exports.Button = Button;
  6876. exports.Carousel = Carousel;
  6877. exports.Collapse = Collapse;
  6878. exports.Dropdown = Dropdown;
  6879. exports.Modal = Modal;
  6880. exports.Popover = Popover;
  6881. exports.Scrollspy = ScrollSpy;
  6882. exports.Tab = Tab;
  6883. exports.Toast = Toast;
  6884. exports.Tooltip = Tooltip;
  6885. exports.Util = Util;
  6886. Object.defineProperty(exports, '__esModule', { value: true });
  6887. })));
  6888. //# sourceMappingURL=bootstrap.js.map
  6889. /***/ }),
  6890. /***/ "./node_modules/buffer/index.js":
  6891. /*!**************************************!*\
  6892. !*** ./node_modules/buffer/index.js ***!
  6893. \**************************************/
  6894. /*! no static exports found */
  6895. /***/ (function(module, exports, __webpack_require__) {
  6896. "use strict";
  6897. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6898. * The buffer module from node.js, for the browser.
  6899. *
  6900. * @author Feross Aboukhadijeh <http://feross.org>
  6901. * @license MIT
  6902. */
  6903. /* eslint-disable no-proto */
  6904. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6905. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6906. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6907. exports.Buffer = Buffer
  6908. exports.SlowBuffer = SlowBuffer
  6909. exports.INSPECT_MAX_BYTES = 50
  6910. /**
  6911. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6912. * === true Use Uint8Array implementation (fastest)
  6913. * === false Use Object implementation (most compatible, even IE6)
  6914. *
  6915. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6916. * Opera 11.6+, iOS 4.2+.
  6917. *
  6918. * Due to various browser bugs, sometimes the Object implementation will be used even
  6919. * when the browser supports typed arrays.
  6920. *
  6921. * Note:
  6922. *
  6923. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6924. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6925. *
  6926. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6927. *
  6928. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6929. * incorrect length in some situations.
  6930. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6931. * get the Object implementation, which is slower but behaves correctly.
  6932. */
  6933. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6934. ? global.TYPED_ARRAY_SUPPORT
  6935. : typedArraySupport()
  6936. /*
  6937. * Export kMaxLength after typed array support is determined.
  6938. */
  6939. exports.kMaxLength = kMaxLength()
  6940. function typedArraySupport () {
  6941. try {
  6942. var arr = new Uint8Array(1)
  6943. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6944. return arr.foo() === 42 && // typed array instances can be augmented
  6945. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6946. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6947. } catch (e) {
  6948. return false
  6949. }
  6950. }
  6951. function kMaxLength () {
  6952. return Buffer.TYPED_ARRAY_SUPPORT
  6953. ? 0x7fffffff
  6954. : 0x3fffffff
  6955. }
  6956. function createBuffer (that, length) {
  6957. if (kMaxLength() < length) {
  6958. throw new RangeError('Invalid typed array length')
  6959. }
  6960. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6961. // Return an augmented `Uint8Array` instance, for best performance
  6962. that = new Uint8Array(length)
  6963. that.__proto__ = Buffer.prototype
  6964. } else {
  6965. // Fallback: Return an object instance of the Buffer class
  6966. if (that === null) {
  6967. that = new Buffer(length)
  6968. }
  6969. that.length = length
  6970. }
  6971. return that
  6972. }
  6973. /**
  6974. * The Buffer constructor returns instances of `Uint8Array` that have their
  6975. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6976. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6977. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6978. * returns a single octet.
  6979. *
  6980. * The `Uint8Array` prototype remains unmodified.
  6981. */
  6982. function Buffer (arg, encodingOrOffset, length) {
  6983. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6984. return new Buffer(arg, encodingOrOffset, length)
  6985. }
  6986. // Common case.
  6987. if (typeof arg === 'number') {
  6988. if (typeof encodingOrOffset === 'string') {
  6989. throw new Error(
  6990. 'If encoding is specified then the first argument must be a string'
  6991. )
  6992. }
  6993. return allocUnsafe(this, arg)
  6994. }
  6995. return from(this, arg, encodingOrOffset, length)
  6996. }
  6997. Buffer.poolSize = 8192 // not used by this implementation
  6998. // TODO: Legacy, not needed anymore. Remove in next major version.
  6999. Buffer._augment = function (arr) {
  7000. arr.__proto__ = Buffer.prototype
  7001. return arr
  7002. }
  7003. function from (that, value, encodingOrOffset, length) {
  7004. if (typeof value === 'number') {
  7005. throw new TypeError('"value" argument must not be a number')
  7006. }
  7007. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  7008. return fromArrayBuffer(that, value, encodingOrOffset, length)
  7009. }
  7010. if (typeof value === 'string') {
  7011. return fromString(that, value, encodingOrOffset)
  7012. }
  7013. return fromObject(that, value)
  7014. }
  7015. /**
  7016. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  7017. * if value is a number.
  7018. * Buffer.from(str[, encoding])
  7019. * Buffer.from(array)
  7020. * Buffer.from(buffer)
  7021. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  7022. **/
  7023. Buffer.from = function (value, encodingOrOffset, length) {
  7024. return from(null, value, encodingOrOffset, length)
  7025. }
  7026. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7027. Buffer.prototype.__proto__ = Uint8Array.prototype
  7028. Buffer.__proto__ = Uint8Array
  7029. if (typeof Symbol !== 'undefined' && Symbol.species &&
  7030. Buffer[Symbol.species] === Buffer) {
  7031. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  7032. Object.defineProperty(Buffer, Symbol.species, {
  7033. value: null,
  7034. configurable: true
  7035. })
  7036. }
  7037. }
  7038. function assertSize (size) {
  7039. if (typeof size !== 'number') {
  7040. throw new TypeError('"size" argument must be a number')
  7041. } else if (size < 0) {
  7042. throw new RangeError('"size" argument must not be negative')
  7043. }
  7044. }
  7045. function alloc (that, size, fill, encoding) {
  7046. assertSize(size)
  7047. if (size <= 0) {
  7048. return createBuffer(that, size)
  7049. }
  7050. if (fill !== undefined) {
  7051. // Only pay attention to encoding if it's a string. This
  7052. // prevents accidentally sending in a number that would
  7053. // be interpretted as a start offset.
  7054. return typeof encoding === 'string'
  7055. ? createBuffer(that, size).fill(fill, encoding)
  7056. : createBuffer(that, size).fill(fill)
  7057. }
  7058. return createBuffer(that, size)
  7059. }
  7060. /**
  7061. * Creates a new filled Buffer instance.
  7062. * alloc(size[, fill[, encoding]])
  7063. **/
  7064. Buffer.alloc = function (size, fill, encoding) {
  7065. return alloc(null, size, fill, encoding)
  7066. }
  7067. function allocUnsafe (that, size) {
  7068. assertSize(size)
  7069. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  7070. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  7071. for (var i = 0; i < size; ++i) {
  7072. that[i] = 0
  7073. }
  7074. }
  7075. return that
  7076. }
  7077. /**
  7078. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  7079. * */
  7080. Buffer.allocUnsafe = function (size) {
  7081. return allocUnsafe(null, size)
  7082. }
  7083. /**
  7084. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  7085. */
  7086. Buffer.allocUnsafeSlow = function (size) {
  7087. return allocUnsafe(null, size)
  7088. }
  7089. function fromString (that, string, encoding) {
  7090. if (typeof encoding !== 'string' || encoding === '') {
  7091. encoding = 'utf8'
  7092. }
  7093. if (!Buffer.isEncoding(encoding)) {
  7094. throw new TypeError('"encoding" must be a valid string encoding')
  7095. }
  7096. var length = byteLength(string, encoding) | 0
  7097. that = createBuffer(that, length)
  7098. var actual = that.write(string, encoding)
  7099. if (actual !== length) {
  7100. // Writing a hex string, for example, that contains invalid characters will
  7101. // cause everything after the first invalid character to be ignored. (e.g.
  7102. // 'abxxcd' will be treated as 'ab')
  7103. that = that.slice(0, actual)
  7104. }
  7105. return that
  7106. }
  7107. function fromArrayLike (that, array) {
  7108. var length = array.length < 0 ? 0 : checked(array.length) | 0
  7109. that = createBuffer(that, length)
  7110. for (var i = 0; i < length; i += 1) {
  7111. that[i] = array[i] & 255
  7112. }
  7113. return that
  7114. }
  7115. function fromArrayBuffer (that, array, byteOffset, length) {
  7116. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  7117. if (byteOffset < 0 || array.byteLength < byteOffset) {
  7118. throw new RangeError('\'offset\' is out of bounds')
  7119. }
  7120. if (array.byteLength < byteOffset + (length || 0)) {
  7121. throw new RangeError('\'length\' is out of bounds')
  7122. }
  7123. if (byteOffset === undefined && length === undefined) {
  7124. array = new Uint8Array(array)
  7125. } else if (length === undefined) {
  7126. array = new Uint8Array(array, byteOffset)
  7127. } else {
  7128. array = new Uint8Array(array, byteOffset, length)
  7129. }
  7130. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7131. // Return an augmented `Uint8Array` instance, for best performance
  7132. that = array
  7133. that.__proto__ = Buffer.prototype
  7134. } else {
  7135. // Fallback: Return an object instance of the Buffer class
  7136. that = fromArrayLike(that, array)
  7137. }
  7138. return that
  7139. }
  7140. function fromObject (that, obj) {
  7141. if (Buffer.isBuffer(obj)) {
  7142. var len = checked(obj.length) | 0
  7143. that = createBuffer(that, len)
  7144. if (that.length === 0) {
  7145. return that
  7146. }
  7147. obj.copy(that, 0, 0, len)
  7148. return that
  7149. }
  7150. if (obj) {
  7151. if ((typeof ArrayBuffer !== 'undefined' &&
  7152. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  7153. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  7154. return createBuffer(that, 0)
  7155. }
  7156. return fromArrayLike(that, obj)
  7157. }
  7158. if (obj.type === 'Buffer' && isArray(obj.data)) {
  7159. return fromArrayLike(that, obj.data)
  7160. }
  7161. }
  7162. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  7163. }
  7164. function checked (length) {
  7165. // Note: cannot use `length < kMaxLength()` here because that fails when
  7166. // length is NaN (which is otherwise coerced to zero.)
  7167. if (length >= kMaxLength()) {
  7168. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  7169. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  7170. }
  7171. return length | 0
  7172. }
  7173. function SlowBuffer (length) {
  7174. if (+length != length) { // eslint-disable-line eqeqeq
  7175. length = 0
  7176. }
  7177. return Buffer.alloc(+length)
  7178. }
  7179. Buffer.isBuffer = function isBuffer (b) {
  7180. return !!(b != null && b._isBuffer)
  7181. }
  7182. Buffer.compare = function compare (a, b) {
  7183. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  7184. throw new TypeError('Arguments must be Buffers')
  7185. }
  7186. if (a === b) return 0
  7187. var x = a.length
  7188. var y = b.length
  7189. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  7190. if (a[i] !== b[i]) {
  7191. x = a[i]
  7192. y = b[i]
  7193. break
  7194. }
  7195. }
  7196. if (x < y) return -1
  7197. if (y < x) return 1
  7198. return 0
  7199. }
  7200. Buffer.isEncoding = function isEncoding (encoding) {
  7201. switch (String(encoding).toLowerCase()) {
  7202. case 'hex':
  7203. case 'utf8':
  7204. case 'utf-8':
  7205. case 'ascii':
  7206. case 'latin1':
  7207. case 'binary':
  7208. case 'base64':
  7209. case 'ucs2':
  7210. case 'ucs-2':
  7211. case 'utf16le':
  7212. case 'utf-16le':
  7213. return true
  7214. default:
  7215. return false
  7216. }
  7217. }
  7218. Buffer.concat = function concat (list, length) {
  7219. if (!isArray(list)) {
  7220. throw new TypeError('"list" argument must be an Array of Buffers')
  7221. }
  7222. if (list.length === 0) {
  7223. return Buffer.alloc(0)
  7224. }
  7225. var i
  7226. if (length === undefined) {
  7227. length = 0
  7228. for (i = 0; i < list.length; ++i) {
  7229. length += list[i].length
  7230. }
  7231. }
  7232. var buffer = Buffer.allocUnsafe(length)
  7233. var pos = 0
  7234. for (i = 0; i < list.length; ++i) {
  7235. var buf = list[i]
  7236. if (!Buffer.isBuffer(buf)) {
  7237. throw new TypeError('"list" argument must be an Array of Buffers')
  7238. }
  7239. buf.copy(buffer, pos)
  7240. pos += buf.length
  7241. }
  7242. return buffer
  7243. }
  7244. function byteLength (string, encoding) {
  7245. if (Buffer.isBuffer(string)) {
  7246. return string.length
  7247. }
  7248. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  7249. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  7250. return string.byteLength
  7251. }
  7252. if (typeof string !== 'string') {
  7253. string = '' + string
  7254. }
  7255. var len = string.length
  7256. if (len === 0) return 0
  7257. // Use a for loop to avoid recursion
  7258. var loweredCase = false
  7259. for (;;) {
  7260. switch (encoding) {
  7261. case 'ascii':
  7262. case 'latin1':
  7263. case 'binary':
  7264. return len
  7265. case 'utf8':
  7266. case 'utf-8':
  7267. case undefined:
  7268. return utf8ToBytes(string).length
  7269. case 'ucs2':
  7270. case 'ucs-2':
  7271. case 'utf16le':
  7272. case 'utf-16le':
  7273. return len * 2
  7274. case 'hex':
  7275. return len >>> 1
  7276. case 'base64':
  7277. return base64ToBytes(string).length
  7278. default:
  7279. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  7280. encoding = ('' + encoding).toLowerCase()
  7281. loweredCase = true
  7282. }
  7283. }
  7284. }
  7285. Buffer.byteLength = byteLength
  7286. function slowToString (encoding, start, end) {
  7287. var loweredCase = false
  7288. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  7289. // property of a typed array.
  7290. // This behaves neither like String nor Uint8Array in that we set start/end
  7291. // to their upper/lower bounds if the value passed is out of range.
  7292. // undefined is handled specially as per ECMA-262 6th Edition,
  7293. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  7294. if (start === undefined || start < 0) {
  7295. start = 0
  7296. }
  7297. // Return early if start > this.length. Done here to prevent potential uint32
  7298. // coercion fail below.
  7299. if (start > this.length) {
  7300. return ''
  7301. }
  7302. if (end === undefined || end > this.length) {
  7303. end = this.length
  7304. }
  7305. if (end <= 0) {
  7306. return ''
  7307. }
  7308. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  7309. end >>>= 0
  7310. start >>>= 0
  7311. if (end <= start) {
  7312. return ''
  7313. }
  7314. if (!encoding) encoding = 'utf8'
  7315. while (true) {
  7316. switch (encoding) {
  7317. case 'hex':
  7318. return hexSlice(this, start, end)
  7319. case 'utf8':
  7320. case 'utf-8':
  7321. return utf8Slice(this, start, end)
  7322. case 'ascii':
  7323. return asciiSlice(this, start, end)
  7324. case 'latin1':
  7325. case 'binary':
  7326. return latin1Slice(this, start, end)
  7327. case 'base64':
  7328. return base64Slice(this, start, end)
  7329. case 'ucs2':
  7330. case 'ucs-2':
  7331. case 'utf16le':
  7332. case 'utf-16le':
  7333. return utf16leSlice(this, start, end)
  7334. default:
  7335. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7336. encoding = (encoding + '').toLowerCase()
  7337. loweredCase = true
  7338. }
  7339. }
  7340. }
  7341. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  7342. // Buffer instances.
  7343. Buffer.prototype._isBuffer = true
  7344. function swap (b, n, m) {
  7345. var i = b[n]
  7346. b[n] = b[m]
  7347. b[m] = i
  7348. }
  7349. Buffer.prototype.swap16 = function swap16 () {
  7350. var len = this.length
  7351. if (len % 2 !== 0) {
  7352. throw new RangeError('Buffer size must be a multiple of 16-bits')
  7353. }
  7354. for (var i = 0; i < len; i += 2) {
  7355. swap(this, i, i + 1)
  7356. }
  7357. return this
  7358. }
  7359. Buffer.prototype.swap32 = function swap32 () {
  7360. var len = this.length
  7361. if (len % 4 !== 0) {
  7362. throw new RangeError('Buffer size must be a multiple of 32-bits')
  7363. }
  7364. for (var i = 0; i < len; i += 4) {
  7365. swap(this, i, i + 3)
  7366. swap(this, i + 1, i + 2)
  7367. }
  7368. return this
  7369. }
  7370. Buffer.prototype.swap64 = function swap64 () {
  7371. var len = this.length
  7372. if (len % 8 !== 0) {
  7373. throw new RangeError('Buffer size must be a multiple of 64-bits')
  7374. }
  7375. for (var i = 0; i < len; i += 8) {
  7376. swap(this, i, i + 7)
  7377. swap(this, i + 1, i + 6)
  7378. swap(this, i + 2, i + 5)
  7379. swap(this, i + 3, i + 4)
  7380. }
  7381. return this
  7382. }
  7383. Buffer.prototype.toString = function toString () {
  7384. var length = this.length | 0
  7385. if (length === 0) return ''
  7386. if (arguments.length === 0) return utf8Slice(this, 0, length)
  7387. return slowToString.apply(this, arguments)
  7388. }
  7389. Buffer.prototype.equals = function equals (b) {
  7390. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  7391. if (this === b) return true
  7392. return Buffer.compare(this, b) === 0
  7393. }
  7394. Buffer.prototype.inspect = function inspect () {
  7395. var str = ''
  7396. var max = exports.INSPECT_MAX_BYTES
  7397. if (this.length > 0) {
  7398. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  7399. if (this.length > max) str += ' ... '
  7400. }
  7401. return '<Buffer ' + str + '>'
  7402. }
  7403. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  7404. if (!Buffer.isBuffer(target)) {
  7405. throw new TypeError('Argument must be a Buffer')
  7406. }
  7407. if (start === undefined) {
  7408. start = 0
  7409. }
  7410. if (end === undefined) {
  7411. end = target ? target.length : 0
  7412. }
  7413. if (thisStart === undefined) {
  7414. thisStart = 0
  7415. }
  7416. if (thisEnd === undefined) {
  7417. thisEnd = this.length
  7418. }
  7419. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  7420. throw new RangeError('out of range index')
  7421. }
  7422. if (thisStart >= thisEnd && start >= end) {
  7423. return 0
  7424. }
  7425. if (thisStart >= thisEnd) {
  7426. return -1
  7427. }
  7428. if (start >= end) {
  7429. return 1
  7430. }
  7431. start >>>= 0
  7432. end >>>= 0
  7433. thisStart >>>= 0
  7434. thisEnd >>>= 0
  7435. if (this === target) return 0
  7436. var x = thisEnd - thisStart
  7437. var y = end - start
  7438. var len = Math.min(x, y)
  7439. var thisCopy = this.slice(thisStart, thisEnd)
  7440. var targetCopy = target.slice(start, end)
  7441. for (var i = 0; i < len; ++i) {
  7442. if (thisCopy[i] !== targetCopy[i]) {
  7443. x = thisCopy[i]
  7444. y = targetCopy[i]
  7445. break
  7446. }
  7447. }
  7448. if (x < y) return -1
  7449. if (y < x) return 1
  7450. return 0
  7451. }
  7452. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  7453. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  7454. //
  7455. // Arguments:
  7456. // - buffer - a Buffer to search
  7457. // - val - a string, Buffer, or number
  7458. // - byteOffset - an index into `buffer`; will be clamped to an int32
  7459. // - encoding - an optional encoding, relevant is val is a string
  7460. // - dir - true for indexOf, false for lastIndexOf
  7461. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  7462. // Empty buffer means no match
  7463. if (buffer.length === 0) return -1
  7464. // Normalize byteOffset
  7465. if (typeof byteOffset === 'string') {
  7466. encoding = byteOffset
  7467. byteOffset = 0
  7468. } else if (byteOffset > 0x7fffffff) {
  7469. byteOffset = 0x7fffffff
  7470. } else if (byteOffset < -0x80000000) {
  7471. byteOffset = -0x80000000
  7472. }
  7473. byteOffset = +byteOffset // Coerce to Number.
  7474. if (isNaN(byteOffset)) {
  7475. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  7476. byteOffset = dir ? 0 : (buffer.length - 1)
  7477. }
  7478. // Normalize byteOffset: negative offsets start from the end of the buffer
  7479. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  7480. if (byteOffset >= buffer.length) {
  7481. if (dir) return -1
  7482. else byteOffset = buffer.length - 1
  7483. } else if (byteOffset < 0) {
  7484. if (dir) byteOffset = 0
  7485. else return -1
  7486. }
  7487. // Normalize val
  7488. if (typeof val === 'string') {
  7489. val = Buffer.from(val, encoding)
  7490. }
  7491. // Finally, search either indexOf (if dir is true) or lastIndexOf
  7492. if (Buffer.isBuffer(val)) {
  7493. // Special case: looking for empty string/buffer always fails
  7494. if (val.length === 0) {
  7495. return -1
  7496. }
  7497. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  7498. } else if (typeof val === 'number') {
  7499. val = val & 0xFF // Search for a byte value [0-255]
  7500. if (Buffer.TYPED_ARRAY_SUPPORT &&
  7501. typeof Uint8Array.prototype.indexOf === 'function') {
  7502. if (dir) {
  7503. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  7504. } else {
  7505. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  7506. }
  7507. }
  7508. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  7509. }
  7510. throw new TypeError('val must be string, number or Buffer')
  7511. }
  7512. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  7513. var indexSize = 1
  7514. var arrLength = arr.length
  7515. var valLength = val.length
  7516. if (encoding !== undefined) {
  7517. encoding = String(encoding).toLowerCase()
  7518. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  7519. encoding === 'utf16le' || encoding === 'utf-16le') {
  7520. if (arr.length < 2 || val.length < 2) {
  7521. return -1
  7522. }
  7523. indexSize = 2
  7524. arrLength /= 2
  7525. valLength /= 2
  7526. byteOffset /= 2
  7527. }
  7528. }
  7529. function read (buf, i) {
  7530. if (indexSize === 1) {
  7531. return buf[i]
  7532. } else {
  7533. return buf.readUInt16BE(i * indexSize)
  7534. }
  7535. }
  7536. var i
  7537. if (dir) {
  7538. var foundIndex = -1
  7539. for (i = byteOffset; i < arrLength; i++) {
  7540. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  7541. if (foundIndex === -1) foundIndex = i
  7542. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  7543. } else {
  7544. if (foundIndex !== -1) i -= i - foundIndex
  7545. foundIndex = -1
  7546. }
  7547. }
  7548. } else {
  7549. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  7550. for (i = byteOffset; i >= 0; i--) {
  7551. var found = true
  7552. for (var j = 0; j < valLength; j++) {
  7553. if (read(arr, i + j) !== read(val, j)) {
  7554. found = false
  7555. break
  7556. }
  7557. }
  7558. if (found) return i
  7559. }
  7560. }
  7561. return -1
  7562. }
  7563. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  7564. return this.indexOf(val, byteOffset, encoding) !== -1
  7565. }
  7566. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  7567. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  7568. }
  7569. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  7570. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  7571. }
  7572. function hexWrite (buf, string, offset, length) {
  7573. offset = Number(offset) || 0
  7574. var remaining = buf.length - offset
  7575. if (!length) {
  7576. length = remaining
  7577. } else {
  7578. length = Number(length)
  7579. if (length > remaining) {
  7580. length = remaining
  7581. }
  7582. }
  7583. // must be an even number of digits
  7584. var strLen = string.length
  7585. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  7586. if (length > strLen / 2) {
  7587. length = strLen / 2
  7588. }
  7589. for (var i = 0; i < length; ++i) {
  7590. var parsed = parseInt(string.substr(i * 2, 2), 16)
  7591. if (isNaN(parsed)) return i
  7592. buf[offset + i] = parsed
  7593. }
  7594. return i
  7595. }
  7596. function utf8Write (buf, string, offset, length) {
  7597. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  7598. }
  7599. function asciiWrite (buf, string, offset, length) {
  7600. return blitBuffer(asciiToBytes(string), buf, offset, length)
  7601. }
  7602. function latin1Write (buf, string, offset, length) {
  7603. return asciiWrite(buf, string, offset, length)
  7604. }
  7605. function base64Write (buf, string, offset, length) {
  7606. return blitBuffer(base64ToBytes(string), buf, offset, length)
  7607. }
  7608. function ucs2Write (buf, string, offset, length) {
  7609. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  7610. }
  7611. Buffer.prototype.write = function write (string, offset, length, encoding) {
  7612. // Buffer#write(string)
  7613. if (offset === undefined) {
  7614. encoding = 'utf8'
  7615. length = this.length
  7616. offset = 0
  7617. // Buffer#write(string, encoding)
  7618. } else if (length === undefined && typeof offset === 'string') {
  7619. encoding = offset
  7620. length = this.length
  7621. offset = 0
  7622. // Buffer#write(string, offset[, length][, encoding])
  7623. } else if (isFinite(offset)) {
  7624. offset = offset | 0
  7625. if (isFinite(length)) {
  7626. length = length | 0
  7627. if (encoding === undefined) encoding = 'utf8'
  7628. } else {
  7629. encoding = length
  7630. length = undefined
  7631. }
  7632. // legacy write(string, encoding, offset, length) - remove in v0.13
  7633. } else {
  7634. throw new Error(
  7635. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  7636. )
  7637. }
  7638. var remaining = this.length - offset
  7639. if (length === undefined || length > remaining) length = remaining
  7640. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  7641. throw new RangeError('Attempt to write outside buffer bounds')
  7642. }
  7643. if (!encoding) encoding = 'utf8'
  7644. var loweredCase = false
  7645. for (;;) {
  7646. switch (encoding) {
  7647. case 'hex':
  7648. return hexWrite(this, string, offset, length)
  7649. case 'utf8':
  7650. case 'utf-8':
  7651. return utf8Write(this, string, offset, length)
  7652. case 'ascii':
  7653. return asciiWrite(this, string, offset, length)
  7654. case 'latin1':
  7655. case 'binary':
  7656. return latin1Write(this, string, offset, length)
  7657. case 'base64':
  7658. // Warning: maxLength not taken into account in base64Write
  7659. return base64Write(this, string, offset, length)
  7660. case 'ucs2':
  7661. case 'ucs-2':
  7662. case 'utf16le':
  7663. case 'utf-16le':
  7664. return ucs2Write(this, string, offset, length)
  7665. default:
  7666. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7667. encoding = ('' + encoding).toLowerCase()
  7668. loweredCase = true
  7669. }
  7670. }
  7671. }
  7672. Buffer.prototype.toJSON = function toJSON () {
  7673. return {
  7674. type: 'Buffer',
  7675. data: Array.prototype.slice.call(this._arr || this, 0)
  7676. }
  7677. }
  7678. function base64Slice (buf, start, end) {
  7679. if (start === 0 && end === buf.length) {
  7680. return base64.fromByteArray(buf)
  7681. } else {
  7682. return base64.fromByteArray(buf.slice(start, end))
  7683. }
  7684. }
  7685. function utf8Slice (buf, start, end) {
  7686. end = Math.min(buf.length, end)
  7687. var res = []
  7688. var i = start
  7689. while (i < end) {
  7690. var firstByte = buf[i]
  7691. var codePoint = null
  7692. var bytesPerSequence = (firstByte > 0xEF) ? 4
  7693. : (firstByte > 0xDF) ? 3
  7694. : (firstByte > 0xBF) ? 2
  7695. : 1
  7696. if (i + bytesPerSequence <= end) {
  7697. var secondByte, thirdByte, fourthByte, tempCodePoint
  7698. switch (bytesPerSequence) {
  7699. case 1:
  7700. if (firstByte < 0x80) {
  7701. codePoint = firstByte
  7702. }
  7703. break
  7704. case 2:
  7705. secondByte = buf[i + 1]
  7706. if ((secondByte & 0xC0) === 0x80) {
  7707. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  7708. if (tempCodePoint > 0x7F) {
  7709. codePoint = tempCodePoint
  7710. }
  7711. }
  7712. break
  7713. case 3:
  7714. secondByte = buf[i + 1]
  7715. thirdByte = buf[i + 2]
  7716. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  7717. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  7718. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  7719. codePoint = tempCodePoint
  7720. }
  7721. }
  7722. break
  7723. case 4:
  7724. secondByte = buf[i + 1]
  7725. thirdByte = buf[i + 2]
  7726. fourthByte = buf[i + 3]
  7727. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  7728. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  7729. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  7730. codePoint = tempCodePoint
  7731. }
  7732. }
  7733. }
  7734. }
  7735. if (codePoint === null) {
  7736. // we did not generate a valid codePoint so insert a
  7737. // replacement char (U+FFFD) and advance only 1 byte
  7738. codePoint = 0xFFFD
  7739. bytesPerSequence = 1
  7740. } else if (codePoint > 0xFFFF) {
  7741. // encode to utf16 (surrogate pair dance)
  7742. codePoint -= 0x10000
  7743. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  7744. codePoint = 0xDC00 | codePoint & 0x3FF
  7745. }
  7746. res.push(codePoint)
  7747. i += bytesPerSequence
  7748. }
  7749. return decodeCodePointsArray(res)
  7750. }
  7751. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  7752. // the lowest limit is Chrome, with 0x10000 args.
  7753. // We go 1 magnitude less, for safety
  7754. var MAX_ARGUMENTS_LENGTH = 0x1000
  7755. function decodeCodePointsArray (codePoints) {
  7756. var len = codePoints.length
  7757. if (len <= MAX_ARGUMENTS_LENGTH) {
  7758. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7759. }
  7760. // Decode in chunks to avoid "call stack size exceeded".
  7761. var res = ''
  7762. var i = 0
  7763. while (i < len) {
  7764. res += String.fromCharCode.apply(
  7765. String,
  7766. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7767. )
  7768. }
  7769. return res
  7770. }
  7771. function asciiSlice (buf, start, end) {
  7772. var ret = ''
  7773. end = Math.min(buf.length, end)
  7774. for (var i = start; i < end; ++i) {
  7775. ret += String.fromCharCode(buf[i] & 0x7F)
  7776. }
  7777. return ret
  7778. }
  7779. function latin1Slice (buf, start, end) {
  7780. var ret = ''
  7781. end = Math.min(buf.length, end)
  7782. for (var i = start; i < end; ++i) {
  7783. ret += String.fromCharCode(buf[i])
  7784. }
  7785. return ret
  7786. }
  7787. function hexSlice (buf, start, end) {
  7788. var len = buf.length
  7789. if (!start || start < 0) start = 0
  7790. if (!end || end < 0 || end > len) end = len
  7791. var out = ''
  7792. for (var i = start; i < end; ++i) {
  7793. out += toHex(buf[i])
  7794. }
  7795. return out
  7796. }
  7797. function utf16leSlice (buf, start, end) {
  7798. var bytes = buf.slice(start, end)
  7799. var res = ''
  7800. for (var i = 0; i < bytes.length; i += 2) {
  7801. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7802. }
  7803. return res
  7804. }
  7805. Buffer.prototype.slice = function slice (start, end) {
  7806. var len = this.length
  7807. start = ~~start
  7808. end = end === undefined ? len : ~~end
  7809. if (start < 0) {
  7810. start += len
  7811. if (start < 0) start = 0
  7812. } else if (start > len) {
  7813. start = len
  7814. }
  7815. if (end < 0) {
  7816. end += len
  7817. if (end < 0) end = 0
  7818. } else if (end > len) {
  7819. end = len
  7820. }
  7821. if (end < start) end = start
  7822. var newBuf
  7823. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7824. newBuf = this.subarray(start, end)
  7825. newBuf.__proto__ = Buffer.prototype
  7826. } else {
  7827. var sliceLen = end - start
  7828. newBuf = new Buffer(sliceLen, undefined)
  7829. for (var i = 0; i < sliceLen; ++i) {
  7830. newBuf[i] = this[i + start]
  7831. }
  7832. }
  7833. return newBuf
  7834. }
  7835. /*
  7836. * Need to make sure that buffer isn't trying to write out of bounds.
  7837. */
  7838. function checkOffset (offset, ext, length) {
  7839. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7840. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7841. }
  7842. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7843. offset = offset | 0
  7844. byteLength = byteLength | 0
  7845. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7846. var val = this[offset]
  7847. var mul = 1
  7848. var i = 0
  7849. while (++i < byteLength && (mul *= 0x100)) {
  7850. val += this[offset + i] * mul
  7851. }
  7852. return val
  7853. }
  7854. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7855. offset = offset | 0
  7856. byteLength = byteLength | 0
  7857. if (!noAssert) {
  7858. checkOffset(offset, byteLength, this.length)
  7859. }
  7860. var val = this[offset + --byteLength]
  7861. var mul = 1
  7862. while (byteLength > 0 && (mul *= 0x100)) {
  7863. val += this[offset + --byteLength] * mul
  7864. }
  7865. return val
  7866. }
  7867. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7868. if (!noAssert) checkOffset(offset, 1, this.length)
  7869. return this[offset]
  7870. }
  7871. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7872. if (!noAssert) checkOffset(offset, 2, this.length)
  7873. return this[offset] | (this[offset + 1] << 8)
  7874. }
  7875. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7876. if (!noAssert) checkOffset(offset, 2, this.length)
  7877. return (this[offset] << 8) | this[offset + 1]
  7878. }
  7879. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7880. if (!noAssert) checkOffset(offset, 4, this.length)
  7881. return ((this[offset]) |
  7882. (this[offset + 1] << 8) |
  7883. (this[offset + 2] << 16)) +
  7884. (this[offset + 3] * 0x1000000)
  7885. }
  7886. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7887. if (!noAssert) checkOffset(offset, 4, this.length)
  7888. return (this[offset] * 0x1000000) +
  7889. ((this[offset + 1] << 16) |
  7890. (this[offset + 2] << 8) |
  7891. this[offset + 3])
  7892. }
  7893. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7894. offset = offset | 0
  7895. byteLength = byteLength | 0
  7896. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7897. var val = this[offset]
  7898. var mul = 1
  7899. var i = 0
  7900. while (++i < byteLength && (mul *= 0x100)) {
  7901. val += this[offset + i] * mul
  7902. }
  7903. mul *= 0x80
  7904. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7905. return val
  7906. }
  7907. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7908. offset = offset | 0
  7909. byteLength = byteLength | 0
  7910. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7911. var i = byteLength
  7912. var mul = 1
  7913. var val = this[offset + --i]
  7914. while (i > 0 && (mul *= 0x100)) {
  7915. val += this[offset + --i] * mul
  7916. }
  7917. mul *= 0x80
  7918. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7919. return val
  7920. }
  7921. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7922. if (!noAssert) checkOffset(offset, 1, this.length)
  7923. if (!(this[offset] & 0x80)) return (this[offset])
  7924. return ((0xff - this[offset] + 1) * -1)
  7925. }
  7926. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7927. if (!noAssert) checkOffset(offset, 2, this.length)
  7928. var val = this[offset] | (this[offset + 1] << 8)
  7929. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7930. }
  7931. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7932. if (!noAssert) checkOffset(offset, 2, this.length)
  7933. var val = this[offset + 1] | (this[offset] << 8)
  7934. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7935. }
  7936. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7937. if (!noAssert) checkOffset(offset, 4, this.length)
  7938. return (this[offset]) |
  7939. (this[offset + 1] << 8) |
  7940. (this[offset + 2] << 16) |
  7941. (this[offset + 3] << 24)
  7942. }
  7943. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7944. if (!noAssert) checkOffset(offset, 4, this.length)
  7945. return (this[offset] << 24) |
  7946. (this[offset + 1] << 16) |
  7947. (this[offset + 2] << 8) |
  7948. (this[offset + 3])
  7949. }
  7950. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7951. if (!noAssert) checkOffset(offset, 4, this.length)
  7952. return ieee754.read(this, offset, true, 23, 4)
  7953. }
  7954. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7955. if (!noAssert) checkOffset(offset, 4, this.length)
  7956. return ieee754.read(this, offset, false, 23, 4)
  7957. }
  7958. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7959. if (!noAssert) checkOffset(offset, 8, this.length)
  7960. return ieee754.read(this, offset, true, 52, 8)
  7961. }
  7962. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7963. if (!noAssert) checkOffset(offset, 8, this.length)
  7964. return ieee754.read(this, offset, false, 52, 8)
  7965. }
  7966. function checkInt (buf, value, offset, ext, max, min) {
  7967. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7968. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7969. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7970. }
  7971. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7972. value = +value
  7973. offset = offset | 0
  7974. byteLength = byteLength | 0
  7975. if (!noAssert) {
  7976. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7977. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7978. }
  7979. var mul = 1
  7980. var i = 0
  7981. this[offset] = value & 0xFF
  7982. while (++i < byteLength && (mul *= 0x100)) {
  7983. this[offset + i] = (value / mul) & 0xFF
  7984. }
  7985. return offset + byteLength
  7986. }
  7987. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7988. value = +value
  7989. offset = offset | 0
  7990. byteLength = byteLength | 0
  7991. if (!noAssert) {
  7992. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7993. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7994. }
  7995. var i = byteLength - 1
  7996. var mul = 1
  7997. this[offset + i] = value & 0xFF
  7998. while (--i >= 0 && (mul *= 0x100)) {
  7999. this[offset + i] = (value / mul) & 0xFF
  8000. }
  8001. return offset + byteLength
  8002. }
  8003. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  8004. value = +value
  8005. offset = offset | 0
  8006. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  8007. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  8008. this[offset] = (value & 0xff)
  8009. return offset + 1
  8010. }
  8011. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  8012. if (value < 0) value = 0xffff + value + 1
  8013. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  8014. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  8015. (littleEndian ? i : 1 - i) * 8
  8016. }
  8017. }
  8018. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  8019. value = +value
  8020. offset = offset | 0
  8021. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  8022. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8023. this[offset] = (value & 0xff)
  8024. this[offset + 1] = (value >>> 8)
  8025. } else {
  8026. objectWriteUInt16(this, value, offset, true)
  8027. }
  8028. return offset + 2
  8029. }
  8030. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  8031. value = +value
  8032. offset = offset | 0
  8033. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  8034. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8035. this[offset] = (value >>> 8)
  8036. this[offset + 1] = (value & 0xff)
  8037. } else {
  8038. objectWriteUInt16(this, value, offset, false)
  8039. }
  8040. return offset + 2
  8041. }
  8042. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  8043. if (value < 0) value = 0xffffffff + value + 1
  8044. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  8045. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  8046. }
  8047. }
  8048. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  8049. value = +value
  8050. offset = offset | 0
  8051. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  8052. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8053. this[offset + 3] = (value >>> 24)
  8054. this[offset + 2] = (value >>> 16)
  8055. this[offset + 1] = (value >>> 8)
  8056. this[offset] = (value & 0xff)
  8057. } else {
  8058. objectWriteUInt32(this, value, offset, true)
  8059. }
  8060. return offset + 4
  8061. }
  8062. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  8063. value = +value
  8064. offset = offset | 0
  8065. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  8066. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8067. this[offset] = (value >>> 24)
  8068. this[offset + 1] = (value >>> 16)
  8069. this[offset + 2] = (value >>> 8)
  8070. this[offset + 3] = (value & 0xff)
  8071. } else {
  8072. objectWriteUInt32(this, value, offset, false)
  8073. }
  8074. return offset + 4
  8075. }
  8076. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  8077. value = +value
  8078. offset = offset | 0
  8079. if (!noAssert) {
  8080. var limit = Math.pow(2, 8 * byteLength - 1)
  8081. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  8082. }
  8083. var i = 0
  8084. var mul = 1
  8085. var sub = 0
  8086. this[offset] = value & 0xFF
  8087. while (++i < byteLength && (mul *= 0x100)) {
  8088. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  8089. sub = 1
  8090. }
  8091. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  8092. }
  8093. return offset + byteLength
  8094. }
  8095. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  8096. value = +value
  8097. offset = offset | 0
  8098. if (!noAssert) {
  8099. var limit = Math.pow(2, 8 * byteLength - 1)
  8100. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  8101. }
  8102. var i = byteLength - 1
  8103. var mul = 1
  8104. var sub = 0
  8105. this[offset + i] = value & 0xFF
  8106. while (--i >= 0 && (mul *= 0x100)) {
  8107. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  8108. sub = 1
  8109. }
  8110. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  8111. }
  8112. return offset + byteLength
  8113. }
  8114. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  8115. value = +value
  8116. offset = offset | 0
  8117. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  8118. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  8119. if (value < 0) value = 0xff + value + 1
  8120. this[offset] = (value & 0xff)
  8121. return offset + 1
  8122. }
  8123. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  8124. value = +value
  8125. offset = offset | 0
  8126. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  8127. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8128. this[offset] = (value & 0xff)
  8129. this[offset + 1] = (value >>> 8)
  8130. } else {
  8131. objectWriteUInt16(this, value, offset, true)
  8132. }
  8133. return offset + 2
  8134. }
  8135. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  8136. value = +value
  8137. offset = offset | 0
  8138. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  8139. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8140. this[offset] = (value >>> 8)
  8141. this[offset + 1] = (value & 0xff)
  8142. } else {
  8143. objectWriteUInt16(this, value, offset, false)
  8144. }
  8145. return offset + 2
  8146. }
  8147. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  8148. value = +value
  8149. offset = offset | 0
  8150. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  8151. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8152. this[offset] = (value & 0xff)
  8153. this[offset + 1] = (value >>> 8)
  8154. this[offset + 2] = (value >>> 16)
  8155. this[offset + 3] = (value >>> 24)
  8156. } else {
  8157. objectWriteUInt32(this, value, offset, true)
  8158. }
  8159. return offset + 4
  8160. }
  8161. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  8162. value = +value
  8163. offset = offset | 0
  8164. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  8165. if (value < 0) value = 0xffffffff + value + 1
  8166. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8167. this[offset] = (value >>> 24)
  8168. this[offset + 1] = (value >>> 16)
  8169. this[offset + 2] = (value >>> 8)
  8170. this[offset + 3] = (value & 0xff)
  8171. } else {
  8172. objectWriteUInt32(this, value, offset, false)
  8173. }
  8174. return offset + 4
  8175. }
  8176. function checkIEEE754 (buf, value, offset, ext, max, min) {
  8177. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  8178. if (offset < 0) throw new RangeError('Index out of range')
  8179. }
  8180. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  8181. if (!noAssert) {
  8182. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  8183. }
  8184. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  8185. return offset + 4
  8186. }
  8187. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  8188. return writeFloat(this, value, offset, true, noAssert)
  8189. }
  8190. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  8191. return writeFloat(this, value, offset, false, noAssert)
  8192. }
  8193. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  8194. if (!noAssert) {
  8195. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  8196. }
  8197. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  8198. return offset + 8
  8199. }
  8200. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  8201. return writeDouble(this, value, offset, true, noAssert)
  8202. }
  8203. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  8204. return writeDouble(this, value, offset, false, noAssert)
  8205. }
  8206. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  8207. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  8208. if (!start) start = 0
  8209. if (!end && end !== 0) end = this.length
  8210. if (targetStart >= target.length) targetStart = target.length
  8211. if (!targetStart) targetStart = 0
  8212. if (end > 0 && end < start) end = start
  8213. // Copy 0 bytes; we're done
  8214. if (end === start) return 0
  8215. if (target.length === 0 || this.length === 0) return 0
  8216. // Fatal error conditions
  8217. if (targetStart < 0) {
  8218. throw new RangeError('targetStart out of bounds')
  8219. }
  8220. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  8221. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  8222. // Are we oob?
  8223. if (end > this.length) end = this.length
  8224. if (target.length - targetStart < end - start) {
  8225. end = target.length - targetStart + start
  8226. }
  8227. var len = end - start
  8228. var i
  8229. if (this === target && start < targetStart && targetStart < end) {
  8230. // descending copy from end
  8231. for (i = len - 1; i >= 0; --i) {
  8232. target[i + targetStart] = this[i + start]
  8233. }
  8234. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  8235. // ascending copy from start
  8236. for (i = 0; i < len; ++i) {
  8237. target[i + targetStart] = this[i + start]
  8238. }
  8239. } else {
  8240. Uint8Array.prototype.set.call(
  8241. target,
  8242. this.subarray(start, start + len),
  8243. targetStart
  8244. )
  8245. }
  8246. return len
  8247. }
  8248. // Usage:
  8249. // buffer.fill(number[, offset[, end]])
  8250. // buffer.fill(buffer[, offset[, end]])
  8251. // buffer.fill(string[, offset[, end]][, encoding])
  8252. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  8253. // Handle string cases:
  8254. if (typeof val === 'string') {
  8255. if (typeof start === 'string') {
  8256. encoding = start
  8257. start = 0
  8258. end = this.length
  8259. } else if (typeof end === 'string') {
  8260. encoding = end
  8261. end = this.length
  8262. }
  8263. if (val.length === 1) {
  8264. var code = val.charCodeAt(0)
  8265. if (code < 256) {
  8266. val = code
  8267. }
  8268. }
  8269. if (encoding !== undefined && typeof encoding !== 'string') {
  8270. throw new TypeError('encoding must be a string')
  8271. }
  8272. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  8273. throw new TypeError('Unknown encoding: ' + encoding)
  8274. }
  8275. } else if (typeof val === 'number') {
  8276. val = val & 255
  8277. }
  8278. // Invalid ranges are not set to a default, so can range check early.
  8279. if (start < 0 || this.length < start || this.length < end) {
  8280. throw new RangeError('Out of range index')
  8281. }
  8282. if (end <= start) {
  8283. return this
  8284. }
  8285. start = start >>> 0
  8286. end = end === undefined ? this.length : end >>> 0
  8287. if (!val) val = 0
  8288. var i
  8289. if (typeof val === 'number') {
  8290. for (i = start; i < end; ++i) {
  8291. this[i] = val
  8292. }
  8293. } else {
  8294. var bytes = Buffer.isBuffer(val)
  8295. ? val
  8296. : utf8ToBytes(new Buffer(val, encoding).toString())
  8297. var len = bytes.length
  8298. for (i = 0; i < end - start; ++i) {
  8299. this[i + start] = bytes[i % len]
  8300. }
  8301. }
  8302. return this
  8303. }
  8304. // HELPER FUNCTIONS
  8305. // ================
  8306. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  8307. function base64clean (str) {
  8308. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  8309. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  8310. // Node converts strings with length < 2 to ''
  8311. if (str.length < 2) return ''
  8312. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  8313. while (str.length % 4 !== 0) {
  8314. str = str + '='
  8315. }
  8316. return str
  8317. }
  8318. function stringtrim (str) {
  8319. if (str.trim) return str.trim()
  8320. return str.replace(/^\s+|\s+$/g, '')
  8321. }
  8322. function toHex (n) {
  8323. if (n < 16) return '0' + n.toString(16)
  8324. return n.toString(16)
  8325. }
  8326. function utf8ToBytes (string, units) {
  8327. units = units || Infinity
  8328. var codePoint
  8329. var length = string.length
  8330. var leadSurrogate = null
  8331. var bytes = []
  8332. for (var i = 0; i < length; ++i) {
  8333. codePoint = string.charCodeAt(i)
  8334. // is surrogate component
  8335. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  8336. // last char was a lead
  8337. if (!leadSurrogate) {
  8338. // no lead yet
  8339. if (codePoint > 0xDBFF) {
  8340. // unexpected trail
  8341. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8342. continue
  8343. } else if (i + 1 === length) {
  8344. // unpaired lead
  8345. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8346. continue
  8347. }
  8348. // valid lead
  8349. leadSurrogate = codePoint
  8350. continue
  8351. }
  8352. // 2 leads in a row
  8353. if (codePoint < 0xDC00) {
  8354. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8355. leadSurrogate = codePoint
  8356. continue
  8357. }
  8358. // valid surrogate pair
  8359. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  8360. } else if (leadSurrogate) {
  8361. // valid bmp char, but last char was a lead
  8362. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8363. }
  8364. leadSurrogate = null
  8365. // encode utf8
  8366. if (codePoint < 0x80) {
  8367. if ((units -= 1) < 0) break
  8368. bytes.push(codePoint)
  8369. } else if (codePoint < 0x800) {
  8370. if ((units -= 2) < 0) break
  8371. bytes.push(
  8372. codePoint >> 0x6 | 0xC0,
  8373. codePoint & 0x3F | 0x80
  8374. )
  8375. } else if (codePoint < 0x10000) {
  8376. if ((units -= 3) < 0) break
  8377. bytes.push(
  8378. codePoint >> 0xC | 0xE0,
  8379. codePoint >> 0x6 & 0x3F | 0x80,
  8380. codePoint & 0x3F | 0x80
  8381. )
  8382. } else if (codePoint < 0x110000) {
  8383. if ((units -= 4) < 0) break
  8384. bytes.push(
  8385. codePoint >> 0x12 | 0xF0,
  8386. codePoint >> 0xC & 0x3F | 0x80,
  8387. codePoint >> 0x6 & 0x3F | 0x80,
  8388. codePoint & 0x3F | 0x80
  8389. )
  8390. } else {
  8391. throw new Error('Invalid code point')
  8392. }
  8393. }
  8394. return bytes
  8395. }
  8396. function asciiToBytes (str) {
  8397. var byteArray = []
  8398. for (var i = 0; i < str.length; ++i) {
  8399. // Node's code seems to be doing this and not & 0x7F..
  8400. byteArray.push(str.charCodeAt(i) & 0xFF)
  8401. }
  8402. return byteArray
  8403. }
  8404. function utf16leToBytes (str, units) {
  8405. var c, hi, lo
  8406. var byteArray = []
  8407. for (var i = 0; i < str.length; ++i) {
  8408. if ((units -= 2) < 0) break
  8409. c = str.charCodeAt(i)
  8410. hi = c >> 8
  8411. lo = c % 256
  8412. byteArray.push(lo)
  8413. byteArray.push(hi)
  8414. }
  8415. return byteArray
  8416. }
  8417. function base64ToBytes (str) {
  8418. return base64.toByteArray(base64clean(str))
  8419. }
  8420. function blitBuffer (src, dst, offset, length) {
  8421. for (var i = 0; i < length; ++i) {
  8422. if ((i + offset >= dst.length) || (i >= src.length)) break
  8423. dst[i + offset] = src[i]
  8424. }
  8425. return i
  8426. }
  8427. function isnan (val) {
  8428. return val !== val // eslint-disable-line no-self-compare
  8429. }
  8430. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  8431. /***/ }),
  8432. /***/ "./node_modules/clipboard/dist/clipboard.js":
  8433. /*!**************************************************!*\
  8434. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  8435. \**************************************************/
  8436. /*! no static exports found */
  8437. /***/ (function(module, exports, __webpack_require__) {
  8438. /*!
  8439. * clipboard.js v2.0.4
  8440. * https://zenorocha.github.io/clipboard.js
  8441. *
  8442. * Licensed MIT © Zeno Rocha
  8443. */
  8444. (function webpackUniversalModuleDefinition(root, factory) {
  8445. if(true)
  8446. module.exports = factory();
  8447. else {}
  8448. })(this, function() {
  8449. return /******/ (function(modules) { // webpackBootstrap
  8450. /******/ // The module cache
  8451. /******/ var installedModules = {};
  8452. /******/
  8453. /******/ // The require function
  8454. /******/ function __webpack_require__(moduleId) {
  8455. /******/
  8456. /******/ // Check if module is in cache
  8457. /******/ if(installedModules[moduleId]) {
  8458. /******/ return installedModules[moduleId].exports;
  8459. /******/ }
  8460. /******/ // Create a new module (and put it into the cache)
  8461. /******/ var module = installedModules[moduleId] = {
  8462. /******/ i: moduleId,
  8463. /******/ l: false,
  8464. /******/ exports: {}
  8465. /******/ };
  8466. /******/
  8467. /******/ // Execute the module function
  8468. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  8469. /******/
  8470. /******/ // Flag the module as loaded
  8471. /******/ module.l = true;
  8472. /******/
  8473. /******/ // Return the exports of the module
  8474. /******/ return module.exports;
  8475. /******/ }
  8476. /******/
  8477. /******/
  8478. /******/ // expose the modules object (__webpack_modules__)
  8479. /******/ __webpack_require__.m = modules;
  8480. /******/
  8481. /******/ // expose the module cache
  8482. /******/ __webpack_require__.c = installedModules;
  8483. /******/
  8484. /******/ // define getter function for harmony exports
  8485. /******/ __webpack_require__.d = function(exports, name, getter) {
  8486. /******/ if(!__webpack_require__.o(exports, name)) {
  8487. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  8488. /******/ }
  8489. /******/ };
  8490. /******/
  8491. /******/ // define __esModule on exports
  8492. /******/ __webpack_require__.r = function(exports) {
  8493. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  8494. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  8495. /******/ }
  8496. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  8497. /******/ };
  8498. /******/
  8499. /******/ // create a fake namespace object
  8500. /******/ // mode & 1: value is a module id, require it
  8501. /******/ // mode & 2: merge all properties of value into the ns
  8502. /******/ // mode & 4: return value when already ns object
  8503. /******/ // mode & 8|1: behave like require
  8504. /******/ __webpack_require__.t = function(value, mode) {
  8505. /******/ if(mode & 1) value = __webpack_require__(value);
  8506. /******/ if(mode & 8) return value;
  8507. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  8508. /******/ var ns = Object.create(null);
  8509. /******/ __webpack_require__.r(ns);
  8510. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  8511. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  8512. /******/ return ns;
  8513. /******/ };
  8514. /******/
  8515. /******/ // getDefaultExport function for compatibility with non-harmony modules
  8516. /******/ __webpack_require__.n = function(module) {
  8517. /******/ var getter = module && module.__esModule ?
  8518. /******/ function getDefault() { return module['default']; } :
  8519. /******/ function getModuleExports() { return module; };
  8520. /******/ __webpack_require__.d(getter, 'a', getter);
  8521. /******/ return getter;
  8522. /******/ };
  8523. /******/
  8524. /******/ // Object.prototype.hasOwnProperty.call
  8525. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  8526. /******/
  8527. /******/ // __webpack_public_path__
  8528. /******/ __webpack_require__.p = "";
  8529. /******/
  8530. /******/
  8531. /******/ // Load entry module and return exports
  8532. /******/ return __webpack_require__(__webpack_require__.s = 0);
  8533. /******/ })
  8534. /************************************************************************/
  8535. /******/ ([
  8536. /* 0 */
  8537. /***/ (function(module, exports, __webpack_require__) {
  8538. "use strict";
  8539. 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; };
  8540. 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; }; }();
  8541. var _clipboardAction = __webpack_require__(1);
  8542. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  8543. var _tinyEmitter = __webpack_require__(3);
  8544. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  8545. var _goodListener = __webpack_require__(4);
  8546. var _goodListener2 = _interopRequireDefault(_goodListener);
  8547. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8548. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8549. 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; }
  8550. 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; }
  8551. /**
  8552. * Base class which takes one or more elements, adds event listeners to them,
  8553. * and instantiates a new `ClipboardAction` on each click.
  8554. */
  8555. var Clipboard = function (_Emitter) {
  8556. _inherits(Clipboard, _Emitter);
  8557. /**
  8558. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  8559. * @param {Object} options
  8560. */
  8561. function Clipboard(trigger, options) {
  8562. _classCallCheck(this, Clipboard);
  8563. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  8564. _this.resolveOptions(options);
  8565. _this.listenClick(trigger);
  8566. return _this;
  8567. }
  8568. /**
  8569. * Defines if attributes would be resolved using internal setter functions
  8570. * or custom functions that were passed in the constructor.
  8571. * @param {Object} options
  8572. */
  8573. _createClass(Clipboard, [{
  8574. key: 'resolveOptions',
  8575. value: function resolveOptions() {
  8576. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8577. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  8578. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  8579. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  8580. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  8581. }
  8582. /**
  8583. * Adds a click event listener to the passed trigger.
  8584. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  8585. */
  8586. }, {
  8587. key: 'listenClick',
  8588. value: function listenClick(trigger) {
  8589. var _this2 = this;
  8590. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  8591. return _this2.onClick(e);
  8592. });
  8593. }
  8594. /**
  8595. * Defines a new `ClipboardAction` on each click event.
  8596. * @param {Event} e
  8597. */
  8598. }, {
  8599. key: 'onClick',
  8600. value: function onClick(e) {
  8601. var trigger = e.delegateTarget || e.currentTarget;
  8602. if (this.clipboardAction) {
  8603. this.clipboardAction = null;
  8604. }
  8605. this.clipboardAction = new _clipboardAction2.default({
  8606. action: this.action(trigger),
  8607. target: this.target(trigger),
  8608. text: this.text(trigger),
  8609. container: this.container,
  8610. trigger: trigger,
  8611. emitter: this
  8612. });
  8613. }
  8614. /**
  8615. * Default `action` lookup function.
  8616. * @param {Element} trigger
  8617. */
  8618. }, {
  8619. key: 'defaultAction',
  8620. value: function defaultAction(trigger) {
  8621. return getAttributeValue('action', trigger);
  8622. }
  8623. /**
  8624. * Default `target` lookup function.
  8625. * @param {Element} trigger
  8626. */
  8627. }, {
  8628. key: 'defaultTarget',
  8629. value: function defaultTarget(trigger) {
  8630. var selector = getAttributeValue('target', trigger);
  8631. if (selector) {
  8632. return document.querySelector(selector);
  8633. }
  8634. }
  8635. /**
  8636. * Returns the support of the given action, or all actions if no action is
  8637. * given.
  8638. * @param {String} [action]
  8639. */
  8640. }, {
  8641. key: 'defaultText',
  8642. /**
  8643. * Default `text` lookup function.
  8644. * @param {Element} trigger
  8645. */
  8646. value: function defaultText(trigger) {
  8647. return getAttributeValue('text', trigger);
  8648. }
  8649. /**
  8650. * Destroy lifecycle.
  8651. */
  8652. }, {
  8653. key: 'destroy',
  8654. value: function destroy() {
  8655. this.listener.destroy();
  8656. if (this.clipboardAction) {
  8657. this.clipboardAction.destroy();
  8658. this.clipboardAction = null;
  8659. }
  8660. }
  8661. }], [{
  8662. key: 'isSupported',
  8663. value: function isSupported() {
  8664. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  8665. var actions = typeof action === 'string' ? [action] : action;
  8666. var support = !!document.queryCommandSupported;
  8667. actions.forEach(function (action) {
  8668. support = support && !!document.queryCommandSupported(action);
  8669. });
  8670. return support;
  8671. }
  8672. }]);
  8673. return Clipboard;
  8674. }(_tinyEmitter2.default);
  8675. /**
  8676. * Helper function to retrieve attribute value.
  8677. * @param {String} suffix
  8678. * @param {Element} element
  8679. */
  8680. function getAttributeValue(suffix, element) {
  8681. var attribute = 'data-clipboard-' + suffix;
  8682. if (!element.hasAttribute(attribute)) {
  8683. return;
  8684. }
  8685. return element.getAttribute(attribute);
  8686. }
  8687. module.exports = Clipboard;
  8688. /***/ }),
  8689. /* 1 */
  8690. /***/ (function(module, exports, __webpack_require__) {
  8691. "use strict";
  8692. 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; };
  8693. 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; }; }();
  8694. var _select = __webpack_require__(2);
  8695. var _select2 = _interopRequireDefault(_select);
  8696. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8697. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8698. /**
  8699. * Inner class which performs selection from either `text` or `target`
  8700. * properties and then executes copy or cut operations.
  8701. */
  8702. var ClipboardAction = function () {
  8703. /**
  8704. * @param {Object} options
  8705. */
  8706. function ClipboardAction(options) {
  8707. _classCallCheck(this, ClipboardAction);
  8708. this.resolveOptions(options);
  8709. this.initSelection();
  8710. }
  8711. /**
  8712. * Defines base properties passed from constructor.
  8713. * @param {Object} options
  8714. */
  8715. _createClass(ClipboardAction, [{
  8716. key: 'resolveOptions',
  8717. value: function resolveOptions() {
  8718. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8719. this.action = options.action;
  8720. this.container = options.container;
  8721. this.emitter = options.emitter;
  8722. this.target = options.target;
  8723. this.text = options.text;
  8724. this.trigger = options.trigger;
  8725. this.selectedText = '';
  8726. }
  8727. /**
  8728. * Decides which selection strategy is going to be applied based
  8729. * on the existence of `text` and `target` properties.
  8730. */
  8731. }, {
  8732. key: 'initSelection',
  8733. value: function initSelection() {
  8734. if (this.text) {
  8735. this.selectFake();
  8736. } else if (this.target) {
  8737. this.selectTarget();
  8738. }
  8739. }
  8740. /**
  8741. * Creates a fake textarea element, sets its value from `text` property,
  8742. * and makes a selection on it.
  8743. */
  8744. }, {
  8745. key: 'selectFake',
  8746. value: function selectFake() {
  8747. var _this = this;
  8748. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  8749. this.removeFake();
  8750. this.fakeHandlerCallback = function () {
  8751. return _this.removeFake();
  8752. };
  8753. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8754. this.fakeElem = document.createElement('textarea');
  8755. // Prevent zooming on iOS
  8756. this.fakeElem.style.fontSize = '12pt';
  8757. // Reset box model
  8758. this.fakeElem.style.border = '0';
  8759. this.fakeElem.style.padding = '0';
  8760. this.fakeElem.style.margin = '0';
  8761. // Move element out of screen horizontally
  8762. this.fakeElem.style.position = 'absolute';
  8763. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8764. // Move element to the same position vertically
  8765. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8766. this.fakeElem.style.top = yPosition + 'px';
  8767. this.fakeElem.setAttribute('readonly', '');
  8768. this.fakeElem.value = this.text;
  8769. this.container.appendChild(this.fakeElem);
  8770. this.selectedText = (0, _select2.default)(this.fakeElem);
  8771. this.copyText();
  8772. }
  8773. /**
  8774. * Only removes the fake element after another click event, that way
  8775. * a user can hit `Ctrl+C` to copy because selection still exists.
  8776. */
  8777. }, {
  8778. key: 'removeFake',
  8779. value: function removeFake() {
  8780. if (this.fakeHandler) {
  8781. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8782. this.fakeHandler = null;
  8783. this.fakeHandlerCallback = null;
  8784. }
  8785. if (this.fakeElem) {
  8786. this.container.removeChild(this.fakeElem);
  8787. this.fakeElem = null;
  8788. }
  8789. }
  8790. /**
  8791. * Selects the content from element passed on `target` property.
  8792. */
  8793. }, {
  8794. key: 'selectTarget',
  8795. value: function selectTarget() {
  8796. this.selectedText = (0, _select2.default)(this.target);
  8797. this.copyText();
  8798. }
  8799. /**
  8800. * Executes the copy operation based on the current selection.
  8801. */
  8802. }, {
  8803. key: 'copyText',
  8804. value: function copyText() {
  8805. var succeeded = void 0;
  8806. try {
  8807. succeeded = document.execCommand(this.action);
  8808. } catch (err) {
  8809. succeeded = false;
  8810. }
  8811. this.handleResult(succeeded);
  8812. }
  8813. /**
  8814. * Fires an event based on the copy operation result.
  8815. * @param {Boolean} succeeded
  8816. */
  8817. }, {
  8818. key: 'handleResult',
  8819. value: function handleResult(succeeded) {
  8820. this.emitter.emit(succeeded ? 'success' : 'error', {
  8821. action: this.action,
  8822. text: this.selectedText,
  8823. trigger: this.trigger,
  8824. clearSelection: this.clearSelection.bind(this)
  8825. });
  8826. }
  8827. /**
  8828. * Moves focus away from `target` and back to the trigger, removes current selection.
  8829. */
  8830. }, {
  8831. key: 'clearSelection',
  8832. value: function clearSelection() {
  8833. if (this.trigger) {
  8834. this.trigger.focus();
  8835. }
  8836. window.getSelection().removeAllRanges();
  8837. }
  8838. /**
  8839. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8840. * @param {String} action
  8841. */
  8842. }, {
  8843. key: 'destroy',
  8844. /**
  8845. * Destroy lifecycle.
  8846. */
  8847. value: function destroy() {
  8848. this.removeFake();
  8849. }
  8850. }, {
  8851. key: 'action',
  8852. set: function set() {
  8853. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8854. this._action = action;
  8855. if (this._action !== 'copy' && this._action !== 'cut') {
  8856. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8857. }
  8858. }
  8859. /**
  8860. * Gets the `action` property.
  8861. * @return {String}
  8862. */
  8863. ,
  8864. get: function get() {
  8865. return this._action;
  8866. }
  8867. /**
  8868. * Sets the `target` property using an element
  8869. * that will be have its content copied.
  8870. * @param {Element} target
  8871. */
  8872. }, {
  8873. key: 'target',
  8874. set: function set(target) {
  8875. if (target !== undefined) {
  8876. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8877. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8878. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8879. }
  8880. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8881. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8882. }
  8883. this._target = target;
  8884. } else {
  8885. throw new Error('Invalid "target" value, use a valid Element');
  8886. }
  8887. }
  8888. }
  8889. /**
  8890. * Gets the `target` property.
  8891. * @return {String|HTMLElement}
  8892. */
  8893. ,
  8894. get: function get() {
  8895. return this._target;
  8896. }
  8897. }]);
  8898. return ClipboardAction;
  8899. }();
  8900. module.exports = ClipboardAction;
  8901. /***/ }),
  8902. /* 2 */
  8903. /***/ (function(module, exports) {
  8904. function select(element) {
  8905. var selectedText;
  8906. if (element.nodeName === 'SELECT') {
  8907. element.focus();
  8908. selectedText = element.value;
  8909. }
  8910. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8911. var isReadOnly = element.hasAttribute('readonly');
  8912. if (!isReadOnly) {
  8913. element.setAttribute('readonly', '');
  8914. }
  8915. element.select();
  8916. element.setSelectionRange(0, element.value.length);
  8917. if (!isReadOnly) {
  8918. element.removeAttribute('readonly');
  8919. }
  8920. selectedText = element.value;
  8921. }
  8922. else {
  8923. if (element.hasAttribute('contenteditable')) {
  8924. element.focus();
  8925. }
  8926. var selection = window.getSelection();
  8927. var range = document.createRange();
  8928. range.selectNodeContents(element);
  8929. selection.removeAllRanges();
  8930. selection.addRange(range);
  8931. selectedText = selection.toString();
  8932. }
  8933. return selectedText;
  8934. }
  8935. module.exports = select;
  8936. /***/ }),
  8937. /* 3 */
  8938. /***/ (function(module, exports) {
  8939. function E () {
  8940. // Keep this empty so it's easier to inherit from
  8941. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8942. }
  8943. E.prototype = {
  8944. on: function (name, callback, ctx) {
  8945. var e = this.e || (this.e = {});
  8946. (e[name] || (e[name] = [])).push({
  8947. fn: callback,
  8948. ctx: ctx
  8949. });
  8950. return this;
  8951. },
  8952. once: function (name, callback, ctx) {
  8953. var self = this;
  8954. function listener () {
  8955. self.off(name, listener);
  8956. callback.apply(ctx, arguments);
  8957. };
  8958. listener._ = callback
  8959. return this.on(name, listener, ctx);
  8960. },
  8961. emit: function (name) {
  8962. var data = [].slice.call(arguments, 1);
  8963. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8964. var i = 0;
  8965. var len = evtArr.length;
  8966. for (i; i < len; i++) {
  8967. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8968. }
  8969. return this;
  8970. },
  8971. off: function (name, callback) {
  8972. var e = this.e || (this.e = {});
  8973. var evts = e[name];
  8974. var liveEvents = [];
  8975. if (evts && callback) {
  8976. for (var i = 0, len = evts.length; i < len; i++) {
  8977. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8978. liveEvents.push(evts[i]);
  8979. }
  8980. }
  8981. // Remove event from queue to prevent memory leak
  8982. // Suggested by https://github.com/lazd
  8983. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8984. (liveEvents.length)
  8985. ? e[name] = liveEvents
  8986. : delete e[name];
  8987. return this;
  8988. }
  8989. };
  8990. module.exports = E;
  8991. /***/ }),
  8992. /* 4 */
  8993. /***/ (function(module, exports, __webpack_require__) {
  8994. var is = __webpack_require__(5);
  8995. var delegate = __webpack_require__(6);
  8996. /**
  8997. * Validates all params and calls the right
  8998. * listener function based on its target type.
  8999. *
  9000. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  9001. * @param {String} type
  9002. * @param {Function} callback
  9003. * @return {Object}
  9004. */
  9005. function listen(target, type, callback) {
  9006. if (!target && !type && !callback) {
  9007. throw new Error('Missing required arguments');
  9008. }
  9009. if (!is.string(type)) {
  9010. throw new TypeError('Second argument must be a String');
  9011. }
  9012. if (!is.fn(callback)) {
  9013. throw new TypeError('Third argument must be a Function');
  9014. }
  9015. if (is.node(target)) {
  9016. return listenNode(target, type, callback);
  9017. }
  9018. else if (is.nodeList(target)) {
  9019. return listenNodeList(target, type, callback);
  9020. }
  9021. else if (is.string(target)) {
  9022. return listenSelector(target, type, callback);
  9023. }
  9024. else {
  9025. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  9026. }
  9027. }
  9028. /**
  9029. * Adds an event listener to a HTML element
  9030. * and returns a remove listener function.
  9031. *
  9032. * @param {HTMLElement} node
  9033. * @param {String} type
  9034. * @param {Function} callback
  9035. * @return {Object}
  9036. */
  9037. function listenNode(node, type, callback) {
  9038. node.addEventListener(type, callback);
  9039. return {
  9040. destroy: function() {
  9041. node.removeEventListener(type, callback);
  9042. }
  9043. }
  9044. }
  9045. /**
  9046. * Add an event listener to a list of HTML elements
  9047. * and returns a remove listener function.
  9048. *
  9049. * @param {NodeList|HTMLCollection} nodeList
  9050. * @param {String} type
  9051. * @param {Function} callback
  9052. * @return {Object}
  9053. */
  9054. function listenNodeList(nodeList, type, callback) {
  9055. Array.prototype.forEach.call(nodeList, function(node) {
  9056. node.addEventListener(type, callback);
  9057. });
  9058. return {
  9059. destroy: function() {
  9060. Array.prototype.forEach.call(nodeList, function(node) {
  9061. node.removeEventListener(type, callback);
  9062. });
  9063. }
  9064. }
  9065. }
  9066. /**
  9067. * Add an event listener to a selector
  9068. * and returns a remove listener function.
  9069. *
  9070. * @param {String} selector
  9071. * @param {String} type
  9072. * @param {Function} callback
  9073. * @return {Object}
  9074. */
  9075. function listenSelector(selector, type, callback) {
  9076. return delegate(document.body, selector, type, callback);
  9077. }
  9078. module.exports = listen;
  9079. /***/ }),
  9080. /* 5 */
  9081. /***/ (function(module, exports) {
  9082. /**
  9083. * Check if argument is a HTML element.
  9084. *
  9085. * @param {Object} value
  9086. * @return {Boolean}
  9087. */
  9088. exports.node = function(value) {
  9089. return value !== undefined
  9090. && value instanceof HTMLElement
  9091. && value.nodeType === 1;
  9092. };
  9093. /**
  9094. * Check if argument is a list of HTML elements.
  9095. *
  9096. * @param {Object} value
  9097. * @return {Boolean}
  9098. */
  9099. exports.nodeList = function(value) {
  9100. var type = Object.prototype.toString.call(value);
  9101. return value !== undefined
  9102. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  9103. && ('length' in value)
  9104. && (value.length === 0 || exports.node(value[0]));
  9105. };
  9106. /**
  9107. * Check if argument is a string.
  9108. *
  9109. * @param {Object} value
  9110. * @return {Boolean}
  9111. */
  9112. exports.string = function(value) {
  9113. return typeof value === 'string'
  9114. || value instanceof String;
  9115. };
  9116. /**
  9117. * Check if argument is a function.
  9118. *
  9119. * @param {Object} value
  9120. * @return {Boolean}
  9121. */
  9122. exports.fn = function(value) {
  9123. var type = Object.prototype.toString.call(value);
  9124. return type === '[object Function]';
  9125. };
  9126. /***/ }),
  9127. /* 6 */
  9128. /***/ (function(module, exports, __webpack_require__) {
  9129. var closest = __webpack_require__(7);
  9130. /**
  9131. * Delegates event to a selector.
  9132. *
  9133. * @param {Element} element
  9134. * @param {String} selector
  9135. * @param {String} type
  9136. * @param {Function} callback
  9137. * @param {Boolean} useCapture
  9138. * @return {Object}
  9139. */
  9140. function _delegate(element, selector, type, callback, useCapture) {
  9141. var listenerFn = listener.apply(this, arguments);
  9142. element.addEventListener(type, listenerFn, useCapture);
  9143. return {
  9144. destroy: function() {
  9145. element.removeEventListener(type, listenerFn, useCapture);
  9146. }
  9147. }
  9148. }
  9149. /**
  9150. * Delegates event to a selector.
  9151. *
  9152. * @param {Element|String|Array} [elements]
  9153. * @param {String} selector
  9154. * @param {String} type
  9155. * @param {Function} callback
  9156. * @param {Boolean} useCapture
  9157. * @return {Object}
  9158. */
  9159. function delegate(elements, selector, type, callback, useCapture) {
  9160. // Handle the regular Element usage
  9161. if (typeof elements.addEventListener === 'function') {
  9162. return _delegate.apply(null, arguments);
  9163. }
  9164. // Handle Element-less usage, it defaults to global delegation
  9165. if (typeof type === 'function') {
  9166. // Use `document` as the first parameter, then apply arguments
  9167. // This is a short way to .unshift `arguments` without running into deoptimizations
  9168. return _delegate.bind(null, document).apply(null, arguments);
  9169. }
  9170. // Handle Selector-based usage
  9171. if (typeof elements === 'string') {
  9172. elements = document.querySelectorAll(elements);
  9173. }
  9174. // Handle Array-like based usage
  9175. return Array.prototype.map.call(elements, function (element) {
  9176. return _delegate(element, selector, type, callback, useCapture);
  9177. });
  9178. }
  9179. /**
  9180. * Finds closest match and invokes callback.
  9181. *
  9182. * @param {Element} element
  9183. * @param {String} selector
  9184. * @param {String} type
  9185. * @param {Function} callback
  9186. * @return {Function}
  9187. */
  9188. function listener(element, selector, type, callback) {
  9189. return function(e) {
  9190. e.delegateTarget = closest(e.target, selector);
  9191. if (e.delegateTarget) {
  9192. callback.call(element, e);
  9193. }
  9194. }
  9195. }
  9196. module.exports = delegate;
  9197. /***/ }),
  9198. /* 7 */
  9199. /***/ (function(module, exports) {
  9200. var DOCUMENT_NODE_TYPE = 9;
  9201. /**
  9202. * A polyfill for Element.matches()
  9203. */
  9204. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  9205. var proto = Element.prototype;
  9206. proto.matches = proto.matchesSelector ||
  9207. proto.mozMatchesSelector ||
  9208. proto.msMatchesSelector ||
  9209. proto.oMatchesSelector ||
  9210. proto.webkitMatchesSelector;
  9211. }
  9212. /**
  9213. * Finds the closest parent that matches a selector.
  9214. *
  9215. * @param {Element} element
  9216. * @param {String} selector
  9217. * @return {Function}
  9218. */
  9219. function closest (element, selector) {
  9220. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  9221. if (typeof element.matches === 'function' &&
  9222. element.matches(selector)) {
  9223. return element;
  9224. }
  9225. element = element.parentNode;
  9226. }
  9227. }
  9228. module.exports = closest;
  9229. /***/ })
  9230. /******/ ]);
  9231. });
  9232. /***/ }),
  9233. /***/ "./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&":
  9234. /*!*******************************************************************************************************************************************************************************************************************************************************************************************************!*\
  9235. !*** ./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& ***!
  9236. \*******************************************************************************************************************************************************************************************************************************************************************************************************/
  9237. /*! no static exports found */
  9238. /***/ (function(module, exports, __webpack_require__) {
  9239. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  9240. // imports
  9241. // module
  9242. 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", ""]);
  9243. // exports
  9244. /***/ }),
  9245. /***/ "./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&":
  9246. /*!********************************************************************************************************************************************************************************************************************************************************************************************!*\
  9247. !*** ./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& ***!
  9248. \********************************************************************************************************************************************************************************************************************************************************************************************/
  9249. /*! no static exports found */
  9250. /***/ (function(module, exports, __webpack_require__) {
  9251. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
  9252. // imports
  9253. // module
  9254. 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", ""]);
  9255. // exports
  9256. /***/ }),
  9257. /***/ "./node_modules/css-loader/lib/css-base.js":
  9258. /*!*************************************************!*\
  9259. !*** ./node_modules/css-loader/lib/css-base.js ***!
  9260. \*************************************************/
  9261. /*! no static exports found */
  9262. /***/ (function(module, exports) {
  9263. /*
  9264. MIT License http://www.opensource.org/licenses/mit-license.php
  9265. Author Tobias Koppers @sokra
  9266. */
  9267. // css base code, injected by the css-loader
  9268. module.exports = function(useSourceMap) {
  9269. var list = [];
  9270. // return the list of modules as css string
  9271. list.toString = function toString() {
  9272. return this.map(function (item) {
  9273. var content = cssWithMappingToString(item, useSourceMap);
  9274. if(item[2]) {
  9275. return "@media " + item[2] + "{" + content + "}";
  9276. } else {
  9277. return content;
  9278. }
  9279. }).join("");
  9280. };
  9281. // import a list of modules into the list
  9282. list.i = function(modules, mediaQuery) {
  9283. if(typeof modules === "string")
  9284. modules = [[null, modules, ""]];
  9285. var alreadyImportedModules = {};
  9286. for(var i = 0; i < this.length; i++) {
  9287. var id = this[i][0];
  9288. if(typeof id === "number")
  9289. alreadyImportedModules[id] = true;
  9290. }
  9291. for(i = 0; i < modules.length; i++) {
  9292. var item = modules[i];
  9293. // skip already imported module
  9294. // this implementation is not 100% perfect for weird media query combinations
  9295. // when a module is imported multiple times with different media queries.
  9296. // I hope this will never occur (Hey this way we have smaller bundles)
  9297. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  9298. if(mediaQuery && !item[2]) {
  9299. item[2] = mediaQuery;
  9300. } else if(mediaQuery) {
  9301. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  9302. }
  9303. list.push(item);
  9304. }
  9305. }
  9306. };
  9307. return list;
  9308. };
  9309. function cssWithMappingToString(item, useSourceMap) {
  9310. var content = item[1] || '';
  9311. var cssMapping = item[3];
  9312. if (!cssMapping) {
  9313. return content;
  9314. }
  9315. if (useSourceMap && typeof btoa === 'function') {
  9316. var sourceMapping = toComment(cssMapping);
  9317. var sourceURLs = cssMapping.sources.map(function (source) {
  9318. return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
  9319. });
  9320. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  9321. }
  9322. return [content].join('\n');
  9323. }
  9324. // Adapted from convert-source-map (MIT)
  9325. function toComment(sourceMap) {
  9326. // eslint-disable-next-line no-undef
  9327. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  9328. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  9329. return '/*# ' + data + ' */';
  9330. }
  9331. /***/ }),
  9332. /***/ "./node_modules/ieee754/index.js":
  9333. /*!***************************************!*\
  9334. !*** ./node_modules/ieee754/index.js ***!
  9335. \***************************************/
  9336. /*! no static exports found */
  9337. /***/ (function(module, exports) {
  9338. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  9339. var e, m
  9340. var eLen = (nBytes * 8) - mLen - 1
  9341. var eMax = (1 << eLen) - 1
  9342. var eBias = eMax >> 1
  9343. var nBits = -7
  9344. var i = isLE ? (nBytes - 1) : 0
  9345. var d = isLE ? -1 : 1
  9346. var s = buffer[offset + i]
  9347. i += d
  9348. e = s & ((1 << (-nBits)) - 1)
  9349. s >>= (-nBits)
  9350. nBits += eLen
  9351. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9352. m = e & ((1 << (-nBits)) - 1)
  9353. e >>= (-nBits)
  9354. nBits += mLen
  9355. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  9356. if (e === 0) {
  9357. e = 1 - eBias
  9358. } else if (e === eMax) {
  9359. return m ? NaN : ((s ? -1 : 1) * Infinity)
  9360. } else {
  9361. m = m + Math.pow(2, mLen)
  9362. e = e - eBias
  9363. }
  9364. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  9365. }
  9366. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  9367. var e, m, c
  9368. var eLen = (nBytes * 8) - mLen - 1
  9369. var eMax = (1 << eLen) - 1
  9370. var eBias = eMax >> 1
  9371. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  9372. var i = isLE ? 0 : (nBytes - 1)
  9373. var d = isLE ? 1 : -1
  9374. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  9375. value = Math.abs(value)
  9376. if (isNaN(value) || value === Infinity) {
  9377. m = isNaN(value) ? 1 : 0
  9378. e = eMax
  9379. } else {
  9380. e = Math.floor(Math.log(value) / Math.LN2)
  9381. if (value * (c = Math.pow(2, -e)) < 1) {
  9382. e--
  9383. c *= 2
  9384. }
  9385. if (e + eBias >= 1) {
  9386. value += rt / c
  9387. } else {
  9388. value += rt * Math.pow(2, 1 - eBias)
  9389. }
  9390. if (value * c >= 2) {
  9391. e++
  9392. c /= 2
  9393. }
  9394. if (e + eBias >= eMax) {
  9395. m = 0
  9396. e = eMax
  9397. } else if (e + eBias >= 1) {
  9398. m = ((value * c) - 1) * Math.pow(2, mLen)
  9399. e = e + eBias
  9400. } else {
  9401. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  9402. e = 0
  9403. }
  9404. }
  9405. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  9406. e = (e << mLen) | m
  9407. eLen += mLen
  9408. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  9409. buffer[offset + i - d] |= s * 128
  9410. }
  9411. /***/ }),
  9412. /***/ "./node_modules/isarray/index.js":
  9413. /*!***************************************!*\
  9414. !*** ./node_modules/isarray/index.js ***!
  9415. \***************************************/
  9416. /*! no static exports found */
  9417. /***/ (function(module, exports) {
  9418. var toString = {}.toString;
  9419. module.exports = Array.isArray || function (arr) {
  9420. return toString.call(arr) == '[object Array]';
  9421. };
  9422. /***/ }),
  9423. /***/ "./node_modules/jquery/dist/jquery.js":
  9424. /*!********************************************!*\
  9425. !*** ./node_modules/jquery/dist/jquery.js ***!
  9426. \********************************************/
  9427. /*! no static exports found */
  9428. /***/ (function(module, exports, __webpack_require__) {
  9429. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  9430. * jQuery JavaScript Library v3.4.1
  9431. * https://jquery.com/
  9432. *
  9433. * Includes Sizzle.js
  9434. * https://sizzlejs.com/
  9435. *
  9436. * Copyright JS Foundation and other contributors
  9437. * Released under the MIT license
  9438. * https://jquery.org/license
  9439. *
  9440. * Date: 2019-05-01T21:04Z
  9441. */
  9442. ( function( global, factory ) {
  9443. "use strict";
  9444. if ( true && typeof module.exports === "object" ) {
  9445. // For CommonJS and CommonJS-like environments where a proper `window`
  9446. // is present, execute the factory and get jQuery.
  9447. // For environments that do not have a `window` with a `document`
  9448. // (such as Node.js), expose a factory as module.exports.
  9449. // This accentuates the need for the creation of a real `window`.
  9450. // e.g. var jQuery = require("jquery")(window);
  9451. // See ticket #14549 for more info.
  9452. module.exports = global.document ?
  9453. factory( global, true ) :
  9454. function( w ) {
  9455. if ( !w.document ) {
  9456. throw new Error( "jQuery requires a window with a document" );
  9457. }
  9458. return factory( w );
  9459. };
  9460. } else {
  9461. factory( global );
  9462. }
  9463. // Pass this if window is not defined yet
  9464. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  9465. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  9466. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  9467. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  9468. // enough that all such attempts are guarded in a try block.
  9469. "use strict";
  9470. var arr = [];
  9471. var document = window.document;
  9472. var getProto = Object.getPrototypeOf;
  9473. var slice = arr.slice;
  9474. var concat = arr.concat;
  9475. var push = arr.push;
  9476. var indexOf = arr.indexOf;
  9477. var class2type = {};
  9478. var toString = class2type.toString;
  9479. var hasOwn = class2type.hasOwnProperty;
  9480. var fnToString = hasOwn.toString;
  9481. var ObjectFunctionString = fnToString.call( Object );
  9482. var support = {};
  9483. var isFunction = function isFunction( obj ) {
  9484. // Support: Chrome <=57, Firefox <=52
  9485. // In some browsers, typeof returns "function" for HTML <object> elements
  9486. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  9487. // We don't want to classify *any* DOM node as a function.
  9488. return typeof obj === "function" && typeof obj.nodeType !== "number";
  9489. };
  9490. var isWindow = function isWindow( obj ) {
  9491. return obj != null && obj === obj.window;
  9492. };
  9493. var preservedScriptAttributes = {
  9494. type: true,
  9495. src: true,
  9496. nonce: true,
  9497. noModule: true
  9498. };
  9499. function DOMEval( code, node, doc ) {
  9500. doc = doc || document;
  9501. var i, val,
  9502. script = doc.createElement( "script" );
  9503. script.text = code;
  9504. if ( node ) {
  9505. for ( i in preservedScriptAttributes ) {
  9506. // Support: Firefox 64+, Edge 18+
  9507. // Some browsers don't support the "nonce" property on scripts.
  9508. // On the other hand, just using `getAttribute` is not enough as
  9509. // the `nonce` attribute is reset to an empty string whenever it
  9510. // becomes browsing-context connected.
  9511. // See https://github.com/whatwg/html/issues/2369
  9512. // See https://html.spec.whatwg.org/#nonce-attributes
  9513. // The `node.getAttribute` check was added for the sake of
  9514. // `jQuery.globalEval` so that it can fake a nonce-containing node
  9515. // via an object.
  9516. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  9517. if ( val ) {
  9518. script.setAttribute( i, val );
  9519. }
  9520. }
  9521. }
  9522. doc.head.appendChild( script ).parentNode.removeChild( script );
  9523. }
  9524. function toType( obj ) {
  9525. if ( obj == null ) {
  9526. return obj + "";
  9527. }
  9528. // Support: Android <=2.3 only (functionish RegExp)
  9529. return typeof obj === "object" || typeof obj === "function" ?
  9530. class2type[ toString.call( obj ) ] || "object" :
  9531. typeof obj;
  9532. }
  9533. /* global Symbol */
  9534. // Defining this global in .eslintrc.json would create a danger of using the global
  9535. // unguarded in another place, it seems safer to define global only for this module
  9536. var
  9537. version = "3.4.1",
  9538. // Define a local copy of jQuery
  9539. jQuery = function( selector, context ) {
  9540. // The jQuery object is actually just the init constructor 'enhanced'
  9541. // Need init if jQuery is called (just allow error to be thrown if not included)
  9542. return new jQuery.fn.init( selector, context );
  9543. },
  9544. // Support: Android <=4.0 only
  9545. // Make sure we trim BOM and NBSP
  9546. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  9547. jQuery.fn = jQuery.prototype = {
  9548. // The current version of jQuery being used
  9549. jquery: version,
  9550. constructor: jQuery,
  9551. // The default length of a jQuery object is 0
  9552. length: 0,
  9553. toArray: function() {
  9554. return slice.call( this );
  9555. },
  9556. // Get the Nth element in the matched element set OR
  9557. // Get the whole matched element set as a clean array
  9558. get: function( num ) {
  9559. // Return all the elements in a clean array
  9560. if ( num == null ) {
  9561. return slice.call( this );
  9562. }
  9563. // Return just the one element from the set
  9564. return num < 0 ? this[ num + this.length ] : this[ num ];
  9565. },
  9566. // Take an array of elements and push it onto the stack
  9567. // (returning the new matched element set)
  9568. pushStack: function( elems ) {
  9569. // Build a new jQuery matched element set
  9570. var ret = jQuery.merge( this.constructor(), elems );
  9571. // Add the old object onto the stack (as a reference)
  9572. ret.prevObject = this;
  9573. // Return the newly-formed element set
  9574. return ret;
  9575. },
  9576. // Execute a callback for every element in the matched set.
  9577. each: function( callback ) {
  9578. return jQuery.each( this, callback );
  9579. },
  9580. map: function( callback ) {
  9581. return this.pushStack( jQuery.map( this, function( elem, i ) {
  9582. return callback.call( elem, i, elem );
  9583. } ) );
  9584. },
  9585. slice: function() {
  9586. return this.pushStack( slice.apply( this, arguments ) );
  9587. },
  9588. first: function() {
  9589. return this.eq( 0 );
  9590. },
  9591. last: function() {
  9592. return this.eq( -1 );
  9593. },
  9594. eq: function( i ) {
  9595. var len = this.length,
  9596. j = +i + ( i < 0 ? len : 0 );
  9597. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  9598. },
  9599. end: function() {
  9600. return this.prevObject || this.constructor();
  9601. },
  9602. // For internal use only.
  9603. // Behaves like an Array's method, not like a jQuery method.
  9604. push: push,
  9605. sort: arr.sort,
  9606. splice: arr.splice
  9607. };
  9608. jQuery.extend = jQuery.fn.extend = function() {
  9609. var options, name, src, copy, copyIsArray, clone,
  9610. target = arguments[ 0 ] || {},
  9611. i = 1,
  9612. length = arguments.length,
  9613. deep = false;
  9614. // Handle a deep copy situation
  9615. if ( typeof target === "boolean" ) {
  9616. deep = target;
  9617. // Skip the boolean and the target
  9618. target = arguments[ i ] || {};
  9619. i++;
  9620. }
  9621. // Handle case when target is a string or something (possible in deep copy)
  9622. if ( typeof target !== "object" && !isFunction( target ) ) {
  9623. target = {};
  9624. }
  9625. // Extend jQuery itself if only one argument is passed
  9626. if ( i === length ) {
  9627. target = this;
  9628. i--;
  9629. }
  9630. for ( ; i < length; i++ ) {
  9631. // Only deal with non-null/undefined values
  9632. if ( ( options = arguments[ i ] ) != null ) {
  9633. // Extend the base object
  9634. for ( name in options ) {
  9635. copy = options[ name ];
  9636. // Prevent Object.prototype pollution
  9637. // Prevent never-ending loop
  9638. if ( name === "__proto__" || target === copy ) {
  9639. continue;
  9640. }
  9641. // Recurse if we're merging plain objects or arrays
  9642. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  9643. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  9644. src = target[ name ];
  9645. // Ensure proper type for the source value
  9646. if ( copyIsArray && !Array.isArray( src ) ) {
  9647. clone = [];
  9648. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  9649. clone = {};
  9650. } else {
  9651. clone = src;
  9652. }
  9653. copyIsArray = false;
  9654. // Never move original objects, clone them
  9655. target[ name ] = jQuery.extend( deep, clone, copy );
  9656. // Don't bring in undefined values
  9657. } else if ( copy !== undefined ) {
  9658. target[ name ] = copy;
  9659. }
  9660. }
  9661. }
  9662. }
  9663. // Return the modified object
  9664. return target;
  9665. };
  9666. jQuery.extend( {
  9667. // Unique for each copy of jQuery on the page
  9668. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  9669. // Assume jQuery is ready without the ready module
  9670. isReady: true,
  9671. error: function( msg ) {
  9672. throw new Error( msg );
  9673. },
  9674. noop: function() {},
  9675. isPlainObject: function( obj ) {
  9676. var proto, Ctor;
  9677. // Detect obvious negatives
  9678. // Use toString instead of jQuery.type to catch host objects
  9679. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  9680. return false;
  9681. }
  9682. proto = getProto( obj );
  9683. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  9684. if ( !proto ) {
  9685. return true;
  9686. }
  9687. // Objects with prototype are plain iff they were constructed by a global Object function
  9688. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  9689. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  9690. },
  9691. isEmptyObject: function( obj ) {
  9692. var name;
  9693. for ( name in obj ) {
  9694. return false;
  9695. }
  9696. return true;
  9697. },
  9698. // Evaluates a script in a global context
  9699. globalEval: function( code, options ) {
  9700. DOMEval( code, { nonce: options && options.nonce } );
  9701. },
  9702. each: function( obj, callback ) {
  9703. var length, i = 0;
  9704. if ( isArrayLike( obj ) ) {
  9705. length = obj.length;
  9706. for ( ; i < length; i++ ) {
  9707. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9708. break;
  9709. }
  9710. }
  9711. } else {
  9712. for ( i in obj ) {
  9713. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  9714. break;
  9715. }
  9716. }
  9717. }
  9718. return obj;
  9719. },
  9720. // Support: Android <=4.0 only
  9721. trim: function( text ) {
  9722. return text == null ?
  9723. "" :
  9724. ( text + "" ).replace( rtrim, "" );
  9725. },
  9726. // results is for internal usage only
  9727. makeArray: function( arr, results ) {
  9728. var ret = results || [];
  9729. if ( arr != null ) {
  9730. if ( isArrayLike( Object( arr ) ) ) {
  9731. jQuery.merge( ret,
  9732. typeof arr === "string" ?
  9733. [ arr ] : arr
  9734. );
  9735. } else {
  9736. push.call( ret, arr );
  9737. }
  9738. }
  9739. return ret;
  9740. },
  9741. inArray: function( elem, arr, i ) {
  9742. return arr == null ? -1 : indexOf.call( arr, elem, i );
  9743. },
  9744. // Support: Android <=4.0 only, PhantomJS 1 only
  9745. // push.apply(_, arraylike) throws on ancient WebKit
  9746. merge: function( first, second ) {
  9747. var len = +second.length,
  9748. j = 0,
  9749. i = first.length;
  9750. for ( ; j < len; j++ ) {
  9751. first[ i++ ] = second[ j ];
  9752. }
  9753. first.length = i;
  9754. return first;
  9755. },
  9756. grep: function( elems, callback, invert ) {
  9757. var callbackInverse,
  9758. matches = [],
  9759. i = 0,
  9760. length = elems.length,
  9761. callbackExpect = !invert;
  9762. // Go through the array, only saving the items
  9763. // that pass the validator function
  9764. for ( ; i < length; i++ ) {
  9765. callbackInverse = !callback( elems[ i ], i );
  9766. if ( callbackInverse !== callbackExpect ) {
  9767. matches.push( elems[ i ] );
  9768. }
  9769. }
  9770. return matches;
  9771. },
  9772. // arg is for internal usage only
  9773. map: function( elems, callback, arg ) {
  9774. var length, value,
  9775. i = 0,
  9776. ret = [];
  9777. // Go through the array, translating each of the items to their new values
  9778. if ( isArrayLike( elems ) ) {
  9779. length = elems.length;
  9780. for ( ; i < length; i++ ) {
  9781. value = callback( elems[ i ], i, arg );
  9782. if ( value != null ) {
  9783. ret.push( value );
  9784. }
  9785. }
  9786. // Go through every key on the object,
  9787. } else {
  9788. for ( i in elems ) {
  9789. value = callback( elems[ i ], i, arg );
  9790. if ( value != null ) {
  9791. ret.push( value );
  9792. }
  9793. }
  9794. }
  9795. // Flatten any nested arrays
  9796. return concat.apply( [], ret );
  9797. },
  9798. // A global GUID counter for objects
  9799. guid: 1,
  9800. // jQuery.support is not used in Core but other projects attach their
  9801. // properties to it so it needs to exist.
  9802. support: support
  9803. } );
  9804. if ( typeof Symbol === "function" ) {
  9805. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9806. }
  9807. // Populate the class2type map
  9808. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9809. function( i, name ) {
  9810. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9811. } );
  9812. function isArrayLike( obj ) {
  9813. // Support: real iOS 8.2 only (not reproducible in simulator)
  9814. // `in` check used to prevent JIT error (gh-2145)
  9815. // hasOwn isn't used here due to false negatives
  9816. // regarding Nodelist length in IE
  9817. var length = !!obj && "length" in obj && obj.length,
  9818. type = toType( obj );
  9819. if ( isFunction( obj ) || isWindow( obj ) ) {
  9820. return false;
  9821. }
  9822. return type === "array" || length === 0 ||
  9823. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9824. }
  9825. var Sizzle =
  9826. /*!
  9827. * Sizzle CSS Selector Engine v2.3.4
  9828. * https://sizzlejs.com/
  9829. *
  9830. * Copyright JS Foundation and other contributors
  9831. * Released under the MIT license
  9832. * https://js.foundation/
  9833. *
  9834. * Date: 2019-04-08
  9835. */
  9836. (function( window ) {
  9837. var i,
  9838. support,
  9839. Expr,
  9840. getText,
  9841. isXML,
  9842. tokenize,
  9843. compile,
  9844. select,
  9845. outermostContext,
  9846. sortInput,
  9847. hasDuplicate,
  9848. // Local document vars
  9849. setDocument,
  9850. document,
  9851. docElem,
  9852. documentIsHTML,
  9853. rbuggyQSA,
  9854. rbuggyMatches,
  9855. matches,
  9856. contains,
  9857. // Instance-specific data
  9858. expando = "sizzle" + 1 * new Date(),
  9859. preferredDoc = window.document,
  9860. dirruns = 0,
  9861. done = 0,
  9862. classCache = createCache(),
  9863. tokenCache = createCache(),
  9864. compilerCache = createCache(),
  9865. nonnativeSelectorCache = createCache(),
  9866. sortOrder = function( a, b ) {
  9867. if ( a === b ) {
  9868. hasDuplicate = true;
  9869. }
  9870. return 0;
  9871. },
  9872. // Instance methods
  9873. hasOwn = ({}).hasOwnProperty,
  9874. arr = [],
  9875. pop = arr.pop,
  9876. push_native = arr.push,
  9877. push = arr.push,
  9878. slice = arr.slice,
  9879. // Use a stripped-down indexOf as it's faster than native
  9880. // https://jsperf.com/thor-indexof-vs-for/5
  9881. indexOf = function( list, elem ) {
  9882. var i = 0,
  9883. len = list.length;
  9884. for ( ; i < len; i++ ) {
  9885. if ( list[i] === elem ) {
  9886. return i;
  9887. }
  9888. }
  9889. return -1;
  9890. },
  9891. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9892. // Regular expressions
  9893. // http://www.w3.org/TR/css3-selectors/#whitespace
  9894. whitespace = "[\\x20\\t\\r\\n\\f]",
  9895. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9896. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9897. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9898. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9899. // Operator (capture 2)
  9900. "*([*^$|!~]?=)" + whitespace +
  9901. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9902. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9903. "*\\]",
  9904. pseudos = ":(" + identifier + ")(?:\\((" +
  9905. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9906. // 1. quoted (capture 3; capture 4 or capture 5)
  9907. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9908. // 2. simple (capture 6)
  9909. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9910. // 3. anything else (capture 2)
  9911. ".*" +
  9912. ")\\)|)",
  9913. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9914. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9915. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9916. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9917. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9918. rdescend = new RegExp( whitespace + "|>" ),
  9919. rpseudo = new RegExp( pseudos ),
  9920. ridentifier = new RegExp( "^" + identifier + "$" ),
  9921. matchExpr = {
  9922. "ID": new RegExp( "^#(" + identifier + ")" ),
  9923. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9924. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9925. "ATTR": new RegExp( "^" + attributes ),
  9926. "PSEUDO": new RegExp( "^" + pseudos ),
  9927. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9928. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9929. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9930. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9931. // For use in libraries implementing .is()
  9932. // We use this for POS matching in `select`
  9933. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9934. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9935. },
  9936. rhtml = /HTML$/i,
  9937. rinputs = /^(?:input|select|textarea|button)$/i,
  9938. rheader = /^h\d$/i,
  9939. rnative = /^[^{]+\{\s*\[native \w/,
  9940. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9941. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9942. rsibling = /[+~]/,
  9943. // CSS escapes
  9944. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9945. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9946. funescape = function( _, escaped, escapedWhitespace ) {
  9947. var high = "0x" + escaped - 0x10000;
  9948. // NaN means non-codepoint
  9949. // Support: Firefox<24
  9950. // Workaround erroneous numeric interpretation of +"0x"
  9951. return high !== high || escapedWhitespace ?
  9952. escaped :
  9953. high < 0 ?
  9954. // BMP codepoint
  9955. String.fromCharCode( high + 0x10000 ) :
  9956. // Supplemental Plane codepoint (surrogate pair)
  9957. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9958. },
  9959. // CSS string/identifier serialization
  9960. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9961. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9962. fcssescape = function( ch, asCodePoint ) {
  9963. if ( asCodePoint ) {
  9964. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9965. if ( ch === "\0" ) {
  9966. return "\uFFFD";
  9967. }
  9968. // Control characters and (dependent upon position) numbers get escaped as code points
  9969. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9970. }
  9971. // Other potentially-special ASCII characters get backslash-escaped
  9972. return "\\" + ch;
  9973. },
  9974. // Used for iframes
  9975. // See setDocument()
  9976. // Removing the function wrapper causes a "Permission Denied"
  9977. // error in IE
  9978. unloadHandler = function() {
  9979. setDocument();
  9980. },
  9981. inDisabledFieldset = addCombinator(
  9982. function( elem ) {
  9983. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9984. },
  9985. { dir: "parentNode", next: "legend" }
  9986. );
  9987. // Optimize for push.apply( _, NodeList )
  9988. try {
  9989. push.apply(
  9990. (arr = slice.call( preferredDoc.childNodes )),
  9991. preferredDoc.childNodes
  9992. );
  9993. // Support: Android<4.0
  9994. // Detect silently failing push.apply
  9995. arr[ preferredDoc.childNodes.length ].nodeType;
  9996. } catch ( e ) {
  9997. push = { apply: arr.length ?
  9998. // Leverage slice if possible
  9999. function( target, els ) {
  10000. push_native.apply( target, slice.call(els) );
  10001. } :
  10002. // Support: IE<9
  10003. // Otherwise append directly
  10004. function( target, els ) {
  10005. var j = target.length,
  10006. i = 0;
  10007. // Can't trust NodeList.length
  10008. while ( (target[j++] = els[i++]) ) {}
  10009. target.length = j - 1;
  10010. }
  10011. };
  10012. }
  10013. function Sizzle( selector, context, results, seed ) {
  10014. var m, i, elem, nid, match, groups, newSelector,
  10015. newContext = context && context.ownerDocument,
  10016. // nodeType defaults to 9, since context defaults to document
  10017. nodeType = context ? context.nodeType : 9;
  10018. results = results || [];
  10019. // Return early from calls with invalid selector or context
  10020. if ( typeof selector !== "string" || !selector ||
  10021. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  10022. return results;
  10023. }
  10024. // Try to shortcut find operations (as opposed to filters) in HTML documents
  10025. if ( !seed ) {
  10026. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  10027. setDocument( context );
  10028. }
  10029. context = context || document;
  10030. if ( documentIsHTML ) {
  10031. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  10032. // (excepting DocumentFragment context, where the methods don't exist)
  10033. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  10034. // ID selector
  10035. if ( (m = match[1]) ) {
  10036. // Document context
  10037. if ( nodeType === 9 ) {
  10038. if ( (elem = context.getElementById( m )) ) {
  10039. // Support: IE, Opera, Webkit
  10040. // TODO: identify versions
  10041. // getElementById can match elements by name instead of ID
  10042. if ( elem.id === m ) {
  10043. results.push( elem );
  10044. return results;
  10045. }
  10046. } else {
  10047. return results;
  10048. }
  10049. // Element context
  10050. } else {
  10051. // Support: IE, Opera, Webkit
  10052. // TODO: identify versions
  10053. // getElementById can match elements by name instead of ID
  10054. if ( newContext && (elem = newContext.getElementById( m )) &&
  10055. contains( context, elem ) &&
  10056. elem.id === m ) {
  10057. results.push( elem );
  10058. return results;
  10059. }
  10060. }
  10061. // Type selector
  10062. } else if ( match[2] ) {
  10063. push.apply( results, context.getElementsByTagName( selector ) );
  10064. return results;
  10065. // Class selector
  10066. } else if ( (m = match[3]) && support.getElementsByClassName &&
  10067. context.getElementsByClassName ) {
  10068. push.apply( results, context.getElementsByClassName( m ) );
  10069. return results;
  10070. }
  10071. }
  10072. // Take advantage of querySelectorAll
  10073. if ( support.qsa &&
  10074. !nonnativeSelectorCache[ selector + " " ] &&
  10075. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  10076. // Support: IE 8 only
  10077. // Exclude object elements
  10078. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  10079. newSelector = selector;
  10080. newContext = context;
  10081. // qSA considers elements outside a scoping root when evaluating child or
  10082. // descendant combinators, which is not what we want.
  10083. // In such cases, we work around the behavior by prefixing every selector in the
  10084. // list with an ID selector referencing the scope context.
  10085. // Thanks to Andrew Dupont for this technique.
  10086. if ( nodeType === 1 && rdescend.test( selector ) ) {
  10087. // Capture the context ID, setting it first if necessary
  10088. if ( (nid = context.getAttribute( "id" )) ) {
  10089. nid = nid.replace( rcssescape, fcssescape );
  10090. } else {
  10091. context.setAttribute( "id", (nid = expando) );
  10092. }
  10093. // Prefix every selector in the list
  10094. groups = tokenize( selector );
  10095. i = groups.length;
  10096. while ( i-- ) {
  10097. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  10098. }
  10099. newSelector = groups.join( "," );
  10100. // Expand context for sibling selectors
  10101. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  10102. context;
  10103. }
  10104. try {
  10105. push.apply( results,
  10106. newContext.querySelectorAll( newSelector )
  10107. );
  10108. return results;
  10109. } catch ( qsaError ) {
  10110. nonnativeSelectorCache( selector, true );
  10111. } finally {
  10112. if ( nid === expando ) {
  10113. context.removeAttribute( "id" );
  10114. }
  10115. }
  10116. }
  10117. }
  10118. }
  10119. // All others
  10120. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  10121. }
  10122. /**
  10123. * Create key-value caches of limited size
  10124. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  10125. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  10126. * deleting the oldest entry
  10127. */
  10128. function createCache() {
  10129. var keys = [];
  10130. function cache( key, value ) {
  10131. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  10132. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  10133. // Only keep the most recent entries
  10134. delete cache[ keys.shift() ];
  10135. }
  10136. return (cache[ key + " " ] = value);
  10137. }
  10138. return cache;
  10139. }
  10140. /**
  10141. * Mark a function for special use by Sizzle
  10142. * @param {Function} fn The function to mark
  10143. */
  10144. function markFunction( fn ) {
  10145. fn[ expando ] = true;
  10146. return fn;
  10147. }
  10148. /**
  10149. * Support testing using an element
  10150. * @param {Function} fn Passed the created element and returns a boolean result
  10151. */
  10152. function assert( fn ) {
  10153. var el = document.createElement("fieldset");
  10154. try {
  10155. return !!fn( el );
  10156. } catch (e) {
  10157. return false;
  10158. } finally {
  10159. // Remove from its parent by default
  10160. if ( el.parentNode ) {
  10161. el.parentNode.removeChild( el );
  10162. }
  10163. // release memory in IE
  10164. el = null;
  10165. }
  10166. }
  10167. /**
  10168. * Adds the same handler for all of the specified attrs
  10169. * @param {String} attrs Pipe-separated list of attributes
  10170. * @param {Function} handler The method that will be applied
  10171. */
  10172. function addHandle( attrs, handler ) {
  10173. var arr = attrs.split("|"),
  10174. i = arr.length;
  10175. while ( i-- ) {
  10176. Expr.attrHandle[ arr[i] ] = handler;
  10177. }
  10178. }
  10179. /**
  10180. * Checks document order of two siblings
  10181. * @param {Element} a
  10182. * @param {Element} b
  10183. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  10184. */
  10185. function siblingCheck( a, b ) {
  10186. var cur = b && a,
  10187. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  10188. a.sourceIndex - b.sourceIndex;
  10189. // Use IE sourceIndex if available on both nodes
  10190. if ( diff ) {
  10191. return diff;
  10192. }
  10193. // Check if b follows a
  10194. if ( cur ) {
  10195. while ( (cur = cur.nextSibling) ) {
  10196. if ( cur === b ) {
  10197. return -1;
  10198. }
  10199. }
  10200. }
  10201. return a ? 1 : -1;
  10202. }
  10203. /**
  10204. * Returns a function to use in pseudos for input types
  10205. * @param {String} type
  10206. */
  10207. function createInputPseudo( type ) {
  10208. return function( elem ) {
  10209. var name = elem.nodeName.toLowerCase();
  10210. return name === "input" && elem.type === type;
  10211. };
  10212. }
  10213. /**
  10214. * Returns a function to use in pseudos for buttons
  10215. * @param {String} type
  10216. */
  10217. function createButtonPseudo( type ) {
  10218. return function( elem ) {
  10219. var name = elem.nodeName.toLowerCase();
  10220. return (name === "input" || name === "button") && elem.type === type;
  10221. };
  10222. }
  10223. /**
  10224. * Returns a function to use in pseudos for :enabled/:disabled
  10225. * @param {Boolean} disabled true for :disabled; false for :enabled
  10226. */
  10227. function createDisabledPseudo( disabled ) {
  10228. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  10229. return function( elem ) {
  10230. // Only certain elements can match :enabled or :disabled
  10231. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  10232. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  10233. if ( "form" in elem ) {
  10234. // Check for inherited disabledness on relevant non-disabled elements:
  10235. // * listed form-associated elements in a disabled fieldset
  10236. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  10237. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  10238. // * option elements in a disabled optgroup
  10239. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  10240. // All such elements have a "form" property.
  10241. if ( elem.parentNode && elem.disabled === false ) {
  10242. // Option elements defer to a parent optgroup if present
  10243. if ( "label" in elem ) {
  10244. if ( "label" in elem.parentNode ) {
  10245. return elem.parentNode.disabled === disabled;
  10246. } else {
  10247. return elem.disabled === disabled;
  10248. }
  10249. }
  10250. // Support: IE 6 - 11
  10251. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  10252. return elem.isDisabled === disabled ||
  10253. // Where there is no isDisabled, check manually
  10254. /* jshint -W018 */
  10255. elem.isDisabled !== !disabled &&
  10256. inDisabledFieldset( elem ) === disabled;
  10257. }
  10258. return elem.disabled === disabled;
  10259. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  10260. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  10261. // even exist on them, let alone have a boolean value.
  10262. } else if ( "label" in elem ) {
  10263. return elem.disabled === disabled;
  10264. }
  10265. // Remaining elements are neither :enabled nor :disabled
  10266. return false;
  10267. };
  10268. }
  10269. /**
  10270. * Returns a function to use in pseudos for positionals
  10271. * @param {Function} fn
  10272. */
  10273. function createPositionalPseudo( fn ) {
  10274. return markFunction(function( argument ) {
  10275. argument = +argument;
  10276. return markFunction(function( seed, matches ) {
  10277. var j,
  10278. matchIndexes = fn( [], seed.length, argument ),
  10279. i = matchIndexes.length;
  10280. // Match elements found at the specified indexes
  10281. while ( i-- ) {
  10282. if ( seed[ (j = matchIndexes[i]) ] ) {
  10283. seed[j] = !(matches[j] = seed[j]);
  10284. }
  10285. }
  10286. });
  10287. });
  10288. }
  10289. /**
  10290. * Checks a node for validity as a Sizzle context
  10291. * @param {Element|Object=} context
  10292. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  10293. */
  10294. function testContext( context ) {
  10295. return context && typeof context.getElementsByTagName !== "undefined" && context;
  10296. }
  10297. // Expose support vars for convenience
  10298. support = Sizzle.support = {};
  10299. /**
  10300. * Detects XML nodes
  10301. * @param {Element|Object} elem An element or a document
  10302. * @returns {Boolean} True iff elem is a non-HTML XML node
  10303. */
  10304. isXML = Sizzle.isXML = function( elem ) {
  10305. var namespace = elem.namespaceURI,
  10306. docElem = (elem.ownerDocument || elem).documentElement;
  10307. // Support: IE <=8
  10308. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  10309. // https://bugs.jquery.com/ticket/4833
  10310. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  10311. };
  10312. /**
  10313. * Sets document-related variables once based on the current document
  10314. * @param {Element|Object} [doc] An element or document object to use to set the document
  10315. * @returns {Object} Returns the current document
  10316. */
  10317. setDocument = Sizzle.setDocument = function( node ) {
  10318. var hasCompare, subWindow,
  10319. doc = node ? node.ownerDocument || node : preferredDoc;
  10320. // Return early if doc is invalid or already selected
  10321. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  10322. return document;
  10323. }
  10324. // Update global variables
  10325. document = doc;
  10326. docElem = document.documentElement;
  10327. documentIsHTML = !isXML( document );
  10328. // Support: IE 9-11, Edge
  10329. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  10330. if ( preferredDoc !== document &&
  10331. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  10332. // Support: IE 11, Edge
  10333. if ( subWindow.addEventListener ) {
  10334. subWindow.addEventListener( "unload", unloadHandler, false );
  10335. // Support: IE 9 - 10 only
  10336. } else if ( subWindow.attachEvent ) {
  10337. subWindow.attachEvent( "onunload", unloadHandler );
  10338. }
  10339. }
  10340. /* Attributes
  10341. ---------------------------------------------------------------------- */
  10342. // Support: IE<8
  10343. // Verify that getAttribute really returns attributes and not properties
  10344. // (excepting IE8 booleans)
  10345. support.attributes = assert(function( el ) {
  10346. el.className = "i";
  10347. return !el.getAttribute("className");
  10348. });
  10349. /* getElement(s)By*
  10350. ---------------------------------------------------------------------- */
  10351. // Check if getElementsByTagName("*") returns only elements
  10352. support.getElementsByTagName = assert(function( el ) {
  10353. el.appendChild( document.createComment("") );
  10354. return !el.getElementsByTagName("*").length;
  10355. });
  10356. // Support: IE<9
  10357. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  10358. // Support: IE<10
  10359. // Check if getElementById returns elements by name
  10360. // The broken getElementById methods don't pick up programmatically-set names,
  10361. // so use a roundabout getElementsByName test
  10362. support.getById = assert(function( el ) {
  10363. docElem.appendChild( el ).id = expando;
  10364. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  10365. });
  10366. // ID filter and find
  10367. if ( support.getById ) {
  10368. Expr.filter["ID"] = function( id ) {
  10369. var attrId = id.replace( runescape, funescape );
  10370. return function( elem ) {
  10371. return elem.getAttribute("id") === attrId;
  10372. };
  10373. };
  10374. Expr.find["ID"] = function( id, context ) {
  10375. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  10376. var elem = context.getElementById( id );
  10377. return elem ? [ elem ] : [];
  10378. }
  10379. };
  10380. } else {
  10381. Expr.filter["ID"] = function( id ) {
  10382. var attrId = id.replace( runescape, funescape );
  10383. return function( elem ) {
  10384. var node = typeof elem.getAttributeNode !== "undefined" &&
  10385. elem.getAttributeNode("id");
  10386. return node && node.value === attrId;
  10387. };
  10388. };
  10389. // Support: IE 6 - 7 only
  10390. // getElementById is not reliable as a find shortcut
  10391. Expr.find["ID"] = function( id, context ) {
  10392. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  10393. var node, i, elems,
  10394. elem = context.getElementById( id );
  10395. if ( elem ) {
  10396. // Verify the id attribute
  10397. node = elem.getAttributeNode("id");
  10398. if ( node && node.value === id ) {
  10399. return [ elem ];
  10400. }
  10401. // Fall back on getElementsByName
  10402. elems = context.getElementsByName( id );
  10403. i = 0;
  10404. while ( (elem = elems[i++]) ) {
  10405. node = elem.getAttributeNode("id");
  10406. if ( node && node.value === id ) {
  10407. return [ elem ];
  10408. }
  10409. }
  10410. }
  10411. return [];
  10412. }
  10413. };
  10414. }
  10415. // Tag
  10416. Expr.find["TAG"] = support.getElementsByTagName ?
  10417. function( tag, context ) {
  10418. if ( typeof context.getElementsByTagName !== "undefined" ) {
  10419. return context.getElementsByTagName( tag );
  10420. // DocumentFragment nodes don't have gEBTN
  10421. } else if ( support.qsa ) {
  10422. return context.querySelectorAll( tag );
  10423. }
  10424. } :
  10425. function( tag, context ) {
  10426. var elem,
  10427. tmp = [],
  10428. i = 0,
  10429. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  10430. results = context.getElementsByTagName( tag );
  10431. // Filter out possible comments
  10432. if ( tag === "*" ) {
  10433. while ( (elem = results[i++]) ) {
  10434. if ( elem.nodeType === 1 ) {
  10435. tmp.push( elem );
  10436. }
  10437. }
  10438. return tmp;
  10439. }
  10440. return results;
  10441. };
  10442. // Class
  10443. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  10444. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  10445. return context.getElementsByClassName( className );
  10446. }
  10447. };
  10448. /* QSA/matchesSelector
  10449. ---------------------------------------------------------------------- */
  10450. // QSA and matchesSelector support
  10451. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  10452. rbuggyMatches = [];
  10453. // qSa(:focus) reports false when true (Chrome 21)
  10454. // We allow this because of a bug in IE8/9 that throws an error
  10455. // whenever `document.activeElement` is accessed on an iframe
  10456. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  10457. // See https://bugs.jquery.com/ticket/13378
  10458. rbuggyQSA = [];
  10459. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  10460. // Build QSA regex
  10461. // Regex strategy adopted from Diego Perini
  10462. assert(function( el ) {
  10463. // Select is set to empty string on purpose
  10464. // This is to test IE's treatment of not explicitly
  10465. // setting a boolean content attribute,
  10466. // since its presence should be enough
  10467. // https://bugs.jquery.com/ticket/12359
  10468. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  10469. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  10470. "<option selected=''></option></select>";
  10471. // Support: IE8, Opera 11-12.16
  10472. // Nothing should be selected when empty strings follow ^= or $= or *=
  10473. // The test attribute must be unknown in Opera but "safe" for WinRT
  10474. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  10475. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  10476. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  10477. }
  10478. // Support: IE8
  10479. // Boolean attributes and "value" are not treated correctly
  10480. if ( !el.querySelectorAll("[selected]").length ) {
  10481. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  10482. }
  10483. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  10484. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  10485. rbuggyQSA.push("~=");
  10486. }
  10487. // Webkit/Opera - :checked should return selected option elements
  10488. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10489. // IE8 throws error here and will not see later tests
  10490. if ( !el.querySelectorAll(":checked").length ) {
  10491. rbuggyQSA.push(":checked");
  10492. }
  10493. // Support: Safari 8+, iOS 8+
  10494. // https://bugs.webkit.org/show_bug.cgi?id=136851
  10495. // In-page `selector#id sibling-combinator selector` fails
  10496. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  10497. rbuggyQSA.push(".#.+[+~]");
  10498. }
  10499. });
  10500. assert(function( el ) {
  10501. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  10502. "<select disabled='disabled'><option/></select>";
  10503. // Support: Windows 8 Native Apps
  10504. // The type and name attributes are restricted during .innerHTML assignment
  10505. var input = document.createElement("input");
  10506. input.setAttribute( "type", "hidden" );
  10507. el.appendChild( input ).setAttribute( "name", "D" );
  10508. // Support: IE8
  10509. // Enforce case-sensitivity of name attribute
  10510. if ( el.querySelectorAll("[name=d]").length ) {
  10511. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  10512. }
  10513. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  10514. // IE8 throws error here and will not see later tests
  10515. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  10516. rbuggyQSA.push( ":enabled", ":disabled" );
  10517. }
  10518. // Support: IE9-11+
  10519. // IE's :disabled selector does not pick up the children of disabled fieldsets
  10520. docElem.appendChild( el ).disabled = true;
  10521. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  10522. rbuggyQSA.push( ":enabled", ":disabled" );
  10523. }
  10524. // Opera 10-11 does not throw on post-comma invalid pseudos
  10525. el.querySelectorAll("*,:x");
  10526. rbuggyQSA.push(",.*:");
  10527. });
  10528. }
  10529. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  10530. docElem.webkitMatchesSelector ||
  10531. docElem.mozMatchesSelector ||
  10532. docElem.oMatchesSelector ||
  10533. docElem.msMatchesSelector) )) ) {
  10534. assert(function( el ) {
  10535. // Check to see if it's possible to do matchesSelector
  10536. // on a disconnected node (IE 9)
  10537. support.disconnectedMatch = matches.call( el, "*" );
  10538. // This should fail with an exception
  10539. // Gecko does not error, returns false instead
  10540. matches.call( el, "[s!='']:x" );
  10541. rbuggyMatches.push( "!=", pseudos );
  10542. });
  10543. }
  10544. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  10545. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  10546. /* Contains
  10547. ---------------------------------------------------------------------- */
  10548. hasCompare = rnative.test( docElem.compareDocumentPosition );
  10549. // Element contains another
  10550. // Purposefully self-exclusive
  10551. // As in, an element does not contain itself
  10552. contains = hasCompare || rnative.test( docElem.contains ) ?
  10553. function( a, b ) {
  10554. var adown = a.nodeType === 9 ? a.documentElement : a,
  10555. bup = b && b.parentNode;
  10556. return a === bup || !!( bup && bup.nodeType === 1 && (
  10557. adown.contains ?
  10558. adown.contains( bup ) :
  10559. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  10560. ));
  10561. } :
  10562. function( a, b ) {
  10563. if ( b ) {
  10564. while ( (b = b.parentNode) ) {
  10565. if ( b === a ) {
  10566. return true;
  10567. }
  10568. }
  10569. }
  10570. return false;
  10571. };
  10572. /* Sorting
  10573. ---------------------------------------------------------------------- */
  10574. // Document order sorting
  10575. sortOrder = hasCompare ?
  10576. function( a, b ) {
  10577. // Flag for duplicate removal
  10578. if ( a === b ) {
  10579. hasDuplicate = true;
  10580. return 0;
  10581. }
  10582. // Sort on method existence if only one input has compareDocumentPosition
  10583. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  10584. if ( compare ) {
  10585. return compare;
  10586. }
  10587. // Calculate position if both inputs belong to the same document
  10588. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  10589. a.compareDocumentPosition( b ) :
  10590. // Otherwise we know they are disconnected
  10591. 1;
  10592. // Disconnected nodes
  10593. if ( compare & 1 ||
  10594. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  10595. // Choose the first element that is related to our preferred document
  10596. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  10597. return -1;
  10598. }
  10599. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  10600. return 1;
  10601. }
  10602. // Maintain original order
  10603. return sortInput ?
  10604. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10605. 0;
  10606. }
  10607. return compare & 4 ? -1 : 1;
  10608. } :
  10609. function( a, b ) {
  10610. // Exit early if the nodes are identical
  10611. if ( a === b ) {
  10612. hasDuplicate = true;
  10613. return 0;
  10614. }
  10615. var cur,
  10616. i = 0,
  10617. aup = a.parentNode,
  10618. bup = b.parentNode,
  10619. ap = [ a ],
  10620. bp = [ b ];
  10621. // Parentless nodes are either documents or disconnected
  10622. if ( !aup || !bup ) {
  10623. return a === document ? -1 :
  10624. b === document ? 1 :
  10625. aup ? -1 :
  10626. bup ? 1 :
  10627. sortInput ?
  10628. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  10629. 0;
  10630. // If the nodes are siblings, we can do a quick check
  10631. } else if ( aup === bup ) {
  10632. return siblingCheck( a, b );
  10633. }
  10634. // Otherwise we need full lists of their ancestors for comparison
  10635. cur = a;
  10636. while ( (cur = cur.parentNode) ) {
  10637. ap.unshift( cur );
  10638. }
  10639. cur = b;
  10640. while ( (cur = cur.parentNode) ) {
  10641. bp.unshift( cur );
  10642. }
  10643. // Walk down the tree looking for a discrepancy
  10644. while ( ap[i] === bp[i] ) {
  10645. i++;
  10646. }
  10647. return i ?
  10648. // Do a sibling check if the nodes have a common ancestor
  10649. siblingCheck( ap[i], bp[i] ) :
  10650. // Otherwise nodes in our document sort first
  10651. ap[i] === preferredDoc ? -1 :
  10652. bp[i] === preferredDoc ? 1 :
  10653. 0;
  10654. };
  10655. return document;
  10656. };
  10657. Sizzle.matches = function( expr, elements ) {
  10658. return Sizzle( expr, null, null, elements );
  10659. };
  10660. Sizzle.matchesSelector = function( elem, expr ) {
  10661. // Set document vars if needed
  10662. if ( ( elem.ownerDocument || elem ) !== document ) {
  10663. setDocument( elem );
  10664. }
  10665. if ( support.matchesSelector && documentIsHTML &&
  10666. !nonnativeSelectorCache[ expr + " " ] &&
  10667. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  10668. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  10669. try {
  10670. var ret = matches.call( elem, expr );
  10671. // IE 9's matchesSelector returns false on disconnected nodes
  10672. if ( ret || support.disconnectedMatch ||
  10673. // As well, disconnected nodes are said to be in a document
  10674. // fragment in IE 9
  10675. elem.document && elem.document.nodeType !== 11 ) {
  10676. return ret;
  10677. }
  10678. } catch (e) {
  10679. nonnativeSelectorCache( expr, true );
  10680. }
  10681. }
  10682. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  10683. };
  10684. Sizzle.contains = function( context, elem ) {
  10685. // Set document vars if needed
  10686. if ( ( context.ownerDocument || context ) !== document ) {
  10687. setDocument( context );
  10688. }
  10689. return contains( context, elem );
  10690. };
  10691. Sizzle.attr = function( elem, name ) {
  10692. // Set document vars if needed
  10693. if ( ( elem.ownerDocument || elem ) !== document ) {
  10694. setDocument( elem );
  10695. }
  10696. var fn = Expr.attrHandle[ name.toLowerCase() ],
  10697. // Don't get fooled by Object.prototype properties (jQuery #13807)
  10698. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  10699. fn( elem, name, !documentIsHTML ) :
  10700. undefined;
  10701. return val !== undefined ?
  10702. val :
  10703. support.attributes || !documentIsHTML ?
  10704. elem.getAttribute( name ) :
  10705. (val = elem.getAttributeNode(name)) && val.specified ?
  10706. val.value :
  10707. null;
  10708. };
  10709. Sizzle.escape = function( sel ) {
  10710. return (sel + "").replace( rcssescape, fcssescape );
  10711. };
  10712. Sizzle.error = function( msg ) {
  10713. throw new Error( "Syntax error, unrecognized expression: " + msg );
  10714. };
  10715. /**
  10716. * Document sorting and removing duplicates
  10717. * @param {ArrayLike} results
  10718. */
  10719. Sizzle.uniqueSort = function( results ) {
  10720. var elem,
  10721. duplicates = [],
  10722. j = 0,
  10723. i = 0;
  10724. // Unless we *know* we can detect duplicates, assume their presence
  10725. hasDuplicate = !support.detectDuplicates;
  10726. sortInput = !support.sortStable && results.slice( 0 );
  10727. results.sort( sortOrder );
  10728. if ( hasDuplicate ) {
  10729. while ( (elem = results[i++]) ) {
  10730. if ( elem === results[ i ] ) {
  10731. j = duplicates.push( i );
  10732. }
  10733. }
  10734. while ( j-- ) {
  10735. results.splice( duplicates[ j ], 1 );
  10736. }
  10737. }
  10738. // Clear input after sorting to release objects
  10739. // See https://github.com/jquery/sizzle/pull/225
  10740. sortInput = null;
  10741. return results;
  10742. };
  10743. /**
  10744. * Utility function for retrieving the text value of an array of DOM nodes
  10745. * @param {Array|Element} elem
  10746. */
  10747. getText = Sizzle.getText = function( elem ) {
  10748. var node,
  10749. ret = "",
  10750. i = 0,
  10751. nodeType = elem.nodeType;
  10752. if ( !nodeType ) {
  10753. // If no nodeType, this is expected to be an array
  10754. while ( (node = elem[i++]) ) {
  10755. // Do not traverse comment nodes
  10756. ret += getText( node );
  10757. }
  10758. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  10759. // Use textContent for elements
  10760. // innerText usage removed for consistency of new lines (jQuery #11153)
  10761. if ( typeof elem.textContent === "string" ) {
  10762. return elem.textContent;
  10763. } else {
  10764. // Traverse its children
  10765. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10766. ret += getText( elem );
  10767. }
  10768. }
  10769. } else if ( nodeType === 3 || nodeType === 4 ) {
  10770. return elem.nodeValue;
  10771. }
  10772. // Do not include comment or processing instruction nodes
  10773. return ret;
  10774. };
  10775. Expr = Sizzle.selectors = {
  10776. // Can be adjusted by the user
  10777. cacheLength: 50,
  10778. createPseudo: markFunction,
  10779. match: matchExpr,
  10780. attrHandle: {},
  10781. find: {},
  10782. relative: {
  10783. ">": { dir: "parentNode", first: true },
  10784. " ": { dir: "parentNode" },
  10785. "+": { dir: "previousSibling", first: true },
  10786. "~": { dir: "previousSibling" }
  10787. },
  10788. preFilter: {
  10789. "ATTR": function( match ) {
  10790. match[1] = match[1].replace( runescape, funescape );
  10791. // Move the given value to match[3] whether quoted or unquoted
  10792. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10793. if ( match[2] === "~=" ) {
  10794. match[3] = " " + match[3] + " ";
  10795. }
  10796. return match.slice( 0, 4 );
  10797. },
  10798. "CHILD": function( match ) {
  10799. /* matches from matchExpr["CHILD"]
  10800. 1 type (only|nth|...)
  10801. 2 what (child|of-type)
  10802. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10803. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10804. 5 sign of xn-component
  10805. 6 x of xn-component
  10806. 7 sign of y-component
  10807. 8 y of y-component
  10808. */
  10809. match[1] = match[1].toLowerCase();
  10810. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10811. // nth-* requires argument
  10812. if ( !match[3] ) {
  10813. Sizzle.error( match[0] );
  10814. }
  10815. // numeric x and y parameters for Expr.filter.CHILD
  10816. // remember that false/true cast respectively to 0/1
  10817. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10818. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10819. // other types prohibit arguments
  10820. } else if ( match[3] ) {
  10821. Sizzle.error( match[0] );
  10822. }
  10823. return match;
  10824. },
  10825. "PSEUDO": function( match ) {
  10826. var excess,
  10827. unquoted = !match[6] && match[2];
  10828. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10829. return null;
  10830. }
  10831. // Accept quoted arguments as-is
  10832. if ( match[3] ) {
  10833. match[2] = match[4] || match[5] || "";
  10834. // Strip excess characters from unquoted arguments
  10835. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10836. // Get excess from tokenize (recursively)
  10837. (excess = tokenize( unquoted, true )) &&
  10838. // advance to the next closing parenthesis
  10839. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10840. // excess is a negative index
  10841. match[0] = match[0].slice( 0, excess );
  10842. match[2] = unquoted.slice( 0, excess );
  10843. }
  10844. // Return only captures needed by the pseudo filter method (type and argument)
  10845. return match.slice( 0, 3 );
  10846. }
  10847. },
  10848. filter: {
  10849. "TAG": function( nodeNameSelector ) {
  10850. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10851. return nodeNameSelector === "*" ?
  10852. function() { return true; } :
  10853. function( elem ) {
  10854. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10855. };
  10856. },
  10857. "CLASS": function( className ) {
  10858. var pattern = classCache[ className + " " ];
  10859. return pattern ||
  10860. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10861. classCache( className, function( elem ) {
  10862. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10863. });
  10864. },
  10865. "ATTR": function( name, operator, check ) {
  10866. return function( elem ) {
  10867. var result = Sizzle.attr( elem, name );
  10868. if ( result == null ) {
  10869. return operator === "!=";
  10870. }
  10871. if ( !operator ) {
  10872. return true;
  10873. }
  10874. result += "";
  10875. return operator === "=" ? result === check :
  10876. operator === "!=" ? result !== check :
  10877. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10878. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10879. operator === "$=" ? check && result.slice( -check.length ) === check :
  10880. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10881. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10882. false;
  10883. };
  10884. },
  10885. "CHILD": function( type, what, argument, first, last ) {
  10886. var simple = type.slice( 0, 3 ) !== "nth",
  10887. forward = type.slice( -4 ) !== "last",
  10888. ofType = what === "of-type";
  10889. return first === 1 && last === 0 ?
  10890. // Shortcut for :nth-*(n)
  10891. function( elem ) {
  10892. return !!elem.parentNode;
  10893. } :
  10894. function( elem, context, xml ) {
  10895. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10896. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10897. parent = elem.parentNode,
  10898. name = ofType && elem.nodeName.toLowerCase(),
  10899. useCache = !xml && !ofType,
  10900. diff = false;
  10901. if ( parent ) {
  10902. // :(first|last|only)-(child|of-type)
  10903. if ( simple ) {
  10904. while ( dir ) {
  10905. node = elem;
  10906. while ( (node = node[ dir ]) ) {
  10907. if ( ofType ?
  10908. node.nodeName.toLowerCase() === name :
  10909. node.nodeType === 1 ) {
  10910. return false;
  10911. }
  10912. }
  10913. // Reverse direction for :only-* (if we haven't yet done so)
  10914. start = dir = type === "only" && !start && "nextSibling";
  10915. }
  10916. return true;
  10917. }
  10918. start = [ forward ? parent.firstChild : parent.lastChild ];
  10919. // non-xml :nth-child(...) stores cache data on `parent`
  10920. if ( forward && useCache ) {
  10921. // Seek `elem` from a previously-cached index
  10922. // ...in a gzip-friendly way
  10923. node = parent;
  10924. outerCache = node[ expando ] || (node[ expando ] = {});
  10925. // Support: IE <9 only
  10926. // Defend against cloned attroperties (jQuery gh-1709)
  10927. uniqueCache = outerCache[ node.uniqueID ] ||
  10928. (outerCache[ node.uniqueID ] = {});
  10929. cache = uniqueCache[ type ] || [];
  10930. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10931. diff = nodeIndex && cache[ 2 ];
  10932. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10933. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10934. // Fallback to seeking `elem` from the start
  10935. (diff = nodeIndex = 0) || start.pop()) ) {
  10936. // When found, cache indexes on `parent` and break
  10937. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10938. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10939. break;
  10940. }
  10941. }
  10942. } else {
  10943. // Use previously-cached element index if available
  10944. if ( useCache ) {
  10945. // ...in a gzip-friendly way
  10946. node = elem;
  10947. outerCache = node[ expando ] || (node[ expando ] = {});
  10948. // Support: IE <9 only
  10949. // Defend against cloned attroperties (jQuery gh-1709)
  10950. uniqueCache = outerCache[ node.uniqueID ] ||
  10951. (outerCache[ node.uniqueID ] = {});
  10952. cache = uniqueCache[ type ] || [];
  10953. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10954. diff = nodeIndex;
  10955. }
  10956. // xml :nth-child(...)
  10957. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10958. if ( diff === false ) {
  10959. // Use the same loop as above to seek `elem` from the start
  10960. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10961. (diff = nodeIndex = 0) || start.pop()) ) {
  10962. if ( ( ofType ?
  10963. node.nodeName.toLowerCase() === name :
  10964. node.nodeType === 1 ) &&
  10965. ++diff ) {
  10966. // Cache the index of each encountered element
  10967. if ( useCache ) {
  10968. outerCache = node[ expando ] || (node[ expando ] = {});
  10969. // Support: IE <9 only
  10970. // Defend against cloned attroperties (jQuery gh-1709)
  10971. uniqueCache = outerCache[ node.uniqueID ] ||
  10972. (outerCache[ node.uniqueID ] = {});
  10973. uniqueCache[ type ] = [ dirruns, diff ];
  10974. }
  10975. if ( node === elem ) {
  10976. break;
  10977. }
  10978. }
  10979. }
  10980. }
  10981. }
  10982. // Incorporate the offset, then check against cycle size
  10983. diff -= last;
  10984. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10985. }
  10986. };
  10987. },
  10988. "PSEUDO": function( pseudo, argument ) {
  10989. // pseudo-class names are case-insensitive
  10990. // http://www.w3.org/TR/selectors/#pseudo-classes
  10991. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10992. // Remember that setFilters inherits from pseudos
  10993. var args,
  10994. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10995. Sizzle.error( "unsupported pseudo: " + pseudo );
  10996. // The user may use createPseudo to indicate that
  10997. // arguments are needed to create the filter function
  10998. // just as Sizzle does
  10999. if ( fn[ expando ] ) {
  11000. return fn( argument );
  11001. }
  11002. // But maintain support for old signatures
  11003. if ( fn.length > 1 ) {
  11004. args = [ pseudo, pseudo, "", argument ];
  11005. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  11006. markFunction(function( seed, matches ) {
  11007. var idx,
  11008. matched = fn( seed, argument ),
  11009. i = matched.length;
  11010. while ( i-- ) {
  11011. idx = indexOf( seed, matched[i] );
  11012. seed[ idx ] = !( matches[ idx ] = matched[i] );
  11013. }
  11014. }) :
  11015. function( elem ) {
  11016. return fn( elem, 0, args );
  11017. };
  11018. }
  11019. return fn;
  11020. }
  11021. },
  11022. pseudos: {
  11023. // Potentially complex pseudos
  11024. "not": markFunction(function( selector ) {
  11025. // Trim the selector passed to compile
  11026. // to avoid treating leading and trailing
  11027. // spaces as combinators
  11028. var input = [],
  11029. results = [],
  11030. matcher = compile( selector.replace( rtrim, "$1" ) );
  11031. return matcher[ expando ] ?
  11032. markFunction(function( seed, matches, context, xml ) {
  11033. var elem,
  11034. unmatched = matcher( seed, null, xml, [] ),
  11035. i = seed.length;
  11036. // Match elements unmatched by `matcher`
  11037. while ( i-- ) {
  11038. if ( (elem = unmatched[i]) ) {
  11039. seed[i] = !(matches[i] = elem);
  11040. }
  11041. }
  11042. }) :
  11043. function( elem, context, xml ) {
  11044. input[0] = elem;
  11045. matcher( input, null, xml, results );
  11046. // Don't keep the element (issue #299)
  11047. input[0] = null;
  11048. return !results.pop();
  11049. };
  11050. }),
  11051. "has": markFunction(function( selector ) {
  11052. return function( elem ) {
  11053. return Sizzle( selector, elem ).length > 0;
  11054. };
  11055. }),
  11056. "contains": markFunction(function( text ) {
  11057. text = text.replace( runescape, funescape );
  11058. return function( elem ) {
  11059. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  11060. };
  11061. }),
  11062. // "Whether an element is represented by a :lang() selector
  11063. // is based solely on the element's language value
  11064. // being equal to the identifier C,
  11065. // or beginning with the identifier C immediately followed by "-".
  11066. // The matching of C against the element's language value is performed case-insensitively.
  11067. // The identifier C does not have to be a valid language name."
  11068. // http://www.w3.org/TR/selectors/#lang-pseudo
  11069. "lang": markFunction( function( lang ) {
  11070. // lang value must be a valid identifier
  11071. if ( !ridentifier.test(lang || "") ) {
  11072. Sizzle.error( "unsupported lang: " + lang );
  11073. }
  11074. lang = lang.replace( runescape, funescape ).toLowerCase();
  11075. return function( elem ) {
  11076. var elemLang;
  11077. do {
  11078. if ( (elemLang = documentIsHTML ?
  11079. elem.lang :
  11080. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  11081. elemLang = elemLang.toLowerCase();
  11082. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  11083. }
  11084. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  11085. return false;
  11086. };
  11087. }),
  11088. // Miscellaneous
  11089. "target": function( elem ) {
  11090. var hash = window.location && window.location.hash;
  11091. return hash && hash.slice( 1 ) === elem.id;
  11092. },
  11093. "root": function( elem ) {
  11094. return elem === docElem;
  11095. },
  11096. "focus": function( elem ) {
  11097. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  11098. },
  11099. // Boolean properties
  11100. "enabled": createDisabledPseudo( false ),
  11101. "disabled": createDisabledPseudo( true ),
  11102. "checked": function( elem ) {
  11103. // In CSS3, :checked should return both checked and selected elements
  11104. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  11105. var nodeName = elem.nodeName.toLowerCase();
  11106. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  11107. },
  11108. "selected": function( elem ) {
  11109. // Accessing this property makes selected-by-default
  11110. // options in Safari work properly
  11111. if ( elem.parentNode ) {
  11112. elem.parentNode.selectedIndex;
  11113. }
  11114. return elem.selected === true;
  11115. },
  11116. // Contents
  11117. "empty": function( elem ) {
  11118. // http://www.w3.org/TR/selectors/#empty-pseudo
  11119. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  11120. // but not by others (comment: 8; processing instruction: 7; etc.)
  11121. // nodeType < 6 works because attributes (2) do not appear as children
  11122. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  11123. if ( elem.nodeType < 6 ) {
  11124. return false;
  11125. }
  11126. }
  11127. return true;
  11128. },
  11129. "parent": function( elem ) {
  11130. return !Expr.pseudos["empty"]( elem );
  11131. },
  11132. // Element/input types
  11133. "header": function( elem ) {
  11134. return rheader.test( elem.nodeName );
  11135. },
  11136. "input": function( elem ) {
  11137. return rinputs.test( elem.nodeName );
  11138. },
  11139. "button": function( elem ) {
  11140. var name = elem.nodeName.toLowerCase();
  11141. return name === "input" && elem.type === "button" || name === "button";
  11142. },
  11143. "text": function( elem ) {
  11144. var attr;
  11145. return elem.nodeName.toLowerCase() === "input" &&
  11146. elem.type === "text" &&
  11147. // Support: IE<8
  11148. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  11149. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  11150. },
  11151. // Position-in-collection
  11152. "first": createPositionalPseudo(function() {
  11153. return [ 0 ];
  11154. }),
  11155. "last": createPositionalPseudo(function( matchIndexes, length ) {
  11156. return [ length - 1 ];
  11157. }),
  11158. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11159. return [ argument < 0 ? argument + length : argument ];
  11160. }),
  11161. "even": createPositionalPseudo(function( matchIndexes, length ) {
  11162. var i = 0;
  11163. for ( ; i < length; i += 2 ) {
  11164. matchIndexes.push( i );
  11165. }
  11166. return matchIndexes;
  11167. }),
  11168. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  11169. var i = 1;
  11170. for ( ; i < length; i += 2 ) {
  11171. matchIndexes.push( i );
  11172. }
  11173. return matchIndexes;
  11174. }),
  11175. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11176. var i = argument < 0 ?
  11177. argument + length :
  11178. argument > length ?
  11179. length :
  11180. argument;
  11181. for ( ; --i >= 0; ) {
  11182. matchIndexes.push( i );
  11183. }
  11184. return matchIndexes;
  11185. }),
  11186. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  11187. var i = argument < 0 ? argument + length : argument;
  11188. for ( ; ++i < length; ) {
  11189. matchIndexes.push( i );
  11190. }
  11191. return matchIndexes;
  11192. })
  11193. }
  11194. };
  11195. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  11196. // Add button/input type pseudos
  11197. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  11198. Expr.pseudos[ i ] = createInputPseudo( i );
  11199. }
  11200. for ( i in { submit: true, reset: true } ) {
  11201. Expr.pseudos[ i ] = createButtonPseudo( i );
  11202. }
  11203. // Easy API for creating new setFilters
  11204. function setFilters() {}
  11205. setFilters.prototype = Expr.filters = Expr.pseudos;
  11206. Expr.setFilters = new setFilters();
  11207. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  11208. var matched, match, tokens, type,
  11209. soFar, groups, preFilters,
  11210. cached = tokenCache[ selector + " " ];
  11211. if ( cached ) {
  11212. return parseOnly ? 0 : cached.slice( 0 );
  11213. }
  11214. soFar = selector;
  11215. groups = [];
  11216. preFilters = Expr.preFilter;
  11217. while ( soFar ) {
  11218. // Comma and first run
  11219. if ( !matched || (match = rcomma.exec( soFar )) ) {
  11220. if ( match ) {
  11221. // Don't consume trailing commas as valid
  11222. soFar = soFar.slice( match[0].length ) || soFar;
  11223. }
  11224. groups.push( (tokens = []) );
  11225. }
  11226. matched = false;
  11227. // Combinators
  11228. if ( (match = rcombinators.exec( soFar )) ) {
  11229. matched = match.shift();
  11230. tokens.push({
  11231. value: matched,
  11232. // Cast descendant combinators to space
  11233. type: match[0].replace( rtrim, " " )
  11234. });
  11235. soFar = soFar.slice( matched.length );
  11236. }
  11237. // Filters
  11238. for ( type in Expr.filter ) {
  11239. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  11240. (match = preFilters[ type ]( match ))) ) {
  11241. matched = match.shift();
  11242. tokens.push({
  11243. value: matched,
  11244. type: type,
  11245. matches: match
  11246. });
  11247. soFar = soFar.slice( matched.length );
  11248. }
  11249. }
  11250. if ( !matched ) {
  11251. break;
  11252. }
  11253. }
  11254. // Return the length of the invalid excess
  11255. // if we're just parsing
  11256. // Otherwise, throw an error or return tokens
  11257. return parseOnly ?
  11258. soFar.length :
  11259. soFar ?
  11260. Sizzle.error( selector ) :
  11261. // Cache the tokens
  11262. tokenCache( selector, groups ).slice( 0 );
  11263. };
  11264. function toSelector( tokens ) {
  11265. var i = 0,
  11266. len = tokens.length,
  11267. selector = "";
  11268. for ( ; i < len; i++ ) {
  11269. selector += tokens[i].value;
  11270. }
  11271. return selector;
  11272. }
  11273. function addCombinator( matcher, combinator, base ) {
  11274. var dir = combinator.dir,
  11275. skip = combinator.next,
  11276. key = skip || dir,
  11277. checkNonElements = base && key === "parentNode",
  11278. doneName = done++;
  11279. return combinator.first ?
  11280. // Check against closest ancestor/preceding element
  11281. function( elem, context, xml ) {
  11282. while ( (elem = elem[ dir ]) ) {
  11283. if ( elem.nodeType === 1 || checkNonElements ) {
  11284. return matcher( elem, context, xml );
  11285. }
  11286. }
  11287. return false;
  11288. } :
  11289. // Check against all ancestor/preceding elements
  11290. function( elem, context, xml ) {
  11291. var oldCache, uniqueCache, outerCache,
  11292. newCache = [ dirruns, doneName ];
  11293. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  11294. if ( xml ) {
  11295. while ( (elem = elem[ dir ]) ) {
  11296. if ( elem.nodeType === 1 || checkNonElements ) {
  11297. if ( matcher( elem, context, xml ) ) {
  11298. return true;
  11299. }
  11300. }
  11301. }
  11302. } else {
  11303. while ( (elem = elem[ dir ]) ) {
  11304. if ( elem.nodeType === 1 || checkNonElements ) {
  11305. outerCache = elem[ expando ] || (elem[ expando ] = {});
  11306. // Support: IE <9 only
  11307. // Defend against cloned attroperties (jQuery gh-1709)
  11308. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  11309. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  11310. elem = elem[ dir ] || elem;
  11311. } else if ( (oldCache = uniqueCache[ key ]) &&
  11312. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  11313. // Assign to newCache so results back-propagate to previous elements
  11314. return (newCache[ 2 ] = oldCache[ 2 ]);
  11315. } else {
  11316. // Reuse newcache so results back-propagate to previous elements
  11317. uniqueCache[ key ] = newCache;
  11318. // A match means we're done; a fail means we have to keep checking
  11319. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  11320. return true;
  11321. }
  11322. }
  11323. }
  11324. }
  11325. }
  11326. return false;
  11327. };
  11328. }
  11329. function elementMatcher( matchers ) {
  11330. return matchers.length > 1 ?
  11331. function( elem, context, xml ) {
  11332. var i = matchers.length;
  11333. while ( i-- ) {
  11334. if ( !matchers[i]( elem, context, xml ) ) {
  11335. return false;
  11336. }
  11337. }
  11338. return true;
  11339. } :
  11340. matchers[0];
  11341. }
  11342. function multipleContexts( selector, contexts, results ) {
  11343. var i = 0,
  11344. len = contexts.length;
  11345. for ( ; i < len; i++ ) {
  11346. Sizzle( selector, contexts[i], results );
  11347. }
  11348. return results;
  11349. }
  11350. function condense( unmatched, map, filter, context, xml ) {
  11351. var elem,
  11352. newUnmatched = [],
  11353. i = 0,
  11354. len = unmatched.length,
  11355. mapped = map != null;
  11356. for ( ; i < len; i++ ) {
  11357. if ( (elem = unmatched[i]) ) {
  11358. if ( !filter || filter( elem, context, xml ) ) {
  11359. newUnmatched.push( elem );
  11360. if ( mapped ) {
  11361. map.push( i );
  11362. }
  11363. }
  11364. }
  11365. }
  11366. return newUnmatched;
  11367. }
  11368. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  11369. if ( postFilter && !postFilter[ expando ] ) {
  11370. postFilter = setMatcher( postFilter );
  11371. }
  11372. if ( postFinder && !postFinder[ expando ] ) {
  11373. postFinder = setMatcher( postFinder, postSelector );
  11374. }
  11375. return markFunction(function( seed, results, context, xml ) {
  11376. var temp, i, elem,
  11377. preMap = [],
  11378. postMap = [],
  11379. preexisting = results.length,
  11380. // Get initial elements from seed or context
  11381. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  11382. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  11383. matcherIn = preFilter && ( seed || !selector ) ?
  11384. condense( elems, preMap, preFilter, context, xml ) :
  11385. elems,
  11386. matcherOut = matcher ?
  11387. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  11388. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  11389. // ...intermediate processing is necessary
  11390. [] :
  11391. // ...otherwise use results directly
  11392. results :
  11393. matcherIn;
  11394. // Find primary matches
  11395. if ( matcher ) {
  11396. matcher( matcherIn, matcherOut, context, xml );
  11397. }
  11398. // Apply postFilter
  11399. if ( postFilter ) {
  11400. temp = condense( matcherOut, postMap );
  11401. postFilter( temp, [], context, xml );
  11402. // Un-match failing elements by moving them back to matcherIn
  11403. i = temp.length;
  11404. while ( i-- ) {
  11405. if ( (elem = temp[i]) ) {
  11406. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  11407. }
  11408. }
  11409. }
  11410. if ( seed ) {
  11411. if ( postFinder || preFilter ) {
  11412. if ( postFinder ) {
  11413. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  11414. temp = [];
  11415. i = matcherOut.length;
  11416. while ( i-- ) {
  11417. if ( (elem = matcherOut[i]) ) {
  11418. // Restore matcherIn since elem is not yet a final match
  11419. temp.push( (matcherIn[i] = elem) );
  11420. }
  11421. }
  11422. postFinder( null, (matcherOut = []), temp, xml );
  11423. }
  11424. // Move matched elements from seed to results to keep them synchronized
  11425. i = matcherOut.length;
  11426. while ( i-- ) {
  11427. if ( (elem = matcherOut[i]) &&
  11428. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  11429. seed[temp] = !(results[temp] = elem);
  11430. }
  11431. }
  11432. }
  11433. // Add elements to results, through postFinder if defined
  11434. } else {
  11435. matcherOut = condense(
  11436. matcherOut === results ?
  11437. matcherOut.splice( preexisting, matcherOut.length ) :
  11438. matcherOut
  11439. );
  11440. if ( postFinder ) {
  11441. postFinder( null, results, matcherOut, xml );
  11442. } else {
  11443. push.apply( results, matcherOut );
  11444. }
  11445. }
  11446. });
  11447. }
  11448. function matcherFromTokens( tokens ) {
  11449. var checkContext, matcher, j,
  11450. len = tokens.length,
  11451. leadingRelative = Expr.relative[ tokens[0].type ],
  11452. implicitRelative = leadingRelative || Expr.relative[" "],
  11453. i = leadingRelative ? 1 : 0,
  11454. // The foundational matcher ensures that elements are reachable from top-level context(s)
  11455. matchContext = addCombinator( function( elem ) {
  11456. return elem === checkContext;
  11457. }, implicitRelative, true ),
  11458. matchAnyContext = addCombinator( function( elem ) {
  11459. return indexOf( checkContext, elem ) > -1;
  11460. }, implicitRelative, true ),
  11461. matchers = [ function( elem, context, xml ) {
  11462. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  11463. (checkContext = context).nodeType ?
  11464. matchContext( elem, context, xml ) :
  11465. matchAnyContext( elem, context, xml ) );
  11466. // Avoid hanging onto element (issue #299)
  11467. checkContext = null;
  11468. return ret;
  11469. } ];
  11470. for ( ; i < len; i++ ) {
  11471. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  11472. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  11473. } else {
  11474. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  11475. // Return special upon seeing a positional matcher
  11476. if ( matcher[ expando ] ) {
  11477. // Find the next relative operator (if any) for proper handling
  11478. j = ++i;
  11479. for ( ; j < len; j++ ) {
  11480. if ( Expr.relative[ tokens[j].type ] ) {
  11481. break;
  11482. }
  11483. }
  11484. return setMatcher(
  11485. i > 1 && elementMatcher( matchers ),
  11486. i > 1 && toSelector(
  11487. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  11488. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  11489. ).replace( rtrim, "$1" ),
  11490. matcher,
  11491. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  11492. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  11493. j < len && toSelector( tokens )
  11494. );
  11495. }
  11496. matchers.push( matcher );
  11497. }
  11498. }
  11499. return elementMatcher( matchers );
  11500. }
  11501. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  11502. var bySet = setMatchers.length > 0,
  11503. byElement = elementMatchers.length > 0,
  11504. superMatcher = function( seed, context, xml, results, outermost ) {
  11505. var elem, j, matcher,
  11506. matchedCount = 0,
  11507. i = "0",
  11508. unmatched = seed && [],
  11509. setMatched = [],
  11510. contextBackup = outermostContext,
  11511. // We must always have either seed elements or outermost context
  11512. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  11513. // Use integer dirruns iff this is the outermost matcher
  11514. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  11515. len = elems.length;
  11516. if ( outermost ) {
  11517. outermostContext = context === document || context || outermost;
  11518. }
  11519. // Add elements passing elementMatchers directly to results
  11520. // Support: IE<9, Safari
  11521. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  11522. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  11523. if ( byElement && elem ) {
  11524. j = 0;
  11525. if ( !context && elem.ownerDocument !== document ) {
  11526. setDocument( elem );
  11527. xml = !documentIsHTML;
  11528. }
  11529. while ( (matcher = elementMatchers[j++]) ) {
  11530. if ( matcher( elem, context || document, xml) ) {
  11531. results.push( elem );
  11532. break;
  11533. }
  11534. }
  11535. if ( outermost ) {
  11536. dirruns = dirrunsUnique;
  11537. }
  11538. }
  11539. // Track unmatched elements for set filters
  11540. if ( bySet ) {
  11541. // They will have gone through all possible matchers
  11542. if ( (elem = !matcher && elem) ) {
  11543. matchedCount--;
  11544. }
  11545. // Lengthen the array for every element, matched or not
  11546. if ( seed ) {
  11547. unmatched.push( elem );
  11548. }
  11549. }
  11550. }
  11551. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  11552. // makes the latter nonnegative.
  11553. matchedCount += i;
  11554. // Apply set filters to unmatched elements
  11555. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  11556. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  11557. // no element matchers and no seed.
  11558. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  11559. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  11560. // numerically zero.
  11561. if ( bySet && i !== matchedCount ) {
  11562. j = 0;
  11563. while ( (matcher = setMatchers[j++]) ) {
  11564. matcher( unmatched, setMatched, context, xml );
  11565. }
  11566. if ( seed ) {
  11567. // Reintegrate element matches to eliminate the need for sorting
  11568. if ( matchedCount > 0 ) {
  11569. while ( i-- ) {
  11570. if ( !(unmatched[i] || setMatched[i]) ) {
  11571. setMatched[i] = pop.call( results );
  11572. }
  11573. }
  11574. }
  11575. // Discard index placeholder values to get only actual matches
  11576. setMatched = condense( setMatched );
  11577. }
  11578. // Add matches to results
  11579. push.apply( results, setMatched );
  11580. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  11581. if ( outermost && !seed && setMatched.length > 0 &&
  11582. ( matchedCount + setMatchers.length ) > 1 ) {
  11583. Sizzle.uniqueSort( results );
  11584. }
  11585. }
  11586. // Override manipulation of globals by nested matchers
  11587. if ( outermost ) {
  11588. dirruns = dirrunsUnique;
  11589. outermostContext = contextBackup;
  11590. }
  11591. return unmatched;
  11592. };
  11593. return bySet ?
  11594. markFunction( superMatcher ) :
  11595. superMatcher;
  11596. }
  11597. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  11598. var i,
  11599. setMatchers = [],
  11600. elementMatchers = [],
  11601. cached = compilerCache[ selector + " " ];
  11602. if ( !cached ) {
  11603. // Generate a function of recursive functions that can be used to check each element
  11604. if ( !match ) {
  11605. match = tokenize( selector );
  11606. }
  11607. i = match.length;
  11608. while ( i-- ) {
  11609. cached = matcherFromTokens( match[i] );
  11610. if ( cached[ expando ] ) {
  11611. setMatchers.push( cached );
  11612. } else {
  11613. elementMatchers.push( cached );
  11614. }
  11615. }
  11616. // Cache the compiled function
  11617. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  11618. // Save selector and tokenization
  11619. cached.selector = selector;
  11620. }
  11621. return cached;
  11622. };
  11623. /**
  11624. * A low-level selection function that works with Sizzle's compiled
  11625. * selector functions
  11626. * @param {String|Function} selector A selector or a pre-compiled
  11627. * selector function built with Sizzle.compile
  11628. * @param {Element} context
  11629. * @param {Array} [results]
  11630. * @param {Array} [seed] A set of elements to match against
  11631. */
  11632. select = Sizzle.select = function( selector, context, results, seed ) {
  11633. var i, tokens, token, type, find,
  11634. compiled = typeof selector === "function" && selector,
  11635. match = !seed && tokenize( (selector = compiled.selector || selector) );
  11636. results = results || [];
  11637. // Try to minimize operations if there is only one selector in the list and no seed
  11638. // (the latter of which guarantees us context)
  11639. if ( match.length === 1 ) {
  11640. // Reduce context if the leading compound selector is an ID
  11641. tokens = match[0] = match[0].slice( 0 );
  11642. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  11643. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  11644. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  11645. if ( !context ) {
  11646. return results;
  11647. // Precompiled matchers will still verify ancestry, so step up a level
  11648. } else if ( compiled ) {
  11649. context = context.parentNode;
  11650. }
  11651. selector = selector.slice( tokens.shift().value.length );
  11652. }
  11653. // Fetch a seed set for right-to-left matching
  11654. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  11655. while ( i-- ) {
  11656. token = tokens[i];
  11657. // Abort if we hit a combinator
  11658. if ( Expr.relative[ (type = token.type) ] ) {
  11659. break;
  11660. }
  11661. if ( (find = Expr.find[ type ]) ) {
  11662. // Search, expanding context for leading sibling combinators
  11663. if ( (seed = find(
  11664. token.matches[0].replace( runescape, funescape ),
  11665. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  11666. )) ) {
  11667. // If seed is empty or no tokens remain, we can return early
  11668. tokens.splice( i, 1 );
  11669. selector = seed.length && toSelector( tokens );
  11670. if ( !selector ) {
  11671. push.apply( results, seed );
  11672. return results;
  11673. }
  11674. break;
  11675. }
  11676. }
  11677. }
  11678. }
  11679. // Compile and execute a filtering function if one is not provided
  11680. // Provide `match` to avoid retokenization if we modified the selector above
  11681. ( compiled || compile( selector, match ) )(
  11682. seed,
  11683. context,
  11684. !documentIsHTML,
  11685. results,
  11686. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  11687. );
  11688. return results;
  11689. };
  11690. // One-time assignments
  11691. // Sort stability
  11692. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  11693. // Support: Chrome 14-35+
  11694. // Always assume duplicates if they aren't passed to the comparison function
  11695. support.detectDuplicates = !!hasDuplicate;
  11696. // Initialize against the default document
  11697. setDocument();
  11698. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  11699. // Detached nodes confoundingly follow *each other*
  11700. support.sortDetached = assert(function( el ) {
  11701. // Should return 1, but returns 4 (following)
  11702. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  11703. });
  11704. // Support: IE<8
  11705. // Prevent attribute/property "interpolation"
  11706. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  11707. if ( !assert(function( el ) {
  11708. el.innerHTML = "<a href='#'></a>";
  11709. return el.firstChild.getAttribute("href") === "#" ;
  11710. }) ) {
  11711. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  11712. if ( !isXML ) {
  11713. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  11714. }
  11715. });
  11716. }
  11717. // Support: IE<9
  11718. // Use defaultValue in place of getAttribute("value")
  11719. if ( !support.attributes || !assert(function( el ) {
  11720. el.innerHTML = "<input/>";
  11721. el.firstChild.setAttribute( "value", "" );
  11722. return el.firstChild.getAttribute( "value" ) === "";
  11723. }) ) {
  11724. addHandle( "value", function( elem, name, isXML ) {
  11725. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  11726. return elem.defaultValue;
  11727. }
  11728. });
  11729. }
  11730. // Support: IE<9
  11731. // Use getAttributeNode to fetch booleans when getAttribute lies
  11732. if ( !assert(function( el ) {
  11733. return el.getAttribute("disabled") == null;
  11734. }) ) {
  11735. addHandle( booleans, function( elem, name, isXML ) {
  11736. var val;
  11737. if ( !isXML ) {
  11738. return elem[ name ] === true ? name.toLowerCase() :
  11739. (val = elem.getAttributeNode( name )) && val.specified ?
  11740. val.value :
  11741. null;
  11742. }
  11743. });
  11744. }
  11745. return Sizzle;
  11746. })( window );
  11747. jQuery.find = Sizzle;
  11748. jQuery.expr = Sizzle.selectors;
  11749. // Deprecated
  11750. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  11751. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  11752. jQuery.text = Sizzle.getText;
  11753. jQuery.isXMLDoc = Sizzle.isXML;
  11754. jQuery.contains = Sizzle.contains;
  11755. jQuery.escapeSelector = Sizzle.escape;
  11756. var dir = function( elem, dir, until ) {
  11757. var matched = [],
  11758. truncate = until !== undefined;
  11759. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  11760. if ( elem.nodeType === 1 ) {
  11761. if ( truncate && jQuery( elem ).is( until ) ) {
  11762. break;
  11763. }
  11764. matched.push( elem );
  11765. }
  11766. }
  11767. return matched;
  11768. };
  11769. var siblings = function( n, elem ) {
  11770. var matched = [];
  11771. for ( ; n; n = n.nextSibling ) {
  11772. if ( n.nodeType === 1 && n !== elem ) {
  11773. matched.push( n );
  11774. }
  11775. }
  11776. return matched;
  11777. };
  11778. var rneedsContext = jQuery.expr.match.needsContext;
  11779. function nodeName( elem, name ) {
  11780. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  11781. };
  11782. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  11783. // Implement the identical functionality for filter and not
  11784. function winnow( elements, qualifier, not ) {
  11785. if ( isFunction( qualifier ) ) {
  11786. return jQuery.grep( elements, function( elem, i ) {
  11787. return !!qualifier.call( elem, i, elem ) !== not;
  11788. } );
  11789. }
  11790. // Single element
  11791. if ( qualifier.nodeType ) {
  11792. return jQuery.grep( elements, function( elem ) {
  11793. return ( elem === qualifier ) !== not;
  11794. } );
  11795. }
  11796. // Arraylike of elements (jQuery, arguments, Array)
  11797. if ( typeof qualifier !== "string" ) {
  11798. return jQuery.grep( elements, function( elem ) {
  11799. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11800. } );
  11801. }
  11802. // Filtered directly for both simple and complex selectors
  11803. return jQuery.filter( qualifier, elements, not );
  11804. }
  11805. jQuery.filter = function( expr, elems, not ) {
  11806. var elem = elems[ 0 ];
  11807. if ( not ) {
  11808. expr = ":not(" + expr + ")";
  11809. }
  11810. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11811. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11812. }
  11813. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11814. return elem.nodeType === 1;
  11815. } ) );
  11816. };
  11817. jQuery.fn.extend( {
  11818. find: function( selector ) {
  11819. var i, ret,
  11820. len = this.length,
  11821. self = this;
  11822. if ( typeof selector !== "string" ) {
  11823. return this.pushStack( jQuery( selector ).filter( function() {
  11824. for ( i = 0; i < len; i++ ) {
  11825. if ( jQuery.contains( self[ i ], this ) ) {
  11826. return true;
  11827. }
  11828. }
  11829. } ) );
  11830. }
  11831. ret = this.pushStack( [] );
  11832. for ( i = 0; i < len; i++ ) {
  11833. jQuery.find( selector, self[ i ], ret );
  11834. }
  11835. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11836. },
  11837. filter: function( selector ) {
  11838. return this.pushStack( winnow( this, selector || [], false ) );
  11839. },
  11840. not: function( selector ) {
  11841. return this.pushStack( winnow( this, selector || [], true ) );
  11842. },
  11843. is: function( selector ) {
  11844. return !!winnow(
  11845. this,
  11846. // If this is a positional/relative selector, check membership in the returned set
  11847. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11848. typeof selector === "string" && rneedsContext.test( selector ) ?
  11849. jQuery( selector ) :
  11850. selector || [],
  11851. false
  11852. ).length;
  11853. }
  11854. } );
  11855. // Initialize a jQuery object
  11856. // A central reference to the root jQuery(document)
  11857. var rootjQuery,
  11858. // A simple way to check for HTML strings
  11859. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11860. // Strict HTML recognition (#11290: must start with <)
  11861. // Shortcut simple #id case for speed
  11862. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11863. init = jQuery.fn.init = function( selector, context, root ) {
  11864. var match, elem;
  11865. // HANDLE: $(""), $(null), $(undefined), $(false)
  11866. if ( !selector ) {
  11867. return this;
  11868. }
  11869. // Method init() accepts an alternate rootjQuery
  11870. // so migrate can support jQuery.sub (gh-2101)
  11871. root = root || rootjQuery;
  11872. // Handle HTML strings
  11873. if ( typeof selector === "string" ) {
  11874. if ( selector[ 0 ] === "<" &&
  11875. selector[ selector.length - 1 ] === ">" &&
  11876. selector.length >= 3 ) {
  11877. // Assume that strings that start and end with <> are HTML and skip the regex check
  11878. match = [ null, selector, null ];
  11879. } else {
  11880. match = rquickExpr.exec( selector );
  11881. }
  11882. // Match html or make sure no context is specified for #id
  11883. if ( match && ( match[ 1 ] || !context ) ) {
  11884. // HANDLE: $(html) -> $(array)
  11885. if ( match[ 1 ] ) {
  11886. context = context instanceof jQuery ? context[ 0 ] : context;
  11887. // Option to run scripts is true for back-compat
  11888. // Intentionally let the error be thrown if parseHTML is not present
  11889. jQuery.merge( this, jQuery.parseHTML(
  11890. match[ 1 ],
  11891. context && context.nodeType ? context.ownerDocument || context : document,
  11892. true
  11893. ) );
  11894. // HANDLE: $(html, props)
  11895. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11896. for ( match in context ) {
  11897. // Properties of context are called as methods if possible
  11898. if ( isFunction( this[ match ] ) ) {
  11899. this[ match ]( context[ match ] );
  11900. // ...and otherwise set as attributes
  11901. } else {
  11902. this.attr( match, context[ match ] );
  11903. }
  11904. }
  11905. }
  11906. return this;
  11907. // HANDLE: $(#id)
  11908. } else {
  11909. elem = document.getElementById( match[ 2 ] );
  11910. if ( elem ) {
  11911. // Inject the element directly into the jQuery object
  11912. this[ 0 ] = elem;
  11913. this.length = 1;
  11914. }
  11915. return this;
  11916. }
  11917. // HANDLE: $(expr, $(...))
  11918. } else if ( !context || context.jquery ) {
  11919. return ( context || root ).find( selector );
  11920. // HANDLE: $(expr, context)
  11921. // (which is just equivalent to: $(context).find(expr)
  11922. } else {
  11923. return this.constructor( context ).find( selector );
  11924. }
  11925. // HANDLE: $(DOMElement)
  11926. } else if ( selector.nodeType ) {
  11927. this[ 0 ] = selector;
  11928. this.length = 1;
  11929. return this;
  11930. // HANDLE: $(function)
  11931. // Shortcut for document ready
  11932. } else if ( isFunction( selector ) ) {
  11933. return root.ready !== undefined ?
  11934. root.ready( selector ) :
  11935. // Execute immediately if ready is not present
  11936. selector( jQuery );
  11937. }
  11938. return jQuery.makeArray( selector, this );
  11939. };
  11940. // Give the init function the jQuery prototype for later instantiation
  11941. init.prototype = jQuery.fn;
  11942. // Initialize central reference
  11943. rootjQuery = jQuery( document );
  11944. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11945. // Methods guaranteed to produce a unique set when starting from a unique set
  11946. guaranteedUnique = {
  11947. children: true,
  11948. contents: true,
  11949. next: true,
  11950. prev: true
  11951. };
  11952. jQuery.fn.extend( {
  11953. has: function( target ) {
  11954. var targets = jQuery( target, this ),
  11955. l = targets.length;
  11956. return this.filter( function() {
  11957. var i = 0;
  11958. for ( ; i < l; i++ ) {
  11959. if ( jQuery.contains( this, targets[ i ] ) ) {
  11960. return true;
  11961. }
  11962. }
  11963. } );
  11964. },
  11965. closest: function( selectors, context ) {
  11966. var cur,
  11967. i = 0,
  11968. l = this.length,
  11969. matched = [],
  11970. targets = typeof selectors !== "string" && jQuery( selectors );
  11971. // Positional selectors never match, since there's no _selection_ context
  11972. if ( !rneedsContext.test( selectors ) ) {
  11973. for ( ; i < l; i++ ) {
  11974. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11975. // Always skip document fragments
  11976. if ( cur.nodeType < 11 && ( targets ?
  11977. targets.index( cur ) > -1 :
  11978. // Don't pass non-elements to Sizzle
  11979. cur.nodeType === 1 &&
  11980. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11981. matched.push( cur );
  11982. break;
  11983. }
  11984. }
  11985. }
  11986. }
  11987. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11988. },
  11989. // Determine the position of an element within the set
  11990. index: function( elem ) {
  11991. // No argument, return index in parent
  11992. if ( !elem ) {
  11993. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11994. }
  11995. // Index in selector
  11996. if ( typeof elem === "string" ) {
  11997. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11998. }
  11999. // Locate the position of the desired element
  12000. return indexOf.call( this,
  12001. // If it receives a jQuery object, the first element is used
  12002. elem.jquery ? elem[ 0 ] : elem
  12003. );
  12004. },
  12005. add: function( selector, context ) {
  12006. return this.pushStack(
  12007. jQuery.uniqueSort(
  12008. jQuery.merge( this.get(), jQuery( selector, context ) )
  12009. )
  12010. );
  12011. },
  12012. addBack: function( selector ) {
  12013. return this.add( selector == null ?
  12014. this.prevObject : this.prevObject.filter( selector )
  12015. );
  12016. }
  12017. } );
  12018. function sibling( cur, dir ) {
  12019. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  12020. return cur;
  12021. }
  12022. jQuery.each( {
  12023. parent: function( elem ) {
  12024. var parent = elem.parentNode;
  12025. return parent && parent.nodeType !== 11 ? parent : null;
  12026. },
  12027. parents: function( elem ) {
  12028. return dir( elem, "parentNode" );
  12029. },
  12030. parentsUntil: function( elem, i, until ) {
  12031. return dir( elem, "parentNode", until );
  12032. },
  12033. next: function( elem ) {
  12034. return sibling( elem, "nextSibling" );
  12035. },
  12036. prev: function( elem ) {
  12037. return sibling( elem, "previousSibling" );
  12038. },
  12039. nextAll: function( elem ) {
  12040. return dir( elem, "nextSibling" );
  12041. },
  12042. prevAll: function( elem ) {
  12043. return dir( elem, "previousSibling" );
  12044. },
  12045. nextUntil: function( elem, i, until ) {
  12046. return dir( elem, "nextSibling", until );
  12047. },
  12048. prevUntil: function( elem, i, until ) {
  12049. return dir( elem, "previousSibling", until );
  12050. },
  12051. siblings: function( elem ) {
  12052. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  12053. },
  12054. children: function( elem ) {
  12055. return siblings( elem.firstChild );
  12056. },
  12057. contents: function( elem ) {
  12058. if ( typeof elem.contentDocument !== "undefined" ) {
  12059. return elem.contentDocument;
  12060. }
  12061. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  12062. // Treat the template element as a regular one in browsers that
  12063. // don't support it.
  12064. if ( nodeName( elem, "template" ) ) {
  12065. elem = elem.content || elem;
  12066. }
  12067. return jQuery.merge( [], elem.childNodes );
  12068. }
  12069. }, function( name, fn ) {
  12070. jQuery.fn[ name ] = function( until, selector ) {
  12071. var matched = jQuery.map( this, fn, until );
  12072. if ( name.slice( -5 ) !== "Until" ) {
  12073. selector = until;
  12074. }
  12075. if ( selector && typeof selector === "string" ) {
  12076. matched = jQuery.filter( selector, matched );
  12077. }
  12078. if ( this.length > 1 ) {
  12079. // Remove duplicates
  12080. if ( !guaranteedUnique[ name ] ) {
  12081. jQuery.uniqueSort( matched );
  12082. }
  12083. // Reverse order for parents* and prev-derivatives
  12084. if ( rparentsprev.test( name ) ) {
  12085. matched.reverse();
  12086. }
  12087. }
  12088. return this.pushStack( matched );
  12089. };
  12090. } );
  12091. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  12092. // Convert String-formatted options into Object-formatted ones
  12093. function createOptions( options ) {
  12094. var object = {};
  12095. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  12096. object[ flag ] = true;
  12097. } );
  12098. return object;
  12099. }
  12100. /*
  12101. * Create a callback list using the following parameters:
  12102. *
  12103. * options: an optional list of space-separated options that will change how
  12104. * the callback list behaves or a more traditional option object
  12105. *
  12106. * By default a callback list will act like an event callback list and can be
  12107. * "fired" multiple times.
  12108. *
  12109. * Possible options:
  12110. *
  12111. * once: will ensure the callback list can only be fired once (like a Deferred)
  12112. *
  12113. * memory: will keep track of previous values and will call any callback added
  12114. * after the list has been fired right away with the latest "memorized"
  12115. * values (like a Deferred)
  12116. *
  12117. * unique: will ensure a callback can only be added once (no duplicate in the list)
  12118. *
  12119. * stopOnFalse: interrupt callings when a callback returns false
  12120. *
  12121. */
  12122. jQuery.Callbacks = function( options ) {
  12123. // Convert options from String-formatted to Object-formatted if needed
  12124. // (we check in cache first)
  12125. options = typeof options === "string" ?
  12126. createOptions( options ) :
  12127. jQuery.extend( {}, options );
  12128. var // Flag to know if list is currently firing
  12129. firing,
  12130. // Last fire value for non-forgettable lists
  12131. memory,
  12132. // Flag to know if list was already fired
  12133. fired,
  12134. // Flag to prevent firing
  12135. locked,
  12136. // Actual callback list
  12137. list = [],
  12138. // Queue of execution data for repeatable lists
  12139. queue = [],
  12140. // Index of currently firing callback (modified by add/remove as needed)
  12141. firingIndex = -1,
  12142. // Fire callbacks
  12143. fire = function() {
  12144. // Enforce single-firing
  12145. locked = locked || options.once;
  12146. // Execute callbacks for all pending executions,
  12147. // respecting firingIndex overrides and runtime changes
  12148. fired = firing = true;
  12149. for ( ; queue.length; firingIndex = -1 ) {
  12150. memory = queue.shift();
  12151. while ( ++firingIndex < list.length ) {
  12152. // Run callback and check for early termination
  12153. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  12154. options.stopOnFalse ) {
  12155. // Jump to end and forget the data so .add doesn't re-fire
  12156. firingIndex = list.length;
  12157. memory = false;
  12158. }
  12159. }
  12160. }
  12161. // Forget the data if we're done with it
  12162. if ( !options.memory ) {
  12163. memory = false;
  12164. }
  12165. firing = false;
  12166. // Clean up if we're done firing for good
  12167. if ( locked ) {
  12168. // Keep an empty list if we have data for future add calls
  12169. if ( memory ) {
  12170. list = [];
  12171. // Otherwise, this object is spent
  12172. } else {
  12173. list = "";
  12174. }
  12175. }
  12176. },
  12177. // Actual Callbacks object
  12178. self = {
  12179. // Add a callback or a collection of callbacks to the list
  12180. add: function() {
  12181. if ( list ) {
  12182. // If we have memory from a past run, we should fire after adding
  12183. if ( memory && !firing ) {
  12184. firingIndex = list.length - 1;
  12185. queue.push( memory );
  12186. }
  12187. ( function add( args ) {
  12188. jQuery.each( args, function( _, arg ) {
  12189. if ( isFunction( arg ) ) {
  12190. if ( !options.unique || !self.has( arg ) ) {
  12191. list.push( arg );
  12192. }
  12193. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  12194. // Inspect recursively
  12195. add( arg );
  12196. }
  12197. } );
  12198. } )( arguments );
  12199. if ( memory && !firing ) {
  12200. fire();
  12201. }
  12202. }
  12203. return this;
  12204. },
  12205. // Remove a callback from the list
  12206. remove: function() {
  12207. jQuery.each( arguments, function( _, arg ) {
  12208. var index;
  12209. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  12210. list.splice( index, 1 );
  12211. // Handle firing indexes
  12212. if ( index <= firingIndex ) {
  12213. firingIndex--;
  12214. }
  12215. }
  12216. } );
  12217. return this;
  12218. },
  12219. // Check if a given callback is in the list.
  12220. // If no argument is given, return whether or not list has callbacks attached.
  12221. has: function( fn ) {
  12222. return fn ?
  12223. jQuery.inArray( fn, list ) > -1 :
  12224. list.length > 0;
  12225. },
  12226. // Remove all callbacks from the list
  12227. empty: function() {
  12228. if ( list ) {
  12229. list = [];
  12230. }
  12231. return this;
  12232. },
  12233. // Disable .fire and .add
  12234. // Abort any current/pending executions
  12235. // Clear all callbacks and values
  12236. disable: function() {
  12237. locked = queue = [];
  12238. list = memory = "";
  12239. return this;
  12240. },
  12241. disabled: function() {
  12242. return !list;
  12243. },
  12244. // Disable .fire
  12245. // Also disable .add unless we have memory (since it would have no effect)
  12246. // Abort any pending executions
  12247. lock: function() {
  12248. locked = queue = [];
  12249. if ( !memory && !firing ) {
  12250. list = memory = "";
  12251. }
  12252. return this;
  12253. },
  12254. locked: function() {
  12255. return !!locked;
  12256. },
  12257. // Call all callbacks with the given context and arguments
  12258. fireWith: function( context, args ) {
  12259. if ( !locked ) {
  12260. args = args || [];
  12261. args = [ context, args.slice ? args.slice() : args ];
  12262. queue.push( args );
  12263. if ( !firing ) {
  12264. fire();
  12265. }
  12266. }
  12267. return this;
  12268. },
  12269. // Call all the callbacks with the given arguments
  12270. fire: function() {
  12271. self.fireWith( this, arguments );
  12272. return this;
  12273. },
  12274. // To know if the callbacks have already been called at least once
  12275. fired: function() {
  12276. return !!fired;
  12277. }
  12278. };
  12279. return self;
  12280. };
  12281. function Identity( v ) {
  12282. return v;
  12283. }
  12284. function Thrower( ex ) {
  12285. throw ex;
  12286. }
  12287. function adoptValue( value, resolve, reject, noValue ) {
  12288. var method;
  12289. try {
  12290. // Check for promise aspect first to privilege synchronous behavior
  12291. if ( value && isFunction( ( method = value.promise ) ) ) {
  12292. method.call( value ).done( resolve ).fail( reject );
  12293. // Other thenables
  12294. } else if ( value && isFunction( ( method = value.then ) ) ) {
  12295. method.call( value, resolve, reject );
  12296. // Other non-thenables
  12297. } else {
  12298. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  12299. // * false: [ value ].slice( 0 ) => resolve( value )
  12300. // * true: [ value ].slice( 1 ) => resolve()
  12301. resolve.apply( undefined, [ value ].slice( noValue ) );
  12302. }
  12303. // For Promises/A+, convert exceptions into rejections
  12304. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  12305. // Deferred#then to conditionally suppress rejection.
  12306. } catch ( value ) {
  12307. // Support: Android 4.0 only
  12308. // Strict mode functions invoked without .call/.apply get global-object context
  12309. reject.apply( undefined, [ value ] );
  12310. }
  12311. }
  12312. jQuery.extend( {
  12313. Deferred: function( func ) {
  12314. var tuples = [
  12315. // action, add listener, callbacks,
  12316. // ... .then handlers, argument index, [final state]
  12317. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  12318. jQuery.Callbacks( "memory" ), 2 ],
  12319. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  12320. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  12321. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  12322. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  12323. ],
  12324. state = "pending",
  12325. promise = {
  12326. state: function() {
  12327. return state;
  12328. },
  12329. always: function() {
  12330. deferred.done( arguments ).fail( arguments );
  12331. return this;
  12332. },
  12333. "catch": function( fn ) {
  12334. return promise.then( null, fn );
  12335. },
  12336. // Keep pipe for back-compat
  12337. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  12338. var fns = arguments;
  12339. return jQuery.Deferred( function( newDefer ) {
  12340. jQuery.each( tuples, function( i, tuple ) {
  12341. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  12342. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  12343. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  12344. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  12345. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  12346. deferred[ tuple[ 1 ] ]( function() {
  12347. var returned = fn && fn.apply( this, arguments );
  12348. if ( returned && isFunction( returned.promise ) ) {
  12349. returned.promise()
  12350. .progress( newDefer.notify )
  12351. .done( newDefer.resolve )
  12352. .fail( newDefer.reject );
  12353. } else {
  12354. newDefer[ tuple[ 0 ] + "With" ](
  12355. this,
  12356. fn ? [ returned ] : arguments
  12357. );
  12358. }
  12359. } );
  12360. } );
  12361. fns = null;
  12362. } ).promise();
  12363. },
  12364. then: function( onFulfilled, onRejected, onProgress ) {
  12365. var maxDepth = 0;
  12366. function resolve( depth, deferred, handler, special ) {
  12367. return function() {
  12368. var that = this,
  12369. args = arguments,
  12370. mightThrow = function() {
  12371. var returned, then;
  12372. // Support: Promises/A+ section 2.3.3.3.3
  12373. // https://promisesaplus.com/#point-59
  12374. // Ignore double-resolution attempts
  12375. if ( depth < maxDepth ) {
  12376. return;
  12377. }
  12378. returned = handler.apply( that, args );
  12379. // Support: Promises/A+ section 2.3.1
  12380. // https://promisesaplus.com/#point-48
  12381. if ( returned === deferred.promise() ) {
  12382. throw new TypeError( "Thenable self-resolution" );
  12383. }
  12384. // Support: Promises/A+ sections 2.3.3.1, 3.5
  12385. // https://promisesaplus.com/#point-54
  12386. // https://promisesaplus.com/#point-75
  12387. // Retrieve `then` only once
  12388. then = returned &&
  12389. // Support: Promises/A+ section 2.3.4
  12390. // https://promisesaplus.com/#point-64
  12391. // Only check objects and functions for thenability
  12392. ( typeof returned === "object" ||
  12393. typeof returned === "function" ) &&
  12394. returned.then;
  12395. // Handle a returned thenable
  12396. if ( isFunction( then ) ) {
  12397. // Special processors (notify) just wait for resolution
  12398. if ( special ) {
  12399. then.call(
  12400. returned,
  12401. resolve( maxDepth, deferred, Identity, special ),
  12402. resolve( maxDepth, deferred, Thrower, special )
  12403. );
  12404. // Normal processors (resolve) also hook into progress
  12405. } else {
  12406. // ...and disregard older resolution values
  12407. maxDepth++;
  12408. then.call(
  12409. returned,
  12410. resolve( maxDepth, deferred, Identity, special ),
  12411. resolve( maxDepth, deferred, Thrower, special ),
  12412. resolve( maxDepth, deferred, Identity,
  12413. deferred.notifyWith )
  12414. );
  12415. }
  12416. // Handle all other returned values
  12417. } else {
  12418. // Only substitute handlers pass on context
  12419. // and multiple values (non-spec behavior)
  12420. if ( handler !== Identity ) {
  12421. that = undefined;
  12422. args = [ returned ];
  12423. }
  12424. // Process the value(s)
  12425. // Default process is resolve
  12426. ( special || deferred.resolveWith )( that, args );
  12427. }
  12428. },
  12429. // Only normal processors (resolve) catch and reject exceptions
  12430. process = special ?
  12431. mightThrow :
  12432. function() {
  12433. try {
  12434. mightThrow();
  12435. } catch ( e ) {
  12436. if ( jQuery.Deferred.exceptionHook ) {
  12437. jQuery.Deferred.exceptionHook( e,
  12438. process.stackTrace );
  12439. }
  12440. // Support: Promises/A+ section 2.3.3.3.4.1
  12441. // https://promisesaplus.com/#point-61
  12442. // Ignore post-resolution exceptions
  12443. if ( depth + 1 >= maxDepth ) {
  12444. // Only substitute handlers pass on context
  12445. // and multiple values (non-spec behavior)
  12446. if ( handler !== Thrower ) {
  12447. that = undefined;
  12448. args = [ e ];
  12449. }
  12450. deferred.rejectWith( that, args );
  12451. }
  12452. }
  12453. };
  12454. // Support: Promises/A+ section 2.3.3.3.1
  12455. // https://promisesaplus.com/#point-57
  12456. // Re-resolve promises immediately to dodge false rejection from
  12457. // subsequent errors
  12458. if ( depth ) {
  12459. process();
  12460. } else {
  12461. // Call an optional hook to record the stack, in case of exception
  12462. // since it's otherwise lost when execution goes async
  12463. if ( jQuery.Deferred.getStackHook ) {
  12464. process.stackTrace = jQuery.Deferred.getStackHook();
  12465. }
  12466. window.setTimeout( process );
  12467. }
  12468. };
  12469. }
  12470. return jQuery.Deferred( function( newDefer ) {
  12471. // progress_handlers.add( ... )
  12472. tuples[ 0 ][ 3 ].add(
  12473. resolve(
  12474. 0,
  12475. newDefer,
  12476. isFunction( onProgress ) ?
  12477. onProgress :
  12478. Identity,
  12479. newDefer.notifyWith
  12480. )
  12481. );
  12482. // fulfilled_handlers.add( ... )
  12483. tuples[ 1 ][ 3 ].add(
  12484. resolve(
  12485. 0,
  12486. newDefer,
  12487. isFunction( onFulfilled ) ?
  12488. onFulfilled :
  12489. Identity
  12490. )
  12491. );
  12492. // rejected_handlers.add( ... )
  12493. tuples[ 2 ][ 3 ].add(
  12494. resolve(
  12495. 0,
  12496. newDefer,
  12497. isFunction( onRejected ) ?
  12498. onRejected :
  12499. Thrower
  12500. )
  12501. );
  12502. } ).promise();
  12503. },
  12504. // Get a promise for this deferred
  12505. // If obj is provided, the promise aspect is added to the object
  12506. promise: function( obj ) {
  12507. return obj != null ? jQuery.extend( obj, promise ) : promise;
  12508. }
  12509. },
  12510. deferred = {};
  12511. // Add list-specific methods
  12512. jQuery.each( tuples, function( i, tuple ) {
  12513. var list = tuple[ 2 ],
  12514. stateString = tuple[ 5 ];
  12515. // promise.progress = list.add
  12516. // promise.done = list.add
  12517. // promise.fail = list.add
  12518. promise[ tuple[ 1 ] ] = list.add;
  12519. // Handle state
  12520. if ( stateString ) {
  12521. list.add(
  12522. function() {
  12523. // state = "resolved" (i.e., fulfilled)
  12524. // state = "rejected"
  12525. state = stateString;
  12526. },
  12527. // rejected_callbacks.disable
  12528. // fulfilled_callbacks.disable
  12529. tuples[ 3 - i ][ 2 ].disable,
  12530. // rejected_handlers.disable
  12531. // fulfilled_handlers.disable
  12532. tuples[ 3 - i ][ 3 ].disable,
  12533. // progress_callbacks.lock
  12534. tuples[ 0 ][ 2 ].lock,
  12535. // progress_handlers.lock
  12536. tuples[ 0 ][ 3 ].lock
  12537. );
  12538. }
  12539. // progress_handlers.fire
  12540. // fulfilled_handlers.fire
  12541. // rejected_handlers.fire
  12542. list.add( tuple[ 3 ].fire );
  12543. // deferred.notify = function() { deferred.notifyWith(...) }
  12544. // deferred.resolve = function() { deferred.resolveWith(...) }
  12545. // deferred.reject = function() { deferred.rejectWith(...) }
  12546. deferred[ tuple[ 0 ] ] = function() {
  12547. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  12548. return this;
  12549. };
  12550. // deferred.notifyWith = list.fireWith
  12551. // deferred.resolveWith = list.fireWith
  12552. // deferred.rejectWith = list.fireWith
  12553. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  12554. } );
  12555. // Make the deferred a promise
  12556. promise.promise( deferred );
  12557. // Call given func if any
  12558. if ( func ) {
  12559. func.call( deferred, deferred );
  12560. }
  12561. // All done!
  12562. return deferred;
  12563. },
  12564. // Deferred helper
  12565. when: function( singleValue ) {
  12566. var
  12567. // count of uncompleted subordinates
  12568. remaining = arguments.length,
  12569. // count of unprocessed arguments
  12570. i = remaining,
  12571. // subordinate fulfillment data
  12572. resolveContexts = Array( i ),
  12573. resolveValues = slice.call( arguments ),
  12574. // the master Deferred
  12575. master = jQuery.Deferred(),
  12576. // subordinate callback factory
  12577. updateFunc = function( i ) {
  12578. return function( value ) {
  12579. resolveContexts[ i ] = this;
  12580. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  12581. if ( !( --remaining ) ) {
  12582. master.resolveWith( resolveContexts, resolveValues );
  12583. }
  12584. };
  12585. };
  12586. // Single- and empty arguments are adopted like Promise.resolve
  12587. if ( remaining <= 1 ) {
  12588. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  12589. !remaining );
  12590. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  12591. if ( master.state() === "pending" ||
  12592. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  12593. return master.then();
  12594. }
  12595. }
  12596. // Multiple arguments are aggregated like Promise.all array elements
  12597. while ( i-- ) {
  12598. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  12599. }
  12600. return master.promise();
  12601. }
  12602. } );
  12603. // These usually indicate a programmer mistake during development,
  12604. // warn about them ASAP rather than swallowing them by default.
  12605. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  12606. jQuery.Deferred.exceptionHook = function( error, stack ) {
  12607. // Support: IE 8 - 9 only
  12608. // Console exists when dev tools are open, which can happen at any time
  12609. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  12610. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  12611. }
  12612. };
  12613. jQuery.readyException = function( error ) {
  12614. window.setTimeout( function() {
  12615. throw error;
  12616. } );
  12617. };
  12618. // The deferred used on DOM ready
  12619. var readyList = jQuery.Deferred();
  12620. jQuery.fn.ready = function( fn ) {
  12621. readyList
  12622. .then( fn )
  12623. // Wrap jQuery.readyException in a function so that the lookup
  12624. // happens at the time of error handling instead of callback
  12625. // registration.
  12626. .catch( function( error ) {
  12627. jQuery.readyException( error );
  12628. } );
  12629. return this;
  12630. };
  12631. jQuery.extend( {
  12632. // Is the DOM ready to be used? Set to true once it occurs.
  12633. isReady: false,
  12634. // A counter to track how many items to wait for before
  12635. // the ready event fires. See #6781
  12636. readyWait: 1,
  12637. // Handle when the DOM is ready
  12638. ready: function( wait ) {
  12639. // Abort if there are pending holds or we're already ready
  12640. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  12641. return;
  12642. }
  12643. // Remember that the DOM is ready
  12644. jQuery.isReady = true;
  12645. // If a normal DOM Ready event fired, decrement, and wait if need be
  12646. if ( wait !== true && --jQuery.readyWait > 0 ) {
  12647. return;
  12648. }
  12649. // If there are functions bound, to execute
  12650. readyList.resolveWith( document, [ jQuery ] );
  12651. }
  12652. } );
  12653. jQuery.ready.then = readyList.then;
  12654. // The ready event handler and self cleanup method
  12655. function completed() {
  12656. document.removeEventListener( "DOMContentLoaded", completed );
  12657. window.removeEventListener( "load", completed );
  12658. jQuery.ready();
  12659. }
  12660. // Catch cases where $(document).ready() is called
  12661. // after the browser event has already occurred.
  12662. // Support: IE <=9 - 10 only
  12663. // Older IE sometimes signals "interactive" too soon
  12664. if ( document.readyState === "complete" ||
  12665. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  12666. // Handle it asynchronously to allow scripts the opportunity to delay ready
  12667. window.setTimeout( jQuery.ready );
  12668. } else {
  12669. // Use the handy event callback
  12670. document.addEventListener( "DOMContentLoaded", completed );
  12671. // A fallback to window.onload, that will always work
  12672. window.addEventListener( "load", completed );
  12673. }
  12674. // Multifunctional method to get and set values of a collection
  12675. // The value/s can optionally be executed if it's a function
  12676. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  12677. var i = 0,
  12678. len = elems.length,
  12679. bulk = key == null;
  12680. // Sets many values
  12681. if ( toType( key ) === "object" ) {
  12682. chainable = true;
  12683. for ( i in key ) {
  12684. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  12685. }
  12686. // Sets one value
  12687. } else if ( value !== undefined ) {
  12688. chainable = true;
  12689. if ( !isFunction( value ) ) {
  12690. raw = true;
  12691. }
  12692. if ( bulk ) {
  12693. // Bulk operations run against the entire set
  12694. if ( raw ) {
  12695. fn.call( elems, value );
  12696. fn = null;
  12697. // ...except when executing function values
  12698. } else {
  12699. bulk = fn;
  12700. fn = function( elem, key, value ) {
  12701. return bulk.call( jQuery( elem ), value );
  12702. };
  12703. }
  12704. }
  12705. if ( fn ) {
  12706. for ( ; i < len; i++ ) {
  12707. fn(
  12708. elems[ i ], key, raw ?
  12709. value :
  12710. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  12711. );
  12712. }
  12713. }
  12714. }
  12715. if ( chainable ) {
  12716. return elems;
  12717. }
  12718. // Gets
  12719. if ( bulk ) {
  12720. return fn.call( elems );
  12721. }
  12722. return len ? fn( elems[ 0 ], key ) : emptyGet;
  12723. };
  12724. // Matches dashed string for camelizing
  12725. var rmsPrefix = /^-ms-/,
  12726. rdashAlpha = /-([a-z])/g;
  12727. // Used by camelCase as callback to replace()
  12728. function fcamelCase( all, letter ) {
  12729. return letter.toUpperCase();
  12730. }
  12731. // Convert dashed to camelCase; used by the css and data modules
  12732. // Support: IE <=9 - 11, Edge 12 - 15
  12733. // Microsoft forgot to hump their vendor prefix (#9572)
  12734. function camelCase( string ) {
  12735. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  12736. }
  12737. var acceptData = function( owner ) {
  12738. // Accepts only:
  12739. // - Node
  12740. // - Node.ELEMENT_NODE
  12741. // - Node.DOCUMENT_NODE
  12742. // - Object
  12743. // - Any
  12744. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  12745. };
  12746. function Data() {
  12747. this.expando = jQuery.expando + Data.uid++;
  12748. }
  12749. Data.uid = 1;
  12750. Data.prototype = {
  12751. cache: function( owner ) {
  12752. // Check if the owner object already has a cache
  12753. var value = owner[ this.expando ];
  12754. // If not, create one
  12755. if ( !value ) {
  12756. value = {};
  12757. // We can accept data for non-element nodes in modern browsers,
  12758. // but we should not, see #8335.
  12759. // Always return an empty object.
  12760. if ( acceptData( owner ) ) {
  12761. // If it is a node unlikely to be stringify-ed or looped over
  12762. // use plain assignment
  12763. if ( owner.nodeType ) {
  12764. owner[ this.expando ] = value;
  12765. // Otherwise secure it in a non-enumerable property
  12766. // configurable must be true to allow the property to be
  12767. // deleted when data is removed
  12768. } else {
  12769. Object.defineProperty( owner, this.expando, {
  12770. value: value,
  12771. configurable: true
  12772. } );
  12773. }
  12774. }
  12775. }
  12776. return value;
  12777. },
  12778. set: function( owner, data, value ) {
  12779. var prop,
  12780. cache = this.cache( owner );
  12781. // Handle: [ owner, key, value ] args
  12782. // Always use camelCase key (gh-2257)
  12783. if ( typeof data === "string" ) {
  12784. cache[ camelCase( data ) ] = value;
  12785. // Handle: [ owner, { properties } ] args
  12786. } else {
  12787. // Copy the properties one-by-one to the cache object
  12788. for ( prop in data ) {
  12789. cache[ camelCase( prop ) ] = data[ prop ];
  12790. }
  12791. }
  12792. return cache;
  12793. },
  12794. get: function( owner, key ) {
  12795. return key === undefined ?
  12796. this.cache( owner ) :
  12797. // Always use camelCase key (gh-2257)
  12798. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12799. },
  12800. access: function( owner, key, value ) {
  12801. // In cases where either:
  12802. //
  12803. // 1. No key was specified
  12804. // 2. A string key was specified, but no value provided
  12805. //
  12806. // Take the "read" path and allow the get method to determine
  12807. // which value to return, respectively either:
  12808. //
  12809. // 1. The entire cache object
  12810. // 2. The data stored at the key
  12811. //
  12812. if ( key === undefined ||
  12813. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12814. return this.get( owner, key );
  12815. }
  12816. // When the key is not a string, or both a key and value
  12817. // are specified, set or extend (existing objects) with either:
  12818. //
  12819. // 1. An object of properties
  12820. // 2. A key and value
  12821. //
  12822. this.set( owner, key, value );
  12823. // Since the "set" path can have two possible entry points
  12824. // return the expected data based on which path was taken[*]
  12825. return value !== undefined ? value : key;
  12826. },
  12827. remove: function( owner, key ) {
  12828. var i,
  12829. cache = owner[ this.expando ];
  12830. if ( cache === undefined ) {
  12831. return;
  12832. }
  12833. if ( key !== undefined ) {
  12834. // Support array or space separated string of keys
  12835. if ( Array.isArray( key ) ) {
  12836. // If key is an array of keys...
  12837. // We always set camelCase keys, so remove that.
  12838. key = key.map( camelCase );
  12839. } else {
  12840. key = camelCase( key );
  12841. // If a key with the spaces exists, use it.
  12842. // Otherwise, create an array by matching non-whitespace
  12843. key = key in cache ?
  12844. [ key ] :
  12845. ( key.match( rnothtmlwhite ) || [] );
  12846. }
  12847. i = key.length;
  12848. while ( i-- ) {
  12849. delete cache[ key[ i ] ];
  12850. }
  12851. }
  12852. // Remove the expando if there's no more data
  12853. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12854. // Support: Chrome <=35 - 45
  12855. // Webkit & Blink performance suffers when deleting properties
  12856. // from DOM nodes, so set to undefined instead
  12857. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12858. if ( owner.nodeType ) {
  12859. owner[ this.expando ] = undefined;
  12860. } else {
  12861. delete owner[ this.expando ];
  12862. }
  12863. }
  12864. },
  12865. hasData: function( owner ) {
  12866. var cache = owner[ this.expando ];
  12867. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12868. }
  12869. };
  12870. var dataPriv = new Data();
  12871. var dataUser = new Data();
  12872. // Implementation Summary
  12873. //
  12874. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12875. // 2. Improve the module's maintainability by reducing the storage
  12876. // paths to a single mechanism.
  12877. // 3. Use the same single mechanism to support "private" and "user" data.
  12878. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12879. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12880. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12881. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12882. rmultiDash = /[A-Z]/g;
  12883. function getData( data ) {
  12884. if ( data === "true" ) {
  12885. return true;
  12886. }
  12887. if ( data === "false" ) {
  12888. return false;
  12889. }
  12890. if ( data === "null" ) {
  12891. return null;
  12892. }
  12893. // Only convert to a number if it doesn't change the string
  12894. if ( data === +data + "" ) {
  12895. return +data;
  12896. }
  12897. if ( rbrace.test( data ) ) {
  12898. return JSON.parse( data );
  12899. }
  12900. return data;
  12901. }
  12902. function dataAttr( elem, key, data ) {
  12903. var name;
  12904. // If nothing was found internally, try to fetch any
  12905. // data from the HTML5 data-* attribute
  12906. if ( data === undefined && elem.nodeType === 1 ) {
  12907. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12908. data = elem.getAttribute( name );
  12909. if ( typeof data === "string" ) {
  12910. try {
  12911. data = getData( data );
  12912. } catch ( e ) {}
  12913. // Make sure we set the data so it isn't changed later
  12914. dataUser.set( elem, key, data );
  12915. } else {
  12916. data = undefined;
  12917. }
  12918. }
  12919. return data;
  12920. }
  12921. jQuery.extend( {
  12922. hasData: function( elem ) {
  12923. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12924. },
  12925. data: function( elem, name, data ) {
  12926. return dataUser.access( elem, name, data );
  12927. },
  12928. removeData: function( elem, name ) {
  12929. dataUser.remove( elem, name );
  12930. },
  12931. // TODO: Now that all calls to _data and _removeData have been replaced
  12932. // with direct calls to dataPriv methods, these can be deprecated.
  12933. _data: function( elem, name, data ) {
  12934. return dataPriv.access( elem, name, data );
  12935. },
  12936. _removeData: function( elem, name ) {
  12937. dataPriv.remove( elem, name );
  12938. }
  12939. } );
  12940. jQuery.fn.extend( {
  12941. data: function( key, value ) {
  12942. var i, name, data,
  12943. elem = this[ 0 ],
  12944. attrs = elem && elem.attributes;
  12945. // Gets all values
  12946. if ( key === undefined ) {
  12947. if ( this.length ) {
  12948. data = dataUser.get( elem );
  12949. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12950. i = attrs.length;
  12951. while ( i-- ) {
  12952. // Support: IE 11 only
  12953. // The attrs elements can be null (#14894)
  12954. if ( attrs[ i ] ) {
  12955. name = attrs[ i ].name;
  12956. if ( name.indexOf( "data-" ) === 0 ) {
  12957. name = camelCase( name.slice( 5 ) );
  12958. dataAttr( elem, name, data[ name ] );
  12959. }
  12960. }
  12961. }
  12962. dataPriv.set( elem, "hasDataAttrs", true );
  12963. }
  12964. }
  12965. return data;
  12966. }
  12967. // Sets multiple values
  12968. if ( typeof key === "object" ) {
  12969. return this.each( function() {
  12970. dataUser.set( this, key );
  12971. } );
  12972. }
  12973. return access( this, function( value ) {
  12974. var data;
  12975. // The calling jQuery object (element matches) is not empty
  12976. // (and therefore has an element appears at this[ 0 ]) and the
  12977. // `value` parameter was not undefined. An empty jQuery object
  12978. // will result in `undefined` for elem = this[ 0 ] which will
  12979. // throw an exception if an attempt to read a data cache is made.
  12980. if ( elem && value === undefined ) {
  12981. // Attempt to get data from the cache
  12982. // The key will always be camelCased in Data
  12983. data = dataUser.get( elem, key );
  12984. if ( data !== undefined ) {
  12985. return data;
  12986. }
  12987. // Attempt to "discover" the data in
  12988. // HTML5 custom data-* attrs
  12989. data = dataAttr( elem, key );
  12990. if ( data !== undefined ) {
  12991. return data;
  12992. }
  12993. // We tried really hard, but the data doesn't exist.
  12994. return;
  12995. }
  12996. // Set the data...
  12997. this.each( function() {
  12998. // We always store the camelCased key
  12999. dataUser.set( this, key, value );
  13000. } );
  13001. }, null, value, arguments.length > 1, null, true );
  13002. },
  13003. removeData: function( key ) {
  13004. return this.each( function() {
  13005. dataUser.remove( this, key );
  13006. } );
  13007. }
  13008. } );
  13009. jQuery.extend( {
  13010. queue: function( elem, type, data ) {
  13011. var queue;
  13012. if ( elem ) {
  13013. type = ( type || "fx" ) + "queue";
  13014. queue = dataPriv.get( elem, type );
  13015. // Speed up dequeue by getting out quickly if this is just a lookup
  13016. if ( data ) {
  13017. if ( !queue || Array.isArray( data ) ) {
  13018. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  13019. } else {
  13020. queue.push( data );
  13021. }
  13022. }
  13023. return queue || [];
  13024. }
  13025. },
  13026. dequeue: function( elem, type ) {
  13027. type = type || "fx";
  13028. var queue = jQuery.queue( elem, type ),
  13029. startLength = queue.length,
  13030. fn = queue.shift(),
  13031. hooks = jQuery._queueHooks( elem, type ),
  13032. next = function() {
  13033. jQuery.dequeue( elem, type );
  13034. };
  13035. // If the fx queue is dequeued, always remove the progress sentinel
  13036. if ( fn === "inprogress" ) {
  13037. fn = queue.shift();
  13038. startLength--;
  13039. }
  13040. if ( fn ) {
  13041. // Add a progress sentinel to prevent the fx queue from being
  13042. // automatically dequeued
  13043. if ( type === "fx" ) {
  13044. queue.unshift( "inprogress" );
  13045. }
  13046. // Clear up the last queue stop function
  13047. delete hooks.stop;
  13048. fn.call( elem, next, hooks );
  13049. }
  13050. if ( !startLength && hooks ) {
  13051. hooks.empty.fire();
  13052. }
  13053. },
  13054. // Not public - generate a queueHooks object, or return the current one
  13055. _queueHooks: function( elem, type ) {
  13056. var key = type + "queueHooks";
  13057. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  13058. empty: jQuery.Callbacks( "once memory" ).add( function() {
  13059. dataPriv.remove( elem, [ type + "queue", key ] );
  13060. } )
  13061. } );
  13062. }
  13063. } );
  13064. jQuery.fn.extend( {
  13065. queue: function( type, data ) {
  13066. var setter = 2;
  13067. if ( typeof type !== "string" ) {
  13068. data = type;
  13069. type = "fx";
  13070. setter--;
  13071. }
  13072. if ( arguments.length < setter ) {
  13073. return jQuery.queue( this[ 0 ], type );
  13074. }
  13075. return data === undefined ?
  13076. this :
  13077. this.each( function() {
  13078. var queue = jQuery.queue( this, type, data );
  13079. // Ensure a hooks for this queue
  13080. jQuery._queueHooks( this, type );
  13081. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  13082. jQuery.dequeue( this, type );
  13083. }
  13084. } );
  13085. },
  13086. dequeue: function( type ) {
  13087. return this.each( function() {
  13088. jQuery.dequeue( this, type );
  13089. } );
  13090. },
  13091. clearQueue: function( type ) {
  13092. return this.queue( type || "fx", [] );
  13093. },
  13094. // Get a promise resolved when queues of a certain type
  13095. // are emptied (fx is the type by default)
  13096. promise: function( type, obj ) {
  13097. var tmp,
  13098. count = 1,
  13099. defer = jQuery.Deferred(),
  13100. elements = this,
  13101. i = this.length,
  13102. resolve = function() {
  13103. if ( !( --count ) ) {
  13104. defer.resolveWith( elements, [ elements ] );
  13105. }
  13106. };
  13107. if ( typeof type !== "string" ) {
  13108. obj = type;
  13109. type = undefined;
  13110. }
  13111. type = type || "fx";
  13112. while ( i-- ) {
  13113. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  13114. if ( tmp && tmp.empty ) {
  13115. count++;
  13116. tmp.empty.add( resolve );
  13117. }
  13118. }
  13119. resolve();
  13120. return defer.promise( obj );
  13121. }
  13122. } );
  13123. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  13124. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  13125. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  13126. var documentElement = document.documentElement;
  13127. var isAttached = function( elem ) {
  13128. return jQuery.contains( elem.ownerDocument, elem );
  13129. },
  13130. composed = { composed: true };
  13131. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  13132. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  13133. // Support: iOS 10.0-10.2 only
  13134. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  13135. // leading to errors. We need to check for `getRootNode`.
  13136. if ( documentElement.getRootNode ) {
  13137. isAttached = function( elem ) {
  13138. return jQuery.contains( elem.ownerDocument, elem ) ||
  13139. elem.getRootNode( composed ) === elem.ownerDocument;
  13140. };
  13141. }
  13142. var isHiddenWithinTree = function( elem, el ) {
  13143. // isHiddenWithinTree might be called from jQuery#filter function;
  13144. // in that case, element will be second argument
  13145. elem = el || elem;
  13146. // Inline style trumps all
  13147. return elem.style.display === "none" ||
  13148. elem.style.display === "" &&
  13149. // Otherwise, check computed style
  13150. // Support: Firefox <=43 - 45
  13151. // Disconnected elements can have computed display: none, so first confirm that elem is
  13152. // in the document.
  13153. isAttached( elem ) &&
  13154. jQuery.css( elem, "display" ) === "none";
  13155. };
  13156. var swap = function( elem, options, callback, args ) {
  13157. var ret, name,
  13158. old = {};
  13159. // Remember the old values, and insert the new ones
  13160. for ( name in options ) {
  13161. old[ name ] = elem.style[ name ];
  13162. elem.style[ name ] = options[ name ];
  13163. }
  13164. ret = callback.apply( elem, args || [] );
  13165. // Revert the old values
  13166. for ( name in options ) {
  13167. elem.style[ name ] = old[ name ];
  13168. }
  13169. return ret;
  13170. };
  13171. function adjustCSS( elem, prop, valueParts, tween ) {
  13172. var adjusted, scale,
  13173. maxIterations = 20,
  13174. currentValue = tween ?
  13175. function() {
  13176. return tween.cur();
  13177. } :
  13178. function() {
  13179. return jQuery.css( elem, prop, "" );
  13180. },
  13181. initial = currentValue(),
  13182. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  13183. // Starting value computation is required for potential unit mismatches
  13184. initialInUnit = elem.nodeType &&
  13185. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  13186. rcssNum.exec( jQuery.css( elem, prop ) );
  13187. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  13188. // Support: Firefox <=54
  13189. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  13190. initial = initial / 2;
  13191. // Trust units reported by jQuery.css
  13192. unit = unit || initialInUnit[ 3 ];
  13193. // Iteratively approximate from a nonzero starting point
  13194. initialInUnit = +initial || 1;
  13195. while ( maxIterations-- ) {
  13196. // Evaluate and update our best guess (doubling guesses that zero out).
  13197. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  13198. jQuery.style( elem, prop, initialInUnit + unit );
  13199. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  13200. maxIterations = 0;
  13201. }
  13202. initialInUnit = initialInUnit / scale;
  13203. }
  13204. initialInUnit = initialInUnit * 2;
  13205. jQuery.style( elem, prop, initialInUnit + unit );
  13206. // Make sure we update the tween properties later on
  13207. valueParts = valueParts || [];
  13208. }
  13209. if ( valueParts ) {
  13210. initialInUnit = +initialInUnit || +initial || 0;
  13211. // Apply relative offset (+=/-=) if specified
  13212. adjusted = valueParts[ 1 ] ?
  13213. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  13214. +valueParts[ 2 ];
  13215. if ( tween ) {
  13216. tween.unit = unit;
  13217. tween.start = initialInUnit;
  13218. tween.end = adjusted;
  13219. }
  13220. }
  13221. return adjusted;
  13222. }
  13223. var defaultDisplayMap = {};
  13224. function getDefaultDisplay( elem ) {
  13225. var temp,
  13226. doc = elem.ownerDocument,
  13227. nodeName = elem.nodeName,
  13228. display = defaultDisplayMap[ nodeName ];
  13229. if ( display ) {
  13230. return display;
  13231. }
  13232. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  13233. display = jQuery.css( temp, "display" );
  13234. temp.parentNode.removeChild( temp );
  13235. if ( display === "none" ) {
  13236. display = "block";
  13237. }
  13238. defaultDisplayMap[ nodeName ] = display;
  13239. return display;
  13240. }
  13241. function showHide( elements, show ) {
  13242. var display, elem,
  13243. values = [],
  13244. index = 0,
  13245. length = elements.length;
  13246. // Determine new display value for elements that need to change
  13247. for ( ; index < length; index++ ) {
  13248. elem = elements[ index ];
  13249. if ( !elem.style ) {
  13250. continue;
  13251. }
  13252. display = elem.style.display;
  13253. if ( show ) {
  13254. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  13255. // check is required in this first loop unless we have a nonempty display value (either
  13256. // inline or about-to-be-restored)
  13257. if ( display === "none" ) {
  13258. values[ index ] = dataPriv.get( elem, "display" ) || null;
  13259. if ( !values[ index ] ) {
  13260. elem.style.display = "";
  13261. }
  13262. }
  13263. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  13264. values[ index ] = getDefaultDisplay( elem );
  13265. }
  13266. } else {
  13267. if ( display !== "none" ) {
  13268. values[ index ] = "none";
  13269. // Remember what we're overwriting
  13270. dataPriv.set( elem, "display", display );
  13271. }
  13272. }
  13273. }
  13274. // Set the display of the elements in a second loop to avoid constant reflow
  13275. for ( index = 0; index < length; index++ ) {
  13276. if ( values[ index ] != null ) {
  13277. elements[ index ].style.display = values[ index ];
  13278. }
  13279. }
  13280. return elements;
  13281. }
  13282. jQuery.fn.extend( {
  13283. show: function() {
  13284. return showHide( this, true );
  13285. },
  13286. hide: function() {
  13287. return showHide( this );
  13288. },
  13289. toggle: function( state ) {
  13290. if ( typeof state === "boolean" ) {
  13291. return state ? this.show() : this.hide();
  13292. }
  13293. return this.each( function() {
  13294. if ( isHiddenWithinTree( this ) ) {
  13295. jQuery( this ).show();
  13296. } else {
  13297. jQuery( this ).hide();
  13298. }
  13299. } );
  13300. }
  13301. } );
  13302. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  13303. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  13304. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  13305. // We have to close these tags to support XHTML (#13200)
  13306. var wrapMap = {
  13307. // Support: IE <=9 only
  13308. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  13309. // XHTML parsers do not magically insert elements in the
  13310. // same way that tag soup parsers do. So we cannot shorten
  13311. // this by omitting <tbody> or other required elements.
  13312. thead: [ 1, "<table>", "</table>" ],
  13313. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  13314. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  13315. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  13316. _default: [ 0, "", "" ]
  13317. };
  13318. // Support: IE <=9 only
  13319. wrapMap.optgroup = wrapMap.option;
  13320. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  13321. wrapMap.th = wrapMap.td;
  13322. function getAll( context, tag ) {
  13323. // Support: IE <=9 - 11 only
  13324. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  13325. var ret;
  13326. if ( typeof context.getElementsByTagName !== "undefined" ) {
  13327. ret = context.getElementsByTagName( tag || "*" );
  13328. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  13329. ret = context.querySelectorAll( tag || "*" );
  13330. } else {
  13331. ret = [];
  13332. }
  13333. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  13334. return jQuery.merge( [ context ], ret );
  13335. }
  13336. return ret;
  13337. }
  13338. // Mark scripts as having already been evaluated
  13339. function setGlobalEval( elems, refElements ) {
  13340. var i = 0,
  13341. l = elems.length;
  13342. for ( ; i < l; i++ ) {
  13343. dataPriv.set(
  13344. elems[ i ],
  13345. "globalEval",
  13346. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  13347. );
  13348. }
  13349. }
  13350. var rhtml = /<|&#?\w+;/;
  13351. function buildFragment( elems, context, scripts, selection, ignored ) {
  13352. var elem, tmp, tag, wrap, attached, j,
  13353. fragment = context.createDocumentFragment(),
  13354. nodes = [],
  13355. i = 0,
  13356. l = elems.length;
  13357. for ( ; i < l; i++ ) {
  13358. elem = elems[ i ];
  13359. if ( elem || elem === 0 ) {
  13360. // Add nodes directly
  13361. if ( toType( elem ) === "object" ) {
  13362. // Support: Android <=4.0 only, PhantomJS 1 only
  13363. // push.apply(_, arraylike) throws on ancient WebKit
  13364. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  13365. // Convert non-html into a text node
  13366. } else if ( !rhtml.test( elem ) ) {
  13367. nodes.push( context.createTextNode( elem ) );
  13368. // Convert html into DOM nodes
  13369. } else {
  13370. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  13371. // Deserialize a standard representation
  13372. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  13373. wrap = wrapMap[ tag ] || wrapMap._default;
  13374. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  13375. // Descend through wrappers to the right content
  13376. j = wrap[ 0 ];
  13377. while ( j-- ) {
  13378. tmp = tmp.lastChild;
  13379. }
  13380. // Support: Android <=4.0 only, PhantomJS 1 only
  13381. // push.apply(_, arraylike) throws on ancient WebKit
  13382. jQuery.merge( nodes, tmp.childNodes );
  13383. // Remember the top-level container
  13384. tmp = fragment.firstChild;
  13385. // Ensure the created nodes are orphaned (#12392)
  13386. tmp.textContent = "";
  13387. }
  13388. }
  13389. }
  13390. // Remove wrapper from fragment
  13391. fragment.textContent = "";
  13392. i = 0;
  13393. while ( ( elem = nodes[ i++ ] ) ) {
  13394. // Skip elements already in the context collection (trac-4087)
  13395. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  13396. if ( ignored ) {
  13397. ignored.push( elem );
  13398. }
  13399. continue;
  13400. }
  13401. attached = isAttached( elem );
  13402. // Append to fragment
  13403. tmp = getAll( fragment.appendChild( elem ), "script" );
  13404. // Preserve script evaluation history
  13405. if ( attached ) {
  13406. setGlobalEval( tmp );
  13407. }
  13408. // Capture executables
  13409. if ( scripts ) {
  13410. j = 0;
  13411. while ( ( elem = tmp[ j++ ] ) ) {
  13412. if ( rscriptType.test( elem.type || "" ) ) {
  13413. scripts.push( elem );
  13414. }
  13415. }
  13416. }
  13417. }
  13418. return fragment;
  13419. }
  13420. ( function() {
  13421. var fragment = document.createDocumentFragment(),
  13422. div = fragment.appendChild( document.createElement( "div" ) ),
  13423. input = document.createElement( "input" );
  13424. // Support: Android 4.0 - 4.3 only
  13425. // Check state lost if the name is set (#11217)
  13426. // Support: Windows Web Apps (WWA)
  13427. // `name` and `type` must use .setAttribute for WWA (#14901)
  13428. input.setAttribute( "type", "radio" );
  13429. input.setAttribute( "checked", "checked" );
  13430. input.setAttribute( "name", "t" );
  13431. div.appendChild( input );
  13432. // Support: Android <=4.1 only
  13433. // Older WebKit doesn't clone checked state correctly in fragments
  13434. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  13435. // Support: IE <=11 only
  13436. // Make sure textarea (and checkbox) defaultValue is properly cloned
  13437. div.innerHTML = "<textarea>x</textarea>";
  13438. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  13439. } )();
  13440. var
  13441. rkeyEvent = /^key/,
  13442. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  13443. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  13444. function returnTrue() {
  13445. return true;
  13446. }
  13447. function returnFalse() {
  13448. return false;
  13449. }
  13450. // Support: IE <=9 - 11+
  13451. // focus() and blur() are asynchronous, except when they are no-op.
  13452. // So expect focus to be synchronous when the element is already active,
  13453. // and blur to be synchronous when the element is not already active.
  13454. // (focus and blur are always synchronous in other supported browsers,
  13455. // this just defines when we can count on it).
  13456. function expectSync( elem, type ) {
  13457. return ( elem === safeActiveElement() ) === ( type === "focus" );
  13458. }
  13459. // Support: IE <=9 only
  13460. // Accessing document.activeElement can throw unexpectedly
  13461. // https://bugs.jquery.com/ticket/13393
  13462. function safeActiveElement() {
  13463. try {
  13464. return document.activeElement;
  13465. } catch ( err ) { }
  13466. }
  13467. function on( elem, types, selector, data, fn, one ) {
  13468. var origFn, type;
  13469. // Types can be a map of types/handlers
  13470. if ( typeof types === "object" ) {
  13471. // ( types-Object, selector, data )
  13472. if ( typeof selector !== "string" ) {
  13473. // ( types-Object, data )
  13474. data = data || selector;
  13475. selector = undefined;
  13476. }
  13477. for ( type in types ) {
  13478. on( elem, type, selector, data, types[ type ], one );
  13479. }
  13480. return elem;
  13481. }
  13482. if ( data == null && fn == null ) {
  13483. // ( types, fn )
  13484. fn = selector;
  13485. data = selector = undefined;
  13486. } else if ( fn == null ) {
  13487. if ( typeof selector === "string" ) {
  13488. // ( types, selector, fn )
  13489. fn = data;
  13490. data = undefined;
  13491. } else {
  13492. // ( types, data, fn )
  13493. fn = data;
  13494. data = selector;
  13495. selector = undefined;
  13496. }
  13497. }
  13498. if ( fn === false ) {
  13499. fn = returnFalse;
  13500. } else if ( !fn ) {
  13501. return elem;
  13502. }
  13503. if ( one === 1 ) {
  13504. origFn = fn;
  13505. fn = function( event ) {
  13506. // Can use an empty set, since event contains the info
  13507. jQuery().off( event );
  13508. return origFn.apply( this, arguments );
  13509. };
  13510. // Use same guid so caller can remove using origFn
  13511. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  13512. }
  13513. return elem.each( function() {
  13514. jQuery.event.add( this, types, fn, data, selector );
  13515. } );
  13516. }
  13517. /*
  13518. * Helper functions for managing events -- not part of the public interface.
  13519. * Props to Dean Edwards' addEvent library for many of the ideas.
  13520. */
  13521. jQuery.event = {
  13522. global: {},
  13523. add: function( elem, types, handler, data, selector ) {
  13524. var handleObjIn, eventHandle, tmp,
  13525. events, t, handleObj,
  13526. special, handlers, type, namespaces, origType,
  13527. elemData = dataPriv.get( elem );
  13528. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  13529. if ( !elemData ) {
  13530. return;
  13531. }
  13532. // Caller can pass in an object of custom data in lieu of the handler
  13533. if ( handler.handler ) {
  13534. handleObjIn = handler;
  13535. handler = handleObjIn.handler;
  13536. selector = handleObjIn.selector;
  13537. }
  13538. // Ensure that invalid selectors throw exceptions at attach time
  13539. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  13540. if ( selector ) {
  13541. jQuery.find.matchesSelector( documentElement, selector );
  13542. }
  13543. // Make sure that the handler has a unique ID, used to find/remove it later
  13544. if ( !handler.guid ) {
  13545. handler.guid = jQuery.guid++;
  13546. }
  13547. // Init the element's event structure and main handler, if this is the first
  13548. if ( !( events = elemData.events ) ) {
  13549. events = elemData.events = {};
  13550. }
  13551. if ( !( eventHandle = elemData.handle ) ) {
  13552. eventHandle = elemData.handle = function( e ) {
  13553. // Discard the second event of a jQuery.event.trigger() and
  13554. // when an event is called after a page has unloaded
  13555. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  13556. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  13557. };
  13558. }
  13559. // Handle multiple events separated by a space
  13560. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13561. t = types.length;
  13562. while ( t-- ) {
  13563. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13564. type = origType = tmp[ 1 ];
  13565. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13566. // There *must* be a type, no attaching namespace-only handlers
  13567. if ( !type ) {
  13568. continue;
  13569. }
  13570. // If event changes its type, use the special event handlers for the changed type
  13571. special = jQuery.event.special[ type ] || {};
  13572. // If selector defined, determine special event api type, otherwise given type
  13573. type = ( selector ? special.delegateType : special.bindType ) || type;
  13574. // Update special based on newly reset type
  13575. special = jQuery.event.special[ type ] || {};
  13576. // handleObj is passed to all event handlers
  13577. handleObj = jQuery.extend( {
  13578. type: type,
  13579. origType: origType,
  13580. data: data,
  13581. handler: handler,
  13582. guid: handler.guid,
  13583. selector: selector,
  13584. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  13585. namespace: namespaces.join( "." )
  13586. }, handleObjIn );
  13587. // Init the event handler queue if we're the first
  13588. if ( !( handlers = events[ type ] ) ) {
  13589. handlers = events[ type ] = [];
  13590. handlers.delegateCount = 0;
  13591. // Only use addEventListener if the special events handler returns false
  13592. if ( !special.setup ||
  13593. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  13594. if ( elem.addEventListener ) {
  13595. elem.addEventListener( type, eventHandle );
  13596. }
  13597. }
  13598. }
  13599. if ( special.add ) {
  13600. special.add.call( elem, handleObj );
  13601. if ( !handleObj.handler.guid ) {
  13602. handleObj.handler.guid = handler.guid;
  13603. }
  13604. }
  13605. // Add to the element's handler list, delegates in front
  13606. if ( selector ) {
  13607. handlers.splice( handlers.delegateCount++, 0, handleObj );
  13608. } else {
  13609. handlers.push( handleObj );
  13610. }
  13611. // Keep track of which events have ever been used, for event optimization
  13612. jQuery.event.global[ type ] = true;
  13613. }
  13614. },
  13615. // Detach an event or set of events from an element
  13616. remove: function( elem, types, handler, selector, mappedTypes ) {
  13617. var j, origCount, tmp,
  13618. events, t, handleObj,
  13619. special, handlers, type, namespaces, origType,
  13620. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  13621. if ( !elemData || !( events = elemData.events ) ) {
  13622. return;
  13623. }
  13624. // Once for each type.namespace in types; type may be omitted
  13625. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  13626. t = types.length;
  13627. while ( t-- ) {
  13628. tmp = rtypenamespace.exec( types[ t ] ) || [];
  13629. type = origType = tmp[ 1 ];
  13630. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  13631. // Unbind all events (on this namespace, if provided) for the element
  13632. if ( !type ) {
  13633. for ( type in events ) {
  13634. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  13635. }
  13636. continue;
  13637. }
  13638. special = jQuery.event.special[ type ] || {};
  13639. type = ( selector ? special.delegateType : special.bindType ) || type;
  13640. handlers = events[ type ] || [];
  13641. tmp = tmp[ 2 ] &&
  13642. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  13643. // Remove matching events
  13644. origCount = j = handlers.length;
  13645. while ( j-- ) {
  13646. handleObj = handlers[ j ];
  13647. if ( ( mappedTypes || origType === handleObj.origType ) &&
  13648. ( !handler || handler.guid === handleObj.guid ) &&
  13649. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  13650. ( !selector || selector === handleObj.selector ||
  13651. selector === "**" && handleObj.selector ) ) {
  13652. handlers.splice( j, 1 );
  13653. if ( handleObj.selector ) {
  13654. handlers.delegateCount--;
  13655. }
  13656. if ( special.remove ) {
  13657. special.remove.call( elem, handleObj );
  13658. }
  13659. }
  13660. }
  13661. // Remove generic event handler if we removed something and no more handlers exist
  13662. // (avoids potential for endless recursion during removal of special event handlers)
  13663. if ( origCount && !handlers.length ) {
  13664. if ( !special.teardown ||
  13665. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  13666. jQuery.removeEvent( elem, type, elemData.handle );
  13667. }
  13668. delete events[ type ];
  13669. }
  13670. }
  13671. // Remove data and the expando if it's no longer used
  13672. if ( jQuery.isEmptyObject( events ) ) {
  13673. dataPriv.remove( elem, "handle events" );
  13674. }
  13675. },
  13676. dispatch: function( nativeEvent ) {
  13677. // Make a writable jQuery.Event from the native event object
  13678. var event = jQuery.event.fix( nativeEvent );
  13679. var i, j, ret, matched, handleObj, handlerQueue,
  13680. args = new Array( arguments.length ),
  13681. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  13682. special = jQuery.event.special[ event.type ] || {};
  13683. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  13684. args[ 0 ] = event;
  13685. for ( i = 1; i < arguments.length; i++ ) {
  13686. args[ i ] = arguments[ i ];
  13687. }
  13688. event.delegateTarget = this;
  13689. // Call the preDispatch hook for the mapped type, and let it bail if desired
  13690. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  13691. return;
  13692. }
  13693. // Determine handlers
  13694. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  13695. // Run delegates first; they may want to stop propagation beneath us
  13696. i = 0;
  13697. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  13698. event.currentTarget = matched.elem;
  13699. j = 0;
  13700. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  13701. !event.isImmediatePropagationStopped() ) {
  13702. // If the event is namespaced, then each handler is only invoked if it is
  13703. // specially universal or its namespaces are a superset of the event's.
  13704. if ( !event.rnamespace || handleObj.namespace === false ||
  13705. event.rnamespace.test( handleObj.namespace ) ) {
  13706. event.handleObj = handleObj;
  13707. event.data = handleObj.data;
  13708. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  13709. handleObj.handler ).apply( matched.elem, args );
  13710. if ( ret !== undefined ) {
  13711. if ( ( event.result = ret ) === false ) {
  13712. event.preventDefault();
  13713. event.stopPropagation();
  13714. }
  13715. }
  13716. }
  13717. }
  13718. }
  13719. // Call the postDispatch hook for the mapped type
  13720. if ( special.postDispatch ) {
  13721. special.postDispatch.call( this, event );
  13722. }
  13723. return event.result;
  13724. },
  13725. handlers: function( event, handlers ) {
  13726. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  13727. handlerQueue = [],
  13728. delegateCount = handlers.delegateCount,
  13729. cur = event.target;
  13730. // Find delegate handlers
  13731. if ( delegateCount &&
  13732. // Support: IE <=9
  13733. // Black-hole SVG <use> instance trees (trac-13180)
  13734. cur.nodeType &&
  13735. // Support: Firefox <=42
  13736. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  13737. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  13738. // Support: IE 11 only
  13739. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  13740. !( event.type === "click" && event.button >= 1 ) ) {
  13741. for ( ; cur !== this; cur = cur.parentNode || this ) {
  13742. // Don't check non-elements (#13208)
  13743. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  13744. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  13745. matchedHandlers = [];
  13746. matchedSelectors = {};
  13747. for ( i = 0; i < delegateCount; i++ ) {
  13748. handleObj = handlers[ i ];
  13749. // Don't conflict with Object.prototype properties (#13203)
  13750. sel = handleObj.selector + " ";
  13751. if ( matchedSelectors[ sel ] === undefined ) {
  13752. matchedSelectors[ sel ] = handleObj.needsContext ?
  13753. jQuery( sel, this ).index( cur ) > -1 :
  13754. jQuery.find( sel, this, null, [ cur ] ).length;
  13755. }
  13756. if ( matchedSelectors[ sel ] ) {
  13757. matchedHandlers.push( handleObj );
  13758. }
  13759. }
  13760. if ( matchedHandlers.length ) {
  13761. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  13762. }
  13763. }
  13764. }
  13765. }
  13766. // Add the remaining (directly-bound) handlers
  13767. cur = this;
  13768. if ( delegateCount < handlers.length ) {
  13769. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  13770. }
  13771. return handlerQueue;
  13772. },
  13773. addProp: function( name, hook ) {
  13774. Object.defineProperty( jQuery.Event.prototype, name, {
  13775. enumerable: true,
  13776. configurable: true,
  13777. get: isFunction( hook ) ?
  13778. function() {
  13779. if ( this.originalEvent ) {
  13780. return hook( this.originalEvent );
  13781. }
  13782. } :
  13783. function() {
  13784. if ( this.originalEvent ) {
  13785. return this.originalEvent[ name ];
  13786. }
  13787. },
  13788. set: function( value ) {
  13789. Object.defineProperty( this, name, {
  13790. enumerable: true,
  13791. configurable: true,
  13792. writable: true,
  13793. value: value
  13794. } );
  13795. }
  13796. } );
  13797. },
  13798. fix: function( originalEvent ) {
  13799. return originalEvent[ jQuery.expando ] ?
  13800. originalEvent :
  13801. new jQuery.Event( originalEvent );
  13802. },
  13803. special: {
  13804. load: {
  13805. // Prevent triggered image.load events from bubbling to window.load
  13806. noBubble: true
  13807. },
  13808. click: {
  13809. // Utilize native event to ensure correct state for checkable inputs
  13810. setup: function( data ) {
  13811. // For mutual compressibility with _default, replace `this` access with a local var.
  13812. // `|| data` is dead code meant only to preserve the variable through minification.
  13813. var el = this || data;
  13814. // Claim the first handler
  13815. if ( rcheckableType.test( el.type ) &&
  13816. el.click && nodeName( el, "input" ) ) {
  13817. // dataPriv.set( el, "click", ... )
  13818. leverageNative( el, "click", returnTrue );
  13819. }
  13820. // Return false to allow normal processing in the caller
  13821. return false;
  13822. },
  13823. trigger: 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. // Force setup before triggering a click
  13828. if ( rcheckableType.test( el.type ) &&
  13829. el.click && nodeName( el, "input" ) ) {
  13830. leverageNative( el, "click" );
  13831. }
  13832. // Return non-false to allow normal event-path propagation
  13833. return true;
  13834. },
  13835. // For cross-browser consistency, suppress native .click() on links
  13836. // Also prevent it if we're currently inside a leveraged native-event stack
  13837. _default: function( event ) {
  13838. var target = event.target;
  13839. return rcheckableType.test( target.type ) &&
  13840. target.click && nodeName( target, "input" ) &&
  13841. dataPriv.get( target, "click" ) ||
  13842. nodeName( target, "a" );
  13843. }
  13844. },
  13845. beforeunload: {
  13846. postDispatch: function( event ) {
  13847. // Support: Firefox 20+
  13848. // Firefox doesn't alert if the returnValue field is not set.
  13849. if ( event.result !== undefined && event.originalEvent ) {
  13850. event.originalEvent.returnValue = event.result;
  13851. }
  13852. }
  13853. }
  13854. }
  13855. };
  13856. // Ensure the presence of an event listener that handles manually-triggered
  13857. // synthetic events by interrupting progress until reinvoked in response to
  13858. // *native* events that it fires directly, ensuring that state changes have
  13859. // already occurred before other listeners are invoked.
  13860. function leverageNative( el, type, expectSync ) {
  13861. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13862. if ( !expectSync ) {
  13863. if ( dataPriv.get( el, type ) === undefined ) {
  13864. jQuery.event.add( el, type, returnTrue );
  13865. }
  13866. return;
  13867. }
  13868. // Register the controller as a special universal handler for all event namespaces
  13869. dataPriv.set( el, type, false );
  13870. jQuery.event.add( el, type, {
  13871. namespace: false,
  13872. handler: function( event ) {
  13873. var notAsync, result,
  13874. saved = dataPriv.get( this, type );
  13875. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13876. // Interrupt processing of the outer synthetic .trigger()ed event
  13877. // Saved data should be false in such cases, but might be a leftover capture object
  13878. // from an async native handler (gh-4350)
  13879. if ( !saved.length ) {
  13880. // Store arguments for use when handling the inner native event
  13881. // There will always be at least one argument (an event object), so this array
  13882. // will not be confused with a leftover capture object.
  13883. saved = slice.call( arguments );
  13884. dataPriv.set( this, type, saved );
  13885. // Trigger the native event and capture its result
  13886. // Support: IE <=9 - 11+
  13887. // focus() and blur() are asynchronous
  13888. notAsync = expectSync( this, type );
  13889. this[ type ]();
  13890. result = dataPriv.get( this, type );
  13891. if ( saved !== result || notAsync ) {
  13892. dataPriv.set( this, type, false );
  13893. } else {
  13894. result = {};
  13895. }
  13896. if ( saved !== result ) {
  13897. // Cancel the outer synthetic event
  13898. event.stopImmediatePropagation();
  13899. event.preventDefault();
  13900. return result.value;
  13901. }
  13902. // If this is an inner synthetic event for an event with a bubbling surrogate
  13903. // (focus or blur), assume that the surrogate already propagated from triggering the
  13904. // native event and prevent that from happening again here.
  13905. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13906. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13907. // less bad than duplication.
  13908. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13909. event.stopPropagation();
  13910. }
  13911. // If this is a native event triggered above, everything is now in order
  13912. // Fire an inner synthetic event with the original arguments
  13913. } else if ( saved.length ) {
  13914. // ...and capture the result
  13915. dataPriv.set( this, type, {
  13916. value: jQuery.event.trigger(
  13917. // Support: IE <=9 - 11+
  13918. // Extend with the prototype to reset the above stopImmediatePropagation()
  13919. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13920. saved.slice( 1 ),
  13921. this
  13922. )
  13923. } );
  13924. // Abort handling of the native event
  13925. event.stopImmediatePropagation();
  13926. }
  13927. }
  13928. } );
  13929. }
  13930. jQuery.removeEvent = function( elem, type, handle ) {
  13931. // This "if" is needed for plain objects
  13932. if ( elem.removeEventListener ) {
  13933. elem.removeEventListener( type, handle );
  13934. }
  13935. };
  13936. jQuery.Event = function( src, props ) {
  13937. // Allow instantiation without the 'new' keyword
  13938. if ( !( this instanceof jQuery.Event ) ) {
  13939. return new jQuery.Event( src, props );
  13940. }
  13941. // Event object
  13942. if ( src && src.type ) {
  13943. this.originalEvent = src;
  13944. this.type = src.type;
  13945. // Events bubbling up the document may have been marked as prevented
  13946. // by a handler lower down the tree; reflect the correct value.
  13947. this.isDefaultPrevented = src.defaultPrevented ||
  13948. src.defaultPrevented === undefined &&
  13949. // Support: Android <=2.3 only
  13950. src.returnValue === false ?
  13951. returnTrue :
  13952. returnFalse;
  13953. // Create target properties
  13954. // Support: Safari <=6 - 7 only
  13955. // Target should not be a text node (#504, #13143)
  13956. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13957. src.target.parentNode :
  13958. src.target;
  13959. this.currentTarget = src.currentTarget;
  13960. this.relatedTarget = src.relatedTarget;
  13961. // Event type
  13962. } else {
  13963. this.type = src;
  13964. }
  13965. // Put explicitly provided properties onto the event object
  13966. if ( props ) {
  13967. jQuery.extend( this, props );
  13968. }
  13969. // Create a timestamp if incoming event doesn't have one
  13970. this.timeStamp = src && src.timeStamp || Date.now();
  13971. // Mark it as fixed
  13972. this[ jQuery.expando ] = true;
  13973. };
  13974. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13975. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13976. jQuery.Event.prototype = {
  13977. constructor: jQuery.Event,
  13978. isDefaultPrevented: returnFalse,
  13979. isPropagationStopped: returnFalse,
  13980. isImmediatePropagationStopped: returnFalse,
  13981. isSimulated: false,
  13982. preventDefault: function() {
  13983. var e = this.originalEvent;
  13984. this.isDefaultPrevented = returnTrue;
  13985. if ( e && !this.isSimulated ) {
  13986. e.preventDefault();
  13987. }
  13988. },
  13989. stopPropagation: function() {
  13990. var e = this.originalEvent;
  13991. this.isPropagationStopped = returnTrue;
  13992. if ( e && !this.isSimulated ) {
  13993. e.stopPropagation();
  13994. }
  13995. },
  13996. stopImmediatePropagation: function() {
  13997. var e = this.originalEvent;
  13998. this.isImmediatePropagationStopped = returnTrue;
  13999. if ( e && !this.isSimulated ) {
  14000. e.stopImmediatePropagation();
  14001. }
  14002. this.stopPropagation();
  14003. }
  14004. };
  14005. // Includes all common event props including KeyEvent and MouseEvent specific props
  14006. jQuery.each( {
  14007. altKey: true,
  14008. bubbles: true,
  14009. cancelable: true,
  14010. changedTouches: true,
  14011. ctrlKey: true,
  14012. detail: true,
  14013. eventPhase: true,
  14014. metaKey: true,
  14015. pageX: true,
  14016. pageY: true,
  14017. shiftKey: true,
  14018. view: true,
  14019. "char": true,
  14020. code: true,
  14021. charCode: true,
  14022. key: true,
  14023. keyCode: true,
  14024. button: true,
  14025. buttons: true,
  14026. clientX: true,
  14027. clientY: true,
  14028. offsetX: true,
  14029. offsetY: true,
  14030. pointerId: true,
  14031. pointerType: true,
  14032. screenX: true,
  14033. screenY: true,
  14034. targetTouches: true,
  14035. toElement: true,
  14036. touches: true,
  14037. which: function( event ) {
  14038. var button = event.button;
  14039. // Add which for key events
  14040. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  14041. return event.charCode != null ? event.charCode : event.keyCode;
  14042. }
  14043. // Add which for click: 1 === left; 2 === middle; 3 === right
  14044. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  14045. if ( button & 1 ) {
  14046. return 1;
  14047. }
  14048. if ( button & 2 ) {
  14049. return 3;
  14050. }
  14051. if ( button & 4 ) {
  14052. return 2;
  14053. }
  14054. return 0;
  14055. }
  14056. return event.which;
  14057. }
  14058. }, jQuery.event.addProp );
  14059. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  14060. jQuery.event.special[ type ] = {
  14061. // Utilize native event if possible so blur/focus sequence is correct
  14062. setup: function() {
  14063. // Claim the first handler
  14064. // dataPriv.set( this, "focus", ... )
  14065. // dataPriv.set( this, "blur", ... )
  14066. leverageNative( this, type, expectSync );
  14067. // Return false to allow normal processing in the caller
  14068. return false;
  14069. },
  14070. trigger: function() {
  14071. // Force setup before trigger
  14072. leverageNative( this, type );
  14073. // Return non-false to allow normal event-path propagation
  14074. return true;
  14075. },
  14076. delegateType: delegateType
  14077. };
  14078. } );
  14079. // Create mouseenter/leave events using mouseover/out and event-time checks
  14080. // so that event delegation works in jQuery.
  14081. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  14082. //
  14083. // Support: Safari 7 only
  14084. // Safari sends mouseenter too often; see:
  14085. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  14086. // for the description of the bug (it existed in older Chrome versions as well).
  14087. jQuery.each( {
  14088. mouseenter: "mouseover",
  14089. mouseleave: "mouseout",
  14090. pointerenter: "pointerover",
  14091. pointerleave: "pointerout"
  14092. }, function( orig, fix ) {
  14093. jQuery.event.special[ orig ] = {
  14094. delegateType: fix,
  14095. bindType: fix,
  14096. handle: function( event ) {
  14097. var ret,
  14098. target = this,
  14099. related = event.relatedTarget,
  14100. handleObj = event.handleObj;
  14101. // For mouseenter/leave call the handler if related is outside the target.
  14102. // NB: No relatedTarget if the mouse left/entered the browser window
  14103. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  14104. event.type = handleObj.origType;
  14105. ret = handleObj.handler.apply( this, arguments );
  14106. event.type = fix;
  14107. }
  14108. return ret;
  14109. }
  14110. };
  14111. } );
  14112. jQuery.fn.extend( {
  14113. on: function( types, selector, data, fn ) {
  14114. return on( this, types, selector, data, fn );
  14115. },
  14116. one: function( types, selector, data, fn ) {
  14117. return on( this, types, selector, data, fn, 1 );
  14118. },
  14119. off: function( types, selector, fn ) {
  14120. var handleObj, type;
  14121. if ( types && types.preventDefault && types.handleObj ) {
  14122. // ( event ) dispatched jQuery.Event
  14123. handleObj = types.handleObj;
  14124. jQuery( types.delegateTarget ).off(
  14125. handleObj.namespace ?
  14126. handleObj.origType + "." + handleObj.namespace :
  14127. handleObj.origType,
  14128. handleObj.selector,
  14129. handleObj.handler
  14130. );
  14131. return this;
  14132. }
  14133. if ( typeof types === "object" ) {
  14134. // ( types-object [, selector] )
  14135. for ( type in types ) {
  14136. this.off( type, selector, types[ type ] );
  14137. }
  14138. return this;
  14139. }
  14140. if ( selector === false || typeof selector === "function" ) {
  14141. // ( types [, fn] )
  14142. fn = selector;
  14143. selector = undefined;
  14144. }
  14145. if ( fn === false ) {
  14146. fn = returnFalse;
  14147. }
  14148. return this.each( function() {
  14149. jQuery.event.remove( this, types, fn, selector );
  14150. } );
  14151. }
  14152. } );
  14153. var
  14154. /* eslint-disable max-len */
  14155. // See https://github.com/eslint/eslint/issues/3229
  14156. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  14157. /* eslint-enable */
  14158. // Support: IE <=10 - 11, Edge 12 - 13 only
  14159. // In IE/Edge using regex groups here causes severe slowdowns.
  14160. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  14161. rnoInnerhtml = /<script|<style|<link/i,
  14162. // checked="checked" or checked
  14163. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  14164. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  14165. // Prefer a tbody over its parent table for containing new rows
  14166. function manipulationTarget( elem, content ) {
  14167. if ( nodeName( elem, "table" ) &&
  14168. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  14169. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  14170. }
  14171. return elem;
  14172. }
  14173. // Replace/restore the type attribute of script elements for safe DOM manipulation
  14174. function disableScript( elem ) {
  14175. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  14176. return elem;
  14177. }
  14178. function restoreScript( elem ) {
  14179. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  14180. elem.type = elem.type.slice( 5 );
  14181. } else {
  14182. elem.removeAttribute( "type" );
  14183. }
  14184. return elem;
  14185. }
  14186. function cloneCopyEvent( src, dest ) {
  14187. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  14188. if ( dest.nodeType !== 1 ) {
  14189. return;
  14190. }
  14191. // 1. Copy private data: events, handlers, etc.
  14192. if ( dataPriv.hasData( src ) ) {
  14193. pdataOld = dataPriv.access( src );
  14194. pdataCur = dataPriv.set( dest, pdataOld );
  14195. events = pdataOld.events;
  14196. if ( events ) {
  14197. delete pdataCur.handle;
  14198. pdataCur.events = {};
  14199. for ( type in events ) {
  14200. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  14201. jQuery.event.add( dest, type, events[ type ][ i ] );
  14202. }
  14203. }
  14204. }
  14205. }
  14206. // 2. Copy user data
  14207. if ( dataUser.hasData( src ) ) {
  14208. udataOld = dataUser.access( src );
  14209. udataCur = jQuery.extend( {}, udataOld );
  14210. dataUser.set( dest, udataCur );
  14211. }
  14212. }
  14213. // Fix IE bugs, see support tests
  14214. function fixInput( src, dest ) {
  14215. var nodeName = dest.nodeName.toLowerCase();
  14216. // Fails to persist the checked state of a cloned checkbox or radio button.
  14217. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  14218. dest.checked = src.checked;
  14219. // Fails to return the selected option to the default selected state when cloning options
  14220. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  14221. dest.defaultValue = src.defaultValue;
  14222. }
  14223. }
  14224. function domManip( collection, args, callback, ignored ) {
  14225. // Flatten any nested arrays
  14226. args = concat.apply( [], args );
  14227. var fragment, first, scripts, hasScripts, node, doc,
  14228. i = 0,
  14229. l = collection.length,
  14230. iNoClone = l - 1,
  14231. value = args[ 0 ],
  14232. valueIsFunction = isFunction( value );
  14233. // We can't cloneNode fragments that contain checked, in WebKit
  14234. if ( valueIsFunction ||
  14235. ( l > 1 && typeof value === "string" &&
  14236. !support.checkClone && rchecked.test( value ) ) ) {
  14237. return collection.each( function( index ) {
  14238. var self = collection.eq( index );
  14239. if ( valueIsFunction ) {
  14240. args[ 0 ] = value.call( this, index, self.html() );
  14241. }
  14242. domManip( self, args, callback, ignored );
  14243. } );
  14244. }
  14245. if ( l ) {
  14246. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  14247. first = fragment.firstChild;
  14248. if ( fragment.childNodes.length === 1 ) {
  14249. fragment = first;
  14250. }
  14251. // Require either new content or an interest in ignored elements to invoke the callback
  14252. if ( first || ignored ) {
  14253. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  14254. hasScripts = scripts.length;
  14255. // Use the original fragment for the last item
  14256. // instead of the first because it can end up
  14257. // being emptied incorrectly in certain situations (#8070).
  14258. for ( ; i < l; i++ ) {
  14259. node = fragment;
  14260. if ( i !== iNoClone ) {
  14261. node = jQuery.clone( node, true, true );
  14262. // Keep references to cloned scripts for later restoration
  14263. if ( hasScripts ) {
  14264. // Support: Android <=4.0 only, PhantomJS 1 only
  14265. // push.apply(_, arraylike) throws on ancient WebKit
  14266. jQuery.merge( scripts, getAll( node, "script" ) );
  14267. }
  14268. }
  14269. callback.call( collection[ i ], node, i );
  14270. }
  14271. if ( hasScripts ) {
  14272. doc = scripts[ scripts.length - 1 ].ownerDocument;
  14273. // Reenable scripts
  14274. jQuery.map( scripts, restoreScript );
  14275. // Evaluate executable scripts on first document insertion
  14276. for ( i = 0; i < hasScripts; i++ ) {
  14277. node = scripts[ i ];
  14278. if ( rscriptType.test( node.type || "" ) &&
  14279. !dataPriv.access( node, "globalEval" ) &&
  14280. jQuery.contains( doc, node ) ) {
  14281. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  14282. // Optional AJAX dependency, but won't run scripts if not present
  14283. if ( jQuery._evalUrl && !node.noModule ) {
  14284. jQuery._evalUrl( node.src, {
  14285. nonce: node.nonce || node.getAttribute( "nonce" )
  14286. } );
  14287. }
  14288. } else {
  14289. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  14290. }
  14291. }
  14292. }
  14293. }
  14294. }
  14295. }
  14296. return collection;
  14297. }
  14298. function remove( elem, selector, keepData ) {
  14299. var node,
  14300. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  14301. i = 0;
  14302. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  14303. if ( !keepData && node.nodeType === 1 ) {
  14304. jQuery.cleanData( getAll( node ) );
  14305. }
  14306. if ( node.parentNode ) {
  14307. if ( keepData && isAttached( node ) ) {
  14308. setGlobalEval( getAll( node, "script" ) );
  14309. }
  14310. node.parentNode.removeChild( node );
  14311. }
  14312. }
  14313. return elem;
  14314. }
  14315. jQuery.extend( {
  14316. htmlPrefilter: function( html ) {
  14317. return html.replace( rxhtmlTag, "<$1></$2>" );
  14318. },
  14319. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  14320. var i, l, srcElements, destElements,
  14321. clone = elem.cloneNode( true ),
  14322. inPage = isAttached( elem );
  14323. // Fix IE cloning issues
  14324. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  14325. !jQuery.isXMLDoc( elem ) ) {
  14326. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  14327. destElements = getAll( clone );
  14328. srcElements = getAll( elem );
  14329. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  14330. fixInput( srcElements[ i ], destElements[ i ] );
  14331. }
  14332. }
  14333. // Copy the events from the original to the clone
  14334. if ( dataAndEvents ) {
  14335. if ( deepDataAndEvents ) {
  14336. srcElements = srcElements || getAll( elem );
  14337. destElements = destElements || getAll( clone );
  14338. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  14339. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  14340. }
  14341. } else {
  14342. cloneCopyEvent( elem, clone );
  14343. }
  14344. }
  14345. // Preserve script evaluation history
  14346. destElements = getAll( clone, "script" );
  14347. if ( destElements.length > 0 ) {
  14348. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  14349. }
  14350. // Return the cloned set
  14351. return clone;
  14352. },
  14353. cleanData: function( elems ) {
  14354. var data, elem, type,
  14355. special = jQuery.event.special,
  14356. i = 0;
  14357. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  14358. if ( acceptData( elem ) ) {
  14359. if ( ( data = elem[ dataPriv.expando ] ) ) {
  14360. if ( data.events ) {
  14361. for ( type in data.events ) {
  14362. if ( special[ type ] ) {
  14363. jQuery.event.remove( elem, type );
  14364. // This is a shortcut to avoid jQuery.event.remove's overhead
  14365. } else {
  14366. jQuery.removeEvent( elem, type, data.handle );
  14367. }
  14368. }
  14369. }
  14370. // Support: Chrome <=35 - 45+
  14371. // Assign undefined instead of using delete, see Data#remove
  14372. elem[ dataPriv.expando ] = undefined;
  14373. }
  14374. if ( elem[ dataUser.expando ] ) {
  14375. // Support: Chrome <=35 - 45+
  14376. // Assign undefined instead of using delete, see Data#remove
  14377. elem[ dataUser.expando ] = undefined;
  14378. }
  14379. }
  14380. }
  14381. }
  14382. } );
  14383. jQuery.fn.extend( {
  14384. detach: function( selector ) {
  14385. return remove( this, selector, true );
  14386. },
  14387. remove: function( selector ) {
  14388. return remove( this, selector );
  14389. },
  14390. text: function( value ) {
  14391. return access( this, function( value ) {
  14392. return value === undefined ?
  14393. jQuery.text( this ) :
  14394. this.empty().each( function() {
  14395. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14396. this.textContent = value;
  14397. }
  14398. } );
  14399. }, null, value, arguments.length );
  14400. },
  14401. append: function() {
  14402. return domManip( this, arguments, function( elem ) {
  14403. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14404. var target = manipulationTarget( this, elem );
  14405. target.appendChild( elem );
  14406. }
  14407. } );
  14408. },
  14409. prepend: function() {
  14410. return domManip( this, arguments, function( elem ) {
  14411. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  14412. var target = manipulationTarget( this, elem );
  14413. target.insertBefore( elem, target.firstChild );
  14414. }
  14415. } );
  14416. },
  14417. before: function() {
  14418. return domManip( this, arguments, function( elem ) {
  14419. if ( this.parentNode ) {
  14420. this.parentNode.insertBefore( elem, this );
  14421. }
  14422. } );
  14423. },
  14424. after: function() {
  14425. return domManip( this, arguments, function( elem ) {
  14426. if ( this.parentNode ) {
  14427. this.parentNode.insertBefore( elem, this.nextSibling );
  14428. }
  14429. } );
  14430. },
  14431. empty: function() {
  14432. var elem,
  14433. i = 0;
  14434. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  14435. if ( elem.nodeType === 1 ) {
  14436. // Prevent memory leaks
  14437. jQuery.cleanData( getAll( elem, false ) );
  14438. // Remove any remaining nodes
  14439. elem.textContent = "";
  14440. }
  14441. }
  14442. return this;
  14443. },
  14444. clone: function( dataAndEvents, deepDataAndEvents ) {
  14445. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  14446. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  14447. return this.map( function() {
  14448. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  14449. } );
  14450. },
  14451. html: function( value ) {
  14452. return access( this, function( value ) {
  14453. var elem = this[ 0 ] || {},
  14454. i = 0,
  14455. l = this.length;
  14456. if ( value === undefined && elem.nodeType === 1 ) {
  14457. return elem.innerHTML;
  14458. }
  14459. // See if we can take a shortcut and just use innerHTML
  14460. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  14461. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  14462. value = jQuery.htmlPrefilter( value );
  14463. try {
  14464. for ( ; i < l; i++ ) {
  14465. elem = this[ i ] || {};
  14466. // Remove element nodes and prevent memory leaks
  14467. if ( elem.nodeType === 1 ) {
  14468. jQuery.cleanData( getAll( elem, false ) );
  14469. elem.innerHTML = value;
  14470. }
  14471. }
  14472. elem = 0;
  14473. // If using innerHTML throws an exception, use the fallback method
  14474. } catch ( e ) {}
  14475. }
  14476. if ( elem ) {
  14477. this.empty().append( value );
  14478. }
  14479. }, null, value, arguments.length );
  14480. },
  14481. replaceWith: function() {
  14482. var ignored = [];
  14483. // Make the changes, replacing each non-ignored context element with the new content
  14484. return domManip( this, arguments, function( elem ) {
  14485. var parent = this.parentNode;
  14486. if ( jQuery.inArray( this, ignored ) < 0 ) {
  14487. jQuery.cleanData( getAll( this ) );
  14488. if ( parent ) {
  14489. parent.replaceChild( elem, this );
  14490. }
  14491. }
  14492. // Force callback invocation
  14493. }, ignored );
  14494. }
  14495. } );
  14496. jQuery.each( {
  14497. appendTo: "append",
  14498. prependTo: "prepend",
  14499. insertBefore: "before",
  14500. insertAfter: "after",
  14501. replaceAll: "replaceWith"
  14502. }, function( name, original ) {
  14503. jQuery.fn[ name ] = function( selector ) {
  14504. var elems,
  14505. ret = [],
  14506. insert = jQuery( selector ),
  14507. last = insert.length - 1,
  14508. i = 0;
  14509. for ( ; i <= last; i++ ) {
  14510. elems = i === last ? this : this.clone( true );
  14511. jQuery( insert[ i ] )[ original ]( elems );
  14512. // Support: Android <=4.0 only, PhantomJS 1 only
  14513. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  14514. push.apply( ret, elems.get() );
  14515. }
  14516. return this.pushStack( ret );
  14517. };
  14518. } );
  14519. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  14520. var getStyles = function( elem ) {
  14521. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  14522. // IE throws on elements created in popups
  14523. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  14524. var view = elem.ownerDocument.defaultView;
  14525. if ( !view || !view.opener ) {
  14526. view = window;
  14527. }
  14528. return view.getComputedStyle( elem );
  14529. };
  14530. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  14531. ( function() {
  14532. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  14533. // so they're executed at the same time to save the second computation.
  14534. function computeStyleTests() {
  14535. // This is a singleton, we need to execute it only once
  14536. if ( !div ) {
  14537. return;
  14538. }
  14539. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  14540. "margin-top:1px;padding:0;border:0";
  14541. div.style.cssText =
  14542. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  14543. "margin:auto;border:1px;padding:1px;" +
  14544. "width:60%;top:1%";
  14545. documentElement.appendChild( container ).appendChild( div );
  14546. var divStyle = window.getComputedStyle( div );
  14547. pixelPositionVal = divStyle.top !== "1%";
  14548. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  14549. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  14550. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  14551. // Some styles come back with percentage values, even though they shouldn't
  14552. div.style.right = "60%";
  14553. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  14554. // Support: IE 9 - 11 only
  14555. // Detect misreporting of content dimensions for box-sizing:border-box elements
  14556. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  14557. // Support: IE 9 only
  14558. // Detect overflow:scroll screwiness (gh-3699)
  14559. // Support: Chrome <=64
  14560. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  14561. div.style.position = "absolute";
  14562. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  14563. documentElement.removeChild( container );
  14564. // Nullify the div so it wouldn't be stored in the memory and
  14565. // it will also be a sign that checks already performed
  14566. div = null;
  14567. }
  14568. function roundPixelMeasures( measure ) {
  14569. return Math.round( parseFloat( measure ) );
  14570. }
  14571. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  14572. reliableMarginLeftVal,
  14573. container = document.createElement( "div" ),
  14574. div = document.createElement( "div" );
  14575. // Finish early in limited (non-browser) environments
  14576. if ( !div.style ) {
  14577. return;
  14578. }
  14579. // Support: IE <=9 - 11 only
  14580. // Style of cloned element affects source element cloned (#8908)
  14581. div.style.backgroundClip = "content-box";
  14582. div.cloneNode( true ).style.backgroundClip = "";
  14583. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  14584. jQuery.extend( support, {
  14585. boxSizingReliable: function() {
  14586. computeStyleTests();
  14587. return boxSizingReliableVal;
  14588. },
  14589. pixelBoxStyles: function() {
  14590. computeStyleTests();
  14591. return pixelBoxStylesVal;
  14592. },
  14593. pixelPosition: function() {
  14594. computeStyleTests();
  14595. return pixelPositionVal;
  14596. },
  14597. reliableMarginLeft: function() {
  14598. computeStyleTests();
  14599. return reliableMarginLeftVal;
  14600. },
  14601. scrollboxSize: function() {
  14602. computeStyleTests();
  14603. return scrollboxSizeVal;
  14604. }
  14605. } );
  14606. } )();
  14607. function curCSS( elem, name, computed ) {
  14608. var width, minWidth, maxWidth, ret,
  14609. // Support: Firefox 51+
  14610. // Retrieving style before computed somehow
  14611. // fixes an issue with getting wrong values
  14612. // on detached elements
  14613. style = elem.style;
  14614. computed = computed || getStyles( elem );
  14615. // getPropertyValue is needed for:
  14616. // .css('filter') (IE 9 only, #12537)
  14617. // .css('--customProperty) (#3144)
  14618. if ( computed ) {
  14619. ret = computed.getPropertyValue( name ) || computed[ name ];
  14620. if ( ret === "" && !isAttached( elem ) ) {
  14621. ret = jQuery.style( elem, name );
  14622. }
  14623. // A tribute to the "awesome hack by Dean Edwards"
  14624. // Android Browser returns percentage for some values,
  14625. // but width seems to be reliably pixels.
  14626. // This is against the CSSOM draft spec:
  14627. // https://drafts.csswg.org/cssom/#resolved-values
  14628. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  14629. // Remember the original values
  14630. width = style.width;
  14631. minWidth = style.minWidth;
  14632. maxWidth = style.maxWidth;
  14633. // Put in the new values to get a computed value out
  14634. style.minWidth = style.maxWidth = style.width = ret;
  14635. ret = computed.width;
  14636. // Revert the changed values
  14637. style.width = width;
  14638. style.minWidth = minWidth;
  14639. style.maxWidth = maxWidth;
  14640. }
  14641. }
  14642. return ret !== undefined ?
  14643. // Support: IE <=9 - 11 only
  14644. // IE returns zIndex value as an integer.
  14645. ret + "" :
  14646. ret;
  14647. }
  14648. function addGetHookIf( conditionFn, hookFn ) {
  14649. // Define the hook, we'll check on the first run if it's really needed.
  14650. return {
  14651. get: function() {
  14652. if ( conditionFn() ) {
  14653. // Hook not needed (or it's not possible to use it due
  14654. // to missing dependency), remove it.
  14655. delete this.get;
  14656. return;
  14657. }
  14658. // Hook needed; redefine it so that the support test is not executed again.
  14659. return ( this.get = hookFn ).apply( this, arguments );
  14660. }
  14661. };
  14662. }
  14663. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  14664. emptyStyle = document.createElement( "div" ).style,
  14665. vendorProps = {};
  14666. // Return a vendor-prefixed property or undefined
  14667. function vendorPropName( name ) {
  14668. // Check for vendor prefixed names
  14669. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  14670. i = cssPrefixes.length;
  14671. while ( i-- ) {
  14672. name = cssPrefixes[ i ] + capName;
  14673. if ( name in emptyStyle ) {
  14674. return name;
  14675. }
  14676. }
  14677. }
  14678. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  14679. function finalPropName( name ) {
  14680. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  14681. if ( final ) {
  14682. return final;
  14683. }
  14684. if ( name in emptyStyle ) {
  14685. return name;
  14686. }
  14687. return vendorProps[ name ] = vendorPropName( name ) || name;
  14688. }
  14689. var
  14690. // Swappable if display is none or starts with table
  14691. // except "table", "table-cell", or "table-caption"
  14692. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  14693. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  14694. rcustomProp = /^--/,
  14695. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  14696. cssNormalTransform = {
  14697. letterSpacing: "0",
  14698. fontWeight: "400"
  14699. };
  14700. function setPositiveNumber( elem, value, subtract ) {
  14701. // Any relative (+/-) values have already been
  14702. // normalized at this point
  14703. var matches = rcssNum.exec( value );
  14704. return matches ?
  14705. // Guard against undefined "subtract", e.g., when used as in cssHooks
  14706. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  14707. value;
  14708. }
  14709. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  14710. var i = dimension === "width" ? 1 : 0,
  14711. extra = 0,
  14712. delta = 0;
  14713. // Adjustment may not be necessary
  14714. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  14715. return 0;
  14716. }
  14717. for ( ; i < 4; i += 2 ) {
  14718. // Both box models exclude margin
  14719. if ( box === "margin" ) {
  14720. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  14721. }
  14722. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  14723. if ( !isBorderBox ) {
  14724. // Add padding
  14725. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14726. // For "border" or "margin", add border
  14727. if ( box !== "padding" ) {
  14728. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14729. // But still keep track of it otherwise
  14730. } else {
  14731. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14732. }
  14733. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  14734. // "padding" or "margin"
  14735. } else {
  14736. // For "content", subtract padding
  14737. if ( box === "content" ) {
  14738. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  14739. }
  14740. // For "content" or "padding", subtract border
  14741. if ( box !== "margin" ) {
  14742. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  14743. }
  14744. }
  14745. }
  14746. // Account for positive content-box scroll gutter when requested by providing computedVal
  14747. if ( !isBorderBox && computedVal >= 0 ) {
  14748. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  14749. // Assuming integer scroll gutter, subtract the rest and round down
  14750. delta += Math.max( 0, Math.ceil(
  14751. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14752. computedVal -
  14753. delta -
  14754. extra -
  14755. 0.5
  14756. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  14757. // Use an explicit zero to avoid NaN (gh-3964)
  14758. ) ) || 0;
  14759. }
  14760. return delta;
  14761. }
  14762. function getWidthOrHeight( elem, dimension, extra ) {
  14763. // Start with computed style
  14764. var styles = getStyles( elem ),
  14765. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  14766. // Fake content-box until we know it's needed to know the true value.
  14767. boxSizingNeeded = !support.boxSizingReliable() || extra,
  14768. isBorderBox = boxSizingNeeded &&
  14769. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14770. valueIsBorderBox = isBorderBox,
  14771. val = curCSS( elem, dimension, styles ),
  14772. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  14773. // Support: Firefox <=54
  14774. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  14775. if ( rnumnonpx.test( val ) ) {
  14776. if ( !extra ) {
  14777. return val;
  14778. }
  14779. val = "auto";
  14780. }
  14781. // Fall back to offsetWidth/offsetHeight when value is "auto"
  14782. // This happens for inline elements with no explicit setting (gh-3571)
  14783. // Support: Android <=4.1 - 4.3 only
  14784. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14785. // Support: IE 9-11 only
  14786. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14787. // We use getClientRects() to check for hidden/disconnected.
  14788. // In those cases, the computed value can be trusted to be border-box
  14789. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14790. val === "auto" ||
  14791. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14792. elem.getClientRects().length ) {
  14793. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14794. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14795. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14796. // retrieved value as a content box dimension.
  14797. valueIsBorderBox = offsetProp in elem;
  14798. if ( valueIsBorderBox ) {
  14799. val = elem[ offsetProp ];
  14800. }
  14801. }
  14802. // Normalize "" and auto
  14803. val = parseFloat( val ) || 0;
  14804. // Adjust for the element's box model
  14805. return ( val +
  14806. boxModelAdjustment(
  14807. elem,
  14808. dimension,
  14809. extra || ( isBorderBox ? "border" : "content" ),
  14810. valueIsBorderBox,
  14811. styles,
  14812. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14813. val
  14814. )
  14815. ) + "px";
  14816. }
  14817. jQuery.extend( {
  14818. // Add in style property hooks for overriding the default
  14819. // behavior of getting and setting a style property
  14820. cssHooks: {
  14821. opacity: {
  14822. get: function( elem, computed ) {
  14823. if ( computed ) {
  14824. // We should always get a number back from opacity
  14825. var ret = curCSS( elem, "opacity" );
  14826. return ret === "" ? "1" : ret;
  14827. }
  14828. }
  14829. }
  14830. },
  14831. // Don't automatically add "px" to these possibly-unitless properties
  14832. cssNumber: {
  14833. "animationIterationCount": true,
  14834. "columnCount": true,
  14835. "fillOpacity": true,
  14836. "flexGrow": true,
  14837. "flexShrink": true,
  14838. "fontWeight": true,
  14839. "gridArea": true,
  14840. "gridColumn": true,
  14841. "gridColumnEnd": true,
  14842. "gridColumnStart": true,
  14843. "gridRow": true,
  14844. "gridRowEnd": true,
  14845. "gridRowStart": true,
  14846. "lineHeight": true,
  14847. "opacity": true,
  14848. "order": true,
  14849. "orphans": true,
  14850. "widows": true,
  14851. "zIndex": true,
  14852. "zoom": true
  14853. },
  14854. // Add in properties whose names you wish to fix before
  14855. // setting or getting the value
  14856. cssProps: {},
  14857. // Get and set the style property on a DOM Node
  14858. style: function( elem, name, value, extra ) {
  14859. // Don't set styles on text and comment nodes
  14860. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14861. return;
  14862. }
  14863. // Make sure that we're working with the right name
  14864. var ret, type, hooks,
  14865. origName = camelCase( name ),
  14866. isCustomProp = rcustomProp.test( name ),
  14867. style = elem.style;
  14868. // Make sure that we're working with the right name. We don't
  14869. // want to query the value if it is a CSS custom property
  14870. // since they are user-defined.
  14871. if ( !isCustomProp ) {
  14872. name = finalPropName( origName );
  14873. }
  14874. // Gets hook for the prefixed version, then unprefixed version
  14875. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14876. // Check if we're setting a value
  14877. if ( value !== undefined ) {
  14878. type = typeof value;
  14879. // Convert "+=" or "-=" to relative numbers (#7345)
  14880. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14881. value = adjustCSS( elem, name, ret );
  14882. // Fixes bug #9237
  14883. type = "number";
  14884. }
  14885. // Make sure that null and NaN values aren't set (#7116)
  14886. if ( value == null || value !== value ) {
  14887. return;
  14888. }
  14889. // If a number was passed in, add the unit (except for certain CSS properties)
  14890. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14891. // "px" to a few hardcoded values.
  14892. if ( type === "number" && !isCustomProp ) {
  14893. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14894. }
  14895. // background-* props affect original clone's values
  14896. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14897. style[ name ] = "inherit";
  14898. }
  14899. // If a hook was provided, use that value, otherwise just set the specified value
  14900. if ( !hooks || !( "set" in hooks ) ||
  14901. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14902. if ( isCustomProp ) {
  14903. style.setProperty( name, value );
  14904. } else {
  14905. style[ name ] = value;
  14906. }
  14907. }
  14908. } else {
  14909. // If a hook was provided get the non-computed value from there
  14910. if ( hooks && "get" in hooks &&
  14911. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14912. return ret;
  14913. }
  14914. // Otherwise just get the value from the style object
  14915. return style[ name ];
  14916. }
  14917. },
  14918. css: function( elem, name, extra, styles ) {
  14919. var val, num, hooks,
  14920. origName = camelCase( name ),
  14921. isCustomProp = rcustomProp.test( name );
  14922. // Make sure that we're working with the right name. We don't
  14923. // want to modify the value if it is a CSS custom property
  14924. // since they are user-defined.
  14925. if ( !isCustomProp ) {
  14926. name = finalPropName( origName );
  14927. }
  14928. // Try prefixed name followed by the unprefixed name
  14929. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14930. // If a hook was provided get the computed value from there
  14931. if ( hooks && "get" in hooks ) {
  14932. val = hooks.get( elem, true, extra );
  14933. }
  14934. // Otherwise, if a way to get the computed value exists, use that
  14935. if ( val === undefined ) {
  14936. val = curCSS( elem, name, styles );
  14937. }
  14938. // Convert "normal" to computed value
  14939. if ( val === "normal" && name in cssNormalTransform ) {
  14940. val = cssNormalTransform[ name ];
  14941. }
  14942. // Make numeric if forced or a qualifier was provided and val looks numeric
  14943. if ( extra === "" || extra ) {
  14944. num = parseFloat( val );
  14945. return extra === true || isFinite( num ) ? num || 0 : val;
  14946. }
  14947. return val;
  14948. }
  14949. } );
  14950. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14951. jQuery.cssHooks[ dimension ] = {
  14952. get: function( elem, computed, extra ) {
  14953. if ( computed ) {
  14954. // Certain elements can have dimension info if we invisibly show them
  14955. // but it must have a current display style that would benefit
  14956. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14957. // Support: Safari 8+
  14958. // Table columns in Safari have non-zero offsetWidth & zero
  14959. // getBoundingClientRect().width unless display is changed.
  14960. // Support: IE <=11 only
  14961. // Running getBoundingClientRect on a disconnected node
  14962. // in IE throws an error.
  14963. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14964. swap( elem, cssShow, function() {
  14965. return getWidthOrHeight( elem, dimension, extra );
  14966. } ) :
  14967. getWidthOrHeight( elem, dimension, extra );
  14968. }
  14969. },
  14970. set: function( elem, value, extra ) {
  14971. var matches,
  14972. styles = getStyles( elem ),
  14973. // Only read styles.position if the test has a chance to fail
  14974. // to avoid forcing a reflow.
  14975. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14976. styles.position === "absolute",
  14977. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14978. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14979. isBorderBox = boxSizingNeeded &&
  14980. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14981. subtract = extra ?
  14982. boxModelAdjustment(
  14983. elem,
  14984. dimension,
  14985. extra,
  14986. isBorderBox,
  14987. styles
  14988. ) :
  14989. 0;
  14990. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14991. // faking a content-box to get border and padding (gh-3699)
  14992. if ( isBorderBox && scrollboxSizeBuggy ) {
  14993. subtract -= Math.ceil(
  14994. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14995. parseFloat( styles[ dimension ] ) -
  14996. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14997. 0.5
  14998. );
  14999. }
  15000. // Convert to pixels if value adjustment is needed
  15001. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  15002. ( matches[ 3 ] || "px" ) !== "px" ) {
  15003. elem.style[ dimension ] = value;
  15004. value = jQuery.css( elem, dimension );
  15005. }
  15006. return setPositiveNumber( elem, value, subtract );
  15007. }
  15008. };
  15009. } );
  15010. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  15011. function( elem, computed ) {
  15012. if ( computed ) {
  15013. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  15014. elem.getBoundingClientRect().left -
  15015. swap( elem, { marginLeft: 0 }, function() {
  15016. return elem.getBoundingClientRect().left;
  15017. } )
  15018. ) + "px";
  15019. }
  15020. }
  15021. );
  15022. // These hooks are used by animate to expand properties
  15023. jQuery.each( {
  15024. margin: "",
  15025. padding: "",
  15026. border: "Width"
  15027. }, function( prefix, suffix ) {
  15028. jQuery.cssHooks[ prefix + suffix ] = {
  15029. expand: function( value ) {
  15030. var i = 0,
  15031. expanded = {},
  15032. // Assumes a single number if not a string
  15033. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  15034. for ( ; i < 4; i++ ) {
  15035. expanded[ prefix + cssExpand[ i ] + suffix ] =
  15036. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  15037. }
  15038. return expanded;
  15039. }
  15040. };
  15041. if ( prefix !== "margin" ) {
  15042. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  15043. }
  15044. } );
  15045. jQuery.fn.extend( {
  15046. css: function( name, value ) {
  15047. return access( this, function( elem, name, value ) {
  15048. var styles, len,
  15049. map = {},
  15050. i = 0;
  15051. if ( Array.isArray( name ) ) {
  15052. styles = getStyles( elem );
  15053. len = name.length;
  15054. for ( ; i < len; i++ ) {
  15055. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  15056. }
  15057. return map;
  15058. }
  15059. return value !== undefined ?
  15060. jQuery.style( elem, name, value ) :
  15061. jQuery.css( elem, name );
  15062. }, name, value, arguments.length > 1 );
  15063. }
  15064. } );
  15065. function Tween( elem, options, prop, end, easing ) {
  15066. return new Tween.prototype.init( elem, options, prop, end, easing );
  15067. }
  15068. jQuery.Tween = Tween;
  15069. Tween.prototype = {
  15070. constructor: Tween,
  15071. init: function( elem, options, prop, end, easing, unit ) {
  15072. this.elem = elem;
  15073. this.prop = prop;
  15074. this.easing = easing || jQuery.easing._default;
  15075. this.options = options;
  15076. this.start = this.now = this.cur();
  15077. this.end = end;
  15078. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  15079. },
  15080. cur: function() {
  15081. var hooks = Tween.propHooks[ this.prop ];
  15082. return hooks && hooks.get ?
  15083. hooks.get( this ) :
  15084. Tween.propHooks._default.get( this );
  15085. },
  15086. run: function( percent ) {
  15087. var eased,
  15088. hooks = Tween.propHooks[ this.prop ];
  15089. if ( this.options.duration ) {
  15090. this.pos = eased = jQuery.easing[ this.easing ](
  15091. percent, this.options.duration * percent, 0, 1, this.options.duration
  15092. );
  15093. } else {
  15094. this.pos = eased = percent;
  15095. }
  15096. this.now = ( this.end - this.start ) * eased + this.start;
  15097. if ( this.options.step ) {
  15098. this.options.step.call( this.elem, this.now, this );
  15099. }
  15100. if ( hooks && hooks.set ) {
  15101. hooks.set( this );
  15102. } else {
  15103. Tween.propHooks._default.set( this );
  15104. }
  15105. return this;
  15106. }
  15107. };
  15108. Tween.prototype.init.prototype = Tween.prototype;
  15109. Tween.propHooks = {
  15110. _default: {
  15111. get: function( tween ) {
  15112. var result;
  15113. // Use a property on the element directly when it is not a DOM element,
  15114. // or when there is no matching style property that exists.
  15115. if ( tween.elem.nodeType !== 1 ||
  15116. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  15117. return tween.elem[ tween.prop ];
  15118. }
  15119. // Passing an empty string as a 3rd parameter to .css will automatically
  15120. // attempt a parseFloat and fallback to a string if the parse fails.
  15121. // Simple values such as "10px" are parsed to Float;
  15122. // complex values such as "rotate(1rad)" are returned as-is.
  15123. result = jQuery.css( tween.elem, tween.prop, "" );
  15124. // Empty strings, null, undefined and "auto" are converted to 0.
  15125. return !result || result === "auto" ? 0 : result;
  15126. },
  15127. set: function( tween ) {
  15128. // Use step hook for back compat.
  15129. // Use cssHook if its there.
  15130. // Use .style if available and use plain properties where available.
  15131. if ( jQuery.fx.step[ tween.prop ] ) {
  15132. jQuery.fx.step[ tween.prop ]( tween );
  15133. } else if ( tween.elem.nodeType === 1 && (
  15134. jQuery.cssHooks[ tween.prop ] ||
  15135. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  15136. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  15137. } else {
  15138. tween.elem[ tween.prop ] = tween.now;
  15139. }
  15140. }
  15141. }
  15142. };
  15143. // Support: IE <=9 only
  15144. // Panic based approach to setting things on disconnected nodes
  15145. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  15146. set: function( tween ) {
  15147. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  15148. tween.elem[ tween.prop ] = tween.now;
  15149. }
  15150. }
  15151. };
  15152. jQuery.easing = {
  15153. linear: function( p ) {
  15154. return p;
  15155. },
  15156. swing: function( p ) {
  15157. return 0.5 - Math.cos( p * Math.PI ) / 2;
  15158. },
  15159. _default: "swing"
  15160. };
  15161. jQuery.fx = Tween.prototype.init;
  15162. // Back compat <1.8 extension point
  15163. jQuery.fx.step = {};
  15164. var
  15165. fxNow, inProgress,
  15166. rfxtypes = /^(?:toggle|show|hide)$/,
  15167. rrun = /queueHooks$/;
  15168. function schedule() {
  15169. if ( inProgress ) {
  15170. if ( document.hidden === false && window.requestAnimationFrame ) {
  15171. window.requestAnimationFrame( schedule );
  15172. } else {
  15173. window.setTimeout( schedule, jQuery.fx.interval );
  15174. }
  15175. jQuery.fx.tick();
  15176. }
  15177. }
  15178. // Animations created synchronously will run synchronously
  15179. function createFxNow() {
  15180. window.setTimeout( function() {
  15181. fxNow = undefined;
  15182. } );
  15183. return ( fxNow = Date.now() );
  15184. }
  15185. // Generate parameters to create a standard animation
  15186. function genFx( type, includeWidth ) {
  15187. var which,
  15188. i = 0,
  15189. attrs = { height: type };
  15190. // If we include width, step value is 1 to do all cssExpand values,
  15191. // otherwise step value is 2 to skip over Left and Right
  15192. includeWidth = includeWidth ? 1 : 0;
  15193. for ( ; i < 4; i += 2 - includeWidth ) {
  15194. which = cssExpand[ i ];
  15195. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  15196. }
  15197. if ( includeWidth ) {
  15198. attrs.opacity = attrs.width = type;
  15199. }
  15200. return attrs;
  15201. }
  15202. function createTween( value, prop, animation ) {
  15203. var tween,
  15204. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  15205. index = 0,
  15206. length = collection.length;
  15207. for ( ; index < length; index++ ) {
  15208. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  15209. // We're done with this property
  15210. return tween;
  15211. }
  15212. }
  15213. }
  15214. function defaultPrefilter( elem, props, opts ) {
  15215. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  15216. isBox = "width" in props || "height" in props,
  15217. anim = this,
  15218. orig = {},
  15219. style = elem.style,
  15220. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  15221. dataShow = dataPriv.get( elem, "fxshow" );
  15222. // Queue-skipping animations hijack the fx hooks
  15223. if ( !opts.queue ) {
  15224. hooks = jQuery._queueHooks( elem, "fx" );
  15225. if ( hooks.unqueued == null ) {
  15226. hooks.unqueued = 0;
  15227. oldfire = hooks.empty.fire;
  15228. hooks.empty.fire = function() {
  15229. if ( !hooks.unqueued ) {
  15230. oldfire();
  15231. }
  15232. };
  15233. }
  15234. hooks.unqueued++;
  15235. anim.always( function() {
  15236. // Ensure the complete handler is called before this completes
  15237. anim.always( function() {
  15238. hooks.unqueued--;
  15239. if ( !jQuery.queue( elem, "fx" ).length ) {
  15240. hooks.empty.fire();
  15241. }
  15242. } );
  15243. } );
  15244. }
  15245. // Detect show/hide animations
  15246. for ( prop in props ) {
  15247. value = props[ prop ];
  15248. if ( rfxtypes.test( value ) ) {
  15249. delete props[ prop ];
  15250. toggle = toggle || value === "toggle";
  15251. if ( value === ( hidden ? "hide" : "show" ) ) {
  15252. // Pretend to be hidden if this is a "show" and
  15253. // there is still data from a stopped show/hide
  15254. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  15255. hidden = true;
  15256. // Ignore all other no-op show/hide data
  15257. } else {
  15258. continue;
  15259. }
  15260. }
  15261. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  15262. }
  15263. }
  15264. // Bail out if this is a no-op like .hide().hide()
  15265. propTween = !jQuery.isEmptyObject( props );
  15266. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  15267. return;
  15268. }
  15269. // Restrict "overflow" and "display" styles during box animations
  15270. if ( isBox && elem.nodeType === 1 ) {
  15271. // Support: IE <=9 - 11, Edge 12 - 15
  15272. // Record all 3 overflow attributes because IE does not infer the shorthand
  15273. // from identically-valued overflowX and overflowY and Edge just mirrors
  15274. // the overflowX value there.
  15275. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  15276. // Identify a display type, preferring old show/hide data over the CSS cascade
  15277. restoreDisplay = dataShow && dataShow.display;
  15278. if ( restoreDisplay == null ) {
  15279. restoreDisplay = dataPriv.get( elem, "display" );
  15280. }
  15281. display = jQuery.css( elem, "display" );
  15282. if ( display === "none" ) {
  15283. if ( restoreDisplay ) {
  15284. display = restoreDisplay;
  15285. } else {
  15286. // Get nonempty value(s) by temporarily forcing visibility
  15287. showHide( [ elem ], true );
  15288. restoreDisplay = elem.style.display || restoreDisplay;
  15289. display = jQuery.css( elem, "display" );
  15290. showHide( [ elem ] );
  15291. }
  15292. }
  15293. // Animate inline elements as inline-block
  15294. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  15295. if ( jQuery.css( elem, "float" ) === "none" ) {
  15296. // Restore the original display value at the end of pure show/hide animations
  15297. if ( !propTween ) {
  15298. anim.done( function() {
  15299. style.display = restoreDisplay;
  15300. } );
  15301. if ( restoreDisplay == null ) {
  15302. display = style.display;
  15303. restoreDisplay = display === "none" ? "" : display;
  15304. }
  15305. }
  15306. style.display = "inline-block";
  15307. }
  15308. }
  15309. }
  15310. if ( opts.overflow ) {
  15311. style.overflow = "hidden";
  15312. anim.always( function() {
  15313. style.overflow = opts.overflow[ 0 ];
  15314. style.overflowX = opts.overflow[ 1 ];
  15315. style.overflowY = opts.overflow[ 2 ];
  15316. } );
  15317. }
  15318. // Implement show/hide animations
  15319. propTween = false;
  15320. for ( prop in orig ) {
  15321. // General show/hide setup for this element animation
  15322. if ( !propTween ) {
  15323. if ( dataShow ) {
  15324. if ( "hidden" in dataShow ) {
  15325. hidden = dataShow.hidden;
  15326. }
  15327. } else {
  15328. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  15329. }
  15330. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  15331. if ( toggle ) {
  15332. dataShow.hidden = !hidden;
  15333. }
  15334. // Show elements before animating them
  15335. if ( hidden ) {
  15336. showHide( [ elem ], true );
  15337. }
  15338. /* eslint-disable no-loop-func */
  15339. anim.done( function() {
  15340. /* eslint-enable no-loop-func */
  15341. // The final step of a "hide" animation is actually hiding the element
  15342. if ( !hidden ) {
  15343. showHide( [ elem ] );
  15344. }
  15345. dataPriv.remove( elem, "fxshow" );
  15346. for ( prop in orig ) {
  15347. jQuery.style( elem, prop, orig[ prop ] );
  15348. }
  15349. } );
  15350. }
  15351. // Per-property setup
  15352. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  15353. if ( !( prop in dataShow ) ) {
  15354. dataShow[ prop ] = propTween.start;
  15355. if ( hidden ) {
  15356. propTween.end = propTween.start;
  15357. propTween.start = 0;
  15358. }
  15359. }
  15360. }
  15361. }
  15362. function propFilter( props, specialEasing ) {
  15363. var index, name, easing, value, hooks;
  15364. // camelCase, specialEasing and expand cssHook pass
  15365. for ( index in props ) {
  15366. name = camelCase( index );
  15367. easing = specialEasing[ name ];
  15368. value = props[ index ];
  15369. if ( Array.isArray( value ) ) {
  15370. easing = value[ 1 ];
  15371. value = props[ index ] = value[ 0 ];
  15372. }
  15373. if ( index !== name ) {
  15374. props[ name ] = value;
  15375. delete props[ index ];
  15376. }
  15377. hooks = jQuery.cssHooks[ name ];
  15378. if ( hooks && "expand" in hooks ) {
  15379. value = hooks.expand( value );
  15380. delete props[ name ];
  15381. // Not quite $.extend, this won't overwrite existing keys.
  15382. // Reusing 'index' because we have the correct "name"
  15383. for ( index in value ) {
  15384. if ( !( index in props ) ) {
  15385. props[ index ] = value[ index ];
  15386. specialEasing[ index ] = easing;
  15387. }
  15388. }
  15389. } else {
  15390. specialEasing[ name ] = easing;
  15391. }
  15392. }
  15393. }
  15394. function Animation( elem, properties, options ) {
  15395. var result,
  15396. stopped,
  15397. index = 0,
  15398. length = Animation.prefilters.length,
  15399. deferred = jQuery.Deferred().always( function() {
  15400. // Don't match elem in the :animated selector
  15401. delete tick.elem;
  15402. } ),
  15403. tick = function() {
  15404. if ( stopped ) {
  15405. return false;
  15406. }
  15407. var currentTime = fxNow || createFxNow(),
  15408. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  15409. // Support: Android 2.3 only
  15410. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  15411. temp = remaining / animation.duration || 0,
  15412. percent = 1 - temp,
  15413. index = 0,
  15414. length = animation.tweens.length;
  15415. for ( ; index < length; index++ ) {
  15416. animation.tweens[ index ].run( percent );
  15417. }
  15418. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  15419. // If there's more to do, yield
  15420. if ( percent < 1 && length ) {
  15421. return remaining;
  15422. }
  15423. // If this was an empty animation, synthesize a final progress notification
  15424. if ( !length ) {
  15425. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  15426. }
  15427. // Resolve the animation and report its conclusion
  15428. deferred.resolveWith( elem, [ animation ] );
  15429. return false;
  15430. },
  15431. animation = deferred.promise( {
  15432. elem: elem,
  15433. props: jQuery.extend( {}, properties ),
  15434. opts: jQuery.extend( true, {
  15435. specialEasing: {},
  15436. easing: jQuery.easing._default
  15437. }, options ),
  15438. originalProperties: properties,
  15439. originalOptions: options,
  15440. startTime: fxNow || createFxNow(),
  15441. duration: options.duration,
  15442. tweens: [],
  15443. createTween: function( prop, end ) {
  15444. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  15445. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  15446. animation.tweens.push( tween );
  15447. return tween;
  15448. },
  15449. stop: function( gotoEnd ) {
  15450. var index = 0,
  15451. // If we are going to the end, we want to run all the tweens
  15452. // otherwise we skip this part
  15453. length = gotoEnd ? animation.tweens.length : 0;
  15454. if ( stopped ) {
  15455. return this;
  15456. }
  15457. stopped = true;
  15458. for ( ; index < length; index++ ) {
  15459. animation.tweens[ index ].run( 1 );
  15460. }
  15461. // Resolve when we played the last frame; otherwise, reject
  15462. if ( gotoEnd ) {
  15463. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  15464. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  15465. } else {
  15466. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  15467. }
  15468. return this;
  15469. }
  15470. } ),
  15471. props = animation.props;
  15472. propFilter( props, animation.opts.specialEasing );
  15473. for ( ; index < length; index++ ) {
  15474. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  15475. if ( result ) {
  15476. if ( isFunction( result.stop ) ) {
  15477. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  15478. result.stop.bind( result );
  15479. }
  15480. return result;
  15481. }
  15482. }
  15483. jQuery.map( props, createTween, animation );
  15484. if ( isFunction( animation.opts.start ) ) {
  15485. animation.opts.start.call( elem, animation );
  15486. }
  15487. // Attach callbacks from options
  15488. animation
  15489. .progress( animation.opts.progress )
  15490. .done( animation.opts.done, animation.opts.complete )
  15491. .fail( animation.opts.fail )
  15492. .always( animation.opts.always );
  15493. jQuery.fx.timer(
  15494. jQuery.extend( tick, {
  15495. elem: elem,
  15496. anim: animation,
  15497. queue: animation.opts.queue
  15498. } )
  15499. );
  15500. return animation;
  15501. }
  15502. jQuery.Animation = jQuery.extend( Animation, {
  15503. tweeners: {
  15504. "*": [ function( prop, value ) {
  15505. var tween = this.createTween( prop, value );
  15506. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  15507. return tween;
  15508. } ]
  15509. },
  15510. tweener: function( props, callback ) {
  15511. if ( isFunction( props ) ) {
  15512. callback = props;
  15513. props = [ "*" ];
  15514. } else {
  15515. props = props.match( rnothtmlwhite );
  15516. }
  15517. var prop,
  15518. index = 0,
  15519. length = props.length;
  15520. for ( ; index < length; index++ ) {
  15521. prop = props[ index ];
  15522. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  15523. Animation.tweeners[ prop ].unshift( callback );
  15524. }
  15525. },
  15526. prefilters: [ defaultPrefilter ],
  15527. prefilter: function( callback, prepend ) {
  15528. if ( prepend ) {
  15529. Animation.prefilters.unshift( callback );
  15530. } else {
  15531. Animation.prefilters.push( callback );
  15532. }
  15533. }
  15534. } );
  15535. jQuery.speed = function( speed, easing, fn ) {
  15536. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  15537. complete: fn || !fn && easing ||
  15538. isFunction( speed ) && speed,
  15539. duration: speed,
  15540. easing: fn && easing || easing && !isFunction( easing ) && easing
  15541. };
  15542. // Go to the end state if fx are off
  15543. if ( jQuery.fx.off ) {
  15544. opt.duration = 0;
  15545. } else {
  15546. if ( typeof opt.duration !== "number" ) {
  15547. if ( opt.duration in jQuery.fx.speeds ) {
  15548. opt.duration = jQuery.fx.speeds[ opt.duration ];
  15549. } else {
  15550. opt.duration = jQuery.fx.speeds._default;
  15551. }
  15552. }
  15553. }
  15554. // Normalize opt.queue - true/undefined/null -> "fx"
  15555. if ( opt.queue == null || opt.queue === true ) {
  15556. opt.queue = "fx";
  15557. }
  15558. // Queueing
  15559. opt.old = opt.complete;
  15560. opt.complete = function() {
  15561. if ( isFunction( opt.old ) ) {
  15562. opt.old.call( this );
  15563. }
  15564. if ( opt.queue ) {
  15565. jQuery.dequeue( this, opt.queue );
  15566. }
  15567. };
  15568. return opt;
  15569. };
  15570. jQuery.fn.extend( {
  15571. fadeTo: function( speed, to, easing, callback ) {
  15572. // Show any hidden elements after setting opacity to 0
  15573. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  15574. // Animate to the value specified
  15575. .end().animate( { opacity: to }, speed, easing, callback );
  15576. },
  15577. animate: function( prop, speed, easing, callback ) {
  15578. var empty = jQuery.isEmptyObject( prop ),
  15579. optall = jQuery.speed( speed, easing, callback ),
  15580. doAnimation = function() {
  15581. // Operate on a copy of prop so per-property easing won't be lost
  15582. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  15583. // Empty animations, or finishing resolves immediately
  15584. if ( empty || dataPriv.get( this, "finish" ) ) {
  15585. anim.stop( true );
  15586. }
  15587. };
  15588. doAnimation.finish = doAnimation;
  15589. return empty || optall.queue === false ?
  15590. this.each( doAnimation ) :
  15591. this.queue( optall.queue, doAnimation );
  15592. },
  15593. stop: function( type, clearQueue, gotoEnd ) {
  15594. var stopQueue = function( hooks ) {
  15595. var stop = hooks.stop;
  15596. delete hooks.stop;
  15597. stop( gotoEnd );
  15598. };
  15599. if ( typeof type !== "string" ) {
  15600. gotoEnd = clearQueue;
  15601. clearQueue = type;
  15602. type = undefined;
  15603. }
  15604. if ( clearQueue && type !== false ) {
  15605. this.queue( type || "fx", [] );
  15606. }
  15607. return this.each( function() {
  15608. var dequeue = true,
  15609. index = type != null && type + "queueHooks",
  15610. timers = jQuery.timers,
  15611. data = dataPriv.get( this );
  15612. if ( index ) {
  15613. if ( data[ index ] && data[ index ].stop ) {
  15614. stopQueue( data[ index ] );
  15615. }
  15616. } else {
  15617. for ( index in data ) {
  15618. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  15619. stopQueue( data[ index ] );
  15620. }
  15621. }
  15622. }
  15623. for ( index = timers.length; index--; ) {
  15624. if ( timers[ index ].elem === this &&
  15625. ( type == null || timers[ index ].queue === type ) ) {
  15626. timers[ index ].anim.stop( gotoEnd );
  15627. dequeue = false;
  15628. timers.splice( index, 1 );
  15629. }
  15630. }
  15631. // Start the next in the queue if the last step wasn't forced.
  15632. // Timers currently will call their complete callbacks, which
  15633. // will dequeue but only if they were gotoEnd.
  15634. if ( dequeue || !gotoEnd ) {
  15635. jQuery.dequeue( this, type );
  15636. }
  15637. } );
  15638. },
  15639. finish: function( type ) {
  15640. if ( type !== false ) {
  15641. type = type || "fx";
  15642. }
  15643. return this.each( function() {
  15644. var index,
  15645. data = dataPriv.get( this ),
  15646. queue = data[ type + "queue" ],
  15647. hooks = data[ type + "queueHooks" ],
  15648. timers = jQuery.timers,
  15649. length = queue ? queue.length : 0;
  15650. // Enable finishing flag on private data
  15651. data.finish = true;
  15652. // Empty the queue first
  15653. jQuery.queue( this, type, [] );
  15654. if ( hooks && hooks.stop ) {
  15655. hooks.stop.call( this, true );
  15656. }
  15657. // Look for any active animations, and finish them
  15658. for ( index = timers.length; index--; ) {
  15659. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  15660. timers[ index ].anim.stop( true );
  15661. timers.splice( index, 1 );
  15662. }
  15663. }
  15664. // Look for any animations in the old queue and finish them
  15665. for ( index = 0; index < length; index++ ) {
  15666. if ( queue[ index ] && queue[ index ].finish ) {
  15667. queue[ index ].finish.call( this );
  15668. }
  15669. }
  15670. // Turn off finishing flag
  15671. delete data.finish;
  15672. } );
  15673. }
  15674. } );
  15675. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  15676. var cssFn = jQuery.fn[ name ];
  15677. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15678. return speed == null || typeof speed === "boolean" ?
  15679. cssFn.apply( this, arguments ) :
  15680. this.animate( genFx( name, true ), speed, easing, callback );
  15681. };
  15682. } );
  15683. // Generate shortcuts for custom animations
  15684. jQuery.each( {
  15685. slideDown: genFx( "show" ),
  15686. slideUp: genFx( "hide" ),
  15687. slideToggle: genFx( "toggle" ),
  15688. fadeIn: { opacity: "show" },
  15689. fadeOut: { opacity: "hide" },
  15690. fadeToggle: { opacity: "toggle" }
  15691. }, function( name, props ) {
  15692. jQuery.fn[ name ] = function( speed, easing, callback ) {
  15693. return this.animate( props, speed, easing, callback );
  15694. };
  15695. } );
  15696. jQuery.timers = [];
  15697. jQuery.fx.tick = function() {
  15698. var timer,
  15699. i = 0,
  15700. timers = jQuery.timers;
  15701. fxNow = Date.now();
  15702. for ( ; i < timers.length; i++ ) {
  15703. timer = timers[ i ];
  15704. // Run the timer and safely remove it when done (allowing for external removal)
  15705. if ( !timer() && timers[ i ] === timer ) {
  15706. timers.splice( i--, 1 );
  15707. }
  15708. }
  15709. if ( !timers.length ) {
  15710. jQuery.fx.stop();
  15711. }
  15712. fxNow = undefined;
  15713. };
  15714. jQuery.fx.timer = function( timer ) {
  15715. jQuery.timers.push( timer );
  15716. jQuery.fx.start();
  15717. };
  15718. jQuery.fx.interval = 13;
  15719. jQuery.fx.start = function() {
  15720. if ( inProgress ) {
  15721. return;
  15722. }
  15723. inProgress = true;
  15724. schedule();
  15725. };
  15726. jQuery.fx.stop = function() {
  15727. inProgress = null;
  15728. };
  15729. jQuery.fx.speeds = {
  15730. slow: 600,
  15731. fast: 200,
  15732. // Default speed
  15733. _default: 400
  15734. };
  15735. // Based off of the plugin by Clint Helfers, with permission.
  15736. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  15737. jQuery.fn.delay = function( time, type ) {
  15738. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  15739. type = type || "fx";
  15740. return this.queue( type, function( next, hooks ) {
  15741. var timeout = window.setTimeout( next, time );
  15742. hooks.stop = function() {
  15743. window.clearTimeout( timeout );
  15744. };
  15745. } );
  15746. };
  15747. ( function() {
  15748. var input = document.createElement( "input" ),
  15749. select = document.createElement( "select" ),
  15750. opt = select.appendChild( document.createElement( "option" ) );
  15751. input.type = "checkbox";
  15752. // Support: Android <=4.3 only
  15753. // Default value for a checkbox should be "on"
  15754. support.checkOn = input.value !== "";
  15755. // Support: IE <=11 only
  15756. // Must access selectedIndex to make default options select
  15757. support.optSelected = opt.selected;
  15758. // Support: IE <=11 only
  15759. // An input loses its value after becoming a radio
  15760. input = document.createElement( "input" );
  15761. input.value = "t";
  15762. input.type = "radio";
  15763. support.radioValue = input.value === "t";
  15764. } )();
  15765. var boolHook,
  15766. attrHandle = jQuery.expr.attrHandle;
  15767. jQuery.fn.extend( {
  15768. attr: function( name, value ) {
  15769. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  15770. },
  15771. removeAttr: function( name ) {
  15772. return this.each( function() {
  15773. jQuery.removeAttr( this, name );
  15774. } );
  15775. }
  15776. } );
  15777. jQuery.extend( {
  15778. attr: function( elem, name, value ) {
  15779. var ret, hooks,
  15780. nType = elem.nodeType;
  15781. // Don't get/set attributes on text, comment and attribute nodes
  15782. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15783. return;
  15784. }
  15785. // Fallback to prop when attributes are not supported
  15786. if ( typeof elem.getAttribute === "undefined" ) {
  15787. return jQuery.prop( elem, name, value );
  15788. }
  15789. // Attribute hooks are determined by the lowercase version
  15790. // Grab necessary hook if one is defined
  15791. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15792. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15793. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15794. }
  15795. if ( value !== undefined ) {
  15796. if ( value === null ) {
  15797. jQuery.removeAttr( elem, name );
  15798. return;
  15799. }
  15800. if ( hooks && "set" in hooks &&
  15801. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15802. return ret;
  15803. }
  15804. elem.setAttribute( name, value + "" );
  15805. return value;
  15806. }
  15807. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15808. return ret;
  15809. }
  15810. ret = jQuery.find.attr( elem, name );
  15811. // Non-existent attributes return null, we normalize to undefined
  15812. return ret == null ? undefined : ret;
  15813. },
  15814. attrHooks: {
  15815. type: {
  15816. set: function( elem, value ) {
  15817. if ( !support.radioValue && value === "radio" &&
  15818. nodeName( elem, "input" ) ) {
  15819. var val = elem.value;
  15820. elem.setAttribute( "type", value );
  15821. if ( val ) {
  15822. elem.value = val;
  15823. }
  15824. return value;
  15825. }
  15826. }
  15827. }
  15828. },
  15829. removeAttr: function( elem, value ) {
  15830. var name,
  15831. i = 0,
  15832. // Attribute names can contain non-HTML whitespace characters
  15833. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15834. attrNames = value && value.match( rnothtmlwhite );
  15835. if ( attrNames && elem.nodeType === 1 ) {
  15836. while ( ( name = attrNames[ i++ ] ) ) {
  15837. elem.removeAttribute( name );
  15838. }
  15839. }
  15840. }
  15841. } );
  15842. // Hooks for boolean attributes
  15843. boolHook = {
  15844. set: function( elem, value, name ) {
  15845. if ( value === false ) {
  15846. // Remove boolean attributes when set to false
  15847. jQuery.removeAttr( elem, name );
  15848. } else {
  15849. elem.setAttribute( name, name );
  15850. }
  15851. return name;
  15852. }
  15853. };
  15854. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15855. var getter = attrHandle[ name ] || jQuery.find.attr;
  15856. attrHandle[ name ] = function( elem, name, isXML ) {
  15857. var ret, handle,
  15858. lowercaseName = name.toLowerCase();
  15859. if ( !isXML ) {
  15860. // Avoid an infinite loop by temporarily removing this function from the getter
  15861. handle = attrHandle[ lowercaseName ];
  15862. attrHandle[ lowercaseName ] = ret;
  15863. ret = getter( elem, name, isXML ) != null ?
  15864. lowercaseName :
  15865. null;
  15866. attrHandle[ lowercaseName ] = handle;
  15867. }
  15868. return ret;
  15869. };
  15870. } );
  15871. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15872. rclickable = /^(?:a|area)$/i;
  15873. jQuery.fn.extend( {
  15874. prop: function( name, value ) {
  15875. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15876. },
  15877. removeProp: function( name ) {
  15878. return this.each( function() {
  15879. delete this[ jQuery.propFix[ name ] || name ];
  15880. } );
  15881. }
  15882. } );
  15883. jQuery.extend( {
  15884. prop: function( elem, name, value ) {
  15885. var ret, hooks,
  15886. nType = elem.nodeType;
  15887. // Don't get/set properties on text, comment and attribute nodes
  15888. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15889. return;
  15890. }
  15891. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15892. // Fix name and attach hooks
  15893. name = jQuery.propFix[ name ] || name;
  15894. hooks = jQuery.propHooks[ name ];
  15895. }
  15896. if ( value !== undefined ) {
  15897. if ( hooks && "set" in hooks &&
  15898. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15899. return ret;
  15900. }
  15901. return ( elem[ name ] = value );
  15902. }
  15903. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15904. return ret;
  15905. }
  15906. return elem[ name ];
  15907. },
  15908. propHooks: {
  15909. tabIndex: {
  15910. get: function( elem ) {
  15911. // Support: IE <=9 - 11 only
  15912. // elem.tabIndex doesn't always return the
  15913. // correct value when it hasn't been explicitly set
  15914. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15915. // Use proper attribute retrieval(#12072)
  15916. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15917. if ( tabindex ) {
  15918. return parseInt( tabindex, 10 );
  15919. }
  15920. if (
  15921. rfocusable.test( elem.nodeName ) ||
  15922. rclickable.test( elem.nodeName ) &&
  15923. elem.href
  15924. ) {
  15925. return 0;
  15926. }
  15927. return -1;
  15928. }
  15929. }
  15930. },
  15931. propFix: {
  15932. "for": "htmlFor",
  15933. "class": "className"
  15934. }
  15935. } );
  15936. // Support: IE <=11 only
  15937. // Accessing the selectedIndex property
  15938. // forces the browser to respect setting selected
  15939. // on the option
  15940. // The getter ensures a default option is selected
  15941. // when in an optgroup
  15942. // eslint rule "no-unused-expressions" is disabled for this code
  15943. // since it considers such accessions noop
  15944. if ( !support.optSelected ) {
  15945. jQuery.propHooks.selected = {
  15946. get: function( elem ) {
  15947. /* eslint no-unused-expressions: "off" */
  15948. var parent = elem.parentNode;
  15949. if ( parent && parent.parentNode ) {
  15950. parent.parentNode.selectedIndex;
  15951. }
  15952. return null;
  15953. },
  15954. set: function( elem ) {
  15955. /* eslint no-unused-expressions: "off" */
  15956. var parent = elem.parentNode;
  15957. if ( parent ) {
  15958. parent.selectedIndex;
  15959. if ( parent.parentNode ) {
  15960. parent.parentNode.selectedIndex;
  15961. }
  15962. }
  15963. }
  15964. };
  15965. }
  15966. jQuery.each( [
  15967. "tabIndex",
  15968. "readOnly",
  15969. "maxLength",
  15970. "cellSpacing",
  15971. "cellPadding",
  15972. "rowSpan",
  15973. "colSpan",
  15974. "useMap",
  15975. "frameBorder",
  15976. "contentEditable"
  15977. ], function() {
  15978. jQuery.propFix[ this.toLowerCase() ] = this;
  15979. } );
  15980. // Strip and collapse whitespace according to HTML spec
  15981. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15982. function stripAndCollapse( value ) {
  15983. var tokens = value.match( rnothtmlwhite ) || [];
  15984. return tokens.join( " " );
  15985. }
  15986. function getClass( elem ) {
  15987. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15988. }
  15989. function classesToArray( value ) {
  15990. if ( Array.isArray( value ) ) {
  15991. return value;
  15992. }
  15993. if ( typeof value === "string" ) {
  15994. return value.match( rnothtmlwhite ) || [];
  15995. }
  15996. return [];
  15997. }
  15998. jQuery.fn.extend( {
  15999. addClass: function( value ) {
  16000. var classes, elem, cur, curValue, clazz, j, finalValue,
  16001. i = 0;
  16002. if ( isFunction( value ) ) {
  16003. return this.each( function( j ) {
  16004. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  16005. } );
  16006. }
  16007. classes = classesToArray( value );
  16008. if ( classes.length ) {
  16009. while ( ( elem = this[ i++ ] ) ) {
  16010. curValue = getClass( elem );
  16011. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  16012. if ( cur ) {
  16013. j = 0;
  16014. while ( ( clazz = classes[ j++ ] ) ) {
  16015. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  16016. cur += clazz + " ";
  16017. }
  16018. }
  16019. // Only assign if different to avoid unneeded rendering.
  16020. finalValue = stripAndCollapse( cur );
  16021. if ( curValue !== finalValue ) {
  16022. elem.setAttribute( "class", finalValue );
  16023. }
  16024. }
  16025. }
  16026. }
  16027. return this;
  16028. },
  16029. removeClass: function( value ) {
  16030. var classes, elem, cur, curValue, clazz, j, finalValue,
  16031. i = 0;
  16032. if ( isFunction( value ) ) {
  16033. return this.each( function( j ) {
  16034. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  16035. } );
  16036. }
  16037. if ( !arguments.length ) {
  16038. return this.attr( "class", "" );
  16039. }
  16040. classes = classesToArray( value );
  16041. if ( classes.length ) {
  16042. while ( ( elem = this[ i++ ] ) ) {
  16043. curValue = getClass( elem );
  16044. // This expression is here for better compressibility (see addClass)
  16045. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  16046. if ( cur ) {
  16047. j = 0;
  16048. while ( ( clazz = classes[ j++ ] ) ) {
  16049. // Remove *all* instances
  16050. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  16051. cur = cur.replace( " " + clazz + " ", " " );
  16052. }
  16053. }
  16054. // Only assign if different to avoid unneeded rendering.
  16055. finalValue = stripAndCollapse( cur );
  16056. if ( curValue !== finalValue ) {
  16057. elem.setAttribute( "class", finalValue );
  16058. }
  16059. }
  16060. }
  16061. }
  16062. return this;
  16063. },
  16064. toggleClass: function( value, stateVal ) {
  16065. var type = typeof value,
  16066. isValidValue = type === "string" || Array.isArray( value );
  16067. if ( typeof stateVal === "boolean" && isValidValue ) {
  16068. return stateVal ? this.addClass( value ) : this.removeClass( value );
  16069. }
  16070. if ( isFunction( value ) ) {
  16071. return this.each( function( i ) {
  16072. jQuery( this ).toggleClass(
  16073. value.call( this, i, getClass( this ), stateVal ),
  16074. stateVal
  16075. );
  16076. } );
  16077. }
  16078. return this.each( function() {
  16079. var className, i, self, classNames;
  16080. if ( isValidValue ) {
  16081. // Toggle individual class names
  16082. i = 0;
  16083. self = jQuery( this );
  16084. classNames = classesToArray( value );
  16085. while ( ( className = classNames[ i++ ] ) ) {
  16086. // Check each className given, space separated list
  16087. if ( self.hasClass( className ) ) {
  16088. self.removeClass( className );
  16089. } else {
  16090. self.addClass( className );
  16091. }
  16092. }
  16093. // Toggle whole class name
  16094. } else if ( value === undefined || type === "boolean" ) {
  16095. className = getClass( this );
  16096. if ( className ) {
  16097. // Store className if set
  16098. dataPriv.set( this, "__className__", className );
  16099. }
  16100. // If the element has a class name or if we're passed `false`,
  16101. // then remove the whole classname (if there was one, the above saved it).
  16102. // Otherwise bring back whatever was previously saved (if anything),
  16103. // falling back to the empty string if nothing was stored.
  16104. if ( this.setAttribute ) {
  16105. this.setAttribute( "class",
  16106. className || value === false ?
  16107. "" :
  16108. dataPriv.get( this, "__className__" ) || ""
  16109. );
  16110. }
  16111. }
  16112. } );
  16113. },
  16114. hasClass: function( selector ) {
  16115. var className, elem,
  16116. i = 0;
  16117. className = " " + selector + " ";
  16118. while ( ( elem = this[ i++ ] ) ) {
  16119. if ( elem.nodeType === 1 &&
  16120. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  16121. return true;
  16122. }
  16123. }
  16124. return false;
  16125. }
  16126. } );
  16127. var rreturn = /\r/g;
  16128. jQuery.fn.extend( {
  16129. val: function( value ) {
  16130. var hooks, ret, valueIsFunction,
  16131. elem = this[ 0 ];
  16132. if ( !arguments.length ) {
  16133. if ( elem ) {
  16134. hooks = jQuery.valHooks[ elem.type ] ||
  16135. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  16136. if ( hooks &&
  16137. "get" in hooks &&
  16138. ( ret = hooks.get( elem, "value" ) ) !== undefined
  16139. ) {
  16140. return ret;
  16141. }
  16142. ret = elem.value;
  16143. // Handle most common string cases
  16144. if ( typeof ret === "string" ) {
  16145. return ret.replace( rreturn, "" );
  16146. }
  16147. // Handle cases where value is null/undef or number
  16148. return ret == null ? "" : ret;
  16149. }
  16150. return;
  16151. }
  16152. valueIsFunction = isFunction( value );
  16153. return this.each( function( i ) {
  16154. var val;
  16155. if ( this.nodeType !== 1 ) {
  16156. return;
  16157. }
  16158. if ( valueIsFunction ) {
  16159. val = value.call( this, i, jQuery( this ).val() );
  16160. } else {
  16161. val = value;
  16162. }
  16163. // Treat null/undefined as ""; convert numbers to string
  16164. if ( val == null ) {
  16165. val = "";
  16166. } else if ( typeof val === "number" ) {
  16167. val += "";
  16168. } else if ( Array.isArray( val ) ) {
  16169. val = jQuery.map( val, function( value ) {
  16170. return value == null ? "" : value + "";
  16171. } );
  16172. }
  16173. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  16174. // If set returns undefined, fall back to normal setting
  16175. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  16176. this.value = val;
  16177. }
  16178. } );
  16179. }
  16180. } );
  16181. jQuery.extend( {
  16182. valHooks: {
  16183. option: {
  16184. get: function( elem ) {
  16185. var val = jQuery.find.attr( elem, "value" );
  16186. return val != null ?
  16187. val :
  16188. // Support: IE <=10 - 11 only
  16189. // option.text throws exceptions (#14686, #14858)
  16190. // Strip and collapse whitespace
  16191. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  16192. stripAndCollapse( jQuery.text( elem ) );
  16193. }
  16194. },
  16195. select: {
  16196. get: function( elem ) {
  16197. var value, option, i,
  16198. options = elem.options,
  16199. index = elem.selectedIndex,
  16200. one = elem.type === "select-one",
  16201. values = one ? null : [],
  16202. max = one ? index + 1 : options.length;
  16203. if ( index < 0 ) {
  16204. i = max;
  16205. } else {
  16206. i = one ? index : 0;
  16207. }
  16208. // Loop through all the selected options
  16209. for ( ; i < max; i++ ) {
  16210. option = options[ i ];
  16211. // Support: IE <=9 only
  16212. // IE8-9 doesn't update selected after form reset (#2551)
  16213. if ( ( option.selected || i === index ) &&
  16214. // Don't return options that are disabled or in a disabled optgroup
  16215. !option.disabled &&
  16216. ( !option.parentNode.disabled ||
  16217. !nodeName( option.parentNode, "optgroup" ) ) ) {
  16218. // Get the specific value for the option
  16219. value = jQuery( option ).val();
  16220. // We don't need an array for one selects
  16221. if ( one ) {
  16222. return value;
  16223. }
  16224. // Multi-Selects return an array
  16225. values.push( value );
  16226. }
  16227. }
  16228. return values;
  16229. },
  16230. set: function( elem, value ) {
  16231. var optionSet, option,
  16232. options = elem.options,
  16233. values = jQuery.makeArray( value ),
  16234. i = options.length;
  16235. while ( i-- ) {
  16236. option = options[ i ];
  16237. /* eslint-disable no-cond-assign */
  16238. if ( option.selected =
  16239. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  16240. ) {
  16241. optionSet = true;
  16242. }
  16243. /* eslint-enable no-cond-assign */
  16244. }
  16245. // Force browsers to behave consistently when non-matching value is set
  16246. if ( !optionSet ) {
  16247. elem.selectedIndex = -1;
  16248. }
  16249. return values;
  16250. }
  16251. }
  16252. }
  16253. } );
  16254. // Radios and checkboxes getter/setter
  16255. jQuery.each( [ "radio", "checkbox" ], function() {
  16256. jQuery.valHooks[ this ] = {
  16257. set: function( elem, value ) {
  16258. if ( Array.isArray( value ) ) {
  16259. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  16260. }
  16261. }
  16262. };
  16263. if ( !support.checkOn ) {
  16264. jQuery.valHooks[ this ].get = function( elem ) {
  16265. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  16266. };
  16267. }
  16268. } );
  16269. // Return jQuery for attributes-only inclusion
  16270. support.focusin = "onfocusin" in window;
  16271. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  16272. stopPropagationCallback = function( e ) {
  16273. e.stopPropagation();
  16274. };
  16275. jQuery.extend( jQuery.event, {
  16276. trigger: function( event, data, elem, onlyHandlers ) {
  16277. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  16278. eventPath = [ elem || document ],
  16279. type = hasOwn.call( event, "type" ) ? event.type : event,
  16280. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  16281. cur = lastElement = tmp = elem = elem || document;
  16282. // Don't do events on text and comment nodes
  16283. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  16284. return;
  16285. }
  16286. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  16287. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  16288. return;
  16289. }
  16290. if ( type.indexOf( "." ) > -1 ) {
  16291. // Namespaced trigger; create a regexp to match event type in handle()
  16292. namespaces = type.split( "." );
  16293. type = namespaces.shift();
  16294. namespaces.sort();
  16295. }
  16296. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  16297. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  16298. event = event[ jQuery.expando ] ?
  16299. event :
  16300. new jQuery.Event( type, typeof event === "object" && event );
  16301. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  16302. event.isTrigger = onlyHandlers ? 2 : 3;
  16303. event.namespace = namespaces.join( "." );
  16304. event.rnamespace = event.namespace ?
  16305. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  16306. null;
  16307. // Clean up the event in case it is being reused
  16308. event.result = undefined;
  16309. if ( !event.target ) {
  16310. event.target = elem;
  16311. }
  16312. // Clone any incoming data and prepend the event, creating the handler arg list
  16313. data = data == null ?
  16314. [ event ] :
  16315. jQuery.makeArray( data, [ event ] );
  16316. // Allow special events to draw outside the lines
  16317. special = jQuery.event.special[ type ] || {};
  16318. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  16319. return;
  16320. }
  16321. // Determine event propagation path in advance, per W3C events spec (#9951)
  16322. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  16323. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  16324. bubbleType = special.delegateType || type;
  16325. if ( !rfocusMorph.test( bubbleType + type ) ) {
  16326. cur = cur.parentNode;
  16327. }
  16328. for ( ; cur; cur = cur.parentNode ) {
  16329. eventPath.push( cur );
  16330. tmp = cur;
  16331. }
  16332. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  16333. if ( tmp === ( elem.ownerDocument || document ) ) {
  16334. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  16335. }
  16336. }
  16337. // Fire handlers on the event path
  16338. i = 0;
  16339. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  16340. lastElement = cur;
  16341. event.type = i > 1 ?
  16342. bubbleType :
  16343. special.bindType || type;
  16344. // jQuery handler
  16345. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  16346. dataPriv.get( cur, "handle" );
  16347. if ( handle ) {
  16348. handle.apply( cur, data );
  16349. }
  16350. // Native handler
  16351. handle = ontype && cur[ ontype ];
  16352. if ( handle && handle.apply && acceptData( cur ) ) {
  16353. event.result = handle.apply( cur, data );
  16354. if ( event.result === false ) {
  16355. event.preventDefault();
  16356. }
  16357. }
  16358. }
  16359. event.type = type;
  16360. // If nobody prevented the default action, do it now
  16361. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  16362. if ( ( !special._default ||
  16363. special._default.apply( eventPath.pop(), data ) === false ) &&
  16364. acceptData( elem ) ) {
  16365. // Call a native DOM method on the target with the same name as the event.
  16366. // Don't do default actions on window, that's where global variables be (#6170)
  16367. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  16368. // Don't re-trigger an onFOO event when we call its FOO() method
  16369. tmp = elem[ ontype ];
  16370. if ( tmp ) {
  16371. elem[ ontype ] = null;
  16372. }
  16373. // Prevent re-triggering of the same event, since we already bubbled it above
  16374. jQuery.event.triggered = type;
  16375. if ( event.isPropagationStopped() ) {
  16376. lastElement.addEventListener( type, stopPropagationCallback );
  16377. }
  16378. elem[ type ]();
  16379. if ( event.isPropagationStopped() ) {
  16380. lastElement.removeEventListener( type, stopPropagationCallback );
  16381. }
  16382. jQuery.event.triggered = undefined;
  16383. if ( tmp ) {
  16384. elem[ ontype ] = tmp;
  16385. }
  16386. }
  16387. }
  16388. }
  16389. return event.result;
  16390. },
  16391. // Piggyback on a donor event to simulate a different one
  16392. // Used only for `focus(in | out)` events
  16393. simulate: function( type, elem, event ) {
  16394. var e = jQuery.extend(
  16395. new jQuery.Event(),
  16396. event,
  16397. {
  16398. type: type,
  16399. isSimulated: true
  16400. }
  16401. );
  16402. jQuery.event.trigger( e, null, elem );
  16403. }
  16404. } );
  16405. jQuery.fn.extend( {
  16406. trigger: function( type, data ) {
  16407. return this.each( function() {
  16408. jQuery.event.trigger( type, data, this );
  16409. } );
  16410. },
  16411. triggerHandler: function( type, data ) {
  16412. var elem = this[ 0 ];
  16413. if ( elem ) {
  16414. return jQuery.event.trigger( type, data, elem, true );
  16415. }
  16416. }
  16417. } );
  16418. // Support: Firefox <=44
  16419. // Firefox doesn't have focus(in | out) events
  16420. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  16421. //
  16422. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  16423. // focus(in | out) events fire after focus & blur events,
  16424. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  16425. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  16426. if ( !support.focusin ) {
  16427. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  16428. // Attach a single capturing handler on the document while someone wants focusin/focusout
  16429. var handler = function( event ) {
  16430. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  16431. };
  16432. jQuery.event.special[ fix ] = {
  16433. setup: function() {
  16434. var doc = this.ownerDocument || this,
  16435. attaches = dataPriv.access( doc, fix );
  16436. if ( !attaches ) {
  16437. doc.addEventListener( orig, handler, true );
  16438. }
  16439. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  16440. },
  16441. teardown: function() {
  16442. var doc = this.ownerDocument || this,
  16443. attaches = dataPriv.access( doc, fix ) - 1;
  16444. if ( !attaches ) {
  16445. doc.removeEventListener( orig, handler, true );
  16446. dataPriv.remove( doc, fix );
  16447. } else {
  16448. dataPriv.access( doc, fix, attaches );
  16449. }
  16450. }
  16451. };
  16452. } );
  16453. }
  16454. var location = window.location;
  16455. var nonce = Date.now();
  16456. var rquery = ( /\?/ );
  16457. // Cross-browser xml parsing
  16458. jQuery.parseXML = function( data ) {
  16459. var xml;
  16460. if ( !data || typeof data !== "string" ) {
  16461. return null;
  16462. }
  16463. // Support: IE 9 - 11 only
  16464. // IE throws on parseFromString with invalid input.
  16465. try {
  16466. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  16467. } catch ( e ) {
  16468. xml = undefined;
  16469. }
  16470. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  16471. jQuery.error( "Invalid XML: " + data );
  16472. }
  16473. return xml;
  16474. };
  16475. var
  16476. rbracket = /\[\]$/,
  16477. rCRLF = /\r?\n/g,
  16478. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  16479. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  16480. function buildParams( prefix, obj, traditional, add ) {
  16481. var name;
  16482. if ( Array.isArray( obj ) ) {
  16483. // Serialize array item.
  16484. jQuery.each( obj, function( i, v ) {
  16485. if ( traditional || rbracket.test( prefix ) ) {
  16486. // Treat each array item as a scalar.
  16487. add( prefix, v );
  16488. } else {
  16489. // Item is non-scalar (array or object), encode its numeric index.
  16490. buildParams(
  16491. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  16492. v,
  16493. traditional,
  16494. add
  16495. );
  16496. }
  16497. } );
  16498. } else if ( !traditional && toType( obj ) === "object" ) {
  16499. // Serialize object item.
  16500. for ( name in obj ) {
  16501. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  16502. }
  16503. } else {
  16504. // Serialize scalar item.
  16505. add( prefix, obj );
  16506. }
  16507. }
  16508. // Serialize an array of form elements or a set of
  16509. // key/values into a query string
  16510. jQuery.param = function( a, traditional ) {
  16511. var prefix,
  16512. s = [],
  16513. add = function( key, valueOrFunction ) {
  16514. // If value is a function, invoke it and use its return value
  16515. var value = isFunction( valueOrFunction ) ?
  16516. valueOrFunction() :
  16517. valueOrFunction;
  16518. s[ s.length ] = encodeURIComponent( key ) + "=" +
  16519. encodeURIComponent( value == null ? "" : value );
  16520. };
  16521. if ( a == null ) {
  16522. return "";
  16523. }
  16524. // If an array was passed in, assume that it is an array of form elements.
  16525. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  16526. // Serialize the form elements
  16527. jQuery.each( a, function() {
  16528. add( this.name, this.value );
  16529. } );
  16530. } else {
  16531. // If traditional, encode the "old" way (the way 1.3.2 or older
  16532. // did it), otherwise encode params recursively.
  16533. for ( prefix in a ) {
  16534. buildParams( prefix, a[ prefix ], traditional, add );
  16535. }
  16536. }
  16537. // Return the resulting serialization
  16538. return s.join( "&" );
  16539. };
  16540. jQuery.fn.extend( {
  16541. serialize: function() {
  16542. return jQuery.param( this.serializeArray() );
  16543. },
  16544. serializeArray: function() {
  16545. return this.map( function() {
  16546. // Can add propHook for "elements" to filter or add form elements
  16547. var elements = jQuery.prop( this, "elements" );
  16548. return elements ? jQuery.makeArray( elements ) : this;
  16549. } )
  16550. .filter( function() {
  16551. var type = this.type;
  16552. // Use .is( ":disabled" ) so that fieldset[disabled] works
  16553. return this.name && !jQuery( this ).is( ":disabled" ) &&
  16554. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  16555. ( this.checked || !rcheckableType.test( type ) );
  16556. } )
  16557. .map( function( i, elem ) {
  16558. var val = jQuery( this ).val();
  16559. if ( val == null ) {
  16560. return null;
  16561. }
  16562. if ( Array.isArray( val ) ) {
  16563. return jQuery.map( val, function( val ) {
  16564. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  16565. } );
  16566. }
  16567. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  16568. } ).get();
  16569. }
  16570. } );
  16571. var
  16572. r20 = /%20/g,
  16573. rhash = /#.*$/,
  16574. rantiCache = /([?&])_=[^&]*/,
  16575. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  16576. // #7653, #8125, #8152: local protocol detection
  16577. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  16578. rnoContent = /^(?:GET|HEAD)$/,
  16579. rprotocol = /^\/\//,
  16580. /* Prefilters
  16581. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  16582. * 2) These are called:
  16583. * - BEFORE asking for a transport
  16584. * - AFTER param serialization (s.data is a string if s.processData is true)
  16585. * 3) key is the dataType
  16586. * 4) the catchall symbol "*" can be used
  16587. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  16588. */
  16589. prefilters = {},
  16590. /* Transports bindings
  16591. * 1) key is the dataType
  16592. * 2) the catchall symbol "*" can be used
  16593. * 3) selection will start with transport dataType and THEN go to "*" if needed
  16594. */
  16595. transports = {},
  16596. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  16597. allTypes = "*/".concat( "*" ),
  16598. // Anchor tag for parsing the document origin
  16599. originAnchor = document.createElement( "a" );
  16600. originAnchor.href = location.href;
  16601. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  16602. function addToPrefiltersOrTransports( structure ) {
  16603. // dataTypeExpression is optional and defaults to "*"
  16604. return function( dataTypeExpression, func ) {
  16605. if ( typeof dataTypeExpression !== "string" ) {
  16606. func = dataTypeExpression;
  16607. dataTypeExpression = "*";
  16608. }
  16609. var dataType,
  16610. i = 0,
  16611. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  16612. if ( isFunction( func ) ) {
  16613. // For each dataType in the dataTypeExpression
  16614. while ( ( dataType = dataTypes[ i++ ] ) ) {
  16615. // Prepend if requested
  16616. if ( dataType[ 0 ] === "+" ) {
  16617. dataType = dataType.slice( 1 ) || "*";
  16618. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  16619. // Otherwise append
  16620. } else {
  16621. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  16622. }
  16623. }
  16624. }
  16625. };
  16626. }
  16627. // Base inspection function for prefilters and transports
  16628. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  16629. var inspected = {},
  16630. seekingTransport = ( structure === transports );
  16631. function inspect( dataType ) {
  16632. var selected;
  16633. inspected[ dataType ] = true;
  16634. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  16635. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  16636. if ( typeof dataTypeOrTransport === "string" &&
  16637. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  16638. options.dataTypes.unshift( dataTypeOrTransport );
  16639. inspect( dataTypeOrTransport );
  16640. return false;
  16641. } else if ( seekingTransport ) {
  16642. return !( selected = dataTypeOrTransport );
  16643. }
  16644. } );
  16645. return selected;
  16646. }
  16647. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  16648. }
  16649. // A special extend for ajax options
  16650. // that takes "flat" options (not to be deep extended)
  16651. // Fixes #9887
  16652. function ajaxExtend( target, src ) {
  16653. var key, deep,
  16654. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  16655. for ( key in src ) {
  16656. if ( src[ key ] !== undefined ) {
  16657. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  16658. }
  16659. }
  16660. if ( deep ) {
  16661. jQuery.extend( true, target, deep );
  16662. }
  16663. return target;
  16664. }
  16665. /* Handles responses to an ajax request:
  16666. * - finds the right dataType (mediates between content-type and expected dataType)
  16667. * - returns the corresponding response
  16668. */
  16669. function ajaxHandleResponses( s, jqXHR, responses ) {
  16670. var ct, type, finalDataType, firstDataType,
  16671. contents = s.contents,
  16672. dataTypes = s.dataTypes;
  16673. // Remove auto dataType and get content-type in the process
  16674. while ( dataTypes[ 0 ] === "*" ) {
  16675. dataTypes.shift();
  16676. if ( ct === undefined ) {
  16677. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  16678. }
  16679. }
  16680. // Check if we're dealing with a known content-type
  16681. if ( ct ) {
  16682. for ( type in contents ) {
  16683. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  16684. dataTypes.unshift( type );
  16685. break;
  16686. }
  16687. }
  16688. }
  16689. // Check to see if we have a response for the expected dataType
  16690. if ( dataTypes[ 0 ] in responses ) {
  16691. finalDataType = dataTypes[ 0 ];
  16692. } else {
  16693. // Try convertible dataTypes
  16694. for ( type in responses ) {
  16695. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  16696. finalDataType = type;
  16697. break;
  16698. }
  16699. if ( !firstDataType ) {
  16700. firstDataType = type;
  16701. }
  16702. }
  16703. // Or just use first one
  16704. finalDataType = finalDataType || firstDataType;
  16705. }
  16706. // If we found a dataType
  16707. // We add the dataType to the list if needed
  16708. // and return the corresponding response
  16709. if ( finalDataType ) {
  16710. if ( finalDataType !== dataTypes[ 0 ] ) {
  16711. dataTypes.unshift( finalDataType );
  16712. }
  16713. return responses[ finalDataType ];
  16714. }
  16715. }
  16716. /* Chain conversions given the request and the original response
  16717. * Also sets the responseXXX fields on the jqXHR instance
  16718. */
  16719. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  16720. var conv2, current, conv, tmp, prev,
  16721. converters = {},
  16722. // Work with a copy of dataTypes in case we need to modify it for conversion
  16723. dataTypes = s.dataTypes.slice();
  16724. // Create converters map with lowercased keys
  16725. if ( dataTypes[ 1 ] ) {
  16726. for ( conv in s.converters ) {
  16727. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  16728. }
  16729. }
  16730. current = dataTypes.shift();
  16731. // Convert to each sequential dataType
  16732. while ( current ) {
  16733. if ( s.responseFields[ current ] ) {
  16734. jqXHR[ s.responseFields[ current ] ] = response;
  16735. }
  16736. // Apply the dataFilter if provided
  16737. if ( !prev && isSuccess && s.dataFilter ) {
  16738. response = s.dataFilter( response, s.dataType );
  16739. }
  16740. prev = current;
  16741. current = dataTypes.shift();
  16742. if ( current ) {
  16743. // There's only work to do if current dataType is non-auto
  16744. if ( current === "*" ) {
  16745. current = prev;
  16746. // Convert response if prev dataType is non-auto and differs from current
  16747. } else if ( prev !== "*" && prev !== current ) {
  16748. // Seek a direct converter
  16749. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  16750. // If none found, seek a pair
  16751. if ( !conv ) {
  16752. for ( conv2 in converters ) {
  16753. // If conv2 outputs current
  16754. tmp = conv2.split( " " );
  16755. if ( tmp[ 1 ] === current ) {
  16756. // If prev can be converted to accepted input
  16757. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  16758. converters[ "* " + tmp[ 0 ] ];
  16759. if ( conv ) {
  16760. // Condense equivalence converters
  16761. if ( conv === true ) {
  16762. conv = converters[ conv2 ];
  16763. // Otherwise, insert the intermediate dataType
  16764. } else if ( converters[ conv2 ] !== true ) {
  16765. current = tmp[ 0 ];
  16766. dataTypes.unshift( tmp[ 1 ] );
  16767. }
  16768. break;
  16769. }
  16770. }
  16771. }
  16772. }
  16773. // Apply converter (if not an equivalence)
  16774. if ( conv !== true ) {
  16775. // Unless errors are allowed to bubble, catch and return them
  16776. if ( conv && s.throws ) {
  16777. response = conv( response );
  16778. } else {
  16779. try {
  16780. response = conv( response );
  16781. } catch ( e ) {
  16782. return {
  16783. state: "parsererror",
  16784. error: conv ? e : "No conversion from " + prev + " to " + current
  16785. };
  16786. }
  16787. }
  16788. }
  16789. }
  16790. }
  16791. }
  16792. return { state: "success", data: response };
  16793. }
  16794. jQuery.extend( {
  16795. // Counter for holding the number of active queries
  16796. active: 0,
  16797. // Last-Modified header cache for next request
  16798. lastModified: {},
  16799. etag: {},
  16800. ajaxSettings: {
  16801. url: location.href,
  16802. type: "GET",
  16803. isLocal: rlocalProtocol.test( location.protocol ),
  16804. global: true,
  16805. processData: true,
  16806. async: true,
  16807. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16808. /*
  16809. timeout: 0,
  16810. data: null,
  16811. dataType: null,
  16812. username: null,
  16813. password: null,
  16814. cache: null,
  16815. throws: false,
  16816. traditional: false,
  16817. headers: {},
  16818. */
  16819. accepts: {
  16820. "*": allTypes,
  16821. text: "text/plain",
  16822. html: "text/html",
  16823. xml: "application/xml, text/xml",
  16824. json: "application/json, text/javascript"
  16825. },
  16826. contents: {
  16827. xml: /\bxml\b/,
  16828. html: /\bhtml/,
  16829. json: /\bjson\b/
  16830. },
  16831. responseFields: {
  16832. xml: "responseXML",
  16833. text: "responseText",
  16834. json: "responseJSON"
  16835. },
  16836. // Data converters
  16837. // Keys separate source (or catchall "*") and destination types with a single space
  16838. converters: {
  16839. // Convert anything to text
  16840. "* text": String,
  16841. // Text to html (true = no transformation)
  16842. "text html": true,
  16843. // Evaluate text as a json expression
  16844. "text json": JSON.parse,
  16845. // Parse text as xml
  16846. "text xml": jQuery.parseXML
  16847. },
  16848. // For options that shouldn't be deep extended:
  16849. // you can add your own custom options here if
  16850. // and when you create one that shouldn't be
  16851. // deep extended (see ajaxExtend)
  16852. flatOptions: {
  16853. url: true,
  16854. context: true
  16855. }
  16856. },
  16857. // Creates a full fledged settings object into target
  16858. // with both ajaxSettings and settings fields.
  16859. // If target is omitted, writes into ajaxSettings.
  16860. ajaxSetup: function( target, settings ) {
  16861. return settings ?
  16862. // Building a settings object
  16863. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16864. // Extending ajaxSettings
  16865. ajaxExtend( jQuery.ajaxSettings, target );
  16866. },
  16867. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16868. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16869. // Main method
  16870. ajax: function( url, options ) {
  16871. // If url is an object, simulate pre-1.5 signature
  16872. if ( typeof url === "object" ) {
  16873. options = url;
  16874. url = undefined;
  16875. }
  16876. // Force options to be an object
  16877. options = options || {};
  16878. var transport,
  16879. // URL without anti-cache param
  16880. cacheURL,
  16881. // Response headers
  16882. responseHeadersString,
  16883. responseHeaders,
  16884. // timeout handle
  16885. timeoutTimer,
  16886. // Url cleanup var
  16887. urlAnchor,
  16888. // Request state (becomes false upon send and true upon completion)
  16889. completed,
  16890. // To know if global events are to be dispatched
  16891. fireGlobals,
  16892. // Loop variable
  16893. i,
  16894. // uncached part of the url
  16895. uncached,
  16896. // Create the final options object
  16897. s = jQuery.ajaxSetup( {}, options ),
  16898. // Callbacks context
  16899. callbackContext = s.context || s,
  16900. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16901. globalEventContext = s.context &&
  16902. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16903. jQuery( callbackContext ) :
  16904. jQuery.event,
  16905. // Deferreds
  16906. deferred = jQuery.Deferred(),
  16907. completeDeferred = jQuery.Callbacks( "once memory" ),
  16908. // Status-dependent callbacks
  16909. statusCode = s.statusCode || {},
  16910. // Headers (they are sent all at once)
  16911. requestHeaders = {},
  16912. requestHeadersNames = {},
  16913. // Default abort message
  16914. strAbort = "canceled",
  16915. // Fake xhr
  16916. jqXHR = {
  16917. readyState: 0,
  16918. // Builds headers hashtable if needed
  16919. getResponseHeader: function( key ) {
  16920. var match;
  16921. if ( completed ) {
  16922. if ( !responseHeaders ) {
  16923. responseHeaders = {};
  16924. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16925. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16926. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16927. .concat( match[ 2 ] );
  16928. }
  16929. }
  16930. match = responseHeaders[ key.toLowerCase() + " " ];
  16931. }
  16932. return match == null ? null : match.join( ", " );
  16933. },
  16934. // Raw string
  16935. getAllResponseHeaders: function() {
  16936. return completed ? responseHeadersString : null;
  16937. },
  16938. // Caches the header
  16939. setRequestHeader: function( name, value ) {
  16940. if ( completed == null ) {
  16941. name = requestHeadersNames[ name.toLowerCase() ] =
  16942. requestHeadersNames[ name.toLowerCase() ] || name;
  16943. requestHeaders[ name ] = value;
  16944. }
  16945. return this;
  16946. },
  16947. // Overrides response content-type header
  16948. overrideMimeType: function( type ) {
  16949. if ( completed == null ) {
  16950. s.mimeType = type;
  16951. }
  16952. return this;
  16953. },
  16954. // Status-dependent callbacks
  16955. statusCode: function( map ) {
  16956. var code;
  16957. if ( map ) {
  16958. if ( completed ) {
  16959. // Execute the appropriate callbacks
  16960. jqXHR.always( map[ jqXHR.status ] );
  16961. } else {
  16962. // Lazy-add the new callbacks in a way that preserves old ones
  16963. for ( code in map ) {
  16964. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16965. }
  16966. }
  16967. }
  16968. return this;
  16969. },
  16970. // Cancel the request
  16971. abort: function( statusText ) {
  16972. var finalText = statusText || strAbort;
  16973. if ( transport ) {
  16974. transport.abort( finalText );
  16975. }
  16976. done( 0, finalText );
  16977. return this;
  16978. }
  16979. };
  16980. // Attach deferreds
  16981. deferred.promise( jqXHR );
  16982. // Add protocol if not provided (prefilters might expect it)
  16983. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16984. // We also use the url parameter if available
  16985. s.url = ( ( url || s.url || location.href ) + "" )
  16986. .replace( rprotocol, location.protocol + "//" );
  16987. // Alias method option to type as per ticket #12004
  16988. s.type = options.method || options.type || s.method || s.type;
  16989. // Extract dataTypes list
  16990. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16991. // A cross-domain request is in order when the origin doesn't match the current origin.
  16992. if ( s.crossDomain == null ) {
  16993. urlAnchor = document.createElement( "a" );
  16994. // Support: IE <=8 - 11, Edge 12 - 15
  16995. // IE throws exception on accessing the href property if url is malformed,
  16996. // e.g. http://example.com:80x/
  16997. try {
  16998. urlAnchor.href = s.url;
  16999. // Support: IE <=8 - 11 only
  17000. // Anchor's host property isn't correctly set when s.url is relative
  17001. urlAnchor.href = urlAnchor.href;
  17002. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  17003. urlAnchor.protocol + "//" + urlAnchor.host;
  17004. } catch ( e ) {
  17005. // If there is an error parsing the URL, assume it is crossDomain,
  17006. // it can be rejected by the transport if it is invalid
  17007. s.crossDomain = true;
  17008. }
  17009. }
  17010. // Convert data if not already a string
  17011. if ( s.data && s.processData && typeof s.data !== "string" ) {
  17012. s.data = jQuery.param( s.data, s.traditional );
  17013. }
  17014. // Apply prefilters
  17015. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  17016. // If request was aborted inside a prefilter, stop there
  17017. if ( completed ) {
  17018. return jqXHR;
  17019. }
  17020. // We can fire global events as of now if asked to
  17021. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  17022. fireGlobals = jQuery.event && s.global;
  17023. // Watch for a new set of requests
  17024. if ( fireGlobals && jQuery.active++ === 0 ) {
  17025. jQuery.event.trigger( "ajaxStart" );
  17026. }
  17027. // Uppercase the type
  17028. s.type = s.type.toUpperCase();
  17029. // Determine if request has content
  17030. s.hasContent = !rnoContent.test( s.type );
  17031. // Save the URL in case we're toying with the If-Modified-Since
  17032. // and/or If-None-Match header later on
  17033. // Remove hash to simplify url manipulation
  17034. cacheURL = s.url.replace( rhash, "" );
  17035. // More options handling for requests with no content
  17036. if ( !s.hasContent ) {
  17037. // Remember the hash so we can put it back
  17038. uncached = s.url.slice( cacheURL.length );
  17039. // If data is available and should be processed, append data to url
  17040. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  17041. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  17042. // #9682: remove data so that it's not used in an eventual retry
  17043. delete s.data;
  17044. }
  17045. // Add or update anti-cache param if needed
  17046. if ( s.cache === false ) {
  17047. cacheURL = cacheURL.replace( rantiCache, "$1" );
  17048. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  17049. }
  17050. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  17051. s.url = cacheURL + uncached;
  17052. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  17053. } else if ( s.data && s.processData &&
  17054. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  17055. s.data = s.data.replace( r20, "+" );
  17056. }
  17057. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  17058. if ( s.ifModified ) {
  17059. if ( jQuery.lastModified[ cacheURL ] ) {
  17060. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  17061. }
  17062. if ( jQuery.etag[ cacheURL ] ) {
  17063. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  17064. }
  17065. }
  17066. // Set the correct header, if data is being sent
  17067. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  17068. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  17069. }
  17070. // Set the Accepts header for the server, depending on the dataType
  17071. jqXHR.setRequestHeader(
  17072. "Accept",
  17073. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  17074. s.accepts[ s.dataTypes[ 0 ] ] +
  17075. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  17076. s.accepts[ "*" ]
  17077. );
  17078. // Check for headers option
  17079. for ( i in s.headers ) {
  17080. jqXHR.setRequestHeader( i, s.headers[ i ] );
  17081. }
  17082. // Allow custom headers/mimetypes and early abort
  17083. if ( s.beforeSend &&
  17084. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  17085. // Abort if not done already and return
  17086. return jqXHR.abort();
  17087. }
  17088. // Aborting is no longer a cancellation
  17089. strAbort = "abort";
  17090. // Install callbacks on deferreds
  17091. completeDeferred.add( s.complete );
  17092. jqXHR.done( s.success );
  17093. jqXHR.fail( s.error );
  17094. // Get transport
  17095. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  17096. // If no transport, we auto-abort
  17097. if ( !transport ) {
  17098. done( -1, "No Transport" );
  17099. } else {
  17100. jqXHR.readyState = 1;
  17101. // Send global event
  17102. if ( fireGlobals ) {
  17103. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  17104. }
  17105. // If request was aborted inside ajaxSend, stop there
  17106. if ( completed ) {
  17107. return jqXHR;
  17108. }
  17109. // Timeout
  17110. if ( s.async && s.timeout > 0 ) {
  17111. timeoutTimer = window.setTimeout( function() {
  17112. jqXHR.abort( "timeout" );
  17113. }, s.timeout );
  17114. }
  17115. try {
  17116. completed = false;
  17117. transport.send( requestHeaders, done );
  17118. } catch ( e ) {
  17119. // Rethrow post-completion exceptions
  17120. if ( completed ) {
  17121. throw e;
  17122. }
  17123. // Propagate others as results
  17124. done( -1, e );
  17125. }
  17126. }
  17127. // Callback for when everything is done
  17128. function done( status, nativeStatusText, responses, headers ) {
  17129. var isSuccess, success, error, response, modified,
  17130. statusText = nativeStatusText;
  17131. // Ignore repeat invocations
  17132. if ( completed ) {
  17133. return;
  17134. }
  17135. completed = true;
  17136. // Clear timeout if it exists
  17137. if ( timeoutTimer ) {
  17138. window.clearTimeout( timeoutTimer );
  17139. }
  17140. // Dereference transport for early garbage collection
  17141. // (no matter how long the jqXHR object will be used)
  17142. transport = undefined;
  17143. // Cache response headers
  17144. responseHeadersString = headers || "";
  17145. // Set readyState
  17146. jqXHR.readyState = status > 0 ? 4 : 0;
  17147. // Determine if successful
  17148. isSuccess = status >= 200 && status < 300 || status === 304;
  17149. // Get response data
  17150. if ( responses ) {
  17151. response = ajaxHandleResponses( s, jqXHR, responses );
  17152. }
  17153. // Convert no matter what (that way responseXXX fields are always set)
  17154. response = ajaxConvert( s, response, jqXHR, isSuccess );
  17155. // If successful, handle type chaining
  17156. if ( isSuccess ) {
  17157. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  17158. if ( s.ifModified ) {
  17159. modified = jqXHR.getResponseHeader( "Last-Modified" );
  17160. if ( modified ) {
  17161. jQuery.lastModified[ cacheURL ] = modified;
  17162. }
  17163. modified = jqXHR.getResponseHeader( "etag" );
  17164. if ( modified ) {
  17165. jQuery.etag[ cacheURL ] = modified;
  17166. }
  17167. }
  17168. // if no content
  17169. if ( status === 204 || s.type === "HEAD" ) {
  17170. statusText = "nocontent";
  17171. // if not modified
  17172. } else if ( status === 304 ) {
  17173. statusText = "notmodified";
  17174. // If we have data, let's convert it
  17175. } else {
  17176. statusText = response.state;
  17177. success = response.data;
  17178. error = response.error;
  17179. isSuccess = !error;
  17180. }
  17181. } else {
  17182. // Extract error from statusText and normalize for non-aborts
  17183. error = statusText;
  17184. if ( status || !statusText ) {
  17185. statusText = "error";
  17186. if ( status < 0 ) {
  17187. status = 0;
  17188. }
  17189. }
  17190. }
  17191. // Set data for the fake xhr object
  17192. jqXHR.status = status;
  17193. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  17194. // Success/Error
  17195. if ( isSuccess ) {
  17196. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  17197. } else {
  17198. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  17199. }
  17200. // Status-dependent callbacks
  17201. jqXHR.statusCode( statusCode );
  17202. statusCode = undefined;
  17203. if ( fireGlobals ) {
  17204. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  17205. [ jqXHR, s, isSuccess ? success : error ] );
  17206. }
  17207. // Complete
  17208. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  17209. if ( fireGlobals ) {
  17210. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  17211. // Handle the global AJAX counter
  17212. if ( !( --jQuery.active ) ) {
  17213. jQuery.event.trigger( "ajaxStop" );
  17214. }
  17215. }
  17216. }
  17217. return jqXHR;
  17218. },
  17219. getJSON: function( url, data, callback ) {
  17220. return jQuery.get( url, data, callback, "json" );
  17221. },
  17222. getScript: function( url, callback ) {
  17223. return jQuery.get( url, undefined, callback, "script" );
  17224. }
  17225. } );
  17226. jQuery.each( [ "get", "post" ], function( i, method ) {
  17227. jQuery[ method ] = function( url, data, callback, type ) {
  17228. // Shift arguments if data argument was omitted
  17229. if ( isFunction( data ) ) {
  17230. type = type || callback;
  17231. callback = data;
  17232. data = undefined;
  17233. }
  17234. // The url can be an options object (which then must have .url)
  17235. return jQuery.ajax( jQuery.extend( {
  17236. url: url,
  17237. type: method,
  17238. dataType: type,
  17239. data: data,
  17240. success: callback
  17241. }, jQuery.isPlainObject( url ) && url ) );
  17242. };
  17243. } );
  17244. jQuery._evalUrl = function( url, options ) {
  17245. return jQuery.ajax( {
  17246. url: url,
  17247. // Make this explicit, since user can override this through ajaxSetup (#11264)
  17248. type: "GET",
  17249. dataType: "script",
  17250. cache: true,
  17251. async: false,
  17252. global: false,
  17253. // Only evaluate the response if it is successful (gh-4126)
  17254. // dataFilter is not invoked for failure responses, so using it instead
  17255. // of the default converter is kludgy but it works.
  17256. converters: {
  17257. "text script": function() {}
  17258. },
  17259. dataFilter: function( response ) {
  17260. jQuery.globalEval( response, options );
  17261. }
  17262. } );
  17263. };
  17264. jQuery.fn.extend( {
  17265. wrapAll: function( html ) {
  17266. var wrap;
  17267. if ( this[ 0 ] ) {
  17268. if ( isFunction( html ) ) {
  17269. html = html.call( this[ 0 ] );
  17270. }
  17271. // The elements to wrap the target around
  17272. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  17273. if ( this[ 0 ].parentNode ) {
  17274. wrap.insertBefore( this[ 0 ] );
  17275. }
  17276. wrap.map( function() {
  17277. var elem = this;
  17278. while ( elem.firstElementChild ) {
  17279. elem = elem.firstElementChild;
  17280. }
  17281. return elem;
  17282. } ).append( this );
  17283. }
  17284. return this;
  17285. },
  17286. wrapInner: function( html ) {
  17287. if ( isFunction( html ) ) {
  17288. return this.each( function( i ) {
  17289. jQuery( this ).wrapInner( html.call( this, i ) );
  17290. } );
  17291. }
  17292. return this.each( function() {
  17293. var self = jQuery( this ),
  17294. contents = self.contents();
  17295. if ( contents.length ) {
  17296. contents.wrapAll( html );
  17297. } else {
  17298. self.append( html );
  17299. }
  17300. } );
  17301. },
  17302. wrap: function( html ) {
  17303. var htmlIsFunction = isFunction( html );
  17304. return this.each( function( i ) {
  17305. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  17306. } );
  17307. },
  17308. unwrap: function( selector ) {
  17309. this.parent( selector ).not( "body" ).each( function() {
  17310. jQuery( this ).replaceWith( this.childNodes );
  17311. } );
  17312. return this;
  17313. }
  17314. } );
  17315. jQuery.expr.pseudos.hidden = function( elem ) {
  17316. return !jQuery.expr.pseudos.visible( elem );
  17317. };
  17318. jQuery.expr.pseudos.visible = function( elem ) {
  17319. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  17320. };
  17321. jQuery.ajaxSettings.xhr = function() {
  17322. try {
  17323. return new window.XMLHttpRequest();
  17324. } catch ( e ) {}
  17325. };
  17326. var xhrSuccessStatus = {
  17327. // File protocol always yields status code 0, assume 200
  17328. 0: 200,
  17329. // Support: IE <=9 only
  17330. // #1450: sometimes IE returns 1223 when it should be 204
  17331. 1223: 204
  17332. },
  17333. xhrSupported = jQuery.ajaxSettings.xhr();
  17334. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  17335. support.ajax = xhrSupported = !!xhrSupported;
  17336. jQuery.ajaxTransport( function( options ) {
  17337. var callback, errorCallback;
  17338. // Cross domain only allowed if supported through XMLHttpRequest
  17339. if ( support.cors || xhrSupported && !options.crossDomain ) {
  17340. return {
  17341. send: function( headers, complete ) {
  17342. var i,
  17343. xhr = options.xhr();
  17344. xhr.open(
  17345. options.type,
  17346. options.url,
  17347. options.async,
  17348. options.username,
  17349. options.password
  17350. );
  17351. // Apply custom fields if provided
  17352. if ( options.xhrFields ) {
  17353. for ( i in options.xhrFields ) {
  17354. xhr[ i ] = options.xhrFields[ i ];
  17355. }
  17356. }
  17357. // Override mime type if needed
  17358. if ( options.mimeType && xhr.overrideMimeType ) {
  17359. xhr.overrideMimeType( options.mimeType );
  17360. }
  17361. // X-Requested-With header
  17362. // For cross-domain requests, seeing as conditions for a preflight are
  17363. // akin to a jigsaw puzzle, we simply never set it to be sure.
  17364. // (it can always be set on a per-request basis or even using ajaxSetup)
  17365. // For same-domain requests, won't change header if already provided.
  17366. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  17367. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  17368. }
  17369. // Set headers
  17370. for ( i in headers ) {
  17371. xhr.setRequestHeader( i, headers[ i ] );
  17372. }
  17373. // Callback
  17374. callback = function( type ) {
  17375. return function() {
  17376. if ( callback ) {
  17377. callback = errorCallback = xhr.onload =
  17378. xhr.onerror = xhr.onabort = xhr.ontimeout =
  17379. xhr.onreadystatechange = null;
  17380. if ( type === "abort" ) {
  17381. xhr.abort();
  17382. } else if ( type === "error" ) {
  17383. // Support: IE <=9 only
  17384. // On a manual native abort, IE9 throws
  17385. // errors on any property access that is not readyState
  17386. if ( typeof xhr.status !== "number" ) {
  17387. complete( 0, "error" );
  17388. } else {
  17389. complete(
  17390. // File: protocol always yields status 0; see #8605, #14207
  17391. xhr.status,
  17392. xhr.statusText
  17393. );
  17394. }
  17395. } else {
  17396. complete(
  17397. xhrSuccessStatus[ xhr.status ] || xhr.status,
  17398. xhr.statusText,
  17399. // Support: IE <=9 only
  17400. // IE9 has no XHR2 but throws on binary (trac-11426)
  17401. // For XHR2 non-text, let the caller handle it (gh-2498)
  17402. ( xhr.responseType || "text" ) !== "text" ||
  17403. typeof xhr.responseText !== "string" ?
  17404. { binary: xhr.response } :
  17405. { text: xhr.responseText },
  17406. xhr.getAllResponseHeaders()
  17407. );
  17408. }
  17409. }
  17410. };
  17411. };
  17412. // Listen to events
  17413. xhr.onload = callback();
  17414. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  17415. // Support: IE 9 only
  17416. // Use onreadystatechange to replace onabort
  17417. // to handle uncaught aborts
  17418. if ( xhr.onabort !== undefined ) {
  17419. xhr.onabort = errorCallback;
  17420. } else {
  17421. xhr.onreadystatechange = function() {
  17422. // Check readyState before timeout as it changes
  17423. if ( xhr.readyState === 4 ) {
  17424. // Allow onerror to be called first,
  17425. // but that will not handle a native abort
  17426. // Also, save errorCallback to a variable
  17427. // as xhr.onerror cannot be accessed
  17428. window.setTimeout( function() {
  17429. if ( callback ) {
  17430. errorCallback();
  17431. }
  17432. } );
  17433. }
  17434. };
  17435. }
  17436. // Create the abort callback
  17437. callback = callback( "abort" );
  17438. try {
  17439. // Do send the request (this may raise an exception)
  17440. xhr.send( options.hasContent && options.data || null );
  17441. } catch ( e ) {
  17442. // #14683: Only rethrow if this hasn't been notified as an error yet
  17443. if ( callback ) {
  17444. throw e;
  17445. }
  17446. }
  17447. },
  17448. abort: function() {
  17449. if ( callback ) {
  17450. callback();
  17451. }
  17452. }
  17453. };
  17454. }
  17455. } );
  17456. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  17457. jQuery.ajaxPrefilter( function( s ) {
  17458. if ( s.crossDomain ) {
  17459. s.contents.script = false;
  17460. }
  17461. } );
  17462. // Install script dataType
  17463. jQuery.ajaxSetup( {
  17464. accepts: {
  17465. script: "text/javascript, application/javascript, " +
  17466. "application/ecmascript, application/x-ecmascript"
  17467. },
  17468. contents: {
  17469. script: /\b(?:java|ecma)script\b/
  17470. },
  17471. converters: {
  17472. "text script": function( text ) {
  17473. jQuery.globalEval( text );
  17474. return text;
  17475. }
  17476. }
  17477. } );
  17478. // Handle cache's special case and crossDomain
  17479. jQuery.ajaxPrefilter( "script", function( s ) {
  17480. if ( s.cache === undefined ) {
  17481. s.cache = false;
  17482. }
  17483. if ( s.crossDomain ) {
  17484. s.type = "GET";
  17485. }
  17486. } );
  17487. // Bind script tag hack transport
  17488. jQuery.ajaxTransport( "script", function( s ) {
  17489. // This transport only deals with cross domain or forced-by-attrs requests
  17490. if ( s.crossDomain || s.scriptAttrs ) {
  17491. var script, callback;
  17492. return {
  17493. send: function( _, complete ) {
  17494. script = jQuery( "<script>" )
  17495. .attr( s.scriptAttrs || {} )
  17496. .prop( { charset: s.scriptCharset, src: s.url } )
  17497. .on( "load error", callback = function( evt ) {
  17498. script.remove();
  17499. callback = null;
  17500. if ( evt ) {
  17501. complete( evt.type === "error" ? 404 : 200, evt.type );
  17502. }
  17503. } );
  17504. // Use native DOM manipulation to avoid our domManip AJAX trickery
  17505. document.head.appendChild( script[ 0 ] );
  17506. },
  17507. abort: function() {
  17508. if ( callback ) {
  17509. callback();
  17510. }
  17511. }
  17512. };
  17513. }
  17514. } );
  17515. var oldCallbacks = [],
  17516. rjsonp = /(=)\?(?=&|$)|\?\?/;
  17517. // Default jsonp settings
  17518. jQuery.ajaxSetup( {
  17519. jsonp: "callback",
  17520. jsonpCallback: function() {
  17521. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  17522. this[ callback ] = true;
  17523. return callback;
  17524. }
  17525. } );
  17526. // Detect, normalize options and install callbacks for jsonp requests
  17527. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  17528. var callbackName, overwritten, responseContainer,
  17529. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  17530. "url" :
  17531. typeof s.data === "string" &&
  17532. ( s.contentType || "" )
  17533. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  17534. rjsonp.test( s.data ) && "data"
  17535. );
  17536. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  17537. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  17538. // Get callback name, remembering preexisting value associated with it
  17539. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  17540. s.jsonpCallback() :
  17541. s.jsonpCallback;
  17542. // Insert callback into url or form data
  17543. if ( jsonProp ) {
  17544. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  17545. } else if ( s.jsonp !== false ) {
  17546. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  17547. }
  17548. // Use data converter to retrieve json after script execution
  17549. s.converters[ "script json" ] = function() {
  17550. if ( !responseContainer ) {
  17551. jQuery.error( callbackName + " was not called" );
  17552. }
  17553. return responseContainer[ 0 ];
  17554. };
  17555. // Force json dataType
  17556. s.dataTypes[ 0 ] = "json";
  17557. // Install callback
  17558. overwritten = window[ callbackName ];
  17559. window[ callbackName ] = function() {
  17560. responseContainer = arguments;
  17561. };
  17562. // Clean-up function (fires after converters)
  17563. jqXHR.always( function() {
  17564. // If previous value didn't exist - remove it
  17565. if ( overwritten === undefined ) {
  17566. jQuery( window ).removeProp( callbackName );
  17567. // Otherwise restore preexisting value
  17568. } else {
  17569. window[ callbackName ] = overwritten;
  17570. }
  17571. // Save back as free
  17572. if ( s[ callbackName ] ) {
  17573. // Make sure that re-using the options doesn't screw things around
  17574. s.jsonpCallback = originalSettings.jsonpCallback;
  17575. // Save the callback name for future use
  17576. oldCallbacks.push( callbackName );
  17577. }
  17578. // Call if it was a function and we have a response
  17579. if ( responseContainer && isFunction( overwritten ) ) {
  17580. overwritten( responseContainer[ 0 ] );
  17581. }
  17582. responseContainer = overwritten = undefined;
  17583. } );
  17584. // Delegate to script
  17585. return "script";
  17586. }
  17587. } );
  17588. // Support: Safari 8 only
  17589. // In Safari 8 documents created via document.implementation.createHTMLDocument
  17590. // collapse sibling forms: the second one becomes a child of the first one.
  17591. // Because of that, this security measure has to be disabled in Safari 8.
  17592. // https://bugs.webkit.org/show_bug.cgi?id=137337
  17593. support.createHTMLDocument = ( function() {
  17594. var body = document.implementation.createHTMLDocument( "" ).body;
  17595. body.innerHTML = "<form></form><form></form>";
  17596. return body.childNodes.length === 2;
  17597. } )();
  17598. // Argument "data" should be string of html
  17599. // context (optional): If specified, the fragment will be created in this context,
  17600. // defaults to document
  17601. // keepScripts (optional): If true, will include scripts passed in the html string
  17602. jQuery.parseHTML = function( data, context, keepScripts ) {
  17603. if ( typeof data !== "string" ) {
  17604. return [];
  17605. }
  17606. if ( typeof context === "boolean" ) {
  17607. keepScripts = context;
  17608. context = false;
  17609. }
  17610. var base, parsed, scripts;
  17611. if ( !context ) {
  17612. // Stop scripts or inline event handlers from being executed immediately
  17613. // by using document.implementation
  17614. if ( support.createHTMLDocument ) {
  17615. context = document.implementation.createHTMLDocument( "" );
  17616. // Set the base href for the created document
  17617. // so any parsed elements with URLs
  17618. // are based on the document's URL (gh-2965)
  17619. base = context.createElement( "base" );
  17620. base.href = document.location.href;
  17621. context.head.appendChild( base );
  17622. } else {
  17623. context = document;
  17624. }
  17625. }
  17626. parsed = rsingleTag.exec( data );
  17627. scripts = !keepScripts && [];
  17628. // Single tag
  17629. if ( parsed ) {
  17630. return [ context.createElement( parsed[ 1 ] ) ];
  17631. }
  17632. parsed = buildFragment( [ data ], context, scripts );
  17633. if ( scripts && scripts.length ) {
  17634. jQuery( scripts ).remove();
  17635. }
  17636. return jQuery.merge( [], parsed.childNodes );
  17637. };
  17638. /**
  17639. * Load a url into a page
  17640. */
  17641. jQuery.fn.load = function( url, params, callback ) {
  17642. var selector, type, response,
  17643. self = this,
  17644. off = url.indexOf( " " );
  17645. if ( off > -1 ) {
  17646. selector = stripAndCollapse( url.slice( off ) );
  17647. url = url.slice( 0, off );
  17648. }
  17649. // If it's a function
  17650. if ( isFunction( params ) ) {
  17651. // We assume that it's the callback
  17652. callback = params;
  17653. params = undefined;
  17654. // Otherwise, build a param string
  17655. } else if ( params && typeof params === "object" ) {
  17656. type = "POST";
  17657. }
  17658. // If we have elements to modify, make the request
  17659. if ( self.length > 0 ) {
  17660. jQuery.ajax( {
  17661. url: url,
  17662. // If "type" variable is undefined, then "GET" method will be used.
  17663. // Make value of this field explicit since
  17664. // user can override it through ajaxSetup method
  17665. type: type || "GET",
  17666. dataType: "html",
  17667. data: params
  17668. } ).done( function( responseText ) {
  17669. // Save response for use in complete callback
  17670. response = arguments;
  17671. self.html( selector ?
  17672. // If a selector was specified, locate the right elements in a dummy div
  17673. // Exclude scripts to avoid IE 'Permission Denied' errors
  17674. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  17675. // Otherwise use the full result
  17676. responseText );
  17677. // If the request succeeds, this function gets "data", "status", "jqXHR"
  17678. // but they are ignored because response was set above.
  17679. // If it fails, this function gets "jqXHR", "status", "error"
  17680. } ).always( callback && function( jqXHR, status ) {
  17681. self.each( function() {
  17682. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  17683. } );
  17684. } );
  17685. }
  17686. return this;
  17687. };
  17688. // Attach a bunch of functions for handling common AJAX events
  17689. jQuery.each( [
  17690. "ajaxStart",
  17691. "ajaxStop",
  17692. "ajaxComplete",
  17693. "ajaxError",
  17694. "ajaxSuccess",
  17695. "ajaxSend"
  17696. ], function( i, type ) {
  17697. jQuery.fn[ type ] = function( fn ) {
  17698. return this.on( type, fn );
  17699. };
  17700. } );
  17701. jQuery.expr.pseudos.animated = function( elem ) {
  17702. return jQuery.grep( jQuery.timers, function( fn ) {
  17703. return elem === fn.elem;
  17704. } ).length;
  17705. };
  17706. jQuery.offset = {
  17707. setOffset: function( elem, options, i ) {
  17708. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  17709. position = jQuery.css( elem, "position" ),
  17710. curElem = jQuery( elem ),
  17711. props = {};
  17712. // Set position first, in-case top/left are set even on static elem
  17713. if ( position === "static" ) {
  17714. elem.style.position = "relative";
  17715. }
  17716. curOffset = curElem.offset();
  17717. curCSSTop = jQuery.css( elem, "top" );
  17718. curCSSLeft = jQuery.css( elem, "left" );
  17719. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  17720. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  17721. // Need to be able to calculate position if either
  17722. // top or left is auto and position is either absolute or fixed
  17723. if ( calculatePosition ) {
  17724. curPosition = curElem.position();
  17725. curTop = curPosition.top;
  17726. curLeft = curPosition.left;
  17727. } else {
  17728. curTop = parseFloat( curCSSTop ) || 0;
  17729. curLeft = parseFloat( curCSSLeft ) || 0;
  17730. }
  17731. if ( isFunction( options ) ) {
  17732. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  17733. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  17734. }
  17735. if ( options.top != null ) {
  17736. props.top = ( options.top - curOffset.top ) + curTop;
  17737. }
  17738. if ( options.left != null ) {
  17739. props.left = ( options.left - curOffset.left ) + curLeft;
  17740. }
  17741. if ( "using" in options ) {
  17742. options.using.call( elem, props );
  17743. } else {
  17744. curElem.css( props );
  17745. }
  17746. }
  17747. };
  17748. jQuery.fn.extend( {
  17749. // offset() relates an element's border box to the document origin
  17750. offset: function( options ) {
  17751. // Preserve chaining for setter
  17752. if ( arguments.length ) {
  17753. return options === undefined ?
  17754. this :
  17755. this.each( function( i ) {
  17756. jQuery.offset.setOffset( this, options, i );
  17757. } );
  17758. }
  17759. var rect, win,
  17760. elem = this[ 0 ];
  17761. if ( !elem ) {
  17762. return;
  17763. }
  17764. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  17765. // Support: IE <=11 only
  17766. // Running getBoundingClientRect on a
  17767. // disconnected node in IE throws an error
  17768. if ( !elem.getClientRects().length ) {
  17769. return { top: 0, left: 0 };
  17770. }
  17771. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  17772. rect = elem.getBoundingClientRect();
  17773. win = elem.ownerDocument.defaultView;
  17774. return {
  17775. top: rect.top + win.pageYOffset,
  17776. left: rect.left + win.pageXOffset
  17777. };
  17778. },
  17779. // position() relates an element's margin box to its offset parent's padding box
  17780. // This corresponds to the behavior of CSS absolute positioning
  17781. position: function() {
  17782. if ( !this[ 0 ] ) {
  17783. return;
  17784. }
  17785. var offsetParent, offset, doc,
  17786. elem = this[ 0 ],
  17787. parentOffset = { top: 0, left: 0 };
  17788. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17789. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17790. // Assume position:fixed implies availability of getBoundingClientRect
  17791. offset = elem.getBoundingClientRect();
  17792. } else {
  17793. offset = this.offset();
  17794. // Account for the *real* offset parent, which can be the document or its root element
  17795. // when a statically positioned element is identified
  17796. doc = elem.ownerDocument;
  17797. offsetParent = elem.offsetParent || doc.documentElement;
  17798. while ( offsetParent &&
  17799. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17800. jQuery.css( offsetParent, "position" ) === "static" ) {
  17801. offsetParent = offsetParent.parentNode;
  17802. }
  17803. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17804. // Incorporate borders into its offset, since they are outside its content origin
  17805. parentOffset = jQuery( offsetParent ).offset();
  17806. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17807. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17808. }
  17809. }
  17810. // Subtract parent offsets and element margins
  17811. return {
  17812. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17813. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17814. };
  17815. },
  17816. // This method will return documentElement in the following cases:
  17817. // 1) For the element inside the iframe without offsetParent, this method will return
  17818. // documentElement of the parent window
  17819. // 2) For the hidden or detached element
  17820. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17821. //
  17822. // but those exceptions were never presented as a real life use-cases
  17823. // and might be considered as more preferable results.
  17824. //
  17825. // This logic, however, is not guaranteed and can change at any point in the future
  17826. offsetParent: function() {
  17827. return this.map( function() {
  17828. var offsetParent = this.offsetParent;
  17829. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17830. offsetParent = offsetParent.offsetParent;
  17831. }
  17832. return offsetParent || documentElement;
  17833. } );
  17834. }
  17835. } );
  17836. // Create scrollLeft and scrollTop methods
  17837. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17838. var top = "pageYOffset" === prop;
  17839. jQuery.fn[ method ] = function( val ) {
  17840. return access( this, function( elem, method, val ) {
  17841. // Coalesce documents and windows
  17842. var win;
  17843. if ( isWindow( elem ) ) {
  17844. win = elem;
  17845. } else if ( elem.nodeType === 9 ) {
  17846. win = elem.defaultView;
  17847. }
  17848. if ( val === undefined ) {
  17849. return win ? win[ prop ] : elem[ method ];
  17850. }
  17851. if ( win ) {
  17852. win.scrollTo(
  17853. !top ? val : win.pageXOffset,
  17854. top ? val : win.pageYOffset
  17855. );
  17856. } else {
  17857. elem[ method ] = val;
  17858. }
  17859. }, method, val, arguments.length );
  17860. };
  17861. } );
  17862. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17863. // Add the top/left cssHooks using jQuery.fn.position
  17864. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17865. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17866. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17867. // rather than make the css module depend on the offset module, just check for it here
  17868. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17869. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17870. function( elem, computed ) {
  17871. if ( computed ) {
  17872. computed = curCSS( elem, prop );
  17873. // If curCSS returns percentage, fallback to offset
  17874. return rnumnonpx.test( computed ) ?
  17875. jQuery( elem ).position()[ prop ] + "px" :
  17876. computed;
  17877. }
  17878. }
  17879. );
  17880. } );
  17881. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17882. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17883. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17884. function( defaultExtra, funcName ) {
  17885. // Margin is only for outerHeight, outerWidth
  17886. jQuery.fn[ funcName ] = function( margin, value ) {
  17887. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17888. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17889. return access( this, function( elem, type, value ) {
  17890. var doc;
  17891. if ( isWindow( elem ) ) {
  17892. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17893. return funcName.indexOf( "outer" ) === 0 ?
  17894. elem[ "inner" + name ] :
  17895. elem.document.documentElement[ "client" + name ];
  17896. }
  17897. // Get document width or height
  17898. if ( elem.nodeType === 9 ) {
  17899. doc = elem.documentElement;
  17900. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17901. // whichever is greatest
  17902. return Math.max(
  17903. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17904. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17905. doc[ "client" + name ]
  17906. );
  17907. }
  17908. return value === undefined ?
  17909. // Get width or height on the element, requesting but not forcing parseFloat
  17910. jQuery.css( elem, type, extra ) :
  17911. // Set width or height on the element
  17912. jQuery.style( elem, type, value, extra );
  17913. }, type, chainable ? margin : undefined, chainable );
  17914. };
  17915. } );
  17916. } );
  17917. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17918. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17919. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17920. function( i, name ) {
  17921. // Handle event binding
  17922. jQuery.fn[ name ] = function( data, fn ) {
  17923. return arguments.length > 0 ?
  17924. this.on( name, null, data, fn ) :
  17925. this.trigger( name );
  17926. };
  17927. } );
  17928. jQuery.fn.extend( {
  17929. hover: function( fnOver, fnOut ) {
  17930. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17931. }
  17932. } );
  17933. jQuery.fn.extend( {
  17934. bind: function( types, data, fn ) {
  17935. return this.on( types, null, data, fn );
  17936. },
  17937. unbind: function( types, fn ) {
  17938. return this.off( types, null, fn );
  17939. },
  17940. delegate: function( selector, types, data, fn ) {
  17941. return this.on( types, selector, data, fn );
  17942. },
  17943. undelegate: function( selector, types, fn ) {
  17944. // ( namespace ) or ( selector, types [, fn] )
  17945. return arguments.length === 1 ?
  17946. this.off( selector, "**" ) :
  17947. this.off( types, selector || "**", fn );
  17948. }
  17949. } );
  17950. // Bind a function to a context, optionally partially applying any
  17951. // arguments.
  17952. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17953. // However, it is not slated for removal any time soon
  17954. jQuery.proxy = function( fn, context ) {
  17955. var tmp, args, proxy;
  17956. if ( typeof context === "string" ) {
  17957. tmp = fn[ context ];
  17958. context = fn;
  17959. fn = tmp;
  17960. }
  17961. // Quick check to determine if target is callable, in the spec
  17962. // this throws a TypeError, but we will just return undefined.
  17963. if ( !isFunction( fn ) ) {
  17964. return undefined;
  17965. }
  17966. // Simulated bind
  17967. args = slice.call( arguments, 2 );
  17968. proxy = function() {
  17969. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17970. };
  17971. // Set the guid of unique handler to the same of original handler, so it can be removed
  17972. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17973. return proxy;
  17974. };
  17975. jQuery.holdReady = function( hold ) {
  17976. if ( hold ) {
  17977. jQuery.readyWait++;
  17978. } else {
  17979. jQuery.ready( true );
  17980. }
  17981. };
  17982. jQuery.isArray = Array.isArray;
  17983. jQuery.parseJSON = JSON.parse;
  17984. jQuery.nodeName = nodeName;
  17985. jQuery.isFunction = isFunction;
  17986. jQuery.isWindow = isWindow;
  17987. jQuery.camelCase = camelCase;
  17988. jQuery.type = toType;
  17989. jQuery.now = Date.now;
  17990. jQuery.isNumeric = function( obj ) {
  17991. // As of jQuery 3.0, isNumeric is limited to
  17992. // strings and numbers (primitives or objects)
  17993. // that can be coerced to finite numbers (gh-2662)
  17994. var type = jQuery.type( obj );
  17995. return ( type === "number" || type === "string" ) &&
  17996. // parseFloat NaNs numeric-cast false positives ("")
  17997. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17998. // subtraction forces infinities to NaN
  17999. !isNaN( obj - parseFloat( obj ) );
  18000. };
  18001. // Register as a named AMD module, since jQuery can be concatenated with other
  18002. // files that may use define, but not via a proper concatenation script that
  18003. // understands anonymous AMD modules. A named AMD is safest and most robust
  18004. // way to register. Lowercase jquery is used because AMD module names are
  18005. // derived from file names, and jQuery is normally delivered in a lowercase
  18006. // file name. Do this after creating the global so that if an AMD module wants
  18007. // to call noConflict to hide this version of jQuery, it will work.
  18008. // Note that for maximum portability, libraries that are not jQuery should
  18009. // declare themselves as anonymous modules, and avoid setting a global if an
  18010. // AMD loader is present. jQuery is a special case. For more information, see
  18011. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  18012. if ( true ) {
  18013. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  18014. return jQuery;
  18015. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  18016. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  18017. }
  18018. var
  18019. // Map over jQuery in case of overwrite
  18020. _jQuery = window.jQuery,
  18021. // Map over the $ in case of overwrite
  18022. _$ = window.$;
  18023. jQuery.noConflict = function( deep ) {
  18024. if ( window.$ === jQuery ) {
  18025. window.$ = _$;
  18026. }
  18027. if ( deep && window.jQuery === jQuery ) {
  18028. window.jQuery = _jQuery;
  18029. }
  18030. return jQuery;
  18031. };
  18032. // Expose jQuery and $ identifiers, even in AMD
  18033. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  18034. // and CommonJS for browser emulators (#13566)
  18035. if ( !noGlobal ) {
  18036. window.jQuery = window.$ = jQuery;
  18037. }
  18038. return jQuery;
  18039. } );
  18040. /***/ }),
  18041. /***/ "./node_modules/laravel-echo/dist/echo.js":
  18042. /*!************************************************!*\
  18043. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  18044. \************************************************/
  18045. /*! exports provided: default */
  18046. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  18047. "use strict";
  18048. __webpack_require__.r(__webpack_exports__);
  18049. var classCallCheck = function (instance, Constructor) {
  18050. if (!(instance instanceof Constructor)) {
  18051. throw new TypeError("Cannot call a class as a function");
  18052. }
  18053. };
  18054. var createClass = function () {
  18055. function defineProperties(target, props) {
  18056. for (var i = 0; i < props.length; i++) {
  18057. var descriptor = props[i];
  18058. descriptor.enumerable = descriptor.enumerable || false;
  18059. descriptor.configurable = true;
  18060. if ("value" in descriptor) descriptor.writable = true;
  18061. Object.defineProperty(target, descriptor.key, descriptor);
  18062. }
  18063. }
  18064. return function (Constructor, protoProps, staticProps) {
  18065. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  18066. if (staticProps) defineProperties(Constructor, staticProps);
  18067. return Constructor;
  18068. };
  18069. }();
  18070. var _extends = Object.assign || function (target) {
  18071. for (var i = 1; i < arguments.length; i++) {
  18072. var source = arguments[i];
  18073. for (var key in source) {
  18074. if (Object.prototype.hasOwnProperty.call(source, key)) {
  18075. target[key] = source[key];
  18076. }
  18077. }
  18078. }
  18079. return target;
  18080. };
  18081. var inherits = function (subClass, superClass) {
  18082. if (typeof superClass !== "function" && superClass !== null) {
  18083. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  18084. }
  18085. subClass.prototype = Object.create(superClass && superClass.prototype, {
  18086. constructor: {
  18087. value: subClass,
  18088. enumerable: false,
  18089. writable: true,
  18090. configurable: true
  18091. }
  18092. });
  18093. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  18094. };
  18095. var possibleConstructorReturn = function (self, call) {
  18096. if (!self) {
  18097. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  18098. }
  18099. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  18100. };
  18101. var Connector = function () {
  18102. /**
  18103. * Create a new class instance.
  18104. */
  18105. function Connector(options) {
  18106. classCallCheck(this, Connector);
  18107. /**
  18108. * Default connector options.
  18109. */
  18110. this._defaultOptions = {
  18111. auth: {
  18112. headers: {}
  18113. },
  18114. authEndpoint: '/broadcasting/auth',
  18115. broadcaster: 'pusher',
  18116. csrfToken: null,
  18117. host: null,
  18118. key: null,
  18119. namespace: 'App.Events'
  18120. };
  18121. this.setOptions(options);
  18122. this.connect();
  18123. }
  18124. /**
  18125. * Merge the custom options with the defaults.
  18126. */
  18127. createClass(Connector, [{
  18128. key: 'setOptions',
  18129. value: function setOptions(options) {
  18130. this.options = _extends(this._defaultOptions, options);
  18131. if (this.csrfToken()) {
  18132. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  18133. }
  18134. return options;
  18135. }
  18136. /**
  18137. * Extract the CSRF token from the page.
  18138. */
  18139. }, {
  18140. key: 'csrfToken',
  18141. value: function csrfToken() {
  18142. var selector = void 0;
  18143. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  18144. return window['Laravel'].csrfToken;
  18145. } else if (this.options.csrfToken) {
  18146. return this.options.csrfToken;
  18147. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  18148. return selector.getAttribute('content');
  18149. }
  18150. return null;
  18151. }
  18152. }]);
  18153. return Connector;
  18154. }();
  18155. /**
  18156. * This class represents a basic channel.
  18157. */
  18158. var Channel = function () {
  18159. function Channel() {
  18160. classCallCheck(this, Channel);
  18161. }
  18162. createClass(Channel, [{
  18163. key: 'listenForWhisper',
  18164. /**
  18165. * Listen for a whisper event on the channel instance.
  18166. */
  18167. value: function listenForWhisper(event, callback) {
  18168. return this.listen('.client-' + event, callback);
  18169. }
  18170. /**
  18171. * Listen for an event on the channel instance.
  18172. */
  18173. }, {
  18174. key: 'notification',
  18175. value: function notification(callback) {
  18176. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  18177. }
  18178. /**
  18179. * Stop listening for a whispser event on the channel instance.
  18180. */
  18181. }, {
  18182. key: 'stopListeningForWhisper',
  18183. value: function stopListeningForWhisper(event) {
  18184. return this.stopListening('.client-' + event);
  18185. }
  18186. }]);
  18187. return Channel;
  18188. }();
  18189. /**
  18190. * Event name formatter
  18191. */
  18192. var EventFormatter = function () {
  18193. /**
  18194. * Create a new class instance.
  18195. */
  18196. function EventFormatter(namespace) {
  18197. classCallCheck(this, EventFormatter);
  18198. this.setNamespace(namespace);
  18199. }
  18200. /**
  18201. * Format the given event name.
  18202. */
  18203. createClass(EventFormatter, [{
  18204. key: 'format',
  18205. value: function format(event) {
  18206. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  18207. return event.substr(1);
  18208. } else if (this.namespace) {
  18209. event = this.namespace + '.' + event;
  18210. }
  18211. return event.replace(/\./g, '\\');
  18212. }
  18213. /**
  18214. * Set the event namespace.
  18215. */
  18216. }, {
  18217. key: 'setNamespace',
  18218. value: function setNamespace(value) {
  18219. this.namespace = value;
  18220. }
  18221. }]);
  18222. return EventFormatter;
  18223. }();
  18224. /**
  18225. * This class represents a Pusher channel.
  18226. */
  18227. var PusherChannel = function (_Channel) {
  18228. inherits(PusherChannel, _Channel);
  18229. /**
  18230. * Create a new class instance.
  18231. */
  18232. function PusherChannel(pusher, name, options) {
  18233. classCallCheck(this, PusherChannel);
  18234. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  18235. _this.name = name;
  18236. _this.pusher = pusher;
  18237. _this.options = options;
  18238. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  18239. _this.subscribe();
  18240. return _this;
  18241. }
  18242. /**
  18243. * Subscribe to a Pusher channel.
  18244. */
  18245. createClass(PusherChannel, [{
  18246. key: 'subscribe',
  18247. value: function subscribe() {
  18248. this.subscription = this.pusher.subscribe(this.name);
  18249. }
  18250. /**
  18251. * Unsubscribe from a Pusher channel.
  18252. */
  18253. }, {
  18254. key: 'unsubscribe',
  18255. value: function unsubscribe() {
  18256. this.pusher.unsubscribe(this.name);
  18257. }
  18258. /**
  18259. * Listen for an event on the channel instance.
  18260. */
  18261. }, {
  18262. key: 'listen',
  18263. value: function listen(event, callback) {
  18264. this.on(this.eventFormatter.format(event), callback);
  18265. return this;
  18266. }
  18267. /**
  18268. * Stop listening for an event on the channel instance.
  18269. */
  18270. }, {
  18271. key: 'stopListening',
  18272. value: function stopListening(event) {
  18273. this.subscription.unbind(this.eventFormatter.format(event));
  18274. return this;
  18275. }
  18276. /**
  18277. * Bind a channel to an event.
  18278. */
  18279. }, {
  18280. key: 'on',
  18281. value: function on(event, callback) {
  18282. this.subscription.bind(event, callback);
  18283. return this;
  18284. }
  18285. }]);
  18286. return PusherChannel;
  18287. }(Channel);
  18288. /**
  18289. * This class represents a Pusher private channel.
  18290. */
  18291. var PusherPrivateChannel = function (_PusherChannel) {
  18292. inherits(PusherPrivateChannel, _PusherChannel);
  18293. function PusherPrivateChannel() {
  18294. classCallCheck(this, PusherPrivateChannel);
  18295. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  18296. }
  18297. createClass(PusherPrivateChannel, [{
  18298. key: 'whisper',
  18299. /**
  18300. * Trigger client event on the channel.
  18301. */
  18302. value: function whisper(eventName, data) {
  18303. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  18304. return this;
  18305. }
  18306. }]);
  18307. return PusherPrivateChannel;
  18308. }(PusherChannel);
  18309. /**
  18310. * This class represents a Pusher presence channel.
  18311. */
  18312. var PusherPresenceChannel = function (_PusherChannel) {
  18313. inherits(PusherPresenceChannel, _PusherChannel);
  18314. function PusherPresenceChannel() {
  18315. classCallCheck(this, PusherPresenceChannel);
  18316. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  18317. }
  18318. createClass(PusherPresenceChannel, [{
  18319. key: 'here',
  18320. /**
  18321. * Register a callback to be called anytime the member list changes.
  18322. */
  18323. value: function here(callback) {
  18324. this.on('pusher:subscription_succeeded', function (data) {
  18325. callback(Object.keys(data.members).map(function (k) {
  18326. return data.members[k];
  18327. }));
  18328. });
  18329. return this;
  18330. }
  18331. /**
  18332. * Listen for someone joining the channel.
  18333. */
  18334. }, {
  18335. key: 'joining',
  18336. value: function joining(callback) {
  18337. this.on('pusher:member_added', function (member) {
  18338. callback(member.info);
  18339. });
  18340. return this;
  18341. }
  18342. /**
  18343. * Listen for someone leaving the channel.
  18344. */
  18345. }, {
  18346. key: 'leaving',
  18347. value: function leaving(callback) {
  18348. this.on('pusher:member_removed', function (member) {
  18349. callback(member.info);
  18350. });
  18351. return this;
  18352. }
  18353. /**
  18354. * Trigger client event on the channel.
  18355. */
  18356. }, {
  18357. key: 'whisper',
  18358. value: function whisper(eventName, data) {
  18359. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  18360. return this;
  18361. }
  18362. }]);
  18363. return PusherPresenceChannel;
  18364. }(PusherChannel);
  18365. /**
  18366. * This class represents a Socket.io channel.
  18367. */
  18368. var SocketIoChannel = function (_Channel) {
  18369. inherits(SocketIoChannel, _Channel);
  18370. /**
  18371. * Create a new class instance.
  18372. */
  18373. function SocketIoChannel(socket, name, options) {
  18374. classCallCheck(this, SocketIoChannel);
  18375. /**
  18376. * The event callbacks applied to the channel.
  18377. */
  18378. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  18379. _this.events = {};
  18380. _this.name = name;
  18381. _this.socket = socket;
  18382. _this.options = options;
  18383. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  18384. _this.subscribe();
  18385. _this.configureReconnector();
  18386. return _this;
  18387. }
  18388. /**
  18389. * Subscribe to a Socket.io channel.
  18390. */
  18391. createClass(SocketIoChannel, [{
  18392. key: 'subscribe',
  18393. value: function subscribe() {
  18394. this.socket.emit('subscribe', {
  18395. channel: this.name,
  18396. auth: this.options.auth || {}
  18397. });
  18398. }
  18399. /**
  18400. * Unsubscribe from channel and ubind event callbacks.
  18401. */
  18402. }, {
  18403. key: 'unsubscribe',
  18404. value: function unsubscribe() {
  18405. this.unbind();
  18406. this.socket.emit('unsubscribe', {
  18407. channel: this.name,
  18408. auth: this.options.auth || {}
  18409. });
  18410. }
  18411. /**
  18412. * Listen for an event on the channel instance.
  18413. */
  18414. }, {
  18415. key: 'listen',
  18416. value: function listen(event, callback) {
  18417. this.on(this.eventFormatter.format(event), callback);
  18418. return this;
  18419. }
  18420. /**
  18421. * Stop listening for an event on the channel instance.
  18422. */
  18423. }, {
  18424. key: 'stopListening',
  18425. value: function stopListening(event) {
  18426. var name = this.eventFormatter.format(event);
  18427. this.socket.removeListener(name);
  18428. delete this.events[name];
  18429. return this;
  18430. }
  18431. /**
  18432. * Bind the channel's socket to an event and store the callback.
  18433. */
  18434. }, {
  18435. key: 'on',
  18436. value: function on(event, callback) {
  18437. var _this2 = this;
  18438. var listener = function listener(channel, data) {
  18439. if (_this2.name == channel) {
  18440. callback(data);
  18441. }
  18442. };
  18443. this.socket.on(event, listener);
  18444. this.bind(event, listener);
  18445. }
  18446. /**
  18447. * Attach a 'reconnect' listener and bind the event.
  18448. */
  18449. }, {
  18450. key: 'configureReconnector',
  18451. value: function configureReconnector() {
  18452. var _this3 = this;
  18453. var listener = function listener() {
  18454. _this3.subscribe();
  18455. };
  18456. this.socket.on('reconnect', listener);
  18457. this.bind('reconnect', listener);
  18458. }
  18459. /**
  18460. * Bind the channel's socket to an event and store the callback.
  18461. */
  18462. }, {
  18463. key: 'bind',
  18464. value: function bind(event, callback) {
  18465. this.events[event] = this.events[event] || [];
  18466. this.events[event].push(callback);
  18467. }
  18468. /**
  18469. * Unbind the channel's socket from all stored event callbacks.
  18470. */
  18471. }, {
  18472. key: 'unbind',
  18473. value: function unbind() {
  18474. var _this4 = this;
  18475. Object.keys(this.events).forEach(function (event) {
  18476. _this4.events[event].forEach(function (callback) {
  18477. _this4.socket.removeListener(event, callback);
  18478. });
  18479. delete _this4.events[event];
  18480. });
  18481. }
  18482. }]);
  18483. return SocketIoChannel;
  18484. }(Channel);
  18485. /**
  18486. * This class represents a Socket.io presence channel.
  18487. */
  18488. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  18489. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  18490. function SocketIoPrivateChannel() {
  18491. classCallCheck(this, SocketIoPrivateChannel);
  18492. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  18493. }
  18494. createClass(SocketIoPrivateChannel, [{
  18495. key: 'whisper',
  18496. /**
  18497. * Trigger client event on the channel.
  18498. */
  18499. value: function whisper(eventName, data) {
  18500. this.socket.emit('client event', {
  18501. channel: this.name,
  18502. event: 'client-' + eventName,
  18503. data: data
  18504. });
  18505. return this;
  18506. }
  18507. }]);
  18508. return SocketIoPrivateChannel;
  18509. }(SocketIoChannel);
  18510. /**
  18511. * This class represents a Socket.io presence channel.
  18512. */
  18513. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  18514. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  18515. function SocketIoPresenceChannel() {
  18516. classCallCheck(this, SocketIoPresenceChannel);
  18517. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  18518. }
  18519. createClass(SocketIoPresenceChannel, [{
  18520. key: 'here',
  18521. /**
  18522. * Register a callback to be called anytime the member list changes.
  18523. */
  18524. value: function here(callback) {
  18525. this.on('presence:subscribed', function (members) {
  18526. callback(members.map(function (m) {
  18527. return m.user_info;
  18528. }));
  18529. });
  18530. return this;
  18531. }
  18532. /**
  18533. * Listen for someone joining the channel.
  18534. */
  18535. }, {
  18536. key: 'joining',
  18537. value: function joining(callback) {
  18538. this.on('presence:joining', function (member) {
  18539. return callback(member.user_info);
  18540. });
  18541. return this;
  18542. }
  18543. /**
  18544. * Listen for someone leaving the channel.
  18545. */
  18546. }, {
  18547. key: 'leaving',
  18548. value: function leaving(callback) {
  18549. this.on('presence:leaving', function (member) {
  18550. return callback(member.user_info);
  18551. });
  18552. return this;
  18553. }
  18554. }]);
  18555. return SocketIoPresenceChannel;
  18556. }(SocketIoPrivateChannel);
  18557. /**
  18558. * This class represents a null channel.
  18559. */
  18560. var NullChannel = function (_Channel) {
  18561. inherits(NullChannel, _Channel);
  18562. function NullChannel() {
  18563. classCallCheck(this, NullChannel);
  18564. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  18565. }
  18566. createClass(NullChannel, [{
  18567. key: 'subscribe',
  18568. /**
  18569. * Subscribe to a channel.
  18570. */
  18571. value: function subscribe() {}
  18572. //
  18573. /**
  18574. * Unsubscribe from a channel.
  18575. */
  18576. }, {
  18577. key: 'unsubscribe',
  18578. value: function unsubscribe() {}
  18579. //
  18580. /**
  18581. * Listen for an event on the channel instance.
  18582. */
  18583. }, {
  18584. key: 'listen',
  18585. value: function listen(event, callback) {
  18586. return this;
  18587. }
  18588. /**
  18589. * Stop listening for an event on the channel instance.
  18590. */
  18591. }, {
  18592. key: 'stopListening',
  18593. value: function stopListening(event) {
  18594. return this;
  18595. }
  18596. /**
  18597. * Bind a channel to an event.
  18598. */
  18599. }, {
  18600. key: 'on',
  18601. value: function on(event, callback) {
  18602. return this;
  18603. }
  18604. }]);
  18605. return NullChannel;
  18606. }(Channel);
  18607. /**
  18608. * This class represents a null private channel.
  18609. */
  18610. var NullPrivateChannel = function (_NullChannel) {
  18611. inherits(NullPrivateChannel, _NullChannel);
  18612. function NullPrivateChannel() {
  18613. classCallCheck(this, NullPrivateChannel);
  18614. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  18615. }
  18616. createClass(NullPrivateChannel, [{
  18617. key: 'whisper',
  18618. /**
  18619. * Trigger client event on the channel.
  18620. */
  18621. value: function whisper(eventName, data) {
  18622. return this;
  18623. }
  18624. }]);
  18625. return NullPrivateChannel;
  18626. }(NullChannel);
  18627. /**
  18628. * This class represents a null presence channel.
  18629. */
  18630. var NullPresenceChannel = function (_NullChannel) {
  18631. inherits(NullPresenceChannel, _NullChannel);
  18632. function NullPresenceChannel() {
  18633. classCallCheck(this, NullPresenceChannel);
  18634. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  18635. }
  18636. createClass(NullPresenceChannel, [{
  18637. key: 'here',
  18638. /**
  18639. * Register a callback to be called anytime the member list changes.
  18640. */
  18641. value: function here(callback) {
  18642. return this;
  18643. }
  18644. /**
  18645. * Listen for someone joining the channel.
  18646. */
  18647. }, {
  18648. key: 'joining',
  18649. value: function joining(callback) {
  18650. return this;
  18651. }
  18652. /**
  18653. * Listen for someone leaving the channel.
  18654. */
  18655. }, {
  18656. key: 'leaving',
  18657. value: function leaving(callback) {
  18658. return this;
  18659. }
  18660. /**
  18661. * Trigger client event on the channel.
  18662. */
  18663. }, {
  18664. key: 'whisper',
  18665. value: function whisper(eventName, data) {
  18666. return this;
  18667. }
  18668. }]);
  18669. return NullPresenceChannel;
  18670. }(NullChannel);
  18671. /**
  18672. * This class creates a connector to Pusher.
  18673. */
  18674. var PusherConnector = function (_Connector) {
  18675. inherits(PusherConnector, _Connector);
  18676. function PusherConnector() {
  18677. classCallCheck(this, PusherConnector);
  18678. /**
  18679. * All of the subscribed channel names.
  18680. */
  18681. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  18682. _this.channels = {};
  18683. return _this;
  18684. }
  18685. /**
  18686. * Create a fresh Pusher connection.
  18687. */
  18688. createClass(PusherConnector, [{
  18689. key: 'connect',
  18690. value: function connect() {
  18691. if (typeof this.options.client !== 'undefined') {
  18692. this.pusher = this.options.client;
  18693. } else {
  18694. this.pusher = new Pusher(this.options.key, this.options);
  18695. }
  18696. }
  18697. /**
  18698. * Listen for an event on a channel instance.
  18699. */
  18700. }, {
  18701. key: 'listen',
  18702. value: function listen(name, event, callback) {
  18703. return this.channel(name).listen(event, callback);
  18704. }
  18705. /**
  18706. * Get a channel instance by name.
  18707. */
  18708. }, {
  18709. key: 'channel',
  18710. value: function channel(name) {
  18711. if (!this.channels[name]) {
  18712. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  18713. }
  18714. return this.channels[name];
  18715. }
  18716. /**
  18717. * Get a private channel instance by name.
  18718. */
  18719. }, {
  18720. key: 'privateChannel',
  18721. value: function privateChannel(name) {
  18722. if (!this.channels['private-' + name]) {
  18723. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  18724. }
  18725. return this.channels['private-' + name];
  18726. }
  18727. /**
  18728. * Get a presence channel instance by name.
  18729. */
  18730. }, {
  18731. key: 'presenceChannel',
  18732. value: function presenceChannel(name) {
  18733. if (!this.channels['presence-' + name]) {
  18734. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  18735. }
  18736. return this.channels['presence-' + name];
  18737. }
  18738. /**
  18739. * Leave the given channel, as well as its private and presence variants.
  18740. */
  18741. }, {
  18742. key: 'leave',
  18743. value: function leave(name) {
  18744. var _this2 = this;
  18745. var channels = [name, 'private-' + name, 'presence-' + name];
  18746. channels.forEach(function (name, index) {
  18747. _this2.leaveChannel(name);
  18748. });
  18749. }
  18750. /**
  18751. * Leave the given channel.
  18752. */
  18753. }, {
  18754. key: 'leaveChannel',
  18755. value: function leaveChannel(name) {
  18756. if (this.channels[name]) {
  18757. this.channels[name].unsubscribe();
  18758. delete this.channels[name];
  18759. }
  18760. }
  18761. /**
  18762. * Get the socket ID for the connection.
  18763. */
  18764. }, {
  18765. key: 'socketId',
  18766. value: function socketId() {
  18767. return this.pusher.connection.socket_id;
  18768. }
  18769. /**
  18770. * Disconnect Pusher connection.
  18771. */
  18772. }, {
  18773. key: 'disconnect',
  18774. value: function disconnect() {
  18775. this.pusher.disconnect();
  18776. }
  18777. }]);
  18778. return PusherConnector;
  18779. }(Connector);
  18780. /**
  18781. * This class creates a connnector to a Socket.io server.
  18782. */
  18783. var SocketIoConnector = function (_Connector) {
  18784. inherits(SocketIoConnector, _Connector);
  18785. function SocketIoConnector() {
  18786. classCallCheck(this, SocketIoConnector);
  18787. /**
  18788. * All of the subscribed channel names.
  18789. */
  18790. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18791. _this.channels = {};
  18792. return _this;
  18793. }
  18794. /**
  18795. * Create a fresh Socket.io connection.
  18796. */
  18797. createClass(SocketIoConnector, [{
  18798. key: 'connect',
  18799. value: function connect() {
  18800. var io = this.getSocketIO();
  18801. this.socket = io(this.options.host, this.options);
  18802. return this.socket;
  18803. }
  18804. /**
  18805. * Get socket.io module from global scope or options.
  18806. */
  18807. }, {
  18808. key: 'getSocketIO',
  18809. value: function getSocketIO() {
  18810. if (typeof this.options.client !== 'undefined') {
  18811. return this.options.client;
  18812. }
  18813. if (typeof io !== 'undefined') {
  18814. return io;
  18815. }
  18816. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18817. }
  18818. /**
  18819. * Listen for an event on a channel instance.
  18820. */
  18821. }, {
  18822. key: 'listen',
  18823. value: function listen(name, event, callback) {
  18824. return this.channel(name).listen(event, callback);
  18825. }
  18826. /**
  18827. * Get a channel instance by name.
  18828. */
  18829. }, {
  18830. key: 'channel',
  18831. value: function channel(name) {
  18832. if (!this.channels[name]) {
  18833. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18834. }
  18835. return this.channels[name];
  18836. }
  18837. /**
  18838. * Get a private channel instance by name.
  18839. */
  18840. }, {
  18841. key: 'privateChannel',
  18842. value: function privateChannel(name) {
  18843. if (!this.channels['private-' + name]) {
  18844. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18845. }
  18846. return this.channels['private-' + name];
  18847. }
  18848. /**
  18849. * Get a presence channel instance by name.
  18850. */
  18851. }, {
  18852. key: 'presenceChannel',
  18853. value: function presenceChannel(name) {
  18854. if (!this.channels['presence-' + name]) {
  18855. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18856. }
  18857. return this.channels['presence-' + name];
  18858. }
  18859. /**
  18860. * Leave the given channel, as well as its private and presence variants.
  18861. */
  18862. }, {
  18863. key: 'leave',
  18864. value: function leave(name) {
  18865. var _this2 = this;
  18866. var channels = [name, 'private-' + name, 'presence-' + name];
  18867. channels.forEach(function (name) {
  18868. _this2.leaveChannel(name);
  18869. });
  18870. }
  18871. /**
  18872. * Leave the given channel.
  18873. */
  18874. }, {
  18875. key: 'leaveChannel',
  18876. value: function leaveChannel(name) {
  18877. if (this.channels[name]) {
  18878. this.channels[name].unsubscribe();
  18879. delete this.channels[name];
  18880. }
  18881. }
  18882. /**
  18883. * Get the socket ID for the connection.
  18884. */
  18885. }, {
  18886. key: 'socketId',
  18887. value: function socketId() {
  18888. return this.socket.id;
  18889. }
  18890. /**
  18891. * Disconnect Socketio connection.
  18892. */
  18893. }, {
  18894. key: 'disconnect',
  18895. value: function disconnect() {
  18896. this.socket.disconnect();
  18897. }
  18898. }]);
  18899. return SocketIoConnector;
  18900. }(Connector);
  18901. /**
  18902. * This class creates a null connector.
  18903. */
  18904. var NullConnector = function (_Connector) {
  18905. inherits(NullConnector, _Connector);
  18906. function NullConnector() {
  18907. classCallCheck(this, NullConnector);
  18908. /**
  18909. * All of the subscribed channel names.
  18910. */
  18911. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18912. _this.channels = {};
  18913. return _this;
  18914. }
  18915. /**
  18916. * Create a fresh connection.
  18917. */
  18918. createClass(NullConnector, [{
  18919. key: 'connect',
  18920. value: function connect() {}
  18921. //
  18922. /**
  18923. * Listen for an event on a channel instance.
  18924. */
  18925. }, {
  18926. key: 'listen',
  18927. value: function listen(name, event, callback) {
  18928. return new NullChannel();
  18929. }
  18930. /**
  18931. * Get a channel instance by name.
  18932. */
  18933. }, {
  18934. key: 'channel',
  18935. value: function channel(name) {
  18936. return new NullChannel();
  18937. }
  18938. /**
  18939. * Get a private channel instance by name.
  18940. */
  18941. }, {
  18942. key: 'privateChannel',
  18943. value: function privateChannel(name) {
  18944. return new NullPrivateChannel();
  18945. }
  18946. /**
  18947. * Get a presence channel instance by name.
  18948. */
  18949. }, {
  18950. key: 'presenceChannel',
  18951. value: function presenceChannel(name) {
  18952. return new NullPresenceChannel();
  18953. }
  18954. /**
  18955. * Leave the given channel, as well as its private and presence variants.
  18956. */
  18957. }, {
  18958. key: 'leave',
  18959. value: function leave(name) {}
  18960. //
  18961. /**
  18962. * Leave the given channel.
  18963. */
  18964. }, {
  18965. key: 'leaveChannel',
  18966. value: function leaveChannel(name) {}
  18967. //
  18968. /**
  18969. * Get the socket ID for the connection.
  18970. */
  18971. }, {
  18972. key: 'socketId',
  18973. value: function socketId() {
  18974. return 'fake-socket-id';
  18975. }
  18976. /**
  18977. * Disconnect the connection.
  18978. */
  18979. }, {
  18980. key: 'disconnect',
  18981. value: function disconnect() {
  18982. //
  18983. }
  18984. }]);
  18985. return NullConnector;
  18986. }(Connector);
  18987. /**
  18988. * This class is the primary API for interacting with broadcasting.
  18989. */
  18990. var Echo = function () {
  18991. /**
  18992. * Create a new class instance.
  18993. */
  18994. function Echo(options) {
  18995. classCallCheck(this, Echo);
  18996. this.options = options;
  18997. this.connect();
  18998. if (!this.options.withoutInterceptors) {
  18999. this.registerInterceptors();
  19000. }
  19001. }
  19002. /**
  19003. * Get a channel instance by name.
  19004. */
  19005. createClass(Echo, [{
  19006. key: 'channel',
  19007. value: function channel(_channel) {
  19008. return this.connector.channel(_channel);
  19009. }
  19010. /**
  19011. * Create a new connection.
  19012. */
  19013. }, {
  19014. key: 'connect',
  19015. value: function connect() {
  19016. if (this.options.broadcaster == 'pusher') {
  19017. this.connector = new PusherConnector(this.options);
  19018. } else if (this.options.broadcaster == 'socket.io') {
  19019. this.connector = new SocketIoConnector(this.options);
  19020. } else if (this.options.broadcaster == 'null') {
  19021. this.connector = new NullConnector(this.options);
  19022. } else if (typeof this.options.broadcaster == 'function') {
  19023. this.connector = new this.options.broadcaster(this.options);
  19024. }
  19025. }
  19026. /**
  19027. * Disconnect from the Echo server.
  19028. */
  19029. }, {
  19030. key: 'disconnect',
  19031. value: function disconnect() {
  19032. this.connector.disconnect();
  19033. }
  19034. /**
  19035. * Get a presence channel instance by name.
  19036. */
  19037. }, {
  19038. key: 'join',
  19039. value: function join(channel) {
  19040. return this.connector.presenceChannel(channel);
  19041. }
  19042. /**
  19043. * Leave the given channel, as well as its private and presence variants.
  19044. */
  19045. }, {
  19046. key: 'leave',
  19047. value: function leave(channel) {
  19048. this.connector.leave(channel);
  19049. }
  19050. /**
  19051. * Leave the given channel.
  19052. */
  19053. }, {
  19054. key: 'leaveChannel',
  19055. value: function leaveChannel(channel) {
  19056. this.connector.leaveChannel(channel);
  19057. }
  19058. /**
  19059. * Listen for an event on a channel instance.
  19060. */
  19061. }, {
  19062. key: 'listen',
  19063. value: function listen(channel, event, callback) {
  19064. return this.connector.listen(channel, event, callback);
  19065. }
  19066. /**
  19067. * Get a private channel instance by name.
  19068. */
  19069. }, {
  19070. key: 'private',
  19071. value: function _private(channel) {
  19072. return this.connector.privateChannel(channel);
  19073. }
  19074. /**
  19075. * Get the Socket ID for the connection.
  19076. */
  19077. }, {
  19078. key: 'socketId',
  19079. value: function socketId() {
  19080. return this.connector.socketId();
  19081. }
  19082. /**
  19083. * Register 3rd party request interceptiors. These are used to automatically
  19084. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  19085. */
  19086. }, {
  19087. key: 'registerInterceptors',
  19088. value: function registerInterceptors() {
  19089. if (typeof Vue === 'function' && Vue.http) {
  19090. this.registerVueRequestInterceptor();
  19091. }
  19092. if (typeof axios === 'function') {
  19093. this.registerAxiosRequestInterceptor();
  19094. }
  19095. if (typeof jQuery === 'function') {
  19096. this.registerjQueryAjaxSetup();
  19097. }
  19098. }
  19099. /**
  19100. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  19101. */
  19102. }, {
  19103. key: 'registerVueRequestInterceptor',
  19104. value: function registerVueRequestInterceptor() {
  19105. var _this = this;
  19106. Vue.http.interceptors.push(function (request, next) {
  19107. if (_this.socketId()) {
  19108. request.headers.set('X-Socket-ID', _this.socketId());
  19109. }
  19110. next();
  19111. });
  19112. }
  19113. /**
  19114. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  19115. */
  19116. }, {
  19117. key: 'registerAxiosRequestInterceptor',
  19118. value: function registerAxiosRequestInterceptor() {
  19119. var _this2 = this;
  19120. axios.interceptors.request.use(function (config) {
  19121. if (_this2.socketId()) {
  19122. config.headers['X-Socket-Id'] = _this2.socketId();
  19123. }
  19124. return config;
  19125. });
  19126. }
  19127. /**
  19128. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  19129. */
  19130. }, {
  19131. key: 'registerjQueryAjaxSetup',
  19132. value: function registerjQueryAjaxSetup() {
  19133. var _this3 = this;
  19134. if (typeof jQuery.ajax != 'undefined') {
  19135. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  19136. if (_this3.socketId()) {
  19137. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  19138. }
  19139. });
  19140. }
  19141. }
  19142. }]);
  19143. return Echo;
  19144. }();
  19145. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  19146. /***/ }),
  19147. /***/ "./node_modules/lodash/lodash.js":
  19148. /*!***************************************!*\
  19149. !*** ./node_modules/lodash/lodash.js ***!
  19150. \***************************************/
  19151. /*! no static exports found */
  19152. /***/ (function(module, exports, __webpack_require__) {
  19153. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  19154. * @license
  19155. * Lodash <https://lodash.com/>
  19156. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  19157. * Released under MIT license <https://lodash.com/license>
  19158. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  19159. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  19160. */
  19161. ;(function() {
  19162. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  19163. var undefined;
  19164. /** Used as the semantic version number. */
  19165. var VERSION = '4.17.15';
  19166. /** Used as the size to enable large array optimizations. */
  19167. var LARGE_ARRAY_SIZE = 200;
  19168. /** Error message constants. */
  19169. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  19170. FUNC_ERROR_TEXT = 'Expected a function';
  19171. /** Used to stand-in for `undefined` hash values. */
  19172. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  19173. /** Used as the maximum memoize cache size. */
  19174. var MAX_MEMOIZE_SIZE = 500;
  19175. /** Used as the internal argument placeholder. */
  19176. var PLACEHOLDER = '__lodash_placeholder__';
  19177. /** Used to compose bitmasks for cloning. */
  19178. var CLONE_DEEP_FLAG = 1,
  19179. CLONE_FLAT_FLAG = 2,
  19180. CLONE_SYMBOLS_FLAG = 4;
  19181. /** Used to compose bitmasks for value comparisons. */
  19182. var COMPARE_PARTIAL_FLAG = 1,
  19183. COMPARE_UNORDERED_FLAG = 2;
  19184. /** Used to compose bitmasks for function metadata. */
  19185. var WRAP_BIND_FLAG = 1,
  19186. WRAP_BIND_KEY_FLAG = 2,
  19187. WRAP_CURRY_BOUND_FLAG = 4,
  19188. WRAP_CURRY_FLAG = 8,
  19189. WRAP_CURRY_RIGHT_FLAG = 16,
  19190. WRAP_PARTIAL_FLAG = 32,
  19191. WRAP_PARTIAL_RIGHT_FLAG = 64,
  19192. WRAP_ARY_FLAG = 128,
  19193. WRAP_REARG_FLAG = 256,
  19194. WRAP_FLIP_FLAG = 512;
  19195. /** Used as default options for `_.truncate`. */
  19196. var DEFAULT_TRUNC_LENGTH = 30,
  19197. DEFAULT_TRUNC_OMISSION = '...';
  19198. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  19199. var HOT_COUNT = 800,
  19200. HOT_SPAN = 16;
  19201. /** Used to indicate the type of lazy iteratees. */
  19202. var LAZY_FILTER_FLAG = 1,
  19203. LAZY_MAP_FLAG = 2,
  19204. LAZY_WHILE_FLAG = 3;
  19205. /** Used as references for various `Number` constants. */
  19206. var INFINITY = 1 / 0,
  19207. MAX_SAFE_INTEGER = 9007199254740991,
  19208. MAX_INTEGER = 1.7976931348623157e+308,
  19209. NAN = 0 / 0;
  19210. /** Used as references for the maximum length and index of an array. */
  19211. var MAX_ARRAY_LENGTH = 4294967295,
  19212. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  19213. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  19214. /** Used to associate wrap methods with their bit flags. */
  19215. var wrapFlags = [
  19216. ['ary', WRAP_ARY_FLAG],
  19217. ['bind', WRAP_BIND_FLAG],
  19218. ['bindKey', WRAP_BIND_KEY_FLAG],
  19219. ['curry', WRAP_CURRY_FLAG],
  19220. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  19221. ['flip', WRAP_FLIP_FLAG],
  19222. ['partial', WRAP_PARTIAL_FLAG],
  19223. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  19224. ['rearg', WRAP_REARG_FLAG]
  19225. ];
  19226. /** `Object#toString` result references. */
  19227. var argsTag = '[object Arguments]',
  19228. arrayTag = '[object Array]',
  19229. asyncTag = '[object AsyncFunction]',
  19230. boolTag = '[object Boolean]',
  19231. dateTag = '[object Date]',
  19232. domExcTag = '[object DOMException]',
  19233. errorTag = '[object Error]',
  19234. funcTag = '[object Function]',
  19235. genTag = '[object GeneratorFunction]',
  19236. mapTag = '[object Map]',
  19237. numberTag = '[object Number]',
  19238. nullTag = '[object Null]',
  19239. objectTag = '[object Object]',
  19240. promiseTag = '[object Promise]',
  19241. proxyTag = '[object Proxy]',
  19242. regexpTag = '[object RegExp]',
  19243. setTag = '[object Set]',
  19244. stringTag = '[object String]',
  19245. symbolTag = '[object Symbol]',
  19246. undefinedTag = '[object Undefined]',
  19247. weakMapTag = '[object WeakMap]',
  19248. weakSetTag = '[object WeakSet]';
  19249. var arrayBufferTag = '[object ArrayBuffer]',
  19250. dataViewTag = '[object DataView]',
  19251. float32Tag = '[object Float32Array]',
  19252. float64Tag = '[object Float64Array]',
  19253. int8Tag = '[object Int8Array]',
  19254. int16Tag = '[object Int16Array]',
  19255. int32Tag = '[object Int32Array]',
  19256. uint8Tag = '[object Uint8Array]',
  19257. uint8ClampedTag = '[object Uint8ClampedArray]',
  19258. uint16Tag = '[object Uint16Array]',
  19259. uint32Tag = '[object Uint32Array]';
  19260. /** Used to match empty string literals in compiled template source. */
  19261. var reEmptyStringLeading = /\b__p \+= '';/g,
  19262. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  19263. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  19264. /** Used to match HTML entities and HTML characters. */
  19265. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  19266. reUnescapedHtml = /[&<>"']/g,
  19267. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  19268. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  19269. /** Used to match template delimiters. */
  19270. var reEscape = /<%-([\s\S]+?)%>/g,
  19271. reEvaluate = /<%([\s\S]+?)%>/g,
  19272. reInterpolate = /<%=([\s\S]+?)%>/g;
  19273. /** Used to match property names within property paths. */
  19274. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  19275. reIsPlainProp = /^\w*$/,
  19276. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  19277. /**
  19278. * Used to match `RegExp`
  19279. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  19280. */
  19281. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  19282. reHasRegExpChar = RegExp(reRegExpChar.source);
  19283. /** Used to match leading and trailing whitespace. */
  19284. var reTrim = /^\s+|\s+$/g,
  19285. reTrimStart = /^\s+/,
  19286. reTrimEnd = /\s+$/;
  19287. /** Used to match wrap detail comments. */
  19288. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  19289. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  19290. reSplitDetails = /,? & /;
  19291. /** Used to match words composed of alphanumeric characters. */
  19292. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  19293. /** Used to match backslashes in property paths. */
  19294. var reEscapeChar = /\\(\\)?/g;
  19295. /**
  19296. * Used to match
  19297. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  19298. */
  19299. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  19300. /** Used to match `RegExp` flags from their coerced string values. */
  19301. var reFlags = /\w*$/;
  19302. /** Used to detect bad signed hexadecimal string values. */
  19303. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  19304. /** Used to detect binary string values. */
  19305. var reIsBinary = /^0b[01]+$/i;
  19306. /** Used to detect host constructors (Safari). */
  19307. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  19308. /** Used to detect octal string values. */
  19309. var reIsOctal = /^0o[0-7]+$/i;
  19310. /** Used to detect unsigned integer values. */
  19311. var reIsUint = /^(?:0|[1-9]\d*)$/;
  19312. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  19313. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  19314. /** Used to ensure capturing order of template delimiters. */
  19315. var reNoMatch = /($^)/;
  19316. /** Used to match unescaped characters in compiled string literals. */
  19317. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  19318. /** Used to compose unicode character classes. */
  19319. var rsAstralRange = '\\ud800-\\udfff',
  19320. rsComboMarksRange = '\\u0300-\\u036f',
  19321. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  19322. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  19323. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  19324. rsDingbatRange = '\\u2700-\\u27bf',
  19325. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  19326. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  19327. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  19328. rsPunctuationRange = '\\u2000-\\u206f',
  19329. 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',
  19330. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  19331. rsVarRange = '\\ufe0e\\ufe0f',
  19332. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  19333. /** Used to compose unicode capture groups. */
  19334. var rsApos = "['\u2019]",
  19335. rsAstral = '[' + rsAstralRange + ']',
  19336. rsBreak = '[' + rsBreakRange + ']',
  19337. rsCombo = '[' + rsComboRange + ']',
  19338. rsDigits = '\\d+',
  19339. rsDingbat = '[' + rsDingbatRange + ']',
  19340. rsLower = '[' + rsLowerRange + ']',
  19341. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  19342. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  19343. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  19344. rsNonAstral = '[^' + rsAstralRange + ']',
  19345. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  19346. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  19347. rsUpper = '[' + rsUpperRange + ']',
  19348. rsZWJ = '\\u200d';
  19349. /** Used to compose unicode regexes. */
  19350. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  19351. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  19352. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  19353. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  19354. reOptMod = rsModifier + '?',
  19355. rsOptVar = '[' + rsVarRange + ']?',
  19356. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  19357. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  19358. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  19359. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  19360. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  19361. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  19362. /** Used to match apostrophes. */
  19363. var reApos = RegExp(rsApos, 'g');
  19364. /**
  19365. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  19366. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  19367. */
  19368. var reComboMark = RegExp(rsCombo, 'g');
  19369. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  19370. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  19371. /** Used to match complex or compound words. */
  19372. var reUnicodeWord = RegExp([
  19373. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  19374. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  19375. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  19376. rsUpper + '+' + rsOptContrUpper,
  19377. rsOrdUpper,
  19378. rsOrdLower,
  19379. rsDigits,
  19380. rsEmoji
  19381. ].join('|'), 'g');
  19382. /** 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/). */
  19383. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  19384. /** Used to detect strings that need a more robust regexp to match words. */
  19385. 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 ]/;
  19386. /** Used to assign default `context` object properties. */
  19387. var contextProps = [
  19388. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  19389. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  19390. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  19391. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  19392. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  19393. ];
  19394. /** Used to make template sourceURLs easier to identify. */
  19395. var templateCounter = -1;
  19396. /** Used to identify `toStringTag` values of typed arrays. */
  19397. var typedArrayTags = {};
  19398. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  19399. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  19400. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  19401. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  19402. typedArrayTags[uint32Tag] = true;
  19403. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  19404. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  19405. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  19406. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  19407. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  19408. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  19409. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  19410. typedArrayTags[weakMapTag] = false;
  19411. /** Used to identify `toStringTag` values supported by `_.clone`. */
  19412. var cloneableTags = {};
  19413. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  19414. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  19415. cloneableTags[boolTag] = cloneableTags[dateTag] =
  19416. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  19417. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  19418. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  19419. cloneableTags[numberTag] = cloneableTags[objectTag] =
  19420. cloneableTags[regexpTag] = cloneableTags[setTag] =
  19421. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  19422. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  19423. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  19424. cloneableTags[errorTag] = cloneableTags[funcTag] =
  19425. cloneableTags[weakMapTag] = false;
  19426. /** Used to map Latin Unicode letters to basic Latin letters. */
  19427. var deburredLetters = {
  19428. // Latin-1 Supplement block.
  19429. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  19430. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  19431. '\xc7': 'C', '\xe7': 'c',
  19432. '\xd0': 'D', '\xf0': 'd',
  19433. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  19434. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  19435. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  19436. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  19437. '\xd1': 'N', '\xf1': 'n',
  19438. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  19439. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  19440. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  19441. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  19442. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  19443. '\xc6': 'Ae', '\xe6': 'ae',
  19444. '\xde': 'Th', '\xfe': 'th',
  19445. '\xdf': 'ss',
  19446. // Latin Extended-A block.
  19447. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  19448. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  19449. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  19450. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  19451. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  19452. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  19453. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  19454. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  19455. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  19456. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  19457. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  19458. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  19459. '\u0134': 'J', '\u0135': 'j',
  19460. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  19461. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  19462. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  19463. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  19464. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  19465. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  19466. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  19467. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  19468. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  19469. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  19470. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  19471. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  19472. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  19473. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  19474. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  19475. '\u0174': 'W', '\u0175': 'w',
  19476. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  19477. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  19478. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  19479. '\u0132': 'IJ', '\u0133': 'ij',
  19480. '\u0152': 'Oe', '\u0153': 'oe',
  19481. '\u0149': "'n", '\u017f': 's'
  19482. };
  19483. /** Used to map characters to HTML entities. */
  19484. var htmlEscapes = {
  19485. '&': '&amp;',
  19486. '<': '&lt;',
  19487. '>': '&gt;',
  19488. '"': '&quot;',
  19489. "'": '&#39;'
  19490. };
  19491. /** Used to map HTML entities to characters. */
  19492. var htmlUnescapes = {
  19493. '&amp;': '&',
  19494. '&lt;': '<',
  19495. '&gt;': '>',
  19496. '&quot;': '"',
  19497. '&#39;': "'"
  19498. };
  19499. /** Used to escape characters for inclusion in compiled string literals. */
  19500. var stringEscapes = {
  19501. '\\': '\\',
  19502. "'": "'",
  19503. '\n': 'n',
  19504. '\r': 'r',
  19505. '\u2028': 'u2028',
  19506. '\u2029': 'u2029'
  19507. };
  19508. /** Built-in method references without a dependency on `root`. */
  19509. var freeParseFloat = parseFloat,
  19510. freeParseInt = parseInt;
  19511. /** Detect free variable `global` from Node.js. */
  19512. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  19513. /** Detect free variable `self`. */
  19514. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  19515. /** Used as a reference to the global object. */
  19516. var root = freeGlobal || freeSelf || Function('return this')();
  19517. /** Detect free variable `exports`. */
  19518. var freeExports = true && exports && !exports.nodeType && exports;
  19519. /** Detect free variable `module`. */
  19520. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  19521. /** Detect the popular CommonJS extension `module.exports`. */
  19522. var moduleExports = freeModule && freeModule.exports === freeExports;
  19523. /** Detect free variable `process` from Node.js. */
  19524. var freeProcess = moduleExports && freeGlobal.process;
  19525. /** Used to access faster Node.js helpers. */
  19526. var nodeUtil = (function() {
  19527. try {
  19528. // Use `util.types` for Node.js 10+.
  19529. var types = freeModule && freeModule.require && freeModule.require('util').types;
  19530. if (types) {
  19531. return types;
  19532. }
  19533. // Legacy `process.binding('util')` for Node.js < 10.
  19534. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  19535. } catch (e) {}
  19536. }());
  19537. /* Node.js helper references. */
  19538. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  19539. nodeIsDate = nodeUtil && nodeUtil.isDate,
  19540. nodeIsMap = nodeUtil && nodeUtil.isMap,
  19541. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  19542. nodeIsSet = nodeUtil && nodeUtil.isSet,
  19543. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  19544. /*--------------------------------------------------------------------------*/
  19545. /**
  19546. * A faster alternative to `Function#apply`, this function invokes `func`
  19547. * with the `this` binding of `thisArg` and the arguments of `args`.
  19548. *
  19549. * @private
  19550. * @param {Function} func The function to invoke.
  19551. * @param {*} thisArg The `this` binding of `func`.
  19552. * @param {Array} args The arguments to invoke `func` with.
  19553. * @returns {*} Returns the result of `func`.
  19554. */
  19555. function apply(func, thisArg, args) {
  19556. switch (args.length) {
  19557. case 0: return func.call(thisArg);
  19558. case 1: return func.call(thisArg, args[0]);
  19559. case 2: return func.call(thisArg, args[0], args[1]);
  19560. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  19561. }
  19562. return func.apply(thisArg, args);
  19563. }
  19564. /**
  19565. * A specialized version of `baseAggregator` for arrays.
  19566. *
  19567. * @private
  19568. * @param {Array} [array] The array to iterate over.
  19569. * @param {Function} setter The function to set `accumulator` values.
  19570. * @param {Function} iteratee The iteratee to transform keys.
  19571. * @param {Object} accumulator The initial aggregated object.
  19572. * @returns {Function} Returns `accumulator`.
  19573. */
  19574. function arrayAggregator(array, setter, iteratee, accumulator) {
  19575. var index = -1,
  19576. length = array == null ? 0 : array.length;
  19577. while (++index < length) {
  19578. var value = array[index];
  19579. setter(accumulator, value, iteratee(value), array);
  19580. }
  19581. return accumulator;
  19582. }
  19583. /**
  19584. * A specialized version of `_.forEach` for arrays without support for
  19585. * iteratee shorthands.
  19586. *
  19587. * @private
  19588. * @param {Array} [array] The array to iterate over.
  19589. * @param {Function} iteratee The function invoked per iteration.
  19590. * @returns {Array} Returns `array`.
  19591. */
  19592. function arrayEach(array, iteratee) {
  19593. var index = -1,
  19594. length = array == null ? 0 : array.length;
  19595. while (++index < length) {
  19596. if (iteratee(array[index], index, array) === false) {
  19597. break;
  19598. }
  19599. }
  19600. return array;
  19601. }
  19602. /**
  19603. * A specialized version of `_.forEachRight` for arrays without support for
  19604. * iteratee shorthands.
  19605. *
  19606. * @private
  19607. * @param {Array} [array] The array to iterate over.
  19608. * @param {Function} iteratee The function invoked per iteration.
  19609. * @returns {Array} Returns `array`.
  19610. */
  19611. function arrayEachRight(array, iteratee) {
  19612. var length = array == null ? 0 : array.length;
  19613. while (length--) {
  19614. if (iteratee(array[length], length, array) === false) {
  19615. break;
  19616. }
  19617. }
  19618. return array;
  19619. }
  19620. /**
  19621. * A specialized version of `_.every` for arrays without support for
  19622. * iteratee shorthands.
  19623. *
  19624. * @private
  19625. * @param {Array} [array] The array to iterate over.
  19626. * @param {Function} predicate The function invoked per iteration.
  19627. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  19628. * else `false`.
  19629. */
  19630. function arrayEvery(array, predicate) {
  19631. var index = -1,
  19632. length = array == null ? 0 : array.length;
  19633. while (++index < length) {
  19634. if (!predicate(array[index], index, array)) {
  19635. return false;
  19636. }
  19637. }
  19638. return true;
  19639. }
  19640. /**
  19641. * A specialized version of `_.filter` for arrays without support for
  19642. * iteratee shorthands.
  19643. *
  19644. * @private
  19645. * @param {Array} [array] The array to iterate over.
  19646. * @param {Function} predicate The function invoked per iteration.
  19647. * @returns {Array} Returns the new filtered array.
  19648. */
  19649. function arrayFilter(array, predicate) {
  19650. var index = -1,
  19651. length = array == null ? 0 : array.length,
  19652. resIndex = 0,
  19653. result = [];
  19654. while (++index < length) {
  19655. var value = array[index];
  19656. if (predicate(value, index, array)) {
  19657. result[resIndex++] = value;
  19658. }
  19659. }
  19660. return result;
  19661. }
  19662. /**
  19663. * A specialized version of `_.includes` for arrays without support for
  19664. * specifying an index to search from.
  19665. *
  19666. * @private
  19667. * @param {Array} [array] The array to inspect.
  19668. * @param {*} target The value to search for.
  19669. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19670. */
  19671. function arrayIncludes(array, value) {
  19672. var length = array == null ? 0 : array.length;
  19673. return !!length && baseIndexOf(array, value, 0) > -1;
  19674. }
  19675. /**
  19676. * This function is like `arrayIncludes` except that it accepts a comparator.
  19677. *
  19678. * @private
  19679. * @param {Array} [array] The array to inspect.
  19680. * @param {*} target The value to search for.
  19681. * @param {Function} comparator The comparator invoked per element.
  19682. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  19683. */
  19684. function arrayIncludesWith(array, value, comparator) {
  19685. var index = -1,
  19686. length = array == null ? 0 : array.length;
  19687. while (++index < length) {
  19688. if (comparator(value, array[index])) {
  19689. return true;
  19690. }
  19691. }
  19692. return false;
  19693. }
  19694. /**
  19695. * A specialized version of `_.map` for arrays without support for iteratee
  19696. * shorthands.
  19697. *
  19698. * @private
  19699. * @param {Array} [array] The array to iterate over.
  19700. * @param {Function} iteratee The function invoked per iteration.
  19701. * @returns {Array} Returns the new mapped array.
  19702. */
  19703. function arrayMap(array, iteratee) {
  19704. var index = -1,
  19705. length = array == null ? 0 : array.length,
  19706. result = Array(length);
  19707. while (++index < length) {
  19708. result[index] = iteratee(array[index], index, array);
  19709. }
  19710. return result;
  19711. }
  19712. /**
  19713. * Appends the elements of `values` to `array`.
  19714. *
  19715. * @private
  19716. * @param {Array} array The array to modify.
  19717. * @param {Array} values The values to append.
  19718. * @returns {Array} Returns `array`.
  19719. */
  19720. function arrayPush(array, values) {
  19721. var index = -1,
  19722. length = values.length,
  19723. offset = array.length;
  19724. while (++index < length) {
  19725. array[offset + index] = values[index];
  19726. }
  19727. return array;
  19728. }
  19729. /**
  19730. * A specialized version of `_.reduce` for arrays without support for
  19731. * iteratee shorthands.
  19732. *
  19733. * @private
  19734. * @param {Array} [array] The array to iterate over.
  19735. * @param {Function} iteratee The function invoked per iteration.
  19736. * @param {*} [accumulator] The initial value.
  19737. * @param {boolean} [initAccum] Specify using the first element of `array` as
  19738. * the initial value.
  19739. * @returns {*} Returns the accumulated value.
  19740. */
  19741. function arrayReduce(array, iteratee, accumulator, initAccum) {
  19742. var index = -1,
  19743. length = array == null ? 0 : array.length;
  19744. if (initAccum && length) {
  19745. accumulator = array[++index];
  19746. }
  19747. while (++index < length) {
  19748. accumulator = iteratee(accumulator, array[index], index, array);
  19749. }
  19750. return accumulator;
  19751. }
  19752. /**
  19753. * A specialized version of `_.reduceRight` for arrays without support for
  19754. * iteratee shorthands.
  19755. *
  19756. * @private
  19757. * @param {Array} [array] The array to iterate over.
  19758. * @param {Function} iteratee The function invoked per iteration.
  19759. * @param {*} [accumulator] The initial value.
  19760. * @param {boolean} [initAccum] Specify using the last element of `array` as
  19761. * the initial value.
  19762. * @returns {*} Returns the accumulated value.
  19763. */
  19764. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  19765. var length = array == null ? 0 : array.length;
  19766. if (initAccum && length) {
  19767. accumulator = array[--length];
  19768. }
  19769. while (length--) {
  19770. accumulator = iteratee(accumulator, array[length], length, array);
  19771. }
  19772. return accumulator;
  19773. }
  19774. /**
  19775. * A specialized version of `_.some` for arrays without support for iteratee
  19776. * shorthands.
  19777. *
  19778. * @private
  19779. * @param {Array} [array] The array to iterate over.
  19780. * @param {Function} predicate The function invoked per iteration.
  19781. * @returns {boolean} Returns `true` if any element passes the predicate check,
  19782. * else `false`.
  19783. */
  19784. function arraySome(array, predicate) {
  19785. var index = -1,
  19786. length = array == null ? 0 : array.length;
  19787. while (++index < length) {
  19788. if (predicate(array[index], index, array)) {
  19789. return true;
  19790. }
  19791. }
  19792. return false;
  19793. }
  19794. /**
  19795. * Gets the size of an ASCII `string`.
  19796. *
  19797. * @private
  19798. * @param {string} string The string inspect.
  19799. * @returns {number} Returns the string size.
  19800. */
  19801. var asciiSize = baseProperty('length');
  19802. /**
  19803. * Converts an ASCII `string` to an array.
  19804. *
  19805. * @private
  19806. * @param {string} string The string to convert.
  19807. * @returns {Array} Returns the converted array.
  19808. */
  19809. function asciiToArray(string) {
  19810. return string.split('');
  19811. }
  19812. /**
  19813. * Splits an ASCII `string` into an array of its words.
  19814. *
  19815. * @private
  19816. * @param {string} The string to inspect.
  19817. * @returns {Array} Returns the words of `string`.
  19818. */
  19819. function asciiWords(string) {
  19820. return string.match(reAsciiWord) || [];
  19821. }
  19822. /**
  19823. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19824. * without support for iteratee shorthands, which iterates over `collection`
  19825. * using `eachFunc`.
  19826. *
  19827. * @private
  19828. * @param {Array|Object} collection The collection to inspect.
  19829. * @param {Function} predicate The function invoked per iteration.
  19830. * @param {Function} eachFunc The function to iterate over `collection`.
  19831. * @returns {*} Returns the found element or its key, else `undefined`.
  19832. */
  19833. function baseFindKey(collection, predicate, eachFunc) {
  19834. var result;
  19835. eachFunc(collection, function(value, key, collection) {
  19836. if (predicate(value, key, collection)) {
  19837. result = key;
  19838. return false;
  19839. }
  19840. });
  19841. return result;
  19842. }
  19843. /**
  19844. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19845. * support for iteratee shorthands.
  19846. *
  19847. * @private
  19848. * @param {Array} array The array to inspect.
  19849. * @param {Function} predicate The function invoked per iteration.
  19850. * @param {number} fromIndex The index to search from.
  19851. * @param {boolean} [fromRight] Specify iterating from right to left.
  19852. * @returns {number} Returns the index of the matched value, else `-1`.
  19853. */
  19854. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19855. var length = array.length,
  19856. index = fromIndex + (fromRight ? 1 : -1);
  19857. while ((fromRight ? index-- : ++index < length)) {
  19858. if (predicate(array[index], index, array)) {
  19859. return index;
  19860. }
  19861. }
  19862. return -1;
  19863. }
  19864. /**
  19865. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19866. *
  19867. * @private
  19868. * @param {Array} array The array to inspect.
  19869. * @param {*} value The value to search for.
  19870. * @param {number} fromIndex The index to search from.
  19871. * @returns {number} Returns the index of the matched value, else `-1`.
  19872. */
  19873. function baseIndexOf(array, value, fromIndex) {
  19874. return value === value
  19875. ? strictIndexOf(array, value, fromIndex)
  19876. : baseFindIndex(array, baseIsNaN, fromIndex);
  19877. }
  19878. /**
  19879. * This function is like `baseIndexOf` except that it accepts a comparator.
  19880. *
  19881. * @private
  19882. * @param {Array} array The array to inspect.
  19883. * @param {*} value The value to search for.
  19884. * @param {number} fromIndex The index to search from.
  19885. * @param {Function} comparator The comparator invoked per element.
  19886. * @returns {number} Returns the index of the matched value, else `-1`.
  19887. */
  19888. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19889. var index = fromIndex - 1,
  19890. length = array.length;
  19891. while (++index < length) {
  19892. if (comparator(array[index], value)) {
  19893. return index;
  19894. }
  19895. }
  19896. return -1;
  19897. }
  19898. /**
  19899. * The base implementation of `_.isNaN` without support for number objects.
  19900. *
  19901. * @private
  19902. * @param {*} value The value to check.
  19903. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19904. */
  19905. function baseIsNaN(value) {
  19906. return value !== value;
  19907. }
  19908. /**
  19909. * The base implementation of `_.mean` and `_.meanBy` without support for
  19910. * iteratee shorthands.
  19911. *
  19912. * @private
  19913. * @param {Array} array The array to iterate over.
  19914. * @param {Function} iteratee The function invoked per iteration.
  19915. * @returns {number} Returns the mean.
  19916. */
  19917. function baseMean(array, iteratee) {
  19918. var length = array == null ? 0 : array.length;
  19919. return length ? (baseSum(array, iteratee) / length) : NAN;
  19920. }
  19921. /**
  19922. * The base implementation of `_.property` without support for deep paths.
  19923. *
  19924. * @private
  19925. * @param {string} key The key of the property to get.
  19926. * @returns {Function} Returns the new accessor function.
  19927. */
  19928. function baseProperty(key) {
  19929. return function(object) {
  19930. return object == null ? undefined : object[key];
  19931. };
  19932. }
  19933. /**
  19934. * The base implementation of `_.propertyOf` without support for deep paths.
  19935. *
  19936. * @private
  19937. * @param {Object} object The object to query.
  19938. * @returns {Function} Returns the new accessor function.
  19939. */
  19940. function basePropertyOf(object) {
  19941. return function(key) {
  19942. return object == null ? undefined : object[key];
  19943. };
  19944. }
  19945. /**
  19946. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19947. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19948. *
  19949. * @private
  19950. * @param {Array|Object} collection The collection to iterate over.
  19951. * @param {Function} iteratee The function invoked per iteration.
  19952. * @param {*} accumulator The initial value.
  19953. * @param {boolean} initAccum Specify using the first or last element of
  19954. * `collection` as the initial value.
  19955. * @param {Function} eachFunc The function to iterate over `collection`.
  19956. * @returns {*} Returns the accumulated value.
  19957. */
  19958. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19959. eachFunc(collection, function(value, index, collection) {
  19960. accumulator = initAccum
  19961. ? (initAccum = false, value)
  19962. : iteratee(accumulator, value, index, collection);
  19963. });
  19964. return accumulator;
  19965. }
  19966. /**
  19967. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19968. * sort order of `array` and replaces criteria objects with their corresponding
  19969. * values.
  19970. *
  19971. * @private
  19972. * @param {Array} array The array to sort.
  19973. * @param {Function} comparer The function to define sort order.
  19974. * @returns {Array} Returns `array`.
  19975. */
  19976. function baseSortBy(array, comparer) {
  19977. var length = array.length;
  19978. array.sort(comparer);
  19979. while (length--) {
  19980. array[length] = array[length].value;
  19981. }
  19982. return array;
  19983. }
  19984. /**
  19985. * The base implementation of `_.sum` and `_.sumBy` without support for
  19986. * iteratee shorthands.
  19987. *
  19988. * @private
  19989. * @param {Array} array The array to iterate over.
  19990. * @param {Function} iteratee The function invoked per iteration.
  19991. * @returns {number} Returns the sum.
  19992. */
  19993. function baseSum(array, iteratee) {
  19994. var result,
  19995. index = -1,
  19996. length = array.length;
  19997. while (++index < length) {
  19998. var current = iteratee(array[index]);
  19999. if (current !== undefined) {
  20000. result = result === undefined ? current : (result + current);
  20001. }
  20002. }
  20003. return result;
  20004. }
  20005. /**
  20006. * The base implementation of `_.times` without support for iteratee shorthands
  20007. * or max array length checks.
  20008. *
  20009. * @private
  20010. * @param {number} n The number of times to invoke `iteratee`.
  20011. * @param {Function} iteratee The function invoked per iteration.
  20012. * @returns {Array} Returns the array of results.
  20013. */
  20014. function baseTimes(n, iteratee) {
  20015. var index = -1,
  20016. result = Array(n);
  20017. while (++index < n) {
  20018. result[index] = iteratee(index);
  20019. }
  20020. return result;
  20021. }
  20022. /**
  20023. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  20024. * of key-value pairs for `object` corresponding to the property names of `props`.
  20025. *
  20026. * @private
  20027. * @param {Object} object The object to query.
  20028. * @param {Array} props The property names to get values for.
  20029. * @returns {Object} Returns the key-value pairs.
  20030. */
  20031. function baseToPairs(object, props) {
  20032. return arrayMap(props, function(key) {
  20033. return [key, object[key]];
  20034. });
  20035. }
  20036. /**
  20037. * The base implementation of `_.unary` without support for storing metadata.
  20038. *
  20039. * @private
  20040. * @param {Function} func The function to cap arguments for.
  20041. * @returns {Function} Returns the new capped function.
  20042. */
  20043. function baseUnary(func) {
  20044. return function(value) {
  20045. return func(value);
  20046. };
  20047. }
  20048. /**
  20049. * The base implementation of `_.values` and `_.valuesIn` which creates an
  20050. * array of `object` property values corresponding to the property names
  20051. * of `props`.
  20052. *
  20053. * @private
  20054. * @param {Object} object The object to query.
  20055. * @param {Array} props The property names to get values for.
  20056. * @returns {Object} Returns the array of property values.
  20057. */
  20058. function baseValues(object, props) {
  20059. return arrayMap(props, function(key) {
  20060. return object[key];
  20061. });
  20062. }
  20063. /**
  20064. * Checks if a `cache` value for `key` exists.
  20065. *
  20066. * @private
  20067. * @param {Object} cache The cache to query.
  20068. * @param {string} key The key of the entry to check.
  20069. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20070. */
  20071. function cacheHas(cache, key) {
  20072. return cache.has(key);
  20073. }
  20074. /**
  20075. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  20076. * that is not found in the character symbols.
  20077. *
  20078. * @private
  20079. * @param {Array} strSymbols The string symbols to inspect.
  20080. * @param {Array} chrSymbols The character symbols to find.
  20081. * @returns {number} Returns the index of the first unmatched string symbol.
  20082. */
  20083. function charsStartIndex(strSymbols, chrSymbols) {
  20084. var index = -1,
  20085. length = strSymbols.length;
  20086. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  20087. return index;
  20088. }
  20089. /**
  20090. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  20091. * that is not found in the character symbols.
  20092. *
  20093. * @private
  20094. * @param {Array} strSymbols The string symbols to inspect.
  20095. * @param {Array} chrSymbols The character symbols to find.
  20096. * @returns {number} Returns the index of the last unmatched string symbol.
  20097. */
  20098. function charsEndIndex(strSymbols, chrSymbols) {
  20099. var index = strSymbols.length;
  20100. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  20101. return index;
  20102. }
  20103. /**
  20104. * Gets the number of `placeholder` occurrences in `array`.
  20105. *
  20106. * @private
  20107. * @param {Array} array The array to inspect.
  20108. * @param {*} placeholder The placeholder to search for.
  20109. * @returns {number} Returns the placeholder count.
  20110. */
  20111. function countHolders(array, placeholder) {
  20112. var length = array.length,
  20113. result = 0;
  20114. while (length--) {
  20115. if (array[length] === placeholder) {
  20116. ++result;
  20117. }
  20118. }
  20119. return result;
  20120. }
  20121. /**
  20122. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  20123. * letters to basic Latin letters.
  20124. *
  20125. * @private
  20126. * @param {string} letter The matched letter to deburr.
  20127. * @returns {string} Returns the deburred letter.
  20128. */
  20129. var deburrLetter = basePropertyOf(deburredLetters);
  20130. /**
  20131. * Used by `_.escape` to convert characters to HTML entities.
  20132. *
  20133. * @private
  20134. * @param {string} chr The matched character to escape.
  20135. * @returns {string} Returns the escaped character.
  20136. */
  20137. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  20138. /**
  20139. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  20140. *
  20141. * @private
  20142. * @param {string} chr The matched character to escape.
  20143. * @returns {string} Returns the escaped character.
  20144. */
  20145. function escapeStringChar(chr) {
  20146. return '\\' + stringEscapes[chr];
  20147. }
  20148. /**
  20149. * Gets the value at `key` of `object`.
  20150. *
  20151. * @private
  20152. * @param {Object} [object] The object to query.
  20153. * @param {string} key The key of the property to get.
  20154. * @returns {*} Returns the property value.
  20155. */
  20156. function getValue(object, key) {
  20157. return object == null ? undefined : object[key];
  20158. }
  20159. /**
  20160. * Checks if `string` contains Unicode symbols.
  20161. *
  20162. * @private
  20163. * @param {string} string The string to inspect.
  20164. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  20165. */
  20166. function hasUnicode(string) {
  20167. return reHasUnicode.test(string);
  20168. }
  20169. /**
  20170. * Checks if `string` contains a word composed of Unicode symbols.
  20171. *
  20172. * @private
  20173. * @param {string} string The string to inspect.
  20174. * @returns {boolean} Returns `true` if a word is found, else `false`.
  20175. */
  20176. function hasUnicodeWord(string) {
  20177. return reHasUnicodeWord.test(string);
  20178. }
  20179. /**
  20180. * Converts `iterator` to an array.
  20181. *
  20182. * @private
  20183. * @param {Object} iterator The iterator to convert.
  20184. * @returns {Array} Returns the converted array.
  20185. */
  20186. function iteratorToArray(iterator) {
  20187. var data,
  20188. result = [];
  20189. while (!(data = iterator.next()).done) {
  20190. result.push(data.value);
  20191. }
  20192. return result;
  20193. }
  20194. /**
  20195. * Converts `map` to its key-value pairs.
  20196. *
  20197. * @private
  20198. * @param {Object} map The map to convert.
  20199. * @returns {Array} Returns the key-value pairs.
  20200. */
  20201. function mapToArray(map) {
  20202. var index = -1,
  20203. result = Array(map.size);
  20204. map.forEach(function(value, key) {
  20205. result[++index] = [key, value];
  20206. });
  20207. return result;
  20208. }
  20209. /**
  20210. * Creates a unary function that invokes `func` with its argument transformed.
  20211. *
  20212. * @private
  20213. * @param {Function} func The function to wrap.
  20214. * @param {Function} transform The argument transform.
  20215. * @returns {Function} Returns the new function.
  20216. */
  20217. function overArg(func, transform) {
  20218. return function(arg) {
  20219. return func(transform(arg));
  20220. };
  20221. }
  20222. /**
  20223. * Replaces all `placeholder` elements in `array` with an internal placeholder
  20224. * and returns an array of their indexes.
  20225. *
  20226. * @private
  20227. * @param {Array} array The array to modify.
  20228. * @param {*} placeholder The placeholder to replace.
  20229. * @returns {Array} Returns the new array of placeholder indexes.
  20230. */
  20231. function replaceHolders(array, placeholder) {
  20232. var index = -1,
  20233. length = array.length,
  20234. resIndex = 0,
  20235. result = [];
  20236. while (++index < length) {
  20237. var value = array[index];
  20238. if (value === placeholder || value === PLACEHOLDER) {
  20239. array[index] = PLACEHOLDER;
  20240. result[resIndex++] = index;
  20241. }
  20242. }
  20243. return result;
  20244. }
  20245. /**
  20246. * Converts `set` to an array of its values.
  20247. *
  20248. * @private
  20249. * @param {Object} set The set to convert.
  20250. * @returns {Array} Returns the values.
  20251. */
  20252. function setToArray(set) {
  20253. var index = -1,
  20254. result = Array(set.size);
  20255. set.forEach(function(value) {
  20256. result[++index] = value;
  20257. });
  20258. return result;
  20259. }
  20260. /**
  20261. * Converts `set` to its value-value pairs.
  20262. *
  20263. * @private
  20264. * @param {Object} set The set to convert.
  20265. * @returns {Array} Returns the value-value pairs.
  20266. */
  20267. function setToPairs(set) {
  20268. var index = -1,
  20269. result = Array(set.size);
  20270. set.forEach(function(value) {
  20271. result[++index] = [value, value];
  20272. });
  20273. return result;
  20274. }
  20275. /**
  20276. * A specialized version of `_.indexOf` which performs strict equality
  20277. * comparisons of values, i.e. `===`.
  20278. *
  20279. * @private
  20280. * @param {Array} array The array to inspect.
  20281. * @param {*} value The value to search for.
  20282. * @param {number} fromIndex The index to search from.
  20283. * @returns {number} Returns the index of the matched value, else `-1`.
  20284. */
  20285. function strictIndexOf(array, value, fromIndex) {
  20286. var index = fromIndex - 1,
  20287. length = array.length;
  20288. while (++index < length) {
  20289. if (array[index] === value) {
  20290. return index;
  20291. }
  20292. }
  20293. return -1;
  20294. }
  20295. /**
  20296. * A specialized version of `_.lastIndexOf` which performs strict equality
  20297. * comparisons of values, i.e. `===`.
  20298. *
  20299. * @private
  20300. * @param {Array} array The array to inspect.
  20301. * @param {*} value The value to search for.
  20302. * @param {number} fromIndex The index to search from.
  20303. * @returns {number} Returns the index of the matched value, else `-1`.
  20304. */
  20305. function strictLastIndexOf(array, value, fromIndex) {
  20306. var index = fromIndex + 1;
  20307. while (index--) {
  20308. if (array[index] === value) {
  20309. return index;
  20310. }
  20311. }
  20312. return index;
  20313. }
  20314. /**
  20315. * Gets the number of symbols in `string`.
  20316. *
  20317. * @private
  20318. * @param {string} string The string to inspect.
  20319. * @returns {number} Returns the string size.
  20320. */
  20321. function stringSize(string) {
  20322. return hasUnicode(string)
  20323. ? unicodeSize(string)
  20324. : asciiSize(string);
  20325. }
  20326. /**
  20327. * Converts `string` to an array.
  20328. *
  20329. * @private
  20330. * @param {string} string The string to convert.
  20331. * @returns {Array} Returns the converted array.
  20332. */
  20333. function stringToArray(string) {
  20334. return hasUnicode(string)
  20335. ? unicodeToArray(string)
  20336. : asciiToArray(string);
  20337. }
  20338. /**
  20339. * Used by `_.unescape` to convert HTML entities to characters.
  20340. *
  20341. * @private
  20342. * @param {string} chr The matched character to unescape.
  20343. * @returns {string} Returns the unescaped character.
  20344. */
  20345. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  20346. /**
  20347. * Gets the size of a Unicode `string`.
  20348. *
  20349. * @private
  20350. * @param {string} string The string inspect.
  20351. * @returns {number} Returns the string size.
  20352. */
  20353. function unicodeSize(string) {
  20354. var result = reUnicode.lastIndex = 0;
  20355. while (reUnicode.test(string)) {
  20356. ++result;
  20357. }
  20358. return result;
  20359. }
  20360. /**
  20361. * Converts a Unicode `string` to an array.
  20362. *
  20363. * @private
  20364. * @param {string} string The string to convert.
  20365. * @returns {Array} Returns the converted array.
  20366. */
  20367. function unicodeToArray(string) {
  20368. return string.match(reUnicode) || [];
  20369. }
  20370. /**
  20371. * Splits a Unicode `string` into an array of its words.
  20372. *
  20373. * @private
  20374. * @param {string} The string to inspect.
  20375. * @returns {Array} Returns the words of `string`.
  20376. */
  20377. function unicodeWords(string) {
  20378. return string.match(reUnicodeWord) || [];
  20379. }
  20380. /*--------------------------------------------------------------------------*/
  20381. /**
  20382. * Create a new pristine `lodash` function using the `context` object.
  20383. *
  20384. * @static
  20385. * @memberOf _
  20386. * @since 1.1.0
  20387. * @category Util
  20388. * @param {Object} [context=root] The context object.
  20389. * @returns {Function} Returns a new `lodash` function.
  20390. * @example
  20391. *
  20392. * _.mixin({ 'foo': _.constant('foo') });
  20393. *
  20394. * var lodash = _.runInContext();
  20395. * lodash.mixin({ 'bar': lodash.constant('bar') });
  20396. *
  20397. * _.isFunction(_.foo);
  20398. * // => true
  20399. * _.isFunction(_.bar);
  20400. * // => false
  20401. *
  20402. * lodash.isFunction(lodash.foo);
  20403. * // => false
  20404. * lodash.isFunction(lodash.bar);
  20405. * // => true
  20406. *
  20407. * // Create a suped-up `defer` in Node.js.
  20408. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  20409. */
  20410. var runInContext = (function runInContext(context) {
  20411. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  20412. /** Built-in constructor references. */
  20413. var Array = context.Array,
  20414. Date = context.Date,
  20415. Error = context.Error,
  20416. Function = context.Function,
  20417. Math = context.Math,
  20418. Object = context.Object,
  20419. RegExp = context.RegExp,
  20420. String = context.String,
  20421. TypeError = context.TypeError;
  20422. /** Used for built-in method references. */
  20423. var arrayProto = Array.prototype,
  20424. funcProto = Function.prototype,
  20425. objectProto = Object.prototype;
  20426. /** Used to detect overreaching core-js shims. */
  20427. var coreJsData = context['__core-js_shared__'];
  20428. /** Used to resolve the decompiled source of functions. */
  20429. var funcToString = funcProto.toString;
  20430. /** Used to check objects for own properties. */
  20431. var hasOwnProperty = objectProto.hasOwnProperty;
  20432. /** Used to generate unique IDs. */
  20433. var idCounter = 0;
  20434. /** Used to detect methods masquerading as native. */
  20435. var maskSrcKey = (function() {
  20436. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  20437. return uid ? ('Symbol(src)_1.' + uid) : '';
  20438. }());
  20439. /**
  20440. * Used to resolve the
  20441. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  20442. * of values.
  20443. */
  20444. var nativeObjectToString = objectProto.toString;
  20445. /** Used to infer the `Object` constructor. */
  20446. var objectCtorString = funcToString.call(Object);
  20447. /** Used to restore the original `_` reference in `_.noConflict`. */
  20448. var oldDash = root._;
  20449. /** Used to detect if a method is native. */
  20450. var reIsNative = RegExp('^' +
  20451. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  20452. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  20453. );
  20454. /** Built-in value references. */
  20455. var Buffer = moduleExports ? context.Buffer : undefined,
  20456. Symbol = context.Symbol,
  20457. Uint8Array = context.Uint8Array,
  20458. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  20459. getPrototype = overArg(Object.getPrototypeOf, Object),
  20460. objectCreate = Object.create,
  20461. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  20462. splice = arrayProto.splice,
  20463. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  20464. symIterator = Symbol ? Symbol.iterator : undefined,
  20465. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  20466. var defineProperty = (function() {
  20467. try {
  20468. var func = getNative(Object, 'defineProperty');
  20469. func({}, '', {});
  20470. return func;
  20471. } catch (e) {}
  20472. }());
  20473. /** Mocked built-ins. */
  20474. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  20475. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  20476. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  20477. /* Built-in method references for those with the same name as other `lodash` methods. */
  20478. var nativeCeil = Math.ceil,
  20479. nativeFloor = Math.floor,
  20480. nativeGetSymbols = Object.getOwnPropertySymbols,
  20481. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  20482. nativeIsFinite = context.isFinite,
  20483. nativeJoin = arrayProto.join,
  20484. nativeKeys = overArg(Object.keys, Object),
  20485. nativeMax = Math.max,
  20486. nativeMin = Math.min,
  20487. nativeNow = Date.now,
  20488. nativeParseInt = context.parseInt,
  20489. nativeRandom = Math.random,
  20490. nativeReverse = arrayProto.reverse;
  20491. /* Built-in method references that are verified to be native. */
  20492. var DataView = getNative(context, 'DataView'),
  20493. Map = getNative(context, 'Map'),
  20494. Promise = getNative(context, 'Promise'),
  20495. Set = getNative(context, 'Set'),
  20496. WeakMap = getNative(context, 'WeakMap'),
  20497. nativeCreate = getNative(Object, 'create');
  20498. /** Used to store function metadata. */
  20499. var metaMap = WeakMap && new WeakMap;
  20500. /** Used to lookup unminified function names. */
  20501. var realNames = {};
  20502. /** Used to detect maps, sets, and weakmaps. */
  20503. var dataViewCtorString = toSource(DataView),
  20504. mapCtorString = toSource(Map),
  20505. promiseCtorString = toSource(Promise),
  20506. setCtorString = toSource(Set),
  20507. weakMapCtorString = toSource(WeakMap);
  20508. /** Used to convert symbols to primitives and strings. */
  20509. var symbolProto = Symbol ? Symbol.prototype : undefined,
  20510. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  20511. symbolToString = symbolProto ? symbolProto.toString : undefined;
  20512. /*------------------------------------------------------------------------*/
  20513. /**
  20514. * Creates a `lodash` object which wraps `value` to enable implicit method
  20515. * chain sequences. Methods that operate on and return arrays, collections,
  20516. * and functions can be chained together. Methods that retrieve a single value
  20517. * or may return a primitive value will automatically end the chain sequence
  20518. * and return the unwrapped value. Otherwise, the value must be unwrapped
  20519. * with `_#value`.
  20520. *
  20521. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  20522. * enabled using `_.chain`.
  20523. *
  20524. * The execution of chained methods is lazy, that is, it's deferred until
  20525. * `_#value` is implicitly or explicitly called.
  20526. *
  20527. * Lazy evaluation allows several methods to support shortcut fusion.
  20528. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  20529. * the creation of intermediate arrays and can greatly reduce the number of
  20530. * iteratee executions. Sections of a chain sequence qualify for shortcut
  20531. * fusion if the section is applied to an array and iteratees accept only
  20532. * one argument. The heuristic for whether a section qualifies for shortcut
  20533. * fusion is subject to change.
  20534. *
  20535. * Chaining is supported in custom builds as long as the `_#value` method is
  20536. * directly or indirectly included in the build.
  20537. *
  20538. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  20539. *
  20540. * The wrapper `Array` methods are:
  20541. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  20542. *
  20543. * The wrapper `String` methods are:
  20544. * `replace` and `split`
  20545. *
  20546. * The wrapper methods that support shortcut fusion are:
  20547. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  20548. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  20549. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  20550. *
  20551. * The chainable wrapper methods are:
  20552. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  20553. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  20554. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  20555. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  20556. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  20557. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  20558. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  20559. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  20560. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  20561. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  20562. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  20563. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  20564. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  20565. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  20566. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  20567. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  20568. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  20569. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  20570. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  20571. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  20572. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  20573. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  20574. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  20575. * `zipObject`, `zipObjectDeep`, and `zipWith`
  20576. *
  20577. * The wrapper methods that are **not** chainable by default are:
  20578. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  20579. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  20580. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  20581. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  20582. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  20583. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  20584. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  20585. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  20586. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  20587. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  20588. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  20589. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  20590. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  20591. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  20592. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  20593. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  20594. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  20595. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  20596. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  20597. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  20598. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  20599. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  20600. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  20601. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  20602. * `upperFirst`, `value`, and `words`
  20603. *
  20604. * @name _
  20605. * @constructor
  20606. * @category Seq
  20607. * @param {*} value The value to wrap in a `lodash` instance.
  20608. * @returns {Object} Returns the new `lodash` wrapper instance.
  20609. * @example
  20610. *
  20611. * function square(n) {
  20612. * return n * n;
  20613. * }
  20614. *
  20615. * var wrapped = _([1, 2, 3]);
  20616. *
  20617. * // Returns an unwrapped value.
  20618. * wrapped.reduce(_.add);
  20619. * // => 6
  20620. *
  20621. * // Returns a wrapped value.
  20622. * var squares = wrapped.map(square);
  20623. *
  20624. * _.isArray(squares);
  20625. * // => false
  20626. *
  20627. * _.isArray(squares.value());
  20628. * // => true
  20629. */
  20630. function lodash(value) {
  20631. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  20632. if (value instanceof LodashWrapper) {
  20633. return value;
  20634. }
  20635. if (hasOwnProperty.call(value, '__wrapped__')) {
  20636. return wrapperClone(value);
  20637. }
  20638. }
  20639. return new LodashWrapper(value);
  20640. }
  20641. /**
  20642. * The base implementation of `_.create` without support for assigning
  20643. * properties to the created object.
  20644. *
  20645. * @private
  20646. * @param {Object} proto The object to inherit from.
  20647. * @returns {Object} Returns the new object.
  20648. */
  20649. var baseCreate = (function() {
  20650. function object() {}
  20651. return function(proto) {
  20652. if (!isObject(proto)) {
  20653. return {};
  20654. }
  20655. if (objectCreate) {
  20656. return objectCreate(proto);
  20657. }
  20658. object.prototype = proto;
  20659. var result = new object;
  20660. object.prototype = undefined;
  20661. return result;
  20662. };
  20663. }());
  20664. /**
  20665. * The function whose prototype chain sequence wrappers inherit from.
  20666. *
  20667. * @private
  20668. */
  20669. function baseLodash() {
  20670. // No operation performed.
  20671. }
  20672. /**
  20673. * The base constructor for creating `lodash` wrapper objects.
  20674. *
  20675. * @private
  20676. * @param {*} value The value to wrap.
  20677. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  20678. */
  20679. function LodashWrapper(value, chainAll) {
  20680. this.__wrapped__ = value;
  20681. this.__actions__ = [];
  20682. this.__chain__ = !!chainAll;
  20683. this.__index__ = 0;
  20684. this.__values__ = undefined;
  20685. }
  20686. /**
  20687. * By default, the template delimiters used by lodash are like those in
  20688. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  20689. * following template settings to use alternative delimiters.
  20690. *
  20691. * @static
  20692. * @memberOf _
  20693. * @type {Object}
  20694. */
  20695. lodash.templateSettings = {
  20696. /**
  20697. * Used to detect `data` property values to be HTML-escaped.
  20698. *
  20699. * @memberOf _.templateSettings
  20700. * @type {RegExp}
  20701. */
  20702. 'escape': reEscape,
  20703. /**
  20704. * Used to detect code to be evaluated.
  20705. *
  20706. * @memberOf _.templateSettings
  20707. * @type {RegExp}
  20708. */
  20709. 'evaluate': reEvaluate,
  20710. /**
  20711. * Used to detect `data` property values to inject.
  20712. *
  20713. * @memberOf _.templateSettings
  20714. * @type {RegExp}
  20715. */
  20716. 'interpolate': reInterpolate,
  20717. /**
  20718. * Used to reference the data object in the template text.
  20719. *
  20720. * @memberOf _.templateSettings
  20721. * @type {string}
  20722. */
  20723. 'variable': '',
  20724. /**
  20725. * Used to import variables into the compiled template.
  20726. *
  20727. * @memberOf _.templateSettings
  20728. * @type {Object}
  20729. */
  20730. 'imports': {
  20731. /**
  20732. * A reference to the `lodash` function.
  20733. *
  20734. * @memberOf _.templateSettings.imports
  20735. * @type {Function}
  20736. */
  20737. '_': lodash
  20738. }
  20739. };
  20740. // Ensure wrappers are instances of `baseLodash`.
  20741. lodash.prototype = baseLodash.prototype;
  20742. lodash.prototype.constructor = lodash;
  20743. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  20744. LodashWrapper.prototype.constructor = LodashWrapper;
  20745. /*------------------------------------------------------------------------*/
  20746. /**
  20747. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  20748. *
  20749. * @private
  20750. * @constructor
  20751. * @param {*} value The value to wrap.
  20752. */
  20753. function LazyWrapper(value) {
  20754. this.__wrapped__ = value;
  20755. this.__actions__ = [];
  20756. this.__dir__ = 1;
  20757. this.__filtered__ = false;
  20758. this.__iteratees__ = [];
  20759. this.__takeCount__ = MAX_ARRAY_LENGTH;
  20760. this.__views__ = [];
  20761. }
  20762. /**
  20763. * Creates a clone of the lazy wrapper object.
  20764. *
  20765. * @private
  20766. * @name clone
  20767. * @memberOf LazyWrapper
  20768. * @returns {Object} Returns the cloned `LazyWrapper` object.
  20769. */
  20770. function lazyClone() {
  20771. var result = new LazyWrapper(this.__wrapped__);
  20772. result.__actions__ = copyArray(this.__actions__);
  20773. result.__dir__ = this.__dir__;
  20774. result.__filtered__ = this.__filtered__;
  20775. result.__iteratees__ = copyArray(this.__iteratees__);
  20776. result.__takeCount__ = this.__takeCount__;
  20777. result.__views__ = copyArray(this.__views__);
  20778. return result;
  20779. }
  20780. /**
  20781. * Reverses the direction of lazy iteration.
  20782. *
  20783. * @private
  20784. * @name reverse
  20785. * @memberOf LazyWrapper
  20786. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20787. */
  20788. function lazyReverse() {
  20789. if (this.__filtered__) {
  20790. var result = new LazyWrapper(this);
  20791. result.__dir__ = -1;
  20792. result.__filtered__ = true;
  20793. } else {
  20794. result = this.clone();
  20795. result.__dir__ *= -1;
  20796. }
  20797. return result;
  20798. }
  20799. /**
  20800. * Extracts the unwrapped value from its lazy wrapper.
  20801. *
  20802. * @private
  20803. * @name value
  20804. * @memberOf LazyWrapper
  20805. * @returns {*} Returns the unwrapped value.
  20806. */
  20807. function lazyValue() {
  20808. var array = this.__wrapped__.value(),
  20809. dir = this.__dir__,
  20810. isArr = isArray(array),
  20811. isRight = dir < 0,
  20812. arrLength = isArr ? array.length : 0,
  20813. view = getView(0, arrLength, this.__views__),
  20814. start = view.start,
  20815. end = view.end,
  20816. length = end - start,
  20817. index = isRight ? end : (start - 1),
  20818. iteratees = this.__iteratees__,
  20819. iterLength = iteratees.length,
  20820. resIndex = 0,
  20821. takeCount = nativeMin(length, this.__takeCount__);
  20822. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20823. return baseWrapperValue(array, this.__actions__);
  20824. }
  20825. var result = [];
  20826. outer:
  20827. while (length-- && resIndex < takeCount) {
  20828. index += dir;
  20829. var iterIndex = -1,
  20830. value = array[index];
  20831. while (++iterIndex < iterLength) {
  20832. var data = iteratees[iterIndex],
  20833. iteratee = data.iteratee,
  20834. type = data.type,
  20835. computed = iteratee(value);
  20836. if (type == LAZY_MAP_FLAG) {
  20837. value = computed;
  20838. } else if (!computed) {
  20839. if (type == LAZY_FILTER_FLAG) {
  20840. continue outer;
  20841. } else {
  20842. break outer;
  20843. }
  20844. }
  20845. }
  20846. result[resIndex++] = value;
  20847. }
  20848. return result;
  20849. }
  20850. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20851. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20852. LazyWrapper.prototype.constructor = LazyWrapper;
  20853. /*------------------------------------------------------------------------*/
  20854. /**
  20855. * Creates a hash object.
  20856. *
  20857. * @private
  20858. * @constructor
  20859. * @param {Array} [entries] The key-value pairs to cache.
  20860. */
  20861. function Hash(entries) {
  20862. var index = -1,
  20863. length = entries == null ? 0 : entries.length;
  20864. this.clear();
  20865. while (++index < length) {
  20866. var entry = entries[index];
  20867. this.set(entry[0], entry[1]);
  20868. }
  20869. }
  20870. /**
  20871. * Removes all key-value entries from the hash.
  20872. *
  20873. * @private
  20874. * @name clear
  20875. * @memberOf Hash
  20876. */
  20877. function hashClear() {
  20878. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20879. this.size = 0;
  20880. }
  20881. /**
  20882. * Removes `key` and its value from the hash.
  20883. *
  20884. * @private
  20885. * @name delete
  20886. * @memberOf Hash
  20887. * @param {Object} hash The hash to modify.
  20888. * @param {string} key The key of the value to remove.
  20889. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20890. */
  20891. function hashDelete(key) {
  20892. var result = this.has(key) && delete this.__data__[key];
  20893. this.size -= result ? 1 : 0;
  20894. return result;
  20895. }
  20896. /**
  20897. * Gets the hash value for `key`.
  20898. *
  20899. * @private
  20900. * @name get
  20901. * @memberOf Hash
  20902. * @param {string} key The key of the value to get.
  20903. * @returns {*} Returns the entry value.
  20904. */
  20905. function hashGet(key) {
  20906. var data = this.__data__;
  20907. if (nativeCreate) {
  20908. var result = data[key];
  20909. return result === HASH_UNDEFINED ? undefined : result;
  20910. }
  20911. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20912. }
  20913. /**
  20914. * Checks if a hash value for `key` exists.
  20915. *
  20916. * @private
  20917. * @name has
  20918. * @memberOf Hash
  20919. * @param {string} key The key of the entry to check.
  20920. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20921. */
  20922. function hashHas(key) {
  20923. var data = this.__data__;
  20924. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20925. }
  20926. /**
  20927. * Sets the hash `key` to `value`.
  20928. *
  20929. * @private
  20930. * @name set
  20931. * @memberOf Hash
  20932. * @param {string} key The key of the value to set.
  20933. * @param {*} value The value to set.
  20934. * @returns {Object} Returns the hash instance.
  20935. */
  20936. function hashSet(key, value) {
  20937. var data = this.__data__;
  20938. this.size += this.has(key) ? 0 : 1;
  20939. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20940. return this;
  20941. }
  20942. // Add methods to `Hash`.
  20943. Hash.prototype.clear = hashClear;
  20944. Hash.prototype['delete'] = hashDelete;
  20945. Hash.prototype.get = hashGet;
  20946. Hash.prototype.has = hashHas;
  20947. Hash.prototype.set = hashSet;
  20948. /*------------------------------------------------------------------------*/
  20949. /**
  20950. * Creates an list cache object.
  20951. *
  20952. * @private
  20953. * @constructor
  20954. * @param {Array} [entries] The key-value pairs to cache.
  20955. */
  20956. function ListCache(entries) {
  20957. var index = -1,
  20958. length = entries == null ? 0 : entries.length;
  20959. this.clear();
  20960. while (++index < length) {
  20961. var entry = entries[index];
  20962. this.set(entry[0], entry[1]);
  20963. }
  20964. }
  20965. /**
  20966. * Removes all key-value entries from the list cache.
  20967. *
  20968. * @private
  20969. * @name clear
  20970. * @memberOf ListCache
  20971. */
  20972. function listCacheClear() {
  20973. this.__data__ = [];
  20974. this.size = 0;
  20975. }
  20976. /**
  20977. * Removes `key` and its value from the list cache.
  20978. *
  20979. * @private
  20980. * @name delete
  20981. * @memberOf ListCache
  20982. * @param {string} key The key of the value to remove.
  20983. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20984. */
  20985. function listCacheDelete(key) {
  20986. var data = this.__data__,
  20987. index = assocIndexOf(data, key);
  20988. if (index < 0) {
  20989. return false;
  20990. }
  20991. var lastIndex = data.length - 1;
  20992. if (index == lastIndex) {
  20993. data.pop();
  20994. } else {
  20995. splice.call(data, index, 1);
  20996. }
  20997. --this.size;
  20998. return true;
  20999. }
  21000. /**
  21001. * Gets the list cache value for `key`.
  21002. *
  21003. * @private
  21004. * @name get
  21005. * @memberOf ListCache
  21006. * @param {string} key The key of the value to get.
  21007. * @returns {*} Returns the entry value.
  21008. */
  21009. function listCacheGet(key) {
  21010. var data = this.__data__,
  21011. index = assocIndexOf(data, key);
  21012. return index < 0 ? undefined : data[index][1];
  21013. }
  21014. /**
  21015. * Checks if a list cache value for `key` exists.
  21016. *
  21017. * @private
  21018. * @name has
  21019. * @memberOf ListCache
  21020. * @param {string} key The key of the entry to check.
  21021. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21022. */
  21023. function listCacheHas(key) {
  21024. return assocIndexOf(this.__data__, key) > -1;
  21025. }
  21026. /**
  21027. * Sets the list cache `key` to `value`.
  21028. *
  21029. * @private
  21030. * @name set
  21031. * @memberOf ListCache
  21032. * @param {string} key The key of the value to set.
  21033. * @param {*} value The value to set.
  21034. * @returns {Object} Returns the list cache instance.
  21035. */
  21036. function listCacheSet(key, value) {
  21037. var data = this.__data__,
  21038. index = assocIndexOf(data, key);
  21039. if (index < 0) {
  21040. ++this.size;
  21041. data.push([key, value]);
  21042. } else {
  21043. data[index][1] = value;
  21044. }
  21045. return this;
  21046. }
  21047. // Add methods to `ListCache`.
  21048. ListCache.prototype.clear = listCacheClear;
  21049. ListCache.prototype['delete'] = listCacheDelete;
  21050. ListCache.prototype.get = listCacheGet;
  21051. ListCache.prototype.has = listCacheHas;
  21052. ListCache.prototype.set = listCacheSet;
  21053. /*------------------------------------------------------------------------*/
  21054. /**
  21055. * Creates a map cache object to store key-value pairs.
  21056. *
  21057. * @private
  21058. * @constructor
  21059. * @param {Array} [entries] The key-value pairs to cache.
  21060. */
  21061. function MapCache(entries) {
  21062. var index = -1,
  21063. length = entries == null ? 0 : entries.length;
  21064. this.clear();
  21065. while (++index < length) {
  21066. var entry = entries[index];
  21067. this.set(entry[0], entry[1]);
  21068. }
  21069. }
  21070. /**
  21071. * Removes all key-value entries from the map.
  21072. *
  21073. * @private
  21074. * @name clear
  21075. * @memberOf MapCache
  21076. */
  21077. function mapCacheClear() {
  21078. this.size = 0;
  21079. this.__data__ = {
  21080. 'hash': new Hash,
  21081. 'map': new (Map || ListCache),
  21082. 'string': new Hash
  21083. };
  21084. }
  21085. /**
  21086. * Removes `key` and its value from the map.
  21087. *
  21088. * @private
  21089. * @name delete
  21090. * @memberOf MapCache
  21091. * @param {string} key The key of the value to remove.
  21092. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21093. */
  21094. function mapCacheDelete(key) {
  21095. var result = getMapData(this, key)['delete'](key);
  21096. this.size -= result ? 1 : 0;
  21097. return result;
  21098. }
  21099. /**
  21100. * Gets the map value for `key`.
  21101. *
  21102. * @private
  21103. * @name get
  21104. * @memberOf MapCache
  21105. * @param {string} key The key of the value to get.
  21106. * @returns {*} Returns the entry value.
  21107. */
  21108. function mapCacheGet(key) {
  21109. return getMapData(this, key).get(key);
  21110. }
  21111. /**
  21112. * Checks if a map value for `key` exists.
  21113. *
  21114. * @private
  21115. * @name has
  21116. * @memberOf MapCache
  21117. * @param {string} key The key of the entry to check.
  21118. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21119. */
  21120. function mapCacheHas(key) {
  21121. return getMapData(this, key).has(key);
  21122. }
  21123. /**
  21124. * Sets the map `key` to `value`.
  21125. *
  21126. * @private
  21127. * @name set
  21128. * @memberOf MapCache
  21129. * @param {string} key The key of the value to set.
  21130. * @param {*} value The value to set.
  21131. * @returns {Object} Returns the map cache instance.
  21132. */
  21133. function mapCacheSet(key, value) {
  21134. var data = getMapData(this, key),
  21135. size = data.size;
  21136. data.set(key, value);
  21137. this.size += data.size == size ? 0 : 1;
  21138. return this;
  21139. }
  21140. // Add methods to `MapCache`.
  21141. MapCache.prototype.clear = mapCacheClear;
  21142. MapCache.prototype['delete'] = mapCacheDelete;
  21143. MapCache.prototype.get = mapCacheGet;
  21144. MapCache.prototype.has = mapCacheHas;
  21145. MapCache.prototype.set = mapCacheSet;
  21146. /*------------------------------------------------------------------------*/
  21147. /**
  21148. *
  21149. * Creates an array cache object to store unique values.
  21150. *
  21151. * @private
  21152. * @constructor
  21153. * @param {Array} [values] The values to cache.
  21154. */
  21155. function SetCache(values) {
  21156. var index = -1,
  21157. length = values == null ? 0 : values.length;
  21158. this.__data__ = new MapCache;
  21159. while (++index < length) {
  21160. this.add(values[index]);
  21161. }
  21162. }
  21163. /**
  21164. * Adds `value` to the array cache.
  21165. *
  21166. * @private
  21167. * @name add
  21168. * @memberOf SetCache
  21169. * @alias push
  21170. * @param {*} value The value to cache.
  21171. * @returns {Object} Returns the cache instance.
  21172. */
  21173. function setCacheAdd(value) {
  21174. this.__data__.set(value, HASH_UNDEFINED);
  21175. return this;
  21176. }
  21177. /**
  21178. * Checks if `value` is in the array cache.
  21179. *
  21180. * @private
  21181. * @name has
  21182. * @memberOf SetCache
  21183. * @param {*} value The value to search for.
  21184. * @returns {number} Returns `true` if `value` is found, else `false`.
  21185. */
  21186. function setCacheHas(value) {
  21187. return this.__data__.has(value);
  21188. }
  21189. // Add methods to `SetCache`.
  21190. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  21191. SetCache.prototype.has = setCacheHas;
  21192. /*------------------------------------------------------------------------*/
  21193. /**
  21194. * Creates a stack cache object to store key-value pairs.
  21195. *
  21196. * @private
  21197. * @constructor
  21198. * @param {Array} [entries] The key-value pairs to cache.
  21199. */
  21200. function Stack(entries) {
  21201. var data = this.__data__ = new ListCache(entries);
  21202. this.size = data.size;
  21203. }
  21204. /**
  21205. * Removes all key-value entries from the stack.
  21206. *
  21207. * @private
  21208. * @name clear
  21209. * @memberOf Stack
  21210. */
  21211. function stackClear() {
  21212. this.__data__ = new ListCache;
  21213. this.size = 0;
  21214. }
  21215. /**
  21216. * Removes `key` and its value from the stack.
  21217. *
  21218. * @private
  21219. * @name delete
  21220. * @memberOf Stack
  21221. * @param {string} key The key of the value to remove.
  21222. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  21223. */
  21224. function stackDelete(key) {
  21225. var data = this.__data__,
  21226. result = data['delete'](key);
  21227. this.size = data.size;
  21228. return result;
  21229. }
  21230. /**
  21231. * Gets the stack value for `key`.
  21232. *
  21233. * @private
  21234. * @name get
  21235. * @memberOf Stack
  21236. * @param {string} key The key of the value to get.
  21237. * @returns {*} Returns the entry value.
  21238. */
  21239. function stackGet(key) {
  21240. return this.__data__.get(key);
  21241. }
  21242. /**
  21243. * Checks if a stack value for `key` exists.
  21244. *
  21245. * @private
  21246. * @name has
  21247. * @memberOf Stack
  21248. * @param {string} key The key of the entry to check.
  21249. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  21250. */
  21251. function stackHas(key) {
  21252. return this.__data__.has(key);
  21253. }
  21254. /**
  21255. * Sets the stack `key` to `value`.
  21256. *
  21257. * @private
  21258. * @name set
  21259. * @memberOf Stack
  21260. * @param {string} key The key of the value to set.
  21261. * @param {*} value The value to set.
  21262. * @returns {Object} Returns the stack cache instance.
  21263. */
  21264. function stackSet(key, value) {
  21265. var data = this.__data__;
  21266. if (data instanceof ListCache) {
  21267. var pairs = data.__data__;
  21268. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  21269. pairs.push([key, value]);
  21270. this.size = ++data.size;
  21271. return this;
  21272. }
  21273. data = this.__data__ = new MapCache(pairs);
  21274. }
  21275. data.set(key, value);
  21276. this.size = data.size;
  21277. return this;
  21278. }
  21279. // Add methods to `Stack`.
  21280. Stack.prototype.clear = stackClear;
  21281. Stack.prototype['delete'] = stackDelete;
  21282. Stack.prototype.get = stackGet;
  21283. Stack.prototype.has = stackHas;
  21284. Stack.prototype.set = stackSet;
  21285. /*------------------------------------------------------------------------*/
  21286. /**
  21287. * Creates an array of the enumerable property names of the array-like `value`.
  21288. *
  21289. * @private
  21290. * @param {*} value The value to query.
  21291. * @param {boolean} inherited Specify returning inherited property names.
  21292. * @returns {Array} Returns the array of property names.
  21293. */
  21294. function arrayLikeKeys(value, inherited) {
  21295. var isArr = isArray(value),
  21296. isArg = !isArr && isArguments(value),
  21297. isBuff = !isArr && !isArg && isBuffer(value),
  21298. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  21299. skipIndexes = isArr || isArg || isBuff || isType,
  21300. result = skipIndexes ? baseTimes(value.length, String) : [],
  21301. length = result.length;
  21302. for (var key in value) {
  21303. if ((inherited || hasOwnProperty.call(value, key)) &&
  21304. !(skipIndexes && (
  21305. // Safari 9 has enumerable `arguments.length` in strict mode.
  21306. key == 'length' ||
  21307. // Node.js 0.10 has enumerable non-index properties on buffers.
  21308. (isBuff && (key == 'offset' || key == 'parent')) ||
  21309. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  21310. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  21311. // Skip index properties.
  21312. isIndex(key, length)
  21313. ))) {
  21314. result.push(key);
  21315. }
  21316. }
  21317. return result;
  21318. }
  21319. /**
  21320. * A specialized version of `_.sample` for arrays.
  21321. *
  21322. * @private
  21323. * @param {Array} array The array to sample.
  21324. * @returns {*} Returns the random element.
  21325. */
  21326. function arraySample(array) {
  21327. var length = array.length;
  21328. return length ? array[baseRandom(0, length - 1)] : undefined;
  21329. }
  21330. /**
  21331. * A specialized version of `_.sampleSize` for arrays.
  21332. *
  21333. * @private
  21334. * @param {Array} array The array to sample.
  21335. * @param {number} n The number of elements to sample.
  21336. * @returns {Array} Returns the random elements.
  21337. */
  21338. function arraySampleSize(array, n) {
  21339. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  21340. }
  21341. /**
  21342. * A specialized version of `_.shuffle` for arrays.
  21343. *
  21344. * @private
  21345. * @param {Array} array The array to shuffle.
  21346. * @returns {Array} Returns the new shuffled array.
  21347. */
  21348. function arrayShuffle(array) {
  21349. return shuffleSelf(copyArray(array));
  21350. }
  21351. /**
  21352. * This function is like `assignValue` except that it doesn't assign
  21353. * `undefined` values.
  21354. *
  21355. * @private
  21356. * @param {Object} object The object to modify.
  21357. * @param {string} key The key of the property to assign.
  21358. * @param {*} value The value to assign.
  21359. */
  21360. function assignMergeValue(object, key, value) {
  21361. if ((value !== undefined && !eq(object[key], value)) ||
  21362. (value === undefined && !(key in object))) {
  21363. baseAssignValue(object, key, value);
  21364. }
  21365. }
  21366. /**
  21367. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  21368. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  21369. * for equality comparisons.
  21370. *
  21371. * @private
  21372. * @param {Object} object The object to modify.
  21373. * @param {string} key The key of the property to assign.
  21374. * @param {*} value The value to assign.
  21375. */
  21376. function assignValue(object, key, value) {
  21377. var objValue = object[key];
  21378. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  21379. (value === undefined && !(key in object))) {
  21380. baseAssignValue(object, key, value);
  21381. }
  21382. }
  21383. /**
  21384. * Gets the index at which the `key` is found in `array` of key-value pairs.
  21385. *
  21386. * @private
  21387. * @param {Array} array The array to inspect.
  21388. * @param {*} key The key to search for.
  21389. * @returns {number} Returns the index of the matched value, else `-1`.
  21390. */
  21391. function assocIndexOf(array, key) {
  21392. var length = array.length;
  21393. while (length--) {
  21394. if (eq(array[length][0], key)) {
  21395. return length;
  21396. }
  21397. }
  21398. return -1;
  21399. }
  21400. /**
  21401. * Aggregates elements of `collection` on `accumulator` with keys transformed
  21402. * by `iteratee` and values set by `setter`.
  21403. *
  21404. * @private
  21405. * @param {Array|Object} collection The collection to iterate over.
  21406. * @param {Function} setter The function to set `accumulator` values.
  21407. * @param {Function} iteratee The iteratee to transform keys.
  21408. * @param {Object} accumulator The initial aggregated object.
  21409. * @returns {Function} Returns `accumulator`.
  21410. */
  21411. function baseAggregator(collection, setter, iteratee, accumulator) {
  21412. baseEach(collection, function(value, key, collection) {
  21413. setter(accumulator, value, iteratee(value), collection);
  21414. });
  21415. return accumulator;
  21416. }
  21417. /**
  21418. * The base implementation of `_.assign` without support for multiple sources
  21419. * or `customizer` functions.
  21420. *
  21421. * @private
  21422. * @param {Object} object The destination object.
  21423. * @param {Object} source The source object.
  21424. * @returns {Object} Returns `object`.
  21425. */
  21426. function baseAssign(object, source) {
  21427. return object && copyObject(source, keys(source), object);
  21428. }
  21429. /**
  21430. * The base implementation of `_.assignIn` without support for multiple sources
  21431. * or `customizer` functions.
  21432. *
  21433. * @private
  21434. * @param {Object} object The destination object.
  21435. * @param {Object} source The source object.
  21436. * @returns {Object} Returns `object`.
  21437. */
  21438. function baseAssignIn(object, source) {
  21439. return object && copyObject(source, keysIn(source), object);
  21440. }
  21441. /**
  21442. * The base implementation of `assignValue` and `assignMergeValue` without
  21443. * value checks.
  21444. *
  21445. * @private
  21446. * @param {Object} object The object to modify.
  21447. * @param {string} key The key of the property to assign.
  21448. * @param {*} value The value to assign.
  21449. */
  21450. function baseAssignValue(object, key, value) {
  21451. if (key == '__proto__' && defineProperty) {
  21452. defineProperty(object, key, {
  21453. 'configurable': true,
  21454. 'enumerable': true,
  21455. 'value': value,
  21456. 'writable': true
  21457. });
  21458. } else {
  21459. object[key] = value;
  21460. }
  21461. }
  21462. /**
  21463. * The base implementation of `_.at` without support for individual paths.
  21464. *
  21465. * @private
  21466. * @param {Object} object The object to iterate over.
  21467. * @param {string[]} paths The property paths to pick.
  21468. * @returns {Array} Returns the picked elements.
  21469. */
  21470. function baseAt(object, paths) {
  21471. var index = -1,
  21472. length = paths.length,
  21473. result = Array(length),
  21474. skip = object == null;
  21475. while (++index < length) {
  21476. result[index] = skip ? undefined : get(object, paths[index]);
  21477. }
  21478. return result;
  21479. }
  21480. /**
  21481. * The base implementation of `_.clamp` which doesn't coerce arguments.
  21482. *
  21483. * @private
  21484. * @param {number} number The number to clamp.
  21485. * @param {number} [lower] The lower bound.
  21486. * @param {number} upper The upper bound.
  21487. * @returns {number} Returns the clamped number.
  21488. */
  21489. function baseClamp(number, lower, upper) {
  21490. if (number === number) {
  21491. if (upper !== undefined) {
  21492. number = number <= upper ? number : upper;
  21493. }
  21494. if (lower !== undefined) {
  21495. number = number >= lower ? number : lower;
  21496. }
  21497. }
  21498. return number;
  21499. }
  21500. /**
  21501. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  21502. * traversed objects.
  21503. *
  21504. * @private
  21505. * @param {*} value The value to clone.
  21506. * @param {boolean} bitmask The bitmask flags.
  21507. * 1 - Deep clone
  21508. * 2 - Flatten inherited properties
  21509. * 4 - Clone symbols
  21510. * @param {Function} [customizer] The function to customize cloning.
  21511. * @param {string} [key] The key of `value`.
  21512. * @param {Object} [object] The parent object of `value`.
  21513. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  21514. * @returns {*} Returns the cloned value.
  21515. */
  21516. function baseClone(value, bitmask, customizer, key, object, stack) {
  21517. var result,
  21518. isDeep = bitmask & CLONE_DEEP_FLAG,
  21519. isFlat = bitmask & CLONE_FLAT_FLAG,
  21520. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  21521. if (customizer) {
  21522. result = object ? customizer(value, key, object, stack) : customizer(value);
  21523. }
  21524. if (result !== undefined) {
  21525. return result;
  21526. }
  21527. if (!isObject(value)) {
  21528. return value;
  21529. }
  21530. var isArr = isArray(value);
  21531. if (isArr) {
  21532. result = initCloneArray(value);
  21533. if (!isDeep) {
  21534. return copyArray(value, result);
  21535. }
  21536. } else {
  21537. var tag = getTag(value),
  21538. isFunc = tag == funcTag || tag == genTag;
  21539. if (isBuffer(value)) {
  21540. return cloneBuffer(value, isDeep);
  21541. }
  21542. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  21543. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  21544. if (!isDeep) {
  21545. return isFlat
  21546. ? copySymbolsIn(value, baseAssignIn(result, value))
  21547. : copySymbols(value, baseAssign(result, value));
  21548. }
  21549. } else {
  21550. if (!cloneableTags[tag]) {
  21551. return object ? value : {};
  21552. }
  21553. result = initCloneByTag(value, tag, isDeep);
  21554. }
  21555. }
  21556. // Check for circular references and return its corresponding clone.
  21557. stack || (stack = new Stack);
  21558. var stacked = stack.get(value);
  21559. if (stacked) {
  21560. return stacked;
  21561. }
  21562. stack.set(value, result);
  21563. if (isSet(value)) {
  21564. value.forEach(function(subValue) {
  21565. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  21566. });
  21567. } else if (isMap(value)) {
  21568. value.forEach(function(subValue, key) {
  21569. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  21570. });
  21571. }
  21572. var keysFunc = isFull
  21573. ? (isFlat ? getAllKeysIn : getAllKeys)
  21574. : (isFlat ? keysIn : keys);
  21575. var props = isArr ? undefined : keysFunc(value);
  21576. arrayEach(props || value, function(subValue, key) {
  21577. if (props) {
  21578. key = subValue;
  21579. subValue = value[key];
  21580. }
  21581. // Recursively populate clone (susceptible to call stack limits).
  21582. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  21583. });
  21584. return result;
  21585. }
  21586. /**
  21587. * The base implementation of `_.conforms` which doesn't clone `source`.
  21588. *
  21589. * @private
  21590. * @param {Object} source The object of property predicates to conform to.
  21591. * @returns {Function} Returns the new spec function.
  21592. */
  21593. function baseConforms(source) {
  21594. var props = keys(source);
  21595. return function(object) {
  21596. return baseConformsTo(object, source, props);
  21597. };
  21598. }
  21599. /**
  21600. * The base implementation of `_.conformsTo` which accepts `props` to check.
  21601. *
  21602. * @private
  21603. * @param {Object} object The object to inspect.
  21604. * @param {Object} source The object of property predicates to conform to.
  21605. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  21606. */
  21607. function baseConformsTo(object, source, props) {
  21608. var length = props.length;
  21609. if (object == null) {
  21610. return !length;
  21611. }
  21612. object = Object(object);
  21613. while (length--) {
  21614. var key = props[length],
  21615. predicate = source[key],
  21616. value = object[key];
  21617. if ((value === undefined && !(key in object)) || !predicate(value)) {
  21618. return false;
  21619. }
  21620. }
  21621. return true;
  21622. }
  21623. /**
  21624. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  21625. * to provide to `func`.
  21626. *
  21627. * @private
  21628. * @param {Function} func The function to delay.
  21629. * @param {number} wait The number of milliseconds to delay invocation.
  21630. * @param {Array} args The arguments to provide to `func`.
  21631. * @returns {number|Object} Returns the timer id or timeout object.
  21632. */
  21633. function baseDelay(func, wait, args) {
  21634. if (typeof func != 'function') {
  21635. throw new TypeError(FUNC_ERROR_TEXT);
  21636. }
  21637. return setTimeout(function() { func.apply(undefined, args); }, wait);
  21638. }
  21639. /**
  21640. * The base implementation of methods like `_.difference` without support
  21641. * for excluding multiple arrays or iteratee shorthands.
  21642. *
  21643. * @private
  21644. * @param {Array} array The array to inspect.
  21645. * @param {Array} values The values to exclude.
  21646. * @param {Function} [iteratee] The iteratee invoked per element.
  21647. * @param {Function} [comparator] The comparator invoked per element.
  21648. * @returns {Array} Returns the new array of filtered values.
  21649. */
  21650. function baseDifference(array, values, iteratee, comparator) {
  21651. var index = -1,
  21652. includes = arrayIncludes,
  21653. isCommon = true,
  21654. length = array.length,
  21655. result = [],
  21656. valuesLength = values.length;
  21657. if (!length) {
  21658. return result;
  21659. }
  21660. if (iteratee) {
  21661. values = arrayMap(values, baseUnary(iteratee));
  21662. }
  21663. if (comparator) {
  21664. includes = arrayIncludesWith;
  21665. isCommon = false;
  21666. }
  21667. else if (values.length >= LARGE_ARRAY_SIZE) {
  21668. includes = cacheHas;
  21669. isCommon = false;
  21670. values = new SetCache(values);
  21671. }
  21672. outer:
  21673. while (++index < length) {
  21674. var value = array[index],
  21675. computed = iteratee == null ? value : iteratee(value);
  21676. value = (comparator || value !== 0) ? value : 0;
  21677. if (isCommon && computed === computed) {
  21678. var valuesIndex = valuesLength;
  21679. while (valuesIndex--) {
  21680. if (values[valuesIndex] === computed) {
  21681. continue outer;
  21682. }
  21683. }
  21684. result.push(value);
  21685. }
  21686. else if (!includes(values, computed, comparator)) {
  21687. result.push(value);
  21688. }
  21689. }
  21690. return result;
  21691. }
  21692. /**
  21693. * The base implementation of `_.forEach` without support for iteratee shorthands.
  21694. *
  21695. * @private
  21696. * @param {Array|Object} collection The collection to iterate over.
  21697. * @param {Function} iteratee The function invoked per iteration.
  21698. * @returns {Array|Object} Returns `collection`.
  21699. */
  21700. var baseEach = createBaseEach(baseForOwn);
  21701. /**
  21702. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  21703. *
  21704. * @private
  21705. * @param {Array|Object} collection The collection to iterate over.
  21706. * @param {Function} iteratee The function invoked per iteration.
  21707. * @returns {Array|Object} Returns `collection`.
  21708. */
  21709. var baseEachRight = createBaseEach(baseForOwnRight, true);
  21710. /**
  21711. * The base implementation of `_.every` without support for iteratee shorthands.
  21712. *
  21713. * @private
  21714. * @param {Array|Object} collection The collection to iterate over.
  21715. * @param {Function} predicate The function invoked per iteration.
  21716. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  21717. * else `false`
  21718. */
  21719. function baseEvery(collection, predicate) {
  21720. var result = true;
  21721. baseEach(collection, function(value, index, collection) {
  21722. result = !!predicate(value, index, collection);
  21723. return result;
  21724. });
  21725. return result;
  21726. }
  21727. /**
  21728. * The base implementation of methods like `_.max` and `_.min` which accepts a
  21729. * `comparator` to determine the extremum value.
  21730. *
  21731. * @private
  21732. * @param {Array} array The array to iterate over.
  21733. * @param {Function} iteratee The iteratee invoked per iteration.
  21734. * @param {Function} comparator The comparator used to compare values.
  21735. * @returns {*} Returns the extremum value.
  21736. */
  21737. function baseExtremum(array, iteratee, comparator) {
  21738. var index = -1,
  21739. length = array.length;
  21740. while (++index < length) {
  21741. var value = array[index],
  21742. current = iteratee(value);
  21743. if (current != null && (computed === undefined
  21744. ? (current === current && !isSymbol(current))
  21745. : comparator(current, computed)
  21746. )) {
  21747. var computed = current,
  21748. result = value;
  21749. }
  21750. }
  21751. return result;
  21752. }
  21753. /**
  21754. * The base implementation of `_.fill` without an iteratee call guard.
  21755. *
  21756. * @private
  21757. * @param {Array} array The array to fill.
  21758. * @param {*} value The value to fill `array` with.
  21759. * @param {number} [start=0] The start position.
  21760. * @param {number} [end=array.length] The end position.
  21761. * @returns {Array} Returns `array`.
  21762. */
  21763. function baseFill(array, value, start, end) {
  21764. var length = array.length;
  21765. start = toInteger(start);
  21766. if (start < 0) {
  21767. start = -start > length ? 0 : (length + start);
  21768. }
  21769. end = (end === undefined || end > length) ? length : toInteger(end);
  21770. if (end < 0) {
  21771. end += length;
  21772. }
  21773. end = start > end ? 0 : toLength(end);
  21774. while (start < end) {
  21775. array[start++] = value;
  21776. }
  21777. return array;
  21778. }
  21779. /**
  21780. * The base implementation of `_.filter` without support for iteratee shorthands.
  21781. *
  21782. * @private
  21783. * @param {Array|Object} collection The collection to iterate over.
  21784. * @param {Function} predicate The function invoked per iteration.
  21785. * @returns {Array} Returns the new filtered array.
  21786. */
  21787. function baseFilter(collection, predicate) {
  21788. var result = [];
  21789. baseEach(collection, function(value, index, collection) {
  21790. if (predicate(value, index, collection)) {
  21791. result.push(value);
  21792. }
  21793. });
  21794. return result;
  21795. }
  21796. /**
  21797. * The base implementation of `_.flatten` with support for restricting flattening.
  21798. *
  21799. * @private
  21800. * @param {Array} array The array to flatten.
  21801. * @param {number} depth The maximum recursion depth.
  21802. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21803. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21804. * @param {Array} [result=[]] The initial result value.
  21805. * @returns {Array} Returns the new flattened array.
  21806. */
  21807. function baseFlatten(array, depth, predicate, isStrict, result) {
  21808. var index = -1,
  21809. length = array.length;
  21810. predicate || (predicate = isFlattenable);
  21811. result || (result = []);
  21812. while (++index < length) {
  21813. var value = array[index];
  21814. if (depth > 0 && predicate(value)) {
  21815. if (depth > 1) {
  21816. // Recursively flatten arrays (susceptible to call stack limits).
  21817. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21818. } else {
  21819. arrayPush(result, value);
  21820. }
  21821. } else if (!isStrict) {
  21822. result[result.length] = value;
  21823. }
  21824. }
  21825. return result;
  21826. }
  21827. /**
  21828. * The base implementation of `baseForOwn` which iterates over `object`
  21829. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21830. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21831. *
  21832. * @private
  21833. * @param {Object} object The object to iterate over.
  21834. * @param {Function} iteratee The function invoked per iteration.
  21835. * @param {Function} keysFunc The function to get the keys of `object`.
  21836. * @returns {Object} Returns `object`.
  21837. */
  21838. var baseFor = createBaseFor();
  21839. /**
  21840. * This function is like `baseFor` except that it iterates over properties
  21841. * in the opposite order.
  21842. *
  21843. * @private
  21844. * @param {Object} object The object to iterate over.
  21845. * @param {Function} iteratee The function invoked per iteration.
  21846. * @param {Function} keysFunc The function to get the keys of `object`.
  21847. * @returns {Object} Returns `object`.
  21848. */
  21849. var baseForRight = createBaseFor(true);
  21850. /**
  21851. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21852. *
  21853. * @private
  21854. * @param {Object} object The object to iterate over.
  21855. * @param {Function} iteratee The function invoked per iteration.
  21856. * @returns {Object} Returns `object`.
  21857. */
  21858. function baseForOwn(object, iteratee) {
  21859. return object && baseFor(object, iteratee, keys);
  21860. }
  21861. /**
  21862. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21863. *
  21864. * @private
  21865. * @param {Object} object The object to iterate over.
  21866. * @param {Function} iteratee The function invoked per iteration.
  21867. * @returns {Object} Returns `object`.
  21868. */
  21869. function baseForOwnRight(object, iteratee) {
  21870. return object && baseForRight(object, iteratee, keys);
  21871. }
  21872. /**
  21873. * The base implementation of `_.functions` which creates an array of
  21874. * `object` function property names filtered from `props`.
  21875. *
  21876. * @private
  21877. * @param {Object} object The object to inspect.
  21878. * @param {Array} props The property names to filter.
  21879. * @returns {Array} Returns the function names.
  21880. */
  21881. function baseFunctions(object, props) {
  21882. return arrayFilter(props, function(key) {
  21883. return isFunction(object[key]);
  21884. });
  21885. }
  21886. /**
  21887. * The base implementation of `_.get` without support for default values.
  21888. *
  21889. * @private
  21890. * @param {Object} object The object to query.
  21891. * @param {Array|string} path The path of the property to get.
  21892. * @returns {*} Returns the resolved value.
  21893. */
  21894. function baseGet(object, path) {
  21895. path = castPath(path, object);
  21896. var index = 0,
  21897. length = path.length;
  21898. while (object != null && index < length) {
  21899. object = object[toKey(path[index++])];
  21900. }
  21901. return (index && index == length) ? object : undefined;
  21902. }
  21903. /**
  21904. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21905. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21906. * symbols of `object`.
  21907. *
  21908. * @private
  21909. * @param {Object} object The object to query.
  21910. * @param {Function} keysFunc The function to get the keys of `object`.
  21911. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21912. * @returns {Array} Returns the array of property names and symbols.
  21913. */
  21914. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21915. var result = keysFunc(object);
  21916. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21917. }
  21918. /**
  21919. * The base implementation of `getTag` without fallbacks for buggy environments.
  21920. *
  21921. * @private
  21922. * @param {*} value The value to query.
  21923. * @returns {string} Returns the `toStringTag`.
  21924. */
  21925. function baseGetTag(value) {
  21926. if (value == null) {
  21927. return value === undefined ? undefinedTag : nullTag;
  21928. }
  21929. return (symToStringTag && symToStringTag in Object(value))
  21930. ? getRawTag(value)
  21931. : objectToString(value);
  21932. }
  21933. /**
  21934. * The base implementation of `_.gt` which doesn't coerce arguments.
  21935. *
  21936. * @private
  21937. * @param {*} value The value to compare.
  21938. * @param {*} other The other value to compare.
  21939. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21940. * else `false`.
  21941. */
  21942. function baseGt(value, other) {
  21943. return value > other;
  21944. }
  21945. /**
  21946. * The base implementation of `_.has` without support for deep paths.
  21947. *
  21948. * @private
  21949. * @param {Object} [object] The object to query.
  21950. * @param {Array|string} key The key to check.
  21951. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21952. */
  21953. function baseHas(object, key) {
  21954. return object != null && hasOwnProperty.call(object, key);
  21955. }
  21956. /**
  21957. * The base implementation of `_.hasIn` without support for deep paths.
  21958. *
  21959. * @private
  21960. * @param {Object} [object] The object to query.
  21961. * @param {Array|string} key The key to check.
  21962. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21963. */
  21964. function baseHasIn(object, key) {
  21965. return object != null && key in Object(object);
  21966. }
  21967. /**
  21968. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21969. *
  21970. * @private
  21971. * @param {number} number The number to check.
  21972. * @param {number} start The start of the range.
  21973. * @param {number} end The end of the range.
  21974. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21975. */
  21976. function baseInRange(number, start, end) {
  21977. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21978. }
  21979. /**
  21980. * The base implementation of methods like `_.intersection`, without support
  21981. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21982. *
  21983. * @private
  21984. * @param {Array} arrays The arrays to inspect.
  21985. * @param {Function} [iteratee] The iteratee invoked per element.
  21986. * @param {Function} [comparator] The comparator invoked per element.
  21987. * @returns {Array} Returns the new array of shared values.
  21988. */
  21989. function baseIntersection(arrays, iteratee, comparator) {
  21990. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21991. length = arrays[0].length,
  21992. othLength = arrays.length,
  21993. othIndex = othLength,
  21994. caches = Array(othLength),
  21995. maxLength = Infinity,
  21996. result = [];
  21997. while (othIndex--) {
  21998. var array = arrays[othIndex];
  21999. if (othIndex && iteratee) {
  22000. array = arrayMap(array, baseUnary(iteratee));
  22001. }
  22002. maxLength = nativeMin(array.length, maxLength);
  22003. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  22004. ? new SetCache(othIndex && array)
  22005. : undefined;
  22006. }
  22007. array = arrays[0];
  22008. var index = -1,
  22009. seen = caches[0];
  22010. outer:
  22011. while (++index < length && result.length < maxLength) {
  22012. var value = array[index],
  22013. computed = iteratee ? iteratee(value) : value;
  22014. value = (comparator || value !== 0) ? value : 0;
  22015. if (!(seen
  22016. ? cacheHas(seen, computed)
  22017. : includes(result, computed, comparator)
  22018. )) {
  22019. othIndex = othLength;
  22020. while (--othIndex) {
  22021. var cache = caches[othIndex];
  22022. if (!(cache
  22023. ? cacheHas(cache, computed)
  22024. : includes(arrays[othIndex], computed, comparator))
  22025. ) {
  22026. continue outer;
  22027. }
  22028. }
  22029. if (seen) {
  22030. seen.push(computed);
  22031. }
  22032. result.push(value);
  22033. }
  22034. }
  22035. return result;
  22036. }
  22037. /**
  22038. * The base implementation of `_.invert` and `_.invertBy` which inverts
  22039. * `object` with values transformed by `iteratee` and set by `setter`.
  22040. *
  22041. * @private
  22042. * @param {Object} object The object to iterate over.
  22043. * @param {Function} setter The function to set `accumulator` values.
  22044. * @param {Function} iteratee The iteratee to transform values.
  22045. * @param {Object} accumulator The initial inverted object.
  22046. * @returns {Function} Returns `accumulator`.
  22047. */
  22048. function baseInverter(object, setter, iteratee, accumulator) {
  22049. baseForOwn(object, function(value, key, object) {
  22050. setter(accumulator, iteratee(value), key, object);
  22051. });
  22052. return accumulator;
  22053. }
  22054. /**
  22055. * The base implementation of `_.invoke` without support for individual
  22056. * method arguments.
  22057. *
  22058. * @private
  22059. * @param {Object} object The object to query.
  22060. * @param {Array|string} path The path of the method to invoke.
  22061. * @param {Array} args The arguments to invoke the method with.
  22062. * @returns {*} Returns the result of the invoked method.
  22063. */
  22064. function baseInvoke(object, path, args) {
  22065. path = castPath(path, object);
  22066. object = parent(object, path);
  22067. var func = object == null ? object : object[toKey(last(path))];
  22068. return func == null ? undefined : apply(func, object, args);
  22069. }
  22070. /**
  22071. * The base implementation of `_.isArguments`.
  22072. *
  22073. * @private
  22074. * @param {*} value The value to check.
  22075. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  22076. */
  22077. function baseIsArguments(value) {
  22078. return isObjectLike(value) && baseGetTag(value) == argsTag;
  22079. }
  22080. /**
  22081. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  22082. *
  22083. * @private
  22084. * @param {*} value The value to check.
  22085. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  22086. */
  22087. function baseIsArrayBuffer(value) {
  22088. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  22089. }
  22090. /**
  22091. * The base implementation of `_.isDate` without Node.js optimizations.
  22092. *
  22093. * @private
  22094. * @param {*} value The value to check.
  22095. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  22096. */
  22097. function baseIsDate(value) {
  22098. return isObjectLike(value) && baseGetTag(value) == dateTag;
  22099. }
  22100. /**
  22101. * The base implementation of `_.isEqual` which supports partial comparisons
  22102. * and tracks traversed objects.
  22103. *
  22104. * @private
  22105. * @param {*} value The value to compare.
  22106. * @param {*} other The other value to compare.
  22107. * @param {boolean} bitmask The bitmask flags.
  22108. * 1 - Unordered comparison
  22109. * 2 - Partial comparison
  22110. * @param {Function} [customizer] The function to customize comparisons.
  22111. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  22112. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  22113. */
  22114. function baseIsEqual(value, other, bitmask, customizer, stack) {
  22115. if (value === other) {
  22116. return true;
  22117. }
  22118. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  22119. return value !== value && other !== other;
  22120. }
  22121. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  22122. }
  22123. /**
  22124. * A specialized version of `baseIsEqual` for arrays and objects which performs
  22125. * deep comparisons and tracks traversed objects enabling objects with circular
  22126. * references to be compared.
  22127. *
  22128. * @private
  22129. * @param {Object} object The object to compare.
  22130. * @param {Object} other The other object to compare.
  22131. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  22132. * @param {Function} customizer The function to customize comparisons.
  22133. * @param {Function} equalFunc The function to determine equivalents of values.
  22134. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  22135. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  22136. */
  22137. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  22138. var objIsArr = isArray(object),
  22139. othIsArr = isArray(other),
  22140. objTag = objIsArr ? arrayTag : getTag(object),
  22141. othTag = othIsArr ? arrayTag : getTag(other);
  22142. objTag = objTag == argsTag ? objectTag : objTag;
  22143. othTag = othTag == argsTag ? objectTag : othTag;
  22144. var objIsObj = objTag == objectTag,
  22145. othIsObj = othTag == objectTag,
  22146. isSameTag = objTag == othTag;
  22147. if (isSameTag && isBuffer(object)) {
  22148. if (!isBuffer(other)) {
  22149. return false;
  22150. }
  22151. objIsArr = true;
  22152. objIsObj = false;
  22153. }
  22154. if (isSameTag && !objIsObj) {
  22155. stack || (stack = new Stack);
  22156. return (objIsArr || isTypedArray(object))
  22157. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  22158. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  22159. }
  22160. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  22161. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  22162. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  22163. if (objIsWrapped || othIsWrapped) {
  22164. var objUnwrapped = objIsWrapped ? object.value() : object,
  22165. othUnwrapped = othIsWrapped ? other.value() : other;
  22166. stack || (stack = new Stack);
  22167. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  22168. }
  22169. }
  22170. if (!isSameTag) {
  22171. return false;
  22172. }
  22173. stack || (stack = new Stack);
  22174. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  22175. }
  22176. /**
  22177. * The base implementation of `_.isMap` without Node.js optimizations.
  22178. *
  22179. * @private
  22180. * @param {*} value The value to check.
  22181. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  22182. */
  22183. function baseIsMap(value) {
  22184. return isObjectLike(value) && getTag(value) == mapTag;
  22185. }
  22186. /**
  22187. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  22188. *
  22189. * @private
  22190. * @param {Object} object The object to inspect.
  22191. * @param {Object} source The object of property values to match.
  22192. * @param {Array} matchData The property names, values, and compare flags to match.
  22193. * @param {Function} [customizer] The function to customize comparisons.
  22194. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  22195. */
  22196. function baseIsMatch(object, source, matchData, customizer) {
  22197. var index = matchData.length,
  22198. length = index,
  22199. noCustomizer = !customizer;
  22200. if (object == null) {
  22201. return !length;
  22202. }
  22203. object = Object(object);
  22204. while (index--) {
  22205. var data = matchData[index];
  22206. if ((noCustomizer && data[2])
  22207. ? data[1] !== object[data[0]]
  22208. : !(data[0] in object)
  22209. ) {
  22210. return false;
  22211. }
  22212. }
  22213. while (++index < length) {
  22214. data = matchData[index];
  22215. var key = data[0],
  22216. objValue = object[key],
  22217. srcValue = data[1];
  22218. if (noCustomizer && data[2]) {
  22219. if (objValue === undefined && !(key in object)) {
  22220. return false;
  22221. }
  22222. } else {
  22223. var stack = new Stack;
  22224. if (customizer) {
  22225. var result = customizer(objValue, srcValue, key, object, source, stack);
  22226. }
  22227. if (!(result === undefined
  22228. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  22229. : result
  22230. )) {
  22231. return false;
  22232. }
  22233. }
  22234. }
  22235. return true;
  22236. }
  22237. /**
  22238. * The base implementation of `_.isNative` without bad shim checks.
  22239. *
  22240. * @private
  22241. * @param {*} value The value to check.
  22242. * @returns {boolean} Returns `true` if `value` is a native function,
  22243. * else `false`.
  22244. */
  22245. function baseIsNative(value) {
  22246. if (!isObject(value) || isMasked(value)) {
  22247. return false;
  22248. }
  22249. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  22250. return pattern.test(toSource(value));
  22251. }
  22252. /**
  22253. * The base implementation of `_.isRegExp` without Node.js optimizations.
  22254. *
  22255. * @private
  22256. * @param {*} value The value to check.
  22257. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  22258. */
  22259. function baseIsRegExp(value) {
  22260. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  22261. }
  22262. /**
  22263. * The base implementation of `_.isSet` without Node.js optimizations.
  22264. *
  22265. * @private
  22266. * @param {*} value The value to check.
  22267. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  22268. */
  22269. function baseIsSet(value) {
  22270. return isObjectLike(value) && getTag(value) == setTag;
  22271. }
  22272. /**
  22273. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  22274. *
  22275. * @private
  22276. * @param {*} value The value to check.
  22277. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  22278. */
  22279. function baseIsTypedArray(value) {
  22280. return isObjectLike(value) &&
  22281. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  22282. }
  22283. /**
  22284. * The base implementation of `_.iteratee`.
  22285. *
  22286. * @private
  22287. * @param {*} [value=_.identity] The value to convert to an iteratee.
  22288. * @returns {Function} Returns the iteratee.
  22289. */
  22290. function baseIteratee(value) {
  22291. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  22292. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  22293. if (typeof value == 'function') {
  22294. return value;
  22295. }
  22296. if (value == null) {
  22297. return identity;
  22298. }
  22299. if (typeof value == 'object') {
  22300. return isArray(value)
  22301. ? baseMatchesProperty(value[0], value[1])
  22302. : baseMatches(value);
  22303. }
  22304. return property(value);
  22305. }
  22306. /**
  22307. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  22308. *
  22309. * @private
  22310. * @param {Object} object The object to query.
  22311. * @returns {Array} Returns the array of property names.
  22312. */
  22313. function baseKeys(object) {
  22314. if (!isPrototype(object)) {
  22315. return nativeKeys(object);
  22316. }
  22317. var result = [];
  22318. for (var key in Object(object)) {
  22319. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  22320. result.push(key);
  22321. }
  22322. }
  22323. return result;
  22324. }
  22325. /**
  22326. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  22327. *
  22328. * @private
  22329. * @param {Object} object The object to query.
  22330. * @returns {Array} Returns the array of property names.
  22331. */
  22332. function baseKeysIn(object) {
  22333. if (!isObject(object)) {
  22334. return nativeKeysIn(object);
  22335. }
  22336. var isProto = isPrototype(object),
  22337. result = [];
  22338. for (var key in object) {
  22339. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  22340. result.push(key);
  22341. }
  22342. }
  22343. return result;
  22344. }
  22345. /**
  22346. * The base implementation of `_.lt` which doesn't coerce arguments.
  22347. *
  22348. * @private
  22349. * @param {*} value The value to compare.
  22350. * @param {*} other The other value to compare.
  22351. * @returns {boolean} Returns `true` if `value` is less than `other`,
  22352. * else `false`.
  22353. */
  22354. function baseLt(value, other) {
  22355. return value < other;
  22356. }
  22357. /**
  22358. * The base implementation of `_.map` without support for iteratee shorthands.
  22359. *
  22360. * @private
  22361. * @param {Array|Object} collection The collection to iterate over.
  22362. * @param {Function} iteratee The function invoked per iteration.
  22363. * @returns {Array} Returns the new mapped array.
  22364. */
  22365. function baseMap(collection, iteratee) {
  22366. var index = -1,
  22367. result = isArrayLike(collection) ? Array(collection.length) : [];
  22368. baseEach(collection, function(value, key, collection) {
  22369. result[++index] = iteratee(value, key, collection);
  22370. });
  22371. return result;
  22372. }
  22373. /**
  22374. * The base implementation of `_.matches` which doesn't clone `source`.
  22375. *
  22376. * @private
  22377. * @param {Object} source The object of property values to match.
  22378. * @returns {Function} Returns the new spec function.
  22379. */
  22380. function baseMatches(source) {
  22381. var matchData = getMatchData(source);
  22382. if (matchData.length == 1 && matchData[0][2]) {
  22383. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  22384. }
  22385. return function(object) {
  22386. return object === source || baseIsMatch(object, source, matchData);
  22387. };
  22388. }
  22389. /**
  22390. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  22391. *
  22392. * @private
  22393. * @param {string} path The path of the property to get.
  22394. * @param {*} srcValue The value to match.
  22395. * @returns {Function} Returns the new spec function.
  22396. */
  22397. function baseMatchesProperty(path, srcValue) {
  22398. if (isKey(path) && isStrictComparable(srcValue)) {
  22399. return matchesStrictComparable(toKey(path), srcValue);
  22400. }
  22401. return function(object) {
  22402. var objValue = get(object, path);
  22403. return (objValue === undefined && objValue === srcValue)
  22404. ? hasIn(object, path)
  22405. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  22406. };
  22407. }
  22408. /**
  22409. * The base implementation of `_.merge` without support for multiple sources.
  22410. *
  22411. * @private
  22412. * @param {Object} object The destination object.
  22413. * @param {Object} source The source object.
  22414. * @param {number} srcIndex The index of `source`.
  22415. * @param {Function} [customizer] The function to customize merged values.
  22416. * @param {Object} [stack] Tracks traversed source values and their merged
  22417. * counterparts.
  22418. */
  22419. function baseMerge(object, source, srcIndex, customizer, stack) {
  22420. if (object === source) {
  22421. return;
  22422. }
  22423. baseFor(source, function(srcValue, key) {
  22424. stack || (stack = new Stack);
  22425. if (isObject(srcValue)) {
  22426. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  22427. }
  22428. else {
  22429. var newValue = customizer
  22430. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  22431. : undefined;
  22432. if (newValue === undefined) {
  22433. newValue = srcValue;
  22434. }
  22435. assignMergeValue(object, key, newValue);
  22436. }
  22437. }, keysIn);
  22438. }
  22439. /**
  22440. * A specialized version of `baseMerge` for arrays and objects which performs
  22441. * deep merges and tracks traversed objects enabling objects with circular
  22442. * references to be merged.
  22443. *
  22444. * @private
  22445. * @param {Object} object The destination object.
  22446. * @param {Object} source The source object.
  22447. * @param {string} key The key of the value to merge.
  22448. * @param {number} srcIndex The index of `source`.
  22449. * @param {Function} mergeFunc The function to merge values.
  22450. * @param {Function} [customizer] The function to customize assigned values.
  22451. * @param {Object} [stack] Tracks traversed source values and their merged
  22452. * counterparts.
  22453. */
  22454. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  22455. var objValue = safeGet(object, key),
  22456. srcValue = safeGet(source, key),
  22457. stacked = stack.get(srcValue);
  22458. if (stacked) {
  22459. assignMergeValue(object, key, stacked);
  22460. return;
  22461. }
  22462. var newValue = customizer
  22463. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  22464. : undefined;
  22465. var isCommon = newValue === undefined;
  22466. if (isCommon) {
  22467. var isArr = isArray(srcValue),
  22468. isBuff = !isArr && isBuffer(srcValue),
  22469. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  22470. newValue = srcValue;
  22471. if (isArr || isBuff || isTyped) {
  22472. if (isArray(objValue)) {
  22473. newValue = objValue;
  22474. }
  22475. else if (isArrayLikeObject(objValue)) {
  22476. newValue = copyArray(objValue);
  22477. }
  22478. else if (isBuff) {
  22479. isCommon = false;
  22480. newValue = cloneBuffer(srcValue, true);
  22481. }
  22482. else if (isTyped) {
  22483. isCommon = false;
  22484. newValue = cloneTypedArray(srcValue, true);
  22485. }
  22486. else {
  22487. newValue = [];
  22488. }
  22489. }
  22490. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  22491. newValue = objValue;
  22492. if (isArguments(objValue)) {
  22493. newValue = toPlainObject(objValue);
  22494. }
  22495. else if (!isObject(objValue) || isFunction(objValue)) {
  22496. newValue = initCloneObject(srcValue);
  22497. }
  22498. }
  22499. else {
  22500. isCommon = false;
  22501. }
  22502. }
  22503. if (isCommon) {
  22504. // Recursively merge objects and arrays (susceptible to call stack limits).
  22505. stack.set(srcValue, newValue);
  22506. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  22507. stack['delete'](srcValue);
  22508. }
  22509. assignMergeValue(object, key, newValue);
  22510. }
  22511. /**
  22512. * The base implementation of `_.nth` which doesn't coerce arguments.
  22513. *
  22514. * @private
  22515. * @param {Array} array The array to query.
  22516. * @param {number} n The index of the element to return.
  22517. * @returns {*} Returns the nth element of `array`.
  22518. */
  22519. function baseNth(array, n) {
  22520. var length = array.length;
  22521. if (!length) {
  22522. return;
  22523. }
  22524. n += n < 0 ? length : 0;
  22525. return isIndex(n, length) ? array[n] : undefined;
  22526. }
  22527. /**
  22528. * The base implementation of `_.orderBy` without param guards.
  22529. *
  22530. * @private
  22531. * @param {Array|Object} collection The collection to iterate over.
  22532. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  22533. * @param {string[]} orders The sort orders of `iteratees`.
  22534. * @returns {Array} Returns the new sorted array.
  22535. */
  22536. function baseOrderBy(collection, iteratees, orders) {
  22537. var index = -1;
  22538. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  22539. var result = baseMap(collection, function(value, key, collection) {
  22540. var criteria = arrayMap(iteratees, function(iteratee) {
  22541. return iteratee(value);
  22542. });
  22543. return { 'criteria': criteria, 'index': ++index, 'value': value };
  22544. });
  22545. return baseSortBy(result, function(object, other) {
  22546. return compareMultiple(object, other, orders);
  22547. });
  22548. }
  22549. /**
  22550. * The base implementation of `_.pick` without support for individual
  22551. * property identifiers.
  22552. *
  22553. * @private
  22554. * @param {Object} object The source object.
  22555. * @param {string[]} paths The property paths to pick.
  22556. * @returns {Object} Returns the new object.
  22557. */
  22558. function basePick(object, paths) {
  22559. return basePickBy(object, paths, function(value, path) {
  22560. return hasIn(object, path);
  22561. });
  22562. }
  22563. /**
  22564. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  22565. *
  22566. * @private
  22567. * @param {Object} object The source object.
  22568. * @param {string[]} paths The property paths to pick.
  22569. * @param {Function} predicate The function invoked per property.
  22570. * @returns {Object} Returns the new object.
  22571. */
  22572. function basePickBy(object, paths, predicate) {
  22573. var index = -1,
  22574. length = paths.length,
  22575. result = {};
  22576. while (++index < length) {
  22577. var path = paths[index],
  22578. value = baseGet(object, path);
  22579. if (predicate(value, path)) {
  22580. baseSet(result, castPath(path, object), value);
  22581. }
  22582. }
  22583. return result;
  22584. }
  22585. /**
  22586. * A specialized version of `baseProperty` which supports deep paths.
  22587. *
  22588. * @private
  22589. * @param {Array|string} path The path of the property to get.
  22590. * @returns {Function} Returns the new accessor function.
  22591. */
  22592. function basePropertyDeep(path) {
  22593. return function(object) {
  22594. return baseGet(object, path);
  22595. };
  22596. }
  22597. /**
  22598. * The base implementation of `_.pullAllBy` without support for iteratee
  22599. * shorthands.
  22600. *
  22601. * @private
  22602. * @param {Array} array The array to modify.
  22603. * @param {Array} values The values to remove.
  22604. * @param {Function} [iteratee] The iteratee invoked per element.
  22605. * @param {Function} [comparator] The comparator invoked per element.
  22606. * @returns {Array} Returns `array`.
  22607. */
  22608. function basePullAll(array, values, iteratee, comparator) {
  22609. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  22610. index = -1,
  22611. length = values.length,
  22612. seen = array;
  22613. if (array === values) {
  22614. values = copyArray(values);
  22615. }
  22616. if (iteratee) {
  22617. seen = arrayMap(array, baseUnary(iteratee));
  22618. }
  22619. while (++index < length) {
  22620. var fromIndex = 0,
  22621. value = values[index],
  22622. computed = iteratee ? iteratee(value) : value;
  22623. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  22624. if (seen !== array) {
  22625. splice.call(seen, fromIndex, 1);
  22626. }
  22627. splice.call(array, fromIndex, 1);
  22628. }
  22629. }
  22630. return array;
  22631. }
  22632. /**
  22633. * The base implementation of `_.pullAt` without support for individual
  22634. * indexes or capturing the removed elements.
  22635. *
  22636. * @private
  22637. * @param {Array} array The array to modify.
  22638. * @param {number[]} indexes The indexes of elements to remove.
  22639. * @returns {Array} Returns `array`.
  22640. */
  22641. function basePullAt(array, indexes) {
  22642. var length = array ? indexes.length : 0,
  22643. lastIndex = length - 1;
  22644. while (length--) {
  22645. var index = indexes[length];
  22646. if (length == lastIndex || index !== previous) {
  22647. var previous = index;
  22648. if (isIndex(index)) {
  22649. splice.call(array, index, 1);
  22650. } else {
  22651. baseUnset(array, index);
  22652. }
  22653. }
  22654. }
  22655. return array;
  22656. }
  22657. /**
  22658. * The base implementation of `_.random` without support for returning
  22659. * floating-point numbers.
  22660. *
  22661. * @private
  22662. * @param {number} lower The lower bound.
  22663. * @param {number} upper The upper bound.
  22664. * @returns {number} Returns the random number.
  22665. */
  22666. function baseRandom(lower, upper) {
  22667. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  22668. }
  22669. /**
  22670. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  22671. * coerce arguments.
  22672. *
  22673. * @private
  22674. * @param {number} start The start of the range.
  22675. * @param {number} end The end of the range.
  22676. * @param {number} step The value to increment or decrement by.
  22677. * @param {boolean} [fromRight] Specify iterating from right to left.
  22678. * @returns {Array} Returns the range of numbers.
  22679. */
  22680. function baseRange(start, end, step, fromRight) {
  22681. var index = -1,
  22682. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  22683. result = Array(length);
  22684. while (length--) {
  22685. result[fromRight ? length : ++index] = start;
  22686. start += step;
  22687. }
  22688. return result;
  22689. }
  22690. /**
  22691. * The base implementation of `_.repeat` which doesn't coerce arguments.
  22692. *
  22693. * @private
  22694. * @param {string} string The string to repeat.
  22695. * @param {number} n The number of times to repeat the string.
  22696. * @returns {string} Returns the repeated string.
  22697. */
  22698. function baseRepeat(string, n) {
  22699. var result = '';
  22700. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  22701. return result;
  22702. }
  22703. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  22704. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  22705. do {
  22706. if (n % 2) {
  22707. result += string;
  22708. }
  22709. n = nativeFloor(n / 2);
  22710. if (n) {
  22711. string += string;
  22712. }
  22713. } while (n);
  22714. return result;
  22715. }
  22716. /**
  22717. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  22718. *
  22719. * @private
  22720. * @param {Function} func The function to apply a rest parameter to.
  22721. * @param {number} [start=func.length-1] The start position of the rest parameter.
  22722. * @returns {Function} Returns the new function.
  22723. */
  22724. function baseRest(func, start) {
  22725. return setToString(overRest(func, start, identity), func + '');
  22726. }
  22727. /**
  22728. * The base implementation of `_.sample`.
  22729. *
  22730. * @private
  22731. * @param {Array|Object} collection The collection to sample.
  22732. * @returns {*} Returns the random element.
  22733. */
  22734. function baseSample(collection) {
  22735. return arraySample(values(collection));
  22736. }
  22737. /**
  22738. * The base implementation of `_.sampleSize` without param guards.
  22739. *
  22740. * @private
  22741. * @param {Array|Object} collection The collection to sample.
  22742. * @param {number} n The number of elements to sample.
  22743. * @returns {Array} Returns the random elements.
  22744. */
  22745. function baseSampleSize(collection, n) {
  22746. var array = values(collection);
  22747. return shuffleSelf(array, baseClamp(n, 0, array.length));
  22748. }
  22749. /**
  22750. * The base implementation of `_.set`.
  22751. *
  22752. * @private
  22753. * @param {Object} object The object to modify.
  22754. * @param {Array|string} path The path of the property to set.
  22755. * @param {*} value The value to set.
  22756. * @param {Function} [customizer] The function to customize path creation.
  22757. * @returns {Object} Returns `object`.
  22758. */
  22759. function baseSet(object, path, value, customizer) {
  22760. if (!isObject(object)) {
  22761. return object;
  22762. }
  22763. path = castPath(path, object);
  22764. var index = -1,
  22765. length = path.length,
  22766. lastIndex = length - 1,
  22767. nested = object;
  22768. while (nested != null && ++index < length) {
  22769. var key = toKey(path[index]),
  22770. newValue = value;
  22771. if (index != lastIndex) {
  22772. var objValue = nested[key];
  22773. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  22774. if (newValue === undefined) {
  22775. newValue = isObject(objValue)
  22776. ? objValue
  22777. : (isIndex(path[index + 1]) ? [] : {});
  22778. }
  22779. }
  22780. assignValue(nested, key, newValue);
  22781. nested = nested[key];
  22782. }
  22783. return object;
  22784. }
  22785. /**
  22786. * The base implementation of `setData` without support for hot loop shorting.
  22787. *
  22788. * @private
  22789. * @param {Function} func The function to associate metadata with.
  22790. * @param {*} data The metadata.
  22791. * @returns {Function} Returns `func`.
  22792. */
  22793. var baseSetData = !metaMap ? identity : function(func, data) {
  22794. metaMap.set(func, data);
  22795. return func;
  22796. };
  22797. /**
  22798. * The base implementation of `setToString` without support for hot loop shorting.
  22799. *
  22800. * @private
  22801. * @param {Function} func The function to modify.
  22802. * @param {Function} string The `toString` result.
  22803. * @returns {Function} Returns `func`.
  22804. */
  22805. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22806. return defineProperty(func, 'toString', {
  22807. 'configurable': true,
  22808. 'enumerable': false,
  22809. 'value': constant(string),
  22810. 'writable': true
  22811. });
  22812. };
  22813. /**
  22814. * The base implementation of `_.shuffle`.
  22815. *
  22816. * @private
  22817. * @param {Array|Object} collection The collection to shuffle.
  22818. * @returns {Array} Returns the new shuffled array.
  22819. */
  22820. function baseShuffle(collection) {
  22821. return shuffleSelf(values(collection));
  22822. }
  22823. /**
  22824. * The base implementation of `_.slice` without an iteratee call guard.
  22825. *
  22826. * @private
  22827. * @param {Array} array The array to slice.
  22828. * @param {number} [start=0] The start position.
  22829. * @param {number} [end=array.length] The end position.
  22830. * @returns {Array} Returns the slice of `array`.
  22831. */
  22832. function baseSlice(array, start, end) {
  22833. var index = -1,
  22834. length = array.length;
  22835. if (start < 0) {
  22836. start = -start > length ? 0 : (length + start);
  22837. }
  22838. end = end > length ? length : end;
  22839. if (end < 0) {
  22840. end += length;
  22841. }
  22842. length = start > end ? 0 : ((end - start) >>> 0);
  22843. start >>>= 0;
  22844. var result = Array(length);
  22845. while (++index < length) {
  22846. result[index] = array[index + start];
  22847. }
  22848. return result;
  22849. }
  22850. /**
  22851. * The base implementation of `_.some` without support for iteratee shorthands.
  22852. *
  22853. * @private
  22854. * @param {Array|Object} collection The collection to iterate over.
  22855. * @param {Function} predicate The function invoked per iteration.
  22856. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22857. * else `false`.
  22858. */
  22859. function baseSome(collection, predicate) {
  22860. var result;
  22861. baseEach(collection, function(value, index, collection) {
  22862. result = predicate(value, index, collection);
  22863. return !result;
  22864. });
  22865. return !!result;
  22866. }
  22867. /**
  22868. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22869. * performs a binary search of `array` to determine the index at which `value`
  22870. * should be inserted into `array` in order to maintain its sort order.
  22871. *
  22872. * @private
  22873. * @param {Array} array The sorted array to inspect.
  22874. * @param {*} value The value to evaluate.
  22875. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22876. * @returns {number} Returns the index at which `value` should be inserted
  22877. * into `array`.
  22878. */
  22879. function baseSortedIndex(array, value, retHighest) {
  22880. var low = 0,
  22881. high = array == null ? low : array.length;
  22882. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22883. while (low < high) {
  22884. var mid = (low + high) >>> 1,
  22885. computed = array[mid];
  22886. if (computed !== null && !isSymbol(computed) &&
  22887. (retHighest ? (computed <= value) : (computed < value))) {
  22888. low = mid + 1;
  22889. } else {
  22890. high = mid;
  22891. }
  22892. }
  22893. return high;
  22894. }
  22895. return baseSortedIndexBy(array, value, identity, retHighest);
  22896. }
  22897. /**
  22898. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22899. * which invokes `iteratee` for `value` and each element of `array` to compute
  22900. * their sort ranking. The iteratee is invoked with one argument; (value).
  22901. *
  22902. * @private
  22903. * @param {Array} array The sorted array to inspect.
  22904. * @param {*} value The value to evaluate.
  22905. * @param {Function} iteratee The iteratee invoked per element.
  22906. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22907. * @returns {number} Returns the index at which `value` should be inserted
  22908. * into `array`.
  22909. */
  22910. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22911. value = iteratee(value);
  22912. var low = 0,
  22913. high = array == null ? 0 : array.length,
  22914. valIsNaN = value !== value,
  22915. valIsNull = value === null,
  22916. valIsSymbol = isSymbol(value),
  22917. valIsUndefined = value === undefined;
  22918. while (low < high) {
  22919. var mid = nativeFloor((low + high) / 2),
  22920. computed = iteratee(array[mid]),
  22921. othIsDefined = computed !== undefined,
  22922. othIsNull = computed === null,
  22923. othIsReflexive = computed === computed,
  22924. othIsSymbol = isSymbol(computed);
  22925. if (valIsNaN) {
  22926. var setLow = retHighest || othIsReflexive;
  22927. } else if (valIsUndefined) {
  22928. setLow = othIsReflexive && (retHighest || othIsDefined);
  22929. } else if (valIsNull) {
  22930. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22931. } else if (valIsSymbol) {
  22932. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22933. } else if (othIsNull || othIsSymbol) {
  22934. setLow = false;
  22935. } else {
  22936. setLow = retHighest ? (computed <= value) : (computed < value);
  22937. }
  22938. if (setLow) {
  22939. low = mid + 1;
  22940. } else {
  22941. high = mid;
  22942. }
  22943. }
  22944. return nativeMin(high, MAX_ARRAY_INDEX);
  22945. }
  22946. /**
  22947. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22948. * support for iteratee shorthands.
  22949. *
  22950. * @private
  22951. * @param {Array} array The array to inspect.
  22952. * @param {Function} [iteratee] The iteratee invoked per element.
  22953. * @returns {Array} Returns the new duplicate free array.
  22954. */
  22955. function baseSortedUniq(array, iteratee) {
  22956. var index = -1,
  22957. length = array.length,
  22958. resIndex = 0,
  22959. result = [];
  22960. while (++index < length) {
  22961. var value = array[index],
  22962. computed = iteratee ? iteratee(value) : value;
  22963. if (!index || !eq(computed, seen)) {
  22964. var seen = computed;
  22965. result[resIndex++] = value === 0 ? 0 : value;
  22966. }
  22967. }
  22968. return result;
  22969. }
  22970. /**
  22971. * The base implementation of `_.toNumber` which doesn't ensure correct
  22972. * conversions of binary, hexadecimal, or octal string values.
  22973. *
  22974. * @private
  22975. * @param {*} value The value to process.
  22976. * @returns {number} Returns the number.
  22977. */
  22978. function baseToNumber(value) {
  22979. if (typeof value == 'number') {
  22980. return value;
  22981. }
  22982. if (isSymbol(value)) {
  22983. return NAN;
  22984. }
  22985. return +value;
  22986. }
  22987. /**
  22988. * The base implementation of `_.toString` which doesn't convert nullish
  22989. * values to empty strings.
  22990. *
  22991. * @private
  22992. * @param {*} value The value to process.
  22993. * @returns {string} Returns the string.
  22994. */
  22995. function baseToString(value) {
  22996. // Exit early for strings to avoid a performance hit in some environments.
  22997. if (typeof value == 'string') {
  22998. return value;
  22999. }
  23000. if (isArray(value)) {
  23001. // Recursively convert values (susceptible to call stack limits).
  23002. return arrayMap(value, baseToString) + '';
  23003. }
  23004. if (isSymbol(value)) {
  23005. return symbolToString ? symbolToString.call(value) : '';
  23006. }
  23007. var result = (value + '');
  23008. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  23009. }
  23010. /**
  23011. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  23012. *
  23013. * @private
  23014. * @param {Array} array The array to inspect.
  23015. * @param {Function} [iteratee] The iteratee invoked per element.
  23016. * @param {Function} [comparator] The comparator invoked per element.
  23017. * @returns {Array} Returns the new duplicate free array.
  23018. */
  23019. function baseUniq(array, iteratee, comparator) {
  23020. var index = -1,
  23021. includes = arrayIncludes,
  23022. length = array.length,
  23023. isCommon = true,
  23024. result = [],
  23025. seen = result;
  23026. if (comparator) {
  23027. isCommon = false;
  23028. includes = arrayIncludesWith;
  23029. }
  23030. else if (length >= LARGE_ARRAY_SIZE) {
  23031. var set = iteratee ? null : createSet(array);
  23032. if (set) {
  23033. return setToArray(set);
  23034. }
  23035. isCommon = false;
  23036. includes = cacheHas;
  23037. seen = new SetCache;
  23038. }
  23039. else {
  23040. seen = iteratee ? [] : result;
  23041. }
  23042. outer:
  23043. while (++index < length) {
  23044. var value = array[index],
  23045. computed = iteratee ? iteratee(value) : value;
  23046. value = (comparator || value !== 0) ? value : 0;
  23047. if (isCommon && computed === computed) {
  23048. var seenIndex = seen.length;
  23049. while (seenIndex--) {
  23050. if (seen[seenIndex] === computed) {
  23051. continue outer;
  23052. }
  23053. }
  23054. if (iteratee) {
  23055. seen.push(computed);
  23056. }
  23057. result.push(value);
  23058. }
  23059. else if (!includes(seen, computed, comparator)) {
  23060. if (seen !== result) {
  23061. seen.push(computed);
  23062. }
  23063. result.push(value);
  23064. }
  23065. }
  23066. return result;
  23067. }
  23068. /**
  23069. * The base implementation of `_.unset`.
  23070. *
  23071. * @private
  23072. * @param {Object} object The object to modify.
  23073. * @param {Array|string} path The property path to unset.
  23074. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  23075. */
  23076. function baseUnset(object, path) {
  23077. path = castPath(path, object);
  23078. object = parent(object, path);
  23079. return object == null || delete object[toKey(last(path))];
  23080. }
  23081. /**
  23082. * The base implementation of `_.update`.
  23083. *
  23084. * @private
  23085. * @param {Object} object The object to modify.
  23086. * @param {Array|string} path The path of the property to update.
  23087. * @param {Function} updater The function to produce the updated value.
  23088. * @param {Function} [customizer] The function to customize path creation.
  23089. * @returns {Object} Returns `object`.
  23090. */
  23091. function baseUpdate(object, path, updater, customizer) {
  23092. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  23093. }
  23094. /**
  23095. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  23096. * without support for iteratee shorthands.
  23097. *
  23098. * @private
  23099. * @param {Array} array The array to query.
  23100. * @param {Function} predicate The function invoked per iteration.
  23101. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  23102. * @param {boolean} [fromRight] Specify iterating from right to left.
  23103. * @returns {Array} Returns the slice of `array`.
  23104. */
  23105. function baseWhile(array, predicate, isDrop, fromRight) {
  23106. var length = array.length,
  23107. index = fromRight ? length : -1;
  23108. while ((fromRight ? index-- : ++index < length) &&
  23109. predicate(array[index], index, array)) {}
  23110. return isDrop
  23111. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  23112. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  23113. }
  23114. /**
  23115. * The base implementation of `wrapperValue` which returns the result of
  23116. * performing a sequence of actions on the unwrapped `value`, where each
  23117. * successive action is supplied the return value of the previous.
  23118. *
  23119. * @private
  23120. * @param {*} value The unwrapped value.
  23121. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  23122. * @returns {*} Returns the resolved value.
  23123. */
  23124. function baseWrapperValue(value, actions) {
  23125. var result = value;
  23126. if (result instanceof LazyWrapper) {
  23127. result = result.value();
  23128. }
  23129. return arrayReduce(actions, function(result, action) {
  23130. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  23131. }, result);
  23132. }
  23133. /**
  23134. * The base implementation of methods like `_.xor`, without support for
  23135. * iteratee shorthands, that accepts an array of arrays to inspect.
  23136. *
  23137. * @private
  23138. * @param {Array} arrays The arrays to inspect.
  23139. * @param {Function} [iteratee] The iteratee invoked per element.
  23140. * @param {Function} [comparator] The comparator invoked per element.
  23141. * @returns {Array} Returns the new array of values.
  23142. */
  23143. function baseXor(arrays, iteratee, comparator) {
  23144. var length = arrays.length;
  23145. if (length < 2) {
  23146. return length ? baseUniq(arrays[0]) : [];
  23147. }
  23148. var index = -1,
  23149. result = Array(length);
  23150. while (++index < length) {
  23151. var array = arrays[index],
  23152. othIndex = -1;
  23153. while (++othIndex < length) {
  23154. if (othIndex != index) {
  23155. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  23156. }
  23157. }
  23158. }
  23159. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  23160. }
  23161. /**
  23162. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  23163. *
  23164. * @private
  23165. * @param {Array} props The property identifiers.
  23166. * @param {Array} values The property values.
  23167. * @param {Function} assignFunc The function to assign values.
  23168. * @returns {Object} Returns the new object.
  23169. */
  23170. function baseZipObject(props, values, assignFunc) {
  23171. var index = -1,
  23172. length = props.length,
  23173. valsLength = values.length,
  23174. result = {};
  23175. while (++index < length) {
  23176. var value = index < valsLength ? values[index] : undefined;
  23177. assignFunc(result, props[index], value);
  23178. }
  23179. return result;
  23180. }
  23181. /**
  23182. * Casts `value` to an empty array if it's not an array like object.
  23183. *
  23184. * @private
  23185. * @param {*} value The value to inspect.
  23186. * @returns {Array|Object} Returns the cast array-like object.
  23187. */
  23188. function castArrayLikeObject(value) {
  23189. return isArrayLikeObject(value) ? value : [];
  23190. }
  23191. /**
  23192. * Casts `value` to `identity` if it's not a function.
  23193. *
  23194. * @private
  23195. * @param {*} value The value to inspect.
  23196. * @returns {Function} Returns cast function.
  23197. */
  23198. function castFunction(value) {
  23199. return typeof value == 'function' ? value : identity;
  23200. }
  23201. /**
  23202. * Casts `value` to a path array if it's not one.
  23203. *
  23204. * @private
  23205. * @param {*} value The value to inspect.
  23206. * @param {Object} [object] The object to query keys on.
  23207. * @returns {Array} Returns the cast property path array.
  23208. */
  23209. function castPath(value, object) {
  23210. if (isArray(value)) {
  23211. return value;
  23212. }
  23213. return isKey(value, object) ? [value] : stringToPath(toString(value));
  23214. }
  23215. /**
  23216. * A `baseRest` alias which can be replaced with `identity` by module
  23217. * replacement plugins.
  23218. *
  23219. * @private
  23220. * @type {Function}
  23221. * @param {Function} func The function to apply a rest parameter to.
  23222. * @returns {Function} Returns the new function.
  23223. */
  23224. var castRest = baseRest;
  23225. /**
  23226. * Casts `array` to a slice if it's needed.
  23227. *
  23228. * @private
  23229. * @param {Array} array The array to inspect.
  23230. * @param {number} start The start position.
  23231. * @param {number} [end=array.length] The end position.
  23232. * @returns {Array} Returns the cast slice.
  23233. */
  23234. function castSlice(array, start, end) {
  23235. var length = array.length;
  23236. end = end === undefined ? length : end;
  23237. return (!start && end >= length) ? array : baseSlice(array, start, end);
  23238. }
  23239. /**
  23240. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  23241. *
  23242. * @private
  23243. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  23244. */
  23245. var clearTimeout = ctxClearTimeout || function(id) {
  23246. return root.clearTimeout(id);
  23247. };
  23248. /**
  23249. * Creates a clone of `buffer`.
  23250. *
  23251. * @private
  23252. * @param {Buffer} buffer The buffer to clone.
  23253. * @param {boolean} [isDeep] Specify a deep clone.
  23254. * @returns {Buffer} Returns the cloned buffer.
  23255. */
  23256. function cloneBuffer(buffer, isDeep) {
  23257. if (isDeep) {
  23258. return buffer.slice();
  23259. }
  23260. var length = buffer.length,
  23261. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  23262. buffer.copy(result);
  23263. return result;
  23264. }
  23265. /**
  23266. * Creates a clone of `arrayBuffer`.
  23267. *
  23268. * @private
  23269. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  23270. * @returns {ArrayBuffer} Returns the cloned array buffer.
  23271. */
  23272. function cloneArrayBuffer(arrayBuffer) {
  23273. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  23274. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  23275. return result;
  23276. }
  23277. /**
  23278. * Creates a clone of `dataView`.
  23279. *
  23280. * @private
  23281. * @param {Object} dataView The data view to clone.
  23282. * @param {boolean} [isDeep] Specify a deep clone.
  23283. * @returns {Object} Returns the cloned data view.
  23284. */
  23285. function cloneDataView(dataView, isDeep) {
  23286. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  23287. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  23288. }
  23289. /**
  23290. * Creates a clone of `regexp`.
  23291. *
  23292. * @private
  23293. * @param {Object} regexp The regexp to clone.
  23294. * @returns {Object} Returns the cloned regexp.
  23295. */
  23296. function cloneRegExp(regexp) {
  23297. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  23298. result.lastIndex = regexp.lastIndex;
  23299. return result;
  23300. }
  23301. /**
  23302. * Creates a clone of the `symbol` object.
  23303. *
  23304. * @private
  23305. * @param {Object} symbol The symbol object to clone.
  23306. * @returns {Object} Returns the cloned symbol object.
  23307. */
  23308. function cloneSymbol(symbol) {
  23309. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  23310. }
  23311. /**
  23312. * Creates a clone of `typedArray`.
  23313. *
  23314. * @private
  23315. * @param {Object} typedArray The typed array to clone.
  23316. * @param {boolean} [isDeep] Specify a deep clone.
  23317. * @returns {Object} Returns the cloned typed array.
  23318. */
  23319. function cloneTypedArray(typedArray, isDeep) {
  23320. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  23321. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  23322. }
  23323. /**
  23324. * Compares values to sort them in ascending order.
  23325. *
  23326. * @private
  23327. * @param {*} value The value to compare.
  23328. * @param {*} other The other value to compare.
  23329. * @returns {number} Returns the sort order indicator for `value`.
  23330. */
  23331. function compareAscending(value, other) {
  23332. if (value !== other) {
  23333. var valIsDefined = value !== undefined,
  23334. valIsNull = value === null,
  23335. valIsReflexive = value === value,
  23336. valIsSymbol = isSymbol(value);
  23337. var othIsDefined = other !== undefined,
  23338. othIsNull = other === null,
  23339. othIsReflexive = other === other,
  23340. othIsSymbol = isSymbol(other);
  23341. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  23342. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  23343. (valIsNull && othIsDefined && othIsReflexive) ||
  23344. (!valIsDefined && othIsReflexive) ||
  23345. !valIsReflexive) {
  23346. return 1;
  23347. }
  23348. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  23349. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  23350. (othIsNull && valIsDefined && valIsReflexive) ||
  23351. (!othIsDefined && valIsReflexive) ||
  23352. !othIsReflexive) {
  23353. return -1;
  23354. }
  23355. }
  23356. return 0;
  23357. }
  23358. /**
  23359. * Used by `_.orderBy` to compare multiple properties of a value to another
  23360. * and stable sort them.
  23361. *
  23362. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  23363. * specify an order of "desc" for descending or "asc" for ascending sort order
  23364. * of corresponding values.
  23365. *
  23366. * @private
  23367. * @param {Object} object The object to compare.
  23368. * @param {Object} other The other object to compare.
  23369. * @param {boolean[]|string[]} orders The order to sort by for each property.
  23370. * @returns {number} Returns the sort order indicator for `object`.
  23371. */
  23372. function compareMultiple(object, other, orders) {
  23373. var index = -1,
  23374. objCriteria = object.criteria,
  23375. othCriteria = other.criteria,
  23376. length = objCriteria.length,
  23377. ordersLength = orders.length;
  23378. while (++index < length) {
  23379. var result = compareAscending(objCriteria[index], othCriteria[index]);
  23380. if (result) {
  23381. if (index >= ordersLength) {
  23382. return result;
  23383. }
  23384. var order = orders[index];
  23385. return result * (order == 'desc' ? -1 : 1);
  23386. }
  23387. }
  23388. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  23389. // that causes it, under certain circumstances, to provide the same value for
  23390. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  23391. // for more details.
  23392. //
  23393. // This also ensures a stable sort in V8 and other engines.
  23394. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  23395. return object.index - other.index;
  23396. }
  23397. /**
  23398. * Creates an array that is the composition of partially applied arguments,
  23399. * placeholders, and provided arguments into a single array of arguments.
  23400. *
  23401. * @private
  23402. * @param {Array} args The provided arguments.
  23403. * @param {Array} partials The arguments to prepend to those provided.
  23404. * @param {Array} holders The `partials` placeholder indexes.
  23405. * @params {boolean} [isCurried] Specify composing for a curried function.
  23406. * @returns {Array} Returns the new array of composed arguments.
  23407. */
  23408. function composeArgs(args, partials, holders, isCurried) {
  23409. var argsIndex = -1,
  23410. argsLength = args.length,
  23411. holdersLength = holders.length,
  23412. leftIndex = -1,
  23413. leftLength = partials.length,
  23414. rangeLength = nativeMax(argsLength - holdersLength, 0),
  23415. result = Array(leftLength + rangeLength),
  23416. isUncurried = !isCurried;
  23417. while (++leftIndex < leftLength) {
  23418. result[leftIndex] = partials[leftIndex];
  23419. }
  23420. while (++argsIndex < holdersLength) {
  23421. if (isUncurried || argsIndex < argsLength) {
  23422. result[holders[argsIndex]] = args[argsIndex];
  23423. }
  23424. }
  23425. while (rangeLength--) {
  23426. result[leftIndex++] = args[argsIndex++];
  23427. }
  23428. return result;
  23429. }
  23430. /**
  23431. * This function is like `composeArgs` except that the arguments composition
  23432. * is tailored for `_.partialRight`.
  23433. *
  23434. * @private
  23435. * @param {Array} args The provided arguments.
  23436. * @param {Array} partials The arguments to append to those provided.
  23437. * @param {Array} holders The `partials` placeholder indexes.
  23438. * @params {boolean} [isCurried] Specify composing for a curried function.
  23439. * @returns {Array} Returns the new array of composed arguments.
  23440. */
  23441. function composeArgsRight(args, partials, holders, isCurried) {
  23442. var argsIndex = -1,
  23443. argsLength = args.length,
  23444. holdersIndex = -1,
  23445. holdersLength = holders.length,
  23446. rightIndex = -1,
  23447. rightLength = partials.length,
  23448. rangeLength = nativeMax(argsLength - holdersLength, 0),
  23449. result = Array(rangeLength + rightLength),
  23450. isUncurried = !isCurried;
  23451. while (++argsIndex < rangeLength) {
  23452. result[argsIndex] = args[argsIndex];
  23453. }
  23454. var offset = argsIndex;
  23455. while (++rightIndex < rightLength) {
  23456. result[offset + rightIndex] = partials[rightIndex];
  23457. }
  23458. while (++holdersIndex < holdersLength) {
  23459. if (isUncurried || argsIndex < argsLength) {
  23460. result[offset + holders[holdersIndex]] = args[argsIndex++];
  23461. }
  23462. }
  23463. return result;
  23464. }
  23465. /**
  23466. * Copies the values of `source` to `array`.
  23467. *
  23468. * @private
  23469. * @param {Array} source The array to copy values from.
  23470. * @param {Array} [array=[]] The array to copy values to.
  23471. * @returns {Array} Returns `array`.
  23472. */
  23473. function copyArray(source, array) {
  23474. var index = -1,
  23475. length = source.length;
  23476. array || (array = Array(length));
  23477. while (++index < length) {
  23478. array[index] = source[index];
  23479. }
  23480. return array;
  23481. }
  23482. /**
  23483. * Copies properties of `source` to `object`.
  23484. *
  23485. * @private
  23486. * @param {Object} source The object to copy properties from.
  23487. * @param {Array} props The property identifiers to copy.
  23488. * @param {Object} [object={}] The object to copy properties to.
  23489. * @param {Function} [customizer] The function to customize copied values.
  23490. * @returns {Object} Returns `object`.
  23491. */
  23492. function copyObject(source, props, object, customizer) {
  23493. var isNew = !object;
  23494. object || (object = {});
  23495. var index = -1,
  23496. length = props.length;
  23497. while (++index < length) {
  23498. var key = props[index];
  23499. var newValue = customizer
  23500. ? customizer(object[key], source[key], key, object, source)
  23501. : undefined;
  23502. if (newValue === undefined) {
  23503. newValue = source[key];
  23504. }
  23505. if (isNew) {
  23506. baseAssignValue(object, key, newValue);
  23507. } else {
  23508. assignValue(object, key, newValue);
  23509. }
  23510. }
  23511. return object;
  23512. }
  23513. /**
  23514. * Copies own symbols of `source` to `object`.
  23515. *
  23516. * @private
  23517. * @param {Object} source The object to copy symbols from.
  23518. * @param {Object} [object={}] The object to copy symbols to.
  23519. * @returns {Object} Returns `object`.
  23520. */
  23521. function copySymbols(source, object) {
  23522. return copyObject(source, getSymbols(source), object);
  23523. }
  23524. /**
  23525. * Copies own and inherited symbols of `source` to `object`.
  23526. *
  23527. * @private
  23528. * @param {Object} source The object to copy symbols from.
  23529. * @param {Object} [object={}] The object to copy symbols to.
  23530. * @returns {Object} Returns `object`.
  23531. */
  23532. function copySymbolsIn(source, object) {
  23533. return copyObject(source, getSymbolsIn(source), object);
  23534. }
  23535. /**
  23536. * Creates a function like `_.groupBy`.
  23537. *
  23538. * @private
  23539. * @param {Function} setter The function to set accumulator values.
  23540. * @param {Function} [initializer] The accumulator object initializer.
  23541. * @returns {Function} Returns the new aggregator function.
  23542. */
  23543. function createAggregator(setter, initializer) {
  23544. return function(collection, iteratee) {
  23545. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  23546. accumulator = initializer ? initializer() : {};
  23547. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  23548. };
  23549. }
  23550. /**
  23551. * Creates a function like `_.assign`.
  23552. *
  23553. * @private
  23554. * @param {Function} assigner The function to assign values.
  23555. * @returns {Function} Returns the new assigner function.
  23556. */
  23557. function createAssigner(assigner) {
  23558. return baseRest(function(object, sources) {
  23559. var index = -1,
  23560. length = sources.length,
  23561. customizer = length > 1 ? sources[length - 1] : undefined,
  23562. guard = length > 2 ? sources[2] : undefined;
  23563. customizer = (assigner.length > 3 && typeof customizer == 'function')
  23564. ? (length--, customizer)
  23565. : undefined;
  23566. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  23567. customizer = length < 3 ? undefined : customizer;
  23568. length = 1;
  23569. }
  23570. object = Object(object);
  23571. while (++index < length) {
  23572. var source = sources[index];
  23573. if (source) {
  23574. assigner(object, source, index, customizer);
  23575. }
  23576. }
  23577. return object;
  23578. });
  23579. }
  23580. /**
  23581. * Creates a `baseEach` or `baseEachRight` function.
  23582. *
  23583. * @private
  23584. * @param {Function} eachFunc The function to iterate over a collection.
  23585. * @param {boolean} [fromRight] Specify iterating from right to left.
  23586. * @returns {Function} Returns the new base function.
  23587. */
  23588. function createBaseEach(eachFunc, fromRight) {
  23589. return function(collection, iteratee) {
  23590. if (collection == null) {
  23591. return collection;
  23592. }
  23593. if (!isArrayLike(collection)) {
  23594. return eachFunc(collection, iteratee);
  23595. }
  23596. var length = collection.length,
  23597. index = fromRight ? length : -1,
  23598. iterable = Object(collection);
  23599. while ((fromRight ? index-- : ++index < length)) {
  23600. if (iteratee(iterable[index], index, iterable) === false) {
  23601. break;
  23602. }
  23603. }
  23604. return collection;
  23605. };
  23606. }
  23607. /**
  23608. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  23609. *
  23610. * @private
  23611. * @param {boolean} [fromRight] Specify iterating from right to left.
  23612. * @returns {Function} Returns the new base function.
  23613. */
  23614. function createBaseFor(fromRight) {
  23615. return function(object, iteratee, keysFunc) {
  23616. var index = -1,
  23617. iterable = Object(object),
  23618. props = keysFunc(object),
  23619. length = props.length;
  23620. while (length--) {
  23621. var key = props[fromRight ? length : ++index];
  23622. if (iteratee(iterable[key], key, iterable) === false) {
  23623. break;
  23624. }
  23625. }
  23626. return object;
  23627. };
  23628. }
  23629. /**
  23630. * Creates a function that wraps `func` to invoke it with the optional `this`
  23631. * binding of `thisArg`.
  23632. *
  23633. * @private
  23634. * @param {Function} func The function to wrap.
  23635. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23636. * @param {*} [thisArg] The `this` binding of `func`.
  23637. * @returns {Function} Returns the new wrapped function.
  23638. */
  23639. function createBind(func, bitmask, thisArg) {
  23640. var isBind = bitmask & WRAP_BIND_FLAG,
  23641. Ctor = createCtor(func);
  23642. function wrapper() {
  23643. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23644. return fn.apply(isBind ? thisArg : this, arguments);
  23645. }
  23646. return wrapper;
  23647. }
  23648. /**
  23649. * Creates a function like `_.lowerFirst`.
  23650. *
  23651. * @private
  23652. * @param {string} methodName The name of the `String` case method to use.
  23653. * @returns {Function} Returns the new case function.
  23654. */
  23655. function createCaseFirst(methodName) {
  23656. return function(string) {
  23657. string = toString(string);
  23658. var strSymbols = hasUnicode(string)
  23659. ? stringToArray(string)
  23660. : undefined;
  23661. var chr = strSymbols
  23662. ? strSymbols[0]
  23663. : string.charAt(0);
  23664. var trailing = strSymbols
  23665. ? castSlice(strSymbols, 1).join('')
  23666. : string.slice(1);
  23667. return chr[methodName]() + trailing;
  23668. };
  23669. }
  23670. /**
  23671. * Creates a function like `_.camelCase`.
  23672. *
  23673. * @private
  23674. * @param {Function} callback The function to combine each word.
  23675. * @returns {Function} Returns the new compounder function.
  23676. */
  23677. function createCompounder(callback) {
  23678. return function(string) {
  23679. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  23680. };
  23681. }
  23682. /**
  23683. * Creates a function that produces an instance of `Ctor` regardless of
  23684. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  23685. *
  23686. * @private
  23687. * @param {Function} Ctor The constructor to wrap.
  23688. * @returns {Function} Returns the new wrapped function.
  23689. */
  23690. function createCtor(Ctor) {
  23691. return function() {
  23692. // Use a `switch` statement to work with class constructors. See
  23693. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  23694. // for more details.
  23695. var args = arguments;
  23696. switch (args.length) {
  23697. case 0: return new Ctor;
  23698. case 1: return new Ctor(args[0]);
  23699. case 2: return new Ctor(args[0], args[1]);
  23700. case 3: return new Ctor(args[0], args[1], args[2]);
  23701. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  23702. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  23703. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  23704. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  23705. }
  23706. var thisBinding = baseCreate(Ctor.prototype),
  23707. result = Ctor.apply(thisBinding, args);
  23708. // Mimic the constructor's `return` behavior.
  23709. // See https://es5.github.io/#x13.2.2 for more details.
  23710. return isObject(result) ? result : thisBinding;
  23711. };
  23712. }
  23713. /**
  23714. * Creates a function that wraps `func` to enable currying.
  23715. *
  23716. * @private
  23717. * @param {Function} func The function to wrap.
  23718. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23719. * @param {number} arity The arity of `func`.
  23720. * @returns {Function} Returns the new wrapped function.
  23721. */
  23722. function createCurry(func, bitmask, arity) {
  23723. var Ctor = createCtor(func);
  23724. function wrapper() {
  23725. var length = arguments.length,
  23726. args = Array(length),
  23727. index = length,
  23728. placeholder = getHolder(wrapper);
  23729. while (index--) {
  23730. args[index] = arguments[index];
  23731. }
  23732. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  23733. ? []
  23734. : replaceHolders(args, placeholder);
  23735. length -= holders.length;
  23736. if (length < arity) {
  23737. return createRecurry(
  23738. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  23739. args, holders, undefined, undefined, arity - length);
  23740. }
  23741. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23742. return apply(fn, this, args);
  23743. }
  23744. return wrapper;
  23745. }
  23746. /**
  23747. * Creates a `_.find` or `_.findLast` function.
  23748. *
  23749. * @private
  23750. * @param {Function} findIndexFunc The function to find the collection index.
  23751. * @returns {Function} Returns the new find function.
  23752. */
  23753. function createFind(findIndexFunc) {
  23754. return function(collection, predicate, fromIndex) {
  23755. var iterable = Object(collection);
  23756. if (!isArrayLike(collection)) {
  23757. var iteratee = getIteratee(predicate, 3);
  23758. collection = keys(collection);
  23759. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  23760. }
  23761. var index = findIndexFunc(collection, predicate, fromIndex);
  23762. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  23763. };
  23764. }
  23765. /**
  23766. * Creates a `_.flow` or `_.flowRight` function.
  23767. *
  23768. * @private
  23769. * @param {boolean} [fromRight] Specify iterating from right to left.
  23770. * @returns {Function} Returns the new flow function.
  23771. */
  23772. function createFlow(fromRight) {
  23773. return flatRest(function(funcs) {
  23774. var length = funcs.length,
  23775. index = length,
  23776. prereq = LodashWrapper.prototype.thru;
  23777. if (fromRight) {
  23778. funcs.reverse();
  23779. }
  23780. while (index--) {
  23781. var func = funcs[index];
  23782. if (typeof func != 'function') {
  23783. throw new TypeError(FUNC_ERROR_TEXT);
  23784. }
  23785. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23786. var wrapper = new LodashWrapper([], true);
  23787. }
  23788. }
  23789. index = wrapper ? index : length;
  23790. while (++index < length) {
  23791. func = funcs[index];
  23792. var funcName = getFuncName(func),
  23793. data = funcName == 'wrapper' ? getData(func) : undefined;
  23794. if (data && isLaziable(data[0]) &&
  23795. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23796. !data[4].length && data[9] == 1
  23797. ) {
  23798. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23799. } else {
  23800. wrapper = (func.length == 1 && isLaziable(func))
  23801. ? wrapper[funcName]()
  23802. : wrapper.thru(func);
  23803. }
  23804. }
  23805. return function() {
  23806. var args = arguments,
  23807. value = args[0];
  23808. if (wrapper && args.length == 1 && isArray(value)) {
  23809. return wrapper.plant(value).value();
  23810. }
  23811. var index = 0,
  23812. result = length ? funcs[index].apply(this, args) : value;
  23813. while (++index < length) {
  23814. result = funcs[index].call(this, result);
  23815. }
  23816. return result;
  23817. };
  23818. });
  23819. }
  23820. /**
  23821. * Creates a function that wraps `func` to invoke it with optional `this`
  23822. * binding of `thisArg`, partial application, and currying.
  23823. *
  23824. * @private
  23825. * @param {Function|string} func The function or method name to wrap.
  23826. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23827. * @param {*} [thisArg] The `this` binding of `func`.
  23828. * @param {Array} [partials] The arguments to prepend to those provided to
  23829. * the new function.
  23830. * @param {Array} [holders] The `partials` placeholder indexes.
  23831. * @param {Array} [partialsRight] The arguments to append to those provided
  23832. * to the new function.
  23833. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23834. * @param {Array} [argPos] The argument positions of the new function.
  23835. * @param {number} [ary] The arity cap of `func`.
  23836. * @param {number} [arity] The arity of `func`.
  23837. * @returns {Function} Returns the new wrapped function.
  23838. */
  23839. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23840. var isAry = bitmask & WRAP_ARY_FLAG,
  23841. isBind = bitmask & WRAP_BIND_FLAG,
  23842. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23843. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23844. isFlip = bitmask & WRAP_FLIP_FLAG,
  23845. Ctor = isBindKey ? undefined : createCtor(func);
  23846. function wrapper() {
  23847. var length = arguments.length,
  23848. args = Array(length),
  23849. index = length;
  23850. while (index--) {
  23851. args[index] = arguments[index];
  23852. }
  23853. if (isCurried) {
  23854. var placeholder = getHolder(wrapper),
  23855. holdersCount = countHolders(args, placeholder);
  23856. }
  23857. if (partials) {
  23858. args = composeArgs(args, partials, holders, isCurried);
  23859. }
  23860. if (partialsRight) {
  23861. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23862. }
  23863. length -= holdersCount;
  23864. if (isCurried && length < arity) {
  23865. var newHolders = replaceHolders(args, placeholder);
  23866. return createRecurry(
  23867. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23868. args, newHolders, argPos, ary, arity - length
  23869. );
  23870. }
  23871. var thisBinding = isBind ? thisArg : this,
  23872. fn = isBindKey ? thisBinding[func] : func;
  23873. length = args.length;
  23874. if (argPos) {
  23875. args = reorder(args, argPos);
  23876. } else if (isFlip && length > 1) {
  23877. args.reverse();
  23878. }
  23879. if (isAry && ary < length) {
  23880. args.length = ary;
  23881. }
  23882. if (this && this !== root && this instanceof wrapper) {
  23883. fn = Ctor || createCtor(fn);
  23884. }
  23885. return fn.apply(thisBinding, args);
  23886. }
  23887. return wrapper;
  23888. }
  23889. /**
  23890. * Creates a function like `_.invertBy`.
  23891. *
  23892. * @private
  23893. * @param {Function} setter The function to set accumulator values.
  23894. * @param {Function} toIteratee The function to resolve iteratees.
  23895. * @returns {Function} Returns the new inverter function.
  23896. */
  23897. function createInverter(setter, toIteratee) {
  23898. return function(object, iteratee) {
  23899. return baseInverter(object, setter, toIteratee(iteratee), {});
  23900. };
  23901. }
  23902. /**
  23903. * Creates a function that performs a mathematical operation on two values.
  23904. *
  23905. * @private
  23906. * @param {Function} operator The function to perform the operation.
  23907. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23908. * @returns {Function} Returns the new mathematical operation function.
  23909. */
  23910. function createMathOperation(operator, defaultValue) {
  23911. return function(value, other) {
  23912. var result;
  23913. if (value === undefined && other === undefined) {
  23914. return defaultValue;
  23915. }
  23916. if (value !== undefined) {
  23917. result = value;
  23918. }
  23919. if (other !== undefined) {
  23920. if (result === undefined) {
  23921. return other;
  23922. }
  23923. if (typeof value == 'string' || typeof other == 'string') {
  23924. value = baseToString(value);
  23925. other = baseToString(other);
  23926. } else {
  23927. value = baseToNumber(value);
  23928. other = baseToNumber(other);
  23929. }
  23930. result = operator(value, other);
  23931. }
  23932. return result;
  23933. };
  23934. }
  23935. /**
  23936. * Creates a function like `_.over`.
  23937. *
  23938. * @private
  23939. * @param {Function} arrayFunc The function to iterate over iteratees.
  23940. * @returns {Function} Returns the new over function.
  23941. */
  23942. function createOver(arrayFunc) {
  23943. return flatRest(function(iteratees) {
  23944. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23945. return baseRest(function(args) {
  23946. var thisArg = this;
  23947. return arrayFunc(iteratees, function(iteratee) {
  23948. return apply(iteratee, thisArg, args);
  23949. });
  23950. });
  23951. });
  23952. }
  23953. /**
  23954. * Creates the padding for `string` based on `length`. The `chars` string
  23955. * is truncated if the number of characters exceeds `length`.
  23956. *
  23957. * @private
  23958. * @param {number} length The padding length.
  23959. * @param {string} [chars=' '] The string used as padding.
  23960. * @returns {string} Returns the padding for `string`.
  23961. */
  23962. function createPadding(length, chars) {
  23963. chars = chars === undefined ? ' ' : baseToString(chars);
  23964. var charsLength = chars.length;
  23965. if (charsLength < 2) {
  23966. return charsLength ? baseRepeat(chars, length) : chars;
  23967. }
  23968. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23969. return hasUnicode(chars)
  23970. ? castSlice(stringToArray(result), 0, length).join('')
  23971. : result.slice(0, length);
  23972. }
  23973. /**
  23974. * Creates a function that wraps `func` to invoke it with the `this` binding
  23975. * of `thisArg` and `partials` prepended to the arguments it receives.
  23976. *
  23977. * @private
  23978. * @param {Function} func The function to wrap.
  23979. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23980. * @param {*} thisArg The `this` binding of `func`.
  23981. * @param {Array} partials The arguments to prepend to those provided to
  23982. * the new function.
  23983. * @returns {Function} Returns the new wrapped function.
  23984. */
  23985. function createPartial(func, bitmask, thisArg, partials) {
  23986. var isBind = bitmask & WRAP_BIND_FLAG,
  23987. Ctor = createCtor(func);
  23988. function wrapper() {
  23989. var argsIndex = -1,
  23990. argsLength = arguments.length,
  23991. leftIndex = -1,
  23992. leftLength = partials.length,
  23993. args = Array(leftLength + argsLength),
  23994. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23995. while (++leftIndex < leftLength) {
  23996. args[leftIndex] = partials[leftIndex];
  23997. }
  23998. while (argsLength--) {
  23999. args[leftIndex++] = arguments[++argsIndex];
  24000. }
  24001. return apply(fn, isBind ? thisArg : this, args);
  24002. }
  24003. return wrapper;
  24004. }
  24005. /**
  24006. * Creates a `_.range` or `_.rangeRight` function.
  24007. *
  24008. * @private
  24009. * @param {boolean} [fromRight] Specify iterating from right to left.
  24010. * @returns {Function} Returns the new range function.
  24011. */
  24012. function createRange(fromRight) {
  24013. return function(start, end, step) {
  24014. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  24015. end = step = undefined;
  24016. }
  24017. // Ensure the sign of `-0` is preserved.
  24018. start = toFinite(start);
  24019. if (end === undefined) {
  24020. end = start;
  24021. start = 0;
  24022. } else {
  24023. end = toFinite(end);
  24024. }
  24025. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  24026. return baseRange(start, end, step, fromRight);
  24027. };
  24028. }
  24029. /**
  24030. * Creates a function that performs a relational operation on two values.
  24031. *
  24032. * @private
  24033. * @param {Function} operator The function to perform the operation.
  24034. * @returns {Function} Returns the new relational operation function.
  24035. */
  24036. function createRelationalOperation(operator) {
  24037. return function(value, other) {
  24038. if (!(typeof value == 'string' && typeof other == 'string')) {
  24039. value = toNumber(value);
  24040. other = toNumber(other);
  24041. }
  24042. return operator(value, other);
  24043. };
  24044. }
  24045. /**
  24046. * Creates a function that wraps `func` to continue currying.
  24047. *
  24048. * @private
  24049. * @param {Function} func The function to wrap.
  24050. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24051. * @param {Function} wrapFunc The function to create the `func` wrapper.
  24052. * @param {*} placeholder The placeholder value.
  24053. * @param {*} [thisArg] The `this` binding of `func`.
  24054. * @param {Array} [partials] The arguments to prepend to those provided to
  24055. * the new function.
  24056. * @param {Array} [holders] The `partials` placeholder indexes.
  24057. * @param {Array} [argPos] The argument positions of the new function.
  24058. * @param {number} [ary] The arity cap of `func`.
  24059. * @param {number} [arity] The arity of `func`.
  24060. * @returns {Function} Returns the new wrapped function.
  24061. */
  24062. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  24063. var isCurry = bitmask & WRAP_CURRY_FLAG,
  24064. newHolders = isCurry ? holders : undefined,
  24065. newHoldersRight = isCurry ? undefined : holders,
  24066. newPartials = isCurry ? partials : undefined,
  24067. newPartialsRight = isCurry ? undefined : partials;
  24068. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  24069. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  24070. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  24071. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  24072. }
  24073. var newData = [
  24074. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  24075. newHoldersRight, argPos, ary, arity
  24076. ];
  24077. var result = wrapFunc.apply(undefined, newData);
  24078. if (isLaziable(func)) {
  24079. setData(result, newData);
  24080. }
  24081. result.placeholder = placeholder;
  24082. return setWrapToString(result, func, bitmask);
  24083. }
  24084. /**
  24085. * Creates a function like `_.round`.
  24086. *
  24087. * @private
  24088. * @param {string} methodName The name of the `Math` method to use when rounding.
  24089. * @returns {Function} Returns the new round function.
  24090. */
  24091. function createRound(methodName) {
  24092. var func = Math[methodName];
  24093. return function(number, precision) {
  24094. number = toNumber(number);
  24095. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  24096. if (precision && nativeIsFinite(number)) {
  24097. // Shift with exponential notation to avoid floating-point issues.
  24098. // See [MDN](https://mdn.io/round#Examples) for more details.
  24099. var pair = (toString(number) + 'e').split('e'),
  24100. value = func(pair[0] + 'e' + (+pair[1] + precision));
  24101. pair = (toString(value) + 'e').split('e');
  24102. return +(pair[0] + 'e' + (+pair[1] - precision));
  24103. }
  24104. return func(number);
  24105. };
  24106. }
  24107. /**
  24108. * Creates a set object of `values`.
  24109. *
  24110. * @private
  24111. * @param {Array} values The values to add to the set.
  24112. * @returns {Object} Returns the new set.
  24113. */
  24114. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  24115. return new Set(values);
  24116. };
  24117. /**
  24118. * Creates a `_.toPairs` or `_.toPairsIn` function.
  24119. *
  24120. * @private
  24121. * @param {Function} keysFunc The function to get the keys of a given object.
  24122. * @returns {Function} Returns the new pairs function.
  24123. */
  24124. function createToPairs(keysFunc) {
  24125. return function(object) {
  24126. var tag = getTag(object);
  24127. if (tag == mapTag) {
  24128. return mapToArray(object);
  24129. }
  24130. if (tag == setTag) {
  24131. return setToPairs(object);
  24132. }
  24133. return baseToPairs(object, keysFunc(object));
  24134. };
  24135. }
  24136. /**
  24137. * Creates a function that either curries or invokes `func` with optional
  24138. * `this` binding and partially applied arguments.
  24139. *
  24140. * @private
  24141. * @param {Function|string} func The function or method name to wrap.
  24142. * @param {number} bitmask The bitmask flags.
  24143. * 1 - `_.bind`
  24144. * 2 - `_.bindKey`
  24145. * 4 - `_.curry` or `_.curryRight` of a bound function
  24146. * 8 - `_.curry`
  24147. * 16 - `_.curryRight`
  24148. * 32 - `_.partial`
  24149. * 64 - `_.partialRight`
  24150. * 128 - `_.rearg`
  24151. * 256 - `_.ary`
  24152. * 512 - `_.flip`
  24153. * @param {*} [thisArg] The `this` binding of `func`.
  24154. * @param {Array} [partials] The arguments to be partially applied.
  24155. * @param {Array} [holders] The `partials` placeholder indexes.
  24156. * @param {Array} [argPos] The argument positions of the new function.
  24157. * @param {number} [ary] The arity cap of `func`.
  24158. * @param {number} [arity] The arity of `func`.
  24159. * @returns {Function} Returns the new wrapped function.
  24160. */
  24161. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  24162. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  24163. if (!isBindKey && typeof func != 'function') {
  24164. throw new TypeError(FUNC_ERROR_TEXT);
  24165. }
  24166. var length = partials ? partials.length : 0;
  24167. if (!length) {
  24168. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  24169. partials = holders = undefined;
  24170. }
  24171. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  24172. arity = arity === undefined ? arity : toInteger(arity);
  24173. length -= holders ? holders.length : 0;
  24174. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  24175. var partialsRight = partials,
  24176. holdersRight = holders;
  24177. partials = holders = undefined;
  24178. }
  24179. var data = isBindKey ? undefined : getData(func);
  24180. var newData = [
  24181. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  24182. argPos, ary, arity
  24183. ];
  24184. if (data) {
  24185. mergeData(newData, data);
  24186. }
  24187. func = newData[0];
  24188. bitmask = newData[1];
  24189. thisArg = newData[2];
  24190. partials = newData[3];
  24191. holders = newData[4];
  24192. arity = newData[9] = newData[9] === undefined
  24193. ? (isBindKey ? 0 : func.length)
  24194. : nativeMax(newData[9] - length, 0);
  24195. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  24196. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  24197. }
  24198. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  24199. var result = createBind(func, bitmask, thisArg);
  24200. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  24201. result = createCurry(func, bitmask, arity);
  24202. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  24203. result = createPartial(func, bitmask, thisArg, partials);
  24204. } else {
  24205. result = createHybrid.apply(undefined, newData);
  24206. }
  24207. var setter = data ? baseSetData : setData;
  24208. return setWrapToString(setter(result, newData), func, bitmask);
  24209. }
  24210. /**
  24211. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  24212. * of source objects to the destination object for all destination properties
  24213. * that resolve to `undefined`.
  24214. *
  24215. * @private
  24216. * @param {*} objValue The destination value.
  24217. * @param {*} srcValue The source value.
  24218. * @param {string} key The key of the property to assign.
  24219. * @param {Object} object The parent object of `objValue`.
  24220. * @returns {*} Returns the value to assign.
  24221. */
  24222. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  24223. if (objValue === undefined ||
  24224. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  24225. return srcValue;
  24226. }
  24227. return objValue;
  24228. }
  24229. /**
  24230. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  24231. * objects into destination objects that are passed thru.
  24232. *
  24233. * @private
  24234. * @param {*} objValue The destination value.
  24235. * @param {*} srcValue The source value.
  24236. * @param {string} key The key of the property to merge.
  24237. * @param {Object} object The parent object of `objValue`.
  24238. * @param {Object} source The parent object of `srcValue`.
  24239. * @param {Object} [stack] Tracks traversed source values and their merged
  24240. * counterparts.
  24241. * @returns {*} Returns the value to assign.
  24242. */
  24243. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  24244. if (isObject(objValue) && isObject(srcValue)) {
  24245. // Recursively merge objects and arrays (susceptible to call stack limits).
  24246. stack.set(srcValue, objValue);
  24247. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  24248. stack['delete'](srcValue);
  24249. }
  24250. return objValue;
  24251. }
  24252. /**
  24253. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  24254. * objects.
  24255. *
  24256. * @private
  24257. * @param {*} value The value to inspect.
  24258. * @param {string} key The key of the property to inspect.
  24259. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  24260. */
  24261. function customOmitClone(value) {
  24262. return isPlainObject(value) ? undefined : value;
  24263. }
  24264. /**
  24265. * A specialized version of `baseIsEqualDeep` for arrays with support for
  24266. * partial deep comparisons.
  24267. *
  24268. * @private
  24269. * @param {Array} array The array to compare.
  24270. * @param {Array} other The other array to compare.
  24271. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24272. * @param {Function} customizer The function to customize comparisons.
  24273. * @param {Function} equalFunc The function to determine equivalents of values.
  24274. * @param {Object} stack Tracks traversed `array` and `other` objects.
  24275. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  24276. */
  24277. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  24278. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  24279. arrLength = array.length,
  24280. othLength = other.length;
  24281. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  24282. return false;
  24283. }
  24284. // Assume cyclic values are equal.
  24285. var stacked = stack.get(array);
  24286. if (stacked && stack.get(other)) {
  24287. return stacked == other;
  24288. }
  24289. var index = -1,
  24290. result = true,
  24291. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  24292. stack.set(array, other);
  24293. stack.set(other, array);
  24294. // Ignore non-index properties.
  24295. while (++index < arrLength) {
  24296. var arrValue = array[index],
  24297. othValue = other[index];
  24298. if (customizer) {
  24299. var compared = isPartial
  24300. ? customizer(othValue, arrValue, index, other, array, stack)
  24301. : customizer(arrValue, othValue, index, array, other, stack);
  24302. }
  24303. if (compared !== undefined) {
  24304. if (compared) {
  24305. continue;
  24306. }
  24307. result = false;
  24308. break;
  24309. }
  24310. // Recursively compare arrays (susceptible to call stack limits).
  24311. if (seen) {
  24312. if (!arraySome(other, function(othValue, othIndex) {
  24313. if (!cacheHas(seen, othIndex) &&
  24314. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  24315. return seen.push(othIndex);
  24316. }
  24317. })) {
  24318. result = false;
  24319. break;
  24320. }
  24321. } else if (!(
  24322. arrValue === othValue ||
  24323. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  24324. )) {
  24325. result = false;
  24326. break;
  24327. }
  24328. }
  24329. stack['delete'](array);
  24330. stack['delete'](other);
  24331. return result;
  24332. }
  24333. /**
  24334. * A specialized version of `baseIsEqualDeep` for comparing objects of
  24335. * the same `toStringTag`.
  24336. *
  24337. * **Note:** This function only supports comparing values with tags of
  24338. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  24339. *
  24340. * @private
  24341. * @param {Object} object The object to compare.
  24342. * @param {Object} other The other object to compare.
  24343. * @param {string} tag The `toStringTag` of the objects to compare.
  24344. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24345. * @param {Function} customizer The function to customize comparisons.
  24346. * @param {Function} equalFunc The function to determine equivalents of values.
  24347. * @param {Object} stack Tracks traversed `object` and `other` objects.
  24348. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24349. */
  24350. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  24351. switch (tag) {
  24352. case dataViewTag:
  24353. if ((object.byteLength != other.byteLength) ||
  24354. (object.byteOffset != other.byteOffset)) {
  24355. return false;
  24356. }
  24357. object = object.buffer;
  24358. other = other.buffer;
  24359. case arrayBufferTag:
  24360. if ((object.byteLength != other.byteLength) ||
  24361. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  24362. return false;
  24363. }
  24364. return true;
  24365. case boolTag:
  24366. case dateTag:
  24367. case numberTag:
  24368. // Coerce booleans to `1` or `0` and dates to milliseconds.
  24369. // Invalid dates are coerced to `NaN`.
  24370. return eq(+object, +other);
  24371. case errorTag:
  24372. return object.name == other.name && object.message == other.message;
  24373. case regexpTag:
  24374. case stringTag:
  24375. // Coerce regexes to strings and treat strings, primitives and objects,
  24376. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  24377. // for more details.
  24378. return object == (other + '');
  24379. case mapTag:
  24380. var convert = mapToArray;
  24381. case setTag:
  24382. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  24383. convert || (convert = setToArray);
  24384. if (object.size != other.size && !isPartial) {
  24385. return false;
  24386. }
  24387. // Assume cyclic values are equal.
  24388. var stacked = stack.get(object);
  24389. if (stacked) {
  24390. return stacked == other;
  24391. }
  24392. bitmask |= COMPARE_UNORDERED_FLAG;
  24393. // Recursively compare objects (susceptible to call stack limits).
  24394. stack.set(object, other);
  24395. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  24396. stack['delete'](object);
  24397. return result;
  24398. case symbolTag:
  24399. if (symbolValueOf) {
  24400. return symbolValueOf.call(object) == symbolValueOf.call(other);
  24401. }
  24402. }
  24403. return false;
  24404. }
  24405. /**
  24406. * A specialized version of `baseIsEqualDeep` for objects with support for
  24407. * partial deep comparisons.
  24408. *
  24409. * @private
  24410. * @param {Object} object The object to compare.
  24411. * @param {Object} other The other object to compare.
  24412. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  24413. * @param {Function} customizer The function to customize comparisons.
  24414. * @param {Function} equalFunc The function to determine equivalents of values.
  24415. * @param {Object} stack Tracks traversed `object` and `other` objects.
  24416. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  24417. */
  24418. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  24419. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  24420. objProps = getAllKeys(object),
  24421. objLength = objProps.length,
  24422. othProps = getAllKeys(other),
  24423. othLength = othProps.length;
  24424. if (objLength != othLength && !isPartial) {
  24425. return false;
  24426. }
  24427. var index = objLength;
  24428. while (index--) {
  24429. var key = objProps[index];
  24430. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  24431. return false;
  24432. }
  24433. }
  24434. // Assume cyclic values are equal.
  24435. var stacked = stack.get(object);
  24436. if (stacked && stack.get(other)) {
  24437. return stacked == other;
  24438. }
  24439. var result = true;
  24440. stack.set(object, other);
  24441. stack.set(other, object);
  24442. var skipCtor = isPartial;
  24443. while (++index < objLength) {
  24444. key = objProps[index];
  24445. var objValue = object[key],
  24446. othValue = other[key];
  24447. if (customizer) {
  24448. var compared = isPartial
  24449. ? customizer(othValue, objValue, key, other, object, stack)
  24450. : customizer(objValue, othValue, key, object, other, stack);
  24451. }
  24452. // Recursively compare objects (susceptible to call stack limits).
  24453. if (!(compared === undefined
  24454. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  24455. : compared
  24456. )) {
  24457. result = false;
  24458. break;
  24459. }
  24460. skipCtor || (skipCtor = key == 'constructor');
  24461. }
  24462. if (result && !skipCtor) {
  24463. var objCtor = object.constructor,
  24464. othCtor = other.constructor;
  24465. // Non `Object` object instances with different constructors are not equal.
  24466. if (objCtor != othCtor &&
  24467. ('constructor' in object && 'constructor' in other) &&
  24468. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  24469. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  24470. result = false;
  24471. }
  24472. }
  24473. stack['delete'](object);
  24474. stack['delete'](other);
  24475. return result;
  24476. }
  24477. /**
  24478. * A specialized version of `baseRest` which flattens the rest array.
  24479. *
  24480. * @private
  24481. * @param {Function} func The function to apply a rest parameter to.
  24482. * @returns {Function} Returns the new function.
  24483. */
  24484. function flatRest(func) {
  24485. return setToString(overRest(func, undefined, flatten), func + '');
  24486. }
  24487. /**
  24488. * Creates an array of own enumerable property names and symbols of `object`.
  24489. *
  24490. * @private
  24491. * @param {Object} object The object to query.
  24492. * @returns {Array} Returns the array of property names and symbols.
  24493. */
  24494. function getAllKeys(object) {
  24495. return baseGetAllKeys(object, keys, getSymbols);
  24496. }
  24497. /**
  24498. * Creates an array of own and inherited enumerable property names and
  24499. * symbols of `object`.
  24500. *
  24501. * @private
  24502. * @param {Object} object The object to query.
  24503. * @returns {Array} Returns the array of property names and symbols.
  24504. */
  24505. function getAllKeysIn(object) {
  24506. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  24507. }
  24508. /**
  24509. * Gets metadata for `func`.
  24510. *
  24511. * @private
  24512. * @param {Function} func The function to query.
  24513. * @returns {*} Returns the metadata for `func`.
  24514. */
  24515. var getData = !metaMap ? noop : function(func) {
  24516. return metaMap.get(func);
  24517. };
  24518. /**
  24519. * Gets the name of `func`.
  24520. *
  24521. * @private
  24522. * @param {Function} func The function to query.
  24523. * @returns {string} Returns the function name.
  24524. */
  24525. function getFuncName(func) {
  24526. var result = (func.name + ''),
  24527. array = realNames[result],
  24528. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  24529. while (length--) {
  24530. var data = array[length],
  24531. otherFunc = data.func;
  24532. if (otherFunc == null || otherFunc == func) {
  24533. return data.name;
  24534. }
  24535. }
  24536. return result;
  24537. }
  24538. /**
  24539. * Gets the argument placeholder value for `func`.
  24540. *
  24541. * @private
  24542. * @param {Function} func The function to inspect.
  24543. * @returns {*} Returns the placeholder value.
  24544. */
  24545. function getHolder(func) {
  24546. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  24547. return object.placeholder;
  24548. }
  24549. /**
  24550. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  24551. * this function returns the custom method, otherwise it returns `baseIteratee`.
  24552. * If arguments are provided, the chosen function is invoked with them and
  24553. * its result is returned.
  24554. *
  24555. * @private
  24556. * @param {*} [value] The value to convert to an iteratee.
  24557. * @param {number} [arity] The arity of the created iteratee.
  24558. * @returns {Function} Returns the chosen function or its result.
  24559. */
  24560. function getIteratee() {
  24561. var result = lodash.iteratee || iteratee;
  24562. result = result === iteratee ? baseIteratee : result;
  24563. return arguments.length ? result(arguments[0], arguments[1]) : result;
  24564. }
  24565. /**
  24566. * Gets the data for `map`.
  24567. *
  24568. * @private
  24569. * @param {Object} map The map to query.
  24570. * @param {string} key The reference key.
  24571. * @returns {*} Returns the map data.
  24572. */
  24573. function getMapData(map, key) {
  24574. var data = map.__data__;
  24575. return isKeyable(key)
  24576. ? data[typeof key == 'string' ? 'string' : 'hash']
  24577. : data.map;
  24578. }
  24579. /**
  24580. * Gets the property names, values, and compare flags of `object`.
  24581. *
  24582. * @private
  24583. * @param {Object} object The object to query.
  24584. * @returns {Array} Returns the match data of `object`.
  24585. */
  24586. function getMatchData(object) {
  24587. var result = keys(object),
  24588. length = result.length;
  24589. while (length--) {
  24590. var key = result[length],
  24591. value = object[key];
  24592. result[length] = [key, value, isStrictComparable(value)];
  24593. }
  24594. return result;
  24595. }
  24596. /**
  24597. * Gets the native function at `key` of `object`.
  24598. *
  24599. * @private
  24600. * @param {Object} object The object to query.
  24601. * @param {string} key The key of the method to get.
  24602. * @returns {*} Returns the function if it's native, else `undefined`.
  24603. */
  24604. function getNative(object, key) {
  24605. var value = getValue(object, key);
  24606. return baseIsNative(value) ? value : undefined;
  24607. }
  24608. /**
  24609. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  24610. *
  24611. * @private
  24612. * @param {*} value The value to query.
  24613. * @returns {string} Returns the raw `toStringTag`.
  24614. */
  24615. function getRawTag(value) {
  24616. var isOwn = hasOwnProperty.call(value, symToStringTag),
  24617. tag = value[symToStringTag];
  24618. try {
  24619. value[symToStringTag] = undefined;
  24620. var unmasked = true;
  24621. } catch (e) {}
  24622. var result = nativeObjectToString.call(value);
  24623. if (unmasked) {
  24624. if (isOwn) {
  24625. value[symToStringTag] = tag;
  24626. } else {
  24627. delete value[symToStringTag];
  24628. }
  24629. }
  24630. return result;
  24631. }
  24632. /**
  24633. * Creates an array of the own enumerable symbols of `object`.
  24634. *
  24635. * @private
  24636. * @param {Object} object The object to query.
  24637. * @returns {Array} Returns the array of symbols.
  24638. */
  24639. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  24640. if (object == null) {
  24641. return [];
  24642. }
  24643. object = Object(object);
  24644. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  24645. return propertyIsEnumerable.call(object, symbol);
  24646. });
  24647. };
  24648. /**
  24649. * Creates an array of the own and inherited enumerable symbols of `object`.
  24650. *
  24651. * @private
  24652. * @param {Object} object The object to query.
  24653. * @returns {Array} Returns the array of symbols.
  24654. */
  24655. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  24656. var result = [];
  24657. while (object) {
  24658. arrayPush(result, getSymbols(object));
  24659. object = getPrototype(object);
  24660. }
  24661. return result;
  24662. };
  24663. /**
  24664. * Gets the `toStringTag` of `value`.
  24665. *
  24666. * @private
  24667. * @param {*} value The value to query.
  24668. * @returns {string} Returns the `toStringTag`.
  24669. */
  24670. var getTag = baseGetTag;
  24671. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  24672. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  24673. (Map && getTag(new Map) != mapTag) ||
  24674. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  24675. (Set && getTag(new Set) != setTag) ||
  24676. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  24677. getTag = function(value) {
  24678. var result = baseGetTag(value),
  24679. Ctor = result == objectTag ? value.constructor : undefined,
  24680. ctorString = Ctor ? toSource(Ctor) : '';
  24681. if (ctorString) {
  24682. switch (ctorString) {
  24683. case dataViewCtorString: return dataViewTag;
  24684. case mapCtorString: return mapTag;
  24685. case promiseCtorString: return promiseTag;
  24686. case setCtorString: return setTag;
  24687. case weakMapCtorString: return weakMapTag;
  24688. }
  24689. }
  24690. return result;
  24691. };
  24692. }
  24693. /**
  24694. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  24695. *
  24696. * @private
  24697. * @param {number} start The start of the view.
  24698. * @param {number} end The end of the view.
  24699. * @param {Array} transforms The transformations to apply to the view.
  24700. * @returns {Object} Returns an object containing the `start` and `end`
  24701. * positions of the view.
  24702. */
  24703. function getView(start, end, transforms) {
  24704. var index = -1,
  24705. length = transforms.length;
  24706. while (++index < length) {
  24707. var data = transforms[index],
  24708. size = data.size;
  24709. switch (data.type) {
  24710. case 'drop': start += size; break;
  24711. case 'dropRight': end -= size; break;
  24712. case 'take': end = nativeMin(end, start + size); break;
  24713. case 'takeRight': start = nativeMax(start, end - size); break;
  24714. }
  24715. }
  24716. return { 'start': start, 'end': end };
  24717. }
  24718. /**
  24719. * Extracts wrapper details from the `source` body comment.
  24720. *
  24721. * @private
  24722. * @param {string} source The source to inspect.
  24723. * @returns {Array} Returns the wrapper details.
  24724. */
  24725. function getWrapDetails(source) {
  24726. var match = source.match(reWrapDetails);
  24727. return match ? match[1].split(reSplitDetails) : [];
  24728. }
  24729. /**
  24730. * Checks if `path` exists on `object`.
  24731. *
  24732. * @private
  24733. * @param {Object} object The object to query.
  24734. * @param {Array|string} path The path to check.
  24735. * @param {Function} hasFunc The function to check properties.
  24736. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  24737. */
  24738. function hasPath(object, path, hasFunc) {
  24739. path = castPath(path, object);
  24740. var index = -1,
  24741. length = path.length,
  24742. result = false;
  24743. while (++index < length) {
  24744. var key = toKey(path[index]);
  24745. if (!(result = object != null && hasFunc(object, key))) {
  24746. break;
  24747. }
  24748. object = object[key];
  24749. }
  24750. if (result || ++index != length) {
  24751. return result;
  24752. }
  24753. length = object == null ? 0 : object.length;
  24754. return !!length && isLength(length) && isIndex(key, length) &&
  24755. (isArray(object) || isArguments(object));
  24756. }
  24757. /**
  24758. * Initializes an array clone.
  24759. *
  24760. * @private
  24761. * @param {Array} array The array to clone.
  24762. * @returns {Array} Returns the initialized clone.
  24763. */
  24764. function initCloneArray(array) {
  24765. var length = array.length,
  24766. result = new array.constructor(length);
  24767. // Add properties assigned by `RegExp#exec`.
  24768. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  24769. result.index = array.index;
  24770. result.input = array.input;
  24771. }
  24772. return result;
  24773. }
  24774. /**
  24775. * Initializes an object clone.
  24776. *
  24777. * @private
  24778. * @param {Object} object The object to clone.
  24779. * @returns {Object} Returns the initialized clone.
  24780. */
  24781. function initCloneObject(object) {
  24782. return (typeof object.constructor == 'function' && !isPrototype(object))
  24783. ? baseCreate(getPrototype(object))
  24784. : {};
  24785. }
  24786. /**
  24787. * Initializes an object clone based on its `toStringTag`.
  24788. *
  24789. * **Note:** This function only supports cloning values with tags of
  24790. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24791. *
  24792. * @private
  24793. * @param {Object} object The object to clone.
  24794. * @param {string} tag The `toStringTag` of the object to clone.
  24795. * @param {boolean} [isDeep] Specify a deep clone.
  24796. * @returns {Object} Returns the initialized clone.
  24797. */
  24798. function initCloneByTag(object, tag, isDeep) {
  24799. var Ctor = object.constructor;
  24800. switch (tag) {
  24801. case arrayBufferTag:
  24802. return cloneArrayBuffer(object);
  24803. case boolTag:
  24804. case dateTag:
  24805. return new Ctor(+object);
  24806. case dataViewTag:
  24807. return cloneDataView(object, isDeep);
  24808. case float32Tag: case float64Tag:
  24809. case int8Tag: case int16Tag: case int32Tag:
  24810. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24811. return cloneTypedArray(object, isDeep);
  24812. case mapTag:
  24813. return new Ctor;
  24814. case numberTag:
  24815. case stringTag:
  24816. return new Ctor(object);
  24817. case regexpTag:
  24818. return cloneRegExp(object);
  24819. case setTag:
  24820. return new Ctor;
  24821. case symbolTag:
  24822. return cloneSymbol(object);
  24823. }
  24824. }
  24825. /**
  24826. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24827. *
  24828. * @private
  24829. * @param {string} source The source to modify.
  24830. * @returns {Array} details The details to insert.
  24831. * @returns {string} Returns the modified source.
  24832. */
  24833. function insertWrapDetails(source, details) {
  24834. var length = details.length;
  24835. if (!length) {
  24836. return source;
  24837. }
  24838. var lastIndex = length - 1;
  24839. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24840. details = details.join(length > 2 ? ', ' : ' ');
  24841. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24842. }
  24843. /**
  24844. * Checks if `value` is a flattenable `arguments` object or array.
  24845. *
  24846. * @private
  24847. * @param {*} value The value to check.
  24848. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24849. */
  24850. function isFlattenable(value) {
  24851. return isArray(value) || isArguments(value) ||
  24852. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24853. }
  24854. /**
  24855. * Checks if `value` is a valid array-like index.
  24856. *
  24857. * @private
  24858. * @param {*} value The value to check.
  24859. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24860. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24861. */
  24862. function isIndex(value, length) {
  24863. var type = typeof value;
  24864. length = length == null ? MAX_SAFE_INTEGER : length;
  24865. return !!length &&
  24866. (type == 'number' ||
  24867. (type != 'symbol' && reIsUint.test(value))) &&
  24868. (value > -1 && value % 1 == 0 && value < length);
  24869. }
  24870. /**
  24871. * Checks if the given arguments are from an iteratee call.
  24872. *
  24873. * @private
  24874. * @param {*} value The potential iteratee value argument.
  24875. * @param {*} index The potential iteratee index or key argument.
  24876. * @param {*} object The potential iteratee object argument.
  24877. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24878. * else `false`.
  24879. */
  24880. function isIterateeCall(value, index, object) {
  24881. if (!isObject(object)) {
  24882. return false;
  24883. }
  24884. var type = typeof index;
  24885. if (type == 'number'
  24886. ? (isArrayLike(object) && isIndex(index, object.length))
  24887. : (type == 'string' && index in object)
  24888. ) {
  24889. return eq(object[index], value);
  24890. }
  24891. return false;
  24892. }
  24893. /**
  24894. * Checks if `value` is a property name and not a property path.
  24895. *
  24896. * @private
  24897. * @param {*} value The value to check.
  24898. * @param {Object} [object] The object to query keys on.
  24899. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24900. */
  24901. function isKey(value, object) {
  24902. if (isArray(value)) {
  24903. return false;
  24904. }
  24905. var type = typeof value;
  24906. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24907. value == null || isSymbol(value)) {
  24908. return true;
  24909. }
  24910. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24911. (object != null && value in Object(object));
  24912. }
  24913. /**
  24914. * Checks if `value` is suitable for use as unique object key.
  24915. *
  24916. * @private
  24917. * @param {*} value The value to check.
  24918. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24919. */
  24920. function isKeyable(value) {
  24921. var type = typeof value;
  24922. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24923. ? (value !== '__proto__')
  24924. : (value === null);
  24925. }
  24926. /**
  24927. * Checks if `func` has a lazy counterpart.
  24928. *
  24929. * @private
  24930. * @param {Function} func The function to check.
  24931. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24932. * else `false`.
  24933. */
  24934. function isLaziable(func) {
  24935. var funcName = getFuncName(func),
  24936. other = lodash[funcName];
  24937. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24938. return false;
  24939. }
  24940. if (func === other) {
  24941. return true;
  24942. }
  24943. var data = getData(other);
  24944. return !!data && func === data[0];
  24945. }
  24946. /**
  24947. * Checks if `func` has its source masked.
  24948. *
  24949. * @private
  24950. * @param {Function} func The function to check.
  24951. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24952. */
  24953. function isMasked(func) {
  24954. return !!maskSrcKey && (maskSrcKey in func);
  24955. }
  24956. /**
  24957. * Checks if `func` is capable of being masked.
  24958. *
  24959. * @private
  24960. * @param {*} value The value to check.
  24961. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24962. */
  24963. var isMaskable = coreJsData ? isFunction : stubFalse;
  24964. /**
  24965. * Checks if `value` is likely a prototype object.
  24966. *
  24967. * @private
  24968. * @param {*} value The value to check.
  24969. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24970. */
  24971. function isPrototype(value) {
  24972. var Ctor = value && value.constructor,
  24973. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24974. return value === proto;
  24975. }
  24976. /**
  24977. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24978. *
  24979. * @private
  24980. * @param {*} value The value to check.
  24981. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24982. * equality comparisons, else `false`.
  24983. */
  24984. function isStrictComparable(value) {
  24985. return value === value && !isObject(value);
  24986. }
  24987. /**
  24988. * A specialized version of `matchesProperty` for source values suitable
  24989. * for strict equality comparisons, i.e. `===`.
  24990. *
  24991. * @private
  24992. * @param {string} key The key of the property to get.
  24993. * @param {*} srcValue The value to match.
  24994. * @returns {Function} Returns the new spec function.
  24995. */
  24996. function matchesStrictComparable(key, srcValue) {
  24997. return function(object) {
  24998. if (object == null) {
  24999. return false;
  25000. }
  25001. return object[key] === srcValue &&
  25002. (srcValue !== undefined || (key in Object(object)));
  25003. };
  25004. }
  25005. /**
  25006. * A specialized version of `_.memoize` which clears the memoized function's
  25007. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  25008. *
  25009. * @private
  25010. * @param {Function} func The function to have its output memoized.
  25011. * @returns {Function} Returns the new memoized function.
  25012. */
  25013. function memoizeCapped(func) {
  25014. var result = memoize(func, function(key) {
  25015. if (cache.size === MAX_MEMOIZE_SIZE) {
  25016. cache.clear();
  25017. }
  25018. return key;
  25019. });
  25020. var cache = result.cache;
  25021. return result;
  25022. }
  25023. /**
  25024. * Merges the function metadata of `source` into `data`.
  25025. *
  25026. * Merging metadata reduces the number of wrappers used to invoke a function.
  25027. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  25028. * may be applied regardless of execution order. Methods like `_.ary` and
  25029. * `_.rearg` modify function arguments, making the order in which they are
  25030. * executed important, preventing the merging of metadata. However, we make
  25031. * an exception for a safe combined case where curried functions have `_.ary`
  25032. * and or `_.rearg` applied.
  25033. *
  25034. * @private
  25035. * @param {Array} data The destination metadata.
  25036. * @param {Array} source The source metadata.
  25037. * @returns {Array} Returns `data`.
  25038. */
  25039. function mergeData(data, source) {
  25040. var bitmask = data[1],
  25041. srcBitmask = source[1],
  25042. newBitmask = bitmask | srcBitmask,
  25043. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  25044. var isCombo =
  25045. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  25046. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  25047. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  25048. // Exit early if metadata can't be merged.
  25049. if (!(isCommon || isCombo)) {
  25050. return data;
  25051. }
  25052. // Use source `thisArg` if available.
  25053. if (srcBitmask & WRAP_BIND_FLAG) {
  25054. data[2] = source[2];
  25055. // Set when currying a bound function.
  25056. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  25057. }
  25058. // Compose partial arguments.
  25059. var value = source[3];
  25060. if (value) {
  25061. var partials = data[3];
  25062. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  25063. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  25064. }
  25065. // Compose partial right arguments.
  25066. value = source[5];
  25067. if (value) {
  25068. partials = data[5];
  25069. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  25070. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  25071. }
  25072. // Use source `argPos` if available.
  25073. value = source[7];
  25074. if (value) {
  25075. data[7] = value;
  25076. }
  25077. // Use source `ary` if it's smaller.
  25078. if (srcBitmask & WRAP_ARY_FLAG) {
  25079. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  25080. }
  25081. // Use source `arity` if one is not provided.
  25082. if (data[9] == null) {
  25083. data[9] = source[9];
  25084. }
  25085. // Use source `func` and merge bitmasks.
  25086. data[0] = source[0];
  25087. data[1] = newBitmask;
  25088. return data;
  25089. }
  25090. /**
  25091. * This function is like
  25092. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  25093. * except that it includes inherited enumerable properties.
  25094. *
  25095. * @private
  25096. * @param {Object} object The object to query.
  25097. * @returns {Array} Returns the array of property names.
  25098. */
  25099. function nativeKeysIn(object) {
  25100. var result = [];
  25101. if (object != null) {
  25102. for (var key in Object(object)) {
  25103. result.push(key);
  25104. }
  25105. }
  25106. return result;
  25107. }
  25108. /**
  25109. * Converts `value` to a string using `Object.prototype.toString`.
  25110. *
  25111. * @private
  25112. * @param {*} value The value to convert.
  25113. * @returns {string} Returns the converted string.
  25114. */
  25115. function objectToString(value) {
  25116. return nativeObjectToString.call(value);
  25117. }
  25118. /**
  25119. * A specialized version of `baseRest` which transforms the rest array.
  25120. *
  25121. * @private
  25122. * @param {Function} func The function to apply a rest parameter to.
  25123. * @param {number} [start=func.length-1] The start position of the rest parameter.
  25124. * @param {Function} transform The rest array transform.
  25125. * @returns {Function} Returns the new function.
  25126. */
  25127. function overRest(func, start, transform) {
  25128. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  25129. return function() {
  25130. var args = arguments,
  25131. index = -1,
  25132. length = nativeMax(args.length - start, 0),
  25133. array = Array(length);
  25134. while (++index < length) {
  25135. array[index] = args[start + index];
  25136. }
  25137. index = -1;
  25138. var otherArgs = Array(start + 1);
  25139. while (++index < start) {
  25140. otherArgs[index] = args[index];
  25141. }
  25142. otherArgs[start] = transform(array);
  25143. return apply(func, this, otherArgs);
  25144. };
  25145. }
  25146. /**
  25147. * Gets the parent value at `path` of `object`.
  25148. *
  25149. * @private
  25150. * @param {Object} object The object to query.
  25151. * @param {Array} path The path to get the parent value of.
  25152. * @returns {*} Returns the parent value.
  25153. */
  25154. function parent(object, path) {
  25155. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  25156. }
  25157. /**
  25158. * Reorder `array` according to the specified indexes where the element at
  25159. * the first index is assigned as the first element, the element at
  25160. * the second index is assigned as the second element, and so on.
  25161. *
  25162. * @private
  25163. * @param {Array} array The array to reorder.
  25164. * @param {Array} indexes The arranged array indexes.
  25165. * @returns {Array} Returns `array`.
  25166. */
  25167. function reorder(array, indexes) {
  25168. var arrLength = array.length,
  25169. length = nativeMin(indexes.length, arrLength),
  25170. oldArray = copyArray(array);
  25171. while (length--) {
  25172. var index = indexes[length];
  25173. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  25174. }
  25175. return array;
  25176. }
  25177. /**
  25178. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  25179. *
  25180. * @private
  25181. * @param {Object} object The object to query.
  25182. * @param {string} key The key of the property to get.
  25183. * @returns {*} Returns the property value.
  25184. */
  25185. function safeGet(object, key) {
  25186. if (key === 'constructor' && typeof object[key] === 'function') {
  25187. return;
  25188. }
  25189. if (key == '__proto__') {
  25190. return;
  25191. }
  25192. return object[key];
  25193. }
  25194. /**
  25195. * Sets metadata for `func`.
  25196. *
  25197. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  25198. * period of time, it will trip its breaker and transition to an identity
  25199. * function to avoid garbage collection pauses in V8. See
  25200. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  25201. * for more details.
  25202. *
  25203. * @private
  25204. * @param {Function} func The function to associate metadata with.
  25205. * @param {*} data The metadata.
  25206. * @returns {Function} Returns `func`.
  25207. */
  25208. var setData = shortOut(baseSetData);
  25209. /**
  25210. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  25211. *
  25212. * @private
  25213. * @param {Function} func The function to delay.
  25214. * @param {number} wait The number of milliseconds to delay invocation.
  25215. * @returns {number|Object} Returns the timer id or timeout object.
  25216. */
  25217. var setTimeout = ctxSetTimeout || function(func, wait) {
  25218. return root.setTimeout(func, wait);
  25219. };
  25220. /**
  25221. * Sets the `toString` method of `func` to return `string`.
  25222. *
  25223. * @private
  25224. * @param {Function} func The function to modify.
  25225. * @param {Function} string The `toString` result.
  25226. * @returns {Function} Returns `func`.
  25227. */
  25228. var setToString = shortOut(baseSetToString);
  25229. /**
  25230. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  25231. * with wrapper details in a comment at the top of the source body.
  25232. *
  25233. * @private
  25234. * @param {Function} wrapper The function to modify.
  25235. * @param {Function} reference The reference function.
  25236. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25237. * @returns {Function} Returns `wrapper`.
  25238. */
  25239. function setWrapToString(wrapper, reference, bitmask) {
  25240. var source = (reference + '');
  25241. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  25242. }
  25243. /**
  25244. * Creates a function that'll short out and invoke `identity` instead
  25245. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  25246. * milliseconds.
  25247. *
  25248. * @private
  25249. * @param {Function} func The function to restrict.
  25250. * @returns {Function} Returns the new shortable function.
  25251. */
  25252. function shortOut(func) {
  25253. var count = 0,
  25254. lastCalled = 0;
  25255. return function() {
  25256. var stamp = nativeNow(),
  25257. remaining = HOT_SPAN - (stamp - lastCalled);
  25258. lastCalled = stamp;
  25259. if (remaining > 0) {
  25260. if (++count >= HOT_COUNT) {
  25261. return arguments[0];
  25262. }
  25263. } else {
  25264. count = 0;
  25265. }
  25266. return func.apply(undefined, arguments);
  25267. };
  25268. }
  25269. /**
  25270. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  25271. *
  25272. * @private
  25273. * @param {Array} array The array to shuffle.
  25274. * @param {number} [size=array.length] The size of `array`.
  25275. * @returns {Array} Returns `array`.
  25276. */
  25277. function shuffleSelf(array, size) {
  25278. var index = -1,
  25279. length = array.length,
  25280. lastIndex = length - 1;
  25281. size = size === undefined ? length : size;
  25282. while (++index < size) {
  25283. var rand = baseRandom(index, lastIndex),
  25284. value = array[rand];
  25285. array[rand] = array[index];
  25286. array[index] = value;
  25287. }
  25288. array.length = size;
  25289. return array;
  25290. }
  25291. /**
  25292. * Converts `string` to a property path array.
  25293. *
  25294. * @private
  25295. * @param {string} string The string to convert.
  25296. * @returns {Array} Returns the property path array.
  25297. */
  25298. var stringToPath = memoizeCapped(function(string) {
  25299. var result = [];
  25300. if (string.charCodeAt(0) === 46 /* . */) {
  25301. result.push('');
  25302. }
  25303. string.replace(rePropName, function(match, number, quote, subString) {
  25304. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  25305. });
  25306. return result;
  25307. });
  25308. /**
  25309. * Converts `value` to a string key if it's not a string or symbol.
  25310. *
  25311. * @private
  25312. * @param {*} value The value to inspect.
  25313. * @returns {string|symbol} Returns the key.
  25314. */
  25315. function toKey(value) {
  25316. if (typeof value == 'string' || isSymbol(value)) {
  25317. return value;
  25318. }
  25319. var result = (value + '');
  25320. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  25321. }
  25322. /**
  25323. * Converts `func` to its source code.
  25324. *
  25325. * @private
  25326. * @param {Function} func The function to convert.
  25327. * @returns {string} Returns the source code.
  25328. */
  25329. function toSource(func) {
  25330. if (func != null) {
  25331. try {
  25332. return funcToString.call(func);
  25333. } catch (e) {}
  25334. try {
  25335. return (func + '');
  25336. } catch (e) {}
  25337. }
  25338. return '';
  25339. }
  25340. /**
  25341. * Updates wrapper `details` based on `bitmask` flags.
  25342. *
  25343. * @private
  25344. * @returns {Array} details The details to modify.
  25345. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  25346. * @returns {Array} Returns `details`.
  25347. */
  25348. function updateWrapDetails(details, bitmask) {
  25349. arrayEach(wrapFlags, function(pair) {
  25350. var value = '_.' + pair[0];
  25351. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  25352. details.push(value);
  25353. }
  25354. });
  25355. return details.sort();
  25356. }
  25357. /**
  25358. * Creates a clone of `wrapper`.
  25359. *
  25360. * @private
  25361. * @param {Object} wrapper The wrapper to clone.
  25362. * @returns {Object} Returns the cloned wrapper.
  25363. */
  25364. function wrapperClone(wrapper) {
  25365. if (wrapper instanceof LazyWrapper) {
  25366. return wrapper.clone();
  25367. }
  25368. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  25369. result.__actions__ = copyArray(wrapper.__actions__);
  25370. result.__index__ = wrapper.__index__;
  25371. result.__values__ = wrapper.__values__;
  25372. return result;
  25373. }
  25374. /*------------------------------------------------------------------------*/
  25375. /**
  25376. * Creates an array of elements split into groups the length of `size`.
  25377. * If `array` can't be split evenly, the final chunk will be the remaining
  25378. * elements.
  25379. *
  25380. * @static
  25381. * @memberOf _
  25382. * @since 3.0.0
  25383. * @category Array
  25384. * @param {Array} array The array to process.
  25385. * @param {number} [size=1] The length of each chunk
  25386. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25387. * @returns {Array} Returns the new array of chunks.
  25388. * @example
  25389. *
  25390. * _.chunk(['a', 'b', 'c', 'd'], 2);
  25391. * // => [['a', 'b'], ['c', 'd']]
  25392. *
  25393. * _.chunk(['a', 'b', 'c', 'd'], 3);
  25394. * // => [['a', 'b', 'c'], ['d']]
  25395. */
  25396. function chunk(array, size, guard) {
  25397. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  25398. size = 1;
  25399. } else {
  25400. size = nativeMax(toInteger(size), 0);
  25401. }
  25402. var length = array == null ? 0 : array.length;
  25403. if (!length || size < 1) {
  25404. return [];
  25405. }
  25406. var index = 0,
  25407. resIndex = 0,
  25408. result = Array(nativeCeil(length / size));
  25409. while (index < length) {
  25410. result[resIndex++] = baseSlice(array, index, (index += size));
  25411. }
  25412. return result;
  25413. }
  25414. /**
  25415. * Creates an array with all falsey values removed. The values `false`, `null`,
  25416. * `0`, `""`, `undefined`, and `NaN` are falsey.
  25417. *
  25418. * @static
  25419. * @memberOf _
  25420. * @since 0.1.0
  25421. * @category Array
  25422. * @param {Array} array The array to compact.
  25423. * @returns {Array} Returns the new array of filtered values.
  25424. * @example
  25425. *
  25426. * _.compact([0, 1, false, 2, '', 3]);
  25427. * // => [1, 2, 3]
  25428. */
  25429. function compact(array) {
  25430. var index = -1,
  25431. length = array == null ? 0 : array.length,
  25432. resIndex = 0,
  25433. result = [];
  25434. while (++index < length) {
  25435. var value = array[index];
  25436. if (value) {
  25437. result[resIndex++] = value;
  25438. }
  25439. }
  25440. return result;
  25441. }
  25442. /**
  25443. * Creates a new array concatenating `array` with any additional arrays
  25444. * and/or values.
  25445. *
  25446. * @static
  25447. * @memberOf _
  25448. * @since 4.0.0
  25449. * @category Array
  25450. * @param {Array} array The array to concatenate.
  25451. * @param {...*} [values] The values to concatenate.
  25452. * @returns {Array} Returns the new concatenated array.
  25453. * @example
  25454. *
  25455. * var array = [1];
  25456. * var other = _.concat(array, 2, [3], [[4]]);
  25457. *
  25458. * console.log(other);
  25459. * // => [1, 2, 3, [4]]
  25460. *
  25461. * console.log(array);
  25462. * // => [1]
  25463. */
  25464. function concat() {
  25465. var length = arguments.length;
  25466. if (!length) {
  25467. return [];
  25468. }
  25469. var args = Array(length - 1),
  25470. array = arguments[0],
  25471. index = length;
  25472. while (index--) {
  25473. args[index - 1] = arguments[index];
  25474. }
  25475. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  25476. }
  25477. /**
  25478. * Creates an array of `array` values not included in the other given arrays
  25479. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25480. * for equality comparisons. The order and references of result values are
  25481. * determined by the first array.
  25482. *
  25483. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  25484. *
  25485. * @static
  25486. * @memberOf _
  25487. * @since 0.1.0
  25488. * @category Array
  25489. * @param {Array} array The array to inspect.
  25490. * @param {...Array} [values] The values to exclude.
  25491. * @returns {Array} Returns the new array of filtered values.
  25492. * @see _.without, _.xor
  25493. * @example
  25494. *
  25495. * _.difference([2, 1], [2, 3]);
  25496. * // => [1]
  25497. */
  25498. var difference = baseRest(function(array, values) {
  25499. return isArrayLikeObject(array)
  25500. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  25501. : [];
  25502. });
  25503. /**
  25504. * This method is like `_.difference` except that it accepts `iteratee` which
  25505. * is invoked for each element of `array` and `values` to generate the criterion
  25506. * by which they're compared. The order and references of result values are
  25507. * determined by the first array. The iteratee is invoked with one argument:
  25508. * (value).
  25509. *
  25510. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  25511. *
  25512. * @static
  25513. * @memberOf _
  25514. * @since 4.0.0
  25515. * @category Array
  25516. * @param {Array} array The array to inspect.
  25517. * @param {...Array} [values] The values to exclude.
  25518. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25519. * @returns {Array} Returns the new array of filtered values.
  25520. * @example
  25521. *
  25522. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25523. * // => [1.2]
  25524. *
  25525. * // The `_.property` iteratee shorthand.
  25526. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  25527. * // => [{ 'x': 2 }]
  25528. */
  25529. var differenceBy = baseRest(function(array, values) {
  25530. var iteratee = last(values);
  25531. if (isArrayLikeObject(iteratee)) {
  25532. iteratee = undefined;
  25533. }
  25534. return isArrayLikeObject(array)
  25535. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  25536. : [];
  25537. });
  25538. /**
  25539. * This method is like `_.difference` except that it accepts `comparator`
  25540. * which is invoked to compare elements of `array` to `values`. The order and
  25541. * references of result values are determined by the first array. The comparator
  25542. * is invoked with two arguments: (arrVal, othVal).
  25543. *
  25544. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  25545. *
  25546. * @static
  25547. * @memberOf _
  25548. * @since 4.0.0
  25549. * @category Array
  25550. * @param {Array} array The array to inspect.
  25551. * @param {...Array} [values] The values to exclude.
  25552. * @param {Function} [comparator] The comparator invoked per element.
  25553. * @returns {Array} Returns the new array of filtered values.
  25554. * @example
  25555. *
  25556. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25557. *
  25558. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  25559. * // => [{ 'x': 2, 'y': 1 }]
  25560. */
  25561. var differenceWith = baseRest(function(array, values) {
  25562. var comparator = last(values);
  25563. if (isArrayLikeObject(comparator)) {
  25564. comparator = undefined;
  25565. }
  25566. return isArrayLikeObject(array)
  25567. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  25568. : [];
  25569. });
  25570. /**
  25571. * Creates a slice of `array` with `n` elements dropped from the beginning.
  25572. *
  25573. * @static
  25574. * @memberOf _
  25575. * @since 0.5.0
  25576. * @category Array
  25577. * @param {Array} array The array to query.
  25578. * @param {number} [n=1] The number of elements to drop.
  25579. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25580. * @returns {Array} Returns the slice of `array`.
  25581. * @example
  25582. *
  25583. * _.drop([1, 2, 3]);
  25584. * // => [2, 3]
  25585. *
  25586. * _.drop([1, 2, 3], 2);
  25587. * // => [3]
  25588. *
  25589. * _.drop([1, 2, 3], 5);
  25590. * // => []
  25591. *
  25592. * _.drop([1, 2, 3], 0);
  25593. * // => [1, 2, 3]
  25594. */
  25595. function drop(array, n, guard) {
  25596. var length = array == null ? 0 : array.length;
  25597. if (!length) {
  25598. return [];
  25599. }
  25600. n = (guard || n === undefined) ? 1 : toInteger(n);
  25601. return baseSlice(array, n < 0 ? 0 : n, length);
  25602. }
  25603. /**
  25604. * Creates a slice of `array` with `n` elements dropped from the end.
  25605. *
  25606. * @static
  25607. * @memberOf _
  25608. * @since 3.0.0
  25609. * @category Array
  25610. * @param {Array} array The array to query.
  25611. * @param {number} [n=1] The number of elements to drop.
  25612. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25613. * @returns {Array} Returns the slice of `array`.
  25614. * @example
  25615. *
  25616. * _.dropRight([1, 2, 3]);
  25617. * // => [1, 2]
  25618. *
  25619. * _.dropRight([1, 2, 3], 2);
  25620. * // => [1]
  25621. *
  25622. * _.dropRight([1, 2, 3], 5);
  25623. * // => []
  25624. *
  25625. * _.dropRight([1, 2, 3], 0);
  25626. * // => [1, 2, 3]
  25627. */
  25628. function dropRight(array, n, guard) {
  25629. var length = array == null ? 0 : array.length;
  25630. if (!length) {
  25631. return [];
  25632. }
  25633. n = (guard || n === undefined) ? 1 : toInteger(n);
  25634. n = length - n;
  25635. return baseSlice(array, 0, n < 0 ? 0 : n);
  25636. }
  25637. /**
  25638. * Creates a slice of `array` excluding elements dropped from the end.
  25639. * Elements are dropped until `predicate` returns falsey. The predicate is
  25640. * invoked with three arguments: (value, index, array).
  25641. *
  25642. * @static
  25643. * @memberOf _
  25644. * @since 3.0.0
  25645. * @category Array
  25646. * @param {Array} array The array to query.
  25647. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25648. * @returns {Array} Returns the slice of `array`.
  25649. * @example
  25650. *
  25651. * var users = [
  25652. * { 'user': 'barney', 'active': true },
  25653. * { 'user': 'fred', 'active': false },
  25654. * { 'user': 'pebbles', 'active': false }
  25655. * ];
  25656. *
  25657. * _.dropRightWhile(users, function(o) { return !o.active; });
  25658. * // => objects for ['barney']
  25659. *
  25660. * // The `_.matches` iteratee shorthand.
  25661. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  25662. * // => objects for ['barney', 'fred']
  25663. *
  25664. * // The `_.matchesProperty` iteratee shorthand.
  25665. * _.dropRightWhile(users, ['active', false]);
  25666. * // => objects for ['barney']
  25667. *
  25668. * // The `_.property` iteratee shorthand.
  25669. * _.dropRightWhile(users, 'active');
  25670. * // => objects for ['barney', 'fred', 'pebbles']
  25671. */
  25672. function dropRightWhile(array, predicate) {
  25673. return (array && array.length)
  25674. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  25675. : [];
  25676. }
  25677. /**
  25678. * Creates a slice of `array` excluding elements dropped from the beginning.
  25679. * Elements are dropped until `predicate` returns falsey. The predicate is
  25680. * invoked with three arguments: (value, index, array).
  25681. *
  25682. * @static
  25683. * @memberOf _
  25684. * @since 3.0.0
  25685. * @category Array
  25686. * @param {Array} array The array to query.
  25687. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25688. * @returns {Array} Returns the slice of `array`.
  25689. * @example
  25690. *
  25691. * var users = [
  25692. * { 'user': 'barney', 'active': false },
  25693. * { 'user': 'fred', 'active': false },
  25694. * { 'user': 'pebbles', 'active': true }
  25695. * ];
  25696. *
  25697. * _.dropWhile(users, function(o) { return !o.active; });
  25698. * // => objects for ['pebbles']
  25699. *
  25700. * // The `_.matches` iteratee shorthand.
  25701. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  25702. * // => objects for ['fred', 'pebbles']
  25703. *
  25704. * // The `_.matchesProperty` iteratee shorthand.
  25705. * _.dropWhile(users, ['active', false]);
  25706. * // => objects for ['pebbles']
  25707. *
  25708. * // The `_.property` iteratee shorthand.
  25709. * _.dropWhile(users, 'active');
  25710. * // => objects for ['barney', 'fred', 'pebbles']
  25711. */
  25712. function dropWhile(array, predicate) {
  25713. return (array && array.length)
  25714. ? baseWhile(array, getIteratee(predicate, 3), true)
  25715. : [];
  25716. }
  25717. /**
  25718. * Fills elements of `array` with `value` from `start` up to, but not
  25719. * including, `end`.
  25720. *
  25721. * **Note:** This method mutates `array`.
  25722. *
  25723. * @static
  25724. * @memberOf _
  25725. * @since 3.2.0
  25726. * @category Array
  25727. * @param {Array} array The array to fill.
  25728. * @param {*} value The value to fill `array` with.
  25729. * @param {number} [start=0] The start position.
  25730. * @param {number} [end=array.length] The end position.
  25731. * @returns {Array} Returns `array`.
  25732. * @example
  25733. *
  25734. * var array = [1, 2, 3];
  25735. *
  25736. * _.fill(array, 'a');
  25737. * console.log(array);
  25738. * // => ['a', 'a', 'a']
  25739. *
  25740. * _.fill(Array(3), 2);
  25741. * // => [2, 2, 2]
  25742. *
  25743. * _.fill([4, 6, 8, 10], '*', 1, 3);
  25744. * // => [4, '*', '*', 10]
  25745. */
  25746. function fill(array, value, start, end) {
  25747. var length = array == null ? 0 : array.length;
  25748. if (!length) {
  25749. return [];
  25750. }
  25751. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  25752. start = 0;
  25753. end = length;
  25754. }
  25755. return baseFill(array, value, start, end);
  25756. }
  25757. /**
  25758. * This method is like `_.find` except that it returns the index of the first
  25759. * element `predicate` returns truthy for instead of the element itself.
  25760. *
  25761. * @static
  25762. * @memberOf _
  25763. * @since 1.1.0
  25764. * @category Array
  25765. * @param {Array} array The array to inspect.
  25766. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25767. * @param {number} [fromIndex=0] The index to search from.
  25768. * @returns {number} Returns the index of the found element, else `-1`.
  25769. * @example
  25770. *
  25771. * var users = [
  25772. * { 'user': 'barney', 'active': false },
  25773. * { 'user': 'fred', 'active': false },
  25774. * { 'user': 'pebbles', 'active': true }
  25775. * ];
  25776. *
  25777. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  25778. * // => 0
  25779. *
  25780. * // The `_.matches` iteratee shorthand.
  25781. * _.findIndex(users, { 'user': 'fred', 'active': false });
  25782. * // => 1
  25783. *
  25784. * // The `_.matchesProperty` iteratee shorthand.
  25785. * _.findIndex(users, ['active', false]);
  25786. * // => 0
  25787. *
  25788. * // The `_.property` iteratee shorthand.
  25789. * _.findIndex(users, 'active');
  25790. * // => 2
  25791. */
  25792. function findIndex(array, predicate, fromIndex) {
  25793. var length = array == null ? 0 : array.length;
  25794. if (!length) {
  25795. return -1;
  25796. }
  25797. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25798. if (index < 0) {
  25799. index = nativeMax(length + index, 0);
  25800. }
  25801. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25802. }
  25803. /**
  25804. * This method is like `_.findIndex` except that it iterates over elements
  25805. * of `collection` from right to left.
  25806. *
  25807. * @static
  25808. * @memberOf _
  25809. * @since 2.0.0
  25810. * @category Array
  25811. * @param {Array} array The array to inspect.
  25812. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25813. * @param {number} [fromIndex=array.length-1] The index to search from.
  25814. * @returns {number} Returns the index of the found element, else `-1`.
  25815. * @example
  25816. *
  25817. * var users = [
  25818. * { 'user': 'barney', 'active': true },
  25819. * { 'user': 'fred', 'active': false },
  25820. * { 'user': 'pebbles', 'active': false }
  25821. * ];
  25822. *
  25823. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25824. * // => 2
  25825. *
  25826. * // The `_.matches` iteratee shorthand.
  25827. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25828. * // => 0
  25829. *
  25830. * // The `_.matchesProperty` iteratee shorthand.
  25831. * _.findLastIndex(users, ['active', false]);
  25832. * // => 2
  25833. *
  25834. * // The `_.property` iteratee shorthand.
  25835. * _.findLastIndex(users, 'active');
  25836. * // => 0
  25837. */
  25838. function findLastIndex(array, predicate, fromIndex) {
  25839. var length = array == null ? 0 : array.length;
  25840. if (!length) {
  25841. return -1;
  25842. }
  25843. var index = length - 1;
  25844. if (fromIndex !== undefined) {
  25845. index = toInteger(fromIndex);
  25846. index = fromIndex < 0
  25847. ? nativeMax(length + index, 0)
  25848. : nativeMin(index, length - 1);
  25849. }
  25850. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25851. }
  25852. /**
  25853. * Flattens `array` a single level deep.
  25854. *
  25855. * @static
  25856. * @memberOf _
  25857. * @since 0.1.0
  25858. * @category Array
  25859. * @param {Array} array The array to flatten.
  25860. * @returns {Array} Returns the new flattened array.
  25861. * @example
  25862. *
  25863. * _.flatten([1, [2, [3, [4]], 5]]);
  25864. * // => [1, 2, [3, [4]], 5]
  25865. */
  25866. function flatten(array) {
  25867. var length = array == null ? 0 : array.length;
  25868. return length ? baseFlatten(array, 1) : [];
  25869. }
  25870. /**
  25871. * Recursively flattens `array`.
  25872. *
  25873. * @static
  25874. * @memberOf _
  25875. * @since 3.0.0
  25876. * @category Array
  25877. * @param {Array} array The array to flatten.
  25878. * @returns {Array} Returns the new flattened array.
  25879. * @example
  25880. *
  25881. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25882. * // => [1, 2, 3, 4, 5]
  25883. */
  25884. function flattenDeep(array) {
  25885. var length = array == null ? 0 : array.length;
  25886. return length ? baseFlatten(array, INFINITY) : [];
  25887. }
  25888. /**
  25889. * Recursively flatten `array` up to `depth` times.
  25890. *
  25891. * @static
  25892. * @memberOf _
  25893. * @since 4.4.0
  25894. * @category Array
  25895. * @param {Array} array The array to flatten.
  25896. * @param {number} [depth=1] The maximum recursion depth.
  25897. * @returns {Array} Returns the new flattened array.
  25898. * @example
  25899. *
  25900. * var array = [1, [2, [3, [4]], 5]];
  25901. *
  25902. * _.flattenDepth(array, 1);
  25903. * // => [1, 2, [3, [4]], 5]
  25904. *
  25905. * _.flattenDepth(array, 2);
  25906. * // => [1, 2, 3, [4], 5]
  25907. */
  25908. function flattenDepth(array, depth) {
  25909. var length = array == null ? 0 : array.length;
  25910. if (!length) {
  25911. return [];
  25912. }
  25913. depth = depth === undefined ? 1 : toInteger(depth);
  25914. return baseFlatten(array, depth);
  25915. }
  25916. /**
  25917. * The inverse of `_.toPairs`; this method returns an object composed
  25918. * from key-value `pairs`.
  25919. *
  25920. * @static
  25921. * @memberOf _
  25922. * @since 4.0.0
  25923. * @category Array
  25924. * @param {Array} pairs The key-value pairs.
  25925. * @returns {Object} Returns the new object.
  25926. * @example
  25927. *
  25928. * _.fromPairs([['a', 1], ['b', 2]]);
  25929. * // => { 'a': 1, 'b': 2 }
  25930. */
  25931. function fromPairs(pairs) {
  25932. var index = -1,
  25933. length = pairs == null ? 0 : pairs.length,
  25934. result = {};
  25935. while (++index < length) {
  25936. var pair = pairs[index];
  25937. result[pair[0]] = pair[1];
  25938. }
  25939. return result;
  25940. }
  25941. /**
  25942. * Gets the first element of `array`.
  25943. *
  25944. * @static
  25945. * @memberOf _
  25946. * @since 0.1.0
  25947. * @alias first
  25948. * @category Array
  25949. * @param {Array} array The array to query.
  25950. * @returns {*} Returns the first element of `array`.
  25951. * @example
  25952. *
  25953. * _.head([1, 2, 3]);
  25954. * // => 1
  25955. *
  25956. * _.head([]);
  25957. * // => undefined
  25958. */
  25959. function head(array) {
  25960. return (array && array.length) ? array[0] : undefined;
  25961. }
  25962. /**
  25963. * Gets the index at which the first occurrence of `value` is found in `array`
  25964. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25965. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25966. * offset from the end of `array`.
  25967. *
  25968. * @static
  25969. * @memberOf _
  25970. * @since 0.1.0
  25971. * @category Array
  25972. * @param {Array} array The array to inspect.
  25973. * @param {*} value The value to search for.
  25974. * @param {number} [fromIndex=0] The index to search from.
  25975. * @returns {number} Returns the index of the matched value, else `-1`.
  25976. * @example
  25977. *
  25978. * _.indexOf([1, 2, 1, 2], 2);
  25979. * // => 1
  25980. *
  25981. * // Search from the `fromIndex`.
  25982. * _.indexOf([1, 2, 1, 2], 2, 2);
  25983. * // => 3
  25984. */
  25985. function indexOf(array, value, fromIndex) {
  25986. var length = array == null ? 0 : array.length;
  25987. if (!length) {
  25988. return -1;
  25989. }
  25990. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25991. if (index < 0) {
  25992. index = nativeMax(length + index, 0);
  25993. }
  25994. return baseIndexOf(array, value, index);
  25995. }
  25996. /**
  25997. * Gets all but the last element of `array`.
  25998. *
  25999. * @static
  26000. * @memberOf _
  26001. * @since 0.1.0
  26002. * @category Array
  26003. * @param {Array} array The array to query.
  26004. * @returns {Array} Returns the slice of `array`.
  26005. * @example
  26006. *
  26007. * _.initial([1, 2, 3]);
  26008. * // => [1, 2]
  26009. */
  26010. function initial(array) {
  26011. var length = array == null ? 0 : array.length;
  26012. return length ? baseSlice(array, 0, -1) : [];
  26013. }
  26014. /**
  26015. * Creates an array of unique values that are included in all given arrays
  26016. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26017. * for equality comparisons. The order and references of result values are
  26018. * determined by the first array.
  26019. *
  26020. * @static
  26021. * @memberOf _
  26022. * @since 0.1.0
  26023. * @category Array
  26024. * @param {...Array} [arrays] The arrays to inspect.
  26025. * @returns {Array} Returns the new array of intersecting values.
  26026. * @example
  26027. *
  26028. * _.intersection([2, 1], [2, 3]);
  26029. * // => [2]
  26030. */
  26031. var intersection = baseRest(function(arrays) {
  26032. var mapped = arrayMap(arrays, castArrayLikeObject);
  26033. return (mapped.length && mapped[0] === arrays[0])
  26034. ? baseIntersection(mapped)
  26035. : [];
  26036. });
  26037. /**
  26038. * This method is like `_.intersection` except that it accepts `iteratee`
  26039. * which is invoked for each element of each `arrays` to generate the criterion
  26040. * by which they're compared. The order and references of result values are
  26041. * determined by the first array. The iteratee is invoked with one argument:
  26042. * (value).
  26043. *
  26044. * @static
  26045. * @memberOf _
  26046. * @since 4.0.0
  26047. * @category Array
  26048. * @param {...Array} [arrays] The arrays to inspect.
  26049. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26050. * @returns {Array} Returns the new array of intersecting values.
  26051. * @example
  26052. *
  26053. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26054. * // => [2.1]
  26055. *
  26056. * // The `_.property` iteratee shorthand.
  26057. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26058. * // => [{ 'x': 1 }]
  26059. */
  26060. var intersectionBy = baseRest(function(arrays) {
  26061. var iteratee = last(arrays),
  26062. mapped = arrayMap(arrays, castArrayLikeObject);
  26063. if (iteratee === last(mapped)) {
  26064. iteratee = undefined;
  26065. } else {
  26066. mapped.pop();
  26067. }
  26068. return (mapped.length && mapped[0] === arrays[0])
  26069. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  26070. : [];
  26071. });
  26072. /**
  26073. * This method is like `_.intersection` except that it accepts `comparator`
  26074. * which is invoked to compare elements of `arrays`. The order and references
  26075. * of result values are determined by the first array. The comparator is
  26076. * invoked with two arguments: (arrVal, othVal).
  26077. *
  26078. * @static
  26079. * @memberOf _
  26080. * @since 4.0.0
  26081. * @category Array
  26082. * @param {...Array} [arrays] The arrays to inspect.
  26083. * @param {Function} [comparator] The comparator invoked per element.
  26084. * @returns {Array} Returns the new array of intersecting values.
  26085. * @example
  26086. *
  26087. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26088. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26089. *
  26090. * _.intersectionWith(objects, others, _.isEqual);
  26091. * // => [{ 'x': 1, 'y': 2 }]
  26092. */
  26093. var intersectionWith = baseRest(function(arrays) {
  26094. var comparator = last(arrays),
  26095. mapped = arrayMap(arrays, castArrayLikeObject);
  26096. comparator = typeof comparator == 'function' ? comparator : undefined;
  26097. if (comparator) {
  26098. mapped.pop();
  26099. }
  26100. return (mapped.length && mapped[0] === arrays[0])
  26101. ? baseIntersection(mapped, undefined, comparator)
  26102. : [];
  26103. });
  26104. /**
  26105. * Converts all elements in `array` into a string separated by `separator`.
  26106. *
  26107. * @static
  26108. * @memberOf _
  26109. * @since 4.0.0
  26110. * @category Array
  26111. * @param {Array} array The array to convert.
  26112. * @param {string} [separator=','] The element separator.
  26113. * @returns {string} Returns the joined string.
  26114. * @example
  26115. *
  26116. * _.join(['a', 'b', 'c'], '~');
  26117. * // => 'a~b~c'
  26118. */
  26119. function join(array, separator) {
  26120. return array == null ? '' : nativeJoin.call(array, separator);
  26121. }
  26122. /**
  26123. * Gets the last element of `array`.
  26124. *
  26125. * @static
  26126. * @memberOf _
  26127. * @since 0.1.0
  26128. * @category Array
  26129. * @param {Array} array The array to query.
  26130. * @returns {*} Returns the last element of `array`.
  26131. * @example
  26132. *
  26133. * _.last([1, 2, 3]);
  26134. * // => 3
  26135. */
  26136. function last(array) {
  26137. var length = array == null ? 0 : array.length;
  26138. return length ? array[length - 1] : undefined;
  26139. }
  26140. /**
  26141. * This method is like `_.indexOf` except that it iterates over elements of
  26142. * `array` from right to left.
  26143. *
  26144. * @static
  26145. * @memberOf _
  26146. * @since 0.1.0
  26147. * @category Array
  26148. * @param {Array} array The array to inspect.
  26149. * @param {*} value The value to search for.
  26150. * @param {number} [fromIndex=array.length-1] The index to search from.
  26151. * @returns {number} Returns the index of the matched value, else `-1`.
  26152. * @example
  26153. *
  26154. * _.lastIndexOf([1, 2, 1, 2], 2);
  26155. * // => 3
  26156. *
  26157. * // Search from the `fromIndex`.
  26158. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  26159. * // => 1
  26160. */
  26161. function lastIndexOf(array, value, fromIndex) {
  26162. var length = array == null ? 0 : array.length;
  26163. if (!length) {
  26164. return -1;
  26165. }
  26166. var index = length;
  26167. if (fromIndex !== undefined) {
  26168. index = toInteger(fromIndex);
  26169. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  26170. }
  26171. return value === value
  26172. ? strictLastIndexOf(array, value, index)
  26173. : baseFindIndex(array, baseIsNaN, index, true);
  26174. }
  26175. /**
  26176. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  26177. * element from the end is returned.
  26178. *
  26179. * @static
  26180. * @memberOf _
  26181. * @since 4.11.0
  26182. * @category Array
  26183. * @param {Array} array The array to query.
  26184. * @param {number} [n=0] The index of the element to return.
  26185. * @returns {*} Returns the nth element of `array`.
  26186. * @example
  26187. *
  26188. * var array = ['a', 'b', 'c', 'd'];
  26189. *
  26190. * _.nth(array, 1);
  26191. * // => 'b'
  26192. *
  26193. * _.nth(array, -2);
  26194. * // => 'c';
  26195. */
  26196. function nth(array, n) {
  26197. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  26198. }
  26199. /**
  26200. * Removes all given values from `array` using
  26201. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26202. * for equality comparisons.
  26203. *
  26204. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  26205. * to remove elements from an array by predicate.
  26206. *
  26207. * @static
  26208. * @memberOf _
  26209. * @since 2.0.0
  26210. * @category Array
  26211. * @param {Array} array The array to modify.
  26212. * @param {...*} [values] The values to remove.
  26213. * @returns {Array} Returns `array`.
  26214. * @example
  26215. *
  26216. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  26217. *
  26218. * _.pull(array, 'a', 'c');
  26219. * console.log(array);
  26220. * // => ['b', 'b']
  26221. */
  26222. var pull = baseRest(pullAll);
  26223. /**
  26224. * This method is like `_.pull` except that it accepts an array of values to remove.
  26225. *
  26226. * **Note:** Unlike `_.difference`, this method mutates `array`.
  26227. *
  26228. * @static
  26229. * @memberOf _
  26230. * @since 4.0.0
  26231. * @category Array
  26232. * @param {Array} array The array to modify.
  26233. * @param {Array} values The values to remove.
  26234. * @returns {Array} Returns `array`.
  26235. * @example
  26236. *
  26237. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  26238. *
  26239. * _.pullAll(array, ['a', 'c']);
  26240. * console.log(array);
  26241. * // => ['b', 'b']
  26242. */
  26243. function pullAll(array, values) {
  26244. return (array && array.length && values && values.length)
  26245. ? basePullAll(array, values)
  26246. : array;
  26247. }
  26248. /**
  26249. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  26250. * invoked for each element of `array` and `values` to generate the criterion
  26251. * by which they're compared. The iteratee is invoked with one argument: (value).
  26252. *
  26253. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  26254. *
  26255. * @static
  26256. * @memberOf _
  26257. * @since 4.0.0
  26258. * @category Array
  26259. * @param {Array} array The array to modify.
  26260. * @param {Array} values The values to remove.
  26261. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26262. * @returns {Array} Returns `array`.
  26263. * @example
  26264. *
  26265. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  26266. *
  26267. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  26268. * console.log(array);
  26269. * // => [{ 'x': 2 }]
  26270. */
  26271. function pullAllBy(array, values, iteratee) {
  26272. return (array && array.length && values && values.length)
  26273. ? basePullAll(array, values, getIteratee(iteratee, 2))
  26274. : array;
  26275. }
  26276. /**
  26277. * This method is like `_.pullAll` except that it accepts `comparator` which
  26278. * is invoked to compare elements of `array` to `values`. The comparator is
  26279. * invoked with two arguments: (arrVal, othVal).
  26280. *
  26281. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  26282. *
  26283. * @static
  26284. * @memberOf _
  26285. * @since 4.6.0
  26286. * @category Array
  26287. * @param {Array} array The array to modify.
  26288. * @param {Array} values The values to remove.
  26289. * @param {Function} [comparator] The comparator invoked per element.
  26290. * @returns {Array} Returns `array`.
  26291. * @example
  26292. *
  26293. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  26294. *
  26295. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  26296. * console.log(array);
  26297. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  26298. */
  26299. function pullAllWith(array, values, comparator) {
  26300. return (array && array.length && values && values.length)
  26301. ? basePullAll(array, values, undefined, comparator)
  26302. : array;
  26303. }
  26304. /**
  26305. * Removes elements from `array` corresponding to `indexes` and returns an
  26306. * array of removed elements.
  26307. *
  26308. * **Note:** Unlike `_.at`, this method mutates `array`.
  26309. *
  26310. * @static
  26311. * @memberOf _
  26312. * @since 3.0.0
  26313. * @category Array
  26314. * @param {Array} array The array to modify.
  26315. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  26316. * @returns {Array} Returns the new array of removed elements.
  26317. * @example
  26318. *
  26319. * var array = ['a', 'b', 'c', 'd'];
  26320. * var pulled = _.pullAt(array, [1, 3]);
  26321. *
  26322. * console.log(array);
  26323. * // => ['a', 'c']
  26324. *
  26325. * console.log(pulled);
  26326. * // => ['b', 'd']
  26327. */
  26328. var pullAt = flatRest(function(array, indexes) {
  26329. var length = array == null ? 0 : array.length,
  26330. result = baseAt(array, indexes);
  26331. basePullAt(array, arrayMap(indexes, function(index) {
  26332. return isIndex(index, length) ? +index : index;
  26333. }).sort(compareAscending));
  26334. return result;
  26335. });
  26336. /**
  26337. * Removes all elements from `array` that `predicate` returns truthy for
  26338. * and returns an array of the removed elements. The predicate is invoked
  26339. * with three arguments: (value, index, array).
  26340. *
  26341. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  26342. * to pull elements from an array by value.
  26343. *
  26344. * @static
  26345. * @memberOf _
  26346. * @since 2.0.0
  26347. * @category Array
  26348. * @param {Array} array The array to modify.
  26349. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26350. * @returns {Array} Returns the new array of removed elements.
  26351. * @example
  26352. *
  26353. * var array = [1, 2, 3, 4];
  26354. * var evens = _.remove(array, function(n) {
  26355. * return n % 2 == 0;
  26356. * });
  26357. *
  26358. * console.log(array);
  26359. * // => [1, 3]
  26360. *
  26361. * console.log(evens);
  26362. * // => [2, 4]
  26363. */
  26364. function remove(array, predicate) {
  26365. var result = [];
  26366. if (!(array && array.length)) {
  26367. return result;
  26368. }
  26369. var index = -1,
  26370. indexes = [],
  26371. length = array.length;
  26372. predicate = getIteratee(predicate, 3);
  26373. while (++index < length) {
  26374. var value = array[index];
  26375. if (predicate(value, index, array)) {
  26376. result.push(value);
  26377. indexes.push(index);
  26378. }
  26379. }
  26380. basePullAt(array, indexes);
  26381. return result;
  26382. }
  26383. /**
  26384. * Reverses `array` so that the first element becomes the last, the second
  26385. * element becomes the second to last, and so on.
  26386. *
  26387. * **Note:** This method mutates `array` and is based on
  26388. * [`Array#reverse`](https://mdn.io/Array/reverse).
  26389. *
  26390. * @static
  26391. * @memberOf _
  26392. * @since 4.0.0
  26393. * @category Array
  26394. * @param {Array} array The array to modify.
  26395. * @returns {Array} Returns `array`.
  26396. * @example
  26397. *
  26398. * var array = [1, 2, 3];
  26399. *
  26400. * _.reverse(array);
  26401. * // => [3, 2, 1]
  26402. *
  26403. * console.log(array);
  26404. * // => [3, 2, 1]
  26405. */
  26406. function reverse(array) {
  26407. return array == null ? array : nativeReverse.call(array);
  26408. }
  26409. /**
  26410. * Creates a slice of `array` from `start` up to, but not including, `end`.
  26411. *
  26412. * **Note:** This method is used instead of
  26413. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  26414. * returned.
  26415. *
  26416. * @static
  26417. * @memberOf _
  26418. * @since 3.0.0
  26419. * @category Array
  26420. * @param {Array} array The array to slice.
  26421. * @param {number} [start=0] The start position.
  26422. * @param {number} [end=array.length] The end position.
  26423. * @returns {Array} Returns the slice of `array`.
  26424. */
  26425. function slice(array, start, end) {
  26426. var length = array == null ? 0 : array.length;
  26427. if (!length) {
  26428. return [];
  26429. }
  26430. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  26431. start = 0;
  26432. end = length;
  26433. }
  26434. else {
  26435. start = start == null ? 0 : toInteger(start);
  26436. end = end === undefined ? length : toInteger(end);
  26437. }
  26438. return baseSlice(array, start, end);
  26439. }
  26440. /**
  26441. * Uses a binary search to determine the lowest index at which `value`
  26442. * should be inserted into `array` in order to maintain its sort order.
  26443. *
  26444. * @static
  26445. * @memberOf _
  26446. * @since 0.1.0
  26447. * @category Array
  26448. * @param {Array} array The sorted array to inspect.
  26449. * @param {*} value The value to evaluate.
  26450. * @returns {number} Returns the index at which `value` should be inserted
  26451. * into `array`.
  26452. * @example
  26453. *
  26454. * _.sortedIndex([30, 50], 40);
  26455. * // => 1
  26456. */
  26457. function sortedIndex(array, value) {
  26458. return baseSortedIndex(array, value);
  26459. }
  26460. /**
  26461. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  26462. * which is invoked for `value` and each element of `array` to compute their
  26463. * sort ranking. The iteratee is invoked with one argument: (value).
  26464. *
  26465. * @static
  26466. * @memberOf _
  26467. * @since 4.0.0
  26468. * @category Array
  26469. * @param {Array} array The sorted array to inspect.
  26470. * @param {*} value The value to evaluate.
  26471. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26472. * @returns {number} Returns the index at which `value` should be inserted
  26473. * into `array`.
  26474. * @example
  26475. *
  26476. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  26477. *
  26478. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  26479. * // => 0
  26480. *
  26481. * // The `_.property` iteratee shorthand.
  26482. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  26483. * // => 0
  26484. */
  26485. function sortedIndexBy(array, value, iteratee) {
  26486. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  26487. }
  26488. /**
  26489. * This method is like `_.indexOf` except that it performs a binary
  26490. * search on a sorted `array`.
  26491. *
  26492. * @static
  26493. * @memberOf _
  26494. * @since 4.0.0
  26495. * @category Array
  26496. * @param {Array} array The array to inspect.
  26497. * @param {*} value The value to search for.
  26498. * @returns {number} Returns the index of the matched value, else `-1`.
  26499. * @example
  26500. *
  26501. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  26502. * // => 1
  26503. */
  26504. function sortedIndexOf(array, value) {
  26505. var length = array == null ? 0 : array.length;
  26506. if (length) {
  26507. var index = baseSortedIndex(array, value);
  26508. if (index < length && eq(array[index], value)) {
  26509. return index;
  26510. }
  26511. }
  26512. return -1;
  26513. }
  26514. /**
  26515. * This method is like `_.sortedIndex` except that it returns the highest
  26516. * index at which `value` should be inserted into `array` in order to
  26517. * maintain its sort order.
  26518. *
  26519. * @static
  26520. * @memberOf _
  26521. * @since 3.0.0
  26522. * @category Array
  26523. * @param {Array} array The sorted array to inspect.
  26524. * @param {*} value The value to evaluate.
  26525. * @returns {number} Returns the index at which `value` should be inserted
  26526. * into `array`.
  26527. * @example
  26528. *
  26529. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  26530. * // => 4
  26531. */
  26532. function sortedLastIndex(array, value) {
  26533. return baseSortedIndex(array, value, true);
  26534. }
  26535. /**
  26536. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  26537. * which is invoked for `value` and each element of `array` to compute their
  26538. * sort ranking. The iteratee is invoked with one argument: (value).
  26539. *
  26540. * @static
  26541. * @memberOf _
  26542. * @since 4.0.0
  26543. * @category Array
  26544. * @param {Array} array The sorted array to inspect.
  26545. * @param {*} value The value to evaluate.
  26546. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26547. * @returns {number} Returns the index at which `value` should be inserted
  26548. * into `array`.
  26549. * @example
  26550. *
  26551. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  26552. *
  26553. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  26554. * // => 1
  26555. *
  26556. * // The `_.property` iteratee shorthand.
  26557. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  26558. * // => 1
  26559. */
  26560. function sortedLastIndexBy(array, value, iteratee) {
  26561. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  26562. }
  26563. /**
  26564. * This method is like `_.lastIndexOf` except that it performs a binary
  26565. * search on a sorted `array`.
  26566. *
  26567. * @static
  26568. * @memberOf _
  26569. * @since 4.0.0
  26570. * @category Array
  26571. * @param {Array} array The array to inspect.
  26572. * @param {*} value The value to search for.
  26573. * @returns {number} Returns the index of the matched value, else `-1`.
  26574. * @example
  26575. *
  26576. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  26577. * // => 3
  26578. */
  26579. function sortedLastIndexOf(array, value) {
  26580. var length = array == null ? 0 : array.length;
  26581. if (length) {
  26582. var index = baseSortedIndex(array, value, true) - 1;
  26583. if (eq(array[index], value)) {
  26584. return index;
  26585. }
  26586. }
  26587. return -1;
  26588. }
  26589. /**
  26590. * This method is like `_.uniq` except that it's designed and optimized
  26591. * for sorted arrays.
  26592. *
  26593. * @static
  26594. * @memberOf _
  26595. * @since 4.0.0
  26596. * @category Array
  26597. * @param {Array} array The array to inspect.
  26598. * @returns {Array} Returns the new duplicate free array.
  26599. * @example
  26600. *
  26601. * _.sortedUniq([1, 1, 2]);
  26602. * // => [1, 2]
  26603. */
  26604. function sortedUniq(array) {
  26605. return (array && array.length)
  26606. ? baseSortedUniq(array)
  26607. : [];
  26608. }
  26609. /**
  26610. * This method is like `_.uniqBy` except that it's designed and optimized
  26611. * for sorted arrays.
  26612. *
  26613. * @static
  26614. * @memberOf _
  26615. * @since 4.0.0
  26616. * @category Array
  26617. * @param {Array} array The array to inspect.
  26618. * @param {Function} [iteratee] The iteratee invoked per element.
  26619. * @returns {Array} Returns the new duplicate free array.
  26620. * @example
  26621. *
  26622. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  26623. * // => [1.1, 2.3]
  26624. */
  26625. function sortedUniqBy(array, iteratee) {
  26626. return (array && array.length)
  26627. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  26628. : [];
  26629. }
  26630. /**
  26631. * Gets all but the first element of `array`.
  26632. *
  26633. * @static
  26634. * @memberOf _
  26635. * @since 4.0.0
  26636. * @category Array
  26637. * @param {Array} array The array to query.
  26638. * @returns {Array} Returns the slice of `array`.
  26639. * @example
  26640. *
  26641. * _.tail([1, 2, 3]);
  26642. * // => [2, 3]
  26643. */
  26644. function tail(array) {
  26645. var length = array == null ? 0 : array.length;
  26646. return length ? baseSlice(array, 1, length) : [];
  26647. }
  26648. /**
  26649. * Creates a slice of `array` with `n` elements taken from the beginning.
  26650. *
  26651. * @static
  26652. * @memberOf _
  26653. * @since 0.1.0
  26654. * @category Array
  26655. * @param {Array} array The array to query.
  26656. * @param {number} [n=1] The number of elements to take.
  26657. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26658. * @returns {Array} Returns the slice of `array`.
  26659. * @example
  26660. *
  26661. * _.take([1, 2, 3]);
  26662. * // => [1]
  26663. *
  26664. * _.take([1, 2, 3], 2);
  26665. * // => [1, 2]
  26666. *
  26667. * _.take([1, 2, 3], 5);
  26668. * // => [1, 2, 3]
  26669. *
  26670. * _.take([1, 2, 3], 0);
  26671. * // => []
  26672. */
  26673. function take(array, n, guard) {
  26674. if (!(array && array.length)) {
  26675. return [];
  26676. }
  26677. n = (guard || n === undefined) ? 1 : toInteger(n);
  26678. return baseSlice(array, 0, n < 0 ? 0 : n);
  26679. }
  26680. /**
  26681. * Creates a slice of `array` with `n` elements taken from the end.
  26682. *
  26683. * @static
  26684. * @memberOf _
  26685. * @since 3.0.0
  26686. * @category Array
  26687. * @param {Array} array The array to query.
  26688. * @param {number} [n=1] The number of elements to take.
  26689. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26690. * @returns {Array} Returns the slice of `array`.
  26691. * @example
  26692. *
  26693. * _.takeRight([1, 2, 3]);
  26694. * // => [3]
  26695. *
  26696. * _.takeRight([1, 2, 3], 2);
  26697. * // => [2, 3]
  26698. *
  26699. * _.takeRight([1, 2, 3], 5);
  26700. * // => [1, 2, 3]
  26701. *
  26702. * _.takeRight([1, 2, 3], 0);
  26703. * // => []
  26704. */
  26705. function takeRight(array, n, guard) {
  26706. var length = array == null ? 0 : array.length;
  26707. if (!length) {
  26708. return [];
  26709. }
  26710. n = (guard || n === undefined) ? 1 : toInteger(n);
  26711. n = length - n;
  26712. return baseSlice(array, n < 0 ? 0 : n, length);
  26713. }
  26714. /**
  26715. * Creates a slice of `array` with elements taken from the end. Elements are
  26716. * taken until `predicate` returns falsey. The predicate is invoked with
  26717. * three arguments: (value, index, array).
  26718. *
  26719. * @static
  26720. * @memberOf _
  26721. * @since 3.0.0
  26722. * @category Array
  26723. * @param {Array} array The array to query.
  26724. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26725. * @returns {Array} Returns the slice of `array`.
  26726. * @example
  26727. *
  26728. * var users = [
  26729. * { 'user': 'barney', 'active': true },
  26730. * { 'user': 'fred', 'active': false },
  26731. * { 'user': 'pebbles', 'active': false }
  26732. * ];
  26733. *
  26734. * _.takeRightWhile(users, function(o) { return !o.active; });
  26735. * // => objects for ['fred', 'pebbles']
  26736. *
  26737. * // The `_.matches` iteratee shorthand.
  26738. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  26739. * // => objects for ['pebbles']
  26740. *
  26741. * // The `_.matchesProperty` iteratee shorthand.
  26742. * _.takeRightWhile(users, ['active', false]);
  26743. * // => objects for ['fred', 'pebbles']
  26744. *
  26745. * // The `_.property` iteratee shorthand.
  26746. * _.takeRightWhile(users, 'active');
  26747. * // => []
  26748. */
  26749. function takeRightWhile(array, predicate) {
  26750. return (array && array.length)
  26751. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  26752. : [];
  26753. }
  26754. /**
  26755. * Creates a slice of `array` with elements taken from the beginning. Elements
  26756. * are taken until `predicate` returns falsey. The predicate is invoked with
  26757. * three arguments: (value, index, array).
  26758. *
  26759. * @static
  26760. * @memberOf _
  26761. * @since 3.0.0
  26762. * @category Array
  26763. * @param {Array} array The array to query.
  26764. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26765. * @returns {Array} Returns the slice of `array`.
  26766. * @example
  26767. *
  26768. * var users = [
  26769. * { 'user': 'barney', 'active': false },
  26770. * { 'user': 'fred', 'active': false },
  26771. * { 'user': 'pebbles', 'active': true }
  26772. * ];
  26773. *
  26774. * _.takeWhile(users, function(o) { return !o.active; });
  26775. * // => objects for ['barney', 'fred']
  26776. *
  26777. * // The `_.matches` iteratee shorthand.
  26778. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  26779. * // => objects for ['barney']
  26780. *
  26781. * // The `_.matchesProperty` iteratee shorthand.
  26782. * _.takeWhile(users, ['active', false]);
  26783. * // => objects for ['barney', 'fred']
  26784. *
  26785. * // The `_.property` iteratee shorthand.
  26786. * _.takeWhile(users, 'active');
  26787. * // => []
  26788. */
  26789. function takeWhile(array, predicate) {
  26790. return (array && array.length)
  26791. ? baseWhile(array, getIteratee(predicate, 3))
  26792. : [];
  26793. }
  26794. /**
  26795. * Creates an array of unique values, in order, from all given arrays using
  26796. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26797. * for equality comparisons.
  26798. *
  26799. * @static
  26800. * @memberOf _
  26801. * @since 0.1.0
  26802. * @category Array
  26803. * @param {...Array} [arrays] The arrays to inspect.
  26804. * @returns {Array} Returns the new array of combined values.
  26805. * @example
  26806. *
  26807. * _.union([2], [1, 2]);
  26808. * // => [2, 1]
  26809. */
  26810. var union = baseRest(function(arrays) {
  26811. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26812. });
  26813. /**
  26814. * This method is like `_.union` except that it accepts `iteratee` which is
  26815. * invoked for each element of each `arrays` to generate the criterion by
  26816. * which uniqueness is computed. Result values are chosen from the first
  26817. * array in which the value occurs. The iteratee is invoked with one argument:
  26818. * (value).
  26819. *
  26820. * @static
  26821. * @memberOf _
  26822. * @since 4.0.0
  26823. * @category Array
  26824. * @param {...Array} [arrays] The arrays to inspect.
  26825. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26826. * @returns {Array} Returns the new array of combined values.
  26827. * @example
  26828. *
  26829. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26830. * // => [2.1, 1.2]
  26831. *
  26832. * // The `_.property` iteratee shorthand.
  26833. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26834. * // => [{ 'x': 1 }, { 'x': 2 }]
  26835. */
  26836. var unionBy = baseRest(function(arrays) {
  26837. var iteratee = last(arrays);
  26838. if (isArrayLikeObject(iteratee)) {
  26839. iteratee = undefined;
  26840. }
  26841. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26842. });
  26843. /**
  26844. * This method is like `_.union` except that it accepts `comparator` which
  26845. * is invoked to compare elements of `arrays`. Result values are chosen from
  26846. * the first array in which the value occurs. The comparator is invoked
  26847. * with two arguments: (arrVal, othVal).
  26848. *
  26849. * @static
  26850. * @memberOf _
  26851. * @since 4.0.0
  26852. * @category Array
  26853. * @param {...Array} [arrays] The arrays to inspect.
  26854. * @param {Function} [comparator] The comparator invoked per element.
  26855. * @returns {Array} Returns the new array of combined values.
  26856. * @example
  26857. *
  26858. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26859. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26860. *
  26861. * _.unionWith(objects, others, _.isEqual);
  26862. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26863. */
  26864. var unionWith = baseRest(function(arrays) {
  26865. var comparator = last(arrays);
  26866. comparator = typeof comparator == 'function' ? comparator : undefined;
  26867. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26868. });
  26869. /**
  26870. * Creates a duplicate-free version of an array, using
  26871. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26872. * for equality comparisons, in which only the first occurrence of each element
  26873. * is kept. The order of result values is determined by the order they occur
  26874. * in the array.
  26875. *
  26876. * @static
  26877. * @memberOf _
  26878. * @since 0.1.0
  26879. * @category Array
  26880. * @param {Array} array The array to inspect.
  26881. * @returns {Array} Returns the new duplicate free array.
  26882. * @example
  26883. *
  26884. * _.uniq([2, 1, 2]);
  26885. * // => [2, 1]
  26886. */
  26887. function uniq(array) {
  26888. return (array && array.length) ? baseUniq(array) : [];
  26889. }
  26890. /**
  26891. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26892. * invoked for each element in `array` to generate the criterion by which
  26893. * uniqueness is computed. The order of result values is determined by the
  26894. * order they occur in the array. The iteratee is invoked with one argument:
  26895. * (value).
  26896. *
  26897. * @static
  26898. * @memberOf _
  26899. * @since 4.0.0
  26900. * @category Array
  26901. * @param {Array} array The array to inspect.
  26902. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26903. * @returns {Array} Returns the new duplicate free array.
  26904. * @example
  26905. *
  26906. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26907. * // => [2.1, 1.2]
  26908. *
  26909. * // The `_.property` iteratee shorthand.
  26910. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26911. * // => [{ 'x': 1 }, { 'x': 2 }]
  26912. */
  26913. function uniqBy(array, iteratee) {
  26914. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26915. }
  26916. /**
  26917. * This method is like `_.uniq` except that it accepts `comparator` which
  26918. * is invoked to compare elements of `array`. The order of result values is
  26919. * determined by the order they occur in the array.The comparator is invoked
  26920. * with two arguments: (arrVal, othVal).
  26921. *
  26922. * @static
  26923. * @memberOf _
  26924. * @since 4.0.0
  26925. * @category Array
  26926. * @param {Array} array The array to inspect.
  26927. * @param {Function} [comparator] The comparator invoked per element.
  26928. * @returns {Array} Returns the new duplicate free array.
  26929. * @example
  26930. *
  26931. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26932. *
  26933. * _.uniqWith(objects, _.isEqual);
  26934. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26935. */
  26936. function uniqWith(array, comparator) {
  26937. comparator = typeof comparator == 'function' ? comparator : undefined;
  26938. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26939. }
  26940. /**
  26941. * This method is like `_.zip` except that it accepts an array of grouped
  26942. * elements and creates an array regrouping the elements to their pre-zip
  26943. * configuration.
  26944. *
  26945. * @static
  26946. * @memberOf _
  26947. * @since 1.2.0
  26948. * @category Array
  26949. * @param {Array} array The array of grouped elements to process.
  26950. * @returns {Array} Returns the new array of regrouped elements.
  26951. * @example
  26952. *
  26953. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26954. * // => [['a', 1, true], ['b', 2, false]]
  26955. *
  26956. * _.unzip(zipped);
  26957. * // => [['a', 'b'], [1, 2], [true, false]]
  26958. */
  26959. function unzip(array) {
  26960. if (!(array && array.length)) {
  26961. return [];
  26962. }
  26963. var length = 0;
  26964. array = arrayFilter(array, function(group) {
  26965. if (isArrayLikeObject(group)) {
  26966. length = nativeMax(group.length, length);
  26967. return true;
  26968. }
  26969. });
  26970. return baseTimes(length, function(index) {
  26971. return arrayMap(array, baseProperty(index));
  26972. });
  26973. }
  26974. /**
  26975. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26976. * how regrouped values should be combined. The iteratee is invoked with the
  26977. * elements of each group: (...group).
  26978. *
  26979. * @static
  26980. * @memberOf _
  26981. * @since 3.8.0
  26982. * @category Array
  26983. * @param {Array} array The array of grouped elements to process.
  26984. * @param {Function} [iteratee=_.identity] The function to combine
  26985. * regrouped values.
  26986. * @returns {Array} Returns the new array of regrouped elements.
  26987. * @example
  26988. *
  26989. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26990. * // => [[1, 10, 100], [2, 20, 200]]
  26991. *
  26992. * _.unzipWith(zipped, _.add);
  26993. * // => [3, 30, 300]
  26994. */
  26995. function unzipWith(array, iteratee) {
  26996. if (!(array && array.length)) {
  26997. return [];
  26998. }
  26999. var result = unzip(array);
  27000. if (iteratee == null) {
  27001. return result;
  27002. }
  27003. return arrayMap(result, function(group) {
  27004. return apply(iteratee, undefined, group);
  27005. });
  27006. }
  27007. /**
  27008. * Creates an array excluding all given values using
  27009. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27010. * for equality comparisons.
  27011. *
  27012. * **Note:** Unlike `_.pull`, this method returns a new array.
  27013. *
  27014. * @static
  27015. * @memberOf _
  27016. * @since 0.1.0
  27017. * @category Array
  27018. * @param {Array} array The array to inspect.
  27019. * @param {...*} [values] The values to exclude.
  27020. * @returns {Array} Returns the new array of filtered values.
  27021. * @see _.difference, _.xor
  27022. * @example
  27023. *
  27024. * _.without([2, 1, 2, 3], 1, 2);
  27025. * // => [3]
  27026. */
  27027. var without = baseRest(function(array, values) {
  27028. return isArrayLikeObject(array)
  27029. ? baseDifference(array, values)
  27030. : [];
  27031. });
  27032. /**
  27033. * Creates an array of unique values that is the
  27034. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  27035. * of the given arrays. The order of result values is determined by the order
  27036. * they occur in the arrays.
  27037. *
  27038. * @static
  27039. * @memberOf _
  27040. * @since 2.4.0
  27041. * @category Array
  27042. * @param {...Array} [arrays] The arrays to inspect.
  27043. * @returns {Array} Returns the new array of filtered values.
  27044. * @see _.difference, _.without
  27045. * @example
  27046. *
  27047. * _.xor([2, 1], [2, 3]);
  27048. * // => [1, 3]
  27049. */
  27050. var xor = baseRest(function(arrays) {
  27051. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  27052. });
  27053. /**
  27054. * This method is like `_.xor` except that it accepts `iteratee` which is
  27055. * invoked for each element of each `arrays` to generate the criterion by
  27056. * which by which they're compared. The order of result values is determined
  27057. * by the order they occur in the arrays. The iteratee is invoked with one
  27058. * argument: (value).
  27059. *
  27060. * @static
  27061. * @memberOf _
  27062. * @since 4.0.0
  27063. * @category Array
  27064. * @param {...Array} [arrays] The arrays to inspect.
  27065. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  27066. * @returns {Array} Returns the new array of filtered values.
  27067. * @example
  27068. *
  27069. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  27070. * // => [1.2, 3.4]
  27071. *
  27072. * // The `_.property` iteratee shorthand.
  27073. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  27074. * // => [{ 'x': 2 }]
  27075. */
  27076. var xorBy = baseRest(function(arrays) {
  27077. var iteratee = last(arrays);
  27078. if (isArrayLikeObject(iteratee)) {
  27079. iteratee = undefined;
  27080. }
  27081. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  27082. });
  27083. /**
  27084. * This method is like `_.xor` except that it accepts `comparator` which is
  27085. * invoked to compare elements of `arrays`. The order of result values is
  27086. * determined by the order they occur in the arrays. The comparator is invoked
  27087. * with two arguments: (arrVal, othVal).
  27088. *
  27089. * @static
  27090. * @memberOf _
  27091. * @since 4.0.0
  27092. * @category Array
  27093. * @param {...Array} [arrays] The arrays to inspect.
  27094. * @param {Function} [comparator] The comparator invoked per element.
  27095. * @returns {Array} Returns the new array of filtered values.
  27096. * @example
  27097. *
  27098. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  27099. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  27100. *
  27101. * _.xorWith(objects, others, _.isEqual);
  27102. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  27103. */
  27104. var xorWith = baseRest(function(arrays) {
  27105. var comparator = last(arrays);
  27106. comparator = typeof comparator == 'function' ? comparator : undefined;
  27107. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  27108. });
  27109. /**
  27110. * Creates an array of grouped elements, the first of which contains the
  27111. * first elements of the given arrays, the second of which contains the
  27112. * second elements of the given arrays, and so on.
  27113. *
  27114. * @static
  27115. * @memberOf _
  27116. * @since 0.1.0
  27117. * @category Array
  27118. * @param {...Array} [arrays] The arrays to process.
  27119. * @returns {Array} Returns the new array of grouped elements.
  27120. * @example
  27121. *
  27122. * _.zip(['a', 'b'], [1, 2], [true, false]);
  27123. * // => [['a', 1, true], ['b', 2, false]]
  27124. */
  27125. var zip = baseRest(unzip);
  27126. /**
  27127. * This method is like `_.fromPairs` except that it accepts two arrays,
  27128. * one of property identifiers and one of corresponding values.
  27129. *
  27130. * @static
  27131. * @memberOf _
  27132. * @since 0.4.0
  27133. * @category Array
  27134. * @param {Array} [props=[]] The property identifiers.
  27135. * @param {Array} [values=[]] The property values.
  27136. * @returns {Object} Returns the new object.
  27137. * @example
  27138. *
  27139. * _.zipObject(['a', 'b'], [1, 2]);
  27140. * // => { 'a': 1, 'b': 2 }
  27141. */
  27142. function zipObject(props, values) {
  27143. return baseZipObject(props || [], values || [], assignValue);
  27144. }
  27145. /**
  27146. * This method is like `_.zipObject` except that it supports property paths.
  27147. *
  27148. * @static
  27149. * @memberOf _
  27150. * @since 4.1.0
  27151. * @category Array
  27152. * @param {Array} [props=[]] The property identifiers.
  27153. * @param {Array} [values=[]] The property values.
  27154. * @returns {Object} Returns the new object.
  27155. * @example
  27156. *
  27157. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  27158. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  27159. */
  27160. function zipObjectDeep(props, values) {
  27161. return baseZipObject(props || [], values || [], baseSet);
  27162. }
  27163. /**
  27164. * This method is like `_.zip` except that it accepts `iteratee` to specify
  27165. * how grouped values should be combined. The iteratee is invoked with the
  27166. * elements of each group: (...group).
  27167. *
  27168. * @static
  27169. * @memberOf _
  27170. * @since 3.8.0
  27171. * @category Array
  27172. * @param {...Array} [arrays] The arrays to process.
  27173. * @param {Function} [iteratee=_.identity] The function to combine
  27174. * grouped values.
  27175. * @returns {Array} Returns the new array of grouped elements.
  27176. * @example
  27177. *
  27178. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  27179. * return a + b + c;
  27180. * });
  27181. * // => [111, 222]
  27182. */
  27183. var zipWith = baseRest(function(arrays) {
  27184. var length = arrays.length,
  27185. iteratee = length > 1 ? arrays[length - 1] : undefined;
  27186. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  27187. return unzipWith(arrays, iteratee);
  27188. });
  27189. /*------------------------------------------------------------------------*/
  27190. /**
  27191. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  27192. * chain sequences enabled. The result of such sequences must be unwrapped
  27193. * with `_#value`.
  27194. *
  27195. * @static
  27196. * @memberOf _
  27197. * @since 1.3.0
  27198. * @category Seq
  27199. * @param {*} value The value to wrap.
  27200. * @returns {Object} Returns the new `lodash` wrapper instance.
  27201. * @example
  27202. *
  27203. * var users = [
  27204. * { 'user': 'barney', 'age': 36 },
  27205. * { 'user': 'fred', 'age': 40 },
  27206. * { 'user': 'pebbles', 'age': 1 }
  27207. * ];
  27208. *
  27209. * var youngest = _
  27210. * .chain(users)
  27211. * .sortBy('age')
  27212. * .map(function(o) {
  27213. * return o.user + ' is ' + o.age;
  27214. * })
  27215. * .head()
  27216. * .value();
  27217. * // => 'pebbles is 1'
  27218. */
  27219. function chain(value) {
  27220. var result = lodash(value);
  27221. result.__chain__ = true;
  27222. return result;
  27223. }
  27224. /**
  27225. * This method invokes `interceptor` and returns `value`. The interceptor
  27226. * is invoked with one argument; (value). The purpose of this method is to
  27227. * "tap into" a method chain sequence in order to modify intermediate results.
  27228. *
  27229. * @static
  27230. * @memberOf _
  27231. * @since 0.1.0
  27232. * @category Seq
  27233. * @param {*} value The value to provide to `interceptor`.
  27234. * @param {Function} interceptor The function to invoke.
  27235. * @returns {*} Returns `value`.
  27236. * @example
  27237. *
  27238. * _([1, 2, 3])
  27239. * .tap(function(array) {
  27240. * // Mutate input array.
  27241. * array.pop();
  27242. * })
  27243. * .reverse()
  27244. * .value();
  27245. * // => [2, 1]
  27246. */
  27247. function tap(value, interceptor) {
  27248. interceptor(value);
  27249. return value;
  27250. }
  27251. /**
  27252. * This method is like `_.tap` except that it returns the result of `interceptor`.
  27253. * The purpose of this method is to "pass thru" values replacing intermediate
  27254. * results in a method chain sequence.
  27255. *
  27256. * @static
  27257. * @memberOf _
  27258. * @since 3.0.0
  27259. * @category Seq
  27260. * @param {*} value The value to provide to `interceptor`.
  27261. * @param {Function} interceptor The function to invoke.
  27262. * @returns {*} Returns the result of `interceptor`.
  27263. * @example
  27264. *
  27265. * _(' abc ')
  27266. * .chain()
  27267. * .trim()
  27268. * .thru(function(value) {
  27269. * return [value];
  27270. * })
  27271. * .value();
  27272. * // => ['abc']
  27273. */
  27274. function thru(value, interceptor) {
  27275. return interceptor(value);
  27276. }
  27277. /**
  27278. * This method is the wrapper version of `_.at`.
  27279. *
  27280. * @name at
  27281. * @memberOf _
  27282. * @since 1.0.0
  27283. * @category Seq
  27284. * @param {...(string|string[])} [paths] The property paths to pick.
  27285. * @returns {Object} Returns the new `lodash` wrapper instance.
  27286. * @example
  27287. *
  27288. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  27289. *
  27290. * _(object).at(['a[0].b.c', 'a[1]']).value();
  27291. * // => [3, 4]
  27292. */
  27293. var wrapperAt = flatRest(function(paths) {
  27294. var length = paths.length,
  27295. start = length ? paths[0] : 0,
  27296. value = this.__wrapped__,
  27297. interceptor = function(object) { return baseAt(object, paths); };
  27298. if (length > 1 || this.__actions__.length ||
  27299. !(value instanceof LazyWrapper) || !isIndex(start)) {
  27300. return this.thru(interceptor);
  27301. }
  27302. value = value.slice(start, +start + (length ? 1 : 0));
  27303. value.__actions__.push({
  27304. 'func': thru,
  27305. 'args': [interceptor],
  27306. 'thisArg': undefined
  27307. });
  27308. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  27309. if (length && !array.length) {
  27310. array.push(undefined);
  27311. }
  27312. return array;
  27313. });
  27314. });
  27315. /**
  27316. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  27317. *
  27318. * @name chain
  27319. * @memberOf _
  27320. * @since 0.1.0
  27321. * @category Seq
  27322. * @returns {Object} Returns the new `lodash` wrapper instance.
  27323. * @example
  27324. *
  27325. * var users = [
  27326. * { 'user': 'barney', 'age': 36 },
  27327. * { 'user': 'fred', 'age': 40 }
  27328. * ];
  27329. *
  27330. * // A sequence without explicit chaining.
  27331. * _(users).head();
  27332. * // => { 'user': 'barney', 'age': 36 }
  27333. *
  27334. * // A sequence with explicit chaining.
  27335. * _(users)
  27336. * .chain()
  27337. * .head()
  27338. * .pick('user')
  27339. * .value();
  27340. * // => { 'user': 'barney' }
  27341. */
  27342. function wrapperChain() {
  27343. return chain(this);
  27344. }
  27345. /**
  27346. * Executes the chain sequence and returns the wrapped result.
  27347. *
  27348. * @name commit
  27349. * @memberOf _
  27350. * @since 3.2.0
  27351. * @category Seq
  27352. * @returns {Object} Returns the new `lodash` wrapper instance.
  27353. * @example
  27354. *
  27355. * var array = [1, 2];
  27356. * var wrapped = _(array).push(3);
  27357. *
  27358. * console.log(array);
  27359. * // => [1, 2]
  27360. *
  27361. * wrapped = wrapped.commit();
  27362. * console.log(array);
  27363. * // => [1, 2, 3]
  27364. *
  27365. * wrapped.last();
  27366. * // => 3
  27367. *
  27368. * console.log(array);
  27369. * // => [1, 2, 3]
  27370. */
  27371. function wrapperCommit() {
  27372. return new LodashWrapper(this.value(), this.__chain__);
  27373. }
  27374. /**
  27375. * Gets the next value on a wrapped object following the
  27376. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  27377. *
  27378. * @name next
  27379. * @memberOf _
  27380. * @since 4.0.0
  27381. * @category Seq
  27382. * @returns {Object} Returns the next iterator value.
  27383. * @example
  27384. *
  27385. * var wrapped = _([1, 2]);
  27386. *
  27387. * wrapped.next();
  27388. * // => { 'done': false, 'value': 1 }
  27389. *
  27390. * wrapped.next();
  27391. * // => { 'done': false, 'value': 2 }
  27392. *
  27393. * wrapped.next();
  27394. * // => { 'done': true, 'value': undefined }
  27395. */
  27396. function wrapperNext() {
  27397. if (this.__values__ === undefined) {
  27398. this.__values__ = toArray(this.value());
  27399. }
  27400. var done = this.__index__ >= this.__values__.length,
  27401. value = done ? undefined : this.__values__[this.__index__++];
  27402. return { 'done': done, 'value': value };
  27403. }
  27404. /**
  27405. * Enables the wrapper to be iterable.
  27406. *
  27407. * @name Symbol.iterator
  27408. * @memberOf _
  27409. * @since 4.0.0
  27410. * @category Seq
  27411. * @returns {Object} Returns the wrapper object.
  27412. * @example
  27413. *
  27414. * var wrapped = _([1, 2]);
  27415. *
  27416. * wrapped[Symbol.iterator]() === wrapped;
  27417. * // => true
  27418. *
  27419. * Array.from(wrapped);
  27420. * // => [1, 2]
  27421. */
  27422. function wrapperToIterator() {
  27423. return this;
  27424. }
  27425. /**
  27426. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  27427. *
  27428. * @name plant
  27429. * @memberOf _
  27430. * @since 3.2.0
  27431. * @category Seq
  27432. * @param {*} value The value to plant.
  27433. * @returns {Object} Returns the new `lodash` wrapper instance.
  27434. * @example
  27435. *
  27436. * function square(n) {
  27437. * return n * n;
  27438. * }
  27439. *
  27440. * var wrapped = _([1, 2]).map(square);
  27441. * var other = wrapped.plant([3, 4]);
  27442. *
  27443. * other.value();
  27444. * // => [9, 16]
  27445. *
  27446. * wrapped.value();
  27447. * // => [1, 4]
  27448. */
  27449. function wrapperPlant(value) {
  27450. var result,
  27451. parent = this;
  27452. while (parent instanceof baseLodash) {
  27453. var clone = wrapperClone(parent);
  27454. clone.__index__ = 0;
  27455. clone.__values__ = undefined;
  27456. if (result) {
  27457. previous.__wrapped__ = clone;
  27458. } else {
  27459. result = clone;
  27460. }
  27461. var previous = clone;
  27462. parent = parent.__wrapped__;
  27463. }
  27464. previous.__wrapped__ = value;
  27465. return result;
  27466. }
  27467. /**
  27468. * This method is the wrapper version of `_.reverse`.
  27469. *
  27470. * **Note:** This method mutates the wrapped array.
  27471. *
  27472. * @name reverse
  27473. * @memberOf _
  27474. * @since 0.1.0
  27475. * @category Seq
  27476. * @returns {Object} Returns the new `lodash` wrapper instance.
  27477. * @example
  27478. *
  27479. * var array = [1, 2, 3];
  27480. *
  27481. * _(array).reverse().value()
  27482. * // => [3, 2, 1]
  27483. *
  27484. * console.log(array);
  27485. * // => [3, 2, 1]
  27486. */
  27487. function wrapperReverse() {
  27488. var value = this.__wrapped__;
  27489. if (value instanceof LazyWrapper) {
  27490. var wrapped = value;
  27491. if (this.__actions__.length) {
  27492. wrapped = new LazyWrapper(this);
  27493. }
  27494. wrapped = wrapped.reverse();
  27495. wrapped.__actions__.push({
  27496. 'func': thru,
  27497. 'args': [reverse],
  27498. 'thisArg': undefined
  27499. });
  27500. return new LodashWrapper(wrapped, this.__chain__);
  27501. }
  27502. return this.thru(reverse);
  27503. }
  27504. /**
  27505. * Executes the chain sequence to resolve the unwrapped value.
  27506. *
  27507. * @name value
  27508. * @memberOf _
  27509. * @since 0.1.0
  27510. * @alias toJSON, valueOf
  27511. * @category Seq
  27512. * @returns {*} Returns the resolved unwrapped value.
  27513. * @example
  27514. *
  27515. * _([1, 2, 3]).value();
  27516. * // => [1, 2, 3]
  27517. */
  27518. function wrapperValue() {
  27519. return baseWrapperValue(this.__wrapped__, this.__actions__);
  27520. }
  27521. /*------------------------------------------------------------------------*/
  27522. /**
  27523. * Creates an object composed of keys generated from the results of running
  27524. * each element of `collection` thru `iteratee`. The corresponding value of
  27525. * each key is the number of times the key was returned by `iteratee`. The
  27526. * iteratee is invoked with one argument: (value).
  27527. *
  27528. * @static
  27529. * @memberOf _
  27530. * @since 0.5.0
  27531. * @category Collection
  27532. * @param {Array|Object} collection The collection to iterate over.
  27533. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27534. * @returns {Object} Returns the composed aggregate object.
  27535. * @example
  27536. *
  27537. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  27538. * // => { '4': 1, '6': 2 }
  27539. *
  27540. * // The `_.property` iteratee shorthand.
  27541. * _.countBy(['one', 'two', 'three'], 'length');
  27542. * // => { '3': 2, '5': 1 }
  27543. */
  27544. var countBy = createAggregator(function(result, value, key) {
  27545. if (hasOwnProperty.call(result, key)) {
  27546. ++result[key];
  27547. } else {
  27548. baseAssignValue(result, key, 1);
  27549. }
  27550. });
  27551. /**
  27552. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  27553. * Iteration is stopped once `predicate` returns falsey. The predicate is
  27554. * invoked with three arguments: (value, index|key, collection).
  27555. *
  27556. * **Note:** This method returns `true` for
  27557. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  27558. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  27559. * elements of empty collections.
  27560. *
  27561. * @static
  27562. * @memberOf _
  27563. * @since 0.1.0
  27564. * @category Collection
  27565. * @param {Array|Object} collection The collection to iterate over.
  27566. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27567. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27568. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  27569. * else `false`.
  27570. * @example
  27571. *
  27572. * _.every([true, 1, null, 'yes'], Boolean);
  27573. * // => false
  27574. *
  27575. * var users = [
  27576. * { 'user': 'barney', 'age': 36, 'active': false },
  27577. * { 'user': 'fred', 'age': 40, 'active': false }
  27578. * ];
  27579. *
  27580. * // The `_.matches` iteratee shorthand.
  27581. * _.every(users, { 'user': 'barney', 'active': false });
  27582. * // => false
  27583. *
  27584. * // The `_.matchesProperty` iteratee shorthand.
  27585. * _.every(users, ['active', false]);
  27586. * // => true
  27587. *
  27588. * // The `_.property` iteratee shorthand.
  27589. * _.every(users, 'active');
  27590. * // => false
  27591. */
  27592. function every(collection, predicate, guard) {
  27593. var func = isArray(collection) ? arrayEvery : baseEvery;
  27594. if (guard && isIterateeCall(collection, predicate, guard)) {
  27595. predicate = undefined;
  27596. }
  27597. return func(collection, getIteratee(predicate, 3));
  27598. }
  27599. /**
  27600. * Iterates over elements of `collection`, returning an array of all elements
  27601. * `predicate` returns truthy for. The predicate is invoked with three
  27602. * arguments: (value, index|key, collection).
  27603. *
  27604. * **Note:** Unlike `_.remove`, this method returns a new array.
  27605. *
  27606. * @static
  27607. * @memberOf _
  27608. * @since 0.1.0
  27609. * @category Collection
  27610. * @param {Array|Object} collection The collection to iterate over.
  27611. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27612. * @returns {Array} Returns the new filtered array.
  27613. * @see _.reject
  27614. * @example
  27615. *
  27616. * var users = [
  27617. * { 'user': 'barney', 'age': 36, 'active': true },
  27618. * { 'user': 'fred', 'age': 40, 'active': false }
  27619. * ];
  27620. *
  27621. * _.filter(users, function(o) { return !o.active; });
  27622. * // => objects for ['fred']
  27623. *
  27624. * // The `_.matches` iteratee shorthand.
  27625. * _.filter(users, { 'age': 36, 'active': true });
  27626. * // => objects for ['barney']
  27627. *
  27628. * // The `_.matchesProperty` iteratee shorthand.
  27629. * _.filter(users, ['active', false]);
  27630. * // => objects for ['fred']
  27631. *
  27632. * // The `_.property` iteratee shorthand.
  27633. * _.filter(users, 'active');
  27634. * // => objects for ['barney']
  27635. */
  27636. function filter(collection, predicate) {
  27637. var func = isArray(collection) ? arrayFilter : baseFilter;
  27638. return func(collection, getIteratee(predicate, 3));
  27639. }
  27640. /**
  27641. * Iterates over elements of `collection`, returning the first element
  27642. * `predicate` returns truthy for. The predicate is invoked with three
  27643. * arguments: (value, index|key, collection).
  27644. *
  27645. * @static
  27646. * @memberOf _
  27647. * @since 0.1.0
  27648. * @category Collection
  27649. * @param {Array|Object} collection The collection to inspect.
  27650. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27651. * @param {number} [fromIndex=0] The index to search from.
  27652. * @returns {*} Returns the matched element, else `undefined`.
  27653. * @example
  27654. *
  27655. * var users = [
  27656. * { 'user': 'barney', 'age': 36, 'active': true },
  27657. * { 'user': 'fred', 'age': 40, 'active': false },
  27658. * { 'user': 'pebbles', 'age': 1, 'active': true }
  27659. * ];
  27660. *
  27661. * _.find(users, function(o) { return o.age < 40; });
  27662. * // => object for 'barney'
  27663. *
  27664. * // The `_.matches` iteratee shorthand.
  27665. * _.find(users, { 'age': 1, 'active': true });
  27666. * // => object for 'pebbles'
  27667. *
  27668. * // The `_.matchesProperty` iteratee shorthand.
  27669. * _.find(users, ['active', false]);
  27670. * // => object for 'fred'
  27671. *
  27672. * // The `_.property` iteratee shorthand.
  27673. * _.find(users, 'active');
  27674. * // => object for 'barney'
  27675. */
  27676. var find = createFind(findIndex);
  27677. /**
  27678. * This method is like `_.find` except that it iterates over elements of
  27679. * `collection` from right to left.
  27680. *
  27681. * @static
  27682. * @memberOf _
  27683. * @since 2.0.0
  27684. * @category Collection
  27685. * @param {Array|Object} collection The collection to inspect.
  27686. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27687. * @param {number} [fromIndex=collection.length-1] The index to search from.
  27688. * @returns {*} Returns the matched element, else `undefined`.
  27689. * @example
  27690. *
  27691. * _.findLast([1, 2, 3, 4], function(n) {
  27692. * return n % 2 == 1;
  27693. * });
  27694. * // => 3
  27695. */
  27696. var findLast = createFind(findLastIndex);
  27697. /**
  27698. * Creates a flattened array of values by running each element in `collection`
  27699. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  27700. * with three arguments: (value, index|key, collection).
  27701. *
  27702. * @static
  27703. * @memberOf _
  27704. * @since 4.0.0
  27705. * @category Collection
  27706. * @param {Array|Object} collection The collection to iterate over.
  27707. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27708. * @returns {Array} Returns the new flattened array.
  27709. * @example
  27710. *
  27711. * function duplicate(n) {
  27712. * return [n, n];
  27713. * }
  27714. *
  27715. * _.flatMap([1, 2], duplicate);
  27716. * // => [1, 1, 2, 2]
  27717. */
  27718. function flatMap(collection, iteratee) {
  27719. return baseFlatten(map(collection, iteratee), 1);
  27720. }
  27721. /**
  27722. * This method is like `_.flatMap` except that it recursively flattens the
  27723. * mapped results.
  27724. *
  27725. * @static
  27726. * @memberOf _
  27727. * @since 4.7.0
  27728. * @category Collection
  27729. * @param {Array|Object} collection The collection to iterate over.
  27730. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27731. * @returns {Array} Returns the new flattened array.
  27732. * @example
  27733. *
  27734. * function duplicate(n) {
  27735. * return [[[n, n]]];
  27736. * }
  27737. *
  27738. * _.flatMapDeep([1, 2], duplicate);
  27739. * // => [1, 1, 2, 2]
  27740. */
  27741. function flatMapDeep(collection, iteratee) {
  27742. return baseFlatten(map(collection, iteratee), INFINITY);
  27743. }
  27744. /**
  27745. * This method is like `_.flatMap` except that it recursively flattens the
  27746. * mapped results up to `depth` times.
  27747. *
  27748. * @static
  27749. * @memberOf _
  27750. * @since 4.7.0
  27751. * @category Collection
  27752. * @param {Array|Object} collection The collection to iterate over.
  27753. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27754. * @param {number} [depth=1] The maximum recursion depth.
  27755. * @returns {Array} Returns the new flattened array.
  27756. * @example
  27757. *
  27758. * function duplicate(n) {
  27759. * return [[[n, n]]];
  27760. * }
  27761. *
  27762. * _.flatMapDepth([1, 2], duplicate, 2);
  27763. * // => [[1, 1], [2, 2]]
  27764. */
  27765. function flatMapDepth(collection, iteratee, depth) {
  27766. depth = depth === undefined ? 1 : toInteger(depth);
  27767. return baseFlatten(map(collection, iteratee), depth);
  27768. }
  27769. /**
  27770. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  27771. * The iteratee is invoked with three arguments: (value, index|key, collection).
  27772. * Iteratee functions may exit iteration early by explicitly returning `false`.
  27773. *
  27774. * **Note:** As with other "Collections" methods, objects with a "length"
  27775. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  27776. * or `_.forOwn` for object iteration.
  27777. *
  27778. * @static
  27779. * @memberOf _
  27780. * @since 0.1.0
  27781. * @alias each
  27782. * @category Collection
  27783. * @param {Array|Object} collection The collection to iterate over.
  27784. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27785. * @returns {Array|Object} Returns `collection`.
  27786. * @see _.forEachRight
  27787. * @example
  27788. *
  27789. * _.forEach([1, 2], function(value) {
  27790. * console.log(value);
  27791. * });
  27792. * // => Logs `1` then `2`.
  27793. *
  27794. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27795. * console.log(key);
  27796. * });
  27797. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27798. */
  27799. function forEach(collection, iteratee) {
  27800. var func = isArray(collection) ? arrayEach : baseEach;
  27801. return func(collection, getIteratee(iteratee, 3));
  27802. }
  27803. /**
  27804. * This method is like `_.forEach` except that it iterates over elements of
  27805. * `collection` from right to left.
  27806. *
  27807. * @static
  27808. * @memberOf _
  27809. * @since 2.0.0
  27810. * @alias eachRight
  27811. * @category Collection
  27812. * @param {Array|Object} collection The collection to iterate over.
  27813. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27814. * @returns {Array|Object} Returns `collection`.
  27815. * @see _.forEach
  27816. * @example
  27817. *
  27818. * _.forEachRight([1, 2], function(value) {
  27819. * console.log(value);
  27820. * });
  27821. * // => Logs `2` then `1`.
  27822. */
  27823. function forEachRight(collection, iteratee) {
  27824. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27825. return func(collection, getIteratee(iteratee, 3));
  27826. }
  27827. /**
  27828. * Creates an object composed of keys generated from the results of running
  27829. * each element of `collection` thru `iteratee`. The order of grouped values
  27830. * is determined by the order they occur in `collection`. The corresponding
  27831. * value of each key is an array of elements responsible for generating the
  27832. * key. The iteratee is invoked with one argument: (value).
  27833. *
  27834. * @static
  27835. * @memberOf _
  27836. * @since 0.1.0
  27837. * @category Collection
  27838. * @param {Array|Object} collection The collection to iterate over.
  27839. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27840. * @returns {Object} Returns the composed aggregate object.
  27841. * @example
  27842. *
  27843. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27844. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27845. *
  27846. * // The `_.property` iteratee shorthand.
  27847. * _.groupBy(['one', 'two', 'three'], 'length');
  27848. * // => { '3': ['one', 'two'], '5': ['three'] }
  27849. */
  27850. var groupBy = createAggregator(function(result, value, key) {
  27851. if (hasOwnProperty.call(result, key)) {
  27852. result[key].push(value);
  27853. } else {
  27854. baseAssignValue(result, key, [value]);
  27855. }
  27856. });
  27857. /**
  27858. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27859. * checked for a substring of `value`, otherwise
  27860. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27861. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27862. * the offset from the end of `collection`.
  27863. *
  27864. * @static
  27865. * @memberOf _
  27866. * @since 0.1.0
  27867. * @category Collection
  27868. * @param {Array|Object|string} collection The collection to inspect.
  27869. * @param {*} value The value to search for.
  27870. * @param {number} [fromIndex=0] The index to search from.
  27871. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27872. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27873. * @example
  27874. *
  27875. * _.includes([1, 2, 3], 1);
  27876. * // => true
  27877. *
  27878. * _.includes([1, 2, 3], 1, 2);
  27879. * // => false
  27880. *
  27881. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27882. * // => true
  27883. *
  27884. * _.includes('abcd', 'bc');
  27885. * // => true
  27886. */
  27887. function includes(collection, value, fromIndex, guard) {
  27888. collection = isArrayLike(collection) ? collection : values(collection);
  27889. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27890. var length = collection.length;
  27891. if (fromIndex < 0) {
  27892. fromIndex = nativeMax(length + fromIndex, 0);
  27893. }
  27894. return isString(collection)
  27895. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27896. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27897. }
  27898. /**
  27899. * Invokes the method at `path` of each element in `collection`, returning
  27900. * an array of the results of each invoked method. Any additional arguments
  27901. * are provided to each invoked method. If `path` is a function, it's invoked
  27902. * for, and `this` bound to, each element in `collection`.
  27903. *
  27904. * @static
  27905. * @memberOf _
  27906. * @since 4.0.0
  27907. * @category Collection
  27908. * @param {Array|Object} collection The collection to iterate over.
  27909. * @param {Array|Function|string} path The path of the method to invoke or
  27910. * the function invoked per iteration.
  27911. * @param {...*} [args] The arguments to invoke each method with.
  27912. * @returns {Array} Returns the array of results.
  27913. * @example
  27914. *
  27915. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27916. * // => [[1, 5, 7], [1, 2, 3]]
  27917. *
  27918. * _.invokeMap([123, 456], String.prototype.split, '');
  27919. * // => [['1', '2', '3'], ['4', '5', '6']]
  27920. */
  27921. var invokeMap = baseRest(function(collection, path, args) {
  27922. var index = -1,
  27923. isFunc = typeof path == 'function',
  27924. result = isArrayLike(collection) ? Array(collection.length) : [];
  27925. baseEach(collection, function(value) {
  27926. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27927. });
  27928. return result;
  27929. });
  27930. /**
  27931. * Creates an object composed of keys generated from the results of running
  27932. * each element of `collection` thru `iteratee`. The corresponding value of
  27933. * each key is the last element responsible for generating the key. The
  27934. * iteratee is invoked with one argument: (value).
  27935. *
  27936. * @static
  27937. * @memberOf _
  27938. * @since 4.0.0
  27939. * @category Collection
  27940. * @param {Array|Object} collection The collection to iterate over.
  27941. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27942. * @returns {Object} Returns the composed aggregate object.
  27943. * @example
  27944. *
  27945. * var array = [
  27946. * { 'dir': 'left', 'code': 97 },
  27947. * { 'dir': 'right', 'code': 100 }
  27948. * ];
  27949. *
  27950. * _.keyBy(array, function(o) {
  27951. * return String.fromCharCode(o.code);
  27952. * });
  27953. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27954. *
  27955. * _.keyBy(array, 'dir');
  27956. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27957. */
  27958. var keyBy = createAggregator(function(result, value, key) {
  27959. baseAssignValue(result, key, value);
  27960. });
  27961. /**
  27962. * Creates an array of values by running each element in `collection` thru
  27963. * `iteratee`. The iteratee is invoked with three arguments:
  27964. * (value, index|key, collection).
  27965. *
  27966. * Many lodash methods are guarded to work as iteratees for methods like
  27967. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27968. *
  27969. * The guarded methods are:
  27970. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27971. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27972. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27973. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27974. *
  27975. * @static
  27976. * @memberOf _
  27977. * @since 0.1.0
  27978. * @category Collection
  27979. * @param {Array|Object} collection The collection to iterate over.
  27980. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27981. * @returns {Array} Returns the new mapped array.
  27982. * @example
  27983. *
  27984. * function square(n) {
  27985. * return n * n;
  27986. * }
  27987. *
  27988. * _.map([4, 8], square);
  27989. * // => [16, 64]
  27990. *
  27991. * _.map({ 'a': 4, 'b': 8 }, square);
  27992. * // => [16, 64] (iteration order is not guaranteed)
  27993. *
  27994. * var users = [
  27995. * { 'user': 'barney' },
  27996. * { 'user': 'fred' }
  27997. * ];
  27998. *
  27999. * // The `_.property` iteratee shorthand.
  28000. * _.map(users, 'user');
  28001. * // => ['barney', 'fred']
  28002. */
  28003. function map(collection, iteratee) {
  28004. var func = isArray(collection) ? arrayMap : baseMap;
  28005. return func(collection, getIteratee(iteratee, 3));
  28006. }
  28007. /**
  28008. * This method is like `_.sortBy` except that it allows specifying the sort
  28009. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  28010. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  28011. * descending or "asc" for ascending sort order of corresponding values.
  28012. *
  28013. * @static
  28014. * @memberOf _
  28015. * @since 4.0.0
  28016. * @category Collection
  28017. * @param {Array|Object} collection The collection to iterate over.
  28018. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  28019. * The iteratees to sort by.
  28020. * @param {string[]} [orders] The sort orders of `iteratees`.
  28021. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  28022. * @returns {Array} Returns the new sorted array.
  28023. * @example
  28024. *
  28025. * var users = [
  28026. * { 'user': 'fred', 'age': 48 },
  28027. * { 'user': 'barney', 'age': 34 },
  28028. * { 'user': 'fred', 'age': 40 },
  28029. * { 'user': 'barney', 'age': 36 }
  28030. * ];
  28031. *
  28032. * // Sort by `user` in ascending order and by `age` in descending order.
  28033. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  28034. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  28035. */
  28036. function orderBy(collection, iteratees, orders, guard) {
  28037. if (collection == null) {
  28038. return [];
  28039. }
  28040. if (!isArray(iteratees)) {
  28041. iteratees = iteratees == null ? [] : [iteratees];
  28042. }
  28043. orders = guard ? undefined : orders;
  28044. if (!isArray(orders)) {
  28045. orders = orders == null ? [] : [orders];
  28046. }
  28047. return baseOrderBy(collection, iteratees, orders);
  28048. }
  28049. /**
  28050. * Creates an array of elements split into two groups, the first of which
  28051. * contains elements `predicate` returns truthy for, the second of which
  28052. * contains elements `predicate` returns falsey for. The predicate is
  28053. * invoked with one argument: (value).
  28054. *
  28055. * @static
  28056. * @memberOf _
  28057. * @since 3.0.0
  28058. * @category Collection
  28059. * @param {Array|Object} collection The collection to iterate over.
  28060. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28061. * @returns {Array} Returns the array of grouped elements.
  28062. * @example
  28063. *
  28064. * var users = [
  28065. * { 'user': 'barney', 'age': 36, 'active': false },
  28066. * { 'user': 'fred', 'age': 40, 'active': true },
  28067. * { 'user': 'pebbles', 'age': 1, 'active': false }
  28068. * ];
  28069. *
  28070. * _.partition(users, function(o) { return o.active; });
  28071. * // => objects for [['fred'], ['barney', 'pebbles']]
  28072. *
  28073. * // The `_.matches` iteratee shorthand.
  28074. * _.partition(users, { 'age': 1, 'active': false });
  28075. * // => objects for [['pebbles'], ['barney', 'fred']]
  28076. *
  28077. * // The `_.matchesProperty` iteratee shorthand.
  28078. * _.partition(users, ['active', false]);
  28079. * // => objects for [['barney', 'pebbles'], ['fred']]
  28080. *
  28081. * // The `_.property` iteratee shorthand.
  28082. * _.partition(users, 'active');
  28083. * // => objects for [['fred'], ['barney', 'pebbles']]
  28084. */
  28085. var partition = createAggregator(function(result, value, key) {
  28086. result[key ? 0 : 1].push(value);
  28087. }, function() { return [[], []]; });
  28088. /**
  28089. * Reduces `collection` to a value which is the accumulated result of running
  28090. * each element in `collection` thru `iteratee`, where each successive
  28091. * invocation is supplied the return value of the previous. If `accumulator`
  28092. * is not given, the first element of `collection` is used as the initial
  28093. * value. The iteratee is invoked with four arguments:
  28094. * (accumulator, value, index|key, collection).
  28095. *
  28096. * Many lodash methods are guarded to work as iteratees for methods like
  28097. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  28098. *
  28099. * The guarded methods are:
  28100. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  28101. * and `sortBy`
  28102. *
  28103. * @static
  28104. * @memberOf _
  28105. * @since 0.1.0
  28106. * @category Collection
  28107. * @param {Array|Object} collection The collection to iterate over.
  28108. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28109. * @param {*} [accumulator] The initial value.
  28110. * @returns {*} Returns the accumulated value.
  28111. * @see _.reduceRight
  28112. * @example
  28113. *
  28114. * _.reduce([1, 2], function(sum, n) {
  28115. * return sum + n;
  28116. * }, 0);
  28117. * // => 3
  28118. *
  28119. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  28120. * (result[value] || (result[value] = [])).push(key);
  28121. * return result;
  28122. * }, {});
  28123. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  28124. */
  28125. function reduce(collection, iteratee, accumulator) {
  28126. var func = isArray(collection) ? arrayReduce : baseReduce,
  28127. initAccum = arguments.length < 3;
  28128. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  28129. }
  28130. /**
  28131. * This method is like `_.reduce` except that it iterates over elements of
  28132. * `collection` from right to left.
  28133. *
  28134. * @static
  28135. * @memberOf _
  28136. * @since 0.1.0
  28137. * @category Collection
  28138. * @param {Array|Object} collection The collection to iterate over.
  28139. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  28140. * @param {*} [accumulator] The initial value.
  28141. * @returns {*} Returns the accumulated value.
  28142. * @see _.reduce
  28143. * @example
  28144. *
  28145. * var array = [[0, 1], [2, 3], [4, 5]];
  28146. *
  28147. * _.reduceRight(array, function(flattened, other) {
  28148. * return flattened.concat(other);
  28149. * }, []);
  28150. * // => [4, 5, 2, 3, 0, 1]
  28151. */
  28152. function reduceRight(collection, iteratee, accumulator) {
  28153. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  28154. initAccum = arguments.length < 3;
  28155. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  28156. }
  28157. /**
  28158. * The opposite of `_.filter`; this method returns the elements of `collection`
  28159. * that `predicate` does **not** return truthy for.
  28160. *
  28161. * @static
  28162. * @memberOf _
  28163. * @since 0.1.0
  28164. * @category Collection
  28165. * @param {Array|Object} collection The collection to iterate over.
  28166. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28167. * @returns {Array} Returns the new filtered array.
  28168. * @see _.filter
  28169. * @example
  28170. *
  28171. * var users = [
  28172. * { 'user': 'barney', 'age': 36, 'active': false },
  28173. * { 'user': 'fred', 'age': 40, 'active': true }
  28174. * ];
  28175. *
  28176. * _.reject(users, function(o) { return !o.active; });
  28177. * // => objects for ['fred']
  28178. *
  28179. * // The `_.matches` iteratee shorthand.
  28180. * _.reject(users, { 'age': 40, 'active': true });
  28181. * // => objects for ['barney']
  28182. *
  28183. * // The `_.matchesProperty` iteratee shorthand.
  28184. * _.reject(users, ['active', false]);
  28185. * // => objects for ['fred']
  28186. *
  28187. * // The `_.property` iteratee shorthand.
  28188. * _.reject(users, 'active');
  28189. * // => objects for ['barney']
  28190. */
  28191. function reject(collection, predicate) {
  28192. var func = isArray(collection) ? arrayFilter : baseFilter;
  28193. return func(collection, negate(getIteratee(predicate, 3)));
  28194. }
  28195. /**
  28196. * Gets a random element from `collection`.
  28197. *
  28198. * @static
  28199. * @memberOf _
  28200. * @since 2.0.0
  28201. * @category Collection
  28202. * @param {Array|Object} collection The collection to sample.
  28203. * @returns {*} Returns the random element.
  28204. * @example
  28205. *
  28206. * _.sample([1, 2, 3, 4]);
  28207. * // => 2
  28208. */
  28209. function sample(collection) {
  28210. var func = isArray(collection) ? arraySample : baseSample;
  28211. return func(collection);
  28212. }
  28213. /**
  28214. * Gets `n` random elements at unique keys from `collection` up to the
  28215. * size of `collection`.
  28216. *
  28217. * @static
  28218. * @memberOf _
  28219. * @since 4.0.0
  28220. * @category Collection
  28221. * @param {Array|Object} collection The collection to sample.
  28222. * @param {number} [n=1] The number of elements to sample.
  28223. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28224. * @returns {Array} Returns the random elements.
  28225. * @example
  28226. *
  28227. * _.sampleSize([1, 2, 3], 2);
  28228. * // => [3, 1]
  28229. *
  28230. * _.sampleSize([1, 2, 3], 4);
  28231. * // => [2, 3, 1]
  28232. */
  28233. function sampleSize(collection, n, guard) {
  28234. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  28235. n = 1;
  28236. } else {
  28237. n = toInteger(n);
  28238. }
  28239. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  28240. return func(collection, n);
  28241. }
  28242. /**
  28243. * Creates an array of shuffled values, using a version of the
  28244. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  28245. *
  28246. * @static
  28247. * @memberOf _
  28248. * @since 0.1.0
  28249. * @category Collection
  28250. * @param {Array|Object} collection The collection to shuffle.
  28251. * @returns {Array} Returns the new shuffled array.
  28252. * @example
  28253. *
  28254. * _.shuffle([1, 2, 3, 4]);
  28255. * // => [4, 1, 3, 2]
  28256. */
  28257. function shuffle(collection) {
  28258. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  28259. return func(collection);
  28260. }
  28261. /**
  28262. * Gets the size of `collection` by returning its length for array-like
  28263. * values or the number of own enumerable string keyed properties for objects.
  28264. *
  28265. * @static
  28266. * @memberOf _
  28267. * @since 0.1.0
  28268. * @category Collection
  28269. * @param {Array|Object|string} collection The collection to inspect.
  28270. * @returns {number} Returns the collection size.
  28271. * @example
  28272. *
  28273. * _.size([1, 2, 3]);
  28274. * // => 3
  28275. *
  28276. * _.size({ 'a': 1, 'b': 2 });
  28277. * // => 2
  28278. *
  28279. * _.size('pebbles');
  28280. * // => 7
  28281. */
  28282. function size(collection) {
  28283. if (collection == null) {
  28284. return 0;
  28285. }
  28286. if (isArrayLike(collection)) {
  28287. return isString(collection) ? stringSize(collection) : collection.length;
  28288. }
  28289. var tag = getTag(collection);
  28290. if (tag == mapTag || tag == setTag) {
  28291. return collection.size;
  28292. }
  28293. return baseKeys(collection).length;
  28294. }
  28295. /**
  28296. * Checks if `predicate` returns truthy for **any** element of `collection`.
  28297. * Iteration is stopped once `predicate` returns truthy. The predicate is
  28298. * invoked with three arguments: (value, index|key, collection).
  28299. *
  28300. * @static
  28301. * @memberOf _
  28302. * @since 0.1.0
  28303. * @category Collection
  28304. * @param {Array|Object} collection The collection to iterate over.
  28305. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  28306. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28307. * @returns {boolean} Returns `true` if any element passes the predicate check,
  28308. * else `false`.
  28309. * @example
  28310. *
  28311. * _.some([null, 0, 'yes', false], Boolean);
  28312. * // => true
  28313. *
  28314. * var users = [
  28315. * { 'user': 'barney', 'active': true },
  28316. * { 'user': 'fred', 'active': false }
  28317. * ];
  28318. *
  28319. * // The `_.matches` iteratee shorthand.
  28320. * _.some(users, { 'user': 'barney', 'active': false });
  28321. * // => false
  28322. *
  28323. * // The `_.matchesProperty` iteratee shorthand.
  28324. * _.some(users, ['active', false]);
  28325. * // => true
  28326. *
  28327. * // The `_.property` iteratee shorthand.
  28328. * _.some(users, 'active');
  28329. * // => true
  28330. */
  28331. function some(collection, predicate, guard) {
  28332. var func = isArray(collection) ? arraySome : baseSome;
  28333. if (guard && isIterateeCall(collection, predicate, guard)) {
  28334. predicate = undefined;
  28335. }
  28336. return func(collection, getIteratee(predicate, 3));
  28337. }
  28338. /**
  28339. * Creates an array of elements, sorted in ascending order by the results of
  28340. * running each element in a collection thru each iteratee. This method
  28341. * performs a stable sort, that is, it preserves the original sort order of
  28342. * equal elements. The iteratees are invoked with one argument: (value).
  28343. *
  28344. * @static
  28345. * @memberOf _
  28346. * @since 0.1.0
  28347. * @category Collection
  28348. * @param {Array|Object} collection The collection to iterate over.
  28349. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  28350. * The iteratees to sort by.
  28351. * @returns {Array} Returns the new sorted array.
  28352. * @example
  28353. *
  28354. * var users = [
  28355. * { 'user': 'fred', 'age': 48 },
  28356. * { 'user': 'barney', 'age': 36 },
  28357. * { 'user': 'fred', 'age': 40 },
  28358. * { 'user': 'barney', 'age': 34 }
  28359. * ];
  28360. *
  28361. * _.sortBy(users, [function(o) { return o.user; }]);
  28362. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  28363. *
  28364. * _.sortBy(users, ['user', 'age']);
  28365. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  28366. */
  28367. var sortBy = baseRest(function(collection, iteratees) {
  28368. if (collection == null) {
  28369. return [];
  28370. }
  28371. var length = iteratees.length;
  28372. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  28373. iteratees = [];
  28374. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  28375. iteratees = [iteratees[0]];
  28376. }
  28377. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  28378. });
  28379. /*------------------------------------------------------------------------*/
  28380. /**
  28381. * Gets the timestamp of the number of milliseconds that have elapsed since
  28382. * the Unix epoch (1 January 1970 00:00:00 UTC).
  28383. *
  28384. * @static
  28385. * @memberOf _
  28386. * @since 2.4.0
  28387. * @category Date
  28388. * @returns {number} Returns the timestamp.
  28389. * @example
  28390. *
  28391. * _.defer(function(stamp) {
  28392. * console.log(_.now() - stamp);
  28393. * }, _.now());
  28394. * // => Logs the number of milliseconds it took for the deferred invocation.
  28395. */
  28396. var now = ctxNow || function() {
  28397. return root.Date.now();
  28398. };
  28399. /*------------------------------------------------------------------------*/
  28400. /**
  28401. * The opposite of `_.before`; this method creates a function that invokes
  28402. * `func` once it's called `n` or more times.
  28403. *
  28404. * @static
  28405. * @memberOf _
  28406. * @since 0.1.0
  28407. * @category Function
  28408. * @param {number} n The number of calls before `func` is invoked.
  28409. * @param {Function} func The function to restrict.
  28410. * @returns {Function} Returns the new restricted function.
  28411. * @example
  28412. *
  28413. * var saves = ['profile', 'settings'];
  28414. *
  28415. * var done = _.after(saves.length, function() {
  28416. * console.log('done saving!');
  28417. * });
  28418. *
  28419. * _.forEach(saves, function(type) {
  28420. * asyncSave({ 'type': type, 'complete': done });
  28421. * });
  28422. * // => Logs 'done saving!' after the two async saves have completed.
  28423. */
  28424. function after(n, func) {
  28425. if (typeof func != 'function') {
  28426. throw new TypeError(FUNC_ERROR_TEXT);
  28427. }
  28428. n = toInteger(n);
  28429. return function() {
  28430. if (--n < 1) {
  28431. return func.apply(this, arguments);
  28432. }
  28433. };
  28434. }
  28435. /**
  28436. * Creates a function that invokes `func`, with up to `n` arguments,
  28437. * ignoring any additional arguments.
  28438. *
  28439. * @static
  28440. * @memberOf _
  28441. * @since 3.0.0
  28442. * @category Function
  28443. * @param {Function} func The function to cap arguments for.
  28444. * @param {number} [n=func.length] The arity cap.
  28445. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28446. * @returns {Function} Returns the new capped function.
  28447. * @example
  28448. *
  28449. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  28450. * // => [6, 8, 10]
  28451. */
  28452. function ary(func, n, guard) {
  28453. n = guard ? undefined : n;
  28454. n = (func && n == null) ? func.length : n;
  28455. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  28456. }
  28457. /**
  28458. * Creates a function that invokes `func`, with the `this` binding and arguments
  28459. * of the created function, while it's called less than `n` times. Subsequent
  28460. * calls to the created function return the result of the last `func` invocation.
  28461. *
  28462. * @static
  28463. * @memberOf _
  28464. * @since 3.0.0
  28465. * @category Function
  28466. * @param {number} n The number of calls at which `func` is no longer invoked.
  28467. * @param {Function} func The function to restrict.
  28468. * @returns {Function} Returns the new restricted function.
  28469. * @example
  28470. *
  28471. * jQuery(element).on('click', _.before(5, addContactToList));
  28472. * // => Allows adding up to 4 contacts to the list.
  28473. */
  28474. function before(n, func) {
  28475. var result;
  28476. if (typeof func != 'function') {
  28477. throw new TypeError(FUNC_ERROR_TEXT);
  28478. }
  28479. n = toInteger(n);
  28480. return function() {
  28481. if (--n > 0) {
  28482. result = func.apply(this, arguments);
  28483. }
  28484. if (n <= 1) {
  28485. func = undefined;
  28486. }
  28487. return result;
  28488. };
  28489. }
  28490. /**
  28491. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  28492. * and `partials` prepended to the arguments it receives.
  28493. *
  28494. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  28495. * may be used as a placeholder for partially applied arguments.
  28496. *
  28497. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  28498. * property of bound functions.
  28499. *
  28500. * @static
  28501. * @memberOf _
  28502. * @since 0.1.0
  28503. * @category Function
  28504. * @param {Function} func The function to bind.
  28505. * @param {*} thisArg The `this` binding of `func`.
  28506. * @param {...*} [partials] The arguments to be partially applied.
  28507. * @returns {Function} Returns the new bound function.
  28508. * @example
  28509. *
  28510. * function greet(greeting, punctuation) {
  28511. * return greeting + ' ' + this.user + punctuation;
  28512. * }
  28513. *
  28514. * var object = { 'user': 'fred' };
  28515. *
  28516. * var bound = _.bind(greet, object, 'hi');
  28517. * bound('!');
  28518. * // => 'hi fred!'
  28519. *
  28520. * // Bound with placeholders.
  28521. * var bound = _.bind(greet, object, _, '!');
  28522. * bound('hi');
  28523. * // => 'hi fred!'
  28524. */
  28525. var bind = baseRest(function(func, thisArg, partials) {
  28526. var bitmask = WRAP_BIND_FLAG;
  28527. if (partials.length) {
  28528. var holders = replaceHolders(partials, getHolder(bind));
  28529. bitmask |= WRAP_PARTIAL_FLAG;
  28530. }
  28531. return createWrap(func, bitmask, thisArg, partials, holders);
  28532. });
  28533. /**
  28534. * Creates a function that invokes the method at `object[key]` with `partials`
  28535. * prepended to the arguments it receives.
  28536. *
  28537. * This method differs from `_.bind` by allowing bound functions to reference
  28538. * methods that may be redefined or don't yet exist. See
  28539. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  28540. * for more details.
  28541. *
  28542. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  28543. * builds, may be used as a placeholder for partially applied arguments.
  28544. *
  28545. * @static
  28546. * @memberOf _
  28547. * @since 0.10.0
  28548. * @category Function
  28549. * @param {Object} object The object to invoke the method on.
  28550. * @param {string} key The key of the method.
  28551. * @param {...*} [partials] The arguments to be partially applied.
  28552. * @returns {Function} Returns the new bound function.
  28553. * @example
  28554. *
  28555. * var object = {
  28556. * 'user': 'fred',
  28557. * 'greet': function(greeting, punctuation) {
  28558. * return greeting + ' ' + this.user + punctuation;
  28559. * }
  28560. * };
  28561. *
  28562. * var bound = _.bindKey(object, 'greet', 'hi');
  28563. * bound('!');
  28564. * // => 'hi fred!'
  28565. *
  28566. * object.greet = function(greeting, punctuation) {
  28567. * return greeting + 'ya ' + this.user + punctuation;
  28568. * };
  28569. *
  28570. * bound('!');
  28571. * // => 'hiya fred!'
  28572. *
  28573. * // Bound with placeholders.
  28574. * var bound = _.bindKey(object, 'greet', _, '!');
  28575. * bound('hi');
  28576. * // => 'hiya fred!'
  28577. */
  28578. var bindKey = baseRest(function(object, key, partials) {
  28579. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  28580. if (partials.length) {
  28581. var holders = replaceHolders(partials, getHolder(bindKey));
  28582. bitmask |= WRAP_PARTIAL_FLAG;
  28583. }
  28584. return createWrap(key, bitmask, object, partials, holders);
  28585. });
  28586. /**
  28587. * Creates a function that accepts arguments of `func` and either invokes
  28588. * `func` returning its result, if at least `arity` number of arguments have
  28589. * been provided, or returns a function that accepts the remaining `func`
  28590. * arguments, and so on. The arity of `func` may be specified if `func.length`
  28591. * is not sufficient.
  28592. *
  28593. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  28594. * may be used as a placeholder for provided arguments.
  28595. *
  28596. * **Note:** This method doesn't set the "length" property of curried functions.
  28597. *
  28598. * @static
  28599. * @memberOf _
  28600. * @since 2.0.0
  28601. * @category Function
  28602. * @param {Function} func The function to curry.
  28603. * @param {number} [arity=func.length] The arity of `func`.
  28604. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28605. * @returns {Function} Returns the new curried function.
  28606. * @example
  28607. *
  28608. * var abc = function(a, b, c) {
  28609. * return [a, b, c];
  28610. * };
  28611. *
  28612. * var curried = _.curry(abc);
  28613. *
  28614. * curried(1)(2)(3);
  28615. * // => [1, 2, 3]
  28616. *
  28617. * curried(1, 2)(3);
  28618. * // => [1, 2, 3]
  28619. *
  28620. * curried(1, 2, 3);
  28621. * // => [1, 2, 3]
  28622. *
  28623. * // Curried with placeholders.
  28624. * curried(1)(_, 3)(2);
  28625. * // => [1, 2, 3]
  28626. */
  28627. function curry(func, arity, guard) {
  28628. arity = guard ? undefined : arity;
  28629. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28630. result.placeholder = curry.placeholder;
  28631. return result;
  28632. }
  28633. /**
  28634. * This method is like `_.curry` except that arguments are applied to `func`
  28635. * in the manner of `_.partialRight` instead of `_.partial`.
  28636. *
  28637. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  28638. * builds, may be used as a placeholder for provided arguments.
  28639. *
  28640. * **Note:** This method doesn't set the "length" property of curried functions.
  28641. *
  28642. * @static
  28643. * @memberOf _
  28644. * @since 3.0.0
  28645. * @category Function
  28646. * @param {Function} func The function to curry.
  28647. * @param {number} [arity=func.length] The arity of `func`.
  28648. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  28649. * @returns {Function} Returns the new curried function.
  28650. * @example
  28651. *
  28652. * var abc = function(a, b, c) {
  28653. * return [a, b, c];
  28654. * };
  28655. *
  28656. * var curried = _.curryRight(abc);
  28657. *
  28658. * curried(3)(2)(1);
  28659. * // => [1, 2, 3]
  28660. *
  28661. * curried(2, 3)(1);
  28662. * // => [1, 2, 3]
  28663. *
  28664. * curried(1, 2, 3);
  28665. * // => [1, 2, 3]
  28666. *
  28667. * // Curried with placeholders.
  28668. * curried(3)(1, _)(2);
  28669. * // => [1, 2, 3]
  28670. */
  28671. function curryRight(func, arity, guard) {
  28672. arity = guard ? undefined : arity;
  28673. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  28674. result.placeholder = curryRight.placeholder;
  28675. return result;
  28676. }
  28677. /**
  28678. * Creates a debounced function that delays invoking `func` until after `wait`
  28679. * milliseconds have elapsed since the last time the debounced function was
  28680. * invoked. The debounced function comes with a `cancel` method to cancel
  28681. * delayed `func` invocations and a `flush` method to immediately invoke them.
  28682. * Provide `options` to indicate whether `func` should be invoked on the
  28683. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  28684. * with the last arguments provided to the debounced function. Subsequent
  28685. * calls to the debounced function return the result of the last `func`
  28686. * invocation.
  28687. *
  28688. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28689. * invoked on the trailing edge of the timeout only if the debounced function
  28690. * is invoked more than once during the `wait` timeout.
  28691. *
  28692. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28693. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28694. *
  28695. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28696. * for details over the differences between `_.debounce` and `_.throttle`.
  28697. *
  28698. * @static
  28699. * @memberOf _
  28700. * @since 0.1.0
  28701. * @category Function
  28702. * @param {Function} func The function to debounce.
  28703. * @param {number} [wait=0] The number of milliseconds to delay.
  28704. * @param {Object} [options={}] The options object.
  28705. * @param {boolean} [options.leading=false]
  28706. * Specify invoking on the leading edge of the timeout.
  28707. * @param {number} [options.maxWait]
  28708. * The maximum time `func` is allowed to be delayed before it's invoked.
  28709. * @param {boolean} [options.trailing=true]
  28710. * Specify invoking on the trailing edge of the timeout.
  28711. * @returns {Function} Returns the new debounced function.
  28712. * @example
  28713. *
  28714. * // Avoid costly calculations while the window size is in flux.
  28715. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  28716. *
  28717. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  28718. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  28719. * 'leading': true,
  28720. * 'trailing': false
  28721. * }));
  28722. *
  28723. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  28724. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  28725. * var source = new EventSource('/stream');
  28726. * jQuery(source).on('message', debounced);
  28727. *
  28728. * // Cancel the trailing debounced invocation.
  28729. * jQuery(window).on('popstate', debounced.cancel);
  28730. */
  28731. function debounce(func, wait, options) {
  28732. var lastArgs,
  28733. lastThis,
  28734. maxWait,
  28735. result,
  28736. timerId,
  28737. lastCallTime,
  28738. lastInvokeTime = 0,
  28739. leading = false,
  28740. maxing = false,
  28741. trailing = true;
  28742. if (typeof func != 'function') {
  28743. throw new TypeError(FUNC_ERROR_TEXT);
  28744. }
  28745. wait = toNumber(wait) || 0;
  28746. if (isObject(options)) {
  28747. leading = !!options.leading;
  28748. maxing = 'maxWait' in options;
  28749. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  28750. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28751. }
  28752. function invokeFunc(time) {
  28753. var args = lastArgs,
  28754. thisArg = lastThis;
  28755. lastArgs = lastThis = undefined;
  28756. lastInvokeTime = time;
  28757. result = func.apply(thisArg, args);
  28758. return result;
  28759. }
  28760. function leadingEdge(time) {
  28761. // Reset any `maxWait` timer.
  28762. lastInvokeTime = time;
  28763. // Start the timer for the trailing edge.
  28764. timerId = setTimeout(timerExpired, wait);
  28765. // Invoke the leading edge.
  28766. return leading ? invokeFunc(time) : result;
  28767. }
  28768. function remainingWait(time) {
  28769. var timeSinceLastCall = time - lastCallTime,
  28770. timeSinceLastInvoke = time - lastInvokeTime,
  28771. timeWaiting = wait - timeSinceLastCall;
  28772. return maxing
  28773. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  28774. : timeWaiting;
  28775. }
  28776. function shouldInvoke(time) {
  28777. var timeSinceLastCall = time - lastCallTime,
  28778. timeSinceLastInvoke = time - lastInvokeTime;
  28779. // Either this is the first call, activity has stopped and we're at the
  28780. // trailing edge, the system time has gone backwards and we're treating
  28781. // it as the trailing edge, or we've hit the `maxWait` limit.
  28782. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28783. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28784. }
  28785. function timerExpired() {
  28786. var time = now();
  28787. if (shouldInvoke(time)) {
  28788. return trailingEdge(time);
  28789. }
  28790. // Restart the timer.
  28791. timerId = setTimeout(timerExpired, remainingWait(time));
  28792. }
  28793. function trailingEdge(time) {
  28794. timerId = undefined;
  28795. // Only invoke if we have `lastArgs` which means `func` has been
  28796. // debounced at least once.
  28797. if (trailing && lastArgs) {
  28798. return invokeFunc(time);
  28799. }
  28800. lastArgs = lastThis = undefined;
  28801. return result;
  28802. }
  28803. function cancel() {
  28804. if (timerId !== undefined) {
  28805. clearTimeout(timerId);
  28806. }
  28807. lastInvokeTime = 0;
  28808. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28809. }
  28810. function flush() {
  28811. return timerId === undefined ? result : trailingEdge(now());
  28812. }
  28813. function debounced() {
  28814. var time = now(),
  28815. isInvoking = shouldInvoke(time);
  28816. lastArgs = arguments;
  28817. lastThis = this;
  28818. lastCallTime = time;
  28819. if (isInvoking) {
  28820. if (timerId === undefined) {
  28821. return leadingEdge(lastCallTime);
  28822. }
  28823. if (maxing) {
  28824. // Handle invocations in a tight loop.
  28825. clearTimeout(timerId);
  28826. timerId = setTimeout(timerExpired, wait);
  28827. return invokeFunc(lastCallTime);
  28828. }
  28829. }
  28830. if (timerId === undefined) {
  28831. timerId = setTimeout(timerExpired, wait);
  28832. }
  28833. return result;
  28834. }
  28835. debounced.cancel = cancel;
  28836. debounced.flush = flush;
  28837. return debounced;
  28838. }
  28839. /**
  28840. * Defers invoking the `func` until the current call stack has cleared. Any
  28841. * additional arguments are provided to `func` when it's invoked.
  28842. *
  28843. * @static
  28844. * @memberOf _
  28845. * @since 0.1.0
  28846. * @category Function
  28847. * @param {Function} func The function to defer.
  28848. * @param {...*} [args] The arguments to invoke `func` with.
  28849. * @returns {number} Returns the timer id.
  28850. * @example
  28851. *
  28852. * _.defer(function(text) {
  28853. * console.log(text);
  28854. * }, 'deferred');
  28855. * // => Logs 'deferred' after one millisecond.
  28856. */
  28857. var defer = baseRest(function(func, args) {
  28858. return baseDelay(func, 1, args);
  28859. });
  28860. /**
  28861. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28862. * provided to `func` when it's invoked.
  28863. *
  28864. * @static
  28865. * @memberOf _
  28866. * @since 0.1.0
  28867. * @category Function
  28868. * @param {Function} func The function to delay.
  28869. * @param {number} wait The number of milliseconds to delay invocation.
  28870. * @param {...*} [args] The arguments to invoke `func` with.
  28871. * @returns {number} Returns the timer id.
  28872. * @example
  28873. *
  28874. * _.delay(function(text) {
  28875. * console.log(text);
  28876. * }, 1000, 'later');
  28877. * // => Logs 'later' after one second.
  28878. */
  28879. var delay = baseRest(function(func, wait, args) {
  28880. return baseDelay(func, toNumber(wait) || 0, args);
  28881. });
  28882. /**
  28883. * Creates a function that invokes `func` with arguments reversed.
  28884. *
  28885. * @static
  28886. * @memberOf _
  28887. * @since 4.0.0
  28888. * @category Function
  28889. * @param {Function} func The function to flip arguments for.
  28890. * @returns {Function} Returns the new flipped function.
  28891. * @example
  28892. *
  28893. * var flipped = _.flip(function() {
  28894. * return _.toArray(arguments);
  28895. * });
  28896. *
  28897. * flipped('a', 'b', 'c', 'd');
  28898. * // => ['d', 'c', 'b', 'a']
  28899. */
  28900. function flip(func) {
  28901. return createWrap(func, WRAP_FLIP_FLAG);
  28902. }
  28903. /**
  28904. * Creates a function that memoizes the result of `func`. If `resolver` is
  28905. * provided, it determines the cache key for storing the result based on the
  28906. * arguments provided to the memoized function. By default, the first argument
  28907. * provided to the memoized function is used as the map cache key. The `func`
  28908. * is invoked with the `this` binding of the memoized function.
  28909. *
  28910. * **Note:** The cache is exposed as the `cache` property on the memoized
  28911. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28912. * constructor with one whose instances implement the
  28913. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28914. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28915. *
  28916. * @static
  28917. * @memberOf _
  28918. * @since 0.1.0
  28919. * @category Function
  28920. * @param {Function} func The function to have its output memoized.
  28921. * @param {Function} [resolver] The function to resolve the cache key.
  28922. * @returns {Function} Returns the new memoized function.
  28923. * @example
  28924. *
  28925. * var object = { 'a': 1, 'b': 2 };
  28926. * var other = { 'c': 3, 'd': 4 };
  28927. *
  28928. * var values = _.memoize(_.values);
  28929. * values(object);
  28930. * // => [1, 2]
  28931. *
  28932. * values(other);
  28933. * // => [3, 4]
  28934. *
  28935. * object.a = 2;
  28936. * values(object);
  28937. * // => [1, 2]
  28938. *
  28939. * // Modify the result cache.
  28940. * values.cache.set(object, ['a', 'b']);
  28941. * values(object);
  28942. * // => ['a', 'b']
  28943. *
  28944. * // Replace `_.memoize.Cache`.
  28945. * _.memoize.Cache = WeakMap;
  28946. */
  28947. function memoize(func, resolver) {
  28948. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28949. throw new TypeError(FUNC_ERROR_TEXT);
  28950. }
  28951. var memoized = function() {
  28952. var args = arguments,
  28953. key = resolver ? resolver.apply(this, args) : args[0],
  28954. cache = memoized.cache;
  28955. if (cache.has(key)) {
  28956. return cache.get(key);
  28957. }
  28958. var result = func.apply(this, args);
  28959. memoized.cache = cache.set(key, result) || cache;
  28960. return result;
  28961. };
  28962. memoized.cache = new (memoize.Cache || MapCache);
  28963. return memoized;
  28964. }
  28965. // Expose `MapCache`.
  28966. memoize.Cache = MapCache;
  28967. /**
  28968. * Creates a function that negates the result of the predicate `func`. The
  28969. * `func` predicate is invoked with the `this` binding and arguments of the
  28970. * created function.
  28971. *
  28972. * @static
  28973. * @memberOf _
  28974. * @since 3.0.0
  28975. * @category Function
  28976. * @param {Function} predicate The predicate to negate.
  28977. * @returns {Function} Returns the new negated function.
  28978. * @example
  28979. *
  28980. * function isEven(n) {
  28981. * return n % 2 == 0;
  28982. * }
  28983. *
  28984. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28985. * // => [1, 3, 5]
  28986. */
  28987. function negate(predicate) {
  28988. if (typeof predicate != 'function') {
  28989. throw new TypeError(FUNC_ERROR_TEXT);
  28990. }
  28991. return function() {
  28992. var args = arguments;
  28993. switch (args.length) {
  28994. case 0: return !predicate.call(this);
  28995. case 1: return !predicate.call(this, args[0]);
  28996. case 2: return !predicate.call(this, args[0], args[1]);
  28997. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28998. }
  28999. return !predicate.apply(this, args);
  29000. };
  29001. }
  29002. /**
  29003. * Creates a function that is restricted to invoking `func` once. Repeat calls
  29004. * to the function return the value of the first invocation. The `func` is
  29005. * invoked with the `this` binding and arguments of the created function.
  29006. *
  29007. * @static
  29008. * @memberOf _
  29009. * @since 0.1.0
  29010. * @category Function
  29011. * @param {Function} func The function to restrict.
  29012. * @returns {Function} Returns the new restricted function.
  29013. * @example
  29014. *
  29015. * var initialize = _.once(createApplication);
  29016. * initialize();
  29017. * initialize();
  29018. * // => `createApplication` is invoked once
  29019. */
  29020. function once(func) {
  29021. return before(2, func);
  29022. }
  29023. /**
  29024. * Creates a function that invokes `func` with its arguments transformed.
  29025. *
  29026. * @static
  29027. * @since 4.0.0
  29028. * @memberOf _
  29029. * @category Function
  29030. * @param {Function} func The function to wrap.
  29031. * @param {...(Function|Function[])} [transforms=[_.identity]]
  29032. * The argument transforms.
  29033. * @returns {Function} Returns the new function.
  29034. * @example
  29035. *
  29036. * function doubled(n) {
  29037. * return n * 2;
  29038. * }
  29039. *
  29040. * function square(n) {
  29041. * return n * n;
  29042. * }
  29043. *
  29044. * var func = _.overArgs(function(x, y) {
  29045. * return [x, y];
  29046. * }, [square, doubled]);
  29047. *
  29048. * func(9, 3);
  29049. * // => [81, 6]
  29050. *
  29051. * func(10, 5);
  29052. * // => [100, 10]
  29053. */
  29054. var overArgs = castRest(function(func, transforms) {
  29055. transforms = (transforms.length == 1 && isArray(transforms[0]))
  29056. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  29057. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  29058. var funcsLength = transforms.length;
  29059. return baseRest(function(args) {
  29060. var index = -1,
  29061. length = nativeMin(args.length, funcsLength);
  29062. while (++index < length) {
  29063. args[index] = transforms[index].call(this, args[index]);
  29064. }
  29065. return apply(func, this, args);
  29066. });
  29067. });
  29068. /**
  29069. * Creates a function that invokes `func` with `partials` prepended to the
  29070. * arguments it receives. This method is like `_.bind` except it does **not**
  29071. * alter the `this` binding.
  29072. *
  29073. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  29074. * builds, may be used as a placeholder for partially applied arguments.
  29075. *
  29076. * **Note:** This method doesn't set the "length" property of partially
  29077. * applied functions.
  29078. *
  29079. * @static
  29080. * @memberOf _
  29081. * @since 0.2.0
  29082. * @category Function
  29083. * @param {Function} func The function to partially apply arguments to.
  29084. * @param {...*} [partials] The arguments to be partially applied.
  29085. * @returns {Function} Returns the new partially applied function.
  29086. * @example
  29087. *
  29088. * function greet(greeting, name) {
  29089. * return greeting + ' ' + name;
  29090. * }
  29091. *
  29092. * var sayHelloTo = _.partial(greet, 'hello');
  29093. * sayHelloTo('fred');
  29094. * // => 'hello fred'
  29095. *
  29096. * // Partially applied with placeholders.
  29097. * var greetFred = _.partial(greet, _, 'fred');
  29098. * greetFred('hi');
  29099. * // => 'hi fred'
  29100. */
  29101. var partial = baseRest(function(func, partials) {
  29102. var holders = replaceHolders(partials, getHolder(partial));
  29103. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  29104. });
  29105. /**
  29106. * This method is like `_.partial` except that partially applied arguments
  29107. * are appended to the arguments it receives.
  29108. *
  29109. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  29110. * builds, may be used as a placeholder for partially applied arguments.
  29111. *
  29112. * **Note:** This method doesn't set the "length" property of partially
  29113. * applied functions.
  29114. *
  29115. * @static
  29116. * @memberOf _
  29117. * @since 1.0.0
  29118. * @category Function
  29119. * @param {Function} func The function to partially apply arguments to.
  29120. * @param {...*} [partials] The arguments to be partially applied.
  29121. * @returns {Function} Returns the new partially applied function.
  29122. * @example
  29123. *
  29124. * function greet(greeting, name) {
  29125. * return greeting + ' ' + name;
  29126. * }
  29127. *
  29128. * var greetFred = _.partialRight(greet, 'fred');
  29129. * greetFred('hi');
  29130. * // => 'hi fred'
  29131. *
  29132. * // Partially applied with placeholders.
  29133. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  29134. * sayHelloTo('fred');
  29135. * // => 'hello fred'
  29136. */
  29137. var partialRight = baseRest(function(func, partials) {
  29138. var holders = replaceHolders(partials, getHolder(partialRight));
  29139. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  29140. });
  29141. /**
  29142. * Creates a function that invokes `func` with arguments arranged according
  29143. * to the specified `indexes` where the argument value at the first index is
  29144. * provided as the first argument, the argument value at the second index is
  29145. * provided as the second argument, and so on.
  29146. *
  29147. * @static
  29148. * @memberOf _
  29149. * @since 3.0.0
  29150. * @category Function
  29151. * @param {Function} func The function to rearrange arguments for.
  29152. * @param {...(number|number[])} indexes The arranged argument indexes.
  29153. * @returns {Function} Returns the new function.
  29154. * @example
  29155. *
  29156. * var rearged = _.rearg(function(a, b, c) {
  29157. * return [a, b, c];
  29158. * }, [2, 0, 1]);
  29159. *
  29160. * rearged('b', 'c', 'a')
  29161. * // => ['a', 'b', 'c']
  29162. */
  29163. var rearg = flatRest(function(func, indexes) {
  29164. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  29165. });
  29166. /**
  29167. * Creates a function that invokes `func` with the `this` binding of the
  29168. * created function and arguments from `start` and beyond provided as
  29169. * an array.
  29170. *
  29171. * **Note:** This method is based on the
  29172. * [rest parameter](https://mdn.io/rest_parameters).
  29173. *
  29174. * @static
  29175. * @memberOf _
  29176. * @since 4.0.0
  29177. * @category Function
  29178. * @param {Function} func The function to apply a rest parameter to.
  29179. * @param {number} [start=func.length-1] The start position of the rest parameter.
  29180. * @returns {Function} Returns the new function.
  29181. * @example
  29182. *
  29183. * var say = _.rest(function(what, names) {
  29184. * return what + ' ' + _.initial(names).join(', ') +
  29185. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  29186. * });
  29187. *
  29188. * say('hello', 'fred', 'barney', 'pebbles');
  29189. * // => 'hello fred, barney, & pebbles'
  29190. */
  29191. function rest(func, start) {
  29192. if (typeof func != 'function') {
  29193. throw new TypeError(FUNC_ERROR_TEXT);
  29194. }
  29195. start = start === undefined ? start : toInteger(start);
  29196. return baseRest(func, start);
  29197. }
  29198. /**
  29199. * Creates a function that invokes `func` with the `this` binding of the
  29200. * create function and an array of arguments much like
  29201. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  29202. *
  29203. * **Note:** This method is based on the
  29204. * [spread operator](https://mdn.io/spread_operator).
  29205. *
  29206. * @static
  29207. * @memberOf _
  29208. * @since 3.2.0
  29209. * @category Function
  29210. * @param {Function} func The function to spread arguments over.
  29211. * @param {number} [start=0] The start position of the spread.
  29212. * @returns {Function} Returns the new function.
  29213. * @example
  29214. *
  29215. * var say = _.spread(function(who, what) {
  29216. * return who + ' says ' + what;
  29217. * });
  29218. *
  29219. * say(['fred', 'hello']);
  29220. * // => 'fred says hello'
  29221. *
  29222. * var numbers = Promise.all([
  29223. * Promise.resolve(40),
  29224. * Promise.resolve(36)
  29225. * ]);
  29226. *
  29227. * numbers.then(_.spread(function(x, y) {
  29228. * return x + y;
  29229. * }));
  29230. * // => a Promise of 76
  29231. */
  29232. function spread(func, start) {
  29233. if (typeof func != 'function') {
  29234. throw new TypeError(FUNC_ERROR_TEXT);
  29235. }
  29236. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  29237. return baseRest(function(args) {
  29238. var array = args[start],
  29239. otherArgs = castSlice(args, 0, start);
  29240. if (array) {
  29241. arrayPush(otherArgs, array);
  29242. }
  29243. return apply(func, this, otherArgs);
  29244. });
  29245. }
  29246. /**
  29247. * Creates a throttled function that only invokes `func` at most once per
  29248. * every `wait` milliseconds. The throttled function comes with a `cancel`
  29249. * method to cancel delayed `func` invocations and a `flush` method to
  29250. * immediately invoke them. Provide `options` to indicate whether `func`
  29251. * should be invoked on the leading and/or trailing edge of the `wait`
  29252. * timeout. The `func` is invoked with the last arguments provided to the
  29253. * throttled function. Subsequent calls to the throttled function return the
  29254. * result of the last `func` invocation.
  29255. *
  29256. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  29257. * invoked on the trailing edge of the timeout only if the throttled function
  29258. * is invoked more than once during the `wait` timeout.
  29259. *
  29260. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  29261. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  29262. *
  29263. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  29264. * for details over the differences between `_.throttle` and `_.debounce`.
  29265. *
  29266. * @static
  29267. * @memberOf _
  29268. * @since 0.1.0
  29269. * @category Function
  29270. * @param {Function} func The function to throttle.
  29271. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  29272. * @param {Object} [options={}] The options object.
  29273. * @param {boolean} [options.leading=true]
  29274. * Specify invoking on the leading edge of the timeout.
  29275. * @param {boolean} [options.trailing=true]
  29276. * Specify invoking on the trailing edge of the timeout.
  29277. * @returns {Function} Returns the new throttled function.
  29278. * @example
  29279. *
  29280. * // Avoid excessively updating the position while scrolling.
  29281. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  29282. *
  29283. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  29284. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  29285. * jQuery(element).on('click', throttled);
  29286. *
  29287. * // Cancel the trailing throttled invocation.
  29288. * jQuery(window).on('popstate', throttled.cancel);
  29289. */
  29290. function throttle(func, wait, options) {
  29291. var leading = true,
  29292. trailing = true;
  29293. if (typeof func != 'function') {
  29294. throw new TypeError(FUNC_ERROR_TEXT);
  29295. }
  29296. if (isObject(options)) {
  29297. leading = 'leading' in options ? !!options.leading : leading;
  29298. trailing = 'trailing' in options ? !!options.trailing : trailing;
  29299. }
  29300. return debounce(func, wait, {
  29301. 'leading': leading,
  29302. 'maxWait': wait,
  29303. 'trailing': trailing
  29304. });
  29305. }
  29306. /**
  29307. * Creates a function that accepts up to one argument, ignoring any
  29308. * additional arguments.
  29309. *
  29310. * @static
  29311. * @memberOf _
  29312. * @since 4.0.0
  29313. * @category Function
  29314. * @param {Function} func The function to cap arguments for.
  29315. * @returns {Function} Returns the new capped function.
  29316. * @example
  29317. *
  29318. * _.map(['6', '8', '10'], _.unary(parseInt));
  29319. * // => [6, 8, 10]
  29320. */
  29321. function unary(func) {
  29322. return ary(func, 1);
  29323. }
  29324. /**
  29325. * Creates a function that provides `value` to `wrapper` as its first
  29326. * argument. Any additional arguments provided to the function are appended
  29327. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  29328. * binding of the created function.
  29329. *
  29330. * @static
  29331. * @memberOf _
  29332. * @since 0.1.0
  29333. * @category Function
  29334. * @param {*} value The value to wrap.
  29335. * @param {Function} [wrapper=identity] The wrapper function.
  29336. * @returns {Function} Returns the new function.
  29337. * @example
  29338. *
  29339. * var p = _.wrap(_.escape, function(func, text) {
  29340. * return '<p>' + func(text) + '</p>';
  29341. * });
  29342. *
  29343. * p('fred, barney, & pebbles');
  29344. * // => '<p>fred, barney, &amp; pebbles</p>'
  29345. */
  29346. function wrap(value, wrapper) {
  29347. return partial(castFunction(wrapper), value);
  29348. }
  29349. /*------------------------------------------------------------------------*/
  29350. /**
  29351. * Casts `value` as an array if it's not one.
  29352. *
  29353. * @static
  29354. * @memberOf _
  29355. * @since 4.4.0
  29356. * @category Lang
  29357. * @param {*} value The value to inspect.
  29358. * @returns {Array} Returns the cast array.
  29359. * @example
  29360. *
  29361. * _.castArray(1);
  29362. * // => [1]
  29363. *
  29364. * _.castArray({ 'a': 1 });
  29365. * // => [{ 'a': 1 }]
  29366. *
  29367. * _.castArray('abc');
  29368. * // => ['abc']
  29369. *
  29370. * _.castArray(null);
  29371. * // => [null]
  29372. *
  29373. * _.castArray(undefined);
  29374. * // => [undefined]
  29375. *
  29376. * _.castArray();
  29377. * // => []
  29378. *
  29379. * var array = [1, 2, 3];
  29380. * console.log(_.castArray(array) === array);
  29381. * // => true
  29382. */
  29383. function castArray() {
  29384. if (!arguments.length) {
  29385. return [];
  29386. }
  29387. var value = arguments[0];
  29388. return isArray(value) ? value : [value];
  29389. }
  29390. /**
  29391. * Creates a shallow clone of `value`.
  29392. *
  29393. * **Note:** This method is loosely based on the
  29394. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  29395. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  29396. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  29397. * arrays. The own enumerable properties of `arguments` objects are cloned
  29398. * as plain objects. An empty object is returned for uncloneable values such
  29399. * as error objects, functions, DOM nodes, and WeakMaps.
  29400. *
  29401. * @static
  29402. * @memberOf _
  29403. * @since 0.1.0
  29404. * @category Lang
  29405. * @param {*} value The value to clone.
  29406. * @returns {*} Returns the cloned value.
  29407. * @see _.cloneDeep
  29408. * @example
  29409. *
  29410. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  29411. *
  29412. * var shallow = _.clone(objects);
  29413. * console.log(shallow[0] === objects[0]);
  29414. * // => true
  29415. */
  29416. function clone(value) {
  29417. return baseClone(value, CLONE_SYMBOLS_FLAG);
  29418. }
  29419. /**
  29420. * This method is like `_.clone` except that it accepts `customizer` which
  29421. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  29422. * cloning is handled by the method instead. The `customizer` is invoked with
  29423. * up to four arguments; (value [, index|key, object, stack]).
  29424. *
  29425. * @static
  29426. * @memberOf _
  29427. * @since 4.0.0
  29428. * @category Lang
  29429. * @param {*} value The value to clone.
  29430. * @param {Function} [customizer] The function to customize cloning.
  29431. * @returns {*} Returns the cloned value.
  29432. * @see _.cloneDeepWith
  29433. * @example
  29434. *
  29435. * function customizer(value) {
  29436. * if (_.isElement(value)) {
  29437. * return value.cloneNode(false);
  29438. * }
  29439. * }
  29440. *
  29441. * var el = _.cloneWith(document.body, customizer);
  29442. *
  29443. * console.log(el === document.body);
  29444. * // => false
  29445. * console.log(el.nodeName);
  29446. * // => 'BODY'
  29447. * console.log(el.childNodes.length);
  29448. * // => 0
  29449. */
  29450. function cloneWith(value, customizer) {
  29451. customizer = typeof customizer == 'function' ? customizer : undefined;
  29452. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  29453. }
  29454. /**
  29455. * This method is like `_.clone` except that it recursively clones `value`.
  29456. *
  29457. * @static
  29458. * @memberOf _
  29459. * @since 1.0.0
  29460. * @category Lang
  29461. * @param {*} value The value to recursively clone.
  29462. * @returns {*} Returns the deep cloned value.
  29463. * @see _.clone
  29464. * @example
  29465. *
  29466. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  29467. *
  29468. * var deep = _.cloneDeep(objects);
  29469. * console.log(deep[0] === objects[0]);
  29470. * // => false
  29471. */
  29472. function cloneDeep(value) {
  29473. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  29474. }
  29475. /**
  29476. * This method is like `_.cloneWith` except that it recursively clones `value`.
  29477. *
  29478. * @static
  29479. * @memberOf _
  29480. * @since 4.0.0
  29481. * @category Lang
  29482. * @param {*} value The value to recursively clone.
  29483. * @param {Function} [customizer] The function to customize cloning.
  29484. * @returns {*} Returns the deep cloned value.
  29485. * @see _.cloneWith
  29486. * @example
  29487. *
  29488. * function customizer(value) {
  29489. * if (_.isElement(value)) {
  29490. * return value.cloneNode(true);
  29491. * }
  29492. * }
  29493. *
  29494. * var el = _.cloneDeepWith(document.body, customizer);
  29495. *
  29496. * console.log(el === document.body);
  29497. * // => false
  29498. * console.log(el.nodeName);
  29499. * // => 'BODY'
  29500. * console.log(el.childNodes.length);
  29501. * // => 20
  29502. */
  29503. function cloneDeepWith(value, customizer) {
  29504. customizer = typeof customizer == 'function' ? customizer : undefined;
  29505. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  29506. }
  29507. /**
  29508. * Checks if `object` conforms to `source` by invoking the predicate
  29509. * properties of `source` with the corresponding property values of `object`.
  29510. *
  29511. * **Note:** This method is equivalent to `_.conforms` when `source` is
  29512. * partially applied.
  29513. *
  29514. * @static
  29515. * @memberOf _
  29516. * @since 4.14.0
  29517. * @category Lang
  29518. * @param {Object} object The object to inspect.
  29519. * @param {Object} source The object of property predicates to conform to.
  29520. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  29521. * @example
  29522. *
  29523. * var object = { 'a': 1, 'b': 2 };
  29524. *
  29525. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  29526. * // => true
  29527. *
  29528. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  29529. * // => false
  29530. */
  29531. function conformsTo(object, source) {
  29532. return source == null || baseConformsTo(object, source, keys(source));
  29533. }
  29534. /**
  29535. * Performs a
  29536. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  29537. * comparison between two values to determine if they are equivalent.
  29538. *
  29539. * @static
  29540. * @memberOf _
  29541. * @since 4.0.0
  29542. * @category Lang
  29543. * @param {*} value The value to compare.
  29544. * @param {*} other The other value to compare.
  29545. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29546. * @example
  29547. *
  29548. * var object = { 'a': 1 };
  29549. * var other = { 'a': 1 };
  29550. *
  29551. * _.eq(object, object);
  29552. * // => true
  29553. *
  29554. * _.eq(object, other);
  29555. * // => false
  29556. *
  29557. * _.eq('a', 'a');
  29558. * // => true
  29559. *
  29560. * _.eq('a', Object('a'));
  29561. * // => false
  29562. *
  29563. * _.eq(NaN, NaN);
  29564. * // => true
  29565. */
  29566. function eq(value, other) {
  29567. return value === other || (value !== value && other !== other);
  29568. }
  29569. /**
  29570. * Checks if `value` is greater than `other`.
  29571. *
  29572. * @static
  29573. * @memberOf _
  29574. * @since 3.9.0
  29575. * @category Lang
  29576. * @param {*} value The value to compare.
  29577. * @param {*} other The other value to compare.
  29578. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  29579. * else `false`.
  29580. * @see _.lt
  29581. * @example
  29582. *
  29583. * _.gt(3, 1);
  29584. * // => true
  29585. *
  29586. * _.gt(3, 3);
  29587. * // => false
  29588. *
  29589. * _.gt(1, 3);
  29590. * // => false
  29591. */
  29592. var gt = createRelationalOperation(baseGt);
  29593. /**
  29594. * Checks if `value` is greater than or equal to `other`.
  29595. *
  29596. * @static
  29597. * @memberOf _
  29598. * @since 3.9.0
  29599. * @category Lang
  29600. * @param {*} value The value to compare.
  29601. * @param {*} other The other value to compare.
  29602. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  29603. * `other`, else `false`.
  29604. * @see _.lte
  29605. * @example
  29606. *
  29607. * _.gte(3, 1);
  29608. * // => true
  29609. *
  29610. * _.gte(3, 3);
  29611. * // => true
  29612. *
  29613. * _.gte(1, 3);
  29614. * // => false
  29615. */
  29616. var gte = createRelationalOperation(function(value, other) {
  29617. return value >= other;
  29618. });
  29619. /**
  29620. * Checks if `value` is likely an `arguments` object.
  29621. *
  29622. * @static
  29623. * @memberOf _
  29624. * @since 0.1.0
  29625. * @category Lang
  29626. * @param {*} value The value to check.
  29627. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  29628. * else `false`.
  29629. * @example
  29630. *
  29631. * _.isArguments(function() { return arguments; }());
  29632. * // => true
  29633. *
  29634. * _.isArguments([1, 2, 3]);
  29635. * // => false
  29636. */
  29637. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  29638. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  29639. !propertyIsEnumerable.call(value, 'callee');
  29640. };
  29641. /**
  29642. * Checks if `value` is classified as an `Array` object.
  29643. *
  29644. * @static
  29645. * @memberOf _
  29646. * @since 0.1.0
  29647. * @category Lang
  29648. * @param {*} value The value to check.
  29649. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  29650. * @example
  29651. *
  29652. * _.isArray([1, 2, 3]);
  29653. * // => true
  29654. *
  29655. * _.isArray(document.body.children);
  29656. * // => false
  29657. *
  29658. * _.isArray('abc');
  29659. * // => false
  29660. *
  29661. * _.isArray(_.noop);
  29662. * // => false
  29663. */
  29664. var isArray = Array.isArray;
  29665. /**
  29666. * Checks if `value` is classified as an `ArrayBuffer` object.
  29667. *
  29668. * @static
  29669. * @memberOf _
  29670. * @since 4.3.0
  29671. * @category Lang
  29672. * @param {*} value The value to check.
  29673. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  29674. * @example
  29675. *
  29676. * _.isArrayBuffer(new ArrayBuffer(2));
  29677. * // => true
  29678. *
  29679. * _.isArrayBuffer(new Array(2));
  29680. * // => false
  29681. */
  29682. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  29683. /**
  29684. * Checks if `value` is array-like. A value is considered array-like if it's
  29685. * not a function and has a `value.length` that's an integer greater than or
  29686. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  29687. *
  29688. * @static
  29689. * @memberOf _
  29690. * @since 4.0.0
  29691. * @category Lang
  29692. * @param {*} value The value to check.
  29693. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  29694. * @example
  29695. *
  29696. * _.isArrayLike([1, 2, 3]);
  29697. * // => true
  29698. *
  29699. * _.isArrayLike(document.body.children);
  29700. * // => true
  29701. *
  29702. * _.isArrayLike('abc');
  29703. * // => true
  29704. *
  29705. * _.isArrayLike(_.noop);
  29706. * // => false
  29707. */
  29708. function isArrayLike(value) {
  29709. return value != null && isLength(value.length) && !isFunction(value);
  29710. }
  29711. /**
  29712. * This method is like `_.isArrayLike` except that it also checks if `value`
  29713. * is an object.
  29714. *
  29715. * @static
  29716. * @memberOf _
  29717. * @since 4.0.0
  29718. * @category Lang
  29719. * @param {*} value The value to check.
  29720. * @returns {boolean} Returns `true` if `value` is an array-like object,
  29721. * else `false`.
  29722. * @example
  29723. *
  29724. * _.isArrayLikeObject([1, 2, 3]);
  29725. * // => true
  29726. *
  29727. * _.isArrayLikeObject(document.body.children);
  29728. * // => true
  29729. *
  29730. * _.isArrayLikeObject('abc');
  29731. * // => false
  29732. *
  29733. * _.isArrayLikeObject(_.noop);
  29734. * // => false
  29735. */
  29736. function isArrayLikeObject(value) {
  29737. return isObjectLike(value) && isArrayLike(value);
  29738. }
  29739. /**
  29740. * Checks if `value` is classified as a boolean primitive or object.
  29741. *
  29742. * @static
  29743. * @memberOf _
  29744. * @since 0.1.0
  29745. * @category Lang
  29746. * @param {*} value The value to check.
  29747. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  29748. * @example
  29749. *
  29750. * _.isBoolean(false);
  29751. * // => true
  29752. *
  29753. * _.isBoolean(null);
  29754. * // => false
  29755. */
  29756. function isBoolean(value) {
  29757. return value === true || value === false ||
  29758. (isObjectLike(value) && baseGetTag(value) == boolTag);
  29759. }
  29760. /**
  29761. * Checks if `value` is a buffer.
  29762. *
  29763. * @static
  29764. * @memberOf _
  29765. * @since 4.3.0
  29766. * @category Lang
  29767. * @param {*} value The value to check.
  29768. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  29769. * @example
  29770. *
  29771. * _.isBuffer(new Buffer(2));
  29772. * // => true
  29773. *
  29774. * _.isBuffer(new Uint8Array(2));
  29775. * // => false
  29776. */
  29777. var isBuffer = nativeIsBuffer || stubFalse;
  29778. /**
  29779. * Checks if `value` is classified as a `Date` object.
  29780. *
  29781. * @static
  29782. * @memberOf _
  29783. * @since 0.1.0
  29784. * @category Lang
  29785. * @param {*} value The value to check.
  29786. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29787. * @example
  29788. *
  29789. * _.isDate(new Date);
  29790. * // => true
  29791. *
  29792. * _.isDate('Mon April 23 2012');
  29793. * // => false
  29794. */
  29795. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29796. /**
  29797. * Checks if `value` is likely a DOM element.
  29798. *
  29799. * @static
  29800. * @memberOf _
  29801. * @since 0.1.0
  29802. * @category Lang
  29803. * @param {*} value The value to check.
  29804. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29805. * @example
  29806. *
  29807. * _.isElement(document.body);
  29808. * // => true
  29809. *
  29810. * _.isElement('<body>');
  29811. * // => false
  29812. */
  29813. function isElement(value) {
  29814. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29815. }
  29816. /**
  29817. * Checks if `value` is an empty object, collection, map, or set.
  29818. *
  29819. * Objects are considered empty if they have no own enumerable string keyed
  29820. * properties.
  29821. *
  29822. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29823. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29824. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29825. *
  29826. * @static
  29827. * @memberOf _
  29828. * @since 0.1.0
  29829. * @category Lang
  29830. * @param {*} value The value to check.
  29831. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29832. * @example
  29833. *
  29834. * _.isEmpty(null);
  29835. * // => true
  29836. *
  29837. * _.isEmpty(true);
  29838. * // => true
  29839. *
  29840. * _.isEmpty(1);
  29841. * // => true
  29842. *
  29843. * _.isEmpty([1, 2, 3]);
  29844. * // => false
  29845. *
  29846. * _.isEmpty({ 'a': 1 });
  29847. * // => false
  29848. */
  29849. function isEmpty(value) {
  29850. if (value == null) {
  29851. return true;
  29852. }
  29853. if (isArrayLike(value) &&
  29854. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29855. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29856. return !value.length;
  29857. }
  29858. var tag = getTag(value);
  29859. if (tag == mapTag || tag == setTag) {
  29860. return !value.size;
  29861. }
  29862. if (isPrototype(value)) {
  29863. return !baseKeys(value).length;
  29864. }
  29865. for (var key in value) {
  29866. if (hasOwnProperty.call(value, key)) {
  29867. return false;
  29868. }
  29869. }
  29870. return true;
  29871. }
  29872. /**
  29873. * Performs a deep comparison between two values to determine if they are
  29874. * equivalent.
  29875. *
  29876. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29877. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29878. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29879. * by their own, not inherited, enumerable properties. Functions and DOM
  29880. * nodes are compared by strict equality, i.e. `===`.
  29881. *
  29882. * @static
  29883. * @memberOf _
  29884. * @since 0.1.0
  29885. * @category Lang
  29886. * @param {*} value The value to compare.
  29887. * @param {*} other The other value to compare.
  29888. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29889. * @example
  29890. *
  29891. * var object = { 'a': 1 };
  29892. * var other = { 'a': 1 };
  29893. *
  29894. * _.isEqual(object, other);
  29895. * // => true
  29896. *
  29897. * object === other;
  29898. * // => false
  29899. */
  29900. function isEqual(value, other) {
  29901. return baseIsEqual(value, other);
  29902. }
  29903. /**
  29904. * This method is like `_.isEqual` except that it accepts `customizer` which
  29905. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29906. * are handled by the method instead. The `customizer` is invoked with up to
  29907. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29908. *
  29909. * @static
  29910. * @memberOf _
  29911. * @since 4.0.0
  29912. * @category Lang
  29913. * @param {*} value The value to compare.
  29914. * @param {*} other The other value to compare.
  29915. * @param {Function} [customizer] The function to customize comparisons.
  29916. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29917. * @example
  29918. *
  29919. * function isGreeting(value) {
  29920. * return /^h(?:i|ello)$/.test(value);
  29921. * }
  29922. *
  29923. * function customizer(objValue, othValue) {
  29924. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29925. * return true;
  29926. * }
  29927. * }
  29928. *
  29929. * var array = ['hello', 'goodbye'];
  29930. * var other = ['hi', 'goodbye'];
  29931. *
  29932. * _.isEqualWith(array, other, customizer);
  29933. * // => true
  29934. */
  29935. function isEqualWith(value, other, customizer) {
  29936. customizer = typeof customizer == 'function' ? customizer : undefined;
  29937. var result = customizer ? customizer(value, other) : undefined;
  29938. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29939. }
  29940. /**
  29941. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29942. * `SyntaxError`, `TypeError`, or `URIError` object.
  29943. *
  29944. * @static
  29945. * @memberOf _
  29946. * @since 3.0.0
  29947. * @category Lang
  29948. * @param {*} value The value to check.
  29949. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29950. * @example
  29951. *
  29952. * _.isError(new Error);
  29953. * // => true
  29954. *
  29955. * _.isError(Error);
  29956. * // => false
  29957. */
  29958. function isError(value) {
  29959. if (!isObjectLike(value)) {
  29960. return false;
  29961. }
  29962. var tag = baseGetTag(value);
  29963. return tag == errorTag || tag == domExcTag ||
  29964. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29965. }
  29966. /**
  29967. * Checks if `value` is a finite primitive number.
  29968. *
  29969. * **Note:** This method is based on
  29970. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29971. *
  29972. * @static
  29973. * @memberOf _
  29974. * @since 0.1.0
  29975. * @category Lang
  29976. * @param {*} value The value to check.
  29977. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29978. * @example
  29979. *
  29980. * _.isFinite(3);
  29981. * // => true
  29982. *
  29983. * _.isFinite(Number.MIN_VALUE);
  29984. * // => true
  29985. *
  29986. * _.isFinite(Infinity);
  29987. * // => false
  29988. *
  29989. * _.isFinite('3');
  29990. * // => false
  29991. */
  29992. function isFinite(value) {
  29993. return typeof value == 'number' && nativeIsFinite(value);
  29994. }
  29995. /**
  29996. * Checks if `value` is classified as a `Function` object.
  29997. *
  29998. * @static
  29999. * @memberOf _
  30000. * @since 0.1.0
  30001. * @category Lang
  30002. * @param {*} value The value to check.
  30003. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  30004. * @example
  30005. *
  30006. * _.isFunction(_);
  30007. * // => true
  30008. *
  30009. * _.isFunction(/abc/);
  30010. * // => false
  30011. */
  30012. function isFunction(value) {
  30013. if (!isObject(value)) {
  30014. return false;
  30015. }
  30016. // The use of `Object#toString` avoids issues with the `typeof` operator
  30017. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  30018. var tag = baseGetTag(value);
  30019. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  30020. }
  30021. /**
  30022. * Checks if `value` is an integer.
  30023. *
  30024. * **Note:** This method is based on
  30025. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  30026. *
  30027. * @static
  30028. * @memberOf _
  30029. * @since 4.0.0
  30030. * @category Lang
  30031. * @param {*} value The value to check.
  30032. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  30033. * @example
  30034. *
  30035. * _.isInteger(3);
  30036. * // => true
  30037. *
  30038. * _.isInteger(Number.MIN_VALUE);
  30039. * // => false
  30040. *
  30041. * _.isInteger(Infinity);
  30042. * // => false
  30043. *
  30044. * _.isInteger('3');
  30045. * // => false
  30046. */
  30047. function isInteger(value) {
  30048. return typeof value == 'number' && value == toInteger(value);
  30049. }
  30050. /**
  30051. * Checks if `value` is a valid array-like length.
  30052. *
  30053. * **Note:** This method is loosely based on
  30054. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30055. *
  30056. * @static
  30057. * @memberOf _
  30058. * @since 4.0.0
  30059. * @category Lang
  30060. * @param {*} value The value to check.
  30061. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  30062. * @example
  30063. *
  30064. * _.isLength(3);
  30065. * // => true
  30066. *
  30067. * _.isLength(Number.MIN_VALUE);
  30068. * // => false
  30069. *
  30070. * _.isLength(Infinity);
  30071. * // => false
  30072. *
  30073. * _.isLength('3');
  30074. * // => false
  30075. */
  30076. function isLength(value) {
  30077. return typeof value == 'number' &&
  30078. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  30079. }
  30080. /**
  30081. * Checks if `value` is the
  30082. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  30083. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  30084. *
  30085. * @static
  30086. * @memberOf _
  30087. * @since 0.1.0
  30088. * @category Lang
  30089. * @param {*} value The value to check.
  30090. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  30091. * @example
  30092. *
  30093. * _.isObject({});
  30094. * // => true
  30095. *
  30096. * _.isObject([1, 2, 3]);
  30097. * // => true
  30098. *
  30099. * _.isObject(_.noop);
  30100. * // => true
  30101. *
  30102. * _.isObject(null);
  30103. * // => false
  30104. */
  30105. function isObject(value) {
  30106. var type = typeof value;
  30107. return value != null && (type == 'object' || type == 'function');
  30108. }
  30109. /**
  30110. * Checks if `value` is object-like. A value is object-like if it's not `null`
  30111. * and has a `typeof` result of "object".
  30112. *
  30113. * @static
  30114. * @memberOf _
  30115. * @since 4.0.0
  30116. * @category Lang
  30117. * @param {*} value The value to check.
  30118. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  30119. * @example
  30120. *
  30121. * _.isObjectLike({});
  30122. * // => true
  30123. *
  30124. * _.isObjectLike([1, 2, 3]);
  30125. * // => true
  30126. *
  30127. * _.isObjectLike(_.noop);
  30128. * // => false
  30129. *
  30130. * _.isObjectLike(null);
  30131. * // => false
  30132. */
  30133. function isObjectLike(value) {
  30134. return value != null && typeof value == 'object';
  30135. }
  30136. /**
  30137. * Checks if `value` is classified as a `Map` object.
  30138. *
  30139. * @static
  30140. * @memberOf _
  30141. * @since 4.3.0
  30142. * @category Lang
  30143. * @param {*} value The value to check.
  30144. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  30145. * @example
  30146. *
  30147. * _.isMap(new Map);
  30148. * // => true
  30149. *
  30150. * _.isMap(new WeakMap);
  30151. * // => false
  30152. */
  30153. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  30154. /**
  30155. * Performs a partial deep comparison between `object` and `source` to
  30156. * determine if `object` contains equivalent property values.
  30157. *
  30158. * **Note:** This method is equivalent to `_.matches` when `source` is
  30159. * partially applied.
  30160. *
  30161. * Partial comparisons will match empty array and empty object `source`
  30162. * values against any array or object value, respectively. See `_.isEqual`
  30163. * for a list of supported value comparisons.
  30164. *
  30165. * @static
  30166. * @memberOf _
  30167. * @since 3.0.0
  30168. * @category Lang
  30169. * @param {Object} object The object to inspect.
  30170. * @param {Object} source The object of property values to match.
  30171. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  30172. * @example
  30173. *
  30174. * var object = { 'a': 1, 'b': 2 };
  30175. *
  30176. * _.isMatch(object, { 'b': 2 });
  30177. * // => true
  30178. *
  30179. * _.isMatch(object, { 'b': 1 });
  30180. * // => false
  30181. */
  30182. function isMatch(object, source) {
  30183. return object === source || baseIsMatch(object, source, getMatchData(source));
  30184. }
  30185. /**
  30186. * This method is like `_.isMatch` except that it accepts `customizer` which
  30187. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  30188. * are handled by the method instead. The `customizer` is invoked with five
  30189. * arguments: (objValue, srcValue, index|key, object, source).
  30190. *
  30191. * @static
  30192. * @memberOf _
  30193. * @since 4.0.0
  30194. * @category Lang
  30195. * @param {Object} object The object to inspect.
  30196. * @param {Object} source The object of property values to match.
  30197. * @param {Function} [customizer] The function to customize comparisons.
  30198. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  30199. * @example
  30200. *
  30201. * function isGreeting(value) {
  30202. * return /^h(?:i|ello)$/.test(value);
  30203. * }
  30204. *
  30205. * function customizer(objValue, srcValue) {
  30206. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  30207. * return true;
  30208. * }
  30209. * }
  30210. *
  30211. * var object = { 'greeting': 'hello' };
  30212. * var source = { 'greeting': 'hi' };
  30213. *
  30214. * _.isMatchWith(object, source, customizer);
  30215. * // => true
  30216. */
  30217. function isMatchWith(object, source, customizer) {
  30218. customizer = typeof customizer == 'function' ? customizer : undefined;
  30219. return baseIsMatch(object, source, getMatchData(source), customizer);
  30220. }
  30221. /**
  30222. * Checks if `value` is `NaN`.
  30223. *
  30224. * **Note:** This method is based on
  30225. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  30226. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  30227. * `undefined` and other non-number values.
  30228. *
  30229. * @static
  30230. * @memberOf _
  30231. * @since 0.1.0
  30232. * @category Lang
  30233. * @param {*} value The value to check.
  30234. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  30235. * @example
  30236. *
  30237. * _.isNaN(NaN);
  30238. * // => true
  30239. *
  30240. * _.isNaN(new Number(NaN));
  30241. * // => true
  30242. *
  30243. * isNaN(undefined);
  30244. * // => true
  30245. *
  30246. * _.isNaN(undefined);
  30247. * // => false
  30248. */
  30249. function isNaN(value) {
  30250. // An `NaN` primitive is the only value that is not equal to itself.
  30251. // Perform the `toStringTag` check first to avoid errors with some
  30252. // ActiveX objects in IE.
  30253. return isNumber(value) && value != +value;
  30254. }
  30255. /**
  30256. * Checks if `value` is a pristine native function.
  30257. *
  30258. * **Note:** This method can't reliably detect native functions in the presence
  30259. * of the core-js package because core-js circumvents this kind of detection.
  30260. * Despite multiple requests, the core-js maintainer has made it clear: any
  30261. * attempt to fix the detection will be obstructed. As a result, we're left
  30262. * with little choice but to throw an error. Unfortunately, this also affects
  30263. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  30264. * which rely on core-js.
  30265. *
  30266. * @static
  30267. * @memberOf _
  30268. * @since 3.0.0
  30269. * @category Lang
  30270. * @param {*} value The value to check.
  30271. * @returns {boolean} Returns `true` if `value` is a native function,
  30272. * else `false`.
  30273. * @example
  30274. *
  30275. * _.isNative(Array.prototype.push);
  30276. * // => true
  30277. *
  30278. * _.isNative(_);
  30279. * // => false
  30280. */
  30281. function isNative(value) {
  30282. if (isMaskable(value)) {
  30283. throw new Error(CORE_ERROR_TEXT);
  30284. }
  30285. return baseIsNative(value);
  30286. }
  30287. /**
  30288. * Checks if `value` is `null`.
  30289. *
  30290. * @static
  30291. * @memberOf _
  30292. * @since 0.1.0
  30293. * @category Lang
  30294. * @param {*} value The value to check.
  30295. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  30296. * @example
  30297. *
  30298. * _.isNull(null);
  30299. * // => true
  30300. *
  30301. * _.isNull(void 0);
  30302. * // => false
  30303. */
  30304. function isNull(value) {
  30305. return value === null;
  30306. }
  30307. /**
  30308. * Checks if `value` is `null` or `undefined`.
  30309. *
  30310. * @static
  30311. * @memberOf _
  30312. * @since 4.0.0
  30313. * @category Lang
  30314. * @param {*} value The value to check.
  30315. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  30316. * @example
  30317. *
  30318. * _.isNil(null);
  30319. * // => true
  30320. *
  30321. * _.isNil(void 0);
  30322. * // => true
  30323. *
  30324. * _.isNil(NaN);
  30325. * // => false
  30326. */
  30327. function isNil(value) {
  30328. return value == null;
  30329. }
  30330. /**
  30331. * Checks if `value` is classified as a `Number` primitive or object.
  30332. *
  30333. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  30334. * classified as numbers, use the `_.isFinite` method.
  30335. *
  30336. * @static
  30337. * @memberOf _
  30338. * @since 0.1.0
  30339. * @category Lang
  30340. * @param {*} value The value to check.
  30341. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  30342. * @example
  30343. *
  30344. * _.isNumber(3);
  30345. * // => true
  30346. *
  30347. * _.isNumber(Number.MIN_VALUE);
  30348. * // => true
  30349. *
  30350. * _.isNumber(Infinity);
  30351. * // => true
  30352. *
  30353. * _.isNumber('3');
  30354. * // => false
  30355. */
  30356. function isNumber(value) {
  30357. return typeof value == 'number' ||
  30358. (isObjectLike(value) && baseGetTag(value) == numberTag);
  30359. }
  30360. /**
  30361. * Checks if `value` is a plain object, that is, an object created by the
  30362. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  30363. *
  30364. * @static
  30365. * @memberOf _
  30366. * @since 0.8.0
  30367. * @category Lang
  30368. * @param {*} value The value to check.
  30369. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  30370. * @example
  30371. *
  30372. * function Foo() {
  30373. * this.a = 1;
  30374. * }
  30375. *
  30376. * _.isPlainObject(new Foo);
  30377. * // => false
  30378. *
  30379. * _.isPlainObject([1, 2, 3]);
  30380. * // => false
  30381. *
  30382. * _.isPlainObject({ 'x': 0, 'y': 0 });
  30383. * // => true
  30384. *
  30385. * _.isPlainObject(Object.create(null));
  30386. * // => true
  30387. */
  30388. function isPlainObject(value) {
  30389. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  30390. return false;
  30391. }
  30392. var proto = getPrototype(value);
  30393. if (proto === null) {
  30394. return true;
  30395. }
  30396. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  30397. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  30398. funcToString.call(Ctor) == objectCtorString;
  30399. }
  30400. /**
  30401. * Checks if `value` is classified as a `RegExp` object.
  30402. *
  30403. * @static
  30404. * @memberOf _
  30405. * @since 0.1.0
  30406. * @category Lang
  30407. * @param {*} value The value to check.
  30408. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  30409. * @example
  30410. *
  30411. * _.isRegExp(/abc/);
  30412. * // => true
  30413. *
  30414. * _.isRegExp('/abc/');
  30415. * // => false
  30416. */
  30417. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  30418. /**
  30419. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  30420. * double precision number which isn't the result of a rounded unsafe integer.
  30421. *
  30422. * **Note:** This method is based on
  30423. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  30424. *
  30425. * @static
  30426. * @memberOf _
  30427. * @since 4.0.0
  30428. * @category Lang
  30429. * @param {*} value The value to check.
  30430. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  30431. * @example
  30432. *
  30433. * _.isSafeInteger(3);
  30434. * // => true
  30435. *
  30436. * _.isSafeInteger(Number.MIN_VALUE);
  30437. * // => false
  30438. *
  30439. * _.isSafeInteger(Infinity);
  30440. * // => false
  30441. *
  30442. * _.isSafeInteger('3');
  30443. * // => false
  30444. */
  30445. function isSafeInteger(value) {
  30446. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  30447. }
  30448. /**
  30449. * Checks if `value` is classified as a `Set` object.
  30450. *
  30451. * @static
  30452. * @memberOf _
  30453. * @since 4.3.0
  30454. * @category Lang
  30455. * @param {*} value The value to check.
  30456. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  30457. * @example
  30458. *
  30459. * _.isSet(new Set);
  30460. * // => true
  30461. *
  30462. * _.isSet(new WeakSet);
  30463. * // => false
  30464. */
  30465. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  30466. /**
  30467. * Checks if `value` is classified as a `String` primitive or object.
  30468. *
  30469. * @static
  30470. * @since 0.1.0
  30471. * @memberOf _
  30472. * @category Lang
  30473. * @param {*} value The value to check.
  30474. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  30475. * @example
  30476. *
  30477. * _.isString('abc');
  30478. * // => true
  30479. *
  30480. * _.isString(1);
  30481. * // => false
  30482. */
  30483. function isString(value) {
  30484. return typeof value == 'string' ||
  30485. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  30486. }
  30487. /**
  30488. * Checks if `value` is classified as a `Symbol` primitive or object.
  30489. *
  30490. * @static
  30491. * @memberOf _
  30492. * @since 4.0.0
  30493. * @category Lang
  30494. * @param {*} value The value to check.
  30495. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  30496. * @example
  30497. *
  30498. * _.isSymbol(Symbol.iterator);
  30499. * // => true
  30500. *
  30501. * _.isSymbol('abc');
  30502. * // => false
  30503. */
  30504. function isSymbol(value) {
  30505. return typeof value == 'symbol' ||
  30506. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  30507. }
  30508. /**
  30509. * Checks if `value` is classified as a typed array.
  30510. *
  30511. * @static
  30512. * @memberOf _
  30513. * @since 3.0.0
  30514. * @category Lang
  30515. * @param {*} value The value to check.
  30516. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  30517. * @example
  30518. *
  30519. * _.isTypedArray(new Uint8Array);
  30520. * // => true
  30521. *
  30522. * _.isTypedArray([]);
  30523. * // => false
  30524. */
  30525. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  30526. /**
  30527. * Checks if `value` is `undefined`.
  30528. *
  30529. * @static
  30530. * @since 0.1.0
  30531. * @memberOf _
  30532. * @category Lang
  30533. * @param {*} value The value to check.
  30534. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  30535. * @example
  30536. *
  30537. * _.isUndefined(void 0);
  30538. * // => true
  30539. *
  30540. * _.isUndefined(null);
  30541. * // => false
  30542. */
  30543. function isUndefined(value) {
  30544. return value === undefined;
  30545. }
  30546. /**
  30547. * Checks if `value` is classified as a `WeakMap` object.
  30548. *
  30549. * @static
  30550. * @memberOf _
  30551. * @since 4.3.0
  30552. * @category Lang
  30553. * @param {*} value The value to check.
  30554. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  30555. * @example
  30556. *
  30557. * _.isWeakMap(new WeakMap);
  30558. * // => true
  30559. *
  30560. * _.isWeakMap(new Map);
  30561. * // => false
  30562. */
  30563. function isWeakMap(value) {
  30564. return isObjectLike(value) && getTag(value) == weakMapTag;
  30565. }
  30566. /**
  30567. * Checks if `value` is classified as a `WeakSet` object.
  30568. *
  30569. * @static
  30570. * @memberOf _
  30571. * @since 4.3.0
  30572. * @category Lang
  30573. * @param {*} value The value to check.
  30574. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  30575. * @example
  30576. *
  30577. * _.isWeakSet(new WeakSet);
  30578. * // => true
  30579. *
  30580. * _.isWeakSet(new Set);
  30581. * // => false
  30582. */
  30583. function isWeakSet(value) {
  30584. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  30585. }
  30586. /**
  30587. * Checks if `value` is less than `other`.
  30588. *
  30589. * @static
  30590. * @memberOf _
  30591. * @since 3.9.0
  30592. * @category Lang
  30593. * @param {*} value The value to compare.
  30594. * @param {*} other The other value to compare.
  30595. * @returns {boolean} Returns `true` if `value` is less than `other`,
  30596. * else `false`.
  30597. * @see _.gt
  30598. * @example
  30599. *
  30600. * _.lt(1, 3);
  30601. * // => true
  30602. *
  30603. * _.lt(3, 3);
  30604. * // => false
  30605. *
  30606. * _.lt(3, 1);
  30607. * // => false
  30608. */
  30609. var lt = createRelationalOperation(baseLt);
  30610. /**
  30611. * Checks if `value` is less than or equal to `other`.
  30612. *
  30613. * @static
  30614. * @memberOf _
  30615. * @since 3.9.0
  30616. * @category Lang
  30617. * @param {*} value The value to compare.
  30618. * @param {*} other The other value to compare.
  30619. * @returns {boolean} Returns `true` if `value` is less than or equal to
  30620. * `other`, else `false`.
  30621. * @see _.gte
  30622. * @example
  30623. *
  30624. * _.lte(1, 3);
  30625. * // => true
  30626. *
  30627. * _.lte(3, 3);
  30628. * // => true
  30629. *
  30630. * _.lte(3, 1);
  30631. * // => false
  30632. */
  30633. var lte = createRelationalOperation(function(value, other) {
  30634. return value <= other;
  30635. });
  30636. /**
  30637. * Converts `value` to an array.
  30638. *
  30639. * @static
  30640. * @since 0.1.0
  30641. * @memberOf _
  30642. * @category Lang
  30643. * @param {*} value The value to convert.
  30644. * @returns {Array} Returns the converted array.
  30645. * @example
  30646. *
  30647. * _.toArray({ 'a': 1, 'b': 2 });
  30648. * // => [1, 2]
  30649. *
  30650. * _.toArray('abc');
  30651. * // => ['a', 'b', 'c']
  30652. *
  30653. * _.toArray(1);
  30654. * // => []
  30655. *
  30656. * _.toArray(null);
  30657. * // => []
  30658. */
  30659. function toArray(value) {
  30660. if (!value) {
  30661. return [];
  30662. }
  30663. if (isArrayLike(value)) {
  30664. return isString(value) ? stringToArray(value) : copyArray(value);
  30665. }
  30666. if (symIterator && value[symIterator]) {
  30667. return iteratorToArray(value[symIterator]());
  30668. }
  30669. var tag = getTag(value),
  30670. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  30671. return func(value);
  30672. }
  30673. /**
  30674. * Converts `value` to a finite number.
  30675. *
  30676. * @static
  30677. * @memberOf _
  30678. * @since 4.12.0
  30679. * @category Lang
  30680. * @param {*} value The value to convert.
  30681. * @returns {number} Returns the converted number.
  30682. * @example
  30683. *
  30684. * _.toFinite(3.2);
  30685. * // => 3.2
  30686. *
  30687. * _.toFinite(Number.MIN_VALUE);
  30688. * // => 5e-324
  30689. *
  30690. * _.toFinite(Infinity);
  30691. * // => 1.7976931348623157e+308
  30692. *
  30693. * _.toFinite('3.2');
  30694. * // => 3.2
  30695. */
  30696. function toFinite(value) {
  30697. if (!value) {
  30698. return value === 0 ? value : 0;
  30699. }
  30700. value = toNumber(value);
  30701. if (value === INFINITY || value === -INFINITY) {
  30702. var sign = (value < 0 ? -1 : 1);
  30703. return sign * MAX_INTEGER;
  30704. }
  30705. return value === value ? value : 0;
  30706. }
  30707. /**
  30708. * Converts `value` to an integer.
  30709. *
  30710. * **Note:** This method is loosely based on
  30711. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  30712. *
  30713. * @static
  30714. * @memberOf _
  30715. * @since 4.0.0
  30716. * @category Lang
  30717. * @param {*} value The value to convert.
  30718. * @returns {number} Returns the converted integer.
  30719. * @example
  30720. *
  30721. * _.toInteger(3.2);
  30722. * // => 3
  30723. *
  30724. * _.toInteger(Number.MIN_VALUE);
  30725. * // => 0
  30726. *
  30727. * _.toInteger(Infinity);
  30728. * // => 1.7976931348623157e+308
  30729. *
  30730. * _.toInteger('3.2');
  30731. * // => 3
  30732. */
  30733. function toInteger(value) {
  30734. var result = toFinite(value),
  30735. remainder = result % 1;
  30736. return result === result ? (remainder ? result - remainder : result) : 0;
  30737. }
  30738. /**
  30739. * Converts `value` to an integer suitable for use as the length of an
  30740. * array-like object.
  30741. *
  30742. * **Note:** This method is based on
  30743. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  30744. *
  30745. * @static
  30746. * @memberOf _
  30747. * @since 4.0.0
  30748. * @category Lang
  30749. * @param {*} value The value to convert.
  30750. * @returns {number} Returns the converted integer.
  30751. * @example
  30752. *
  30753. * _.toLength(3.2);
  30754. * // => 3
  30755. *
  30756. * _.toLength(Number.MIN_VALUE);
  30757. * // => 0
  30758. *
  30759. * _.toLength(Infinity);
  30760. * // => 4294967295
  30761. *
  30762. * _.toLength('3.2');
  30763. * // => 3
  30764. */
  30765. function toLength(value) {
  30766. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  30767. }
  30768. /**
  30769. * Converts `value` to a number.
  30770. *
  30771. * @static
  30772. * @memberOf _
  30773. * @since 4.0.0
  30774. * @category Lang
  30775. * @param {*} value The value to process.
  30776. * @returns {number} Returns the number.
  30777. * @example
  30778. *
  30779. * _.toNumber(3.2);
  30780. * // => 3.2
  30781. *
  30782. * _.toNumber(Number.MIN_VALUE);
  30783. * // => 5e-324
  30784. *
  30785. * _.toNumber(Infinity);
  30786. * // => Infinity
  30787. *
  30788. * _.toNumber('3.2');
  30789. * // => 3.2
  30790. */
  30791. function toNumber(value) {
  30792. if (typeof value == 'number') {
  30793. return value;
  30794. }
  30795. if (isSymbol(value)) {
  30796. return NAN;
  30797. }
  30798. if (isObject(value)) {
  30799. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30800. value = isObject(other) ? (other + '') : other;
  30801. }
  30802. if (typeof value != 'string') {
  30803. return value === 0 ? value : +value;
  30804. }
  30805. value = value.replace(reTrim, '');
  30806. var isBinary = reIsBinary.test(value);
  30807. return (isBinary || reIsOctal.test(value))
  30808. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30809. : (reIsBadHex.test(value) ? NAN : +value);
  30810. }
  30811. /**
  30812. * Converts `value` to a plain object flattening inherited enumerable string
  30813. * keyed properties of `value` to own properties of the plain object.
  30814. *
  30815. * @static
  30816. * @memberOf _
  30817. * @since 3.0.0
  30818. * @category Lang
  30819. * @param {*} value The value to convert.
  30820. * @returns {Object} Returns the converted plain object.
  30821. * @example
  30822. *
  30823. * function Foo() {
  30824. * this.b = 2;
  30825. * }
  30826. *
  30827. * Foo.prototype.c = 3;
  30828. *
  30829. * _.assign({ 'a': 1 }, new Foo);
  30830. * // => { 'a': 1, 'b': 2 }
  30831. *
  30832. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30833. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30834. */
  30835. function toPlainObject(value) {
  30836. return copyObject(value, keysIn(value));
  30837. }
  30838. /**
  30839. * Converts `value` to a safe integer. A safe integer can be compared and
  30840. * represented correctly.
  30841. *
  30842. * @static
  30843. * @memberOf _
  30844. * @since 4.0.0
  30845. * @category Lang
  30846. * @param {*} value The value to convert.
  30847. * @returns {number} Returns the converted integer.
  30848. * @example
  30849. *
  30850. * _.toSafeInteger(3.2);
  30851. * // => 3
  30852. *
  30853. * _.toSafeInteger(Number.MIN_VALUE);
  30854. * // => 0
  30855. *
  30856. * _.toSafeInteger(Infinity);
  30857. * // => 9007199254740991
  30858. *
  30859. * _.toSafeInteger('3.2');
  30860. * // => 3
  30861. */
  30862. function toSafeInteger(value) {
  30863. return value
  30864. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30865. : (value === 0 ? value : 0);
  30866. }
  30867. /**
  30868. * Converts `value` to a string. An empty string is returned for `null`
  30869. * and `undefined` values. The sign of `-0` is preserved.
  30870. *
  30871. * @static
  30872. * @memberOf _
  30873. * @since 4.0.0
  30874. * @category Lang
  30875. * @param {*} value The value to convert.
  30876. * @returns {string} Returns the converted string.
  30877. * @example
  30878. *
  30879. * _.toString(null);
  30880. * // => ''
  30881. *
  30882. * _.toString(-0);
  30883. * // => '-0'
  30884. *
  30885. * _.toString([1, 2, 3]);
  30886. * // => '1,2,3'
  30887. */
  30888. function toString(value) {
  30889. return value == null ? '' : baseToString(value);
  30890. }
  30891. /*------------------------------------------------------------------------*/
  30892. /**
  30893. * Assigns own enumerable string keyed properties of source objects to the
  30894. * destination object. Source objects are applied from left to right.
  30895. * Subsequent sources overwrite property assignments of previous sources.
  30896. *
  30897. * **Note:** This method mutates `object` and is loosely based on
  30898. * [`Object.assign`](https://mdn.io/Object/assign).
  30899. *
  30900. * @static
  30901. * @memberOf _
  30902. * @since 0.10.0
  30903. * @category Object
  30904. * @param {Object} object The destination object.
  30905. * @param {...Object} [sources] The source objects.
  30906. * @returns {Object} Returns `object`.
  30907. * @see _.assignIn
  30908. * @example
  30909. *
  30910. * function Foo() {
  30911. * this.a = 1;
  30912. * }
  30913. *
  30914. * function Bar() {
  30915. * this.c = 3;
  30916. * }
  30917. *
  30918. * Foo.prototype.b = 2;
  30919. * Bar.prototype.d = 4;
  30920. *
  30921. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30922. * // => { 'a': 1, 'c': 3 }
  30923. */
  30924. var assign = createAssigner(function(object, source) {
  30925. if (isPrototype(source) || isArrayLike(source)) {
  30926. copyObject(source, keys(source), object);
  30927. return;
  30928. }
  30929. for (var key in source) {
  30930. if (hasOwnProperty.call(source, key)) {
  30931. assignValue(object, key, source[key]);
  30932. }
  30933. }
  30934. });
  30935. /**
  30936. * This method is like `_.assign` except that it iterates over own and
  30937. * inherited source properties.
  30938. *
  30939. * **Note:** This method mutates `object`.
  30940. *
  30941. * @static
  30942. * @memberOf _
  30943. * @since 4.0.0
  30944. * @alias extend
  30945. * @category Object
  30946. * @param {Object} object The destination object.
  30947. * @param {...Object} [sources] The source objects.
  30948. * @returns {Object} Returns `object`.
  30949. * @see _.assign
  30950. * @example
  30951. *
  30952. * function Foo() {
  30953. * this.a = 1;
  30954. * }
  30955. *
  30956. * function Bar() {
  30957. * this.c = 3;
  30958. * }
  30959. *
  30960. * Foo.prototype.b = 2;
  30961. * Bar.prototype.d = 4;
  30962. *
  30963. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30964. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30965. */
  30966. var assignIn = createAssigner(function(object, source) {
  30967. copyObject(source, keysIn(source), object);
  30968. });
  30969. /**
  30970. * This method is like `_.assignIn` except that it accepts `customizer`
  30971. * which is invoked to produce the assigned values. If `customizer` returns
  30972. * `undefined`, assignment is handled by the method instead. The `customizer`
  30973. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30974. *
  30975. * **Note:** This method mutates `object`.
  30976. *
  30977. * @static
  30978. * @memberOf _
  30979. * @since 4.0.0
  30980. * @alias extendWith
  30981. * @category Object
  30982. * @param {Object} object The destination object.
  30983. * @param {...Object} sources The source objects.
  30984. * @param {Function} [customizer] The function to customize assigned values.
  30985. * @returns {Object} Returns `object`.
  30986. * @see _.assignWith
  30987. * @example
  30988. *
  30989. * function customizer(objValue, srcValue) {
  30990. * return _.isUndefined(objValue) ? srcValue : objValue;
  30991. * }
  30992. *
  30993. * var defaults = _.partialRight(_.assignInWith, customizer);
  30994. *
  30995. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30996. * // => { 'a': 1, 'b': 2 }
  30997. */
  30998. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30999. copyObject(source, keysIn(source), object, customizer);
  31000. });
  31001. /**
  31002. * This method is like `_.assign` except that it accepts `customizer`
  31003. * which is invoked to produce the assigned values. If `customizer` returns
  31004. * `undefined`, assignment is handled by the method instead. The `customizer`
  31005. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  31006. *
  31007. * **Note:** This method mutates `object`.
  31008. *
  31009. * @static
  31010. * @memberOf _
  31011. * @since 4.0.0
  31012. * @category Object
  31013. * @param {Object} object The destination object.
  31014. * @param {...Object} sources The source objects.
  31015. * @param {Function} [customizer] The function to customize assigned values.
  31016. * @returns {Object} Returns `object`.
  31017. * @see _.assignInWith
  31018. * @example
  31019. *
  31020. * function customizer(objValue, srcValue) {
  31021. * return _.isUndefined(objValue) ? srcValue : objValue;
  31022. * }
  31023. *
  31024. * var defaults = _.partialRight(_.assignWith, customizer);
  31025. *
  31026. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  31027. * // => { 'a': 1, 'b': 2 }
  31028. */
  31029. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  31030. copyObject(source, keys(source), object, customizer);
  31031. });
  31032. /**
  31033. * Creates an array of values corresponding to `paths` of `object`.
  31034. *
  31035. * @static
  31036. * @memberOf _
  31037. * @since 1.0.0
  31038. * @category Object
  31039. * @param {Object} object The object to iterate over.
  31040. * @param {...(string|string[])} [paths] The property paths to pick.
  31041. * @returns {Array} Returns the picked values.
  31042. * @example
  31043. *
  31044. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  31045. *
  31046. * _.at(object, ['a[0].b.c', 'a[1]']);
  31047. * // => [3, 4]
  31048. */
  31049. var at = flatRest(baseAt);
  31050. /**
  31051. * Creates an object that inherits from the `prototype` object. If a
  31052. * `properties` object is given, its own enumerable string keyed properties
  31053. * are assigned to the created object.
  31054. *
  31055. * @static
  31056. * @memberOf _
  31057. * @since 2.3.0
  31058. * @category Object
  31059. * @param {Object} prototype The object to inherit from.
  31060. * @param {Object} [properties] The properties to assign to the object.
  31061. * @returns {Object} Returns the new object.
  31062. * @example
  31063. *
  31064. * function Shape() {
  31065. * this.x = 0;
  31066. * this.y = 0;
  31067. * }
  31068. *
  31069. * function Circle() {
  31070. * Shape.call(this);
  31071. * }
  31072. *
  31073. * Circle.prototype = _.create(Shape.prototype, {
  31074. * 'constructor': Circle
  31075. * });
  31076. *
  31077. * var circle = new Circle;
  31078. * circle instanceof Circle;
  31079. * // => true
  31080. *
  31081. * circle instanceof Shape;
  31082. * // => true
  31083. */
  31084. function create(prototype, properties) {
  31085. var result = baseCreate(prototype);
  31086. return properties == null ? result : baseAssign(result, properties);
  31087. }
  31088. /**
  31089. * Assigns own and inherited enumerable string keyed properties of source
  31090. * objects to the destination object for all destination properties that
  31091. * resolve to `undefined`. Source objects are applied from left to right.
  31092. * Once a property is set, additional values of the same property are ignored.
  31093. *
  31094. * **Note:** This method mutates `object`.
  31095. *
  31096. * @static
  31097. * @since 0.1.0
  31098. * @memberOf _
  31099. * @category Object
  31100. * @param {Object} object The destination object.
  31101. * @param {...Object} [sources] The source objects.
  31102. * @returns {Object} Returns `object`.
  31103. * @see _.defaultsDeep
  31104. * @example
  31105. *
  31106. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  31107. * // => { 'a': 1, 'b': 2 }
  31108. */
  31109. var defaults = baseRest(function(object, sources) {
  31110. object = Object(object);
  31111. var index = -1;
  31112. var length = sources.length;
  31113. var guard = length > 2 ? sources[2] : undefined;
  31114. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  31115. length = 1;
  31116. }
  31117. while (++index < length) {
  31118. var source = sources[index];
  31119. var props = keysIn(source);
  31120. var propsIndex = -1;
  31121. var propsLength = props.length;
  31122. while (++propsIndex < propsLength) {
  31123. var key = props[propsIndex];
  31124. var value = object[key];
  31125. if (value === undefined ||
  31126. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  31127. object[key] = source[key];
  31128. }
  31129. }
  31130. }
  31131. return object;
  31132. });
  31133. /**
  31134. * This method is like `_.defaults` except that it recursively assigns
  31135. * default properties.
  31136. *
  31137. * **Note:** This method mutates `object`.
  31138. *
  31139. * @static
  31140. * @memberOf _
  31141. * @since 3.10.0
  31142. * @category Object
  31143. * @param {Object} object The destination object.
  31144. * @param {...Object} [sources] The source objects.
  31145. * @returns {Object} Returns `object`.
  31146. * @see _.defaults
  31147. * @example
  31148. *
  31149. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  31150. * // => { 'a': { 'b': 2, 'c': 3 } }
  31151. */
  31152. var defaultsDeep = baseRest(function(args) {
  31153. args.push(undefined, customDefaultsMerge);
  31154. return apply(mergeWith, undefined, args);
  31155. });
  31156. /**
  31157. * This method is like `_.find` except that it returns the key of the first
  31158. * element `predicate` returns truthy for instead of the element itself.
  31159. *
  31160. * @static
  31161. * @memberOf _
  31162. * @since 1.1.0
  31163. * @category Object
  31164. * @param {Object} object The object to inspect.
  31165. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  31166. * @returns {string|undefined} Returns the key of the matched element,
  31167. * else `undefined`.
  31168. * @example
  31169. *
  31170. * var users = {
  31171. * 'barney': { 'age': 36, 'active': true },
  31172. * 'fred': { 'age': 40, 'active': false },
  31173. * 'pebbles': { 'age': 1, 'active': true }
  31174. * };
  31175. *
  31176. * _.findKey(users, function(o) { return o.age < 40; });
  31177. * // => 'barney' (iteration order is not guaranteed)
  31178. *
  31179. * // The `_.matches` iteratee shorthand.
  31180. * _.findKey(users, { 'age': 1, 'active': true });
  31181. * // => 'pebbles'
  31182. *
  31183. * // The `_.matchesProperty` iteratee shorthand.
  31184. * _.findKey(users, ['active', false]);
  31185. * // => 'fred'
  31186. *
  31187. * // The `_.property` iteratee shorthand.
  31188. * _.findKey(users, 'active');
  31189. * // => 'barney'
  31190. */
  31191. function findKey(object, predicate) {
  31192. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  31193. }
  31194. /**
  31195. * This method is like `_.findKey` except that it iterates over elements of
  31196. * a collection in the opposite order.
  31197. *
  31198. * @static
  31199. * @memberOf _
  31200. * @since 2.0.0
  31201. * @category Object
  31202. * @param {Object} object The object to inspect.
  31203. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  31204. * @returns {string|undefined} Returns the key of the matched element,
  31205. * else `undefined`.
  31206. * @example
  31207. *
  31208. * var users = {
  31209. * 'barney': { 'age': 36, 'active': true },
  31210. * 'fred': { 'age': 40, 'active': false },
  31211. * 'pebbles': { 'age': 1, 'active': true }
  31212. * };
  31213. *
  31214. * _.findLastKey(users, function(o) { return o.age < 40; });
  31215. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  31216. *
  31217. * // The `_.matches` iteratee shorthand.
  31218. * _.findLastKey(users, { 'age': 36, 'active': true });
  31219. * // => 'barney'
  31220. *
  31221. * // The `_.matchesProperty` iteratee shorthand.
  31222. * _.findLastKey(users, ['active', false]);
  31223. * // => 'fred'
  31224. *
  31225. * // The `_.property` iteratee shorthand.
  31226. * _.findLastKey(users, 'active');
  31227. * // => 'pebbles'
  31228. */
  31229. function findLastKey(object, predicate) {
  31230. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  31231. }
  31232. /**
  31233. * Iterates over own and inherited enumerable string keyed properties of an
  31234. * object and invokes `iteratee` for each property. The iteratee is invoked
  31235. * with three arguments: (value, key, object). Iteratee functions may exit
  31236. * iteration early by explicitly returning `false`.
  31237. *
  31238. * @static
  31239. * @memberOf _
  31240. * @since 0.3.0
  31241. * @category Object
  31242. * @param {Object} object The object to iterate over.
  31243. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31244. * @returns {Object} Returns `object`.
  31245. * @see _.forInRight
  31246. * @example
  31247. *
  31248. * function Foo() {
  31249. * this.a = 1;
  31250. * this.b = 2;
  31251. * }
  31252. *
  31253. * Foo.prototype.c = 3;
  31254. *
  31255. * _.forIn(new Foo, function(value, key) {
  31256. * console.log(key);
  31257. * });
  31258. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  31259. */
  31260. function forIn(object, iteratee) {
  31261. return object == null
  31262. ? object
  31263. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  31264. }
  31265. /**
  31266. * This method is like `_.forIn` except that it iterates over properties of
  31267. * `object` in the opposite order.
  31268. *
  31269. * @static
  31270. * @memberOf _
  31271. * @since 2.0.0
  31272. * @category Object
  31273. * @param {Object} object The object to iterate over.
  31274. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31275. * @returns {Object} Returns `object`.
  31276. * @see _.forIn
  31277. * @example
  31278. *
  31279. * function Foo() {
  31280. * this.a = 1;
  31281. * this.b = 2;
  31282. * }
  31283. *
  31284. * Foo.prototype.c = 3;
  31285. *
  31286. * _.forInRight(new Foo, function(value, key) {
  31287. * console.log(key);
  31288. * });
  31289. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  31290. */
  31291. function forInRight(object, iteratee) {
  31292. return object == null
  31293. ? object
  31294. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  31295. }
  31296. /**
  31297. * Iterates over own enumerable string keyed properties of an object and
  31298. * invokes `iteratee` for each property. The iteratee is invoked with three
  31299. * arguments: (value, key, object). Iteratee functions may exit iteration
  31300. * early by explicitly returning `false`.
  31301. *
  31302. * @static
  31303. * @memberOf _
  31304. * @since 0.3.0
  31305. * @category Object
  31306. * @param {Object} object The object to iterate over.
  31307. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31308. * @returns {Object} Returns `object`.
  31309. * @see _.forOwnRight
  31310. * @example
  31311. *
  31312. * function Foo() {
  31313. * this.a = 1;
  31314. * this.b = 2;
  31315. * }
  31316. *
  31317. * Foo.prototype.c = 3;
  31318. *
  31319. * _.forOwn(new Foo, function(value, key) {
  31320. * console.log(key);
  31321. * });
  31322. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  31323. */
  31324. function forOwn(object, iteratee) {
  31325. return object && baseForOwn(object, getIteratee(iteratee, 3));
  31326. }
  31327. /**
  31328. * This method is like `_.forOwn` except that it iterates over properties of
  31329. * `object` in the opposite order.
  31330. *
  31331. * @static
  31332. * @memberOf _
  31333. * @since 2.0.0
  31334. * @category Object
  31335. * @param {Object} object The object to iterate over.
  31336. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31337. * @returns {Object} Returns `object`.
  31338. * @see _.forOwn
  31339. * @example
  31340. *
  31341. * function Foo() {
  31342. * this.a = 1;
  31343. * this.b = 2;
  31344. * }
  31345. *
  31346. * Foo.prototype.c = 3;
  31347. *
  31348. * _.forOwnRight(new Foo, function(value, key) {
  31349. * console.log(key);
  31350. * });
  31351. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  31352. */
  31353. function forOwnRight(object, iteratee) {
  31354. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  31355. }
  31356. /**
  31357. * Creates an array of function property names from own enumerable properties
  31358. * of `object`.
  31359. *
  31360. * @static
  31361. * @since 0.1.0
  31362. * @memberOf _
  31363. * @category Object
  31364. * @param {Object} object The object to inspect.
  31365. * @returns {Array} Returns the function names.
  31366. * @see _.functionsIn
  31367. * @example
  31368. *
  31369. * function Foo() {
  31370. * this.a = _.constant('a');
  31371. * this.b = _.constant('b');
  31372. * }
  31373. *
  31374. * Foo.prototype.c = _.constant('c');
  31375. *
  31376. * _.functions(new Foo);
  31377. * // => ['a', 'b']
  31378. */
  31379. function functions(object) {
  31380. return object == null ? [] : baseFunctions(object, keys(object));
  31381. }
  31382. /**
  31383. * Creates an array of function property names from own and inherited
  31384. * enumerable properties of `object`.
  31385. *
  31386. * @static
  31387. * @memberOf _
  31388. * @since 4.0.0
  31389. * @category Object
  31390. * @param {Object} object The object to inspect.
  31391. * @returns {Array} Returns the function names.
  31392. * @see _.functions
  31393. * @example
  31394. *
  31395. * function Foo() {
  31396. * this.a = _.constant('a');
  31397. * this.b = _.constant('b');
  31398. * }
  31399. *
  31400. * Foo.prototype.c = _.constant('c');
  31401. *
  31402. * _.functionsIn(new Foo);
  31403. * // => ['a', 'b', 'c']
  31404. */
  31405. function functionsIn(object) {
  31406. return object == null ? [] : baseFunctions(object, keysIn(object));
  31407. }
  31408. /**
  31409. * Gets the value at `path` of `object`. If the resolved value is
  31410. * `undefined`, the `defaultValue` is returned in its place.
  31411. *
  31412. * @static
  31413. * @memberOf _
  31414. * @since 3.7.0
  31415. * @category Object
  31416. * @param {Object} object The object to query.
  31417. * @param {Array|string} path The path of the property to get.
  31418. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31419. * @returns {*} Returns the resolved value.
  31420. * @example
  31421. *
  31422. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31423. *
  31424. * _.get(object, 'a[0].b.c');
  31425. * // => 3
  31426. *
  31427. * _.get(object, ['a', '0', 'b', 'c']);
  31428. * // => 3
  31429. *
  31430. * _.get(object, 'a.b.c', 'default');
  31431. * // => 'default'
  31432. */
  31433. function get(object, path, defaultValue) {
  31434. var result = object == null ? undefined : baseGet(object, path);
  31435. return result === undefined ? defaultValue : result;
  31436. }
  31437. /**
  31438. * Checks if `path` is a direct property of `object`.
  31439. *
  31440. * @static
  31441. * @since 0.1.0
  31442. * @memberOf _
  31443. * @category Object
  31444. * @param {Object} object The object to query.
  31445. * @param {Array|string} path The path to check.
  31446. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31447. * @example
  31448. *
  31449. * var object = { 'a': { 'b': 2 } };
  31450. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  31451. *
  31452. * _.has(object, 'a');
  31453. * // => true
  31454. *
  31455. * _.has(object, 'a.b');
  31456. * // => true
  31457. *
  31458. * _.has(object, ['a', 'b']);
  31459. * // => true
  31460. *
  31461. * _.has(other, 'a');
  31462. * // => false
  31463. */
  31464. function has(object, path) {
  31465. return object != null && hasPath(object, path, baseHas);
  31466. }
  31467. /**
  31468. * Checks if `path` is a direct or inherited property of `object`.
  31469. *
  31470. * @static
  31471. * @memberOf _
  31472. * @since 4.0.0
  31473. * @category Object
  31474. * @param {Object} object The object to query.
  31475. * @param {Array|string} path The path to check.
  31476. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31477. * @example
  31478. *
  31479. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  31480. *
  31481. * _.hasIn(object, 'a');
  31482. * // => true
  31483. *
  31484. * _.hasIn(object, 'a.b');
  31485. * // => true
  31486. *
  31487. * _.hasIn(object, ['a', 'b']);
  31488. * // => true
  31489. *
  31490. * _.hasIn(object, 'b');
  31491. * // => false
  31492. */
  31493. function hasIn(object, path) {
  31494. return object != null && hasPath(object, path, baseHasIn);
  31495. }
  31496. /**
  31497. * Creates an object composed of the inverted keys and values of `object`.
  31498. * If `object` contains duplicate values, subsequent values overwrite
  31499. * property assignments of previous values.
  31500. *
  31501. * @static
  31502. * @memberOf _
  31503. * @since 0.7.0
  31504. * @category Object
  31505. * @param {Object} object The object to invert.
  31506. * @returns {Object} Returns the new inverted object.
  31507. * @example
  31508. *
  31509. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  31510. *
  31511. * _.invert(object);
  31512. * // => { '1': 'c', '2': 'b' }
  31513. */
  31514. var invert = createInverter(function(result, value, key) {
  31515. if (value != null &&
  31516. typeof value.toString != 'function') {
  31517. value = nativeObjectToString.call(value);
  31518. }
  31519. result[value] = key;
  31520. }, constant(identity));
  31521. /**
  31522. * This method is like `_.invert` except that the inverted object is generated
  31523. * from the results of running each element of `object` thru `iteratee`. The
  31524. * corresponding inverted value of each inverted key is an array of keys
  31525. * responsible for generating the inverted value. The iteratee is invoked
  31526. * with one argument: (value).
  31527. *
  31528. * @static
  31529. * @memberOf _
  31530. * @since 4.1.0
  31531. * @category Object
  31532. * @param {Object} object The object to invert.
  31533. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  31534. * @returns {Object} Returns the new inverted object.
  31535. * @example
  31536. *
  31537. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  31538. *
  31539. * _.invertBy(object);
  31540. * // => { '1': ['a', 'c'], '2': ['b'] }
  31541. *
  31542. * _.invertBy(object, function(value) {
  31543. * return 'group' + value;
  31544. * });
  31545. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  31546. */
  31547. var invertBy = createInverter(function(result, value, key) {
  31548. if (value != null &&
  31549. typeof value.toString != 'function') {
  31550. value = nativeObjectToString.call(value);
  31551. }
  31552. if (hasOwnProperty.call(result, value)) {
  31553. result[value].push(key);
  31554. } else {
  31555. result[value] = [key];
  31556. }
  31557. }, getIteratee);
  31558. /**
  31559. * Invokes the method at `path` of `object`.
  31560. *
  31561. * @static
  31562. * @memberOf _
  31563. * @since 4.0.0
  31564. * @category Object
  31565. * @param {Object} object The object to query.
  31566. * @param {Array|string} path The path of the method to invoke.
  31567. * @param {...*} [args] The arguments to invoke the method with.
  31568. * @returns {*} Returns the result of the invoked method.
  31569. * @example
  31570. *
  31571. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  31572. *
  31573. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  31574. * // => [2, 3]
  31575. */
  31576. var invoke = baseRest(baseInvoke);
  31577. /**
  31578. * Creates an array of the own enumerable property names of `object`.
  31579. *
  31580. * **Note:** Non-object values are coerced to objects. See the
  31581. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  31582. * for more details.
  31583. *
  31584. * @static
  31585. * @since 0.1.0
  31586. * @memberOf _
  31587. * @category Object
  31588. * @param {Object} object The object to query.
  31589. * @returns {Array} Returns the array of property names.
  31590. * @example
  31591. *
  31592. * function Foo() {
  31593. * this.a = 1;
  31594. * this.b = 2;
  31595. * }
  31596. *
  31597. * Foo.prototype.c = 3;
  31598. *
  31599. * _.keys(new Foo);
  31600. * // => ['a', 'b'] (iteration order is not guaranteed)
  31601. *
  31602. * _.keys('hi');
  31603. * // => ['0', '1']
  31604. */
  31605. function keys(object) {
  31606. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  31607. }
  31608. /**
  31609. * Creates an array of the own and inherited enumerable property names of `object`.
  31610. *
  31611. * **Note:** Non-object values are coerced to objects.
  31612. *
  31613. * @static
  31614. * @memberOf _
  31615. * @since 3.0.0
  31616. * @category Object
  31617. * @param {Object} object The object to query.
  31618. * @returns {Array} Returns the array of property names.
  31619. * @example
  31620. *
  31621. * function Foo() {
  31622. * this.a = 1;
  31623. * this.b = 2;
  31624. * }
  31625. *
  31626. * Foo.prototype.c = 3;
  31627. *
  31628. * _.keysIn(new Foo);
  31629. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  31630. */
  31631. function keysIn(object) {
  31632. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  31633. }
  31634. /**
  31635. * The opposite of `_.mapValues`; this method creates an object with the
  31636. * same values as `object` and keys generated by running each own enumerable
  31637. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  31638. * with three arguments: (value, key, object).
  31639. *
  31640. * @static
  31641. * @memberOf _
  31642. * @since 3.8.0
  31643. * @category Object
  31644. * @param {Object} object The object to iterate over.
  31645. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31646. * @returns {Object} Returns the new mapped object.
  31647. * @see _.mapValues
  31648. * @example
  31649. *
  31650. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  31651. * return key + value;
  31652. * });
  31653. * // => { 'a1': 1, 'b2': 2 }
  31654. */
  31655. function mapKeys(object, iteratee) {
  31656. var result = {};
  31657. iteratee = getIteratee(iteratee, 3);
  31658. baseForOwn(object, function(value, key, object) {
  31659. baseAssignValue(result, iteratee(value, key, object), value);
  31660. });
  31661. return result;
  31662. }
  31663. /**
  31664. * Creates an object with the same keys as `object` and values generated
  31665. * by running each own enumerable string keyed property of `object` thru
  31666. * `iteratee`. The iteratee is invoked with three arguments:
  31667. * (value, key, object).
  31668. *
  31669. * @static
  31670. * @memberOf _
  31671. * @since 2.4.0
  31672. * @category Object
  31673. * @param {Object} object The object to iterate over.
  31674. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31675. * @returns {Object} Returns the new mapped object.
  31676. * @see _.mapKeys
  31677. * @example
  31678. *
  31679. * var users = {
  31680. * 'fred': { 'user': 'fred', 'age': 40 },
  31681. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  31682. * };
  31683. *
  31684. * _.mapValues(users, function(o) { return o.age; });
  31685. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31686. *
  31687. * // The `_.property` iteratee shorthand.
  31688. * _.mapValues(users, 'age');
  31689. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  31690. */
  31691. function mapValues(object, iteratee) {
  31692. var result = {};
  31693. iteratee = getIteratee(iteratee, 3);
  31694. baseForOwn(object, function(value, key, object) {
  31695. baseAssignValue(result, key, iteratee(value, key, object));
  31696. });
  31697. return result;
  31698. }
  31699. /**
  31700. * This method is like `_.assign` except that it recursively merges own and
  31701. * inherited enumerable string keyed properties of source objects into the
  31702. * destination object. Source properties that resolve to `undefined` are
  31703. * skipped if a destination value exists. Array and plain object properties
  31704. * are merged recursively. Other objects and value types are overridden by
  31705. * assignment. Source objects are applied from left to right. Subsequent
  31706. * sources overwrite property assignments of previous sources.
  31707. *
  31708. * **Note:** This method mutates `object`.
  31709. *
  31710. * @static
  31711. * @memberOf _
  31712. * @since 0.5.0
  31713. * @category Object
  31714. * @param {Object} object The destination object.
  31715. * @param {...Object} [sources] The source objects.
  31716. * @returns {Object} Returns `object`.
  31717. * @example
  31718. *
  31719. * var object = {
  31720. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  31721. * };
  31722. *
  31723. * var other = {
  31724. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  31725. * };
  31726. *
  31727. * _.merge(object, other);
  31728. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  31729. */
  31730. var merge = createAssigner(function(object, source, srcIndex) {
  31731. baseMerge(object, source, srcIndex);
  31732. });
  31733. /**
  31734. * This method is like `_.merge` except that it accepts `customizer` which
  31735. * is invoked to produce the merged values of the destination and source
  31736. * properties. If `customizer` returns `undefined`, merging is handled by the
  31737. * method instead. The `customizer` is invoked with six arguments:
  31738. * (objValue, srcValue, key, object, source, stack).
  31739. *
  31740. * **Note:** This method mutates `object`.
  31741. *
  31742. * @static
  31743. * @memberOf _
  31744. * @since 4.0.0
  31745. * @category Object
  31746. * @param {Object} object The destination object.
  31747. * @param {...Object} sources The source objects.
  31748. * @param {Function} customizer The function to customize assigned values.
  31749. * @returns {Object} Returns `object`.
  31750. * @example
  31751. *
  31752. * function customizer(objValue, srcValue) {
  31753. * if (_.isArray(objValue)) {
  31754. * return objValue.concat(srcValue);
  31755. * }
  31756. * }
  31757. *
  31758. * var object = { 'a': [1], 'b': [2] };
  31759. * var other = { 'a': [3], 'b': [4] };
  31760. *
  31761. * _.mergeWith(object, other, customizer);
  31762. * // => { 'a': [1, 3], 'b': [2, 4] }
  31763. */
  31764. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  31765. baseMerge(object, source, srcIndex, customizer);
  31766. });
  31767. /**
  31768. * The opposite of `_.pick`; this method creates an object composed of the
  31769. * own and inherited enumerable property paths of `object` that are not omitted.
  31770. *
  31771. * **Note:** This method is considerably slower than `_.pick`.
  31772. *
  31773. * @static
  31774. * @since 0.1.0
  31775. * @memberOf _
  31776. * @category Object
  31777. * @param {Object} object The source object.
  31778. * @param {...(string|string[])} [paths] The property paths to omit.
  31779. * @returns {Object} Returns the new object.
  31780. * @example
  31781. *
  31782. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31783. *
  31784. * _.omit(object, ['a', 'c']);
  31785. * // => { 'b': '2' }
  31786. */
  31787. var omit = flatRest(function(object, paths) {
  31788. var result = {};
  31789. if (object == null) {
  31790. return result;
  31791. }
  31792. var isDeep = false;
  31793. paths = arrayMap(paths, function(path) {
  31794. path = castPath(path, object);
  31795. isDeep || (isDeep = path.length > 1);
  31796. return path;
  31797. });
  31798. copyObject(object, getAllKeysIn(object), result);
  31799. if (isDeep) {
  31800. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31801. }
  31802. var length = paths.length;
  31803. while (length--) {
  31804. baseUnset(result, paths[length]);
  31805. }
  31806. return result;
  31807. });
  31808. /**
  31809. * The opposite of `_.pickBy`; this method creates an object composed of
  31810. * the own and inherited enumerable string keyed properties of `object` that
  31811. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31812. * arguments: (value, key).
  31813. *
  31814. * @static
  31815. * @memberOf _
  31816. * @since 4.0.0
  31817. * @category Object
  31818. * @param {Object} object The source object.
  31819. * @param {Function} [predicate=_.identity] The function invoked per property.
  31820. * @returns {Object} Returns the new object.
  31821. * @example
  31822. *
  31823. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31824. *
  31825. * _.omitBy(object, _.isNumber);
  31826. * // => { 'b': '2' }
  31827. */
  31828. function omitBy(object, predicate) {
  31829. return pickBy(object, negate(getIteratee(predicate)));
  31830. }
  31831. /**
  31832. * Creates an object composed of the picked `object` properties.
  31833. *
  31834. * @static
  31835. * @since 0.1.0
  31836. * @memberOf _
  31837. * @category Object
  31838. * @param {Object} object The source object.
  31839. * @param {...(string|string[])} [paths] The property paths to pick.
  31840. * @returns {Object} Returns the new object.
  31841. * @example
  31842. *
  31843. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31844. *
  31845. * _.pick(object, ['a', 'c']);
  31846. * // => { 'a': 1, 'c': 3 }
  31847. */
  31848. var pick = flatRest(function(object, paths) {
  31849. return object == null ? {} : basePick(object, paths);
  31850. });
  31851. /**
  31852. * Creates an object composed of the `object` properties `predicate` returns
  31853. * truthy for. The predicate is invoked with two arguments: (value, key).
  31854. *
  31855. * @static
  31856. * @memberOf _
  31857. * @since 4.0.0
  31858. * @category Object
  31859. * @param {Object} object The source object.
  31860. * @param {Function} [predicate=_.identity] The function invoked per property.
  31861. * @returns {Object} Returns the new object.
  31862. * @example
  31863. *
  31864. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31865. *
  31866. * _.pickBy(object, _.isNumber);
  31867. * // => { 'a': 1, 'c': 3 }
  31868. */
  31869. function pickBy(object, predicate) {
  31870. if (object == null) {
  31871. return {};
  31872. }
  31873. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31874. return [prop];
  31875. });
  31876. predicate = getIteratee(predicate);
  31877. return basePickBy(object, props, function(value, path) {
  31878. return predicate(value, path[0]);
  31879. });
  31880. }
  31881. /**
  31882. * This method is like `_.get` except that if the resolved value is a
  31883. * function it's invoked with the `this` binding of its parent object and
  31884. * its result is returned.
  31885. *
  31886. * @static
  31887. * @since 0.1.0
  31888. * @memberOf _
  31889. * @category Object
  31890. * @param {Object} object The object to query.
  31891. * @param {Array|string} path The path of the property to resolve.
  31892. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31893. * @returns {*} Returns the resolved value.
  31894. * @example
  31895. *
  31896. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31897. *
  31898. * _.result(object, 'a[0].b.c1');
  31899. * // => 3
  31900. *
  31901. * _.result(object, 'a[0].b.c2');
  31902. * // => 4
  31903. *
  31904. * _.result(object, 'a[0].b.c3', 'default');
  31905. * // => 'default'
  31906. *
  31907. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31908. * // => 'default'
  31909. */
  31910. function result(object, path, defaultValue) {
  31911. path = castPath(path, object);
  31912. var index = -1,
  31913. length = path.length;
  31914. // Ensure the loop is entered when path is empty.
  31915. if (!length) {
  31916. length = 1;
  31917. object = undefined;
  31918. }
  31919. while (++index < length) {
  31920. var value = object == null ? undefined : object[toKey(path[index])];
  31921. if (value === undefined) {
  31922. index = length;
  31923. value = defaultValue;
  31924. }
  31925. object = isFunction(value) ? value.call(object) : value;
  31926. }
  31927. return object;
  31928. }
  31929. /**
  31930. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31931. * it's created. Arrays are created for missing index properties while objects
  31932. * are created for all other missing properties. Use `_.setWith` to customize
  31933. * `path` creation.
  31934. *
  31935. * **Note:** This method mutates `object`.
  31936. *
  31937. * @static
  31938. * @memberOf _
  31939. * @since 3.7.0
  31940. * @category Object
  31941. * @param {Object} object The object to modify.
  31942. * @param {Array|string} path The path of the property to set.
  31943. * @param {*} value The value to set.
  31944. * @returns {Object} Returns `object`.
  31945. * @example
  31946. *
  31947. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31948. *
  31949. * _.set(object, 'a[0].b.c', 4);
  31950. * console.log(object.a[0].b.c);
  31951. * // => 4
  31952. *
  31953. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31954. * console.log(object.x[0].y.z);
  31955. * // => 5
  31956. */
  31957. function set(object, path, value) {
  31958. return object == null ? object : baseSet(object, path, value);
  31959. }
  31960. /**
  31961. * This method is like `_.set` except that it accepts `customizer` which is
  31962. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31963. * path creation is handled by the method instead. The `customizer` is invoked
  31964. * with three arguments: (nsValue, key, nsObject).
  31965. *
  31966. * **Note:** This method mutates `object`.
  31967. *
  31968. * @static
  31969. * @memberOf _
  31970. * @since 4.0.0
  31971. * @category Object
  31972. * @param {Object} object The object to modify.
  31973. * @param {Array|string} path The path of the property to set.
  31974. * @param {*} value The value to set.
  31975. * @param {Function} [customizer] The function to customize assigned values.
  31976. * @returns {Object} Returns `object`.
  31977. * @example
  31978. *
  31979. * var object = {};
  31980. *
  31981. * _.setWith(object, '[0][1]', 'a', Object);
  31982. * // => { '0': { '1': 'a' } }
  31983. */
  31984. function setWith(object, path, value, customizer) {
  31985. customizer = typeof customizer == 'function' ? customizer : undefined;
  31986. return object == null ? object : baseSet(object, path, value, customizer);
  31987. }
  31988. /**
  31989. * Creates an array of own enumerable string keyed-value pairs for `object`
  31990. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31991. * entries are returned.
  31992. *
  31993. * @static
  31994. * @memberOf _
  31995. * @since 4.0.0
  31996. * @alias entries
  31997. * @category Object
  31998. * @param {Object} object The object to query.
  31999. * @returns {Array} Returns the key-value pairs.
  32000. * @example
  32001. *
  32002. * function Foo() {
  32003. * this.a = 1;
  32004. * this.b = 2;
  32005. * }
  32006. *
  32007. * Foo.prototype.c = 3;
  32008. *
  32009. * _.toPairs(new Foo);
  32010. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  32011. */
  32012. var toPairs = createToPairs(keys);
  32013. /**
  32014. * Creates an array of own and inherited enumerable string keyed-value pairs
  32015. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  32016. * or set, its entries are returned.
  32017. *
  32018. * @static
  32019. * @memberOf _
  32020. * @since 4.0.0
  32021. * @alias entriesIn
  32022. * @category Object
  32023. * @param {Object} object The object to query.
  32024. * @returns {Array} Returns the key-value pairs.
  32025. * @example
  32026. *
  32027. * function Foo() {
  32028. * this.a = 1;
  32029. * this.b = 2;
  32030. * }
  32031. *
  32032. * Foo.prototype.c = 3;
  32033. *
  32034. * _.toPairsIn(new Foo);
  32035. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  32036. */
  32037. var toPairsIn = createToPairs(keysIn);
  32038. /**
  32039. * An alternative to `_.reduce`; this method transforms `object` to a new
  32040. * `accumulator` object which is the result of running each of its own
  32041. * enumerable string keyed properties thru `iteratee`, with each invocation
  32042. * potentially mutating the `accumulator` object. If `accumulator` is not
  32043. * provided, a new object with the same `[[Prototype]]` will be used. The
  32044. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  32045. * Iteratee functions may exit iteration early by explicitly returning `false`.
  32046. *
  32047. * @static
  32048. * @memberOf _
  32049. * @since 1.3.0
  32050. * @category Object
  32051. * @param {Object} object The object to iterate over.
  32052. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  32053. * @param {*} [accumulator] The custom accumulator value.
  32054. * @returns {*} Returns the accumulated value.
  32055. * @example
  32056. *
  32057. * _.transform([2, 3, 4], function(result, n) {
  32058. * result.push(n *= n);
  32059. * return n % 2 == 0;
  32060. * }, []);
  32061. * // => [4, 9]
  32062. *
  32063. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  32064. * (result[value] || (result[value] = [])).push(key);
  32065. * }, {});
  32066. * // => { '1': ['a', 'c'], '2': ['b'] }
  32067. */
  32068. function transform(object, iteratee, accumulator) {
  32069. var isArr = isArray(object),
  32070. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  32071. iteratee = getIteratee(iteratee, 4);
  32072. if (accumulator == null) {
  32073. var Ctor = object && object.constructor;
  32074. if (isArrLike) {
  32075. accumulator = isArr ? new Ctor : [];
  32076. }
  32077. else if (isObject(object)) {
  32078. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  32079. }
  32080. else {
  32081. accumulator = {};
  32082. }
  32083. }
  32084. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  32085. return iteratee(accumulator, value, index, object);
  32086. });
  32087. return accumulator;
  32088. }
  32089. /**
  32090. * Removes the property at `path` of `object`.
  32091. *
  32092. * **Note:** This method mutates `object`.
  32093. *
  32094. * @static
  32095. * @memberOf _
  32096. * @since 4.0.0
  32097. * @category Object
  32098. * @param {Object} object The object to modify.
  32099. * @param {Array|string} path The path of the property to unset.
  32100. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  32101. * @example
  32102. *
  32103. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  32104. * _.unset(object, 'a[0].b.c');
  32105. * // => true
  32106. *
  32107. * console.log(object);
  32108. * // => { 'a': [{ 'b': {} }] };
  32109. *
  32110. * _.unset(object, ['a', '0', 'b', 'c']);
  32111. * // => true
  32112. *
  32113. * console.log(object);
  32114. * // => { 'a': [{ 'b': {} }] };
  32115. */
  32116. function unset(object, path) {
  32117. return object == null ? true : baseUnset(object, path);
  32118. }
  32119. /**
  32120. * This method is like `_.set` except that accepts `updater` to produce the
  32121. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  32122. * is invoked with one argument: (value).
  32123. *
  32124. * **Note:** This method mutates `object`.
  32125. *
  32126. * @static
  32127. * @memberOf _
  32128. * @since 4.6.0
  32129. * @category Object
  32130. * @param {Object} object The object to modify.
  32131. * @param {Array|string} path The path of the property to set.
  32132. * @param {Function} updater The function to produce the updated value.
  32133. * @returns {Object} Returns `object`.
  32134. * @example
  32135. *
  32136. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  32137. *
  32138. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  32139. * console.log(object.a[0].b.c);
  32140. * // => 9
  32141. *
  32142. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  32143. * console.log(object.x[0].y.z);
  32144. * // => 0
  32145. */
  32146. function update(object, path, updater) {
  32147. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  32148. }
  32149. /**
  32150. * This method is like `_.update` except that it accepts `customizer` which is
  32151. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  32152. * path creation is handled by the method instead. The `customizer` is invoked
  32153. * with three arguments: (nsValue, key, nsObject).
  32154. *
  32155. * **Note:** This method mutates `object`.
  32156. *
  32157. * @static
  32158. * @memberOf _
  32159. * @since 4.6.0
  32160. * @category Object
  32161. * @param {Object} object The object to modify.
  32162. * @param {Array|string} path The path of the property to set.
  32163. * @param {Function} updater The function to produce the updated value.
  32164. * @param {Function} [customizer] The function to customize assigned values.
  32165. * @returns {Object} Returns `object`.
  32166. * @example
  32167. *
  32168. * var object = {};
  32169. *
  32170. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  32171. * // => { '0': { '1': 'a' } }
  32172. */
  32173. function updateWith(object, path, updater, customizer) {
  32174. customizer = typeof customizer == 'function' ? customizer : undefined;
  32175. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  32176. }
  32177. /**
  32178. * Creates an array of the own enumerable string keyed property values of `object`.
  32179. *
  32180. * **Note:** Non-object values are coerced to objects.
  32181. *
  32182. * @static
  32183. * @since 0.1.0
  32184. * @memberOf _
  32185. * @category Object
  32186. * @param {Object} object The object to query.
  32187. * @returns {Array} Returns the array of property values.
  32188. * @example
  32189. *
  32190. * function Foo() {
  32191. * this.a = 1;
  32192. * this.b = 2;
  32193. * }
  32194. *
  32195. * Foo.prototype.c = 3;
  32196. *
  32197. * _.values(new Foo);
  32198. * // => [1, 2] (iteration order is not guaranteed)
  32199. *
  32200. * _.values('hi');
  32201. * // => ['h', 'i']
  32202. */
  32203. function values(object) {
  32204. return object == null ? [] : baseValues(object, keys(object));
  32205. }
  32206. /**
  32207. * Creates an array of the own and inherited enumerable string keyed property
  32208. * values of `object`.
  32209. *
  32210. * **Note:** Non-object values are coerced to objects.
  32211. *
  32212. * @static
  32213. * @memberOf _
  32214. * @since 3.0.0
  32215. * @category Object
  32216. * @param {Object} object The object to query.
  32217. * @returns {Array} Returns the array of property values.
  32218. * @example
  32219. *
  32220. * function Foo() {
  32221. * this.a = 1;
  32222. * this.b = 2;
  32223. * }
  32224. *
  32225. * Foo.prototype.c = 3;
  32226. *
  32227. * _.valuesIn(new Foo);
  32228. * // => [1, 2, 3] (iteration order is not guaranteed)
  32229. */
  32230. function valuesIn(object) {
  32231. return object == null ? [] : baseValues(object, keysIn(object));
  32232. }
  32233. /*------------------------------------------------------------------------*/
  32234. /**
  32235. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  32236. *
  32237. * @static
  32238. * @memberOf _
  32239. * @since 4.0.0
  32240. * @category Number
  32241. * @param {number} number The number to clamp.
  32242. * @param {number} [lower] The lower bound.
  32243. * @param {number} upper The upper bound.
  32244. * @returns {number} Returns the clamped number.
  32245. * @example
  32246. *
  32247. * _.clamp(-10, -5, 5);
  32248. * // => -5
  32249. *
  32250. * _.clamp(10, -5, 5);
  32251. * // => 5
  32252. */
  32253. function clamp(number, lower, upper) {
  32254. if (upper === undefined) {
  32255. upper = lower;
  32256. lower = undefined;
  32257. }
  32258. if (upper !== undefined) {
  32259. upper = toNumber(upper);
  32260. upper = upper === upper ? upper : 0;
  32261. }
  32262. if (lower !== undefined) {
  32263. lower = toNumber(lower);
  32264. lower = lower === lower ? lower : 0;
  32265. }
  32266. return baseClamp(toNumber(number), lower, upper);
  32267. }
  32268. /**
  32269. * Checks if `n` is between `start` and up to, but not including, `end`. If
  32270. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  32271. * If `start` is greater than `end` the params are swapped to support
  32272. * negative ranges.
  32273. *
  32274. * @static
  32275. * @memberOf _
  32276. * @since 3.3.0
  32277. * @category Number
  32278. * @param {number} number The number to check.
  32279. * @param {number} [start=0] The start of the range.
  32280. * @param {number} end The end of the range.
  32281. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  32282. * @see _.range, _.rangeRight
  32283. * @example
  32284. *
  32285. * _.inRange(3, 2, 4);
  32286. * // => true
  32287. *
  32288. * _.inRange(4, 8);
  32289. * // => true
  32290. *
  32291. * _.inRange(4, 2);
  32292. * // => false
  32293. *
  32294. * _.inRange(2, 2);
  32295. * // => false
  32296. *
  32297. * _.inRange(1.2, 2);
  32298. * // => true
  32299. *
  32300. * _.inRange(5.2, 4);
  32301. * // => false
  32302. *
  32303. * _.inRange(-3, -2, -6);
  32304. * // => true
  32305. */
  32306. function inRange(number, start, end) {
  32307. start = toFinite(start);
  32308. if (end === undefined) {
  32309. end = start;
  32310. start = 0;
  32311. } else {
  32312. end = toFinite(end);
  32313. }
  32314. number = toNumber(number);
  32315. return baseInRange(number, start, end);
  32316. }
  32317. /**
  32318. * Produces a random number between the inclusive `lower` and `upper` bounds.
  32319. * If only one argument is provided a number between `0` and the given number
  32320. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  32321. * floats, a floating-point number is returned instead of an integer.
  32322. *
  32323. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  32324. * floating-point values which can produce unexpected results.
  32325. *
  32326. * @static
  32327. * @memberOf _
  32328. * @since 0.7.0
  32329. * @category Number
  32330. * @param {number} [lower=0] The lower bound.
  32331. * @param {number} [upper=1] The upper bound.
  32332. * @param {boolean} [floating] Specify returning a floating-point number.
  32333. * @returns {number} Returns the random number.
  32334. * @example
  32335. *
  32336. * _.random(0, 5);
  32337. * // => an integer between 0 and 5
  32338. *
  32339. * _.random(5);
  32340. * // => also an integer between 0 and 5
  32341. *
  32342. * _.random(5, true);
  32343. * // => a floating-point number between 0 and 5
  32344. *
  32345. * _.random(1.2, 5.2);
  32346. * // => a floating-point number between 1.2 and 5.2
  32347. */
  32348. function random(lower, upper, floating) {
  32349. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  32350. upper = floating = undefined;
  32351. }
  32352. if (floating === undefined) {
  32353. if (typeof upper == 'boolean') {
  32354. floating = upper;
  32355. upper = undefined;
  32356. }
  32357. else if (typeof lower == 'boolean') {
  32358. floating = lower;
  32359. lower = undefined;
  32360. }
  32361. }
  32362. if (lower === undefined && upper === undefined) {
  32363. lower = 0;
  32364. upper = 1;
  32365. }
  32366. else {
  32367. lower = toFinite(lower);
  32368. if (upper === undefined) {
  32369. upper = lower;
  32370. lower = 0;
  32371. } else {
  32372. upper = toFinite(upper);
  32373. }
  32374. }
  32375. if (lower > upper) {
  32376. var temp = lower;
  32377. lower = upper;
  32378. upper = temp;
  32379. }
  32380. if (floating || lower % 1 || upper % 1) {
  32381. var rand = nativeRandom();
  32382. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  32383. }
  32384. return baseRandom(lower, upper);
  32385. }
  32386. /*------------------------------------------------------------------------*/
  32387. /**
  32388. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  32389. *
  32390. * @static
  32391. * @memberOf _
  32392. * @since 3.0.0
  32393. * @category String
  32394. * @param {string} [string=''] The string to convert.
  32395. * @returns {string} Returns the camel cased string.
  32396. * @example
  32397. *
  32398. * _.camelCase('Foo Bar');
  32399. * // => 'fooBar'
  32400. *
  32401. * _.camelCase('--foo-bar--');
  32402. * // => 'fooBar'
  32403. *
  32404. * _.camelCase('__FOO_BAR__');
  32405. * // => 'fooBar'
  32406. */
  32407. var camelCase = createCompounder(function(result, word, index) {
  32408. word = word.toLowerCase();
  32409. return result + (index ? capitalize(word) : word);
  32410. });
  32411. /**
  32412. * Converts the first character of `string` to upper case and the remaining
  32413. * to lower case.
  32414. *
  32415. * @static
  32416. * @memberOf _
  32417. * @since 3.0.0
  32418. * @category String
  32419. * @param {string} [string=''] The string to capitalize.
  32420. * @returns {string} Returns the capitalized string.
  32421. * @example
  32422. *
  32423. * _.capitalize('FRED');
  32424. * // => 'Fred'
  32425. */
  32426. function capitalize(string) {
  32427. return upperFirst(toString(string).toLowerCase());
  32428. }
  32429. /**
  32430. * Deburrs `string` by converting
  32431. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  32432. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  32433. * letters to basic Latin letters and removing
  32434. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  32435. *
  32436. * @static
  32437. * @memberOf _
  32438. * @since 3.0.0
  32439. * @category String
  32440. * @param {string} [string=''] The string to deburr.
  32441. * @returns {string} Returns the deburred string.
  32442. * @example
  32443. *
  32444. * _.deburr('déjà vu');
  32445. * // => 'deja vu'
  32446. */
  32447. function deburr(string) {
  32448. string = toString(string);
  32449. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  32450. }
  32451. /**
  32452. * Checks if `string` ends with the given target string.
  32453. *
  32454. * @static
  32455. * @memberOf _
  32456. * @since 3.0.0
  32457. * @category String
  32458. * @param {string} [string=''] The string to inspect.
  32459. * @param {string} [target] The string to search for.
  32460. * @param {number} [position=string.length] The position to search up to.
  32461. * @returns {boolean} Returns `true` if `string` ends with `target`,
  32462. * else `false`.
  32463. * @example
  32464. *
  32465. * _.endsWith('abc', 'c');
  32466. * // => true
  32467. *
  32468. * _.endsWith('abc', 'b');
  32469. * // => false
  32470. *
  32471. * _.endsWith('abc', 'b', 2);
  32472. * // => true
  32473. */
  32474. function endsWith(string, target, position) {
  32475. string = toString(string);
  32476. target = baseToString(target);
  32477. var length = string.length;
  32478. position = position === undefined
  32479. ? length
  32480. : baseClamp(toInteger(position), 0, length);
  32481. var end = position;
  32482. position -= target.length;
  32483. return position >= 0 && string.slice(position, end) == target;
  32484. }
  32485. /**
  32486. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  32487. * corresponding HTML entities.
  32488. *
  32489. * **Note:** No other characters are escaped. To escape additional
  32490. * characters use a third-party library like [_he_](https://mths.be/he).
  32491. *
  32492. * Though the ">" character is escaped for symmetry, characters like
  32493. * ">" and "/" don't need escaping in HTML and have no special meaning
  32494. * unless they're part of a tag or unquoted attribute value. See
  32495. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  32496. * (under "semi-related fun fact") for more details.
  32497. *
  32498. * When working with HTML you should always
  32499. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  32500. * XSS vectors.
  32501. *
  32502. * @static
  32503. * @since 0.1.0
  32504. * @memberOf _
  32505. * @category String
  32506. * @param {string} [string=''] The string to escape.
  32507. * @returns {string} Returns the escaped string.
  32508. * @example
  32509. *
  32510. * _.escape('fred, barney, & pebbles');
  32511. * // => 'fred, barney, &amp; pebbles'
  32512. */
  32513. function escape(string) {
  32514. string = toString(string);
  32515. return (string && reHasUnescapedHtml.test(string))
  32516. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  32517. : string;
  32518. }
  32519. /**
  32520. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  32521. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  32522. *
  32523. * @static
  32524. * @memberOf _
  32525. * @since 3.0.0
  32526. * @category String
  32527. * @param {string} [string=''] The string to escape.
  32528. * @returns {string} Returns the escaped string.
  32529. * @example
  32530. *
  32531. * _.escapeRegExp('[lodash](https://lodash.com/)');
  32532. * // => '\[lodash\]\(https://lodash\.com/\)'
  32533. */
  32534. function escapeRegExp(string) {
  32535. string = toString(string);
  32536. return (string && reHasRegExpChar.test(string))
  32537. ? string.replace(reRegExpChar, '\\$&')
  32538. : string;
  32539. }
  32540. /**
  32541. * Converts `string` to
  32542. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  32543. *
  32544. * @static
  32545. * @memberOf _
  32546. * @since 3.0.0
  32547. * @category String
  32548. * @param {string} [string=''] The string to convert.
  32549. * @returns {string} Returns the kebab cased string.
  32550. * @example
  32551. *
  32552. * _.kebabCase('Foo Bar');
  32553. * // => 'foo-bar'
  32554. *
  32555. * _.kebabCase('fooBar');
  32556. * // => 'foo-bar'
  32557. *
  32558. * _.kebabCase('__FOO_BAR__');
  32559. * // => 'foo-bar'
  32560. */
  32561. var kebabCase = createCompounder(function(result, word, index) {
  32562. return result + (index ? '-' : '') + word.toLowerCase();
  32563. });
  32564. /**
  32565. * Converts `string`, as space separated words, to lower case.
  32566. *
  32567. * @static
  32568. * @memberOf _
  32569. * @since 4.0.0
  32570. * @category String
  32571. * @param {string} [string=''] The string to convert.
  32572. * @returns {string} Returns the lower cased string.
  32573. * @example
  32574. *
  32575. * _.lowerCase('--Foo-Bar--');
  32576. * // => 'foo bar'
  32577. *
  32578. * _.lowerCase('fooBar');
  32579. * // => 'foo bar'
  32580. *
  32581. * _.lowerCase('__FOO_BAR__');
  32582. * // => 'foo bar'
  32583. */
  32584. var lowerCase = createCompounder(function(result, word, index) {
  32585. return result + (index ? ' ' : '') + word.toLowerCase();
  32586. });
  32587. /**
  32588. * Converts the first character of `string` to lower case.
  32589. *
  32590. * @static
  32591. * @memberOf _
  32592. * @since 4.0.0
  32593. * @category String
  32594. * @param {string} [string=''] The string to convert.
  32595. * @returns {string} Returns the converted string.
  32596. * @example
  32597. *
  32598. * _.lowerFirst('Fred');
  32599. * // => 'fred'
  32600. *
  32601. * _.lowerFirst('FRED');
  32602. * // => 'fRED'
  32603. */
  32604. var lowerFirst = createCaseFirst('toLowerCase');
  32605. /**
  32606. * Pads `string` on the left and right sides if it's shorter than `length`.
  32607. * Padding characters are truncated if they can't be evenly divided by `length`.
  32608. *
  32609. * @static
  32610. * @memberOf _
  32611. * @since 3.0.0
  32612. * @category String
  32613. * @param {string} [string=''] The string to pad.
  32614. * @param {number} [length=0] The padding length.
  32615. * @param {string} [chars=' '] The string used as padding.
  32616. * @returns {string} Returns the padded string.
  32617. * @example
  32618. *
  32619. * _.pad('abc', 8);
  32620. * // => ' abc '
  32621. *
  32622. * _.pad('abc', 8, '_-');
  32623. * // => '_-abc_-_'
  32624. *
  32625. * _.pad('abc', 3);
  32626. * // => 'abc'
  32627. */
  32628. function pad(string, length, chars) {
  32629. string = toString(string);
  32630. length = toInteger(length);
  32631. var strLength = length ? stringSize(string) : 0;
  32632. if (!length || strLength >= length) {
  32633. return string;
  32634. }
  32635. var mid = (length - strLength) / 2;
  32636. return (
  32637. createPadding(nativeFloor(mid), chars) +
  32638. string +
  32639. createPadding(nativeCeil(mid), chars)
  32640. );
  32641. }
  32642. /**
  32643. * Pads `string` on the right side if it's shorter than `length`. Padding
  32644. * characters are truncated if they exceed `length`.
  32645. *
  32646. * @static
  32647. * @memberOf _
  32648. * @since 4.0.0
  32649. * @category String
  32650. * @param {string} [string=''] The string to pad.
  32651. * @param {number} [length=0] The padding length.
  32652. * @param {string} [chars=' '] The string used as padding.
  32653. * @returns {string} Returns the padded string.
  32654. * @example
  32655. *
  32656. * _.padEnd('abc', 6);
  32657. * // => 'abc '
  32658. *
  32659. * _.padEnd('abc', 6, '_-');
  32660. * // => 'abc_-_'
  32661. *
  32662. * _.padEnd('abc', 3);
  32663. * // => 'abc'
  32664. */
  32665. function padEnd(string, length, chars) {
  32666. string = toString(string);
  32667. length = toInteger(length);
  32668. var strLength = length ? stringSize(string) : 0;
  32669. return (length && strLength < length)
  32670. ? (string + createPadding(length - strLength, chars))
  32671. : string;
  32672. }
  32673. /**
  32674. * Pads `string` on the left side if it's shorter than `length`. Padding
  32675. * characters are truncated if they exceed `length`.
  32676. *
  32677. * @static
  32678. * @memberOf _
  32679. * @since 4.0.0
  32680. * @category String
  32681. * @param {string} [string=''] The string to pad.
  32682. * @param {number} [length=0] The padding length.
  32683. * @param {string} [chars=' '] The string used as padding.
  32684. * @returns {string} Returns the padded string.
  32685. * @example
  32686. *
  32687. * _.padStart('abc', 6);
  32688. * // => ' abc'
  32689. *
  32690. * _.padStart('abc', 6, '_-');
  32691. * // => '_-_abc'
  32692. *
  32693. * _.padStart('abc', 3);
  32694. * // => 'abc'
  32695. */
  32696. function padStart(string, length, chars) {
  32697. string = toString(string);
  32698. length = toInteger(length);
  32699. var strLength = length ? stringSize(string) : 0;
  32700. return (length && strLength < length)
  32701. ? (createPadding(length - strLength, chars) + string)
  32702. : string;
  32703. }
  32704. /**
  32705. * Converts `string` to an integer of the specified radix. If `radix` is
  32706. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  32707. * hexadecimal, in which case a `radix` of `16` is used.
  32708. *
  32709. * **Note:** This method aligns with the
  32710. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  32711. *
  32712. * @static
  32713. * @memberOf _
  32714. * @since 1.1.0
  32715. * @category String
  32716. * @param {string} string The string to convert.
  32717. * @param {number} [radix=10] The radix to interpret `value` by.
  32718. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32719. * @returns {number} Returns the converted integer.
  32720. * @example
  32721. *
  32722. * _.parseInt('08');
  32723. * // => 8
  32724. *
  32725. * _.map(['6', '08', '10'], _.parseInt);
  32726. * // => [6, 8, 10]
  32727. */
  32728. function parseInt(string, radix, guard) {
  32729. if (guard || radix == null) {
  32730. radix = 0;
  32731. } else if (radix) {
  32732. radix = +radix;
  32733. }
  32734. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  32735. }
  32736. /**
  32737. * Repeats the given string `n` times.
  32738. *
  32739. * @static
  32740. * @memberOf _
  32741. * @since 3.0.0
  32742. * @category String
  32743. * @param {string} [string=''] The string to repeat.
  32744. * @param {number} [n=1] The number of times to repeat the string.
  32745. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32746. * @returns {string} Returns the repeated string.
  32747. * @example
  32748. *
  32749. * _.repeat('*', 3);
  32750. * // => '***'
  32751. *
  32752. * _.repeat('abc', 2);
  32753. * // => 'abcabc'
  32754. *
  32755. * _.repeat('abc', 0);
  32756. * // => ''
  32757. */
  32758. function repeat(string, n, guard) {
  32759. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  32760. n = 1;
  32761. } else {
  32762. n = toInteger(n);
  32763. }
  32764. return baseRepeat(toString(string), n);
  32765. }
  32766. /**
  32767. * Replaces matches for `pattern` in `string` with `replacement`.
  32768. *
  32769. * **Note:** This method is based on
  32770. * [`String#replace`](https://mdn.io/String/replace).
  32771. *
  32772. * @static
  32773. * @memberOf _
  32774. * @since 4.0.0
  32775. * @category String
  32776. * @param {string} [string=''] The string to modify.
  32777. * @param {RegExp|string} pattern The pattern to replace.
  32778. * @param {Function|string} replacement The match replacement.
  32779. * @returns {string} Returns the modified string.
  32780. * @example
  32781. *
  32782. * _.replace('Hi Fred', 'Fred', 'Barney');
  32783. * // => 'Hi Barney'
  32784. */
  32785. function replace() {
  32786. var args = arguments,
  32787. string = toString(args[0]);
  32788. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32789. }
  32790. /**
  32791. * Converts `string` to
  32792. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32793. *
  32794. * @static
  32795. * @memberOf _
  32796. * @since 3.0.0
  32797. * @category String
  32798. * @param {string} [string=''] The string to convert.
  32799. * @returns {string} Returns the snake cased string.
  32800. * @example
  32801. *
  32802. * _.snakeCase('Foo Bar');
  32803. * // => 'foo_bar'
  32804. *
  32805. * _.snakeCase('fooBar');
  32806. * // => 'foo_bar'
  32807. *
  32808. * _.snakeCase('--FOO-BAR--');
  32809. * // => 'foo_bar'
  32810. */
  32811. var snakeCase = createCompounder(function(result, word, index) {
  32812. return result + (index ? '_' : '') + word.toLowerCase();
  32813. });
  32814. /**
  32815. * Splits `string` by `separator`.
  32816. *
  32817. * **Note:** This method is based on
  32818. * [`String#split`](https://mdn.io/String/split).
  32819. *
  32820. * @static
  32821. * @memberOf _
  32822. * @since 4.0.0
  32823. * @category String
  32824. * @param {string} [string=''] The string to split.
  32825. * @param {RegExp|string} separator The separator pattern to split by.
  32826. * @param {number} [limit] The length to truncate results to.
  32827. * @returns {Array} Returns the string segments.
  32828. * @example
  32829. *
  32830. * _.split('a-b-c', '-', 2);
  32831. * // => ['a', 'b']
  32832. */
  32833. function split(string, separator, limit) {
  32834. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32835. separator = limit = undefined;
  32836. }
  32837. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32838. if (!limit) {
  32839. return [];
  32840. }
  32841. string = toString(string);
  32842. if (string && (
  32843. typeof separator == 'string' ||
  32844. (separator != null && !isRegExp(separator))
  32845. )) {
  32846. separator = baseToString(separator);
  32847. if (!separator && hasUnicode(string)) {
  32848. return castSlice(stringToArray(string), 0, limit);
  32849. }
  32850. }
  32851. return string.split(separator, limit);
  32852. }
  32853. /**
  32854. * Converts `string` to
  32855. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32856. *
  32857. * @static
  32858. * @memberOf _
  32859. * @since 3.1.0
  32860. * @category String
  32861. * @param {string} [string=''] The string to convert.
  32862. * @returns {string} Returns the start cased string.
  32863. * @example
  32864. *
  32865. * _.startCase('--foo-bar--');
  32866. * // => 'Foo Bar'
  32867. *
  32868. * _.startCase('fooBar');
  32869. * // => 'Foo Bar'
  32870. *
  32871. * _.startCase('__FOO_BAR__');
  32872. * // => 'FOO BAR'
  32873. */
  32874. var startCase = createCompounder(function(result, word, index) {
  32875. return result + (index ? ' ' : '') + upperFirst(word);
  32876. });
  32877. /**
  32878. * Checks if `string` starts with the given target string.
  32879. *
  32880. * @static
  32881. * @memberOf _
  32882. * @since 3.0.0
  32883. * @category String
  32884. * @param {string} [string=''] The string to inspect.
  32885. * @param {string} [target] The string to search for.
  32886. * @param {number} [position=0] The position to search from.
  32887. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32888. * else `false`.
  32889. * @example
  32890. *
  32891. * _.startsWith('abc', 'a');
  32892. * // => true
  32893. *
  32894. * _.startsWith('abc', 'b');
  32895. * // => false
  32896. *
  32897. * _.startsWith('abc', 'b', 1);
  32898. * // => true
  32899. */
  32900. function startsWith(string, target, position) {
  32901. string = toString(string);
  32902. position = position == null
  32903. ? 0
  32904. : baseClamp(toInteger(position), 0, string.length);
  32905. target = baseToString(target);
  32906. return string.slice(position, position + target.length) == target;
  32907. }
  32908. /**
  32909. * Creates a compiled template function that can interpolate data properties
  32910. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32911. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32912. * properties may be accessed as free variables in the template. If a setting
  32913. * object is given, it takes precedence over `_.templateSettings` values.
  32914. *
  32915. * **Note:** In the development build `_.template` utilizes
  32916. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32917. * for easier debugging.
  32918. *
  32919. * For more information on precompiling templates see
  32920. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32921. *
  32922. * For more information on Chrome extension sandboxes see
  32923. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32924. *
  32925. * @static
  32926. * @since 0.1.0
  32927. * @memberOf _
  32928. * @category String
  32929. * @param {string} [string=''] The template string.
  32930. * @param {Object} [options={}] The options object.
  32931. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32932. * The HTML "escape" delimiter.
  32933. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32934. * The "evaluate" delimiter.
  32935. * @param {Object} [options.imports=_.templateSettings.imports]
  32936. * An object to import into the template as free variables.
  32937. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32938. * The "interpolate" delimiter.
  32939. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32940. * The sourceURL of the compiled template.
  32941. * @param {string} [options.variable='obj']
  32942. * The data object variable name.
  32943. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32944. * @returns {Function} Returns the compiled template function.
  32945. * @example
  32946. *
  32947. * // Use the "interpolate" delimiter to create a compiled template.
  32948. * var compiled = _.template('hello <%= user %>!');
  32949. * compiled({ 'user': 'fred' });
  32950. * // => 'hello fred!'
  32951. *
  32952. * // Use the HTML "escape" delimiter to escape data property values.
  32953. * var compiled = _.template('<b><%- value %></b>');
  32954. * compiled({ 'value': '<script>' });
  32955. * // => '<b>&lt;script&gt;</b>'
  32956. *
  32957. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32958. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32959. * compiled({ 'users': ['fred', 'barney'] });
  32960. * // => '<li>fred</li><li>barney</li>'
  32961. *
  32962. * // Use the internal `print` function in "evaluate" delimiters.
  32963. * var compiled = _.template('<% print("hello " + user); %>!');
  32964. * compiled({ 'user': 'barney' });
  32965. * // => 'hello barney!'
  32966. *
  32967. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32968. * // Disable support by replacing the "interpolate" delimiter.
  32969. * var compiled = _.template('hello ${ user }!');
  32970. * compiled({ 'user': 'pebbles' });
  32971. * // => 'hello pebbles!'
  32972. *
  32973. * // Use backslashes to treat delimiters as plain text.
  32974. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32975. * compiled({ 'value': 'ignored' });
  32976. * // => '<%- value %>'
  32977. *
  32978. * // Use the `imports` option to import `jQuery` as `jq`.
  32979. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32980. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32981. * compiled({ 'users': ['fred', 'barney'] });
  32982. * // => '<li>fred</li><li>barney</li>'
  32983. *
  32984. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32985. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32986. * compiled(data);
  32987. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32988. *
  32989. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32990. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32991. * compiled.source;
  32992. * // => function(data) {
  32993. * // var __t, __p = '';
  32994. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32995. * // return __p;
  32996. * // }
  32997. *
  32998. * // Use custom template delimiters.
  32999. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  33000. * var compiled = _.template('hello {{ user }}!');
  33001. * compiled({ 'user': 'mustache' });
  33002. * // => 'hello mustache!'
  33003. *
  33004. * // Use the `source` property to inline compiled templates for meaningful
  33005. * // line numbers in error messages and stack traces.
  33006. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  33007. * var JST = {\
  33008. * "main": ' + _.template(mainText).source + '\
  33009. * };\
  33010. * ');
  33011. */
  33012. function template(string, options, guard) {
  33013. // Based on John Resig's `tmpl` implementation
  33014. // (http://ejohn.org/blog/javascript-micro-templating/)
  33015. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  33016. var settings = lodash.templateSettings;
  33017. if (guard && isIterateeCall(string, options, guard)) {
  33018. options = undefined;
  33019. }
  33020. string = toString(string);
  33021. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  33022. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  33023. importsKeys = keys(imports),
  33024. importsValues = baseValues(imports, importsKeys);
  33025. var isEscaping,
  33026. isEvaluating,
  33027. index = 0,
  33028. interpolate = options.interpolate || reNoMatch,
  33029. source = "__p += '";
  33030. // Compile the regexp to match each delimiter.
  33031. var reDelimiters = RegExp(
  33032. (options.escape || reNoMatch).source + '|' +
  33033. interpolate.source + '|' +
  33034. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  33035. (options.evaluate || reNoMatch).source + '|$'
  33036. , 'g');
  33037. // Use a sourceURL for easier debugging.
  33038. // The sourceURL gets injected into the source that's eval-ed, so be careful
  33039. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  33040. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  33041. var sourceURL = '//# sourceURL=' +
  33042. (hasOwnProperty.call(options, 'sourceURL')
  33043. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  33044. : ('lodash.templateSources[' + (++templateCounter) + ']')
  33045. ) + '\n';
  33046. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  33047. interpolateValue || (interpolateValue = esTemplateValue);
  33048. // Escape characters that can't be included in string literals.
  33049. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  33050. // Replace delimiters with snippets.
  33051. if (escapeValue) {
  33052. isEscaping = true;
  33053. source += "' +\n__e(" + escapeValue + ") +\n'";
  33054. }
  33055. if (evaluateValue) {
  33056. isEvaluating = true;
  33057. source += "';\n" + evaluateValue + ";\n__p += '";
  33058. }
  33059. if (interpolateValue) {
  33060. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  33061. }
  33062. index = offset + match.length;
  33063. // The JS engine embedded in Adobe products needs `match` returned in
  33064. // order to produce the correct `offset` value.
  33065. return match;
  33066. });
  33067. source += "';\n";
  33068. // If `variable` is not specified wrap a with-statement around the generated
  33069. // code to add the data object to the top of the scope chain.
  33070. // Like with sourceURL, we take care to not check the option's prototype,
  33071. // as this configuration is a code injection vector.
  33072. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  33073. if (!variable) {
  33074. source = 'with (obj) {\n' + source + '\n}\n';
  33075. }
  33076. // Cleanup code by stripping empty strings.
  33077. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  33078. .replace(reEmptyStringMiddle, '$1')
  33079. .replace(reEmptyStringTrailing, '$1;');
  33080. // Frame code as the function body.
  33081. source = 'function(' + (variable || 'obj') + ') {\n' +
  33082. (variable
  33083. ? ''
  33084. : 'obj || (obj = {});\n'
  33085. ) +
  33086. "var __t, __p = ''" +
  33087. (isEscaping
  33088. ? ', __e = _.escape'
  33089. : ''
  33090. ) +
  33091. (isEvaluating
  33092. ? ', __j = Array.prototype.join;\n' +
  33093. "function print() { __p += __j.call(arguments, '') }\n"
  33094. : ';\n'
  33095. ) +
  33096. source +
  33097. 'return __p\n}';
  33098. var result = attempt(function() {
  33099. return Function(importsKeys, sourceURL + 'return ' + source)
  33100. .apply(undefined, importsValues);
  33101. });
  33102. // Provide the compiled function's source by its `toString` method or
  33103. // the `source` property as a convenience for inlining compiled templates.
  33104. result.source = source;
  33105. if (isError(result)) {
  33106. throw result;
  33107. }
  33108. return result;
  33109. }
  33110. /**
  33111. * Converts `string`, as a whole, to lower case just like
  33112. * [String#toLowerCase](https://mdn.io/toLowerCase).
  33113. *
  33114. * @static
  33115. * @memberOf _
  33116. * @since 4.0.0
  33117. * @category String
  33118. * @param {string} [string=''] The string to convert.
  33119. * @returns {string} Returns the lower cased string.
  33120. * @example
  33121. *
  33122. * _.toLower('--Foo-Bar--');
  33123. * // => '--foo-bar--'
  33124. *
  33125. * _.toLower('fooBar');
  33126. * // => 'foobar'
  33127. *
  33128. * _.toLower('__FOO_BAR__');
  33129. * // => '__foo_bar__'
  33130. */
  33131. function toLower(value) {
  33132. return toString(value).toLowerCase();
  33133. }
  33134. /**
  33135. * Converts `string`, as a whole, to upper case just like
  33136. * [String#toUpperCase](https://mdn.io/toUpperCase).
  33137. *
  33138. * @static
  33139. * @memberOf _
  33140. * @since 4.0.0
  33141. * @category String
  33142. * @param {string} [string=''] The string to convert.
  33143. * @returns {string} Returns the upper cased string.
  33144. * @example
  33145. *
  33146. * _.toUpper('--foo-bar--');
  33147. * // => '--FOO-BAR--'
  33148. *
  33149. * _.toUpper('fooBar');
  33150. * // => 'FOOBAR'
  33151. *
  33152. * _.toUpper('__foo_bar__');
  33153. * // => '__FOO_BAR__'
  33154. */
  33155. function toUpper(value) {
  33156. return toString(value).toUpperCase();
  33157. }
  33158. /**
  33159. * Removes leading and trailing whitespace or specified characters from `string`.
  33160. *
  33161. * @static
  33162. * @memberOf _
  33163. * @since 3.0.0
  33164. * @category String
  33165. * @param {string} [string=''] The string to trim.
  33166. * @param {string} [chars=whitespace] The characters to trim.
  33167. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33168. * @returns {string} Returns the trimmed string.
  33169. * @example
  33170. *
  33171. * _.trim(' abc ');
  33172. * // => 'abc'
  33173. *
  33174. * _.trim('-_-abc-_-', '_-');
  33175. * // => 'abc'
  33176. *
  33177. * _.map([' foo ', ' bar '], _.trim);
  33178. * // => ['foo', 'bar']
  33179. */
  33180. function trim(string, chars, guard) {
  33181. string = toString(string);
  33182. if (string && (guard || chars === undefined)) {
  33183. return string.replace(reTrim, '');
  33184. }
  33185. if (!string || !(chars = baseToString(chars))) {
  33186. return string;
  33187. }
  33188. var strSymbols = stringToArray(string),
  33189. chrSymbols = stringToArray(chars),
  33190. start = charsStartIndex(strSymbols, chrSymbols),
  33191. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  33192. return castSlice(strSymbols, start, end).join('');
  33193. }
  33194. /**
  33195. * Removes trailing whitespace or specified characters from `string`.
  33196. *
  33197. * @static
  33198. * @memberOf _
  33199. * @since 4.0.0
  33200. * @category String
  33201. * @param {string} [string=''] The string to trim.
  33202. * @param {string} [chars=whitespace] The characters to trim.
  33203. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33204. * @returns {string} Returns the trimmed string.
  33205. * @example
  33206. *
  33207. * _.trimEnd(' abc ');
  33208. * // => ' abc'
  33209. *
  33210. * _.trimEnd('-_-abc-_-', '_-');
  33211. * // => '-_-abc'
  33212. */
  33213. function trimEnd(string, chars, guard) {
  33214. string = toString(string);
  33215. if (string && (guard || chars === undefined)) {
  33216. return string.replace(reTrimEnd, '');
  33217. }
  33218. if (!string || !(chars = baseToString(chars))) {
  33219. return string;
  33220. }
  33221. var strSymbols = stringToArray(string),
  33222. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  33223. return castSlice(strSymbols, 0, end).join('');
  33224. }
  33225. /**
  33226. * Removes leading whitespace or specified characters from `string`.
  33227. *
  33228. * @static
  33229. * @memberOf _
  33230. * @since 4.0.0
  33231. * @category String
  33232. * @param {string} [string=''] The string to trim.
  33233. * @param {string} [chars=whitespace] The characters to trim.
  33234. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33235. * @returns {string} Returns the trimmed string.
  33236. * @example
  33237. *
  33238. * _.trimStart(' abc ');
  33239. * // => 'abc '
  33240. *
  33241. * _.trimStart('-_-abc-_-', '_-');
  33242. * // => 'abc-_-'
  33243. */
  33244. function trimStart(string, chars, guard) {
  33245. string = toString(string);
  33246. if (string && (guard || chars === undefined)) {
  33247. return string.replace(reTrimStart, '');
  33248. }
  33249. if (!string || !(chars = baseToString(chars))) {
  33250. return string;
  33251. }
  33252. var strSymbols = stringToArray(string),
  33253. start = charsStartIndex(strSymbols, stringToArray(chars));
  33254. return castSlice(strSymbols, start).join('');
  33255. }
  33256. /**
  33257. * Truncates `string` if it's longer than the given maximum string length.
  33258. * The last characters of the truncated string are replaced with the omission
  33259. * string which defaults to "...".
  33260. *
  33261. * @static
  33262. * @memberOf _
  33263. * @since 4.0.0
  33264. * @category String
  33265. * @param {string} [string=''] The string to truncate.
  33266. * @param {Object} [options={}] The options object.
  33267. * @param {number} [options.length=30] The maximum string length.
  33268. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  33269. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  33270. * @returns {string} Returns the truncated string.
  33271. * @example
  33272. *
  33273. * _.truncate('hi-diddly-ho there, neighborino');
  33274. * // => 'hi-diddly-ho there, neighbo...'
  33275. *
  33276. * _.truncate('hi-diddly-ho there, neighborino', {
  33277. * 'length': 24,
  33278. * 'separator': ' '
  33279. * });
  33280. * // => 'hi-diddly-ho there,...'
  33281. *
  33282. * _.truncate('hi-diddly-ho there, neighborino', {
  33283. * 'length': 24,
  33284. * 'separator': /,? +/
  33285. * });
  33286. * // => 'hi-diddly-ho there...'
  33287. *
  33288. * _.truncate('hi-diddly-ho there, neighborino', {
  33289. * 'omission': ' [...]'
  33290. * });
  33291. * // => 'hi-diddly-ho there, neig [...]'
  33292. */
  33293. function truncate(string, options) {
  33294. var length = DEFAULT_TRUNC_LENGTH,
  33295. omission = DEFAULT_TRUNC_OMISSION;
  33296. if (isObject(options)) {
  33297. var separator = 'separator' in options ? options.separator : separator;
  33298. length = 'length' in options ? toInteger(options.length) : length;
  33299. omission = 'omission' in options ? baseToString(options.omission) : omission;
  33300. }
  33301. string = toString(string);
  33302. var strLength = string.length;
  33303. if (hasUnicode(string)) {
  33304. var strSymbols = stringToArray(string);
  33305. strLength = strSymbols.length;
  33306. }
  33307. if (length >= strLength) {
  33308. return string;
  33309. }
  33310. var end = length - stringSize(omission);
  33311. if (end < 1) {
  33312. return omission;
  33313. }
  33314. var result = strSymbols
  33315. ? castSlice(strSymbols, 0, end).join('')
  33316. : string.slice(0, end);
  33317. if (separator === undefined) {
  33318. return result + omission;
  33319. }
  33320. if (strSymbols) {
  33321. end += (result.length - end);
  33322. }
  33323. if (isRegExp(separator)) {
  33324. if (string.slice(end).search(separator)) {
  33325. var match,
  33326. substring = result;
  33327. if (!separator.global) {
  33328. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  33329. }
  33330. separator.lastIndex = 0;
  33331. while ((match = separator.exec(substring))) {
  33332. var newEnd = match.index;
  33333. }
  33334. result = result.slice(0, newEnd === undefined ? end : newEnd);
  33335. }
  33336. } else if (string.indexOf(baseToString(separator), end) != end) {
  33337. var index = result.lastIndexOf(separator);
  33338. if (index > -1) {
  33339. result = result.slice(0, index);
  33340. }
  33341. }
  33342. return result + omission;
  33343. }
  33344. /**
  33345. * The inverse of `_.escape`; this method converts the HTML entities
  33346. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  33347. * their corresponding characters.
  33348. *
  33349. * **Note:** No other HTML entities are unescaped. To unescape additional
  33350. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  33351. *
  33352. * @static
  33353. * @memberOf _
  33354. * @since 0.6.0
  33355. * @category String
  33356. * @param {string} [string=''] The string to unescape.
  33357. * @returns {string} Returns the unescaped string.
  33358. * @example
  33359. *
  33360. * _.unescape('fred, barney, &amp; pebbles');
  33361. * // => 'fred, barney, & pebbles'
  33362. */
  33363. function unescape(string) {
  33364. string = toString(string);
  33365. return (string && reHasEscapedHtml.test(string))
  33366. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  33367. : string;
  33368. }
  33369. /**
  33370. * Converts `string`, as space separated words, to upper case.
  33371. *
  33372. * @static
  33373. * @memberOf _
  33374. * @since 4.0.0
  33375. * @category String
  33376. * @param {string} [string=''] The string to convert.
  33377. * @returns {string} Returns the upper cased string.
  33378. * @example
  33379. *
  33380. * _.upperCase('--foo-bar');
  33381. * // => 'FOO BAR'
  33382. *
  33383. * _.upperCase('fooBar');
  33384. * // => 'FOO BAR'
  33385. *
  33386. * _.upperCase('__foo_bar__');
  33387. * // => 'FOO BAR'
  33388. */
  33389. var upperCase = createCompounder(function(result, word, index) {
  33390. return result + (index ? ' ' : '') + word.toUpperCase();
  33391. });
  33392. /**
  33393. * Converts the first character of `string` to upper case.
  33394. *
  33395. * @static
  33396. * @memberOf _
  33397. * @since 4.0.0
  33398. * @category String
  33399. * @param {string} [string=''] The string to convert.
  33400. * @returns {string} Returns the converted string.
  33401. * @example
  33402. *
  33403. * _.upperFirst('fred');
  33404. * // => 'Fred'
  33405. *
  33406. * _.upperFirst('FRED');
  33407. * // => 'FRED'
  33408. */
  33409. var upperFirst = createCaseFirst('toUpperCase');
  33410. /**
  33411. * Splits `string` into an array of its words.
  33412. *
  33413. * @static
  33414. * @memberOf _
  33415. * @since 3.0.0
  33416. * @category String
  33417. * @param {string} [string=''] The string to inspect.
  33418. * @param {RegExp|string} [pattern] The pattern to match words.
  33419. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  33420. * @returns {Array} Returns the words of `string`.
  33421. * @example
  33422. *
  33423. * _.words('fred, barney, & pebbles');
  33424. * // => ['fred', 'barney', 'pebbles']
  33425. *
  33426. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  33427. * // => ['fred', 'barney', '&', 'pebbles']
  33428. */
  33429. function words(string, pattern, guard) {
  33430. string = toString(string);
  33431. pattern = guard ? undefined : pattern;
  33432. if (pattern === undefined) {
  33433. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  33434. }
  33435. return string.match(pattern) || [];
  33436. }
  33437. /*------------------------------------------------------------------------*/
  33438. /**
  33439. * Attempts to invoke `func`, returning either the result or the caught error
  33440. * object. Any additional arguments are provided to `func` when it's invoked.
  33441. *
  33442. * @static
  33443. * @memberOf _
  33444. * @since 3.0.0
  33445. * @category Util
  33446. * @param {Function} func The function to attempt.
  33447. * @param {...*} [args] The arguments to invoke `func` with.
  33448. * @returns {*} Returns the `func` result or error object.
  33449. * @example
  33450. *
  33451. * // Avoid throwing errors for invalid selectors.
  33452. * var elements = _.attempt(function(selector) {
  33453. * return document.querySelectorAll(selector);
  33454. * }, '>_>');
  33455. *
  33456. * if (_.isError(elements)) {
  33457. * elements = [];
  33458. * }
  33459. */
  33460. var attempt = baseRest(function(func, args) {
  33461. try {
  33462. return apply(func, undefined, args);
  33463. } catch (e) {
  33464. return isError(e) ? e : new Error(e);
  33465. }
  33466. });
  33467. /**
  33468. * Binds methods of an object to the object itself, overwriting the existing
  33469. * method.
  33470. *
  33471. * **Note:** This method doesn't set the "length" property of bound functions.
  33472. *
  33473. * @static
  33474. * @since 0.1.0
  33475. * @memberOf _
  33476. * @category Util
  33477. * @param {Object} object The object to bind and assign the bound methods to.
  33478. * @param {...(string|string[])} methodNames The object method names to bind.
  33479. * @returns {Object} Returns `object`.
  33480. * @example
  33481. *
  33482. * var view = {
  33483. * 'label': 'docs',
  33484. * 'click': function() {
  33485. * console.log('clicked ' + this.label);
  33486. * }
  33487. * };
  33488. *
  33489. * _.bindAll(view, ['click']);
  33490. * jQuery(element).on('click', view.click);
  33491. * // => Logs 'clicked docs' when clicked.
  33492. */
  33493. var bindAll = flatRest(function(object, methodNames) {
  33494. arrayEach(methodNames, function(key) {
  33495. key = toKey(key);
  33496. baseAssignValue(object, key, bind(object[key], object));
  33497. });
  33498. return object;
  33499. });
  33500. /**
  33501. * Creates a function that iterates over `pairs` and invokes the corresponding
  33502. * function of the first predicate to return truthy. The predicate-function
  33503. * pairs are invoked with the `this` binding and arguments of the created
  33504. * function.
  33505. *
  33506. * @static
  33507. * @memberOf _
  33508. * @since 4.0.0
  33509. * @category Util
  33510. * @param {Array} pairs The predicate-function pairs.
  33511. * @returns {Function} Returns the new composite function.
  33512. * @example
  33513. *
  33514. * var func = _.cond([
  33515. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  33516. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  33517. * [_.stubTrue, _.constant('no match')]
  33518. * ]);
  33519. *
  33520. * func({ 'a': 1, 'b': 2 });
  33521. * // => 'matches A'
  33522. *
  33523. * func({ 'a': 0, 'b': 1 });
  33524. * // => 'matches B'
  33525. *
  33526. * func({ 'a': '1', 'b': '2' });
  33527. * // => 'no match'
  33528. */
  33529. function cond(pairs) {
  33530. var length = pairs == null ? 0 : pairs.length,
  33531. toIteratee = getIteratee();
  33532. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  33533. if (typeof pair[1] != 'function') {
  33534. throw new TypeError(FUNC_ERROR_TEXT);
  33535. }
  33536. return [toIteratee(pair[0]), pair[1]];
  33537. });
  33538. return baseRest(function(args) {
  33539. var index = -1;
  33540. while (++index < length) {
  33541. var pair = pairs[index];
  33542. if (apply(pair[0], this, args)) {
  33543. return apply(pair[1], this, args);
  33544. }
  33545. }
  33546. });
  33547. }
  33548. /**
  33549. * Creates a function that invokes the predicate properties of `source` with
  33550. * the corresponding property values of a given object, returning `true` if
  33551. * all predicates return truthy, else `false`.
  33552. *
  33553. * **Note:** The created function is equivalent to `_.conformsTo` with
  33554. * `source` partially applied.
  33555. *
  33556. * @static
  33557. * @memberOf _
  33558. * @since 4.0.0
  33559. * @category Util
  33560. * @param {Object} source The object of property predicates to conform to.
  33561. * @returns {Function} Returns the new spec function.
  33562. * @example
  33563. *
  33564. * var objects = [
  33565. * { 'a': 2, 'b': 1 },
  33566. * { 'a': 1, 'b': 2 }
  33567. * ];
  33568. *
  33569. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  33570. * // => [{ 'a': 1, 'b': 2 }]
  33571. */
  33572. function conforms(source) {
  33573. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  33574. }
  33575. /**
  33576. * Creates a function that returns `value`.
  33577. *
  33578. * @static
  33579. * @memberOf _
  33580. * @since 2.4.0
  33581. * @category Util
  33582. * @param {*} value The value to return from the new function.
  33583. * @returns {Function} Returns the new constant function.
  33584. * @example
  33585. *
  33586. * var objects = _.times(2, _.constant({ 'a': 1 }));
  33587. *
  33588. * console.log(objects);
  33589. * // => [{ 'a': 1 }, { 'a': 1 }]
  33590. *
  33591. * console.log(objects[0] === objects[1]);
  33592. * // => true
  33593. */
  33594. function constant(value) {
  33595. return function() {
  33596. return value;
  33597. };
  33598. }
  33599. /**
  33600. * Checks `value` to determine whether a default value should be returned in
  33601. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  33602. * or `undefined`.
  33603. *
  33604. * @static
  33605. * @memberOf _
  33606. * @since 4.14.0
  33607. * @category Util
  33608. * @param {*} value The value to check.
  33609. * @param {*} defaultValue The default value.
  33610. * @returns {*} Returns the resolved value.
  33611. * @example
  33612. *
  33613. * _.defaultTo(1, 10);
  33614. * // => 1
  33615. *
  33616. * _.defaultTo(undefined, 10);
  33617. * // => 10
  33618. */
  33619. function defaultTo(value, defaultValue) {
  33620. return (value == null || value !== value) ? defaultValue : value;
  33621. }
  33622. /**
  33623. * Creates a function that returns the result of invoking the given functions
  33624. * with the `this` binding of the created function, where each successive
  33625. * invocation is supplied the return value of the previous.
  33626. *
  33627. * @static
  33628. * @memberOf _
  33629. * @since 3.0.0
  33630. * @category Util
  33631. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33632. * @returns {Function} Returns the new composite function.
  33633. * @see _.flowRight
  33634. * @example
  33635. *
  33636. * function square(n) {
  33637. * return n * n;
  33638. * }
  33639. *
  33640. * var addSquare = _.flow([_.add, square]);
  33641. * addSquare(1, 2);
  33642. * // => 9
  33643. */
  33644. var flow = createFlow();
  33645. /**
  33646. * This method is like `_.flow` except that it creates a function that
  33647. * invokes the given functions from right to left.
  33648. *
  33649. * @static
  33650. * @since 3.0.0
  33651. * @memberOf _
  33652. * @category Util
  33653. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  33654. * @returns {Function} Returns the new composite function.
  33655. * @see _.flow
  33656. * @example
  33657. *
  33658. * function square(n) {
  33659. * return n * n;
  33660. * }
  33661. *
  33662. * var addSquare = _.flowRight([square, _.add]);
  33663. * addSquare(1, 2);
  33664. * // => 9
  33665. */
  33666. var flowRight = createFlow(true);
  33667. /**
  33668. * This method returns the first argument it receives.
  33669. *
  33670. * @static
  33671. * @since 0.1.0
  33672. * @memberOf _
  33673. * @category Util
  33674. * @param {*} value Any value.
  33675. * @returns {*} Returns `value`.
  33676. * @example
  33677. *
  33678. * var object = { 'a': 1 };
  33679. *
  33680. * console.log(_.identity(object) === object);
  33681. * // => true
  33682. */
  33683. function identity(value) {
  33684. return value;
  33685. }
  33686. /**
  33687. * Creates a function that invokes `func` with the arguments of the created
  33688. * function. If `func` is a property name, the created function returns the
  33689. * property value for a given element. If `func` is an array or object, the
  33690. * created function returns `true` for elements that contain the equivalent
  33691. * source properties, otherwise it returns `false`.
  33692. *
  33693. * @static
  33694. * @since 4.0.0
  33695. * @memberOf _
  33696. * @category Util
  33697. * @param {*} [func=_.identity] The value to convert to a callback.
  33698. * @returns {Function} Returns the callback.
  33699. * @example
  33700. *
  33701. * var users = [
  33702. * { 'user': 'barney', 'age': 36, 'active': true },
  33703. * { 'user': 'fred', 'age': 40, 'active': false }
  33704. * ];
  33705. *
  33706. * // The `_.matches` iteratee shorthand.
  33707. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  33708. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  33709. *
  33710. * // The `_.matchesProperty` iteratee shorthand.
  33711. * _.filter(users, _.iteratee(['user', 'fred']));
  33712. * // => [{ 'user': 'fred', 'age': 40 }]
  33713. *
  33714. * // The `_.property` iteratee shorthand.
  33715. * _.map(users, _.iteratee('user'));
  33716. * // => ['barney', 'fred']
  33717. *
  33718. * // Create custom iteratee shorthands.
  33719. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  33720. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  33721. * return func.test(string);
  33722. * };
  33723. * });
  33724. *
  33725. * _.filter(['abc', 'def'], /ef/);
  33726. * // => ['def']
  33727. */
  33728. function iteratee(func) {
  33729. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  33730. }
  33731. /**
  33732. * Creates a function that performs a partial deep comparison between a given
  33733. * object and `source`, returning `true` if the given object has equivalent
  33734. * property values, else `false`.
  33735. *
  33736. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  33737. * partially applied.
  33738. *
  33739. * Partial comparisons will match empty array and empty object `source`
  33740. * values against any array or object value, respectively. See `_.isEqual`
  33741. * for a list of supported value comparisons.
  33742. *
  33743. * @static
  33744. * @memberOf _
  33745. * @since 3.0.0
  33746. * @category Util
  33747. * @param {Object} source The object of property values to match.
  33748. * @returns {Function} Returns the new spec function.
  33749. * @example
  33750. *
  33751. * var objects = [
  33752. * { 'a': 1, 'b': 2, 'c': 3 },
  33753. * { 'a': 4, 'b': 5, 'c': 6 }
  33754. * ];
  33755. *
  33756. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  33757. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  33758. */
  33759. function matches(source) {
  33760. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  33761. }
  33762. /**
  33763. * Creates a function that performs a partial deep comparison between the
  33764. * value at `path` of a given object to `srcValue`, returning `true` if the
  33765. * object value is equivalent, else `false`.
  33766. *
  33767. * **Note:** Partial comparisons will match empty array and empty object
  33768. * `srcValue` values against any array or object value, respectively. See
  33769. * `_.isEqual` for a list of supported value comparisons.
  33770. *
  33771. * @static
  33772. * @memberOf _
  33773. * @since 3.2.0
  33774. * @category Util
  33775. * @param {Array|string} path The path of the property to get.
  33776. * @param {*} srcValue The value to match.
  33777. * @returns {Function} Returns the new spec function.
  33778. * @example
  33779. *
  33780. * var objects = [
  33781. * { 'a': 1, 'b': 2, 'c': 3 },
  33782. * { 'a': 4, 'b': 5, 'c': 6 }
  33783. * ];
  33784. *
  33785. * _.find(objects, _.matchesProperty('a', 4));
  33786. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33787. */
  33788. function matchesProperty(path, srcValue) {
  33789. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33790. }
  33791. /**
  33792. * Creates a function that invokes the method at `path` of a given object.
  33793. * Any additional arguments are provided to the invoked method.
  33794. *
  33795. * @static
  33796. * @memberOf _
  33797. * @since 3.7.0
  33798. * @category Util
  33799. * @param {Array|string} path The path of the method to invoke.
  33800. * @param {...*} [args] The arguments to invoke the method with.
  33801. * @returns {Function} Returns the new invoker function.
  33802. * @example
  33803. *
  33804. * var objects = [
  33805. * { 'a': { 'b': _.constant(2) } },
  33806. * { 'a': { 'b': _.constant(1) } }
  33807. * ];
  33808. *
  33809. * _.map(objects, _.method('a.b'));
  33810. * // => [2, 1]
  33811. *
  33812. * _.map(objects, _.method(['a', 'b']));
  33813. * // => [2, 1]
  33814. */
  33815. var method = baseRest(function(path, args) {
  33816. return function(object) {
  33817. return baseInvoke(object, path, args);
  33818. };
  33819. });
  33820. /**
  33821. * The opposite of `_.method`; this method creates a function that invokes
  33822. * the method at a given path of `object`. Any additional arguments are
  33823. * provided to the invoked method.
  33824. *
  33825. * @static
  33826. * @memberOf _
  33827. * @since 3.7.0
  33828. * @category Util
  33829. * @param {Object} object The object to query.
  33830. * @param {...*} [args] The arguments to invoke the method with.
  33831. * @returns {Function} Returns the new invoker function.
  33832. * @example
  33833. *
  33834. * var array = _.times(3, _.constant),
  33835. * object = { 'a': array, 'b': array, 'c': array };
  33836. *
  33837. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33838. * // => [2, 0]
  33839. *
  33840. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33841. * // => [2, 0]
  33842. */
  33843. var methodOf = baseRest(function(object, args) {
  33844. return function(path) {
  33845. return baseInvoke(object, path, args);
  33846. };
  33847. });
  33848. /**
  33849. * Adds all own enumerable string keyed function properties of a source
  33850. * object to the destination object. If `object` is a function, then methods
  33851. * are added to its prototype as well.
  33852. *
  33853. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33854. * avoid conflicts caused by modifying the original.
  33855. *
  33856. * @static
  33857. * @since 0.1.0
  33858. * @memberOf _
  33859. * @category Util
  33860. * @param {Function|Object} [object=lodash] The destination object.
  33861. * @param {Object} source The object of functions to add.
  33862. * @param {Object} [options={}] The options object.
  33863. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33864. * @returns {Function|Object} Returns `object`.
  33865. * @example
  33866. *
  33867. * function vowels(string) {
  33868. * return _.filter(string, function(v) {
  33869. * return /[aeiou]/i.test(v);
  33870. * });
  33871. * }
  33872. *
  33873. * _.mixin({ 'vowels': vowels });
  33874. * _.vowels('fred');
  33875. * // => ['e']
  33876. *
  33877. * _('fred').vowels().value();
  33878. * // => ['e']
  33879. *
  33880. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33881. * _('fred').vowels();
  33882. * // => ['e']
  33883. */
  33884. function mixin(object, source, options) {
  33885. var props = keys(source),
  33886. methodNames = baseFunctions(source, props);
  33887. if (options == null &&
  33888. !(isObject(source) && (methodNames.length || !props.length))) {
  33889. options = source;
  33890. source = object;
  33891. object = this;
  33892. methodNames = baseFunctions(source, keys(source));
  33893. }
  33894. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33895. isFunc = isFunction(object);
  33896. arrayEach(methodNames, function(methodName) {
  33897. var func = source[methodName];
  33898. object[methodName] = func;
  33899. if (isFunc) {
  33900. object.prototype[methodName] = function() {
  33901. var chainAll = this.__chain__;
  33902. if (chain || chainAll) {
  33903. var result = object(this.__wrapped__),
  33904. actions = result.__actions__ = copyArray(this.__actions__);
  33905. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33906. result.__chain__ = chainAll;
  33907. return result;
  33908. }
  33909. return func.apply(object, arrayPush([this.value()], arguments));
  33910. };
  33911. }
  33912. });
  33913. return object;
  33914. }
  33915. /**
  33916. * Reverts the `_` variable to its previous value and returns a reference to
  33917. * the `lodash` function.
  33918. *
  33919. * @static
  33920. * @since 0.1.0
  33921. * @memberOf _
  33922. * @category Util
  33923. * @returns {Function} Returns the `lodash` function.
  33924. * @example
  33925. *
  33926. * var lodash = _.noConflict();
  33927. */
  33928. function noConflict() {
  33929. if (root._ === this) {
  33930. root._ = oldDash;
  33931. }
  33932. return this;
  33933. }
  33934. /**
  33935. * This method returns `undefined`.
  33936. *
  33937. * @static
  33938. * @memberOf _
  33939. * @since 2.3.0
  33940. * @category Util
  33941. * @example
  33942. *
  33943. * _.times(2, _.noop);
  33944. * // => [undefined, undefined]
  33945. */
  33946. function noop() {
  33947. // No operation performed.
  33948. }
  33949. /**
  33950. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33951. * the nth argument from the end is returned.
  33952. *
  33953. * @static
  33954. * @memberOf _
  33955. * @since 4.0.0
  33956. * @category Util
  33957. * @param {number} [n=0] The index of the argument to return.
  33958. * @returns {Function} Returns the new pass-thru function.
  33959. * @example
  33960. *
  33961. * var func = _.nthArg(1);
  33962. * func('a', 'b', 'c', 'd');
  33963. * // => 'b'
  33964. *
  33965. * var func = _.nthArg(-2);
  33966. * func('a', 'b', 'c', 'd');
  33967. * // => 'c'
  33968. */
  33969. function nthArg(n) {
  33970. n = toInteger(n);
  33971. return baseRest(function(args) {
  33972. return baseNth(args, n);
  33973. });
  33974. }
  33975. /**
  33976. * Creates a function that invokes `iteratees` with the arguments it receives
  33977. * and returns their results.
  33978. *
  33979. * @static
  33980. * @memberOf _
  33981. * @since 4.0.0
  33982. * @category Util
  33983. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33984. * The iteratees to invoke.
  33985. * @returns {Function} Returns the new function.
  33986. * @example
  33987. *
  33988. * var func = _.over([Math.max, Math.min]);
  33989. *
  33990. * func(1, 2, 3, 4);
  33991. * // => [4, 1]
  33992. */
  33993. var over = createOver(arrayMap);
  33994. /**
  33995. * Creates a function that checks if **all** of the `predicates` return
  33996. * truthy when invoked with the arguments it receives.
  33997. *
  33998. * @static
  33999. * @memberOf _
  34000. * @since 4.0.0
  34001. * @category Util
  34002. * @param {...(Function|Function[])} [predicates=[_.identity]]
  34003. * The predicates to check.
  34004. * @returns {Function} Returns the new function.
  34005. * @example
  34006. *
  34007. * var func = _.overEvery([Boolean, isFinite]);
  34008. *
  34009. * func('1');
  34010. * // => true
  34011. *
  34012. * func(null);
  34013. * // => false
  34014. *
  34015. * func(NaN);
  34016. * // => false
  34017. */
  34018. var overEvery = createOver(arrayEvery);
  34019. /**
  34020. * Creates a function that checks if **any** of the `predicates` return
  34021. * truthy when invoked with the arguments it receives.
  34022. *
  34023. * @static
  34024. * @memberOf _
  34025. * @since 4.0.0
  34026. * @category Util
  34027. * @param {...(Function|Function[])} [predicates=[_.identity]]
  34028. * The predicates to check.
  34029. * @returns {Function} Returns the new function.
  34030. * @example
  34031. *
  34032. * var func = _.overSome([Boolean, isFinite]);
  34033. *
  34034. * func('1');
  34035. * // => true
  34036. *
  34037. * func(null);
  34038. * // => true
  34039. *
  34040. * func(NaN);
  34041. * // => false
  34042. */
  34043. var overSome = createOver(arraySome);
  34044. /**
  34045. * Creates a function that returns the value at `path` of a given object.
  34046. *
  34047. * @static
  34048. * @memberOf _
  34049. * @since 2.4.0
  34050. * @category Util
  34051. * @param {Array|string} path The path of the property to get.
  34052. * @returns {Function} Returns the new accessor function.
  34053. * @example
  34054. *
  34055. * var objects = [
  34056. * { 'a': { 'b': 2 } },
  34057. * { 'a': { 'b': 1 } }
  34058. * ];
  34059. *
  34060. * _.map(objects, _.property('a.b'));
  34061. * // => [2, 1]
  34062. *
  34063. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  34064. * // => [1, 2]
  34065. */
  34066. function property(path) {
  34067. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  34068. }
  34069. /**
  34070. * The opposite of `_.property`; this method creates a function that returns
  34071. * the value at a given path of `object`.
  34072. *
  34073. * @static
  34074. * @memberOf _
  34075. * @since 3.0.0
  34076. * @category Util
  34077. * @param {Object} object The object to query.
  34078. * @returns {Function} Returns the new accessor function.
  34079. * @example
  34080. *
  34081. * var array = [0, 1, 2],
  34082. * object = { 'a': array, 'b': array, 'c': array };
  34083. *
  34084. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  34085. * // => [2, 0]
  34086. *
  34087. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  34088. * // => [2, 0]
  34089. */
  34090. function propertyOf(object) {
  34091. return function(path) {
  34092. return object == null ? undefined : baseGet(object, path);
  34093. };
  34094. }
  34095. /**
  34096. * Creates an array of numbers (positive and/or negative) progressing from
  34097. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  34098. * `start` is specified without an `end` or `step`. If `end` is not specified,
  34099. * it's set to `start` with `start` then set to `0`.
  34100. *
  34101. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  34102. * floating-point values which can produce unexpected results.
  34103. *
  34104. * @static
  34105. * @since 0.1.0
  34106. * @memberOf _
  34107. * @category Util
  34108. * @param {number} [start=0] The start of the range.
  34109. * @param {number} end The end of the range.
  34110. * @param {number} [step=1] The value to increment or decrement by.
  34111. * @returns {Array} Returns the range of numbers.
  34112. * @see _.inRange, _.rangeRight
  34113. * @example
  34114. *
  34115. * _.range(4);
  34116. * // => [0, 1, 2, 3]
  34117. *
  34118. * _.range(-4);
  34119. * // => [0, -1, -2, -3]
  34120. *
  34121. * _.range(1, 5);
  34122. * // => [1, 2, 3, 4]
  34123. *
  34124. * _.range(0, 20, 5);
  34125. * // => [0, 5, 10, 15]
  34126. *
  34127. * _.range(0, -4, -1);
  34128. * // => [0, -1, -2, -3]
  34129. *
  34130. * _.range(1, 4, 0);
  34131. * // => [1, 1, 1]
  34132. *
  34133. * _.range(0);
  34134. * // => []
  34135. */
  34136. var range = createRange();
  34137. /**
  34138. * This method is like `_.range` except that it populates values in
  34139. * descending order.
  34140. *
  34141. * @static
  34142. * @memberOf _
  34143. * @since 4.0.0
  34144. * @category Util
  34145. * @param {number} [start=0] The start of the range.
  34146. * @param {number} end The end of the range.
  34147. * @param {number} [step=1] The value to increment or decrement by.
  34148. * @returns {Array} Returns the range of numbers.
  34149. * @see _.inRange, _.range
  34150. * @example
  34151. *
  34152. * _.rangeRight(4);
  34153. * // => [3, 2, 1, 0]
  34154. *
  34155. * _.rangeRight(-4);
  34156. * // => [-3, -2, -1, 0]
  34157. *
  34158. * _.rangeRight(1, 5);
  34159. * // => [4, 3, 2, 1]
  34160. *
  34161. * _.rangeRight(0, 20, 5);
  34162. * // => [15, 10, 5, 0]
  34163. *
  34164. * _.rangeRight(0, -4, -1);
  34165. * // => [-3, -2, -1, 0]
  34166. *
  34167. * _.rangeRight(1, 4, 0);
  34168. * // => [1, 1, 1]
  34169. *
  34170. * _.rangeRight(0);
  34171. * // => []
  34172. */
  34173. var rangeRight = createRange(true);
  34174. /**
  34175. * This method returns a new empty array.
  34176. *
  34177. * @static
  34178. * @memberOf _
  34179. * @since 4.13.0
  34180. * @category Util
  34181. * @returns {Array} Returns the new empty array.
  34182. * @example
  34183. *
  34184. * var arrays = _.times(2, _.stubArray);
  34185. *
  34186. * console.log(arrays);
  34187. * // => [[], []]
  34188. *
  34189. * console.log(arrays[0] === arrays[1]);
  34190. * // => false
  34191. */
  34192. function stubArray() {
  34193. return [];
  34194. }
  34195. /**
  34196. * This method returns `false`.
  34197. *
  34198. * @static
  34199. * @memberOf _
  34200. * @since 4.13.0
  34201. * @category Util
  34202. * @returns {boolean} Returns `false`.
  34203. * @example
  34204. *
  34205. * _.times(2, _.stubFalse);
  34206. * // => [false, false]
  34207. */
  34208. function stubFalse() {
  34209. return false;
  34210. }
  34211. /**
  34212. * This method returns a new empty object.
  34213. *
  34214. * @static
  34215. * @memberOf _
  34216. * @since 4.13.0
  34217. * @category Util
  34218. * @returns {Object} Returns the new empty object.
  34219. * @example
  34220. *
  34221. * var objects = _.times(2, _.stubObject);
  34222. *
  34223. * console.log(objects);
  34224. * // => [{}, {}]
  34225. *
  34226. * console.log(objects[0] === objects[1]);
  34227. * // => false
  34228. */
  34229. function stubObject() {
  34230. return {};
  34231. }
  34232. /**
  34233. * This method returns an empty string.
  34234. *
  34235. * @static
  34236. * @memberOf _
  34237. * @since 4.13.0
  34238. * @category Util
  34239. * @returns {string} Returns the empty string.
  34240. * @example
  34241. *
  34242. * _.times(2, _.stubString);
  34243. * // => ['', '']
  34244. */
  34245. function stubString() {
  34246. return '';
  34247. }
  34248. /**
  34249. * This method returns `true`.
  34250. *
  34251. * @static
  34252. * @memberOf _
  34253. * @since 4.13.0
  34254. * @category Util
  34255. * @returns {boolean} Returns `true`.
  34256. * @example
  34257. *
  34258. * _.times(2, _.stubTrue);
  34259. * // => [true, true]
  34260. */
  34261. function stubTrue() {
  34262. return true;
  34263. }
  34264. /**
  34265. * Invokes the iteratee `n` times, returning an array of the results of
  34266. * each invocation. The iteratee is invoked with one argument; (index).
  34267. *
  34268. * @static
  34269. * @since 0.1.0
  34270. * @memberOf _
  34271. * @category Util
  34272. * @param {number} n The number of times to invoke `iteratee`.
  34273. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  34274. * @returns {Array} Returns the array of results.
  34275. * @example
  34276. *
  34277. * _.times(3, String);
  34278. * // => ['0', '1', '2']
  34279. *
  34280. * _.times(4, _.constant(0));
  34281. * // => [0, 0, 0, 0]
  34282. */
  34283. function times(n, iteratee) {
  34284. n = toInteger(n);
  34285. if (n < 1 || n > MAX_SAFE_INTEGER) {
  34286. return [];
  34287. }
  34288. var index = MAX_ARRAY_LENGTH,
  34289. length = nativeMin(n, MAX_ARRAY_LENGTH);
  34290. iteratee = getIteratee(iteratee);
  34291. n -= MAX_ARRAY_LENGTH;
  34292. var result = baseTimes(length, iteratee);
  34293. while (++index < n) {
  34294. iteratee(index);
  34295. }
  34296. return result;
  34297. }
  34298. /**
  34299. * Converts `value` to a property path array.
  34300. *
  34301. * @static
  34302. * @memberOf _
  34303. * @since 4.0.0
  34304. * @category Util
  34305. * @param {*} value The value to convert.
  34306. * @returns {Array} Returns the new property path array.
  34307. * @example
  34308. *
  34309. * _.toPath('a.b.c');
  34310. * // => ['a', 'b', 'c']
  34311. *
  34312. * _.toPath('a[0].b.c');
  34313. * // => ['a', '0', 'b', 'c']
  34314. */
  34315. function toPath(value) {
  34316. if (isArray(value)) {
  34317. return arrayMap(value, toKey);
  34318. }
  34319. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  34320. }
  34321. /**
  34322. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  34323. *
  34324. * @static
  34325. * @since 0.1.0
  34326. * @memberOf _
  34327. * @category Util
  34328. * @param {string} [prefix=''] The value to prefix the ID with.
  34329. * @returns {string} Returns the unique ID.
  34330. * @example
  34331. *
  34332. * _.uniqueId('contact_');
  34333. * // => 'contact_104'
  34334. *
  34335. * _.uniqueId();
  34336. * // => '105'
  34337. */
  34338. function uniqueId(prefix) {
  34339. var id = ++idCounter;
  34340. return toString(prefix) + id;
  34341. }
  34342. /*------------------------------------------------------------------------*/
  34343. /**
  34344. * Adds two numbers.
  34345. *
  34346. * @static
  34347. * @memberOf _
  34348. * @since 3.4.0
  34349. * @category Math
  34350. * @param {number} augend The first number in an addition.
  34351. * @param {number} addend The second number in an addition.
  34352. * @returns {number} Returns the total.
  34353. * @example
  34354. *
  34355. * _.add(6, 4);
  34356. * // => 10
  34357. */
  34358. var add = createMathOperation(function(augend, addend) {
  34359. return augend + addend;
  34360. }, 0);
  34361. /**
  34362. * Computes `number` rounded up to `precision`.
  34363. *
  34364. * @static
  34365. * @memberOf _
  34366. * @since 3.10.0
  34367. * @category Math
  34368. * @param {number} number The number to round up.
  34369. * @param {number} [precision=0] The precision to round up to.
  34370. * @returns {number} Returns the rounded up number.
  34371. * @example
  34372. *
  34373. * _.ceil(4.006);
  34374. * // => 5
  34375. *
  34376. * _.ceil(6.004, 2);
  34377. * // => 6.01
  34378. *
  34379. * _.ceil(6040, -2);
  34380. * // => 6100
  34381. */
  34382. var ceil = createRound('ceil');
  34383. /**
  34384. * Divide two numbers.
  34385. *
  34386. * @static
  34387. * @memberOf _
  34388. * @since 4.7.0
  34389. * @category Math
  34390. * @param {number} dividend The first number in a division.
  34391. * @param {number} divisor The second number in a division.
  34392. * @returns {number} Returns the quotient.
  34393. * @example
  34394. *
  34395. * _.divide(6, 4);
  34396. * // => 1.5
  34397. */
  34398. var divide = createMathOperation(function(dividend, divisor) {
  34399. return dividend / divisor;
  34400. }, 1);
  34401. /**
  34402. * Computes `number` rounded down to `precision`.
  34403. *
  34404. * @static
  34405. * @memberOf _
  34406. * @since 3.10.0
  34407. * @category Math
  34408. * @param {number} number The number to round down.
  34409. * @param {number} [precision=0] The precision to round down to.
  34410. * @returns {number} Returns the rounded down number.
  34411. * @example
  34412. *
  34413. * _.floor(4.006);
  34414. * // => 4
  34415. *
  34416. * _.floor(0.046, 2);
  34417. * // => 0.04
  34418. *
  34419. * _.floor(4060, -2);
  34420. * // => 4000
  34421. */
  34422. var floor = createRound('floor');
  34423. /**
  34424. * Computes the maximum value of `array`. If `array` is empty or falsey,
  34425. * `undefined` is returned.
  34426. *
  34427. * @static
  34428. * @since 0.1.0
  34429. * @memberOf _
  34430. * @category Math
  34431. * @param {Array} array The array to iterate over.
  34432. * @returns {*} Returns the maximum value.
  34433. * @example
  34434. *
  34435. * _.max([4, 2, 8, 6]);
  34436. * // => 8
  34437. *
  34438. * _.max([]);
  34439. * // => undefined
  34440. */
  34441. function max(array) {
  34442. return (array && array.length)
  34443. ? baseExtremum(array, identity, baseGt)
  34444. : undefined;
  34445. }
  34446. /**
  34447. * This method is like `_.max` except that it accepts `iteratee` which is
  34448. * invoked for each element in `array` to generate the criterion by which
  34449. * the value is ranked. The iteratee is invoked with one argument: (value).
  34450. *
  34451. * @static
  34452. * @memberOf _
  34453. * @since 4.0.0
  34454. * @category Math
  34455. * @param {Array} array The array to iterate over.
  34456. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34457. * @returns {*} Returns the maximum value.
  34458. * @example
  34459. *
  34460. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  34461. *
  34462. * _.maxBy(objects, function(o) { return o.n; });
  34463. * // => { 'n': 2 }
  34464. *
  34465. * // The `_.property` iteratee shorthand.
  34466. * _.maxBy(objects, 'n');
  34467. * // => { 'n': 2 }
  34468. */
  34469. function maxBy(array, iteratee) {
  34470. return (array && array.length)
  34471. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  34472. : undefined;
  34473. }
  34474. /**
  34475. * Computes the mean of the values in `array`.
  34476. *
  34477. * @static
  34478. * @memberOf _
  34479. * @since 4.0.0
  34480. * @category Math
  34481. * @param {Array} array The array to iterate over.
  34482. * @returns {number} Returns the mean.
  34483. * @example
  34484. *
  34485. * _.mean([4, 2, 8, 6]);
  34486. * // => 5
  34487. */
  34488. function mean(array) {
  34489. return baseMean(array, identity);
  34490. }
  34491. /**
  34492. * This method is like `_.mean` except that it accepts `iteratee` which is
  34493. * invoked for each element in `array` to generate the value to be averaged.
  34494. * The iteratee is invoked with one argument: (value).
  34495. *
  34496. * @static
  34497. * @memberOf _
  34498. * @since 4.7.0
  34499. * @category Math
  34500. * @param {Array} array The array to iterate over.
  34501. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34502. * @returns {number} Returns the mean.
  34503. * @example
  34504. *
  34505. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34506. *
  34507. * _.meanBy(objects, function(o) { return o.n; });
  34508. * // => 5
  34509. *
  34510. * // The `_.property` iteratee shorthand.
  34511. * _.meanBy(objects, 'n');
  34512. * // => 5
  34513. */
  34514. function meanBy(array, iteratee) {
  34515. return baseMean(array, getIteratee(iteratee, 2));
  34516. }
  34517. /**
  34518. * Computes the minimum value of `array`. If `array` is empty or falsey,
  34519. * `undefined` is returned.
  34520. *
  34521. * @static
  34522. * @since 0.1.0
  34523. * @memberOf _
  34524. * @category Math
  34525. * @param {Array} array The array to iterate over.
  34526. * @returns {*} Returns the minimum value.
  34527. * @example
  34528. *
  34529. * _.min([4, 2, 8, 6]);
  34530. * // => 2
  34531. *
  34532. * _.min([]);
  34533. * // => undefined
  34534. */
  34535. function min(array) {
  34536. return (array && array.length)
  34537. ? baseExtremum(array, identity, baseLt)
  34538. : undefined;
  34539. }
  34540. /**
  34541. * This method is like `_.min` except that it accepts `iteratee` which is
  34542. * invoked for each element in `array` to generate the criterion by which
  34543. * the value is ranked. The iteratee is invoked with one argument: (value).
  34544. *
  34545. * @static
  34546. * @memberOf _
  34547. * @since 4.0.0
  34548. * @category Math
  34549. * @param {Array} array The array to iterate over.
  34550. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34551. * @returns {*} Returns the minimum value.
  34552. * @example
  34553. *
  34554. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  34555. *
  34556. * _.minBy(objects, function(o) { return o.n; });
  34557. * // => { 'n': 1 }
  34558. *
  34559. * // The `_.property` iteratee shorthand.
  34560. * _.minBy(objects, 'n');
  34561. * // => { 'n': 1 }
  34562. */
  34563. function minBy(array, iteratee) {
  34564. return (array && array.length)
  34565. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  34566. : undefined;
  34567. }
  34568. /**
  34569. * Multiply two numbers.
  34570. *
  34571. * @static
  34572. * @memberOf _
  34573. * @since 4.7.0
  34574. * @category Math
  34575. * @param {number} multiplier The first number in a multiplication.
  34576. * @param {number} multiplicand The second number in a multiplication.
  34577. * @returns {number} Returns the product.
  34578. * @example
  34579. *
  34580. * _.multiply(6, 4);
  34581. * // => 24
  34582. */
  34583. var multiply = createMathOperation(function(multiplier, multiplicand) {
  34584. return multiplier * multiplicand;
  34585. }, 1);
  34586. /**
  34587. * Computes `number` rounded to `precision`.
  34588. *
  34589. * @static
  34590. * @memberOf _
  34591. * @since 3.10.0
  34592. * @category Math
  34593. * @param {number} number The number to round.
  34594. * @param {number} [precision=0] The precision to round to.
  34595. * @returns {number} Returns the rounded number.
  34596. * @example
  34597. *
  34598. * _.round(4.006);
  34599. * // => 4
  34600. *
  34601. * _.round(4.006, 2);
  34602. * // => 4.01
  34603. *
  34604. * _.round(4060, -2);
  34605. * // => 4100
  34606. */
  34607. var round = createRound('round');
  34608. /**
  34609. * Subtract two numbers.
  34610. *
  34611. * @static
  34612. * @memberOf _
  34613. * @since 4.0.0
  34614. * @category Math
  34615. * @param {number} minuend The first number in a subtraction.
  34616. * @param {number} subtrahend The second number in a subtraction.
  34617. * @returns {number} Returns the difference.
  34618. * @example
  34619. *
  34620. * _.subtract(6, 4);
  34621. * // => 2
  34622. */
  34623. var subtract = createMathOperation(function(minuend, subtrahend) {
  34624. return minuend - subtrahend;
  34625. }, 0);
  34626. /**
  34627. * Computes the sum of the values in `array`.
  34628. *
  34629. * @static
  34630. * @memberOf _
  34631. * @since 3.4.0
  34632. * @category Math
  34633. * @param {Array} array The array to iterate over.
  34634. * @returns {number} Returns the sum.
  34635. * @example
  34636. *
  34637. * _.sum([4, 2, 8, 6]);
  34638. * // => 20
  34639. */
  34640. function sum(array) {
  34641. return (array && array.length)
  34642. ? baseSum(array, identity)
  34643. : 0;
  34644. }
  34645. /**
  34646. * This method is like `_.sum` except that it accepts `iteratee` which is
  34647. * invoked for each element in `array` to generate the value to be summed.
  34648. * The iteratee is invoked with one argument: (value).
  34649. *
  34650. * @static
  34651. * @memberOf _
  34652. * @since 4.0.0
  34653. * @category Math
  34654. * @param {Array} array The array to iterate over.
  34655. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  34656. * @returns {number} Returns the sum.
  34657. * @example
  34658. *
  34659. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  34660. *
  34661. * _.sumBy(objects, function(o) { return o.n; });
  34662. * // => 20
  34663. *
  34664. * // The `_.property` iteratee shorthand.
  34665. * _.sumBy(objects, 'n');
  34666. * // => 20
  34667. */
  34668. function sumBy(array, iteratee) {
  34669. return (array && array.length)
  34670. ? baseSum(array, getIteratee(iteratee, 2))
  34671. : 0;
  34672. }
  34673. /*------------------------------------------------------------------------*/
  34674. // Add methods that return wrapped values in chain sequences.
  34675. lodash.after = after;
  34676. lodash.ary = ary;
  34677. lodash.assign = assign;
  34678. lodash.assignIn = assignIn;
  34679. lodash.assignInWith = assignInWith;
  34680. lodash.assignWith = assignWith;
  34681. lodash.at = at;
  34682. lodash.before = before;
  34683. lodash.bind = bind;
  34684. lodash.bindAll = bindAll;
  34685. lodash.bindKey = bindKey;
  34686. lodash.castArray = castArray;
  34687. lodash.chain = chain;
  34688. lodash.chunk = chunk;
  34689. lodash.compact = compact;
  34690. lodash.concat = concat;
  34691. lodash.cond = cond;
  34692. lodash.conforms = conforms;
  34693. lodash.constant = constant;
  34694. lodash.countBy = countBy;
  34695. lodash.create = create;
  34696. lodash.curry = curry;
  34697. lodash.curryRight = curryRight;
  34698. lodash.debounce = debounce;
  34699. lodash.defaults = defaults;
  34700. lodash.defaultsDeep = defaultsDeep;
  34701. lodash.defer = defer;
  34702. lodash.delay = delay;
  34703. lodash.difference = difference;
  34704. lodash.differenceBy = differenceBy;
  34705. lodash.differenceWith = differenceWith;
  34706. lodash.drop = drop;
  34707. lodash.dropRight = dropRight;
  34708. lodash.dropRightWhile = dropRightWhile;
  34709. lodash.dropWhile = dropWhile;
  34710. lodash.fill = fill;
  34711. lodash.filter = filter;
  34712. lodash.flatMap = flatMap;
  34713. lodash.flatMapDeep = flatMapDeep;
  34714. lodash.flatMapDepth = flatMapDepth;
  34715. lodash.flatten = flatten;
  34716. lodash.flattenDeep = flattenDeep;
  34717. lodash.flattenDepth = flattenDepth;
  34718. lodash.flip = flip;
  34719. lodash.flow = flow;
  34720. lodash.flowRight = flowRight;
  34721. lodash.fromPairs = fromPairs;
  34722. lodash.functions = functions;
  34723. lodash.functionsIn = functionsIn;
  34724. lodash.groupBy = groupBy;
  34725. lodash.initial = initial;
  34726. lodash.intersection = intersection;
  34727. lodash.intersectionBy = intersectionBy;
  34728. lodash.intersectionWith = intersectionWith;
  34729. lodash.invert = invert;
  34730. lodash.invertBy = invertBy;
  34731. lodash.invokeMap = invokeMap;
  34732. lodash.iteratee = iteratee;
  34733. lodash.keyBy = keyBy;
  34734. lodash.keys = keys;
  34735. lodash.keysIn = keysIn;
  34736. lodash.map = map;
  34737. lodash.mapKeys = mapKeys;
  34738. lodash.mapValues = mapValues;
  34739. lodash.matches = matches;
  34740. lodash.matchesProperty = matchesProperty;
  34741. lodash.memoize = memoize;
  34742. lodash.merge = merge;
  34743. lodash.mergeWith = mergeWith;
  34744. lodash.method = method;
  34745. lodash.methodOf = methodOf;
  34746. lodash.mixin = mixin;
  34747. lodash.negate = negate;
  34748. lodash.nthArg = nthArg;
  34749. lodash.omit = omit;
  34750. lodash.omitBy = omitBy;
  34751. lodash.once = once;
  34752. lodash.orderBy = orderBy;
  34753. lodash.over = over;
  34754. lodash.overArgs = overArgs;
  34755. lodash.overEvery = overEvery;
  34756. lodash.overSome = overSome;
  34757. lodash.partial = partial;
  34758. lodash.partialRight = partialRight;
  34759. lodash.partition = partition;
  34760. lodash.pick = pick;
  34761. lodash.pickBy = pickBy;
  34762. lodash.property = property;
  34763. lodash.propertyOf = propertyOf;
  34764. lodash.pull = pull;
  34765. lodash.pullAll = pullAll;
  34766. lodash.pullAllBy = pullAllBy;
  34767. lodash.pullAllWith = pullAllWith;
  34768. lodash.pullAt = pullAt;
  34769. lodash.range = range;
  34770. lodash.rangeRight = rangeRight;
  34771. lodash.rearg = rearg;
  34772. lodash.reject = reject;
  34773. lodash.remove = remove;
  34774. lodash.rest = rest;
  34775. lodash.reverse = reverse;
  34776. lodash.sampleSize = sampleSize;
  34777. lodash.set = set;
  34778. lodash.setWith = setWith;
  34779. lodash.shuffle = shuffle;
  34780. lodash.slice = slice;
  34781. lodash.sortBy = sortBy;
  34782. lodash.sortedUniq = sortedUniq;
  34783. lodash.sortedUniqBy = sortedUniqBy;
  34784. lodash.split = split;
  34785. lodash.spread = spread;
  34786. lodash.tail = tail;
  34787. lodash.take = take;
  34788. lodash.takeRight = takeRight;
  34789. lodash.takeRightWhile = takeRightWhile;
  34790. lodash.takeWhile = takeWhile;
  34791. lodash.tap = tap;
  34792. lodash.throttle = throttle;
  34793. lodash.thru = thru;
  34794. lodash.toArray = toArray;
  34795. lodash.toPairs = toPairs;
  34796. lodash.toPairsIn = toPairsIn;
  34797. lodash.toPath = toPath;
  34798. lodash.toPlainObject = toPlainObject;
  34799. lodash.transform = transform;
  34800. lodash.unary = unary;
  34801. lodash.union = union;
  34802. lodash.unionBy = unionBy;
  34803. lodash.unionWith = unionWith;
  34804. lodash.uniq = uniq;
  34805. lodash.uniqBy = uniqBy;
  34806. lodash.uniqWith = uniqWith;
  34807. lodash.unset = unset;
  34808. lodash.unzip = unzip;
  34809. lodash.unzipWith = unzipWith;
  34810. lodash.update = update;
  34811. lodash.updateWith = updateWith;
  34812. lodash.values = values;
  34813. lodash.valuesIn = valuesIn;
  34814. lodash.without = without;
  34815. lodash.words = words;
  34816. lodash.wrap = wrap;
  34817. lodash.xor = xor;
  34818. lodash.xorBy = xorBy;
  34819. lodash.xorWith = xorWith;
  34820. lodash.zip = zip;
  34821. lodash.zipObject = zipObject;
  34822. lodash.zipObjectDeep = zipObjectDeep;
  34823. lodash.zipWith = zipWith;
  34824. // Add aliases.
  34825. lodash.entries = toPairs;
  34826. lodash.entriesIn = toPairsIn;
  34827. lodash.extend = assignIn;
  34828. lodash.extendWith = assignInWith;
  34829. // Add methods to `lodash.prototype`.
  34830. mixin(lodash, lodash);
  34831. /*------------------------------------------------------------------------*/
  34832. // Add methods that return unwrapped values in chain sequences.
  34833. lodash.add = add;
  34834. lodash.attempt = attempt;
  34835. lodash.camelCase = camelCase;
  34836. lodash.capitalize = capitalize;
  34837. lodash.ceil = ceil;
  34838. lodash.clamp = clamp;
  34839. lodash.clone = clone;
  34840. lodash.cloneDeep = cloneDeep;
  34841. lodash.cloneDeepWith = cloneDeepWith;
  34842. lodash.cloneWith = cloneWith;
  34843. lodash.conformsTo = conformsTo;
  34844. lodash.deburr = deburr;
  34845. lodash.defaultTo = defaultTo;
  34846. lodash.divide = divide;
  34847. lodash.endsWith = endsWith;
  34848. lodash.eq = eq;
  34849. lodash.escape = escape;
  34850. lodash.escapeRegExp = escapeRegExp;
  34851. lodash.every = every;
  34852. lodash.find = find;
  34853. lodash.findIndex = findIndex;
  34854. lodash.findKey = findKey;
  34855. lodash.findLast = findLast;
  34856. lodash.findLastIndex = findLastIndex;
  34857. lodash.findLastKey = findLastKey;
  34858. lodash.floor = floor;
  34859. lodash.forEach = forEach;
  34860. lodash.forEachRight = forEachRight;
  34861. lodash.forIn = forIn;
  34862. lodash.forInRight = forInRight;
  34863. lodash.forOwn = forOwn;
  34864. lodash.forOwnRight = forOwnRight;
  34865. lodash.get = get;
  34866. lodash.gt = gt;
  34867. lodash.gte = gte;
  34868. lodash.has = has;
  34869. lodash.hasIn = hasIn;
  34870. lodash.head = head;
  34871. lodash.identity = identity;
  34872. lodash.includes = includes;
  34873. lodash.indexOf = indexOf;
  34874. lodash.inRange = inRange;
  34875. lodash.invoke = invoke;
  34876. lodash.isArguments = isArguments;
  34877. lodash.isArray = isArray;
  34878. lodash.isArrayBuffer = isArrayBuffer;
  34879. lodash.isArrayLike = isArrayLike;
  34880. lodash.isArrayLikeObject = isArrayLikeObject;
  34881. lodash.isBoolean = isBoolean;
  34882. lodash.isBuffer = isBuffer;
  34883. lodash.isDate = isDate;
  34884. lodash.isElement = isElement;
  34885. lodash.isEmpty = isEmpty;
  34886. lodash.isEqual = isEqual;
  34887. lodash.isEqualWith = isEqualWith;
  34888. lodash.isError = isError;
  34889. lodash.isFinite = isFinite;
  34890. lodash.isFunction = isFunction;
  34891. lodash.isInteger = isInteger;
  34892. lodash.isLength = isLength;
  34893. lodash.isMap = isMap;
  34894. lodash.isMatch = isMatch;
  34895. lodash.isMatchWith = isMatchWith;
  34896. lodash.isNaN = isNaN;
  34897. lodash.isNative = isNative;
  34898. lodash.isNil = isNil;
  34899. lodash.isNull = isNull;
  34900. lodash.isNumber = isNumber;
  34901. lodash.isObject = isObject;
  34902. lodash.isObjectLike = isObjectLike;
  34903. lodash.isPlainObject = isPlainObject;
  34904. lodash.isRegExp = isRegExp;
  34905. lodash.isSafeInteger = isSafeInteger;
  34906. lodash.isSet = isSet;
  34907. lodash.isString = isString;
  34908. lodash.isSymbol = isSymbol;
  34909. lodash.isTypedArray = isTypedArray;
  34910. lodash.isUndefined = isUndefined;
  34911. lodash.isWeakMap = isWeakMap;
  34912. lodash.isWeakSet = isWeakSet;
  34913. lodash.join = join;
  34914. lodash.kebabCase = kebabCase;
  34915. lodash.last = last;
  34916. lodash.lastIndexOf = lastIndexOf;
  34917. lodash.lowerCase = lowerCase;
  34918. lodash.lowerFirst = lowerFirst;
  34919. lodash.lt = lt;
  34920. lodash.lte = lte;
  34921. lodash.max = max;
  34922. lodash.maxBy = maxBy;
  34923. lodash.mean = mean;
  34924. lodash.meanBy = meanBy;
  34925. lodash.min = min;
  34926. lodash.minBy = minBy;
  34927. lodash.stubArray = stubArray;
  34928. lodash.stubFalse = stubFalse;
  34929. lodash.stubObject = stubObject;
  34930. lodash.stubString = stubString;
  34931. lodash.stubTrue = stubTrue;
  34932. lodash.multiply = multiply;
  34933. lodash.nth = nth;
  34934. lodash.noConflict = noConflict;
  34935. lodash.noop = noop;
  34936. lodash.now = now;
  34937. lodash.pad = pad;
  34938. lodash.padEnd = padEnd;
  34939. lodash.padStart = padStart;
  34940. lodash.parseInt = parseInt;
  34941. lodash.random = random;
  34942. lodash.reduce = reduce;
  34943. lodash.reduceRight = reduceRight;
  34944. lodash.repeat = repeat;
  34945. lodash.replace = replace;
  34946. lodash.result = result;
  34947. lodash.round = round;
  34948. lodash.runInContext = runInContext;
  34949. lodash.sample = sample;
  34950. lodash.size = size;
  34951. lodash.snakeCase = snakeCase;
  34952. lodash.some = some;
  34953. lodash.sortedIndex = sortedIndex;
  34954. lodash.sortedIndexBy = sortedIndexBy;
  34955. lodash.sortedIndexOf = sortedIndexOf;
  34956. lodash.sortedLastIndex = sortedLastIndex;
  34957. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34958. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34959. lodash.startCase = startCase;
  34960. lodash.startsWith = startsWith;
  34961. lodash.subtract = subtract;
  34962. lodash.sum = sum;
  34963. lodash.sumBy = sumBy;
  34964. lodash.template = template;
  34965. lodash.times = times;
  34966. lodash.toFinite = toFinite;
  34967. lodash.toInteger = toInteger;
  34968. lodash.toLength = toLength;
  34969. lodash.toLower = toLower;
  34970. lodash.toNumber = toNumber;
  34971. lodash.toSafeInteger = toSafeInteger;
  34972. lodash.toString = toString;
  34973. lodash.toUpper = toUpper;
  34974. lodash.trim = trim;
  34975. lodash.trimEnd = trimEnd;
  34976. lodash.trimStart = trimStart;
  34977. lodash.truncate = truncate;
  34978. lodash.unescape = unescape;
  34979. lodash.uniqueId = uniqueId;
  34980. lodash.upperCase = upperCase;
  34981. lodash.upperFirst = upperFirst;
  34982. // Add aliases.
  34983. lodash.each = forEach;
  34984. lodash.eachRight = forEachRight;
  34985. lodash.first = head;
  34986. mixin(lodash, (function() {
  34987. var source = {};
  34988. baseForOwn(lodash, function(func, methodName) {
  34989. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34990. source[methodName] = func;
  34991. }
  34992. });
  34993. return source;
  34994. }()), { 'chain': false });
  34995. /*------------------------------------------------------------------------*/
  34996. /**
  34997. * The semantic version number.
  34998. *
  34999. * @static
  35000. * @memberOf _
  35001. * @type {string}
  35002. */
  35003. lodash.VERSION = VERSION;
  35004. // Assign default placeholders.
  35005. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  35006. lodash[methodName].placeholder = lodash;
  35007. });
  35008. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  35009. arrayEach(['drop', 'take'], function(methodName, index) {
  35010. LazyWrapper.prototype[methodName] = function(n) {
  35011. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  35012. var result = (this.__filtered__ && !index)
  35013. ? new LazyWrapper(this)
  35014. : this.clone();
  35015. if (result.__filtered__) {
  35016. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  35017. } else {
  35018. result.__views__.push({
  35019. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  35020. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  35021. });
  35022. }
  35023. return result;
  35024. };
  35025. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  35026. return this.reverse()[methodName](n).reverse();
  35027. };
  35028. });
  35029. // Add `LazyWrapper` methods that accept an `iteratee` value.
  35030. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  35031. var type = index + 1,
  35032. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  35033. LazyWrapper.prototype[methodName] = function(iteratee) {
  35034. var result = this.clone();
  35035. result.__iteratees__.push({
  35036. 'iteratee': getIteratee(iteratee, 3),
  35037. 'type': type
  35038. });
  35039. result.__filtered__ = result.__filtered__ || isFilter;
  35040. return result;
  35041. };
  35042. });
  35043. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  35044. arrayEach(['head', 'last'], function(methodName, index) {
  35045. var takeName = 'take' + (index ? 'Right' : '');
  35046. LazyWrapper.prototype[methodName] = function() {
  35047. return this[takeName](1).value()[0];
  35048. };
  35049. });
  35050. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  35051. arrayEach(['initial', 'tail'], function(methodName, index) {
  35052. var dropName = 'drop' + (index ? '' : 'Right');
  35053. LazyWrapper.prototype[methodName] = function() {
  35054. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  35055. };
  35056. });
  35057. LazyWrapper.prototype.compact = function() {
  35058. return this.filter(identity);
  35059. };
  35060. LazyWrapper.prototype.find = function(predicate) {
  35061. return this.filter(predicate).head();
  35062. };
  35063. LazyWrapper.prototype.findLast = function(predicate) {
  35064. return this.reverse().find(predicate);
  35065. };
  35066. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  35067. if (typeof path == 'function') {
  35068. return new LazyWrapper(this);
  35069. }
  35070. return this.map(function(value) {
  35071. return baseInvoke(value, path, args);
  35072. });
  35073. });
  35074. LazyWrapper.prototype.reject = function(predicate) {
  35075. return this.filter(negate(getIteratee(predicate)));
  35076. };
  35077. LazyWrapper.prototype.slice = function(start, end) {
  35078. start = toInteger(start);
  35079. var result = this;
  35080. if (result.__filtered__ && (start > 0 || end < 0)) {
  35081. return new LazyWrapper(result);
  35082. }
  35083. if (start < 0) {
  35084. result = result.takeRight(-start);
  35085. } else if (start) {
  35086. result = result.drop(start);
  35087. }
  35088. if (end !== undefined) {
  35089. end = toInteger(end);
  35090. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  35091. }
  35092. return result;
  35093. };
  35094. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  35095. return this.reverse().takeWhile(predicate).reverse();
  35096. };
  35097. LazyWrapper.prototype.toArray = function() {
  35098. return this.take(MAX_ARRAY_LENGTH);
  35099. };
  35100. // Add `LazyWrapper` methods to `lodash.prototype`.
  35101. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  35102. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  35103. isTaker = /^(?:head|last)$/.test(methodName),
  35104. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  35105. retUnwrapped = isTaker || /^find/.test(methodName);
  35106. if (!lodashFunc) {
  35107. return;
  35108. }
  35109. lodash.prototype[methodName] = function() {
  35110. var value = this.__wrapped__,
  35111. args = isTaker ? [1] : arguments,
  35112. isLazy = value instanceof LazyWrapper,
  35113. iteratee = args[0],
  35114. useLazy = isLazy || isArray(value);
  35115. var interceptor = function(value) {
  35116. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  35117. return (isTaker && chainAll) ? result[0] : result;
  35118. };
  35119. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  35120. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  35121. isLazy = useLazy = false;
  35122. }
  35123. var chainAll = this.__chain__,
  35124. isHybrid = !!this.__actions__.length,
  35125. isUnwrapped = retUnwrapped && !chainAll,
  35126. onlyLazy = isLazy && !isHybrid;
  35127. if (!retUnwrapped && useLazy) {
  35128. value = onlyLazy ? value : new LazyWrapper(this);
  35129. var result = func.apply(value, args);
  35130. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  35131. return new LodashWrapper(result, chainAll);
  35132. }
  35133. if (isUnwrapped && onlyLazy) {
  35134. return func.apply(this, args);
  35135. }
  35136. result = this.thru(interceptor);
  35137. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  35138. };
  35139. });
  35140. // Add `Array` methods to `lodash.prototype`.
  35141. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  35142. var func = arrayProto[methodName],
  35143. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  35144. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  35145. lodash.prototype[methodName] = function() {
  35146. var args = arguments;
  35147. if (retUnwrapped && !this.__chain__) {
  35148. var value = this.value();
  35149. return func.apply(isArray(value) ? value : [], args);
  35150. }
  35151. return this[chainName](function(value) {
  35152. return func.apply(isArray(value) ? value : [], args);
  35153. });
  35154. };
  35155. });
  35156. // Map minified method names to their real names.
  35157. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  35158. var lodashFunc = lodash[methodName];
  35159. if (lodashFunc) {
  35160. var key = lodashFunc.name + '';
  35161. if (!hasOwnProperty.call(realNames, key)) {
  35162. realNames[key] = [];
  35163. }
  35164. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  35165. }
  35166. });
  35167. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  35168. 'name': 'wrapper',
  35169. 'func': undefined
  35170. }];
  35171. // Add methods to `LazyWrapper`.
  35172. LazyWrapper.prototype.clone = lazyClone;
  35173. LazyWrapper.prototype.reverse = lazyReverse;
  35174. LazyWrapper.prototype.value = lazyValue;
  35175. // Add chain sequence methods to the `lodash` wrapper.
  35176. lodash.prototype.at = wrapperAt;
  35177. lodash.prototype.chain = wrapperChain;
  35178. lodash.prototype.commit = wrapperCommit;
  35179. lodash.prototype.next = wrapperNext;
  35180. lodash.prototype.plant = wrapperPlant;
  35181. lodash.prototype.reverse = wrapperReverse;
  35182. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  35183. // Add lazy aliases.
  35184. lodash.prototype.first = lodash.prototype.head;
  35185. if (symIterator) {
  35186. lodash.prototype[symIterator] = wrapperToIterator;
  35187. }
  35188. return lodash;
  35189. });
  35190. /*--------------------------------------------------------------------------*/
  35191. // Export lodash.
  35192. var _ = runInContext();
  35193. // Some AMD build optimizers, like r.js, check for condition patterns like:
  35194. if (true) {
  35195. // Expose Lodash on the global object to prevent errors when Lodash is
  35196. // loaded by a script tag in the presence of an AMD loader.
  35197. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  35198. // Use `_.noConflict` to remove Lodash from the global object.
  35199. root._ = _;
  35200. // Define as an anonymous module so, through path mapping, it can be
  35201. // referenced as the "underscore" module.
  35202. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  35203. return _;
  35204. }).call(exports, __webpack_require__, exports, module),
  35205. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  35206. }
  35207. // Check for `exports` after `define` in case a build optimizer adds it.
  35208. else {}
  35209. }.call(this));
  35210. /* 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)))
  35211. /***/ }),
  35212. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  35213. /*!***************************************************!*\
  35214. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  35215. \***************************************************/
  35216. /*! exports provided: default */
  35217. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  35218. "use strict";
  35219. __webpack_require__.r(__webpack_exports__);
  35220. /* WEBPACK VAR INJECTION */(function(global) {/**!
  35221. * @fileOverview Kickass library to create and place poppers near their reference elements.
  35222. * @version 1.16.1
  35223. * @license
  35224. * Copyright (c) 2016 Federico Zivolo and contributors
  35225. *
  35226. * Permission is hereby granted, free of charge, to any person obtaining a copy
  35227. * of this software and associated documentation files (the "Software"), to deal
  35228. * in the Software without restriction, including without limitation the rights
  35229. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  35230. * copies of the Software, and to permit persons to whom the Software is
  35231. * furnished to do so, subject to the following conditions:
  35232. *
  35233. * The above copyright notice and this permission notice shall be included in all
  35234. * copies or substantial portions of the Software.
  35235. *
  35236. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  35237. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  35238. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  35239. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  35240. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  35241. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  35242. * SOFTWARE.
  35243. */
  35244. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  35245. var timeoutDuration = function () {
  35246. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  35247. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  35248. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  35249. return 1;
  35250. }
  35251. }
  35252. return 0;
  35253. }();
  35254. function microtaskDebounce(fn) {
  35255. var called = false;
  35256. return function () {
  35257. if (called) {
  35258. return;
  35259. }
  35260. called = true;
  35261. window.Promise.resolve().then(function () {
  35262. called = false;
  35263. fn();
  35264. });
  35265. };
  35266. }
  35267. function taskDebounce(fn) {
  35268. var scheduled = false;
  35269. return function () {
  35270. if (!scheduled) {
  35271. scheduled = true;
  35272. setTimeout(function () {
  35273. scheduled = false;
  35274. fn();
  35275. }, timeoutDuration);
  35276. }
  35277. };
  35278. }
  35279. var supportsMicroTasks = isBrowser && window.Promise;
  35280. /**
  35281. * Create a debounced version of a method, that's asynchronously deferred
  35282. * but called in the minimum time possible.
  35283. *
  35284. * @method
  35285. * @memberof Popper.Utils
  35286. * @argument {Function} fn
  35287. * @returns {Function}
  35288. */
  35289. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  35290. /**
  35291. * Check if the given variable is a function
  35292. * @method
  35293. * @memberof Popper.Utils
  35294. * @argument {Any} functionToCheck - variable to check
  35295. * @returns {Boolean} answer to: is a function?
  35296. */
  35297. function isFunction(functionToCheck) {
  35298. var getType = {};
  35299. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  35300. }
  35301. /**
  35302. * Get CSS computed property of the given element
  35303. * @method
  35304. * @memberof Popper.Utils
  35305. * @argument {Eement} element
  35306. * @argument {String} property
  35307. */
  35308. function getStyleComputedProperty(element, property) {
  35309. if (element.nodeType !== 1) {
  35310. return [];
  35311. }
  35312. // NOTE: 1 DOM access here
  35313. var window = element.ownerDocument.defaultView;
  35314. var css = window.getComputedStyle(element, null);
  35315. return property ? css[property] : css;
  35316. }
  35317. /**
  35318. * Returns the parentNode or the host of the element
  35319. * @method
  35320. * @memberof Popper.Utils
  35321. * @argument {Element} element
  35322. * @returns {Element} parent
  35323. */
  35324. function getParentNode(element) {
  35325. if (element.nodeName === 'HTML') {
  35326. return element;
  35327. }
  35328. return element.parentNode || element.host;
  35329. }
  35330. /**
  35331. * Returns the scrolling parent of the given element
  35332. * @method
  35333. * @memberof Popper.Utils
  35334. * @argument {Element} element
  35335. * @returns {Element} scroll parent
  35336. */
  35337. function getScrollParent(element) {
  35338. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  35339. if (!element) {
  35340. return document.body;
  35341. }
  35342. switch (element.nodeName) {
  35343. case 'HTML':
  35344. case 'BODY':
  35345. return element.ownerDocument.body;
  35346. case '#document':
  35347. return element.body;
  35348. }
  35349. // Firefox want us to check `-x` and `-y` variations as well
  35350. var _getStyleComputedProp = getStyleComputedProperty(element),
  35351. overflow = _getStyleComputedProp.overflow,
  35352. overflowX = _getStyleComputedProp.overflowX,
  35353. overflowY = _getStyleComputedProp.overflowY;
  35354. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  35355. return element;
  35356. }
  35357. return getScrollParent(getParentNode(element));
  35358. }
  35359. /**
  35360. * Returns the reference node of the reference object, or the reference object itself.
  35361. * @method
  35362. * @memberof Popper.Utils
  35363. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  35364. * @returns {Element} parent
  35365. */
  35366. function getReferenceNode(reference) {
  35367. return reference && reference.referenceNode ? reference.referenceNode : reference;
  35368. }
  35369. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  35370. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  35371. /**
  35372. * Determines if the browser is Internet Explorer
  35373. * @method
  35374. * @memberof Popper.Utils
  35375. * @param {Number} version to check
  35376. * @returns {Boolean} isIE
  35377. */
  35378. function isIE(version) {
  35379. if (version === 11) {
  35380. return isIE11;
  35381. }
  35382. if (version === 10) {
  35383. return isIE10;
  35384. }
  35385. return isIE11 || isIE10;
  35386. }
  35387. /**
  35388. * Returns the offset parent of the given element
  35389. * @method
  35390. * @memberof Popper.Utils
  35391. * @argument {Element} element
  35392. * @returns {Element} offset parent
  35393. */
  35394. function getOffsetParent(element) {
  35395. if (!element) {
  35396. return document.documentElement;
  35397. }
  35398. var noOffsetParent = isIE(10) ? document.body : null;
  35399. // NOTE: 1 DOM access here
  35400. var offsetParent = element.offsetParent || null;
  35401. // Skip hidden elements which don't have an offsetParent
  35402. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  35403. offsetParent = (element = element.nextElementSibling).offsetParent;
  35404. }
  35405. var nodeName = offsetParent && offsetParent.nodeName;
  35406. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  35407. return element ? element.ownerDocument.documentElement : document.documentElement;
  35408. }
  35409. // .offsetParent will return the closest TH, TD or TABLE in case
  35410. // no offsetParent is present, I hate this job...
  35411. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  35412. return getOffsetParent(offsetParent);
  35413. }
  35414. return offsetParent;
  35415. }
  35416. function isOffsetContainer(element) {
  35417. var nodeName = element.nodeName;
  35418. if (nodeName === 'BODY') {
  35419. return false;
  35420. }
  35421. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  35422. }
  35423. /**
  35424. * Finds the root node (document, shadowDOM root) of the given element
  35425. * @method
  35426. * @memberof Popper.Utils
  35427. * @argument {Element} node
  35428. * @returns {Element} root node
  35429. */
  35430. function getRoot(node) {
  35431. if (node.parentNode !== null) {
  35432. return getRoot(node.parentNode);
  35433. }
  35434. return node;
  35435. }
  35436. /**
  35437. * Finds the offset parent common to the two provided nodes
  35438. * @method
  35439. * @memberof Popper.Utils
  35440. * @argument {Element} element1
  35441. * @argument {Element} element2
  35442. * @returns {Element} common offset parent
  35443. */
  35444. function findCommonOffsetParent(element1, element2) {
  35445. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35446. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  35447. return document.documentElement;
  35448. }
  35449. // Here we make sure to give as "start" the element that comes first in the DOM
  35450. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  35451. var start = order ? element1 : element2;
  35452. var end = order ? element2 : element1;
  35453. // Get common ancestor container
  35454. var range = document.createRange();
  35455. range.setStart(start, 0);
  35456. range.setEnd(end, 0);
  35457. var commonAncestorContainer = range.commonAncestorContainer;
  35458. // Both nodes are inside #document
  35459. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  35460. if (isOffsetContainer(commonAncestorContainer)) {
  35461. return commonAncestorContainer;
  35462. }
  35463. return getOffsetParent(commonAncestorContainer);
  35464. }
  35465. // one of the nodes is inside shadowDOM, find which one
  35466. var element1root = getRoot(element1);
  35467. if (element1root.host) {
  35468. return findCommonOffsetParent(element1root.host, element2);
  35469. } else {
  35470. return findCommonOffsetParent(element1, getRoot(element2).host);
  35471. }
  35472. }
  35473. /**
  35474. * Gets the scroll value of the given element in the given side (top and left)
  35475. * @method
  35476. * @memberof Popper.Utils
  35477. * @argument {Element} element
  35478. * @argument {String} side `top` or `left`
  35479. * @returns {number} amount of scrolled pixels
  35480. */
  35481. function getScroll(element) {
  35482. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  35483. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  35484. var nodeName = element.nodeName;
  35485. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35486. var html = element.ownerDocument.documentElement;
  35487. var scrollingElement = element.ownerDocument.scrollingElement || html;
  35488. return scrollingElement[upperSide];
  35489. }
  35490. return element[upperSide];
  35491. }
  35492. /*
  35493. * Sum or subtract the element scroll values (left and top) from a given rect object
  35494. * @method
  35495. * @memberof Popper.Utils
  35496. * @param {Object} rect - Rect object you want to change
  35497. * @param {HTMLElement} element - The element from the function reads the scroll values
  35498. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  35499. * @return {Object} rect - The modifier rect object
  35500. */
  35501. function includeScroll(rect, element) {
  35502. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35503. var scrollTop = getScroll(element, 'top');
  35504. var scrollLeft = getScroll(element, 'left');
  35505. var modifier = subtract ? -1 : 1;
  35506. rect.top += scrollTop * modifier;
  35507. rect.bottom += scrollTop * modifier;
  35508. rect.left += scrollLeft * modifier;
  35509. rect.right += scrollLeft * modifier;
  35510. return rect;
  35511. }
  35512. /*
  35513. * Helper to detect borders of a given element
  35514. * @method
  35515. * @memberof Popper.Utils
  35516. * @param {CSSStyleDeclaration} styles
  35517. * Result of `getStyleComputedProperty` on the given element
  35518. * @param {String} axis - `x` or `y`
  35519. * @return {number} borders - The borders size of the given axis
  35520. */
  35521. function getBordersSize(styles, axis) {
  35522. var sideA = axis === 'x' ? 'Left' : 'Top';
  35523. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  35524. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  35525. }
  35526. function getSize(axis, body, html, computedStyle) {
  35527. 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);
  35528. }
  35529. function getWindowSizes(document) {
  35530. var body = document.body;
  35531. var html = document.documentElement;
  35532. var computedStyle = isIE(10) && getComputedStyle(html);
  35533. return {
  35534. height: getSize('Height', body, html, computedStyle),
  35535. width: getSize('Width', body, html, computedStyle)
  35536. };
  35537. }
  35538. var classCallCheck = function (instance, Constructor) {
  35539. if (!(instance instanceof Constructor)) {
  35540. throw new TypeError("Cannot call a class as a function");
  35541. }
  35542. };
  35543. var createClass = function () {
  35544. function defineProperties(target, props) {
  35545. for (var i = 0; i < props.length; i++) {
  35546. var descriptor = props[i];
  35547. descriptor.enumerable = descriptor.enumerable || false;
  35548. descriptor.configurable = true;
  35549. if ("value" in descriptor) descriptor.writable = true;
  35550. Object.defineProperty(target, descriptor.key, descriptor);
  35551. }
  35552. }
  35553. return function (Constructor, protoProps, staticProps) {
  35554. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  35555. if (staticProps) defineProperties(Constructor, staticProps);
  35556. return Constructor;
  35557. };
  35558. }();
  35559. var defineProperty = function (obj, key, value) {
  35560. if (key in obj) {
  35561. Object.defineProperty(obj, key, {
  35562. value: value,
  35563. enumerable: true,
  35564. configurable: true,
  35565. writable: true
  35566. });
  35567. } else {
  35568. obj[key] = value;
  35569. }
  35570. return obj;
  35571. };
  35572. var _extends = Object.assign || function (target) {
  35573. for (var i = 1; i < arguments.length; i++) {
  35574. var source = arguments[i];
  35575. for (var key in source) {
  35576. if (Object.prototype.hasOwnProperty.call(source, key)) {
  35577. target[key] = source[key];
  35578. }
  35579. }
  35580. }
  35581. return target;
  35582. };
  35583. /**
  35584. * Given element offsets, generate an output similar to getBoundingClientRect
  35585. * @method
  35586. * @memberof Popper.Utils
  35587. * @argument {Object} offsets
  35588. * @returns {Object} ClientRect like output
  35589. */
  35590. function getClientRect(offsets) {
  35591. return _extends({}, offsets, {
  35592. right: offsets.left + offsets.width,
  35593. bottom: offsets.top + offsets.height
  35594. });
  35595. }
  35596. /**
  35597. * Get bounding client rect of given element
  35598. * @method
  35599. * @memberof Popper.Utils
  35600. * @param {HTMLElement} element
  35601. * @return {Object} client rect
  35602. */
  35603. function getBoundingClientRect(element) {
  35604. var rect = {};
  35605. // IE10 10 FIX: Please, don't ask, the element isn't
  35606. // considered in DOM in some circumstances...
  35607. // This isn't reproducible in IE10 compatibility mode of IE11
  35608. try {
  35609. if (isIE(10)) {
  35610. rect = element.getBoundingClientRect();
  35611. var scrollTop = getScroll(element, 'top');
  35612. var scrollLeft = getScroll(element, 'left');
  35613. rect.top += scrollTop;
  35614. rect.left += scrollLeft;
  35615. rect.bottom += scrollTop;
  35616. rect.right += scrollLeft;
  35617. } else {
  35618. rect = element.getBoundingClientRect();
  35619. }
  35620. } catch (e) {}
  35621. var result = {
  35622. left: rect.left,
  35623. top: rect.top,
  35624. width: rect.right - rect.left,
  35625. height: rect.bottom - rect.top
  35626. };
  35627. // subtract scrollbar size from sizes
  35628. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  35629. var width = sizes.width || element.clientWidth || result.width;
  35630. var height = sizes.height || element.clientHeight || result.height;
  35631. var horizScrollbar = element.offsetWidth - width;
  35632. var vertScrollbar = element.offsetHeight - height;
  35633. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  35634. // we make this check conditional for performance reasons
  35635. if (horizScrollbar || vertScrollbar) {
  35636. var styles = getStyleComputedProperty(element);
  35637. horizScrollbar -= getBordersSize(styles, 'x');
  35638. vertScrollbar -= getBordersSize(styles, 'y');
  35639. result.width -= horizScrollbar;
  35640. result.height -= vertScrollbar;
  35641. }
  35642. return getClientRect(result);
  35643. }
  35644. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  35645. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  35646. var isIE10 = isIE(10);
  35647. var isHTML = parent.nodeName === 'HTML';
  35648. var childrenRect = getBoundingClientRect(children);
  35649. var parentRect = getBoundingClientRect(parent);
  35650. var scrollParent = getScrollParent(children);
  35651. var styles = getStyleComputedProperty(parent);
  35652. var borderTopWidth = parseFloat(styles.borderTopWidth);
  35653. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  35654. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  35655. if (fixedPosition && isHTML) {
  35656. parentRect.top = Math.max(parentRect.top, 0);
  35657. parentRect.left = Math.max(parentRect.left, 0);
  35658. }
  35659. var offsets = getClientRect({
  35660. top: childrenRect.top - parentRect.top - borderTopWidth,
  35661. left: childrenRect.left - parentRect.left - borderLeftWidth,
  35662. width: childrenRect.width,
  35663. height: childrenRect.height
  35664. });
  35665. offsets.marginTop = 0;
  35666. offsets.marginLeft = 0;
  35667. // Subtract margins of documentElement in case it's being used as parent
  35668. // we do this only on HTML because it's the only element that behaves
  35669. // differently when margins are applied to it. The margins are included in
  35670. // the box of the documentElement, in the other cases not.
  35671. if (!isIE10 && isHTML) {
  35672. var marginTop = parseFloat(styles.marginTop);
  35673. var marginLeft = parseFloat(styles.marginLeft);
  35674. offsets.top -= borderTopWidth - marginTop;
  35675. offsets.bottom -= borderTopWidth - marginTop;
  35676. offsets.left -= borderLeftWidth - marginLeft;
  35677. offsets.right -= borderLeftWidth - marginLeft;
  35678. // Attach marginTop and marginLeft because in some circumstances we may need them
  35679. offsets.marginTop = marginTop;
  35680. offsets.marginLeft = marginLeft;
  35681. }
  35682. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  35683. offsets = includeScroll(offsets, parent);
  35684. }
  35685. return offsets;
  35686. }
  35687. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  35688. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35689. var html = element.ownerDocument.documentElement;
  35690. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  35691. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  35692. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  35693. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  35694. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  35695. var offset = {
  35696. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  35697. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  35698. width: width,
  35699. height: height
  35700. };
  35701. return getClientRect(offset);
  35702. }
  35703. /**
  35704. * Check if the given element is fixed or is inside a fixed parent
  35705. * @method
  35706. * @memberof Popper.Utils
  35707. * @argument {Element} element
  35708. * @argument {Element} customContainer
  35709. * @returns {Boolean} answer to "isFixed?"
  35710. */
  35711. function isFixed(element) {
  35712. var nodeName = element.nodeName;
  35713. if (nodeName === 'BODY' || nodeName === 'HTML') {
  35714. return false;
  35715. }
  35716. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  35717. return true;
  35718. }
  35719. var parentNode = getParentNode(element);
  35720. if (!parentNode) {
  35721. return false;
  35722. }
  35723. return isFixed(parentNode);
  35724. }
  35725. /**
  35726. * Finds the first parent of an element that has a transformed property defined
  35727. * @method
  35728. * @memberof Popper.Utils
  35729. * @argument {Element} element
  35730. * @returns {Element} first transformed parent or documentElement
  35731. */
  35732. function getFixedPositionOffsetParent(element) {
  35733. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  35734. if (!element || !element.parentElement || isIE()) {
  35735. return document.documentElement;
  35736. }
  35737. var el = element.parentElement;
  35738. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  35739. el = el.parentElement;
  35740. }
  35741. return el || document.documentElement;
  35742. }
  35743. /**
  35744. * Computed the boundaries limits and return them
  35745. * @method
  35746. * @memberof Popper.Utils
  35747. * @param {HTMLElement} popper
  35748. * @param {HTMLElement} reference
  35749. * @param {number} padding
  35750. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  35751. * @param {Boolean} fixedPosition - Is in fixed position mode
  35752. * @returns {Object} Coordinates of the boundaries
  35753. */
  35754. function getBoundaries(popper, reference, padding, boundariesElement) {
  35755. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  35756. // NOTE: 1 DOM access here
  35757. var boundaries = { top: 0, left: 0 };
  35758. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35759. // Handle viewport case
  35760. if (boundariesElement === 'viewport') {
  35761. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  35762. } else {
  35763. // Handle other cases based on DOM element used as boundaries
  35764. var boundariesNode = void 0;
  35765. if (boundariesElement === 'scrollParent') {
  35766. boundariesNode = getScrollParent(getParentNode(reference));
  35767. if (boundariesNode.nodeName === 'BODY') {
  35768. boundariesNode = popper.ownerDocument.documentElement;
  35769. }
  35770. } else if (boundariesElement === 'window') {
  35771. boundariesNode = popper.ownerDocument.documentElement;
  35772. } else {
  35773. boundariesNode = boundariesElement;
  35774. }
  35775. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  35776. // In case of HTML, we need a different computation
  35777. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  35778. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  35779. height = _getWindowSizes.height,
  35780. width = _getWindowSizes.width;
  35781. boundaries.top += offsets.top - offsets.marginTop;
  35782. boundaries.bottom = height + offsets.top;
  35783. boundaries.left += offsets.left - offsets.marginLeft;
  35784. boundaries.right = width + offsets.left;
  35785. } else {
  35786. // for all the other DOM elements, this one is good
  35787. boundaries = offsets;
  35788. }
  35789. }
  35790. // Add paddings
  35791. padding = padding || 0;
  35792. var isPaddingNumber = typeof padding === 'number';
  35793. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35794. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35795. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35796. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35797. return boundaries;
  35798. }
  35799. function getArea(_ref) {
  35800. var width = _ref.width,
  35801. height = _ref.height;
  35802. return width * height;
  35803. }
  35804. /**
  35805. * Utility used to transform the `auto` placement to the placement with more
  35806. * available space.
  35807. * @method
  35808. * @memberof Popper.Utils
  35809. * @argument {Object} data - The data object generated by update method
  35810. * @argument {Object} options - Modifiers configuration and options
  35811. * @returns {Object} The data object, properly modified
  35812. */
  35813. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35814. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35815. if (placement.indexOf('auto') === -1) {
  35816. return placement;
  35817. }
  35818. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35819. var rects = {
  35820. top: {
  35821. width: boundaries.width,
  35822. height: refRect.top - boundaries.top
  35823. },
  35824. right: {
  35825. width: boundaries.right - refRect.right,
  35826. height: boundaries.height
  35827. },
  35828. bottom: {
  35829. width: boundaries.width,
  35830. height: boundaries.bottom - refRect.bottom
  35831. },
  35832. left: {
  35833. width: refRect.left - boundaries.left,
  35834. height: boundaries.height
  35835. }
  35836. };
  35837. var sortedAreas = Object.keys(rects).map(function (key) {
  35838. return _extends({
  35839. key: key
  35840. }, rects[key], {
  35841. area: getArea(rects[key])
  35842. });
  35843. }).sort(function (a, b) {
  35844. return b.area - a.area;
  35845. });
  35846. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35847. var width = _ref2.width,
  35848. height = _ref2.height;
  35849. return width >= popper.clientWidth && height >= popper.clientHeight;
  35850. });
  35851. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35852. var variation = placement.split('-')[1];
  35853. return computedPlacement + (variation ? '-' + variation : '');
  35854. }
  35855. /**
  35856. * Get offsets to the reference element
  35857. * @method
  35858. * @memberof Popper.Utils
  35859. * @param {Object} state
  35860. * @param {Element} popper - the popper element
  35861. * @param {Element} reference - the reference element (the popper will be relative to this)
  35862. * @param {Element} fixedPosition - is in fixed position mode
  35863. * @returns {Object} An object containing the offsets which will be applied to the popper
  35864. */
  35865. function getReferenceOffsets(state, popper, reference) {
  35866. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35867. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35868. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35869. }
  35870. /**
  35871. * Get the outer sizes of the given element (offset size + margins)
  35872. * @method
  35873. * @memberof Popper.Utils
  35874. * @argument {Element} element
  35875. * @returns {Object} object containing width and height properties
  35876. */
  35877. function getOuterSizes(element) {
  35878. var window = element.ownerDocument.defaultView;
  35879. var styles = window.getComputedStyle(element);
  35880. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35881. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35882. var result = {
  35883. width: element.offsetWidth + y,
  35884. height: element.offsetHeight + x
  35885. };
  35886. return result;
  35887. }
  35888. /**
  35889. * Get the opposite placement of the given one
  35890. * @method
  35891. * @memberof Popper.Utils
  35892. * @argument {String} placement
  35893. * @returns {String} flipped placement
  35894. */
  35895. function getOppositePlacement(placement) {
  35896. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35897. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35898. return hash[matched];
  35899. });
  35900. }
  35901. /**
  35902. * Get offsets to the popper
  35903. * @method
  35904. * @memberof Popper.Utils
  35905. * @param {Object} position - CSS position the Popper will get applied
  35906. * @param {HTMLElement} popper - the popper element
  35907. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35908. * @param {String} placement - one of the valid placement options
  35909. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35910. */
  35911. function getPopperOffsets(popper, referenceOffsets, placement) {
  35912. placement = placement.split('-')[0];
  35913. // Get popper node sizes
  35914. var popperRect = getOuterSizes(popper);
  35915. // Add position, width and height to our offsets object
  35916. var popperOffsets = {
  35917. width: popperRect.width,
  35918. height: popperRect.height
  35919. };
  35920. // depending by the popper placement we have to compute its offsets slightly differently
  35921. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35922. var mainSide = isHoriz ? 'top' : 'left';
  35923. var secondarySide = isHoriz ? 'left' : 'top';
  35924. var measurement = isHoriz ? 'height' : 'width';
  35925. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35926. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35927. if (placement === secondarySide) {
  35928. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35929. } else {
  35930. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35931. }
  35932. return popperOffsets;
  35933. }
  35934. /**
  35935. * Mimics the `find` method of Array
  35936. * @method
  35937. * @memberof Popper.Utils
  35938. * @argument {Array} arr
  35939. * @argument prop
  35940. * @argument value
  35941. * @returns index or -1
  35942. */
  35943. function find(arr, check) {
  35944. // use native find if supported
  35945. if (Array.prototype.find) {
  35946. return arr.find(check);
  35947. }
  35948. // use `filter` to obtain the same behavior of `find`
  35949. return arr.filter(check)[0];
  35950. }
  35951. /**
  35952. * Return the index of the matching object
  35953. * @method
  35954. * @memberof Popper.Utils
  35955. * @argument {Array} arr
  35956. * @argument prop
  35957. * @argument value
  35958. * @returns index or -1
  35959. */
  35960. function findIndex(arr, prop, value) {
  35961. // use native findIndex if supported
  35962. if (Array.prototype.findIndex) {
  35963. return arr.findIndex(function (cur) {
  35964. return cur[prop] === value;
  35965. });
  35966. }
  35967. // use `find` + `indexOf` if `findIndex` isn't supported
  35968. var match = find(arr, function (obj) {
  35969. return obj[prop] === value;
  35970. });
  35971. return arr.indexOf(match);
  35972. }
  35973. /**
  35974. * Loop trough the list of modifiers and run them in order,
  35975. * each of them will then edit the data object.
  35976. * @method
  35977. * @memberof Popper.Utils
  35978. * @param {dataObject} data
  35979. * @param {Array} modifiers
  35980. * @param {String} ends - Optional modifier name used as stopper
  35981. * @returns {dataObject}
  35982. */
  35983. function runModifiers(modifiers, data, ends) {
  35984. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35985. modifiersToRun.forEach(function (modifier) {
  35986. if (modifier['function']) {
  35987. // eslint-disable-line dot-notation
  35988. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35989. }
  35990. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35991. if (modifier.enabled && isFunction(fn)) {
  35992. // Add properties to offsets to make them a complete clientRect object
  35993. // we do this before each modifier to make sure the previous one doesn't
  35994. // mess with these values
  35995. data.offsets.popper = getClientRect(data.offsets.popper);
  35996. data.offsets.reference = getClientRect(data.offsets.reference);
  35997. data = fn(data, modifier);
  35998. }
  35999. });
  36000. return data;
  36001. }
  36002. /**
  36003. * Updates the position of the popper, computing the new offsets and applying
  36004. * the new style.<br />
  36005. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  36006. * @method
  36007. * @memberof Popper
  36008. */
  36009. function update() {
  36010. // if popper is destroyed, don't perform any further update
  36011. if (this.state.isDestroyed) {
  36012. return;
  36013. }
  36014. var data = {
  36015. instance: this,
  36016. styles: {},
  36017. arrowStyles: {},
  36018. attributes: {},
  36019. flipped: false,
  36020. offsets: {}
  36021. };
  36022. // compute reference element offsets
  36023. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  36024. // compute auto placement, store placement inside the data object,
  36025. // modifiers will be able to edit `placement` if needed
  36026. // and refer to originalPlacement to know the original value
  36027. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  36028. // store the computed placement inside `originalPlacement`
  36029. data.originalPlacement = data.placement;
  36030. data.positionFixed = this.options.positionFixed;
  36031. // compute the popper offsets
  36032. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  36033. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  36034. // run the modifiers
  36035. data = runModifiers(this.modifiers, data);
  36036. // the first `update` will call `onCreate` callback
  36037. // the other ones will call `onUpdate` callback
  36038. if (!this.state.isCreated) {
  36039. this.state.isCreated = true;
  36040. this.options.onCreate(data);
  36041. } else {
  36042. this.options.onUpdate(data);
  36043. }
  36044. }
  36045. /**
  36046. * Helper used to know if the given modifier is enabled.
  36047. * @method
  36048. * @memberof Popper.Utils
  36049. * @returns {Boolean}
  36050. */
  36051. function isModifierEnabled(modifiers, modifierName) {
  36052. return modifiers.some(function (_ref) {
  36053. var name = _ref.name,
  36054. enabled = _ref.enabled;
  36055. return enabled && name === modifierName;
  36056. });
  36057. }
  36058. /**
  36059. * Get the prefixed supported property name
  36060. * @method
  36061. * @memberof Popper.Utils
  36062. * @argument {String} property (camelCase)
  36063. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  36064. */
  36065. function getSupportedPropertyName(property) {
  36066. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  36067. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  36068. for (var i = 0; i < prefixes.length; i++) {
  36069. var prefix = prefixes[i];
  36070. var toCheck = prefix ? '' + prefix + upperProp : property;
  36071. if (typeof document.body.style[toCheck] !== 'undefined') {
  36072. return toCheck;
  36073. }
  36074. }
  36075. return null;
  36076. }
  36077. /**
  36078. * Destroys the popper.
  36079. * @method
  36080. * @memberof Popper
  36081. */
  36082. function destroy() {
  36083. this.state.isDestroyed = true;
  36084. // touch DOM only if `applyStyle` modifier is enabled
  36085. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  36086. this.popper.removeAttribute('x-placement');
  36087. this.popper.style.position = '';
  36088. this.popper.style.top = '';
  36089. this.popper.style.left = '';
  36090. this.popper.style.right = '';
  36091. this.popper.style.bottom = '';
  36092. this.popper.style.willChange = '';
  36093. this.popper.style[getSupportedPropertyName('transform')] = '';
  36094. }
  36095. this.disableEventListeners();
  36096. // remove the popper if user explicitly asked for the deletion on destroy
  36097. // do not use `remove` because IE11 doesn't support it
  36098. if (this.options.removeOnDestroy) {
  36099. this.popper.parentNode.removeChild(this.popper);
  36100. }
  36101. return this;
  36102. }
  36103. /**
  36104. * Get the window associated with the element
  36105. * @argument {Element} element
  36106. * @returns {Window}
  36107. */
  36108. function getWindow(element) {
  36109. var ownerDocument = element.ownerDocument;
  36110. return ownerDocument ? ownerDocument.defaultView : window;
  36111. }
  36112. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  36113. var isBody = scrollParent.nodeName === 'BODY';
  36114. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  36115. target.addEventListener(event, callback, { passive: true });
  36116. if (!isBody) {
  36117. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  36118. }
  36119. scrollParents.push(target);
  36120. }
  36121. /**
  36122. * Setup needed event listeners used to update the popper position
  36123. * @method
  36124. * @memberof Popper.Utils
  36125. * @private
  36126. */
  36127. function setupEventListeners(reference, options, state, updateBound) {
  36128. // Resize event listener on window
  36129. state.updateBound = updateBound;
  36130. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  36131. // Scroll event listener on scroll parents
  36132. var scrollElement = getScrollParent(reference);
  36133. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  36134. state.scrollElement = scrollElement;
  36135. state.eventsEnabled = true;
  36136. return state;
  36137. }
  36138. /**
  36139. * It will add resize/scroll events and start recalculating
  36140. * position of the popper element when they are triggered.
  36141. * @method
  36142. * @memberof Popper
  36143. */
  36144. function enableEventListeners() {
  36145. if (!this.state.eventsEnabled) {
  36146. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  36147. }
  36148. }
  36149. /**
  36150. * Remove event listeners used to update the popper position
  36151. * @method
  36152. * @memberof Popper.Utils
  36153. * @private
  36154. */
  36155. function removeEventListeners(reference, state) {
  36156. // Remove resize event listener on window
  36157. getWindow(reference).removeEventListener('resize', state.updateBound);
  36158. // Remove scroll event listener on scroll parents
  36159. state.scrollParents.forEach(function (target) {
  36160. target.removeEventListener('scroll', state.updateBound);
  36161. });
  36162. // Reset state
  36163. state.updateBound = null;
  36164. state.scrollParents = [];
  36165. state.scrollElement = null;
  36166. state.eventsEnabled = false;
  36167. return state;
  36168. }
  36169. /**
  36170. * It will remove resize/scroll events and won't recalculate popper position
  36171. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  36172. * unless you call `update` method manually.
  36173. * @method
  36174. * @memberof Popper
  36175. */
  36176. function disableEventListeners() {
  36177. if (this.state.eventsEnabled) {
  36178. cancelAnimationFrame(this.scheduleUpdate);
  36179. this.state = removeEventListeners(this.reference, this.state);
  36180. }
  36181. }
  36182. /**
  36183. * Tells if a given input is a number
  36184. * @method
  36185. * @memberof Popper.Utils
  36186. * @param {*} input to check
  36187. * @return {Boolean}
  36188. */
  36189. function isNumeric(n) {
  36190. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  36191. }
  36192. /**
  36193. * Set the style to the given popper
  36194. * @method
  36195. * @memberof Popper.Utils
  36196. * @argument {Element} element - Element to apply the style to
  36197. * @argument {Object} styles
  36198. * Object with a list of properties and values which will be applied to the element
  36199. */
  36200. function setStyles(element, styles) {
  36201. Object.keys(styles).forEach(function (prop) {
  36202. var unit = '';
  36203. // add unit if the value is numeric and is one of the following
  36204. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  36205. unit = 'px';
  36206. }
  36207. element.style[prop] = styles[prop] + unit;
  36208. });
  36209. }
  36210. /**
  36211. * Set the attributes to the given popper
  36212. * @method
  36213. * @memberof Popper.Utils
  36214. * @argument {Element} element - Element to apply the attributes to
  36215. * @argument {Object} styles
  36216. * Object with a list of properties and values which will be applied to the element
  36217. */
  36218. function setAttributes(element, attributes) {
  36219. Object.keys(attributes).forEach(function (prop) {
  36220. var value = attributes[prop];
  36221. if (value !== false) {
  36222. element.setAttribute(prop, attributes[prop]);
  36223. } else {
  36224. element.removeAttribute(prop);
  36225. }
  36226. });
  36227. }
  36228. /**
  36229. * @function
  36230. * @memberof Modifiers
  36231. * @argument {Object} data - The data object generated by `update` method
  36232. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  36233. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  36234. * @argument {Object} options - Modifiers configuration and options
  36235. * @returns {Object} The same data object
  36236. */
  36237. function applyStyle(data) {
  36238. // any property present in `data.styles` will be applied to the popper,
  36239. // in this way we can make the 3rd party modifiers add custom styles to it
  36240. // Be aware, modifiers could override the properties defined in the previous
  36241. // lines of this modifier!
  36242. setStyles(data.instance.popper, data.styles);
  36243. // any property present in `data.attributes` will be applied to the popper,
  36244. // they will be set as HTML attributes of the element
  36245. setAttributes(data.instance.popper, data.attributes);
  36246. // if arrowElement is defined and arrowStyles has some properties
  36247. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  36248. setStyles(data.arrowElement, data.arrowStyles);
  36249. }
  36250. return data;
  36251. }
  36252. /**
  36253. * Set the x-placement attribute before everything else because it could be used
  36254. * to add margins to the popper margins needs to be calculated to get the
  36255. * correct popper offsets.
  36256. * @method
  36257. * @memberof Popper.modifiers
  36258. * @param {HTMLElement} reference - The reference element used to position the popper
  36259. * @param {HTMLElement} popper - The HTML element used as popper
  36260. * @param {Object} options - Popper.js options
  36261. */
  36262. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  36263. // compute reference element offsets
  36264. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  36265. // compute auto placement, store placement inside the data object,
  36266. // modifiers will be able to edit `placement` if needed
  36267. // and refer to originalPlacement to know the original value
  36268. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  36269. popper.setAttribute('x-placement', placement);
  36270. // Apply `position` to popper before anything else because
  36271. // without the position applied we can't guarantee correct computations
  36272. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  36273. return options;
  36274. }
  36275. /**
  36276. * @function
  36277. * @memberof Popper.Utils
  36278. * @argument {Object} data - The data object generated by `update` method
  36279. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  36280. * @returns {Object} The popper's position offsets rounded
  36281. *
  36282. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  36283. * good as it can be within reason.
  36284. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  36285. *
  36286. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  36287. * as well on High DPI screens).
  36288. *
  36289. * Firefox prefers no rounding for positioning and does not have blurriness on
  36290. * high DPI screens.
  36291. *
  36292. * Only horizontal placement and left/right values need to be considered.
  36293. */
  36294. function getRoundedOffsets(data, shouldRound) {
  36295. var _data$offsets = data.offsets,
  36296. popper = _data$offsets.popper,
  36297. reference = _data$offsets.reference;
  36298. var round = Math.round,
  36299. floor = Math.floor;
  36300. var noRound = function noRound(v) {
  36301. return v;
  36302. };
  36303. var referenceWidth = round(reference.width);
  36304. var popperWidth = round(popper.width);
  36305. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  36306. var isVariation = data.placement.indexOf('-') !== -1;
  36307. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  36308. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  36309. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  36310. var verticalToInteger = !shouldRound ? noRound : round;
  36311. return {
  36312. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  36313. top: verticalToInteger(popper.top),
  36314. bottom: verticalToInteger(popper.bottom),
  36315. right: horizontalToInteger(popper.right)
  36316. };
  36317. }
  36318. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  36319. /**
  36320. * @function
  36321. * @memberof Modifiers
  36322. * @argument {Object} data - The data object generated by `update` method
  36323. * @argument {Object} options - Modifiers configuration and options
  36324. * @returns {Object} The data object, properly modified
  36325. */
  36326. function computeStyle(data, options) {
  36327. var x = options.x,
  36328. y = options.y;
  36329. var popper = data.offsets.popper;
  36330. // Remove this legacy support in Popper.js v2
  36331. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  36332. return modifier.name === 'applyStyle';
  36333. }).gpuAcceleration;
  36334. if (legacyGpuAccelerationOption !== undefined) {
  36335. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  36336. }
  36337. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  36338. var offsetParent = getOffsetParent(data.instance.popper);
  36339. var offsetParentRect = getBoundingClientRect(offsetParent);
  36340. // Styles
  36341. var styles = {
  36342. position: popper.position
  36343. };
  36344. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  36345. var sideA = x === 'bottom' ? 'top' : 'bottom';
  36346. var sideB = y === 'right' ? 'left' : 'right';
  36347. // if gpuAcceleration is set to `true` and transform is supported,
  36348. // we use `translate3d` to apply the position to the popper we
  36349. // automatically use the supported prefixed version if needed
  36350. var prefixedProperty = getSupportedPropertyName('transform');
  36351. // now, let's make a step back and look at this code closely (wtf?)
  36352. // If the content of the popper grows once it's been positioned, it
  36353. // may happen that the popper gets misplaced because of the new content
  36354. // overflowing its reference element
  36355. // To avoid this problem, we provide two options (x and y), which allow
  36356. // the consumer to define the offset origin.
  36357. // If we position a popper on top of a reference element, we can set
  36358. // `x` to `top` to make the popper grow towards its top instead of
  36359. // its bottom.
  36360. var left = void 0,
  36361. top = void 0;
  36362. if (sideA === 'bottom') {
  36363. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  36364. // and not the bottom of the html element
  36365. if (offsetParent.nodeName === 'HTML') {
  36366. top = -offsetParent.clientHeight + offsets.bottom;
  36367. } else {
  36368. top = -offsetParentRect.height + offsets.bottom;
  36369. }
  36370. } else {
  36371. top = offsets.top;
  36372. }
  36373. if (sideB === 'right') {
  36374. if (offsetParent.nodeName === 'HTML') {
  36375. left = -offsetParent.clientWidth + offsets.right;
  36376. } else {
  36377. left = -offsetParentRect.width + offsets.right;
  36378. }
  36379. } else {
  36380. left = offsets.left;
  36381. }
  36382. if (gpuAcceleration && prefixedProperty) {
  36383. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  36384. styles[sideA] = 0;
  36385. styles[sideB] = 0;
  36386. styles.willChange = 'transform';
  36387. } else {
  36388. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  36389. var invertTop = sideA === 'bottom' ? -1 : 1;
  36390. var invertLeft = sideB === 'right' ? -1 : 1;
  36391. styles[sideA] = top * invertTop;
  36392. styles[sideB] = left * invertLeft;
  36393. styles.willChange = sideA + ', ' + sideB;
  36394. }
  36395. // Attributes
  36396. var attributes = {
  36397. 'x-placement': data.placement
  36398. };
  36399. // Update `data` attributes, styles and arrowStyles
  36400. data.attributes = _extends({}, attributes, data.attributes);
  36401. data.styles = _extends({}, styles, data.styles);
  36402. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  36403. return data;
  36404. }
  36405. /**
  36406. * Helper used to know if the given modifier depends from another one.<br />
  36407. * It checks if the needed modifier is listed and enabled.
  36408. * @method
  36409. * @memberof Popper.Utils
  36410. * @param {Array} modifiers - list of modifiers
  36411. * @param {String} requestingName - name of requesting modifier
  36412. * @param {String} requestedName - name of requested modifier
  36413. * @returns {Boolean}
  36414. */
  36415. function isModifierRequired(modifiers, requestingName, requestedName) {
  36416. var requesting = find(modifiers, function (_ref) {
  36417. var name = _ref.name;
  36418. return name === requestingName;
  36419. });
  36420. var isRequired = !!requesting && modifiers.some(function (modifier) {
  36421. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  36422. });
  36423. if (!isRequired) {
  36424. var _requesting = '`' + requestingName + '`';
  36425. var requested = '`' + requestedName + '`';
  36426. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  36427. }
  36428. return isRequired;
  36429. }
  36430. /**
  36431. * @function
  36432. * @memberof Modifiers
  36433. * @argument {Object} data - The data object generated by update method
  36434. * @argument {Object} options - Modifiers configuration and options
  36435. * @returns {Object} The data object, properly modified
  36436. */
  36437. function arrow(data, options) {
  36438. var _data$offsets$arrow;
  36439. // arrow depends on keepTogether in order to work
  36440. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  36441. return data;
  36442. }
  36443. var arrowElement = options.element;
  36444. // if arrowElement is a string, suppose it's a CSS selector
  36445. if (typeof arrowElement === 'string') {
  36446. arrowElement = data.instance.popper.querySelector(arrowElement);
  36447. // if arrowElement is not found, don't run the modifier
  36448. if (!arrowElement) {
  36449. return data;
  36450. }
  36451. } else {
  36452. // if the arrowElement isn't a query selector we must check that the
  36453. // provided DOM node is child of its popper node
  36454. if (!data.instance.popper.contains(arrowElement)) {
  36455. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  36456. return data;
  36457. }
  36458. }
  36459. var placement = data.placement.split('-')[0];
  36460. var _data$offsets = data.offsets,
  36461. popper = _data$offsets.popper,
  36462. reference = _data$offsets.reference;
  36463. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  36464. var len = isVertical ? 'height' : 'width';
  36465. var sideCapitalized = isVertical ? 'Top' : 'Left';
  36466. var side = sideCapitalized.toLowerCase();
  36467. var altSide = isVertical ? 'left' : 'top';
  36468. var opSide = isVertical ? 'bottom' : 'right';
  36469. var arrowElementSize = getOuterSizes(arrowElement)[len];
  36470. //
  36471. // extends keepTogether behavior making sure the popper and its
  36472. // reference have enough pixels in conjunction
  36473. //
  36474. // top/left side
  36475. if (reference[opSide] - arrowElementSize < popper[side]) {
  36476. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  36477. }
  36478. // bottom/right side
  36479. if (reference[side] + arrowElementSize > popper[opSide]) {
  36480. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  36481. }
  36482. data.offsets.popper = getClientRect(data.offsets.popper);
  36483. // compute center of the popper
  36484. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  36485. // Compute the sideValue using the updated popper offsets
  36486. // take popper margin in account because we don't have this info available
  36487. var css = getStyleComputedProperty(data.instance.popper);
  36488. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  36489. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  36490. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  36491. // prevent arrowElement from being placed not contiguously to its popper
  36492. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  36493. data.arrowElement = arrowElement;
  36494. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  36495. return data;
  36496. }
  36497. /**
  36498. * Get the opposite placement variation of the given one
  36499. * @method
  36500. * @memberof Popper.Utils
  36501. * @argument {String} placement variation
  36502. * @returns {String} flipped placement variation
  36503. */
  36504. function getOppositeVariation(variation) {
  36505. if (variation === 'end') {
  36506. return 'start';
  36507. } else if (variation === 'start') {
  36508. return 'end';
  36509. }
  36510. return variation;
  36511. }
  36512. /**
  36513. * List of accepted placements to use as values of the `placement` option.<br />
  36514. * Valid placements are:
  36515. * - `auto`
  36516. * - `top`
  36517. * - `right`
  36518. * - `bottom`
  36519. * - `left`
  36520. *
  36521. * Each placement can have a variation from this list:
  36522. * - `-start`
  36523. * - `-end`
  36524. *
  36525. * Variations are interpreted easily if you think of them as the left to right
  36526. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  36527. * is right.<br />
  36528. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  36529. *
  36530. * Some valid examples are:
  36531. * - `top-end` (on top of reference, right aligned)
  36532. * - `right-start` (on right of reference, top aligned)
  36533. * - `bottom` (on bottom, centered)
  36534. * - `auto-end` (on the side with more space available, alignment depends by placement)
  36535. *
  36536. * @static
  36537. * @type {Array}
  36538. * @enum {String}
  36539. * @readonly
  36540. * @method placements
  36541. * @memberof Popper
  36542. */
  36543. 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'];
  36544. // Get rid of `auto` `auto-start` and `auto-end`
  36545. var validPlacements = placements.slice(3);
  36546. /**
  36547. * Given an initial placement, returns all the subsequent placements
  36548. * clockwise (or counter-clockwise).
  36549. *
  36550. * @method
  36551. * @memberof Popper.Utils
  36552. * @argument {String} placement - A valid placement (it accepts variations)
  36553. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  36554. * @returns {Array} placements including their variations
  36555. */
  36556. function clockwise(placement) {
  36557. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  36558. var index = validPlacements.indexOf(placement);
  36559. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  36560. return counter ? arr.reverse() : arr;
  36561. }
  36562. var BEHAVIORS = {
  36563. FLIP: 'flip',
  36564. CLOCKWISE: 'clockwise',
  36565. COUNTERCLOCKWISE: 'counterclockwise'
  36566. };
  36567. /**
  36568. * @function
  36569. * @memberof Modifiers
  36570. * @argument {Object} data - The data object generated by update method
  36571. * @argument {Object} options - Modifiers configuration and options
  36572. * @returns {Object} The data object, properly modified
  36573. */
  36574. function flip(data, options) {
  36575. // if `inner` modifier is enabled, we can't use the `flip` modifier
  36576. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  36577. return data;
  36578. }
  36579. if (data.flipped && data.placement === data.originalPlacement) {
  36580. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  36581. return data;
  36582. }
  36583. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  36584. var placement = data.placement.split('-')[0];
  36585. var placementOpposite = getOppositePlacement(placement);
  36586. var variation = data.placement.split('-')[1] || '';
  36587. var flipOrder = [];
  36588. switch (options.behavior) {
  36589. case BEHAVIORS.FLIP:
  36590. flipOrder = [placement, placementOpposite];
  36591. break;
  36592. case BEHAVIORS.CLOCKWISE:
  36593. flipOrder = clockwise(placement);
  36594. break;
  36595. case BEHAVIORS.COUNTERCLOCKWISE:
  36596. flipOrder = clockwise(placement, true);
  36597. break;
  36598. default:
  36599. flipOrder = options.behavior;
  36600. }
  36601. flipOrder.forEach(function (step, index) {
  36602. if (placement !== step || flipOrder.length === index + 1) {
  36603. return data;
  36604. }
  36605. placement = data.placement.split('-')[0];
  36606. placementOpposite = getOppositePlacement(placement);
  36607. var popperOffsets = data.offsets.popper;
  36608. var refOffsets = data.offsets.reference;
  36609. // using floor because the reference offsets may contain decimals we are not going to consider here
  36610. var floor = Math.floor;
  36611. 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);
  36612. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  36613. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  36614. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  36615. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  36616. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  36617. // flip the variation if required
  36618. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36619. // flips variation if reference element overflows boundaries
  36620. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  36621. // flips variation if popper content overflows boundaries
  36622. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  36623. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  36624. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  36625. // this boolean to detect any flip loop
  36626. data.flipped = true;
  36627. if (overlapsRef || overflowsBoundaries) {
  36628. placement = flipOrder[index + 1];
  36629. }
  36630. if (flippedVariation) {
  36631. variation = getOppositeVariation(variation);
  36632. }
  36633. data.placement = placement + (variation ? '-' + variation : '');
  36634. // this object contains `position`, we want to preserve it along with
  36635. // any additional property we may add in the future
  36636. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  36637. data = runModifiers(data.instance.modifiers, data, 'flip');
  36638. }
  36639. });
  36640. return data;
  36641. }
  36642. /**
  36643. * @function
  36644. * @memberof Modifiers
  36645. * @argument {Object} data - The data object generated by update method
  36646. * @argument {Object} options - Modifiers configuration and options
  36647. * @returns {Object} The data object, properly modified
  36648. */
  36649. function keepTogether(data) {
  36650. var _data$offsets = data.offsets,
  36651. popper = _data$offsets.popper,
  36652. reference = _data$offsets.reference;
  36653. var placement = data.placement.split('-')[0];
  36654. var floor = Math.floor;
  36655. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  36656. var side = isVertical ? 'right' : 'bottom';
  36657. var opSide = isVertical ? 'left' : 'top';
  36658. var measurement = isVertical ? 'width' : 'height';
  36659. if (popper[side] < floor(reference[opSide])) {
  36660. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  36661. }
  36662. if (popper[opSide] > floor(reference[side])) {
  36663. data.offsets.popper[opSide] = floor(reference[side]);
  36664. }
  36665. return data;
  36666. }
  36667. /**
  36668. * Converts a string containing value + unit into a px value number
  36669. * @function
  36670. * @memberof {modifiers~offset}
  36671. * @private
  36672. * @argument {String} str - Value + unit string
  36673. * @argument {String} measurement - `height` or `width`
  36674. * @argument {Object} popperOffsets
  36675. * @argument {Object} referenceOffsets
  36676. * @returns {Number|String}
  36677. * Value in pixels, or original string if no values were extracted
  36678. */
  36679. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  36680. // separate value from unit
  36681. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  36682. var value = +split[1];
  36683. var unit = split[2];
  36684. // If it's not a number it's an operator, I guess
  36685. if (!value) {
  36686. return str;
  36687. }
  36688. if (unit.indexOf('%') === 0) {
  36689. var element = void 0;
  36690. switch (unit) {
  36691. case '%p':
  36692. element = popperOffsets;
  36693. break;
  36694. case '%':
  36695. case '%r':
  36696. default:
  36697. element = referenceOffsets;
  36698. }
  36699. var rect = getClientRect(element);
  36700. return rect[measurement] / 100 * value;
  36701. } else if (unit === 'vh' || unit === 'vw') {
  36702. // if is a vh or vw, we calculate the size based on the viewport
  36703. var size = void 0;
  36704. if (unit === 'vh') {
  36705. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  36706. } else {
  36707. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  36708. }
  36709. return size / 100 * value;
  36710. } else {
  36711. // if is an explicit pixel unit, we get rid of the unit and keep the value
  36712. // if is an implicit unit, it's px, and we return just the value
  36713. return value;
  36714. }
  36715. }
  36716. /**
  36717. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  36718. * @function
  36719. * @memberof {modifiers~offset}
  36720. * @private
  36721. * @argument {String} offset
  36722. * @argument {Object} popperOffsets
  36723. * @argument {Object} referenceOffsets
  36724. * @argument {String} basePlacement
  36725. * @returns {Array} a two cells array with x and y offsets in numbers
  36726. */
  36727. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  36728. var offsets = [0, 0];
  36729. // Use height if placement is left or right and index is 0 otherwise use width
  36730. // in this way the first offset will use an axis and the second one
  36731. // will use the other one
  36732. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  36733. // Split the offset string to obtain a list of values and operands
  36734. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  36735. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  36736. return frag.trim();
  36737. });
  36738. // Detect if the offset string contains a pair of values or a single one
  36739. // they could be separated by comma or space
  36740. var divider = fragments.indexOf(find(fragments, function (frag) {
  36741. return frag.search(/,|\s/) !== -1;
  36742. }));
  36743. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  36744. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  36745. }
  36746. // If divider is found, we divide the list of values and operands to divide
  36747. // them by ofset X and Y.
  36748. var splitRegex = /\s*,\s*|\s+/;
  36749. 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];
  36750. // Convert the values with units to absolute pixels to allow our computations
  36751. ops = ops.map(function (op, index) {
  36752. // Most of the units rely on the orientation of the popper
  36753. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  36754. var mergeWithPrevious = false;
  36755. return op
  36756. // This aggregates any `+` or `-` sign that aren't considered operators
  36757. // e.g.: 10 + +5 => [10, +, +5]
  36758. .reduce(function (a, b) {
  36759. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  36760. a[a.length - 1] = b;
  36761. mergeWithPrevious = true;
  36762. return a;
  36763. } else if (mergeWithPrevious) {
  36764. a[a.length - 1] += b;
  36765. mergeWithPrevious = false;
  36766. return a;
  36767. } else {
  36768. return a.concat(b);
  36769. }
  36770. }, [])
  36771. // Here we convert the string values into number values (in px)
  36772. .map(function (str) {
  36773. return toValue(str, measurement, popperOffsets, referenceOffsets);
  36774. });
  36775. });
  36776. // Loop trough the offsets arrays and execute the operations
  36777. ops.forEach(function (op, index) {
  36778. op.forEach(function (frag, index2) {
  36779. if (isNumeric(frag)) {
  36780. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  36781. }
  36782. });
  36783. });
  36784. return offsets;
  36785. }
  36786. /**
  36787. * @function
  36788. * @memberof Modifiers
  36789. * @argument {Object} data - The data object generated by update method
  36790. * @argument {Object} options - Modifiers configuration and options
  36791. * @argument {Number|String} options.offset=0
  36792. * The offset value as described in the modifier description
  36793. * @returns {Object} The data object, properly modified
  36794. */
  36795. function offset(data, _ref) {
  36796. var offset = _ref.offset;
  36797. var placement = data.placement,
  36798. _data$offsets = data.offsets,
  36799. popper = _data$offsets.popper,
  36800. reference = _data$offsets.reference;
  36801. var basePlacement = placement.split('-')[0];
  36802. var offsets = void 0;
  36803. if (isNumeric(+offset)) {
  36804. offsets = [+offset, 0];
  36805. } else {
  36806. offsets = parseOffset(offset, popper, reference, basePlacement);
  36807. }
  36808. if (basePlacement === 'left') {
  36809. popper.top += offsets[0];
  36810. popper.left -= offsets[1];
  36811. } else if (basePlacement === 'right') {
  36812. popper.top += offsets[0];
  36813. popper.left += offsets[1];
  36814. } else if (basePlacement === 'top') {
  36815. popper.left += offsets[0];
  36816. popper.top -= offsets[1];
  36817. } else if (basePlacement === 'bottom') {
  36818. popper.left += offsets[0];
  36819. popper.top += offsets[1];
  36820. }
  36821. data.popper = popper;
  36822. return data;
  36823. }
  36824. /**
  36825. * @function
  36826. * @memberof Modifiers
  36827. * @argument {Object} data - The data object generated by `update` method
  36828. * @argument {Object} options - Modifiers configuration and options
  36829. * @returns {Object} The data object, properly modified
  36830. */
  36831. function preventOverflow(data, options) {
  36832. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36833. // If offsetParent is the reference element, we really want to
  36834. // go one step up and use the next offsetParent as reference to
  36835. // avoid to make this modifier completely useless and look like broken
  36836. if (data.instance.reference === boundariesElement) {
  36837. boundariesElement = getOffsetParent(boundariesElement);
  36838. }
  36839. // NOTE: DOM access here
  36840. // resets the popper's position so that the document size can be calculated excluding
  36841. // the size of the popper element itself
  36842. var transformProp = getSupportedPropertyName('transform');
  36843. var popperStyles = data.instance.popper.style; // assignment to help minification
  36844. var top = popperStyles.top,
  36845. left = popperStyles.left,
  36846. transform = popperStyles[transformProp];
  36847. popperStyles.top = '';
  36848. popperStyles.left = '';
  36849. popperStyles[transformProp] = '';
  36850. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36851. // NOTE: DOM access here
  36852. // restores the original style properties after the offsets have been computed
  36853. popperStyles.top = top;
  36854. popperStyles.left = left;
  36855. popperStyles[transformProp] = transform;
  36856. options.boundaries = boundaries;
  36857. var order = options.priority;
  36858. var popper = data.offsets.popper;
  36859. var check = {
  36860. primary: function primary(placement) {
  36861. var value = popper[placement];
  36862. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36863. value = Math.max(popper[placement], boundaries[placement]);
  36864. }
  36865. return defineProperty({}, placement, value);
  36866. },
  36867. secondary: function secondary(placement) {
  36868. var mainSide = placement === 'right' ? 'left' : 'top';
  36869. var value = popper[mainSide];
  36870. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36871. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36872. }
  36873. return defineProperty({}, mainSide, value);
  36874. }
  36875. };
  36876. order.forEach(function (placement) {
  36877. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36878. popper = _extends({}, popper, check[side](placement));
  36879. });
  36880. data.offsets.popper = popper;
  36881. return data;
  36882. }
  36883. /**
  36884. * @function
  36885. * @memberof Modifiers
  36886. * @argument {Object} data - The data object generated by `update` method
  36887. * @argument {Object} options - Modifiers configuration and options
  36888. * @returns {Object} The data object, properly modified
  36889. */
  36890. function shift(data) {
  36891. var placement = data.placement;
  36892. var basePlacement = placement.split('-')[0];
  36893. var shiftvariation = placement.split('-')[1];
  36894. // if shift shiftvariation is specified, run the modifier
  36895. if (shiftvariation) {
  36896. var _data$offsets = data.offsets,
  36897. reference = _data$offsets.reference,
  36898. popper = _data$offsets.popper;
  36899. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36900. var side = isVertical ? 'left' : 'top';
  36901. var measurement = isVertical ? 'width' : 'height';
  36902. var shiftOffsets = {
  36903. start: defineProperty({}, side, reference[side]),
  36904. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36905. };
  36906. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36907. }
  36908. return data;
  36909. }
  36910. /**
  36911. * @function
  36912. * @memberof Modifiers
  36913. * @argument {Object} data - The data object generated by update method
  36914. * @argument {Object} options - Modifiers configuration and options
  36915. * @returns {Object} The data object, properly modified
  36916. */
  36917. function hide(data) {
  36918. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36919. return data;
  36920. }
  36921. var refRect = data.offsets.reference;
  36922. var bound = find(data.instance.modifiers, function (modifier) {
  36923. return modifier.name === 'preventOverflow';
  36924. }).boundaries;
  36925. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36926. // Avoid unnecessary DOM access if visibility hasn't changed
  36927. if (data.hide === true) {
  36928. return data;
  36929. }
  36930. data.hide = true;
  36931. data.attributes['x-out-of-boundaries'] = '';
  36932. } else {
  36933. // Avoid unnecessary DOM access if visibility hasn't changed
  36934. if (data.hide === false) {
  36935. return data;
  36936. }
  36937. data.hide = false;
  36938. data.attributes['x-out-of-boundaries'] = false;
  36939. }
  36940. return data;
  36941. }
  36942. /**
  36943. * @function
  36944. * @memberof Modifiers
  36945. * @argument {Object} data - The data object generated by `update` method
  36946. * @argument {Object} options - Modifiers configuration and options
  36947. * @returns {Object} The data object, properly modified
  36948. */
  36949. function inner(data) {
  36950. var placement = data.placement;
  36951. var basePlacement = placement.split('-')[0];
  36952. var _data$offsets = data.offsets,
  36953. popper = _data$offsets.popper,
  36954. reference = _data$offsets.reference;
  36955. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36956. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36957. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36958. data.placement = getOppositePlacement(placement);
  36959. data.offsets.popper = getClientRect(popper);
  36960. return data;
  36961. }
  36962. /**
  36963. * Modifier function, each modifier can have a function of this type assigned
  36964. * to its `fn` property.<br />
  36965. * These functions will be called on each update, this means that you must
  36966. * make sure they are performant enough to avoid performance bottlenecks.
  36967. *
  36968. * @function ModifierFn
  36969. * @argument {dataObject} data - The data object generated by `update` method
  36970. * @argument {Object} options - Modifiers configuration and options
  36971. * @returns {dataObject} The data object, properly modified
  36972. */
  36973. /**
  36974. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36975. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36976. * needed by the library.
  36977. *
  36978. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36979. * All the other properties are configurations that could be tweaked.
  36980. * @namespace modifiers
  36981. */
  36982. var modifiers = {
  36983. /**
  36984. * Modifier used to shift the popper on the start or end of its reference
  36985. * element.<br />
  36986. * It will read the variation of the `placement` property.<br />
  36987. * It can be one either `-end` or `-start`.
  36988. * @memberof modifiers
  36989. * @inner
  36990. */
  36991. shift: {
  36992. /** @prop {number} order=100 - Index used to define the order of execution */
  36993. order: 100,
  36994. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36995. enabled: true,
  36996. /** @prop {ModifierFn} */
  36997. fn: shift
  36998. },
  36999. /**
  37000. * The `offset` modifier can shift your popper on both its axis.
  37001. *
  37002. * It accepts the following units:
  37003. * - `px` or unit-less, interpreted as pixels
  37004. * - `%` or `%r`, percentage relative to the length of the reference element
  37005. * - `%p`, percentage relative to the length of the popper element
  37006. * - `vw`, CSS viewport width unit
  37007. * - `vh`, CSS viewport height unit
  37008. *
  37009. * For length is intended the main axis relative to the placement of the popper.<br />
  37010. * This means that if the placement is `top` or `bottom`, the length will be the
  37011. * `width`. In case of `left` or `right`, it will be the `height`.
  37012. *
  37013. * You can provide a single value (as `Number` or `String`), or a pair of values
  37014. * as `String` divided by a comma or one (or more) white spaces.<br />
  37015. * The latter is a deprecated method because it leads to confusion and will be
  37016. * removed in v2.<br />
  37017. * Additionally, it accepts additions and subtractions between different units.
  37018. * Note that multiplications and divisions aren't supported.
  37019. *
  37020. * Valid examples are:
  37021. * ```
  37022. * 10
  37023. * '10%'
  37024. * '10, 10'
  37025. * '10%, 10'
  37026. * '10 + 10%'
  37027. * '10 - 5vh + 3%'
  37028. * '-10px + 5vh, 5px - 6%'
  37029. * ```
  37030. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  37031. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  37032. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  37033. *
  37034. * @memberof modifiers
  37035. * @inner
  37036. */
  37037. offset: {
  37038. /** @prop {number} order=200 - Index used to define the order of execution */
  37039. order: 200,
  37040. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37041. enabled: true,
  37042. /** @prop {ModifierFn} */
  37043. fn: offset,
  37044. /** @prop {Number|String} offset=0
  37045. * The offset value as described in the modifier description
  37046. */
  37047. offset: 0
  37048. },
  37049. /**
  37050. * Modifier used to prevent the popper from being positioned outside the boundary.
  37051. *
  37052. * A scenario exists where the reference itself is not within the boundaries.<br />
  37053. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  37054. * In this case we need to decide whether the popper should either:
  37055. *
  37056. * - detach from the reference and remain "trapped" in the boundaries, or
  37057. * - if it should ignore the boundary and "escape with its reference"
  37058. *
  37059. * When `escapeWithReference` is set to`true` and reference is completely
  37060. * outside its boundaries, the popper will overflow (or completely leave)
  37061. * the boundaries in order to remain attached to the edge of the reference.
  37062. *
  37063. * @memberof modifiers
  37064. * @inner
  37065. */
  37066. preventOverflow: {
  37067. /** @prop {number} order=300 - Index used to define the order of execution */
  37068. order: 300,
  37069. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37070. enabled: true,
  37071. /** @prop {ModifierFn} */
  37072. fn: preventOverflow,
  37073. /**
  37074. * @prop {Array} [priority=['left','right','top','bottom']]
  37075. * Popper will try to prevent overflow following these priorities by default,
  37076. * then, it could overflow on the left and on top of the `boundariesElement`
  37077. */
  37078. priority: ['left', 'right', 'top', 'bottom'],
  37079. /**
  37080. * @prop {number} padding=5
  37081. * Amount of pixel used to define a minimum distance between the boundaries
  37082. * and the popper. This makes sure the popper always has a little padding
  37083. * between the edges of its container
  37084. */
  37085. padding: 5,
  37086. /**
  37087. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  37088. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  37089. * `viewport` or any DOM element.
  37090. */
  37091. boundariesElement: 'scrollParent'
  37092. },
  37093. /**
  37094. * Modifier used to make sure the reference and its popper stay near each other
  37095. * without leaving any gap between the two. Especially useful when the arrow is
  37096. * enabled and you want to ensure that it points to its reference element.
  37097. * It cares only about the first axis. You can still have poppers with margin
  37098. * between the popper and its reference element.
  37099. * @memberof modifiers
  37100. * @inner
  37101. */
  37102. keepTogether: {
  37103. /** @prop {number} order=400 - Index used to define the order of execution */
  37104. order: 400,
  37105. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37106. enabled: true,
  37107. /** @prop {ModifierFn} */
  37108. fn: keepTogether
  37109. },
  37110. /**
  37111. * This modifier is used to move the `arrowElement` of the popper to make
  37112. * sure it is positioned between the reference element and its popper element.
  37113. * It will read the outer size of the `arrowElement` node to detect how many
  37114. * pixels of conjunction are needed.
  37115. *
  37116. * It has no effect if no `arrowElement` is provided.
  37117. * @memberof modifiers
  37118. * @inner
  37119. */
  37120. arrow: {
  37121. /** @prop {number} order=500 - Index used to define the order of execution */
  37122. order: 500,
  37123. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37124. enabled: true,
  37125. /** @prop {ModifierFn} */
  37126. fn: arrow,
  37127. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  37128. element: '[x-arrow]'
  37129. },
  37130. /**
  37131. * Modifier used to flip the popper's placement when it starts to overlap its
  37132. * reference element.
  37133. *
  37134. * Requires the `preventOverflow` modifier before it in order to work.
  37135. *
  37136. * **NOTE:** this modifier will interrupt the current update cycle and will
  37137. * restart it if it detects the need to flip the placement.
  37138. * @memberof modifiers
  37139. * @inner
  37140. */
  37141. flip: {
  37142. /** @prop {number} order=600 - Index used to define the order of execution */
  37143. order: 600,
  37144. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37145. enabled: true,
  37146. /** @prop {ModifierFn} */
  37147. fn: flip,
  37148. /**
  37149. * @prop {String|Array} behavior='flip'
  37150. * The behavior used to change the popper's placement. It can be one of
  37151. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  37152. * placements (with optional variations)
  37153. */
  37154. behavior: 'flip',
  37155. /**
  37156. * @prop {number} padding=5
  37157. * The popper will flip if it hits the edges of the `boundariesElement`
  37158. */
  37159. padding: 5,
  37160. /**
  37161. * @prop {String|HTMLElement} boundariesElement='viewport'
  37162. * The element which will define the boundaries of the popper position.
  37163. * The popper will never be placed outside of the defined boundaries
  37164. * (except if `keepTogether` is enabled)
  37165. */
  37166. boundariesElement: 'viewport',
  37167. /**
  37168. * @prop {Boolean} flipVariations=false
  37169. * The popper will switch placement variation between `-start` and `-end` when
  37170. * the reference element overlaps its boundaries.
  37171. *
  37172. * The original placement should have a set variation.
  37173. */
  37174. flipVariations: false,
  37175. /**
  37176. * @prop {Boolean} flipVariationsByContent=false
  37177. * The popper will switch placement variation between `-start` and `-end` when
  37178. * the popper element overlaps its reference boundaries.
  37179. *
  37180. * The original placement should have a set variation.
  37181. */
  37182. flipVariationsByContent: false
  37183. },
  37184. /**
  37185. * Modifier used to make the popper flow toward the inner of the reference element.
  37186. * By default, when this modifier is disabled, the popper will be placed outside
  37187. * the reference element.
  37188. * @memberof modifiers
  37189. * @inner
  37190. */
  37191. inner: {
  37192. /** @prop {number} order=700 - Index used to define the order of execution */
  37193. order: 700,
  37194. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  37195. enabled: false,
  37196. /** @prop {ModifierFn} */
  37197. fn: inner
  37198. },
  37199. /**
  37200. * Modifier used to hide the popper when its reference element is outside of the
  37201. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  37202. * be used to hide with a CSS selector the popper when its reference is
  37203. * out of boundaries.
  37204. *
  37205. * Requires the `preventOverflow` modifier before it in order to work.
  37206. * @memberof modifiers
  37207. * @inner
  37208. */
  37209. hide: {
  37210. /** @prop {number} order=800 - Index used to define the order of execution */
  37211. order: 800,
  37212. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37213. enabled: true,
  37214. /** @prop {ModifierFn} */
  37215. fn: hide
  37216. },
  37217. /**
  37218. * Computes the style that will be applied to the popper element to gets
  37219. * properly positioned.
  37220. *
  37221. * Note that this modifier will not touch the DOM, it just prepares the styles
  37222. * so that `applyStyle` modifier can apply it. This separation is useful
  37223. * in case you need to replace `applyStyle` with a custom implementation.
  37224. *
  37225. * This modifier has `850` as `order` value to maintain backward compatibility
  37226. * with previous versions of Popper.js. Expect the modifiers ordering method
  37227. * to change in future major versions of the library.
  37228. *
  37229. * @memberof modifiers
  37230. * @inner
  37231. */
  37232. computeStyle: {
  37233. /** @prop {number} order=850 - Index used to define the order of execution */
  37234. order: 850,
  37235. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37236. enabled: true,
  37237. /** @prop {ModifierFn} */
  37238. fn: computeStyle,
  37239. /**
  37240. * @prop {Boolean} gpuAcceleration=true
  37241. * If true, it uses the CSS 3D transformation to position the popper.
  37242. * Otherwise, it will use the `top` and `left` properties
  37243. */
  37244. gpuAcceleration: true,
  37245. /**
  37246. * @prop {string} [x='bottom']
  37247. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  37248. * Change this if your popper should grow in a direction different from `bottom`
  37249. */
  37250. x: 'bottom',
  37251. /**
  37252. * @prop {string} [x='left']
  37253. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  37254. * Change this if your popper should grow in a direction different from `right`
  37255. */
  37256. y: 'right'
  37257. },
  37258. /**
  37259. * Applies the computed styles to the popper element.
  37260. *
  37261. * All the DOM manipulations are limited to this modifier. This is useful in case
  37262. * you want to integrate Popper.js inside a framework or view library and you
  37263. * want to delegate all the DOM manipulations to it.
  37264. *
  37265. * Note that if you disable this modifier, you must make sure the popper element
  37266. * has its position set to `absolute` before Popper.js can do its work!
  37267. *
  37268. * Just disable this modifier and define your own to achieve the desired effect.
  37269. *
  37270. * @memberof modifiers
  37271. * @inner
  37272. */
  37273. applyStyle: {
  37274. /** @prop {number} order=900 - Index used to define the order of execution */
  37275. order: 900,
  37276. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  37277. enabled: true,
  37278. /** @prop {ModifierFn} */
  37279. fn: applyStyle,
  37280. /** @prop {Function} */
  37281. onLoad: applyStyleOnLoad,
  37282. /**
  37283. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  37284. * @prop {Boolean} gpuAcceleration=true
  37285. * If true, it uses the CSS 3D transformation to position the popper.
  37286. * Otherwise, it will use the `top` and `left` properties
  37287. */
  37288. gpuAcceleration: undefined
  37289. }
  37290. };
  37291. /**
  37292. * The `dataObject` is an object containing all the information used by Popper.js.
  37293. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  37294. * @name dataObject
  37295. * @property {Object} data.instance The Popper.js instance
  37296. * @property {String} data.placement Placement applied to popper
  37297. * @property {String} data.originalPlacement Placement originally defined on init
  37298. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  37299. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  37300. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  37301. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  37302. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  37303. * @property {Object} data.boundaries Offsets of the popper boundaries
  37304. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  37305. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  37306. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  37307. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  37308. */
  37309. /**
  37310. * Default options provided to Popper.js constructor.<br />
  37311. * These can be overridden using the `options` argument of Popper.js.<br />
  37312. * To override an option, simply pass an object with the same
  37313. * structure of the `options` object, as the 3rd argument. For example:
  37314. * ```
  37315. * new Popper(ref, pop, {
  37316. * modifiers: {
  37317. * preventOverflow: { enabled: false }
  37318. * }
  37319. * })
  37320. * ```
  37321. * @type {Object}
  37322. * @static
  37323. * @memberof Popper
  37324. */
  37325. var Defaults = {
  37326. /**
  37327. * Popper's placement.
  37328. * @prop {Popper.placements} placement='bottom'
  37329. */
  37330. placement: 'bottom',
  37331. /**
  37332. * Set this to true if you want popper to position it self in 'fixed' mode
  37333. * @prop {Boolean} positionFixed=false
  37334. */
  37335. positionFixed: false,
  37336. /**
  37337. * Whether events (resize, scroll) are initially enabled.
  37338. * @prop {Boolean} eventsEnabled=true
  37339. */
  37340. eventsEnabled: true,
  37341. /**
  37342. * Set to true if you want to automatically remove the popper when
  37343. * you call the `destroy` method.
  37344. * @prop {Boolean} removeOnDestroy=false
  37345. */
  37346. removeOnDestroy: false,
  37347. /**
  37348. * Callback called when the popper is created.<br />
  37349. * By default, it is set to no-op.<br />
  37350. * Access Popper.js instance with `data.instance`.
  37351. * @prop {onCreate}
  37352. */
  37353. onCreate: function onCreate() {},
  37354. /**
  37355. * Callback called when the popper is updated. This callback is not called
  37356. * on the initialization/creation of the popper, but only on subsequent
  37357. * updates.<br />
  37358. * By default, it is set to no-op.<br />
  37359. * Access Popper.js instance with `data.instance`.
  37360. * @prop {onUpdate}
  37361. */
  37362. onUpdate: function onUpdate() {},
  37363. /**
  37364. * List of modifiers used to modify the offsets before they are applied to the popper.
  37365. * They provide most of the functionalities of Popper.js.
  37366. * @prop {modifiers}
  37367. */
  37368. modifiers: modifiers
  37369. };
  37370. /**
  37371. * @callback onCreate
  37372. * @param {dataObject} data
  37373. */
  37374. /**
  37375. * @callback onUpdate
  37376. * @param {dataObject} data
  37377. */
  37378. // Utils
  37379. // Methods
  37380. var Popper = function () {
  37381. /**
  37382. * Creates a new Popper.js instance.
  37383. * @class Popper
  37384. * @param {Element|referenceObject} reference - The reference element used to position the popper
  37385. * @param {Element} popper - The HTML / XML element used as the popper
  37386. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  37387. * @return {Object} instance - The generated Popper.js instance
  37388. */
  37389. function Popper(reference, popper) {
  37390. var _this = this;
  37391. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  37392. classCallCheck(this, Popper);
  37393. this.scheduleUpdate = function () {
  37394. return requestAnimationFrame(_this.update);
  37395. };
  37396. // make update() debounced, so that it only runs at most once-per-tick
  37397. this.update = debounce(this.update.bind(this));
  37398. // with {} we create a new object with the options inside it
  37399. this.options = _extends({}, Popper.Defaults, options);
  37400. // init state
  37401. this.state = {
  37402. isDestroyed: false,
  37403. isCreated: false,
  37404. scrollParents: []
  37405. };
  37406. // get reference and popper elements (allow jQuery wrappers)
  37407. this.reference = reference && reference.jquery ? reference[0] : reference;
  37408. this.popper = popper && popper.jquery ? popper[0] : popper;
  37409. // Deep merge modifiers options
  37410. this.options.modifiers = {};
  37411. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  37412. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  37413. });
  37414. // Refactoring modifiers' list (Object => Array)
  37415. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  37416. return _extends({
  37417. name: name
  37418. }, _this.options.modifiers[name]);
  37419. })
  37420. // sort the modifiers by order
  37421. .sort(function (a, b) {
  37422. return a.order - b.order;
  37423. });
  37424. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  37425. // such code is executed in the same order of its modifier
  37426. // they could add new properties to their options configuration
  37427. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  37428. this.modifiers.forEach(function (modifierOptions) {
  37429. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  37430. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  37431. }
  37432. });
  37433. // fire the first update to position the popper in the right place
  37434. this.update();
  37435. var eventsEnabled = this.options.eventsEnabled;
  37436. if (eventsEnabled) {
  37437. // setup event listeners, they will take care of update the position in specific situations
  37438. this.enableEventListeners();
  37439. }
  37440. this.state.eventsEnabled = eventsEnabled;
  37441. }
  37442. // We can't use class properties because they don't get listed in the
  37443. // class prototype and break stuff like Sinon stubs
  37444. createClass(Popper, [{
  37445. key: 'update',
  37446. value: function update$$1() {
  37447. return update.call(this);
  37448. }
  37449. }, {
  37450. key: 'destroy',
  37451. value: function destroy$$1() {
  37452. return destroy.call(this);
  37453. }
  37454. }, {
  37455. key: 'enableEventListeners',
  37456. value: function enableEventListeners$$1() {
  37457. return enableEventListeners.call(this);
  37458. }
  37459. }, {
  37460. key: 'disableEventListeners',
  37461. value: function disableEventListeners$$1() {
  37462. return disableEventListeners.call(this);
  37463. }
  37464. /**
  37465. * Schedules an update. It will run on the next UI update available.
  37466. * @method scheduleUpdate
  37467. * @memberof Popper
  37468. */
  37469. /**
  37470. * Collection of utilities useful when writing custom modifiers.
  37471. * Starting from version 1.7, this method is available only if you
  37472. * include `popper-utils.js` before `popper.js`.
  37473. *
  37474. * **DEPRECATION**: This way to access PopperUtils is deprecated
  37475. * and will be removed in v2! Use the PopperUtils module directly instead.
  37476. * Due to the high instability of the methods contained in Utils, we can't
  37477. * guarantee them to follow semver. Use them at your own risk!
  37478. * @static
  37479. * @private
  37480. * @type {Object}
  37481. * @deprecated since version 1.8
  37482. * @member Utils
  37483. * @memberof Popper
  37484. */
  37485. }]);
  37486. return Popper;
  37487. }();
  37488. /**
  37489. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  37490. * and lets you use it as replacement of a real DOM node.<br />
  37491. * You can use this method to position a popper relatively to a set of coordinates
  37492. * in case you don't have a DOM node to use as reference.
  37493. *
  37494. * ```
  37495. * new Popper(referenceObject, popperNode);
  37496. * ```
  37497. *
  37498. * NB: This feature isn't supported in Internet Explorer 10.
  37499. * @name referenceObject
  37500. * @property {Function} data.getBoundingClientRect
  37501. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  37502. * @property {number} data.clientWidth
  37503. * An ES6 getter that will return the width of the virtual reference element.
  37504. * @property {number} data.clientHeight
  37505. * An ES6 getter that will return the height of the virtual reference element.
  37506. */
  37507. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  37508. Popper.placements = placements;
  37509. Popper.Defaults = Defaults;
  37510. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  37511. //# sourceMappingURL=popper.js.map
  37512. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  37513. /***/ }),
  37514. /***/ "./node_modules/process/browser.js":
  37515. /*!*****************************************!*\
  37516. !*** ./node_modules/process/browser.js ***!
  37517. \*****************************************/
  37518. /*! no static exports found */
  37519. /***/ (function(module, exports) {
  37520. // shim for using process in browser
  37521. var process = module.exports = {};
  37522. // cached from whatever global is present so that test runners that stub it
  37523. // don't break things. But we need to wrap it in a try catch in case it is
  37524. // wrapped in strict mode code which doesn't define any globals. It's inside a
  37525. // function because try/catches deoptimize in certain engines.
  37526. var cachedSetTimeout;
  37527. var cachedClearTimeout;
  37528. function defaultSetTimout() {
  37529. throw new Error('setTimeout has not been defined');
  37530. }
  37531. function defaultClearTimeout () {
  37532. throw new Error('clearTimeout has not been defined');
  37533. }
  37534. (function () {
  37535. try {
  37536. if (typeof setTimeout === 'function') {
  37537. cachedSetTimeout = setTimeout;
  37538. } else {
  37539. cachedSetTimeout = defaultSetTimout;
  37540. }
  37541. } catch (e) {
  37542. cachedSetTimeout = defaultSetTimout;
  37543. }
  37544. try {
  37545. if (typeof clearTimeout === 'function') {
  37546. cachedClearTimeout = clearTimeout;
  37547. } else {
  37548. cachedClearTimeout = defaultClearTimeout;
  37549. }
  37550. } catch (e) {
  37551. cachedClearTimeout = defaultClearTimeout;
  37552. }
  37553. } ())
  37554. function runTimeout(fun) {
  37555. if (cachedSetTimeout === setTimeout) {
  37556. //normal enviroments in sane situations
  37557. return setTimeout(fun, 0);
  37558. }
  37559. // if setTimeout wasn't available but was latter defined
  37560. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  37561. cachedSetTimeout = setTimeout;
  37562. return setTimeout(fun, 0);
  37563. }
  37564. try {
  37565. // when when somebody has screwed with setTimeout but no I.E. maddness
  37566. return cachedSetTimeout(fun, 0);
  37567. } catch(e){
  37568. try {
  37569. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  37570. return cachedSetTimeout.call(null, fun, 0);
  37571. } catch(e){
  37572. // 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
  37573. return cachedSetTimeout.call(this, fun, 0);
  37574. }
  37575. }
  37576. }
  37577. function runClearTimeout(marker) {
  37578. if (cachedClearTimeout === clearTimeout) {
  37579. //normal enviroments in sane situations
  37580. return clearTimeout(marker);
  37581. }
  37582. // if clearTimeout wasn't available but was latter defined
  37583. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  37584. cachedClearTimeout = clearTimeout;
  37585. return clearTimeout(marker);
  37586. }
  37587. try {
  37588. // when when somebody has screwed with setTimeout but no I.E. maddness
  37589. return cachedClearTimeout(marker);
  37590. } catch (e){
  37591. try {
  37592. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  37593. return cachedClearTimeout.call(null, marker);
  37594. } catch (e){
  37595. // 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.
  37596. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  37597. return cachedClearTimeout.call(this, marker);
  37598. }
  37599. }
  37600. }
  37601. var queue = [];
  37602. var draining = false;
  37603. var currentQueue;
  37604. var queueIndex = -1;
  37605. function cleanUpNextTick() {
  37606. if (!draining || !currentQueue) {
  37607. return;
  37608. }
  37609. draining = false;
  37610. if (currentQueue.length) {
  37611. queue = currentQueue.concat(queue);
  37612. } else {
  37613. queueIndex = -1;
  37614. }
  37615. if (queue.length) {
  37616. drainQueue();
  37617. }
  37618. }
  37619. function drainQueue() {
  37620. if (draining) {
  37621. return;
  37622. }
  37623. var timeout = runTimeout(cleanUpNextTick);
  37624. draining = true;
  37625. var len = queue.length;
  37626. while(len) {
  37627. currentQueue = queue;
  37628. queue = [];
  37629. while (++queueIndex < len) {
  37630. if (currentQueue) {
  37631. currentQueue[queueIndex].run();
  37632. }
  37633. }
  37634. queueIndex = -1;
  37635. len = queue.length;
  37636. }
  37637. currentQueue = null;
  37638. draining = false;
  37639. runClearTimeout(timeout);
  37640. }
  37641. process.nextTick = function (fun) {
  37642. var args = new Array(arguments.length - 1);
  37643. if (arguments.length > 1) {
  37644. for (var i = 1; i < arguments.length; i++) {
  37645. args[i - 1] = arguments[i];
  37646. }
  37647. }
  37648. queue.push(new Item(fun, args));
  37649. if (queue.length === 1 && !draining) {
  37650. runTimeout(drainQueue);
  37651. }
  37652. };
  37653. // v8 likes predictible objects
  37654. function Item(fun, array) {
  37655. this.fun = fun;
  37656. this.array = array;
  37657. }
  37658. Item.prototype.run = function () {
  37659. this.fun.apply(null, this.array);
  37660. };
  37661. process.title = 'browser';
  37662. process.browser = true;
  37663. process.env = {};
  37664. process.argv = [];
  37665. process.version = ''; // empty string to avoid regexp issues
  37666. process.versions = {};
  37667. function noop() {}
  37668. process.on = noop;
  37669. process.addListener = noop;
  37670. process.once = noop;
  37671. process.off = noop;
  37672. process.removeListener = noop;
  37673. process.removeAllListeners = noop;
  37674. process.emit = noop;
  37675. process.prependListener = noop;
  37676. process.prependOnceListener = noop;
  37677. process.listeners = function (name) { return [] }
  37678. process.binding = function (name) {
  37679. throw new Error('process.binding is not supported');
  37680. };
  37681. process.cwd = function () { return '/' };
  37682. process.chdir = function (dir) {
  37683. throw new Error('process.chdir is not supported');
  37684. };
  37685. process.umask = function() { return 0; };
  37686. /***/ }),
  37687. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  37688. /*!***************************************************!*\
  37689. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  37690. \***************************************************/
  37691. /*! no static exports found */
  37692. /***/ (function(module, exports, __webpack_require__) {
  37693. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  37694. * Pusher JavaScript Library v5.0.3
  37695. * https://pusher.com/
  37696. *
  37697. * Copyright 2017, Pusher
  37698. * Released under the MIT licence.
  37699. */
  37700. (function webpackUniversalModuleDefinition(root, factory) {
  37701. if(true)
  37702. module.exports = factory();
  37703. else {}
  37704. })(window, function() {
  37705. return /******/ (function(modules) { // webpackBootstrap
  37706. /******/ // The module cache
  37707. /******/ var installedModules = {};
  37708. /******/
  37709. /******/ // The require function
  37710. /******/ function __webpack_require__(moduleId) {
  37711. /******/
  37712. /******/ // Check if module is in cache
  37713. /******/ if(installedModules[moduleId]) {
  37714. /******/ return installedModules[moduleId].exports;
  37715. /******/ }
  37716. /******/ // Create a new module (and put it into the cache)
  37717. /******/ var module = installedModules[moduleId] = {
  37718. /******/ i: moduleId,
  37719. /******/ l: false,
  37720. /******/ exports: {}
  37721. /******/ };
  37722. /******/
  37723. /******/ // Execute the module function
  37724. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  37725. /******/
  37726. /******/ // Flag the module as loaded
  37727. /******/ module.l = true;
  37728. /******/
  37729. /******/ // Return the exports of the module
  37730. /******/ return module.exports;
  37731. /******/ }
  37732. /******/
  37733. /******/
  37734. /******/ // expose the modules object (__webpack_modules__)
  37735. /******/ __webpack_require__.m = modules;
  37736. /******/
  37737. /******/ // expose the module cache
  37738. /******/ __webpack_require__.c = installedModules;
  37739. /******/
  37740. /******/ // define getter function for harmony exports
  37741. /******/ __webpack_require__.d = function(exports, name, getter) {
  37742. /******/ if(!__webpack_require__.o(exports, name)) {
  37743. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  37744. /******/ }
  37745. /******/ };
  37746. /******/
  37747. /******/ // define __esModule on exports
  37748. /******/ __webpack_require__.r = function(exports) {
  37749. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  37750. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  37751. /******/ }
  37752. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  37753. /******/ };
  37754. /******/
  37755. /******/ // create a fake namespace object
  37756. /******/ // mode & 1: value is a module id, require it
  37757. /******/ // mode & 2: merge all properties of value into the ns
  37758. /******/ // mode & 4: return value when already ns object
  37759. /******/ // mode & 8|1: behave like require
  37760. /******/ __webpack_require__.t = function(value, mode) {
  37761. /******/ if(mode & 1) value = __webpack_require__(value);
  37762. /******/ if(mode & 8) return value;
  37763. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  37764. /******/ var ns = Object.create(null);
  37765. /******/ __webpack_require__.r(ns);
  37766. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  37767. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  37768. /******/ return ns;
  37769. /******/ };
  37770. /******/
  37771. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37772. /******/ __webpack_require__.n = function(module) {
  37773. /******/ var getter = module && module.__esModule ?
  37774. /******/ function getDefault() { return module['default']; } :
  37775. /******/ function getModuleExports() { return module; };
  37776. /******/ __webpack_require__.d(getter, 'a', getter);
  37777. /******/ return getter;
  37778. /******/ };
  37779. /******/
  37780. /******/ // Object.prototype.hasOwnProperty.call
  37781. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  37782. /******/
  37783. /******/ // __webpack_public_path__
  37784. /******/ __webpack_require__.p = "";
  37785. /******/
  37786. /******/
  37787. /******/ // Load entry module and return exports
  37788. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37789. /******/ })
  37790. /************************************************************************/
  37791. /******/ ([
  37792. /* 0 */
  37793. /***/ (function(module, exports, __webpack_require__) {
  37794. (function(nacl) {
  37795. 'use strict';
  37796. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37797. // Public domain.
  37798. //
  37799. // Implementation derived from TweetNaCl version 20140427.
  37800. // See for details: http://tweetnacl.cr.yp.to/
  37801. var gf = function(init) {
  37802. var i, r = new Float64Array(16);
  37803. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37804. return r;
  37805. };
  37806. // Pluggable, initialized in high-level API below.
  37807. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37808. var _0 = new Uint8Array(16);
  37809. var _9 = new Uint8Array(32); _9[0] = 9;
  37810. var gf0 = gf(),
  37811. gf1 = gf([1]),
  37812. _121665 = gf([0xdb41, 1]),
  37813. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37814. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37815. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37816. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37817. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37818. function ts64(x, i, h, l) {
  37819. x[i] = (h >> 24) & 0xff;
  37820. x[i+1] = (h >> 16) & 0xff;
  37821. x[i+2] = (h >> 8) & 0xff;
  37822. x[i+3] = h & 0xff;
  37823. x[i+4] = (l >> 24) & 0xff;
  37824. x[i+5] = (l >> 16) & 0xff;
  37825. x[i+6] = (l >> 8) & 0xff;
  37826. x[i+7] = l & 0xff;
  37827. }
  37828. function vn(x, xi, y, yi, n) {
  37829. var i,d = 0;
  37830. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37831. return (1 & ((d - 1) >>> 8)) - 1;
  37832. }
  37833. function crypto_verify_16(x, xi, y, yi) {
  37834. return vn(x,xi,y,yi,16);
  37835. }
  37836. function crypto_verify_32(x, xi, y, yi) {
  37837. return vn(x,xi,y,yi,32);
  37838. }
  37839. function core_salsa20(o, p, k, c) {
  37840. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37841. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37842. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37843. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37844. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37845. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37846. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37847. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37848. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37849. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37850. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37851. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37852. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37853. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37854. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37855. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37856. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37857. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37858. x15 = j15, u;
  37859. for (var i = 0; i < 20; i += 2) {
  37860. u = x0 + x12 | 0;
  37861. x4 ^= u<<7 | u>>>(32-7);
  37862. u = x4 + x0 | 0;
  37863. x8 ^= u<<9 | u>>>(32-9);
  37864. u = x8 + x4 | 0;
  37865. x12 ^= u<<13 | u>>>(32-13);
  37866. u = x12 + x8 | 0;
  37867. x0 ^= u<<18 | u>>>(32-18);
  37868. u = x5 + x1 | 0;
  37869. x9 ^= u<<7 | u>>>(32-7);
  37870. u = x9 + x5 | 0;
  37871. x13 ^= u<<9 | u>>>(32-9);
  37872. u = x13 + x9 | 0;
  37873. x1 ^= u<<13 | u>>>(32-13);
  37874. u = x1 + x13 | 0;
  37875. x5 ^= u<<18 | u>>>(32-18);
  37876. u = x10 + x6 | 0;
  37877. x14 ^= u<<7 | u>>>(32-7);
  37878. u = x14 + x10 | 0;
  37879. x2 ^= u<<9 | u>>>(32-9);
  37880. u = x2 + x14 | 0;
  37881. x6 ^= u<<13 | u>>>(32-13);
  37882. u = x6 + x2 | 0;
  37883. x10 ^= u<<18 | u>>>(32-18);
  37884. u = x15 + x11 | 0;
  37885. x3 ^= u<<7 | u>>>(32-7);
  37886. u = x3 + x15 | 0;
  37887. x7 ^= u<<9 | u>>>(32-9);
  37888. u = x7 + x3 | 0;
  37889. x11 ^= u<<13 | u>>>(32-13);
  37890. u = x11 + x7 | 0;
  37891. x15 ^= u<<18 | u>>>(32-18);
  37892. u = x0 + x3 | 0;
  37893. x1 ^= u<<7 | u>>>(32-7);
  37894. u = x1 + x0 | 0;
  37895. x2 ^= u<<9 | u>>>(32-9);
  37896. u = x2 + x1 | 0;
  37897. x3 ^= u<<13 | u>>>(32-13);
  37898. u = x3 + x2 | 0;
  37899. x0 ^= u<<18 | u>>>(32-18);
  37900. u = x5 + x4 | 0;
  37901. x6 ^= u<<7 | u>>>(32-7);
  37902. u = x6 + x5 | 0;
  37903. x7 ^= u<<9 | u>>>(32-9);
  37904. u = x7 + x6 | 0;
  37905. x4 ^= u<<13 | u>>>(32-13);
  37906. u = x4 + x7 | 0;
  37907. x5 ^= u<<18 | u>>>(32-18);
  37908. u = x10 + x9 | 0;
  37909. x11 ^= u<<7 | u>>>(32-7);
  37910. u = x11 + x10 | 0;
  37911. x8 ^= u<<9 | u>>>(32-9);
  37912. u = x8 + x11 | 0;
  37913. x9 ^= u<<13 | u>>>(32-13);
  37914. u = x9 + x8 | 0;
  37915. x10 ^= u<<18 | u>>>(32-18);
  37916. u = x15 + x14 | 0;
  37917. x12 ^= u<<7 | u>>>(32-7);
  37918. u = x12 + x15 | 0;
  37919. x13 ^= u<<9 | u>>>(32-9);
  37920. u = x13 + x12 | 0;
  37921. x14 ^= u<<13 | u>>>(32-13);
  37922. u = x14 + x13 | 0;
  37923. x15 ^= u<<18 | u>>>(32-18);
  37924. }
  37925. x0 = x0 + j0 | 0;
  37926. x1 = x1 + j1 | 0;
  37927. x2 = x2 + j2 | 0;
  37928. x3 = x3 + j3 | 0;
  37929. x4 = x4 + j4 | 0;
  37930. x5 = x5 + j5 | 0;
  37931. x6 = x6 + j6 | 0;
  37932. x7 = x7 + j7 | 0;
  37933. x8 = x8 + j8 | 0;
  37934. x9 = x9 + j9 | 0;
  37935. x10 = x10 + j10 | 0;
  37936. x11 = x11 + j11 | 0;
  37937. x12 = x12 + j12 | 0;
  37938. x13 = x13 + j13 | 0;
  37939. x14 = x14 + j14 | 0;
  37940. x15 = x15 + j15 | 0;
  37941. o[ 0] = x0 >>> 0 & 0xff;
  37942. o[ 1] = x0 >>> 8 & 0xff;
  37943. o[ 2] = x0 >>> 16 & 0xff;
  37944. o[ 3] = x0 >>> 24 & 0xff;
  37945. o[ 4] = x1 >>> 0 & 0xff;
  37946. o[ 5] = x1 >>> 8 & 0xff;
  37947. o[ 6] = x1 >>> 16 & 0xff;
  37948. o[ 7] = x1 >>> 24 & 0xff;
  37949. o[ 8] = x2 >>> 0 & 0xff;
  37950. o[ 9] = x2 >>> 8 & 0xff;
  37951. o[10] = x2 >>> 16 & 0xff;
  37952. o[11] = x2 >>> 24 & 0xff;
  37953. o[12] = x3 >>> 0 & 0xff;
  37954. o[13] = x3 >>> 8 & 0xff;
  37955. o[14] = x3 >>> 16 & 0xff;
  37956. o[15] = x3 >>> 24 & 0xff;
  37957. o[16] = x4 >>> 0 & 0xff;
  37958. o[17] = x4 >>> 8 & 0xff;
  37959. o[18] = x4 >>> 16 & 0xff;
  37960. o[19] = x4 >>> 24 & 0xff;
  37961. o[20] = x5 >>> 0 & 0xff;
  37962. o[21] = x5 >>> 8 & 0xff;
  37963. o[22] = x5 >>> 16 & 0xff;
  37964. o[23] = x5 >>> 24 & 0xff;
  37965. o[24] = x6 >>> 0 & 0xff;
  37966. o[25] = x6 >>> 8 & 0xff;
  37967. o[26] = x6 >>> 16 & 0xff;
  37968. o[27] = x6 >>> 24 & 0xff;
  37969. o[28] = x7 >>> 0 & 0xff;
  37970. o[29] = x7 >>> 8 & 0xff;
  37971. o[30] = x7 >>> 16 & 0xff;
  37972. o[31] = x7 >>> 24 & 0xff;
  37973. o[32] = x8 >>> 0 & 0xff;
  37974. o[33] = x8 >>> 8 & 0xff;
  37975. o[34] = x8 >>> 16 & 0xff;
  37976. o[35] = x8 >>> 24 & 0xff;
  37977. o[36] = x9 >>> 0 & 0xff;
  37978. o[37] = x9 >>> 8 & 0xff;
  37979. o[38] = x9 >>> 16 & 0xff;
  37980. o[39] = x9 >>> 24 & 0xff;
  37981. o[40] = x10 >>> 0 & 0xff;
  37982. o[41] = x10 >>> 8 & 0xff;
  37983. o[42] = x10 >>> 16 & 0xff;
  37984. o[43] = x10 >>> 24 & 0xff;
  37985. o[44] = x11 >>> 0 & 0xff;
  37986. o[45] = x11 >>> 8 & 0xff;
  37987. o[46] = x11 >>> 16 & 0xff;
  37988. o[47] = x11 >>> 24 & 0xff;
  37989. o[48] = x12 >>> 0 & 0xff;
  37990. o[49] = x12 >>> 8 & 0xff;
  37991. o[50] = x12 >>> 16 & 0xff;
  37992. o[51] = x12 >>> 24 & 0xff;
  37993. o[52] = x13 >>> 0 & 0xff;
  37994. o[53] = x13 >>> 8 & 0xff;
  37995. o[54] = x13 >>> 16 & 0xff;
  37996. o[55] = x13 >>> 24 & 0xff;
  37997. o[56] = x14 >>> 0 & 0xff;
  37998. o[57] = x14 >>> 8 & 0xff;
  37999. o[58] = x14 >>> 16 & 0xff;
  38000. o[59] = x14 >>> 24 & 0xff;
  38001. o[60] = x15 >>> 0 & 0xff;
  38002. o[61] = x15 >>> 8 & 0xff;
  38003. o[62] = x15 >>> 16 & 0xff;
  38004. o[63] = x15 >>> 24 & 0xff;
  38005. }
  38006. function core_hsalsa20(o,p,k,c) {
  38007. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  38008. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  38009. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  38010. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  38011. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  38012. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  38013. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  38014. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  38015. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  38016. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  38017. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  38018. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  38019. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  38020. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  38021. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  38022. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  38023. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  38024. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  38025. x15 = j15, u;
  38026. for (var i = 0; i < 20; i += 2) {
  38027. u = x0 + x12 | 0;
  38028. x4 ^= u<<7 | u>>>(32-7);
  38029. u = x4 + x0 | 0;
  38030. x8 ^= u<<9 | u>>>(32-9);
  38031. u = x8 + x4 | 0;
  38032. x12 ^= u<<13 | u>>>(32-13);
  38033. u = x12 + x8 | 0;
  38034. x0 ^= u<<18 | u>>>(32-18);
  38035. u = x5 + x1 | 0;
  38036. x9 ^= u<<7 | u>>>(32-7);
  38037. u = x9 + x5 | 0;
  38038. x13 ^= u<<9 | u>>>(32-9);
  38039. u = x13 + x9 | 0;
  38040. x1 ^= u<<13 | u>>>(32-13);
  38041. u = x1 + x13 | 0;
  38042. x5 ^= u<<18 | u>>>(32-18);
  38043. u = x10 + x6 | 0;
  38044. x14 ^= u<<7 | u>>>(32-7);
  38045. u = x14 + x10 | 0;
  38046. x2 ^= u<<9 | u>>>(32-9);
  38047. u = x2 + x14 | 0;
  38048. x6 ^= u<<13 | u>>>(32-13);
  38049. u = x6 + x2 | 0;
  38050. x10 ^= u<<18 | u>>>(32-18);
  38051. u = x15 + x11 | 0;
  38052. x3 ^= u<<7 | u>>>(32-7);
  38053. u = x3 + x15 | 0;
  38054. x7 ^= u<<9 | u>>>(32-9);
  38055. u = x7 + x3 | 0;
  38056. x11 ^= u<<13 | u>>>(32-13);
  38057. u = x11 + x7 | 0;
  38058. x15 ^= u<<18 | u>>>(32-18);
  38059. u = x0 + x3 | 0;
  38060. x1 ^= u<<7 | u>>>(32-7);
  38061. u = x1 + x0 | 0;
  38062. x2 ^= u<<9 | u>>>(32-9);
  38063. u = x2 + x1 | 0;
  38064. x3 ^= u<<13 | u>>>(32-13);
  38065. u = x3 + x2 | 0;
  38066. x0 ^= u<<18 | u>>>(32-18);
  38067. u = x5 + x4 | 0;
  38068. x6 ^= u<<7 | u>>>(32-7);
  38069. u = x6 + x5 | 0;
  38070. x7 ^= u<<9 | u>>>(32-9);
  38071. u = x7 + x6 | 0;
  38072. x4 ^= u<<13 | u>>>(32-13);
  38073. u = x4 + x7 | 0;
  38074. x5 ^= u<<18 | u>>>(32-18);
  38075. u = x10 + x9 | 0;
  38076. x11 ^= u<<7 | u>>>(32-7);
  38077. u = x11 + x10 | 0;
  38078. x8 ^= u<<9 | u>>>(32-9);
  38079. u = x8 + x11 | 0;
  38080. x9 ^= u<<13 | u>>>(32-13);
  38081. u = x9 + x8 | 0;
  38082. x10 ^= u<<18 | u>>>(32-18);
  38083. u = x15 + x14 | 0;
  38084. x12 ^= u<<7 | u>>>(32-7);
  38085. u = x12 + x15 | 0;
  38086. x13 ^= u<<9 | u>>>(32-9);
  38087. u = x13 + x12 | 0;
  38088. x14 ^= u<<13 | u>>>(32-13);
  38089. u = x14 + x13 | 0;
  38090. x15 ^= u<<18 | u>>>(32-18);
  38091. }
  38092. o[ 0] = x0 >>> 0 & 0xff;
  38093. o[ 1] = x0 >>> 8 & 0xff;
  38094. o[ 2] = x0 >>> 16 & 0xff;
  38095. o[ 3] = x0 >>> 24 & 0xff;
  38096. o[ 4] = x5 >>> 0 & 0xff;
  38097. o[ 5] = x5 >>> 8 & 0xff;
  38098. o[ 6] = x5 >>> 16 & 0xff;
  38099. o[ 7] = x5 >>> 24 & 0xff;
  38100. o[ 8] = x10 >>> 0 & 0xff;
  38101. o[ 9] = x10 >>> 8 & 0xff;
  38102. o[10] = x10 >>> 16 & 0xff;
  38103. o[11] = x10 >>> 24 & 0xff;
  38104. o[12] = x15 >>> 0 & 0xff;
  38105. o[13] = x15 >>> 8 & 0xff;
  38106. o[14] = x15 >>> 16 & 0xff;
  38107. o[15] = x15 >>> 24 & 0xff;
  38108. o[16] = x6 >>> 0 & 0xff;
  38109. o[17] = x6 >>> 8 & 0xff;
  38110. o[18] = x6 >>> 16 & 0xff;
  38111. o[19] = x6 >>> 24 & 0xff;
  38112. o[20] = x7 >>> 0 & 0xff;
  38113. o[21] = x7 >>> 8 & 0xff;
  38114. o[22] = x7 >>> 16 & 0xff;
  38115. o[23] = x7 >>> 24 & 0xff;
  38116. o[24] = x8 >>> 0 & 0xff;
  38117. o[25] = x8 >>> 8 & 0xff;
  38118. o[26] = x8 >>> 16 & 0xff;
  38119. o[27] = x8 >>> 24 & 0xff;
  38120. o[28] = x9 >>> 0 & 0xff;
  38121. o[29] = x9 >>> 8 & 0xff;
  38122. o[30] = x9 >>> 16 & 0xff;
  38123. o[31] = x9 >>> 24 & 0xff;
  38124. }
  38125. function crypto_core_salsa20(out,inp,k,c) {
  38126. core_salsa20(out,inp,k,c);
  38127. }
  38128. function crypto_core_hsalsa20(out,inp,k,c) {
  38129. core_hsalsa20(out,inp,k,c);
  38130. }
  38131. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  38132. // "expand 32-byte k"
  38133. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  38134. var z = new Uint8Array(16), x = new Uint8Array(64);
  38135. var u, i;
  38136. for (i = 0; i < 16; i++) z[i] = 0;
  38137. for (i = 0; i < 8; i++) z[i] = n[i];
  38138. while (b >= 64) {
  38139. crypto_core_salsa20(x,z,k,sigma);
  38140. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  38141. u = 1;
  38142. for (i = 8; i < 16; i++) {
  38143. u = u + (z[i] & 0xff) | 0;
  38144. z[i] = u & 0xff;
  38145. u >>>= 8;
  38146. }
  38147. b -= 64;
  38148. cpos += 64;
  38149. mpos += 64;
  38150. }
  38151. if (b > 0) {
  38152. crypto_core_salsa20(x,z,k,sigma);
  38153. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  38154. }
  38155. return 0;
  38156. }
  38157. function crypto_stream_salsa20(c,cpos,b,n,k) {
  38158. var z = new Uint8Array(16), x = new Uint8Array(64);
  38159. var u, i;
  38160. for (i = 0; i < 16; i++) z[i] = 0;
  38161. for (i = 0; i < 8; i++) z[i] = n[i];
  38162. while (b >= 64) {
  38163. crypto_core_salsa20(x,z,k,sigma);
  38164. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  38165. u = 1;
  38166. for (i = 8; i < 16; i++) {
  38167. u = u + (z[i] & 0xff) | 0;
  38168. z[i] = u & 0xff;
  38169. u >>>= 8;
  38170. }
  38171. b -= 64;
  38172. cpos += 64;
  38173. }
  38174. if (b > 0) {
  38175. crypto_core_salsa20(x,z,k,sigma);
  38176. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  38177. }
  38178. return 0;
  38179. }
  38180. function crypto_stream(c,cpos,d,n,k) {
  38181. var s = new Uint8Array(32);
  38182. crypto_core_hsalsa20(s,n,k,sigma);
  38183. var sn = new Uint8Array(8);
  38184. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  38185. return crypto_stream_salsa20(c,cpos,d,sn,s);
  38186. }
  38187. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  38188. var s = new Uint8Array(32);
  38189. crypto_core_hsalsa20(s,n,k,sigma);
  38190. var sn = new Uint8Array(8);
  38191. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  38192. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  38193. }
  38194. /*
  38195. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  38196. * https://github.com/floodyberry/poly1305-donna
  38197. */
  38198. var poly1305 = function(key) {
  38199. this.buffer = new Uint8Array(16);
  38200. this.r = new Uint16Array(10);
  38201. this.h = new Uint16Array(10);
  38202. this.pad = new Uint16Array(8);
  38203. this.leftover = 0;
  38204. this.fin = 0;
  38205. var t0, t1, t2, t3, t4, t5, t6, t7;
  38206. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  38207. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  38208. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  38209. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  38210. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  38211. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  38212. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  38213. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  38214. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  38215. this.r[9] = ((t7 >>> 5)) & 0x007f;
  38216. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  38217. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  38218. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  38219. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  38220. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  38221. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  38222. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  38223. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  38224. };
  38225. poly1305.prototype.blocks = function(m, mpos, bytes) {
  38226. var hibit = this.fin ? 0 : (1 << 11);
  38227. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  38228. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  38229. var h0 = this.h[0],
  38230. h1 = this.h[1],
  38231. h2 = this.h[2],
  38232. h3 = this.h[3],
  38233. h4 = this.h[4],
  38234. h5 = this.h[5],
  38235. h6 = this.h[6],
  38236. h7 = this.h[7],
  38237. h8 = this.h[8],
  38238. h9 = this.h[9];
  38239. var r0 = this.r[0],
  38240. r1 = this.r[1],
  38241. r2 = this.r[2],
  38242. r3 = this.r[3],
  38243. r4 = this.r[4],
  38244. r5 = this.r[5],
  38245. r6 = this.r[6],
  38246. r7 = this.r[7],
  38247. r8 = this.r[8],
  38248. r9 = this.r[9];
  38249. while (bytes >= 16) {
  38250. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  38251. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  38252. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  38253. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  38254. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  38255. h5 += ((t4 >>> 1)) & 0x1fff;
  38256. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  38257. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  38258. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  38259. h9 += ((t7 >>> 5)) | hibit;
  38260. c = 0;
  38261. d0 = c;
  38262. d0 += h0 * r0;
  38263. d0 += h1 * (5 * r9);
  38264. d0 += h2 * (5 * r8);
  38265. d0 += h3 * (5 * r7);
  38266. d0 += h4 * (5 * r6);
  38267. c = (d0 >>> 13); d0 &= 0x1fff;
  38268. d0 += h5 * (5 * r5);
  38269. d0 += h6 * (5 * r4);
  38270. d0 += h7 * (5 * r3);
  38271. d0 += h8 * (5 * r2);
  38272. d0 += h9 * (5 * r1);
  38273. c += (d0 >>> 13); d0 &= 0x1fff;
  38274. d1 = c;
  38275. d1 += h0 * r1;
  38276. d1 += h1 * r0;
  38277. d1 += h2 * (5 * r9);
  38278. d1 += h3 * (5 * r8);
  38279. d1 += h4 * (5 * r7);
  38280. c = (d1 >>> 13); d1 &= 0x1fff;
  38281. d1 += h5 * (5 * r6);
  38282. d1 += h6 * (5 * r5);
  38283. d1 += h7 * (5 * r4);
  38284. d1 += h8 * (5 * r3);
  38285. d1 += h9 * (5 * r2);
  38286. c += (d1 >>> 13); d1 &= 0x1fff;
  38287. d2 = c;
  38288. d2 += h0 * r2;
  38289. d2 += h1 * r1;
  38290. d2 += h2 * r0;
  38291. d2 += h3 * (5 * r9);
  38292. d2 += h4 * (5 * r8);
  38293. c = (d2 >>> 13); d2 &= 0x1fff;
  38294. d2 += h5 * (5 * r7);
  38295. d2 += h6 * (5 * r6);
  38296. d2 += h7 * (5 * r5);
  38297. d2 += h8 * (5 * r4);
  38298. d2 += h9 * (5 * r3);
  38299. c += (d2 >>> 13); d2 &= 0x1fff;
  38300. d3 = c;
  38301. d3 += h0 * r3;
  38302. d3 += h1 * r2;
  38303. d3 += h2 * r1;
  38304. d3 += h3 * r0;
  38305. d3 += h4 * (5 * r9);
  38306. c = (d3 >>> 13); d3 &= 0x1fff;
  38307. d3 += h5 * (5 * r8);
  38308. d3 += h6 * (5 * r7);
  38309. d3 += h7 * (5 * r6);
  38310. d3 += h8 * (5 * r5);
  38311. d3 += h9 * (5 * r4);
  38312. c += (d3 >>> 13); d3 &= 0x1fff;
  38313. d4 = c;
  38314. d4 += h0 * r4;
  38315. d4 += h1 * r3;
  38316. d4 += h2 * r2;
  38317. d4 += h3 * r1;
  38318. d4 += h4 * r0;
  38319. c = (d4 >>> 13); d4 &= 0x1fff;
  38320. d4 += h5 * (5 * r9);
  38321. d4 += h6 * (5 * r8);
  38322. d4 += h7 * (5 * r7);
  38323. d4 += h8 * (5 * r6);
  38324. d4 += h9 * (5 * r5);
  38325. c += (d4 >>> 13); d4 &= 0x1fff;
  38326. d5 = c;
  38327. d5 += h0 * r5;
  38328. d5 += h1 * r4;
  38329. d5 += h2 * r3;
  38330. d5 += h3 * r2;
  38331. d5 += h4 * r1;
  38332. c = (d5 >>> 13); d5 &= 0x1fff;
  38333. d5 += h5 * r0;
  38334. d5 += h6 * (5 * r9);
  38335. d5 += h7 * (5 * r8);
  38336. d5 += h8 * (5 * r7);
  38337. d5 += h9 * (5 * r6);
  38338. c += (d5 >>> 13); d5 &= 0x1fff;
  38339. d6 = c;
  38340. d6 += h0 * r6;
  38341. d6 += h1 * r5;
  38342. d6 += h2 * r4;
  38343. d6 += h3 * r3;
  38344. d6 += h4 * r2;
  38345. c = (d6 >>> 13); d6 &= 0x1fff;
  38346. d6 += h5 * r1;
  38347. d6 += h6 * r0;
  38348. d6 += h7 * (5 * r9);
  38349. d6 += h8 * (5 * r8);
  38350. d6 += h9 * (5 * r7);
  38351. c += (d6 >>> 13); d6 &= 0x1fff;
  38352. d7 = c;
  38353. d7 += h0 * r7;
  38354. d7 += h1 * r6;
  38355. d7 += h2 * r5;
  38356. d7 += h3 * r4;
  38357. d7 += h4 * r3;
  38358. c = (d7 >>> 13); d7 &= 0x1fff;
  38359. d7 += h5 * r2;
  38360. d7 += h6 * r1;
  38361. d7 += h7 * r0;
  38362. d7 += h8 * (5 * r9);
  38363. d7 += h9 * (5 * r8);
  38364. c += (d7 >>> 13); d7 &= 0x1fff;
  38365. d8 = c;
  38366. d8 += h0 * r8;
  38367. d8 += h1 * r7;
  38368. d8 += h2 * r6;
  38369. d8 += h3 * r5;
  38370. d8 += h4 * r4;
  38371. c = (d8 >>> 13); d8 &= 0x1fff;
  38372. d8 += h5 * r3;
  38373. d8 += h6 * r2;
  38374. d8 += h7 * r1;
  38375. d8 += h8 * r0;
  38376. d8 += h9 * (5 * r9);
  38377. c += (d8 >>> 13); d8 &= 0x1fff;
  38378. d9 = c;
  38379. d9 += h0 * r9;
  38380. d9 += h1 * r8;
  38381. d9 += h2 * r7;
  38382. d9 += h3 * r6;
  38383. d9 += h4 * r5;
  38384. c = (d9 >>> 13); d9 &= 0x1fff;
  38385. d9 += h5 * r4;
  38386. d9 += h6 * r3;
  38387. d9 += h7 * r2;
  38388. d9 += h8 * r1;
  38389. d9 += h9 * r0;
  38390. c += (d9 >>> 13); d9 &= 0x1fff;
  38391. c = (((c << 2) + c)) | 0;
  38392. c = (c + d0) | 0;
  38393. d0 = c & 0x1fff;
  38394. c = (c >>> 13);
  38395. d1 += c;
  38396. h0 = d0;
  38397. h1 = d1;
  38398. h2 = d2;
  38399. h3 = d3;
  38400. h4 = d4;
  38401. h5 = d5;
  38402. h6 = d6;
  38403. h7 = d7;
  38404. h8 = d8;
  38405. h9 = d9;
  38406. mpos += 16;
  38407. bytes -= 16;
  38408. }
  38409. this.h[0] = h0;
  38410. this.h[1] = h1;
  38411. this.h[2] = h2;
  38412. this.h[3] = h3;
  38413. this.h[4] = h4;
  38414. this.h[5] = h5;
  38415. this.h[6] = h6;
  38416. this.h[7] = h7;
  38417. this.h[8] = h8;
  38418. this.h[9] = h9;
  38419. };
  38420. poly1305.prototype.finish = function(mac, macpos) {
  38421. var g = new Uint16Array(10);
  38422. var c, mask, f, i;
  38423. if (this.leftover) {
  38424. i = this.leftover;
  38425. this.buffer[i++] = 1;
  38426. for (; i < 16; i++) this.buffer[i] = 0;
  38427. this.fin = 1;
  38428. this.blocks(this.buffer, 0, 16);
  38429. }
  38430. c = this.h[1] >>> 13;
  38431. this.h[1] &= 0x1fff;
  38432. for (i = 2; i < 10; i++) {
  38433. this.h[i] += c;
  38434. c = this.h[i] >>> 13;
  38435. this.h[i] &= 0x1fff;
  38436. }
  38437. this.h[0] += (c * 5);
  38438. c = this.h[0] >>> 13;
  38439. this.h[0] &= 0x1fff;
  38440. this.h[1] += c;
  38441. c = this.h[1] >>> 13;
  38442. this.h[1] &= 0x1fff;
  38443. this.h[2] += c;
  38444. g[0] = this.h[0] + 5;
  38445. c = g[0] >>> 13;
  38446. g[0] &= 0x1fff;
  38447. for (i = 1; i < 10; i++) {
  38448. g[i] = this.h[i] + c;
  38449. c = g[i] >>> 13;
  38450. g[i] &= 0x1fff;
  38451. }
  38452. g[9] -= (1 << 13);
  38453. mask = (c ^ 1) - 1;
  38454. for (i = 0; i < 10; i++) g[i] &= mask;
  38455. mask = ~mask;
  38456. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  38457. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  38458. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  38459. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  38460. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  38461. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  38462. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  38463. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  38464. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  38465. f = this.h[0] + this.pad[0];
  38466. this.h[0] = f & 0xffff;
  38467. for (i = 1; i < 8; i++) {
  38468. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  38469. this.h[i] = f & 0xffff;
  38470. }
  38471. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  38472. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  38473. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  38474. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  38475. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  38476. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  38477. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  38478. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  38479. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  38480. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  38481. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  38482. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  38483. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  38484. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  38485. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  38486. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  38487. };
  38488. poly1305.prototype.update = function(m, mpos, bytes) {
  38489. var i, want;
  38490. if (this.leftover) {
  38491. want = (16 - this.leftover);
  38492. if (want > bytes)
  38493. want = bytes;
  38494. for (i = 0; i < want; i++)
  38495. this.buffer[this.leftover + i] = m[mpos+i];
  38496. bytes -= want;
  38497. mpos += want;
  38498. this.leftover += want;
  38499. if (this.leftover < 16)
  38500. return;
  38501. this.blocks(this.buffer, 0, 16);
  38502. this.leftover = 0;
  38503. }
  38504. if (bytes >= 16) {
  38505. want = bytes - (bytes % 16);
  38506. this.blocks(m, mpos, want);
  38507. mpos += want;
  38508. bytes -= want;
  38509. }
  38510. if (bytes) {
  38511. for (i = 0; i < bytes; i++)
  38512. this.buffer[this.leftover + i] = m[mpos+i];
  38513. this.leftover += bytes;
  38514. }
  38515. };
  38516. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  38517. var s = new poly1305(k);
  38518. s.update(m, mpos, n);
  38519. s.finish(out, outpos);
  38520. return 0;
  38521. }
  38522. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  38523. var x = new Uint8Array(16);
  38524. crypto_onetimeauth(x,0,m,mpos,n,k);
  38525. return crypto_verify_16(h,hpos,x,0);
  38526. }
  38527. function crypto_secretbox(c,m,d,n,k) {
  38528. var i;
  38529. if (d < 32) return -1;
  38530. crypto_stream_xor(c,0,m,0,d,n,k);
  38531. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  38532. for (i = 0; i < 16; i++) c[i] = 0;
  38533. return 0;
  38534. }
  38535. function crypto_secretbox_open(m,c,d,n,k) {
  38536. var i;
  38537. var x = new Uint8Array(32);
  38538. if (d < 32) return -1;
  38539. crypto_stream(x,0,32,n,k);
  38540. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  38541. crypto_stream_xor(m,0,c,0,d,n,k);
  38542. for (i = 0; i < 32; i++) m[i] = 0;
  38543. return 0;
  38544. }
  38545. function set25519(r, a) {
  38546. var i;
  38547. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  38548. }
  38549. function car25519(o) {
  38550. var i, v, c = 1;
  38551. for (i = 0; i < 16; i++) {
  38552. v = o[i] + c + 65535;
  38553. c = Math.floor(v / 65536);
  38554. o[i] = v - c * 65536;
  38555. }
  38556. o[0] += c-1 + 37 * (c-1);
  38557. }
  38558. function sel25519(p, q, b) {
  38559. var t, c = ~(b-1);
  38560. for (var i = 0; i < 16; i++) {
  38561. t = c & (p[i] ^ q[i]);
  38562. p[i] ^= t;
  38563. q[i] ^= t;
  38564. }
  38565. }
  38566. function pack25519(o, n) {
  38567. var i, j, b;
  38568. var m = gf(), t = gf();
  38569. for (i = 0; i < 16; i++) t[i] = n[i];
  38570. car25519(t);
  38571. car25519(t);
  38572. car25519(t);
  38573. for (j = 0; j < 2; j++) {
  38574. m[0] = t[0] - 0xffed;
  38575. for (i = 1; i < 15; i++) {
  38576. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  38577. m[i-1] &= 0xffff;
  38578. }
  38579. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  38580. b = (m[15]>>16) & 1;
  38581. m[14] &= 0xffff;
  38582. sel25519(t, m, 1-b);
  38583. }
  38584. for (i = 0; i < 16; i++) {
  38585. o[2*i] = t[i] & 0xff;
  38586. o[2*i+1] = t[i]>>8;
  38587. }
  38588. }
  38589. function neq25519(a, b) {
  38590. var c = new Uint8Array(32), d = new Uint8Array(32);
  38591. pack25519(c, a);
  38592. pack25519(d, b);
  38593. return crypto_verify_32(c, 0, d, 0);
  38594. }
  38595. function par25519(a) {
  38596. var d = new Uint8Array(32);
  38597. pack25519(d, a);
  38598. return d[0] & 1;
  38599. }
  38600. function unpack25519(o, n) {
  38601. var i;
  38602. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  38603. o[15] &= 0x7fff;
  38604. }
  38605. function A(o, a, b) {
  38606. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  38607. }
  38608. function Z(o, a, b) {
  38609. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  38610. }
  38611. function M(o, a, b) {
  38612. var v, c,
  38613. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  38614. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  38615. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  38616. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  38617. b0 = b[0],
  38618. b1 = b[1],
  38619. b2 = b[2],
  38620. b3 = b[3],
  38621. b4 = b[4],
  38622. b5 = b[5],
  38623. b6 = b[6],
  38624. b7 = b[7],
  38625. b8 = b[8],
  38626. b9 = b[9],
  38627. b10 = b[10],
  38628. b11 = b[11],
  38629. b12 = b[12],
  38630. b13 = b[13],
  38631. b14 = b[14],
  38632. b15 = b[15];
  38633. v = a[0];
  38634. t0 += v * b0;
  38635. t1 += v * b1;
  38636. t2 += v * b2;
  38637. t3 += v * b3;
  38638. t4 += v * b4;
  38639. t5 += v * b5;
  38640. t6 += v * b6;
  38641. t7 += v * b7;
  38642. t8 += v * b8;
  38643. t9 += v * b9;
  38644. t10 += v * b10;
  38645. t11 += v * b11;
  38646. t12 += v * b12;
  38647. t13 += v * b13;
  38648. t14 += v * b14;
  38649. t15 += v * b15;
  38650. v = a[1];
  38651. t1 += v * b0;
  38652. t2 += v * b1;
  38653. t3 += v * b2;
  38654. t4 += v * b3;
  38655. t5 += v * b4;
  38656. t6 += v * b5;
  38657. t7 += v * b6;
  38658. t8 += v * b7;
  38659. t9 += v * b8;
  38660. t10 += v * b9;
  38661. t11 += v * b10;
  38662. t12 += v * b11;
  38663. t13 += v * b12;
  38664. t14 += v * b13;
  38665. t15 += v * b14;
  38666. t16 += v * b15;
  38667. v = a[2];
  38668. t2 += v * b0;
  38669. t3 += v * b1;
  38670. t4 += v * b2;
  38671. t5 += v * b3;
  38672. t6 += v * b4;
  38673. t7 += v * b5;
  38674. t8 += v * b6;
  38675. t9 += v * b7;
  38676. t10 += v * b8;
  38677. t11 += v * b9;
  38678. t12 += v * b10;
  38679. t13 += v * b11;
  38680. t14 += v * b12;
  38681. t15 += v * b13;
  38682. t16 += v * b14;
  38683. t17 += v * b15;
  38684. v = a[3];
  38685. t3 += v * b0;
  38686. t4 += v * b1;
  38687. t5 += v * b2;
  38688. t6 += v * b3;
  38689. t7 += v * b4;
  38690. t8 += v * b5;
  38691. t9 += v * b6;
  38692. t10 += v * b7;
  38693. t11 += v * b8;
  38694. t12 += v * b9;
  38695. t13 += v * b10;
  38696. t14 += v * b11;
  38697. t15 += v * b12;
  38698. t16 += v * b13;
  38699. t17 += v * b14;
  38700. t18 += v * b15;
  38701. v = a[4];
  38702. t4 += v * b0;
  38703. t5 += v * b1;
  38704. t6 += v * b2;
  38705. t7 += v * b3;
  38706. t8 += v * b4;
  38707. t9 += v * b5;
  38708. t10 += v * b6;
  38709. t11 += v * b7;
  38710. t12 += v * b8;
  38711. t13 += v * b9;
  38712. t14 += v * b10;
  38713. t15 += v * b11;
  38714. t16 += v * b12;
  38715. t17 += v * b13;
  38716. t18 += v * b14;
  38717. t19 += v * b15;
  38718. v = a[5];
  38719. t5 += v * b0;
  38720. t6 += v * b1;
  38721. t7 += v * b2;
  38722. t8 += v * b3;
  38723. t9 += v * b4;
  38724. t10 += v * b5;
  38725. t11 += v * b6;
  38726. t12 += v * b7;
  38727. t13 += v * b8;
  38728. t14 += v * b9;
  38729. t15 += v * b10;
  38730. t16 += v * b11;
  38731. t17 += v * b12;
  38732. t18 += v * b13;
  38733. t19 += v * b14;
  38734. t20 += v * b15;
  38735. v = a[6];
  38736. t6 += v * b0;
  38737. t7 += v * b1;
  38738. t8 += v * b2;
  38739. t9 += v * b3;
  38740. t10 += v * b4;
  38741. t11 += v * b5;
  38742. t12 += v * b6;
  38743. t13 += v * b7;
  38744. t14 += v * b8;
  38745. t15 += v * b9;
  38746. t16 += v * b10;
  38747. t17 += v * b11;
  38748. t18 += v * b12;
  38749. t19 += v * b13;
  38750. t20 += v * b14;
  38751. t21 += v * b15;
  38752. v = a[7];
  38753. t7 += v * b0;
  38754. t8 += v * b1;
  38755. t9 += v * b2;
  38756. t10 += v * b3;
  38757. t11 += v * b4;
  38758. t12 += v * b5;
  38759. t13 += v * b6;
  38760. t14 += v * b7;
  38761. t15 += v * b8;
  38762. t16 += v * b9;
  38763. t17 += v * b10;
  38764. t18 += v * b11;
  38765. t19 += v * b12;
  38766. t20 += v * b13;
  38767. t21 += v * b14;
  38768. t22 += v * b15;
  38769. v = a[8];
  38770. t8 += v * b0;
  38771. t9 += v * b1;
  38772. t10 += v * b2;
  38773. t11 += v * b3;
  38774. t12 += v * b4;
  38775. t13 += v * b5;
  38776. t14 += v * b6;
  38777. t15 += v * b7;
  38778. t16 += v * b8;
  38779. t17 += v * b9;
  38780. t18 += v * b10;
  38781. t19 += v * b11;
  38782. t20 += v * b12;
  38783. t21 += v * b13;
  38784. t22 += v * b14;
  38785. t23 += v * b15;
  38786. v = a[9];
  38787. t9 += v * b0;
  38788. t10 += v * b1;
  38789. t11 += v * b2;
  38790. t12 += v * b3;
  38791. t13 += v * b4;
  38792. t14 += v * b5;
  38793. t15 += v * b6;
  38794. t16 += v * b7;
  38795. t17 += v * b8;
  38796. t18 += v * b9;
  38797. t19 += v * b10;
  38798. t20 += v * b11;
  38799. t21 += v * b12;
  38800. t22 += v * b13;
  38801. t23 += v * b14;
  38802. t24 += v * b15;
  38803. v = a[10];
  38804. t10 += v * b0;
  38805. t11 += v * b1;
  38806. t12 += v * b2;
  38807. t13 += v * b3;
  38808. t14 += v * b4;
  38809. t15 += v * b5;
  38810. t16 += v * b6;
  38811. t17 += v * b7;
  38812. t18 += v * b8;
  38813. t19 += v * b9;
  38814. t20 += v * b10;
  38815. t21 += v * b11;
  38816. t22 += v * b12;
  38817. t23 += v * b13;
  38818. t24 += v * b14;
  38819. t25 += v * b15;
  38820. v = a[11];
  38821. t11 += v * b0;
  38822. t12 += v * b1;
  38823. t13 += v * b2;
  38824. t14 += v * b3;
  38825. t15 += v * b4;
  38826. t16 += v * b5;
  38827. t17 += v * b6;
  38828. t18 += v * b7;
  38829. t19 += v * b8;
  38830. t20 += v * b9;
  38831. t21 += v * b10;
  38832. t22 += v * b11;
  38833. t23 += v * b12;
  38834. t24 += v * b13;
  38835. t25 += v * b14;
  38836. t26 += v * b15;
  38837. v = a[12];
  38838. t12 += v * b0;
  38839. t13 += v * b1;
  38840. t14 += v * b2;
  38841. t15 += v * b3;
  38842. t16 += v * b4;
  38843. t17 += v * b5;
  38844. t18 += v * b6;
  38845. t19 += v * b7;
  38846. t20 += v * b8;
  38847. t21 += v * b9;
  38848. t22 += v * b10;
  38849. t23 += v * b11;
  38850. t24 += v * b12;
  38851. t25 += v * b13;
  38852. t26 += v * b14;
  38853. t27 += v * b15;
  38854. v = a[13];
  38855. t13 += v * b0;
  38856. t14 += v * b1;
  38857. t15 += v * b2;
  38858. t16 += v * b3;
  38859. t17 += v * b4;
  38860. t18 += v * b5;
  38861. t19 += v * b6;
  38862. t20 += v * b7;
  38863. t21 += v * b8;
  38864. t22 += v * b9;
  38865. t23 += v * b10;
  38866. t24 += v * b11;
  38867. t25 += v * b12;
  38868. t26 += v * b13;
  38869. t27 += v * b14;
  38870. t28 += v * b15;
  38871. v = a[14];
  38872. t14 += v * b0;
  38873. t15 += v * b1;
  38874. t16 += v * b2;
  38875. t17 += v * b3;
  38876. t18 += v * b4;
  38877. t19 += v * b5;
  38878. t20 += v * b6;
  38879. t21 += v * b7;
  38880. t22 += v * b8;
  38881. t23 += v * b9;
  38882. t24 += v * b10;
  38883. t25 += v * b11;
  38884. t26 += v * b12;
  38885. t27 += v * b13;
  38886. t28 += v * b14;
  38887. t29 += v * b15;
  38888. v = a[15];
  38889. t15 += v * b0;
  38890. t16 += v * b1;
  38891. t17 += v * b2;
  38892. t18 += v * b3;
  38893. t19 += v * b4;
  38894. t20 += v * b5;
  38895. t21 += v * b6;
  38896. t22 += v * b7;
  38897. t23 += v * b8;
  38898. t24 += v * b9;
  38899. t25 += v * b10;
  38900. t26 += v * b11;
  38901. t27 += v * b12;
  38902. t28 += v * b13;
  38903. t29 += v * b14;
  38904. t30 += v * b15;
  38905. t0 += 38 * t16;
  38906. t1 += 38 * t17;
  38907. t2 += 38 * t18;
  38908. t3 += 38 * t19;
  38909. t4 += 38 * t20;
  38910. t5 += 38 * t21;
  38911. t6 += 38 * t22;
  38912. t7 += 38 * t23;
  38913. t8 += 38 * t24;
  38914. t9 += 38 * t25;
  38915. t10 += 38 * t26;
  38916. t11 += 38 * t27;
  38917. t12 += 38 * t28;
  38918. t13 += 38 * t29;
  38919. t14 += 38 * t30;
  38920. // t15 left as is
  38921. // first car
  38922. c = 1;
  38923. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38924. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38925. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38926. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38927. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38928. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38929. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38930. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38931. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38932. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38933. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38934. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38935. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38936. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38937. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38938. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38939. t0 += c-1 + 37 * (c-1);
  38940. // second car
  38941. c = 1;
  38942. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38943. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38944. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38945. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38946. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38947. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38948. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38949. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38950. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38951. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38952. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38953. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38954. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38955. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38956. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38957. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38958. t0 += c-1 + 37 * (c-1);
  38959. o[ 0] = t0;
  38960. o[ 1] = t1;
  38961. o[ 2] = t2;
  38962. o[ 3] = t3;
  38963. o[ 4] = t4;
  38964. o[ 5] = t5;
  38965. o[ 6] = t6;
  38966. o[ 7] = t7;
  38967. o[ 8] = t8;
  38968. o[ 9] = t9;
  38969. o[10] = t10;
  38970. o[11] = t11;
  38971. o[12] = t12;
  38972. o[13] = t13;
  38973. o[14] = t14;
  38974. o[15] = t15;
  38975. }
  38976. function S(o, a) {
  38977. M(o, a, a);
  38978. }
  38979. function inv25519(o, i) {
  38980. var c = gf();
  38981. var a;
  38982. for (a = 0; a < 16; a++) c[a] = i[a];
  38983. for (a = 253; a >= 0; a--) {
  38984. S(c, c);
  38985. if(a !== 2 && a !== 4) M(c, c, i);
  38986. }
  38987. for (a = 0; a < 16; a++) o[a] = c[a];
  38988. }
  38989. function pow2523(o, i) {
  38990. var c = gf();
  38991. var a;
  38992. for (a = 0; a < 16; a++) c[a] = i[a];
  38993. for (a = 250; a >= 0; a--) {
  38994. S(c, c);
  38995. if(a !== 1) M(c, c, i);
  38996. }
  38997. for (a = 0; a < 16; a++) o[a] = c[a];
  38998. }
  38999. function crypto_scalarmult(q, n, p) {
  39000. var z = new Uint8Array(32);
  39001. var x = new Float64Array(80), r, i;
  39002. var a = gf(), b = gf(), c = gf(),
  39003. d = gf(), e = gf(), f = gf();
  39004. for (i = 0; i < 31; i++) z[i] = n[i];
  39005. z[31]=(n[31]&127)|64;
  39006. z[0]&=248;
  39007. unpack25519(x,p);
  39008. for (i = 0; i < 16; i++) {
  39009. b[i]=x[i];
  39010. d[i]=a[i]=c[i]=0;
  39011. }
  39012. a[0]=d[0]=1;
  39013. for (i=254; i>=0; --i) {
  39014. r=(z[i>>>3]>>>(i&7))&1;
  39015. sel25519(a,b,r);
  39016. sel25519(c,d,r);
  39017. A(e,a,c);
  39018. Z(a,a,c);
  39019. A(c,b,d);
  39020. Z(b,b,d);
  39021. S(d,e);
  39022. S(f,a);
  39023. M(a,c,a);
  39024. M(c,b,e);
  39025. A(e,a,c);
  39026. Z(a,a,c);
  39027. S(b,a);
  39028. Z(c,d,f);
  39029. M(a,c,_121665);
  39030. A(a,a,d);
  39031. M(c,c,a);
  39032. M(a,d,f);
  39033. M(d,b,x);
  39034. S(b,e);
  39035. sel25519(a,b,r);
  39036. sel25519(c,d,r);
  39037. }
  39038. for (i = 0; i < 16; i++) {
  39039. x[i+16]=a[i];
  39040. x[i+32]=c[i];
  39041. x[i+48]=b[i];
  39042. x[i+64]=d[i];
  39043. }
  39044. var x32 = x.subarray(32);
  39045. var x16 = x.subarray(16);
  39046. inv25519(x32,x32);
  39047. M(x16,x16,x32);
  39048. pack25519(q,x16);
  39049. return 0;
  39050. }
  39051. function crypto_scalarmult_base(q, n) {
  39052. return crypto_scalarmult(q, n, _9);
  39053. }
  39054. function crypto_box_keypair(y, x) {
  39055. randombytes(x, 32);
  39056. return crypto_scalarmult_base(y, x);
  39057. }
  39058. function crypto_box_beforenm(k, y, x) {
  39059. var s = new Uint8Array(32);
  39060. crypto_scalarmult(s, x, y);
  39061. return crypto_core_hsalsa20(k, _0, s, sigma);
  39062. }
  39063. var crypto_box_afternm = crypto_secretbox;
  39064. var crypto_box_open_afternm = crypto_secretbox_open;
  39065. function crypto_box(c, m, d, n, y, x) {
  39066. var k = new Uint8Array(32);
  39067. crypto_box_beforenm(k, y, x);
  39068. return crypto_box_afternm(c, m, d, n, k);
  39069. }
  39070. function crypto_box_open(m, c, d, n, y, x) {
  39071. var k = new Uint8Array(32);
  39072. crypto_box_beforenm(k, y, x);
  39073. return crypto_box_open_afternm(m, c, d, n, k);
  39074. }
  39075. var K = [
  39076. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  39077. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  39078. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  39079. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  39080. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  39081. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  39082. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  39083. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  39084. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  39085. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  39086. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  39087. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  39088. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  39089. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  39090. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  39091. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  39092. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  39093. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  39094. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  39095. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  39096. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  39097. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  39098. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  39099. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  39100. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  39101. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  39102. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  39103. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  39104. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  39105. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  39106. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  39107. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  39108. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  39109. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  39110. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  39111. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  39112. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  39113. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  39114. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  39115. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  39116. ];
  39117. function crypto_hashblocks_hl(hh, hl, m, n) {
  39118. var wh = new Int32Array(16), wl = new Int32Array(16),
  39119. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  39120. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  39121. th, tl, i, j, h, l, a, b, c, d;
  39122. var ah0 = hh[0],
  39123. ah1 = hh[1],
  39124. ah2 = hh[2],
  39125. ah3 = hh[3],
  39126. ah4 = hh[4],
  39127. ah5 = hh[5],
  39128. ah6 = hh[6],
  39129. ah7 = hh[7],
  39130. al0 = hl[0],
  39131. al1 = hl[1],
  39132. al2 = hl[2],
  39133. al3 = hl[3],
  39134. al4 = hl[4],
  39135. al5 = hl[5],
  39136. al6 = hl[6],
  39137. al7 = hl[7];
  39138. var pos = 0;
  39139. while (n >= 128) {
  39140. for (i = 0; i < 16; i++) {
  39141. j = 8 * i + pos;
  39142. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  39143. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  39144. }
  39145. for (i = 0; i < 80; i++) {
  39146. bh0 = ah0;
  39147. bh1 = ah1;
  39148. bh2 = ah2;
  39149. bh3 = ah3;
  39150. bh4 = ah4;
  39151. bh5 = ah5;
  39152. bh6 = ah6;
  39153. bh7 = ah7;
  39154. bl0 = al0;
  39155. bl1 = al1;
  39156. bl2 = al2;
  39157. bl3 = al3;
  39158. bl4 = al4;
  39159. bl5 = al5;
  39160. bl6 = al6;
  39161. bl7 = al7;
  39162. // add
  39163. h = ah7;
  39164. l = al7;
  39165. a = l & 0xffff; b = l >>> 16;
  39166. c = h & 0xffff; d = h >>> 16;
  39167. // Sigma1
  39168. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  39169. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  39170. a += l & 0xffff; b += l >>> 16;
  39171. c += h & 0xffff; d += h >>> 16;
  39172. // Ch
  39173. h = (ah4 & ah5) ^ (~ah4 & ah6);
  39174. l = (al4 & al5) ^ (~al4 & al6);
  39175. a += l & 0xffff; b += l >>> 16;
  39176. c += h & 0xffff; d += h >>> 16;
  39177. // K
  39178. h = K[i*2];
  39179. l = K[i*2+1];
  39180. a += l & 0xffff; b += l >>> 16;
  39181. c += h & 0xffff; d += h >>> 16;
  39182. // w
  39183. h = wh[i%16];
  39184. l = wl[i%16];
  39185. a += l & 0xffff; b += l >>> 16;
  39186. c += h & 0xffff; d += h >>> 16;
  39187. b += a >>> 16;
  39188. c += b >>> 16;
  39189. d += c >>> 16;
  39190. th = c & 0xffff | d << 16;
  39191. tl = a & 0xffff | b << 16;
  39192. // add
  39193. h = th;
  39194. l = tl;
  39195. a = l & 0xffff; b = l >>> 16;
  39196. c = h & 0xffff; d = h >>> 16;
  39197. // Sigma0
  39198. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  39199. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  39200. a += l & 0xffff; b += l >>> 16;
  39201. c += h & 0xffff; d += h >>> 16;
  39202. // Maj
  39203. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  39204. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  39205. a += l & 0xffff; b += l >>> 16;
  39206. c += h & 0xffff; d += h >>> 16;
  39207. b += a >>> 16;
  39208. c += b >>> 16;
  39209. d += c >>> 16;
  39210. bh7 = (c & 0xffff) | (d << 16);
  39211. bl7 = (a & 0xffff) | (b << 16);
  39212. // add
  39213. h = bh3;
  39214. l = bl3;
  39215. a = l & 0xffff; b = l >>> 16;
  39216. c = h & 0xffff; d = h >>> 16;
  39217. h = th;
  39218. l = tl;
  39219. a += l & 0xffff; b += l >>> 16;
  39220. c += h & 0xffff; d += h >>> 16;
  39221. b += a >>> 16;
  39222. c += b >>> 16;
  39223. d += c >>> 16;
  39224. bh3 = (c & 0xffff) | (d << 16);
  39225. bl3 = (a & 0xffff) | (b << 16);
  39226. ah1 = bh0;
  39227. ah2 = bh1;
  39228. ah3 = bh2;
  39229. ah4 = bh3;
  39230. ah5 = bh4;
  39231. ah6 = bh5;
  39232. ah7 = bh6;
  39233. ah0 = bh7;
  39234. al1 = bl0;
  39235. al2 = bl1;
  39236. al3 = bl2;
  39237. al4 = bl3;
  39238. al5 = bl4;
  39239. al6 = bl5;
  39240. al7 = bl6;
  39241. al0 = bl7;
  39242. if (i%16 === 15) {
  39243. for (j = 0; j < 16; j++) {
  39244. // add
  39245. h = wh[j];
  39246. l = wl[j];
  39247. a = l & 0xffff; b = l >>> 16;
  39248. c = h & 0xffff; d = h >>> 16;
  39249. h = wh[(j+9)%16];
  39250. l = wl[(j+9)%16];
  39251. a += l & 0xffff; b += l >>> 16;
  39252. c += h & 0xffff; d += h >>> 16;
  39253. // sigma0
  39254. th = wh[(j+1)%16];
  39255. tl = wl[(j+1)%16];
  39256. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  39257. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  39258. a += l & 0xffff; b += l >>> 16;
  39259. c += h & 0xffff; d += h >>> 16;
  39260. // sigma1
  39261. th = wh[(j+14)%16];
  39262. tl = wl[(j+14)%16];
  39263. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  39264. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  39265. a += l & 0xffff; b += l >>> 16;
  39266. c += h & 0xffff; d += h >>> 16;
  39267. b += a >>> 16;
  39268. c += b >>> 16;
  39269. d += c >>> 16;
  39270. wh[j] = (c & 0xffff) | (d << 16);
  39271. wl[j] = (a & 0xffff) | (b << 16);
  39272. }
  39273. }
  39274. }
  39275. // add
  39276. h = ah0;
  39277. l = al0;
  39278. a = l & 0xffff; b = l >>> 16;
  39279. c = h & 0xffff; d = h >>> 16;
  39280. h = hh[0];
  39281. l = hl[0];
  39282. a += l & 0xffff; b += l >>> 16;
  39283. c += h & 0xffff; d += h >>> 16;
  39284. b += a >>> 16;
  39285. c += b >>> 16;
  39286. d += c >>> 16;
  39287. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  39288. hl[0] = al0 = (a & 0xffff) | (b << 16);
  39289. h = ah1;
  39290. l = al1;
  39291. a = l & 0xffff; b = l >>> 16;
  39292. c = h & 0xffff; d = h >>> 16;
  39293. h = hh[1];
  39294. l = hl[1];
  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[1] = ah1 = (c & 0xffff) | (d << 16);
  39301. hl[1] = al1 = (a & 0xffff) | (b << 16);
  39302. h = ah2;
  39303. l = al2;
  39304. a = l & 0xffff; b = l >>> 16;
  39305. c = h & 0xffff; d = h >>> 16;
  39306. h = hh[2];
  39307. l = hl[2];
  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[2] = ah2 = (c & 0xffff) | (d << 16);
  39314. hl[2] = al2 = (a & 0xffff) | (b << 16);
  39315. h = ah3;
  39316. l = al3;
  39317. a = l & 0xffff; b = l >>> 16;
  39318. c = h & 0xffff; d = h >>> 16;
  39319. h = hh[3];
  39320. l = hl[3];
  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[3] = ah3 = (c & 0xffff) | (d << 16);
  39327. hl[3] = al3 = (a & 0xffff) | (b << 16);
  39328. h = ah4;
  39329. l = al4;
  39330. a = l & 0xffff; b = l >>> 16;
  39331. c = h & 0xffff; d = h >>> 16;
  39332. h = hh[4];
  39333. l = hl[4];
  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[4] = ah4 = (c & 0xffff) | (d << 16);
  39340. hl[4] = al4 = (a & 0xffff) | (b << 16);
  39341. h = ah5;
  39342. l = al5;
  39343. a = l & 0xffff; b = l >>> 16;
  39344. c = h & 0xffff; d = h >>> 16;
  39345. h = hh[5];
  39346. l = hl[5];
  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[5] = ah5 = (c & 0xffff) | (d << 16);
  39353. hl[5] = al5 = (a & 0xffff) | (b << 16);
  39354. h = ah6;
  39355. l = al6;
  39356. a = l & 0xffff; b = l >>> 16;
  39357. c = h & 0xffff; d = h >>> 16;
  39358. h = hh[6];
  39359. l = hl[6];
  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[6] = ah6 = (c & 0xffff) | (d << 16);
  39366. hl[6] = al6 = (a & 0xffff) | (b << 16);
  39367. h = ah7;
  39368. l = al7;
  39369. a = l & 0xffff; b = l >>> 16;
  39370. c = h & 0xffff; d = h >>> 16;
  39371. h = hh[7];
  39372. l = hl[7];
  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[7] = ah7 = (c & 0xffff) | (d << 16);
  39379. hl[7] = al7 = (a & 0xffff) | (b << 16);
  39380. pos += 128;
  39381. n -= 128;
  39382. }
  39383. return n;
  39384. }
  39385. function crypto_hash(out, m, n) {
  39386. var hh = new Int32Array(8),
  39387. hl = new Int32Array(8),
  39388. x = new Uint8Array(256),
  39389. i, b = n;
  39390. hh[0] = 0x6a09e667;
  39391. hh[1] = 0xbb67ae85;
  39392. hh[2] = 0x3c6ef372;
  39393. hh[3] = 0xa54ff53a;
  39394. hh[4] = 0x510e527f;
  39395. hh[5] = 0x9b05688c;
  39396. hh[6] = 0x1f83d9ab;
  39397. hh[7] = 0x5be0cd19;
  39398. hl[0] = 0xf3bcc908;
  39399. hl[1] = 0x84caa73b;
  39400. hl[2] = 0xfe94f82b;
  39401. hl[3] = 0x5f1d36f1;
  39402. hl[4] = 0xade682d1;
  39403. hl[5] = 0x2b3e6c1f;
  39404. hl[6] = 0xfb41bd6b;
  39405. hl[7] = 0x137e2179;
  39406. crypto_hashblocks_hl(hh, hl, m, n);
  39407. n %= 128;
  39408. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  39409. x[n] = 128;
  39410. n = 256-128*(n<112?1:0);
  39411. x[n-9] = 0;
  39412. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  39413. crypto_hashblocks_hl(hh, hl, x, n);
  39414. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  39415. return 0;
  39416. }
  39417. function add(p, q) {
  39418. var a = gf(), b = gf(), c = gf(),
  39419. d = gf(), e = gf(), f = gf(),
  39420. g = gf(), h = gf(), t = gf();
  39421. Z(a, p[1], p[0]);
  39422. Z(t, q[1], q[0]);
  39423. M(a, a, t);
  39424. A(b, p[0], p[1]);
  39425. A(t, q[0], q[1]);
  39426. M(b, b, t);
  39427. M(c, p[3], q[3]);
  39428. M(c, c, D2);
  39429. M(d, p[2], q[2]);
  39430. A(d, d, d);
  39431. Z(e, b, a);
  39432. Z(f, d, c);
  39433. A(g, d, c);
  39434. A(h, b, a);
  39435. M(p[0], e, f);
  39436. M(p[1], h, g);
  39437. M(p[2], g, f);
  39438. M(p[3], e, h);
  39439. }
  39440. function cswap(p, q, b) {
  39441. var i;
  39442. for (i = 0; i < 4; i++) {
  39443. sel25519(p[i], q[i], b);
  39444. }
  39445. }
  39446. function pack(r, p) {
  39447. var tx = gf(), ty = gf(), zi = gf();
  39448. inv25519(zi, p[2]);
  39449. M(tx, p[0], zi);
  39450. M(ty, p[1], zi);
  39451. pack25519(r, ty);
  39452. r[31] ^= par25519(tx) << 7;
  39453. }
  39454. function scalarmult(p, q, s) {
  39455. var b, i;
  39456. set25519(p[0], gf0);
  39457. set25519(p[1], gf1);
  39458. set25519(p[2], gf1);
  39459. set25519(p[3], gf0);
  39460. for (i = 255; i >= 0; --i) {
  39461. b = (s[(i/8)|0] >> (i&7)) & 1;
  39462. cswap(p, q, b);
  39463. add(q, p);
  39464. add(p, p);
  39465. cswap(p, q, b);
  39466. }
  39467. }
  39468. function scalarbase(p, s) {
  39469. var q = [gf(), gf(), gf(), gf()];
  39470. set25519(q[0], X);
  39471. set25519(q[1], Y);
  39472. set25519(q[2], gf1);
  39473. M(q[3], X, Y);
  39474. scalarmult(p, q, s);
  39475. }
  39476. function crypto_sign_keypair(pk, sk, seeded) {
  39477. var d = new Uint8Array(64);
  39478. var p = [gf(), gf(), gf(), gf()];
  39479. var i;
  39480. if (!seeded) randombytes(sk, 32);
  39481. crypto_hash(d, sk, 32);
  39482. d[0] &= 248;
  39483. d[31] &= 127;
  39484. d[31] |= 64;
  39485. scalarbase(p, d);
  39486. pack(pk, p);
  39487. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  39488. return 0;
  39489. }
  39490. 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]);
  39491. function modL(r, x) {
  39492. var carry, i, j, k;
  39493. for (i = 63; i >= 32; --i) {
  39494. carry = 0;
  39495. for (j = i - 32, k = i - 12; j < k; ++j) {
  39496. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  39497. carry = (x[j] + 128) >> 8;
  39498. x[j] -= carry * 256;
  39499. }
  39500. x[j] += carry;
  39501. x[i] = 0;
  39502. }
  39503. carry = 0;
  39504. for (j = 0; j < 32; j++) {
  39505. x[j] += carry - (x[31] >> 4) * L[j];
  39506. carry = x[j] >> 8;
  39507. x[j] &= 255;
  39508. }
  39509. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  39510. for (i = 0; i < 32; i++) {
  39511. x[i+1] += x[i] >> 8;
  39512. r[i] = x[i] & 255;
  39513. }
  39514. }
  39515. function reduce(r) {
  39516. var x = new Float64Array(64), i;
  39517. for (i = 0; i < 64; i++) x[i] = r[i];
  39518. for (i = 0; i < 64; i++) r[i] = 0;
  39519. modL(r, x);
  39520. }
  39521. // Note: difference from C - smlen returned, not passed as argument.
  39522. function crypto_sign(sm, m, n, sk) {
  39523. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  39524. var i, j, x = new Float64Array(64);
  39525. var p = [gf(), gf(), gf(), gf()];
  39526. crypto_hash(d, sk, 32);
  39527. d[0] &= 248;
  39528. d[31] &= 127;
  39529. d[31] |= 64;
  39530. var smlen = n + 64;
  39531. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  39532. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  39533. crypto_hash(r, sm.subarray(32), n+32);
  39534. reduce(r);
  39535. scalarbase(p, r);
  39536. pack(sm, p);
  39537. for (i = 32; i < 64; i++) sm[i] = sk[i];
  39538. crypto_hash(h, sm, n + 64);
  39539. reduce(h);
  39540. for (i = 0; i < 64; i++) x[i] = 0;
  39541. for (i = 0; i < 32; i++) x[i] = r[i];
  39542. for (i = 0; i < 32; i++) {
  39543. for (j = 0; j < 32; j++) {
  39544. x[i+j] += h[i] * d[j];
  39545. }
  39546. }
  39547. modL(sm.subarray(32), x);
  39548. return smlen;
  39549. }
  39550. function unpackneg(r, p) {
  39551. var t = gf(), chk = gf(), num = gf(),
  39552. den = gf(), den2 = gf(), den4 = gf(),
  39553. den6 = gf();
  39554. set25519(r[2], gf1);
  39555. unpack25519(r[1], p);
  39556. S(num, r[1]);
  39557. M(den, num, D);
  39558. Z(num, num, r[2]);
  39559. A(den, r[2], den);
  39560. S(den2, den);
  39561. S(den4, den2);
  39562. M(den6, den4, den2);
  39563. M(t, den6, num);
  39564. M(t, t, den);
  39565. pow2523(t, t);
  39566. M(t, t, num);
  39567. M(t, t, den);
  39568. M(t, t, den);
  39569. M(r[0], t, den);
  39570. S(chk, r[0]);
  39571. M(chk, chk, den);
  39572. if (neq25519(chk, num)) M(r[0], r[0], I);
  39573. S(chk, r[0]);
  39574. M(chk, chk, den);
  39575. if (neq25519(chk, num)) return -1;
  39576. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  39577. M(r[3], r[0], r[1]);
  39578. return 0;
  39579. }
  39580. function crypto_sign_open(m, sm, n, pk) {
  39581. var i, mlen;
  39582. var t = new Uint8Array(32), h = new Uint8Array(64);
  39583. var p = [gf(), gf(), gf(), gf()],
  39584. q = [gf(), gf(), gf(), gf()];
  39585. mlen = -1;
  39586. if (n < 64) return -1;
  39587. if (unpackneg(q, pk)) return -1;
  39588. for (i = 0; i < n; i++) m[i] = sm[i];
  39589. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  39590. crypto_hash(h, m, n);
  39591. reduce(h);
  39592. scalarmult(p, q, h);
  39593. scalarbase(q, sm.subarray(32));
  39594. add(p, q);
  39595. pack(t, p);
  39596. n -= 64;
  39597. if (crypto_verify_32(sm, 0, t, 0)) {
  39598. for (i = 0; i < n; i++) m[i] = 0;
  39599. return -1;
  39600. }
  39601. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  39602. mlen = n;
  39603. return mlen;
  39604. }
  39605. var crypto_secretbox_KEYBYTES = 32,
  39606. crypto_secretbox_NONCEBYTES = 24,
  39607. crypto_secretbox_ZEROBYTES = 32,
  39608. crypto_secretbox_BOXZEROBYTES = 16,
  39609. crypto_scalarmult_BYTES = 32,
  39610. crypto_scalarmult_SCALARBYTES = 32,
  39611. crypto_box_PUBLICKEYBYTES = 32,
  39612. crypto_box_SECRETKEYBYTES = 32,
  39613. crypto_box_BEFORENMBYTES = 32,
  39614. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  39615. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  39616. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  39617. crypto_sign_BYTES = 64,
  39618. crypto_sign_PUBLICKEYBYTES = 32,
  39619. crypto_sign_SECRETKEYBYTES = 64,
  39620. crypto_sign_SEEDBYTES = 32,
  39621. crypto_hash_BYTES = 64;
  39622. nacl.lowlevel = {
  39623. crypto_core_hsalsa20: crypto_core_hsalsa20,
  39624. crypto_stream_xor: crypto_stream_xor,
  39625. crypto_stream: crypto_stream,
  39626. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  39627. crypto_stream_salsa20: crypto_stream_salsa20,
  39628. crypto_onetimeauth: crypto_onetimeauth,
  39629. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  39630. crypto_verify_16: crypto_verify_16,
  39631. crypto_verify_32: crypto_verify_32,
  39632. crypto_secretbox: crypto_secretbox,
  39633. crypto_secretbox_open: crypto_secretbox_open,
  39634. crypto_scalarmult: crypto_scalarmult,
  39635. crypto_scalarmult_base: crypto_scalarmult_base,
  39636. crypto_box_beforenm: crypto_box_beforenm,
  39637. crypto_box_afternm: crypto_box_afternm,
  39638. crypto_box: crypto_box,
  39639. crypto_box_open: crypto_box_open,
  39640. crypto_box_keypair: crypto_box_keypair,
  39641. crypto_hash: crypto_hash,
  39642. crypto_sign: crypto_sign,
  39643. crypto_sign_keypair: crypto_sign_keypair,
  39644. crypto_sign_open: crypto_sign_open,
  39645. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  39646. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  39647. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  39648. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  39649. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  39650. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  39651. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  39652. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  39653. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  39654. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  39655. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  39656. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  39657. crypto_sign_BYTES: crypto_sign_BYTES,
  39658. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  39659. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  39660. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  39661. crypto_hash_BYTES: crypto_hash_BYTES
  39662. };
  39663. /* High-level API */
  39664. function checkLengths(k, n) {
  39665. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  39666. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  39667. }
  39668. function checkBoxLengths(pk, sk) {
  39669. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  39670. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  39671. }
  39672. function checkArrayTypes() {
  39673. for (var i = 0; i < arguments.length; i++) {
  39674. if (!(arguments[i] instanceof Uint8Array))
  39675. throw new TypeError('unexpected type, use Uint8Array');
  39676. }
  39677. }
  39678. function cleanup(arr) {
  39679. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  39680. }
  39681. nacl.randomBytes = function(n) {
  39682. var b = new Uint8Array(n);
  39683. randombytes(b, n);
  39684. return b;
  39685. };
  39686. nacl.secretbox = function(msg, nonce, key) {
  39687. checkArrayTypes(msg, nonce, key);
  39688. checkLengths(key, nonce);
  39689. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  39690. var c = new Uint8Array(m.length);
  39691. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  39692. crypto_secretbox(c, m, m.length, nonce, key);
  39693. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  39694. };
  39695. nacl.secretbox.open = function(box, nonce, key) {
  39696. checkArrayTypes(box, nonce, key);
  39697. checkLengths(key, nonce);
  39698. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  39699. var m = new Uint8Array(c.length);
  39700. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  39701. if (c.length < 32) return null;
  39702. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  39703. return m.subarray(crypto_secretbox_ZEROBYTES);
  39704. };
  39705. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  39706. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  39707. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  39708. nacl.scalarMult = function(n, p) {
  39709. checkArrayTypes(n, p);
  39710. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39711. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  39712. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39713. crypto_scalarmult(q, n, p);
  39714. return q;
  39715. };
  39716. nacl.scalarMult.base = function(n) {
  39717. checkArrayTypes(n);
  39718. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  39719. var q = new Uint8Array(crypto_scalarmult_BYTES);
  39720. crypto_scalarmult_base(q, n);
  39721. return q;
  39722. };
  39723. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  39724. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  39725. nacl.box = function(msg, nonce, publicKey, secretKey) {
  39726. var k = nacl.box.before(publicKey, secretKey);
  39727. return nacl.secretbox(msg, nonce, k);
  39728. };
  39729. nacl.box.before = function(publicKey, secretKey) {
  39730. checkArrayTypes(publicKey, secretKey);
  39731. checkBoxLengths(publicKey, secretKey);
  39732. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  39733. crypto_box_beforenm(k, publicKey, secretKey);
  39734. return k;
  39735. };
  39736. nacl.box.after = nacl.secretbox;
  39737. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  39738. var k = nacl.box.before(publicKey, secretKey);
  39739. return nacl.secretbox.open(msg, nonce, k);
  39740. };
  39741. nacl.box.open.after = nacl.secretbox.open;
  39742. nacl.box.keyPair = function() {
  39743. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39744. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  39745. crypto_box_keypair(pk, sk);
  39746. return {publicKey: pk, secretKey: sk};
  39747. };
  39748. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  39749. checkArrayTypes(secretKey);
  39750. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  39751. throw new Error('bad secret key size');
  39752. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  39753. crypto_scalarmult_base(pk, secretKey);
  39754. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39755. };
  39756. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  39757. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  39758. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  39759. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  39760. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  39761. nacl.sign = function(msg, secretKey) {
  39762. checkArrayTypes(msg, secretKey);
  39763. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39764. throw new Error('bad secret key size');
  39765. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  39766. crypto_sign(signedMsg, msg, msg.length, secretKey);
  39767. return signedMsg;
  39768. };
  39769. nacl.sign.open = function(signedMsg, publicKey) {
  39770. checkArrayTypes(signedMsg, publicKey);
  39771. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39772. throw new Error('bad public key size');
  39773. var tmp = new Uint8Array(signedMsg.length);
  39774. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  39775. if (mlen < 0) return null;
  39776. var m = new Uint8Array(mlen);
  39777. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  39778. return m;
  39779. };
  39780. nacl.sign.detached = function(msg, secretKey) {
  39781. var signedMsg = nacl.sign(msg, secretKey);
  39782. var sig = new Uint8Array(crypto_sign_BYTES);
  39783. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39784. return sig;
  39785. };
  39786. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39787. checkArrayTypes(msg, sig, publicKey);
  39788. if (sig.length !== crypto_sign_BYTES)
  39789. throw new Error('bad signature size');
  39790. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39791. throw new Error('bad public key size');
  39792. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39793. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39794. var i;
  39795. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39796. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39797. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39798. };
  39799. nacl.sign.keyPair = function() {
  39800. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39801. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39802. crypto_sign_keypair(pk, sk);
  39803. return {publicKey: pk, secretKey: sk};
  39804. };
  39805. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39806. checkArrayTypes(secretKey);
  39807. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39808. throw new Error('bad secret key size');
  39809. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39810. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39811. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39812. };
  39813. nacl.sign.keyPair.fromSeed = function(seed) {
  39814. checkArrayTypes(seed);
  39815. if (seed.length !== crypto_sign_SEEDBYTES)
  39816. throw new Error('bad seed size');
  39817. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39818. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39819. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39820. crypto_sign_keypair(pk, sk, true);
  39821. return {publicKey: pk, secretKey: sk};
  39822. };
  39823. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39824. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39825. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39826. nacl.sign.signatureLength = crypto_sign_BYTES;
  39827. nacl.hash = function(msg) {
  39828. checkArrayTypes(msg);
  39829. var h = new Uint8Array(crypto_hash_BYTES);
  39830. crypto_hash(h, msg, msg.length);
  39831. return h;
  39832. };
  39833. nacl.hash.hashLength = crypto_hash_BYTES;
  39834. nacl.verify = function(x, y) {
  39835. checkArrayTypes(x, y);
  39836. // Zero length arguments are considered not equal.
  39837. if (x.length === 0 || y.length === 0) return false;
  39838. if (x.length !== y.length) return false;
  39839. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39840. };
  39841. nacl.setPRNG = function(fn) {
  39842. randombytes = fn;
  39843. };
  39844. (function() {
  39845. // Initialize PRNG if environment provides CSPRNG.
  39846. // If not, methods calling randombytes will throw.
  39847. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39848. if (crypto && crypto.getRandomValues) {
  39849. // Browsers.
  39850. var QUOTA = 65536;
  39851. nacl.setPRNG(function(x, n) {
  39852. var i, v = new Uint8Array(n);
  39853. for (i = 0; i < n; i += QUOTA) {
  39854. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39855. }
  39856. for (i = 0; i < n; i++) x[i] = v[i];
  39857. cleanup(v);
  39858. });
  39859. } else if (true) {
  39860. // Node.js.
  39861. crypto = __webpack_require__(3);
  39862. if (crypto && crypto.randomBytes) {
  39863. nacl.setPRNG(function(x, n) {
  39864. var i, v = crypto.randomBytes(n);
  39865. for (i = 0; i < n; i++) x[i] = v[i];
  39866. cleanup(v);
  39867. });
  39868. }
  39869. }
  39870. })();
  39871. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39872. /***/ }),
  39873. /* 1 */
  39874. /***/ (function(module, exports, __webpack_require__) {
  39875. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39876. // Public domain.
  39877. (function(root, f) {
  39878. 'use strict';
  39879. if ( true && module.exports) module.exports = f();
  39880. else if (root.nacl) root.nacl.util = f();
  39881. else {
  39882. root.nacl = {};
  39883. root.nacl.util = f();
  39884. }
  39885. }(this, function() {
  39886. 'use strict';
  39887. var util = {};
  39888. function validateBase64(s) {
  39889. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39890. throw new TypeError('invalid encoding');
  39891. }
  39892. }
  39893. util.decodeUTF8 = function(s) {
  39894. if (typeof s !== 'string') throw new TypeError('expected string');
  39895. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39896. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39897. return b;
  39898. };
  39899. util.encodeUTF8 = function(arr) {
  39900. var i, s = [];
  39901. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39902. return decodeURIComponent(escape(s.join('')));
  39903. };
  39904. if (typeof atob === 'undefined') {
  39905. // Node.js
  39906. if (typeof Buffer.from !== 'undefined') {
  39907. // Node v6 and later
  39908. util.encodeBase64 = function (arr) { // v6 and later
  39909. return Buffer.from(arr).toString('base64');
  39910. };
  39911. util.decodeBase64 = function (s) {
  39912. validateBase64(s);
  39913. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39914. };
  39915. } else {
  39916. // Node earlier than v6
  39917. util.encodeBase64 = function (arr) { // v6 and later
  39918. return (new Buffer(arr)).toString('base64');
  39919. };
  39920. util.decodeBase64 = function(s) {
  39921. validateBase64(s);
  39922. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39923. };
  39924. }
  39925. } else {
  39926. // Browsers
  39927. util.encodeBase64 = function(arr) {
  39928. var i, s = [], len = arr.length;
  39929. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39930. return btoa(s.join(''));
  39931. };
  39932. util.decodeBase64 = function(s) {
  39933. validateBase64(s);
  39934. var i, d = atob(s), b = new Uint8Array(d.length);
  39935. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39936. return b;
  39937. };
  39938. }
  39939. return util;
  39940. }));
  39941. /***/ }),
  39942. /* 2 */
  39943. /***/ (function(module, exports, __webpack_require__) {
  39944. // required so we don't have to do require('pusher').default etc.
  39945. module.exports = __webpack_require__(4).default;
  39946. /***/ }),
  39947. /* 3 */
  39948. /***/ (function(module, exports) {
  39949. /* (ignored) */
  39950. /***/ }),
  39951. /* 4 */
  39952. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39953. "use strict";
  39954. __webpack_require__.r(__webpack_exports__);
  39955. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39956. var ScriptReceiverFactory = (function () {
  39957. function ScriptReceiverFactory(prefix, name) {
  39958. this.lastId = 0;
  39959. this.prefix = prefix;
  39960. this.name = name;
  39961. }
  39962. ScriptReceiverFactory.prototype.create = function (callback) {
  39963. this.lastId++;
  39964. var number = this.lastId;
  39965. var id = this.prefix + number;
  39966. var name = this.name + "[" + number + "]";
  39967. var called = false;
  39968. var callbackWrapper = function () {
  39969. if (!called) {
  39970. callback.apply(null, arguments);
  39971. called = true;
  39972. }
  39973. };
  39974. this[number] = callbackWrapper;
  39975. return { number: number, id: id, name: name, callback: callbackWrapper };
  39976. };
  39977. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39978. delete this[receiver.number];
  39979. };
  39980. return ScriptReceiverFactory;
  39981. }());
  39982. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39983. // CONCATENATED MODULE: ./src/core/defaults.ts
  39984. var Defaults = {
  39985. VERSION: "5.0.3",
  39986. PROTOCOL: 7,
  39987. host: 'ws.pusherapp.com',
  39988. ws_port: 80,
  39989. wss_port: 443,
  39990. ws_path: '',
  39991. sockjs_host: 'sockjs.pusher.com',
  39992. sockjs_http_port: 80,
  39993. sockjs_https_port: 443,
  39994. sockjs_path: '/pusher',
  39995. stats_host: 'stats.pusher.com',
  39996. channel_auth_endpoint: '/pusher/auth',
  39997. channel_auth_transport: 'ajax',
  39998. activity_timeout: 120000,
  39999. pong_timeout: 30000,
  40000. unavailable_timeout: 10000,
  40001. cdn_http: "http://js.pusher.com",
  40002. cdn_https: "https://js.pusher.com",
  40003. dependency_suffix: ""
  40004. };
  40005. /* harmony default export */ var defaults = (Defaults);
  40006. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  40007. var dependency_loader_DependencyLoader = (function () {
  40008. function DependencyLoader(options) {
  40009. this.options = options;
  40010. this.receivers = options.receivers || ScriptReceivers;
  40011. this.loading = {};
  40012. }
  40013. DependencyLoader.prototype.load = function (name, options, callback) {
  40014. var self = this;
  40015. if (self.loading[name] && self.loading[name].length > 0) {
  40016. self.loading[name].push(callback);
  40017. }
  40018. else {
  40019. self.loading[name] = [callback];
  40020. var request = runtime.createScriptRequest(self.getPath(name, options));
  40021. var receiver = self.receivers.create(function (error) {
  40022. self.receivers.remove(receiver);
  40023. if (self.loading[name]) {
  40024. var callbacks = self.loading[name];
  40025. delete self.loading[name];
  40026. var successCallback = function (wasSuccessful) {
  40027. if (!wasSuccessful) {
  40028. request.cleanup();
  40029. }
  40030. };
  40031. for (var i = 0; i < callbacks.length; i++) {
  40032. callbacks[i](error, successCallback);
  40033. }
  40034. }
  40035. });
  40036. request.send(receiver);
  40037. }
  40038. };
  40039. DependencyLoader.prototype.getRoot = function (options) {
  40040. var cdn;
  40041. var protocol = runtime.getDocument().location.protocol;
  40042. if ((options && options.useTLS) || protocol === "https:") {
  40043. cdn = this.options.cdn_https;
  40044. }
  40045. else {
  40046. cdn = this.options.cdn_http;
  40047. }
  40048. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  40049. };
  40050. DependencyLoader.prototype.getPath = function (name, options) {
  40051. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  40052. };
  40053. ;
  40054. return DependencyLoader;
  40055. }());
  40056. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  40057. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  40058. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  40059. var Dependencies = new dependency_loader({
  40060. cdn_http: defaults.cdn_http,
  40061. cdn_https: defaults.cdn_https,
  40062. version: defaults.VERSION,
  40063. suffix: defaults.dependency_suffix,
  40064. receivers: DependenciesReceivers
  40065. });
  40066. // CONCATENATED MODULE: ./src/core/base64.ts
  40067. function encode(s) {
  40068. return btoa(utob(s));
  40069. }
  40070. var fromCharCode = String.fromCharCode;
  40071. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  40072. var b64tab = {};
  40073. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  40074. b64tab[b64chars.charAt(base64_i)] = base64_i;
  40075. }
  40076. var cb_utob = function (c) {
  40077. var cc = c.charCodeAt(0);
  40078. return cc < 0x80
  40079. ? c
  40080. : cc < 0x800
  40081. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  40082. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  40083. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  40084. fromCharCode(0x80 | (cc & 0x3f));
  40085. };
  40086. var utob = function (u) {
  40087. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  40088. };
  40089. var cb_encode = function (ccc) {
  40090. var padlen = [0, 2, 1][ccc.length % 3];
  40091. var ord = (ccc.charCodeAt(0) << 16) |
  40092. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  40093. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  40094. var chars = [
  40095. b64chars.charAt(ord >>> 18),
  40096. b64chars.charAt((ord >>> 12) & 63),
  40097. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  40098. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  40099. ];
  40100. return chars.join('');
  40101. };
  40102. var btoa = window.btoa ||
  40103. function (b) {
  40104. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  40105. };
  40106. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  40107. var Timer = (function () {
  40108. function Timer(set, clear, delay, callback) {
  40109. var _this = this;
  40110. this.clear = clear;
  40111. this.timer = set(function () {
  40112. if (_this.timer) {
  40113. _this.timer = callback(_this.timer);
  40114. }
  40115. }, delay);
  40116. }
  40117. Timer.prototype.isRunning = function () {
  40118. return this.timer !== null;
  40119. };
  40120. Timer.prototype.ensureAborted = function () {
  40121. if (this.timer) {
  40122. this.clear(this.timer);
  40123. this.timer = null;
  40124. }
  40125. };
  40126. return Timer;
  40127. }());
  40128. /* harmony default export */ var abstract_timer = (Timer);
  40129. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  40130. var __extends = (undefined && undefined.__extends) || (function () {
  40131. var extendStatics = function (d, b) {
  40132. extendStatics = Object.setPrototypeOf ||
  40133. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40134. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40135. return extendStatics(d, b);
  40136. };
  40137. return function (d, b) {
  40138. extendStatics(d, b);
  40139. function __() { this.constructor = d; }
  40140. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40141. };
  40142. })();
  40143. function timers_clearTimeout(timer) {
  40144. window.clearTimeout(timer);
  40145. }
  40146. function timers_clearInterval(timer) {
  40147. window.clearInterval(timer);
  40148. }
  40149. var OneOffTimer = (function (_super) {
  40150. __extends(OneOffTimer, _super);
  40151. function OneOffTimer(delay, callback) {
  40152. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  40153. callback();
  40154. return null;
  40155. }) || this;
  40156. }
  40157. return OneOffTimer;
  40158. }(abstract_timer));
  40159. var PeriodicTimer = (function (_super) {
  40160. __extends(PeriodicTimer, _super);
  40161. function PeriodicTimer(delay, callback) {
  40162. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  40163. callback();
  40164. return timer;
  40165. }) || this;
  40166. }
  40167. return PeriodicTimer;
  40168. }(abstract_timer));
  40169. // CONCATENATED MODULE: ./src/core/util.ts
  40170. var Util = {
  40171. now: function () {
  40172. if (Date.now) {
  40173. return Date.now();
  40174. }
  40175. else {
  40176. return new Date().valueOf();
  40177. }
  40178. },
  40179. defer: function (callback) {
  40180. return new OneOffTimer(0, callback);
  40181. },
  40182. method: function (name) {
  40183. var args = [];
  40184. for (var _i = 1; _i < arguments.length; _i++) {
  40185. args[_i - 1] = arguments[_i];
  40186. }
  40187. var boundArguments = Array.prototype.slice.call(arguments, 1);
  40188. return function (object) {
  40189. return object[name].apply(object, boundArguments.concat(arguments));
  40190. };
  40191. }
  40192. };
  40193. /* harmony default export */ var util = (Util);
  40194. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  40195. function extend(target) {
  40196. var sources = [];
  40197. for (var _i = 1; _i < arguments.length; _i++) {
  40198. sources[_i - 1] = arguments[_i];
  40199. }
  40200. for (var i = 0; i < sources.length; i++) {
  40201. var extensions = sources[i];
  40202. for (var property in extensions) {
  40203. if (extensions[property] && extensions[property].constructor &&
  40204. extensions[property].constructor === Object) {
  40205. target[property] = extend(target[property] || {}, extensions[property]);
  40206. }
  40207. else {
  40208. target[property] = extensions[property];
  40209. }
  40210. }
  40211. }
  40212. return target;
  40213. }
  40214. function stringify() {
  40215. var m = ["Pusher"];
  40216. for (var i = 0; i < arguments.length; i++) {
  40217. if (typeof arguments[i] === "string") {
  40218. m.push(arguments[i]);
  40219. }
  40220. else {
  40221. m.push(safeJSONStringify(arguments[i]));
  40222. }
  40223. }
  40224. return m.join(" : ");
  40225. }
  40226. function arrayIndexOf(array, item) {
  40227. var nativeIndexOf = Array.prototype.indexOf;
  40228. if (array === null) {
  40229. return -1;
  40230. }
  40231. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  40232. return array.indexOf(item);
  40233. }
  40234. for (var i = 0, l = array.length; i < l; i++) {
  40235. if (array[i] === item) {
  40236. return i;
  40237. }
  40238. }
  40239. return -1;
  40240. }
  40241. function objectApply(object, f) {
  40242. for (var key in object) {
  40243. if (Object.prototype.hasOwnProperty.call(object, key)) {
  40244. f(object[key], key, object);
  40245. }
  40246. }
  40247. }
  40248. function keys(object) {
  40249. var keys = [];
  40250. objectApply(object, function (_, key) {
  40251. keys.push(key);
  40252. });
  40253. return keys;
  40254. }
  40255. function values(object) {
  40256. var values = [];
  40257. objectApply(object, function (value) {
  40258. values.push(value);
  40259. });
  40260. return values;
  40261. }
  40262. function apply(array, f, context) {
  40263. for (var i = 0; i < array.length; i++) {
  40264. f.call(context || window, array[i], i, array);
  40265. }
  40266. }
  40267. function map(array, f) {
  40268. var result = [];
  40269. for (var i = 0; i < array.length; i++) {
  40270. result.push(f(array[i], i, array, result));
  40271. }
  40272. return result;
  40273. }
  40274. function mapObject(object, f) {
  40275. var result = {};
  40276. objectApply(object, function (value, key) {
  40277. result[key] = f(value);
  40278. });
  40279. return result;
  40280. }
  40281. function filter(array, test) {
  40282. test = test || function (value) { return !!value; };
  40283. var result = [];
  40284. for (var i = 0; i < array.length; i++) {
  40285. if (test(array[i], i, array, result)) {
  40286. result.push(array[i]);
  40287. }
  40288. }
  40289. return result;
  40290. }
  40291. function filterObject(object, test) {
  40292. var result = {};
  40293. objectApply(object, function (value, key) {
  40294. if ((test && test(value, key, object, result)) || Boolean(value)) {
  40295. result[key] = value;
  40296. }
  40297. });
  40298. return result;
  40299. }
  40300. function flatten(object) {
  40301. var result = [];
  40302. objectApply(object, function (value, key) {
  40303. result.push([key, value]);
  40304. });
  40305. return result;
  40306. }
  40307. function any(array, test) {
  40308. for (var i = 0; i < array.length; i++) {
  40309. if (test(array[i], i, array)) {
  40310. return true;
  40311. }
  40312. }
  40313. return false;
  40314. }
  40315. function collections_all(array, test) {
  40316. for (var i = 0; i < array.length; i++) {
  40317. if (!test(array[i], i, array)) {
  40318. return false;
  40319. }
  40320. }
  40321. return true;
  40322. }
  40323. function encodeParamsObject(data) {
  40324. return mapObject(data, function (value) {
  40325. if (typeof value === "object") {
  40326. value = safeJSONStringify(value);
  40327. }
  40328. return encodeURIComponent(encode(value.toString()));
  40329. });
  40330. }
  40331. function buildQueryString(data) {
  40332. var params = filterObject(data, function (value) {
  40333. return value !== undefined;
  40334. });
  40335. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  40336. return query;
  40337. }
  40338. function decycleObject(object) {
  40339. var objects = [], paths = [];
  40340. return (function derez(value, path) {
  40341. var i, name, nu;
  40342. switch (typeof value) {
  40343. case 'object':
  40344. if (!value) {
  40345. return null;
  40346. }
  40347. for (i = 0; i < objects.length; i += 1) {
  40348. if (objects[i] === value) {
  40349. return { $ref: paths[i] };
  40350. }
  40351. }
  40352. objects.push(value);
  40353. paths.push(path);
  40354. if (Object.prototype.toString.apply(value) === '[object Array]') {
  40355. nu = [];
  40356. for (i = 0; i < value.length; i += 1) {
  40357. nu[i] = derez(value[i], path + '[' + i + ']');
  40358. }
  40359. }
  40360. else {
  40361. nu = {};
  40362. for (name in value) {
  40363. if (Object.prototype.hasOwnProperty.call(value, name)) {
  40364. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  40365. }
  40366. }
  40367. }
  40368. return nu;
  40369. case 'number':
  40370. case 'string':
  40371. case 'boolean':
  40372. return value;
  40373. }
  40374. }(object, '$'));
  40375. }
  40376. function safeJSONStringify(source) {
  40377. try {
  40378. return JSON.stringify(source);
  40379. }
  40380. catch (e) {
  40381. return JSON.stringify(decycleObject(source));
  40382. }
  40383. }
  40384. // CONCATENATED MODULE: ./src/core/logger.ts
  40385. var logger_Logger = (function () {
  40386. function Logger() {
  40387. this.globalLog = function (message) {
  40388. if (window.console && window.console.log) {
  40389. window.console.log(message);
  40390. }
  40391. };
  40392. }
  40393. Logger.prototype.debug = function () {
  40394. var args = [];
  40395. for (var _i = 0; _i < arguments.length; _i++) {
  40396. args[_i] = arguments[_i];
  40397. }
  40398. this.log(this.globalLog, args);
  40399. };
  40400. Logger.prototype.warn = function () {
  40401. var args = [];
  40402. for (var _i = 0; _i < arguments.length; _i++) {
  40403. args[_i] = arguments[_i];
  40404. }
  40405. this.log(this.globalLogWarn, args);
  40406. };
  40407. Logger.prototype.error = function () {
  40408. var args = [];
  40409. for (var _i = 0; _i < arguments.length; _i++) {
  40410. args[_i] = arguments[_i];
  40411. }
  40412. this.log(this.globalLogError, args);
  40413. };
  40414. Logger.prototype.globalLogWarn = function (message) {
  40415. if (window.console && window.console.warn) {
  40416. window.console.warn(message);
  40417. }
  40418. else {
  40419. this.globalLog(message);
  40420. }
  40421. };
  40422. Logger.prototype.globalLogError = function (message) {
  40423. if (window.console && window.console.error) {
  40424. window.console.error(message);
  40425. }
  40426. else {
  40427. this.globalLogWarn(message);
  40428. }
  40429. };
  40430. Logger.prototype.log = function (defaultLoggingFunction) {
  40431. var args = [];
  40432. for (var _i = 1; _i < arguments.length; _i++) {
  40433. args[_i - 1] = arguments[_i];
  40434. }
  40435. var message = stringify.apply(this, arguments);
  40436. if (core_pusher.log) {
  40437. core_pusher.log(message);
  40438. }
  40439. else if (core_pusher.logToConsole) {
  40440. var log = defaultLoggingFunction.bind(this);
  40441. log(message);
  40442. }
  40443. };
  40444. return Logger;
  40445. }());
  40446. /* harmony default export */ var logger = (new logger_Logger());
  40447. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  40448. var urlStore = {
  40449. baseUrl: "https://pusher.com",
  40450. urls: {
  40451. authenticationEndpoint: {
  40452. path: "/docs/authenticating_users",
  40453. },
  40454. javascriptQuickStart: {
  40455. path: "/docs/javascript_quick_start"
  40456. },
  40457. triggeringClientEvents: {
  40458. path: "/docs/client_api_guide/client_events#trigger-events"
  40459. }
  40460. }
  40461. };
  40462. var buildLogSuffix = function (key) {
  40463. var urlPrefix = "See:";
  40464. var urlObj = urlStore.urls[key];
  40465. if (!urlObj)
  40466. return "";
  40467. var url;
  40468. if (urlObj.fullUrl) {
  40469. url = urlObj.fullUrl;
  40470. }
  40471. else if (urlObj.path) {
  40472. url = urlStore.baseUrl + urlObj.path;
  40473. }
  40474. if (!url)
  40475. return "";
  40476. return urlPrefix + " " + url;
  40477. };
  40478. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  40479. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  40480. var ajax = function (context, socketId, callback) {
  40481. var self = this, xhr;
  40482. xhr = runtime.createXHR();
  40483. xhr.open("POST", self.options.authEndpoint, true);
  40484. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  40485. for (var headerName in this.authOptions.headers) {
  40486. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  40487. }
  40488. xhr.onreadystatechange = function () {
  40489. if (xhr.readyState === 4) {
  40490. if (xhr.status === 200) {
  40491. var data, parsed = false;
  40492. try {
  40493. data = JSON.parse(xhr.responseText);
  40494. parsed = true;
  40495. }
  40496. catch (e) {
  40497. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  40498. }
  40499. if (parsed) {
  40500. callback(false, data);
  40501. }
  40502. }
  40503. else {
  40504. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40505. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  40506. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  40507. ("Clients must be authenticated to join private or presence channels. " + suffix));
  40508. callback(true, xhr.status);
  40509. }
  40510. }
  40511. };
  40512. xhr.send(this.composeQuery(socketId));
  40513. return xhr;
  40514. };
  40515. /* harmony default export */ var xhr_auth = (ajax);
  40516. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  40517. var jsonp = function (context, socketId, callback) {
  40518. if (this.authOptions.headers !== undefined) {
  40519. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  40520. }
  40521. var callbackName = context.nextAuthCallbackID.toString();
  40522. context.nextAuthCallbackID++;
  40523. var document = context.getDocument();
  40524. var script = document.createElement("script");
  40525. context.auth_callbacks[callbackName] = function (data) {
  40526. callback(false, data);
  40527. };
  40528. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  40529. script.src = this.options.authEndpoint +
  40530. '?callback=' +
  40531. encodeURIComponent(callback_name) +
  40532. '&' +
  40533. this.composeQuery(socketId);
  40534. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  40535. head.insertBefore(script, head.firstChild);
  40536. };
  40537. /* harmony default export */ var jsonp_auth = (jsonp);
  40538. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  40539. var ScriptRequest = (function () {
  40540. function ScriptRequest(src) {
  40541. this.src = src;
  40542. }
  40543. ScriptRequest.prototype.send = function (receiver) {
  40544. var self = this;
  40545. var errorString = "Error loading " + self.src;
  40546. self.script = document.createElement("script");
  40547. self.script.id = receiver.id;
  40548. self.script.src = self.src;
  40549. self.script.type = "text/javascript";
  40550. self.script.charset = "UTF-8";
  40551. if (self.script.addEventListener) {
  40552. self.script.onerror = function () {
  40553. receiver.callback(errorString);
  40554. };
  40555. self.script.onload = function () {
  40556. receiver.callback(null);
  40557. };
  40558. }
  40559. else {
  40560. self.script.onreadystatechange = function () {
  40561. if (self.script.readyState === 'loaded' ||
  40562. self.script.readyState === 'complete') {
  40563. receiver.callback(null);
  40564. }
  40565. };
  40566. }
  40567. if (self.script.async === undefined && document.attachEvent &&
  40568. /opera/i.test(navigator.userAgent)) {
  40569. self.errorScript = document.createElement("script");
  40570. self.errorScript.id = receiver.id + "_error";
  40571. self.errorScript.text = receiver.name + "('" + errorString + "');";
  40572. self.script.async = self.errorScript.async = false;
  40573. }
  40574. else {
  40575. self.script.async = true;
  40576. }
  40577. var head = document.getElementsByTagName('head')[0];
  40578. head.insertBefore(self.script, head.firstChild);
  40579. if (self.errorScript) {
  40580. head.insertBefore(self.errorScript, self.script.nextSibling);
  40581. }
  40582. };
  40583. ScriptRequest.prototype.cleanup = function () {
  40584. if (this.script) {
  40585. this.script.onload = this.script.onerror = null;
  40586. this.script.onreadystatechange = null;
  40587. }
  40588. if (this.script && this.script.parentNode) {
  40589. this.script.parentNode.removeChild(this.script);
  40590. }
  40591. if (this.errorScript && this.errorScript.parentNode) {
  40592. this.errorScript.parentNode.removeChild(this.errorScript);
  40593. }
  40594. this.script = null;
  40595. this.errorScript = null;
  40596. };
  40597. return ScriptRequest;
  40598. }());
  40599. /* harmony default export */ var script_request = (ScriptRequest);
  40600. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  40601. var jsonp_request_JSONPRequest = (function () {
  40602. function JSONPRequest(url, data) {
  40603. this.url = url;
  40604. this.data = data;
  40605. }
  40606. JSONPRequest.prototype.send = function (receiver) {
  40607. if (this.request) {
  40608. return;
  40609. }
  40610. var query = buildQueryString(this.data);
  40611. var url = this.url + "/" + receiver.number + "?" + query;
  40612. this.request = runtime.createScriptRequest(url);
  40613. this.request.send(receiver);
  40614. };
  40615. JSONPRequest.prototype.cleanup = function () {
  40616. if (this.request) {
  40617. this.request.cleanup();
  40618. }
  40619. };
  40620. return JSONPRequest;
  40621. }());
  40622. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  40623. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  40624. var getAgent = function (sender, useTLS) {
  40625. return function (data, callback) {
  40626. var scheme = "http" + (useTLS ? "s" : "") + "://";
  40627. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  40628. var request = runtime.createJSONPRequest(url, data);
  40629. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  40630. ScriptReceivers.remove(receiver);
  40631. request.cleanup();
  40632. if (result && result.host) {
  40633. sender.host = result.host;
  40634. }
  40635. if (callback) {
  40636. callback(error, result);
  40637. }
  40638. });
  40639. request.send(receiver);
  40640. };
  40641. };
  40642. var jsonp_timeline_jsonp = {
  40643. name: 'jsonp',
  40644. getAgent: getAgent
  40645. };
  40646. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  40647. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  40648. function getGenericURL(baseScheme, params, path) {
  40649. var scheme = baseScheme + (params.useTLS ? "s" : "");
  40650. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  40651. return scheme + "://" + host + path;
  40652. }
  40653. function getGenericPath(key, queryString) {
  40654. var path = "/app/" + key;
  40655. var query = "?protocol=" + defaults.PROTOCOL +
  40656. "&client=js" +
  40657. "&version=" + defaults.VERSION +
  40658. (queryString ? ("&" + queryString) : "");
  40659. return path + query;
  40660. }
  40661. var ws = {
  40662. getInitial: function (key, params) {
  40663. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  40664. return getGenericURL("ws", params, path);
  40665. }
  40666. };
  40667. var http = {
  40668. getInitial: function (key, params) {
  40669. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  40670. return getGenericURL("http", params, path);
  40671. }
  40672. };
  40673. var sockjs = {
  40674. getInitial: function (key, params) {
  40675. return getGenericURL("http", params, params.httpPath || "/pusher");
  40676. },
  40677. getPath: function (key, params) {
  40678. return getGenericPath(key);
  40679. }
  40680. };
  40681. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  40682. var callback_registry_CallbackRegistry = (function () {
  40683. function CallbackRegistry() {
  40684. this._callbacks = {};
  40685. }
  40686. CallbackRegistry.prototype.get = function (name) {
  40687. return this._callbacks[prefix(name)];
  40688. };
  40689. CallbackRegistry.prototype.add = function (name, callback, context) {
  40690. var prefixedEventName = prefix(name);
  40691. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  40692. this._callbacks[prefixedEventName].push({
  40693. fn: callback,
  40694. context: context
  40695. });
  40696. };
  40697. CallbackRegistry.prototype.remove = function (name, callback, context) {
  40698. if (!name && !callback && !context) {
  40699. this._callbacks = {};
  40700. return;
  40701. }
  40702. var names = name ? [prefix(name)] : keys(this._callbacks);
  40703. if (callback || context) {
  40704. this.removeCallback(names, callback, context);
  40705. }
  40706. else {
  40707. this.removeAllCallbacks(names);
  40708. }
  40709. };
  40710. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  40711. apply(names, function (name) {
  40712. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  40713. return (callback && callback !== binding.fn) ||
  40714. (context && context !== binding.context);
  40715. });
  40716. if (this._callbacks[name].length === 0) {
  40717. delete this._callbacks[name];
  40718. }
  40719. }, this);
  40720. };
  40721. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  40722. apply(names, function (name) {
  40723. delete this._callbacks[name];
  40724. }, this);
  40725. };
  40726. return CallbackRegistry;
  40727. }());
  40728. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  40729. function prefix(name) {
  40730. return "_" + name;
  40731. }
  40732. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  40733. var dispatcher_Dispatcher = (function () {
  40734. function Dispatcher(failThrough) {
  40735. this.callbacks = new callback_registry();
  40736. this.global_callbacks = [];
  40737. this.failThrough = failThrough;
  40738. }
  40739. Dispatcher.prototype.bind = function (eventName, callback, context) {
  40740. this.callbacks.add(eventName, callback, context);
  40741. return this;
  40742. };
  40743. Dispatcher.prototype.bind_global = function (callback) {
  40744. this.global_callbacks.push(callback);
  40745. return this;
  40746. };
  40747. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  40748. this.callbacks.remove(eventName, callback, context);
  40749. return this;
  40750. };
  40751. Dispatcher.prototype.unbind_global = function (callback) {
  40752. if (!callback) {
  40753. this.global_callbacks = [];
  40754. return this;
  40755. }
  40756. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  40757. return this;
  40758. };
  40759. Dispatcher.prototype.unbind_all = function () {
  40760. this.unbind();
  40761. this.unbind_global();
  40762. return this;
  40763. };
  40764. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  40765. for (var i = 0; i < this.global_callbacks.length; i++) {
  40766. this.global_callbacks[i](eventName, data);
  40767. }
  40768. var callbacks = this.callbacks.get(eventName);
  40769. var args = [];
  40770. if (metadata) {
  40771. args.push(data, metadata);
  40772. }
  40773. else if (data) {
  40774. args.push(data);
  40775. }
  40776. if (callbacks && callbacks.length > 0) {
  40777. for (var i = 0; i < callbacks.length; i++) {
  40778. callbacks[i].fn.apply(callbacks[i].context || window, args);
  40779. }
  40780. }
  40781. else if (this.failThrough) {
  40782. this.failThrough(eventName, data);
  40783. }
  40784. return this;
  40785. };
  40786. return Dispatcher;
  40787. }());
  40788. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40789. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40790. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40791. var extendStatics = function (d, b) {
  40792. extendStatics = Object.setPrototypeOf ||
  40793. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40794. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40795. return extendStatics(d, b);
  40796. };
  40797. return function (d, b) {
  40798. extendStatics(d, b);
  40799. function __() { this.constructor = d; }
  40800. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40801. };
  40802. })();
  40803. var transport_connection_TransportConnection = (function (_super) {
  40804. transport_connection_extends(TransportConnection, _super);
  40805. function TransportConnection(hooks, name, priority, key, options) {
  40806. var _this = _super.call(this) || this;
  40807. _this.initialize = runtime.transportConnectionInitializer;
  40808. _this.hooks = hooks;
  40809. _this.name = name;
  40810. _this.priority = priority;
  40811. _this.key = key;
  40812. _this.options = options;
  40813. _this.state = "new";
  40814. _this.timeline = options.timeline;
  40815. _this.activityTimeout = options.activityTimeout;
  40816. _this.id = _this.timeline.generateUniqueID();
  40817. return _this;
  40818. }
  40819. TransportConnection.prototype.handlesActivityChecks = function () {
  40820. return Boolean(this.hooks.handlesActivityChecks);
  40821. };
  40822. TransportConnection.prototype.supportsPing = function () {
  40823. return Boolean(this.hooks.supportsPing);
  40824. };
  40825. TransportConnection.prototype.connect = function () {
  40826. var _this = this;
  40827. if (this.socket || this.state !== "initialized") {
  40828. return false;
  40829. }
  40830. var url = this.hooks.urls.getInitial(this.key, this.options);
  40831. try {
  40832. this.socket = this.hooks.getSocket(url, this.options);
  40833. }
  40834. catch (e) {
  40835. util.defer(function () {
  40836. _this.onError(e);
  40837. _this.changeState("closed");
  40838. });
  40839. return false;
  40840. }
  40841. this.bindListeners();
  40842. logger.debug("Connecting", { transport: this.name, url: url });
  40843. this.changeState("connecting");
  40844. return true;
  40845. };
  40846. TransportConnection.prototype.close = function () {
  40847. if (this.socket) {
  40848. this.socket.close();
  40849. return true;
  40850. }
  40851. else {
  40852. return false;
  40853. }
  40854. };
  40855. TransportConnection.prototype.send = function (data) {
  40856. var _this = this;
  40857. if (this.state === "open") {
  40858. util.defer(function () {
  40859. if (_this.socket) {
  40860. _this.socket.send(data);
  40861. }
  40862. });
  40863. return true;
  40864. }
  40865. else {
  40866. return false;
  40867. }
  40868. };
  40869. TransportConnection.prototype.ping = function () {
  40870. if (this.state === "open" && this.supportsPing()) {
  40871. this.socket.ping();
  40872. }
  40873. };
  40874. TransportConnection.prototype.onOpen = function () {
  40875. if (this.hooks.beforeOpen) {
  40876. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40877. }
  40878. this.changeState("open");
  40879. this.socket.onopen = undefined;
  40880. };
  40881. TransportConnection.prototype.onError = function (error) {
  40882. this.emit("error", { type: 'WebSocketError', error: error });
  40883. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40884. };
  40885. TransportConnection.prototype.onClose = function (closeEvent) {
  40886. if (closeEvent) {
  40887. this.changeState("closed", {
  40888. code: closeEvent.code,
  40889. reason: closeEvent.reason,
  40890. wasClean: closeEvent.wasClean
  40891. });
  40892. }
  40893. else {
  40894. this.changeState("closed");
  40895. }
  40896. this.unbindListeners();
  40897. this.socket = undefined;
  40898. };
  40899. TransportConnection.prototype.onMessage = function (message) {
  40900. this.emit("message", message);
  40901. };
  40902. TransportConnection.prototype.onActivity = function () {
  40903. this.emit("activity");
  40904. };
  40905. TransportConnection.prototype.bindListeners = function () {
  40906. var _this = this;
  40907. this.socket.onopen = function () {
  40908. _this.onOpen();
  40909. };
  40910. this.socket.onerror = function (error) {
  40911. _this.onError(error);
  40912. };
  40913. this.socket.onclose = function (closeEvent) {
  40914. _this.onClose(closeEvent);
  40915. };
  40916. this.socket.onmessage = function (message) {
  40917. _this.onMessage(message);
  40918. };
  40919. if (this.supportsPing()) {
  40920. this.socket.onactivity = function () { _this.onActivity(); };
  40921. }
  40922. };
  40923. TransportConnection.prototype.unbindListeners = function () {
  40924. if (this.socket) {
  40925. this.socket.onopen = undefined;
  40926. this.socket.onerror = undefined;
  40927. this.socket.onclose = undefined;
  40928. this.socket.onmessage = undefined;
  40929. if (this.supportsPing()) {
  40930. this.socket.onactivity = undefined;
  40931. }
  40932. }
  40933. };
  40934. TransportConnection.prototype.changeState = function (state, params) {
  40935. this.state = state;
  40936. this.timeline.info(this.buildTimelineMessage({
  40937. state: state,
  40938. params: params
  40939. }));
  40940. this.emit(state, params);
  40941. };
  40942. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40943. return extend({ cid: this.id }, message);
  40944. };
  40945. return TransportConnection;
  40946. }(dispatcher));
  40947. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40948. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40949. var transport_Transport = (function () {
  40950. function Transport(hooks) {
  40951. this.hooks = hooks;
  40952. }
  40953. Transport.prototype.isSupported = function (environment) {
  40954. return this.hooks.isSupported(environment);
  40955. };
  40956. Transport.prototype.createConnection = function (name, priority, key, options) {
  40957. return new transport_connection(this.hooks, name, priority, key, options);
  40958. };
  40959. return Transport;
  40960. }());
  40961. /* harmony default export */ var transports_transport = (transport_Transport);
  40962. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40963. var WSTransport = new transports_transport({
  40964. urls: ws,
  40965. handlesActivityChecks: false,
  40966. supportsPing: false,
  40967. isInitialized: function () {
  40968. return Boolean(runtime.getWebSocketAPI());
  40969. },
  40970. isSupported: function () {
  40971. return Boolean(runtime.getWebSocketAPI());
  40972. },
  40973. getSocket: function (url) {
  40974. return runtime.createWebSocket(url);
  40975. }
  40976. });
  40977. var httpConfiguration = {
  40978. urls: http,
  40979. handlesActivityChecks: false,
  40980. supportsPing: true,
  40981. isInitialized: function () {
  40982. return true;
  40983. }
  40984. };
  40985. var streamingConfiguration = extend({ getSocket: function (url) {
  40986. return runtime.HTTPFactory.createStreamingSocket(url);
  40987. }
  40988. }, httpConfiguration);
  40989. var pollingConfiguration = extend({ getSocket: function (url) {
  40990. return runtime.HTTPFactory.createPollingSocket(url);
  40991. }
  40992. }, httpConfiguration);
  40993. var xhrConfiguration = {
  40994. isSupported: function () {
  40995. return runtime.isXHRSupported();
  40996. }
  40997. };
  40998. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40999. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  41000. var Transports = {
  41001. ws: WSTransport,
  41002. xhr_streaming: XHRStreamingTransport,
  41003. xhr_polling: XHRPollingTransport
  41004. };
  41005. /* harmony default export */ var transports = (Transports);
  41006. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  41007. var SockJSTransport = new transports_transport({
  41008. file: "sockjs",
  41009. urls: sockjs,
  41010. handlesActivityChecks: true,
  41011. supportsPing: false,
  41012. isSupported: function () {
  41013. return true;
  41014. },
  41015. isInitialized: function () {
  41016. return window.SockJS !== undefined;
  41017. },
  41018. getSocket: function (url, options) {
  41019. return new window.SockJS(url, null, {
  41020. js_path: Dependencies.getPath("sockjs", {
  41021. useTLS: options.useTLS
  41022. }),
  41023. ignore_null_origin: options.ignoreNullOrigin
  41024. });
  41025. },
  41026. beforeOpen: function (socket, path) {
  41027. socket.send(JSON.stringify({
  41028. path: path
  41029. }));
  41030. }
  41031. });
  41032. var xdrConfiguration = {
  41033. isSupported: function (environment) {
  41034. var yes = runtime.isXDRSupported(environment.useTLS);
  41035. return yes;
  41036. }
  41037. };
  41038. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  41039. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  41040. transports.xdr_streaming = XDRStreamingTransport;
  41041. transports.xdr_polling = XDRPollingTransport;
  41042. transports.sockjs = SockJSTransport;
  41043. /* harmony default export */ var transports_transports = (transports);
  41044. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  41045. var net_info_extends = (undefined && undefined.__extends) || (function () {
  41046. var extendStatics = function (d, b) {
  41047. extendStatics = Object.setPrototypeOf ||
  41048. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41049. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41050. return extendStatics(d, b);
  41051. };
  41052. return function (d, b) {
  41053. extendStatics(d, b);
  41054. function __() { this.constructor = d; }
  41055. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41056. };
  41057. })();
  41058. var NetInfo = (function (_super) {
  41059. net_info_extends(NetInfo, _super);
  41060. function NetInfo() {
  41061. var _this = _super.call(this) || this;
  41062. var self = _this;
  41063. if (window.addEventListener !== undefined) {
  41064. window.addEventListener("online", function () {
  41065. self.emit('online');
  41066. }, false);
  41067. window.addEventListener("offline", function () {
  41068. self.emit('offline');
  41069. }, false);
  41070. }
  41071. return _this;
  41072. }
  41073. NetInfo.prototype.isOnline = function () {
  41074. if (window.navigator.onLine === undefined) {
  41075. return true;
  41076. }
  41077. else {
  41078. return window.navigator.onLine;
  41079. }
  41080. };
  41081. return NetInfo;
  41082. }(dispatcher));
  41083. var net_info_Network = new NetInfo();
  41084. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  41085. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  41086. function AssistantToTheTransportManager(manager, transport, options) {
  41087. this.manager = manager;
  41088. this.transport = transport;
  41089. this.minPingDelay = options.minPingDelay;
  41090. this.maxPingDelay = options.maxPingDelay;
  41091. this.pingDelay = undefined;
  41092. }
  41093. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  41094. var _this = this;
  41095. options = extend({}, options, {
  41096. activityTimeout: this.pingDelay
  41097. });
  41098. var connection = this.transport.createConnection(name, priority, key, options);
  41099. var openTimestamp = null;
  41100. var onOpen = function () {
  41101. connection.unbind("open", onOpen);
  41102. connection.bind("closed", onClosed);
  41103. openTimestamp = util.now();
  41104. };
  41105. var onClosed = function (closeEvent) {
  41106. connection.unbind("closed", onClosed);
  41107. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  41108. _this.manager.reportDeath();
  41109. }
  41110. else if (!closeEvent.wasClean && openTimestamp) {
  41111. var lifespan = util.now() - openTimestamp;
  41112. if (lifespan < 2 * _this.maxPingDelay) {
  41113. _this.manager.reportDeath();
  41114. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  41115. }
  41116. }
  41117. };
  41118. connection.bind("open", onOpen);
  41119. return connection;
  41120. };
  41121. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  41122. return this.manager.isAlive() && this.transport.isSupported(environment);
  41123. };
  41124. return AssistantToTheTransportManager;
  41125. }());
  41126. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  41127. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  41128. var Protocol = {
  41129. decodeMessage: function (messageEvent) {
  41130. try {
  41131. var messageData = JSON.parse(messageEvent.data);
  41132. var pusherEventData = messageData.data;
  41133. if (typeof pusherEventData === 'string') {
  41134. try {
  41135. pusherEventData = JSON.parse(messageData.data);
  41136. }
  41137. catch (e) { }
  41138. }
  41139. var pusherEvent = {
  41140. event: messageData.event,
  41141. channel: messageData.channel,
  41142. data: pusherEventData,
  41143. };
  41144. if (messageData.user_id) {
  41145. pusherEvent.user_id = messageData.user_id;
  41146. }
  41147. return pusherEvent;
  41148. }
  41149. catch (e) {
  41150. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  41151. }
  41152. },
  41153. encodeMessage: function (event) {
  41154. return JSON.stringify(event);
  41155. },
  41156. processHandshake: function (messageEvent) {
  41157. var message = Protocol.decodeMessage(messageEvent);
  41158. if (message.event === "pusher:connection_established") {
  41159. if (!message.data.activity_timeout) {
  41160. throw "No activity timeout specified in handshake";
  41161. }
  41162. return {
  41163. action: "connected",
  41164. id: message.data.socket_id,
  41165. activityTimeout: message.data.activity_timeout * 1000
  41166. };
  41167. }
  41168. else if (message.event === "pusher:error") {
  41169. return {
  41170. action: this.getCloseAction(message.data),
  41171. error: this.getCloseError(message.data)
  41172. };
  41173. }
  41174. else {
  41175. throw "Invalid handshake";
  41176. }
  41177. },
  41178. getCloseAction: function (closeEvent) {
  41179. if (closeEvent.code < 4000) {
  41180. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  41181. return "backoff";
  41182. }
  41183. else {
  41184. return null;
  41185. }
  41186. }
  41187. else if (closeEvent.code === 4000) {
  41188. return "tls_only";
  41189. }
  41190. else if (closeEvent.code < 4100) {
  41191. return "refused";
  41192. }
  41193. else if (closeEvent.code < 4200) {
  41194. return "backoff";
  41195. }
  41196. else if (closeEvent.code < 4300) {
  41197. return "retry";
  41198. }
  41199. else {
  41200. return "refused";
  41201. }
  41202. },
  41203. getCloseError: function (closeEvent) {
  41204. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  41205. return {
  41206. type: 'PusherError',
  41207. data: {
  41208. code: closeEvent.code,
  41209. message: closeEvent.reason || closeEvent.message
  41210. }
  41211. };
  41212. }
  41213. else {
  41214. return null;
  41215. }
  41216. }
  41217. };
  41218. /* harmony default export */ var protocol_protocol = (Protocol);
  41219. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  41220. var connection_extends = (undefined && undefined.__extends) || (function () {
  41221. var extendStatics = function (d, b) {
  41222. extendStatics = Object.setPrototypeOf ||
  41223. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41224. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41225. return extendStatics(d, b);
  41226. };
  41227. return function (d, b) {
  41228. extendStatics(d, b);
  41229. function __() { this.constructor = d; }
  41230. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41231. };
  41232. })();
  41233. var connection_Connection = (function (_super) {
  41234. connection_extends(Connection, _super);
  41235. function Connection(id, transport) {
  41236. var _this = _super.call(this) || this;
  41237. _this.id = id;
  41238. _this.transport = transport;
  41239. _this.activityTimeout = transport.activityTimeout;
  41240. _this.bindListeners();
  41241. return _this;
  41242. }
  41243. Connection.prototype.handlesActivityChecks = function () {
  41244. return this.transport.handlesActivityChecks();
  41245. };
  41246. Connection.prototype.send = function (data) {
  41247. return this.transport.send(data);
  41248. };
  41249. Connection.prototype.send_event = function (name, data, channel) {
  41250. var event = { event: name, data: data };
  41251. if (channel) {
  41252. event.channel = channel;
  41253. }
  41254. logger.debug('Event sent', event);
  41255. return this.send(protocol_protocol.encodeMessage(event));
  41256. };
  41257. Connection.prototype.ping = function () {
  41258. if (this.transport.supportsPing()) {
  41259. this.transport.ping();
  41260. }
  41261. else {
  41262. this.send_event('pusher:ping', {});
  41263. }
  41264. };
  41265. Connection.prototype.close = function () {
  41266. this.transport.close();
  41267. };
  41268. Connection.prototype.bindListeners = function () {
  41269. var _this = this;
  41270. var listeners = {
  41271. message: function (messageEvent) {
  41272. var pusherEvent;
  41273. try {
  41274. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  41275. }
  41276. catch (e) {
  41277. _this.emit('error', {
  41278. type: 'MessageParseError',
  41279. error: e,
  41280. data: messageEvent.data
  41281. });
  41282. }
  41283. if (pusherEvent !== undefined) {
  41284. logger.debug('Event recd', pusherEvent);
  41285. switch (pusherEvent.event) {
  41286. case 'pusher:error':
  41287. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  41288. break;
  41289. case 'pusher:ping':
  41290. _this.emit("ping");
  41291. break;
  41292. case 'pusher:pong':
  41293. _this.emit("pong");
  41294. break;
  41295. }
  41296. _this.emit('message', pusherEvent);
  41297. }
  41298. },
  41299. activity: function () {
  41300. _this.emit("activity");
  41301. },
  41302. error: function (error) {
  41303. _this.emit("error", { type: "WebSocketError", error: error });
  41304. },
  41305. closed: function (closeEvent) {
  41306. unbindListeners();
  41307. if (closeEvent && closeEvent.code) {
  41308. _this.handleCloseEvent(closeEvent);
  41309. }
  41310. _this.transport = null;
  41311. _this.emit("closed");
  41312. }
  41313. };
  41314. var unbindListeners = function () {
  41315. objectApply(listeners, function (listener, event) {
  41316. _this.transport.unbind(event, listener);
  41317. });
  41318. };
  41319. objectApply(listeners, function (listener, event) {
  41320. _this.transport.bind(event, listener);
  41321. });
  41322. };
  41323. Connection.prototype.handleCloseEvent = function (closeEvent) {
  41324. var action = protocol_protocol.getCloseAction(closeEvent);
  41325. var error = protocol_protocol.getCloseError(closeEvent);
  41326. if (error) {
  41327. this.emit('error', error);
  41328. }
  41329. if (action) {
  41330. this.emit(action, { action: action, error: error });
  41331. }
  41332. };
  41333. return Connection;
  41334. }(dispatcher));
  41335. /* harmony default export */ var connection_connection = (connection_Connection);
  41336. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  41337. var handshake_Handshake = (function () {
  41338. function Handshake(transport, callback) {
  41339. this.transport = transport;
  41340. this.callback = callback;
  41341. this.bindListeners();
  41342. }
  41343. Handshake.prototype.close = function () {
  41344. this.unbindListeners();
  41345. this.transport.close();
  41346. };
  41347. Handshake.prototype.bindListeners = function () {
  41348. var _this = this;
  41349. this.onMessage = function (m) {
  41350. _this.unbindListeners();
  41351. var result;
  41352. try {
  41353. result = protocol_protocol.processHandshake(m);
  41354. }
  41355. catch (e) {
  41356. _this.finish("error", { error: e });
  41357. _this.transport.close();
  41358. return;
  41359. }
  41360. if (result.action === "connected") {
  41361. _this.finish("connected", {
  41362. connection: new connection_connection(result.id, _this.transport),
  41363. activityTimeout: result.activityTimeout
  41364. });
  41365. }
  41366. else {
  41367. _this.finish(result.action, { error: result.error });
  41368. _this.transport.close();
  41369. }
  41370. };
  41371. this.onClosed = function (closeEvent) {
  41372. _this.unbindListeners();
  41373. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  41374. var error = protocol_protocol.getCloseError(closeEvent);
  41375. _this.finish(action, { error: error });
  41376. };
  41377. this.transport.bind("message", this.onMessage);
  41378. this.transport.bind("closed", this.onClosed);
  41379. };
  41380. Handshake.prototype.unbindListeners = function () {
  41381. this.transport.unbind("message", this.onMessage);
  41382. this.transport.unbind("closed", this.onClosed);
  41383. };
  41384. Handshake.prototype.finish = function (action, params) {
  41385. this.callback(extend({ transport: this.transport, action: action }, params));
  41386. };
  41387. return Handshake;
  41388. }());
  41389. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  41390. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  41391. var pusher_authorizer_PusherAuthorizer = (function () {
  41392. function PusherAuthorizer(channel, options) {
  41393. this.channel = channel;
  41394. var authTransport = options.authTransport;
  41395. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  41396. throw "'" + authTransport + "' is not a recognized auth transport";
  41397. }
  41398. this.type = authTransport;
  41399. this.options = options;
  41400. this.authOptions = (options || {}).auth || {};
  41401. }
  41402. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  41403. var query = 'socket_id=' + encodeURIComponent(socketId) +
  41404. '&channel_name=' + encodeURIComponent(this.channel.name);
  41405. for (var i in this.authOptions.params) {
  41406. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  41407. }
  41408. return query;
  41409. };
  41410. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  41411. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  41412. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  41413. };
  41414. return PusherAuthorizer;
  41415. }());
  41416. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  41417. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  41418. var timeline_sender_TimelineSender = (function () {
  41419. function TimelineSender(timeline, options) {
  41420. this.timeline = timeline;
  41421. this.options = options || {};
  41422. }
  41423. TimelineSender.prototype.send = function (useTLS, callback) {
  41424. if (this.timeline.isEmpty()) {
  41425. return;
  41426. }
  41427. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  41428. };
  41429. return TimelineSender;
  41430. }());
  41431. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  41432. // CONCATENATED MODULE: ./src/core/errors.ts
  41433. var errors_extends = (undefined && undefined.__extends) || (function () {
  41434. var extendStatics = function (d, b) {
  41435. extendStatics = Object.setPrototypeOf ||
  41436. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41437. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41438. return extendStatics(d, b);
  41439. };
  41440. return function (d, b) {
  41441. extendStatics(d, b);
  41442. function __() { this.constructor = d; }
  41443. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41444. };
  41445. })();
  41446. var BadEventName = (function (_super) {
  41447. errors_extends(BadEventName, _super);
  41448. function BadEventName(msg) {
  41449. var _newTarget = this.constructor;
  41450. var _this = _super.call(this, msg) || this;
  41451. Object.setPrototypeOf(_this, _newTarget.prototype);
  41452. return _this;
  41453. }
  41454. return BadEventName;
  41455. }(Error));
  41456. var RequestTimedOut = (function (_super) {
  41457. errors_extends(RequestTimedOut, _super);
  41458. function RequestTimedOut(msg) {
  41459. var _newTarget = this.constructor;
  41460. var _this = _super.call(this, msg) || this;
  41461. Object.setPrototypeOf(_this, _newTarget.prototype);
  41462. return _this;
  41463. }
  41464. return RequestTimedOut;
  41465. }(Error));
  41466. var TransportPriorityTooLow = (function (_super) {
  41467. errors_extends(TransportPriorityTooLow, _super);
  41468. function TransportPriorityTooLow(msg) {
  41469. var _newTarget = this.constructor;
  41470. var _this = _super.call(this, msg) || this;
  41471. Object.setPrototypeOf(_this, _newTarget.prototype);
  41472. return _this;
  41473. }
  41474. return TransportPriorityTooLow;
  41475. }(Error));
  41476. var TransportClosed = (function (_super) {
  41477. errors_extends(TransportClosed, _super);
  41478. function TransportClosed(msg) {
  41479. var _newTarget = this.constructor;
  41480. var _this = _super.call(this, msg) || this;
  41481. Object.setPrototypeOf(_this, _newTarget.prototype);
  41482. return _this;
  41483. }
  41484. return TransportClosed;
  41485. }(Error));
  41486. var UnsupportedFeature = (function (_super) {
  41487. errors_extends(UnsupportedFeature, _super);
  41488. function UnsupportedFeature(msg) {
  41489. var _newTarget = this.constructor;
  41490. var _this = _super.call(this, msg) || this;
  41491. Object.setPrototypeOf(_this, _newTarget.prototype);
  41492. return _this;
  41493. }
  41494. return UnsupportedFeature;
  41495. }(Error));
  41496. var UnsupportedTransport = (function (_super) {
  41497. errors_extends(UnsupportedTransport, _super);
  41498. function UnsupportedTransport(msg) {
  41499. var _newTarget = this.constructor;
  41500. var _this = _super.call(this, msg) || this;
  41501. Object.setPrototypeOf(_this, _newTarget.prototype);
  41502. return _this;
  41503. }
  41504. return UnsupportedTransport;
  41505. }(Error));
  41506. var UnsupportedStrategy = (function (_super) {
  41507. errors_extends(UnsupportedStrategy, _super);
  41508. function UnsupportedStrategy(msg) {
  41509. var _newTarget = this.constructor;
  41510. var _this = _super.call(this, msg) || this;
  41511. Object.setPrototypeOf(_this, _newTarget.prototype);
  41512. return _this;
  41513. }
  41514. return UnsupportedStrategy;
  41515. }(Error));
  41516. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  41517. var channel_extends = (undefined && undefined.__extends) || (function () {
  41518. var extendStatics = function (d, b) {
  41519. extendStatics = Object.setPrototypeOf ||
  41520. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41521. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41522. return extendStatics(d, b);
  41523. };
  41524. return function (d, b) {
  41525. extendStatics(d, b);
  41526. function __() { this.constructor = d; }
  41527. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41528. };
  41529. })();
  41530. var channel_Channel = (function (_super) {
  41531. channel_extends(Channel, _super);
  41532. function Channel(name, pusher) {
  41533. var _this = _super.call(this, function (event, data) {
  41534. logger.debug('No callbacks on ' + name + ' for ' + event);
  41535. }) || this;
  41536. _this.name = name;
  41537. _this.pusher = pusher;
  41538. _this.subscribed = false;
  41539. _this.subscriptionPending = false;
  41540. _this.subscriptionCancelled = false;
  41541. return _this;
  41542. }
  41543. Channel.prototype.authorize = function (socketId, callback) {
  41544. return callback(false, {});
  41545. };
  41546. Channel.prototype.trigger = function (event, data) {
  41547. if (event.indexOf("client-") !== 0) {
  41548. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  41549. }
  41550. if (!this.subscribed) {
  41551. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  41552. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  41553. }
  41554. return this.pusher.send_event(event, data, this.name);
  41555. };
  41556. Channel.prototype.disconnect = function () {
  41557. this.subscribed = false;
  41558. this.subscriptionPending = false;
  41559. };
  41560. Channel.prototype.handleEvent = function (event) {
  41561. var eventName = event.event;
  41562. var data = event.data;
  41563. if (eventName === "pusher_internal:subscription_succeeded") {
  41564. this.handleSubscriptionSucceededEvent(event);
  41565. }
  41566. else if (eventName.indexOf("pusher_internal:") !== 0) {
  41567. var metadata = {};
  41568. this.emit(eventName, data, metadata);
  41569. }
  41570. };
  41571. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41572. this.subscriptionPending = false;
  41573. this.subscribed = true;
  41574. if (this.subscriptionCancelled) {
  41575. this.pusher.unsubscribe(this.name);
  41576. }
  41577. else {
  41578. this.emit("pusher:subscription_succeeded", event.data);
  41579. }
  41580. };
  41581. Channel.prototype.subscribe = function () {
  41582. var _this = this;
  41583. if (this.subscribed) {
  41584. return;
  41585. }
  41586. this.subscriptionPending = true;
  41587. this.subscriptionCancelled = false;
  41588. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  41589. if (error) {
  41590. logger.error(data);
  41591. _this.emit('pusher:subscription_error', data);
  41592. }
  41593. else {
  41594. _this.pusher.send_event('pusher:subscribe', {
  41595. auth: data.auth,
  41596. channel_data: data.channel_data,
  41597. channel: _this.name
  41598. });
  41599. }
  41600. });
  41601. };
  41602. Channel.prototype.unsubscribe = function () {
  41603. this.subscribed = false;
  41604. this.pusher.send_event('pusher:unsubscribe', {
  41605. channel: this.name
  41606. });
  41607. };
  41608. Channel.prototype.cancelSubscription = function () {
  41609. this.subscriptionCancelled = true;
  41610. };
  41611. Channel.prototype.reinstateSubscription = function () {
  41612. this.subscriptionCancelled = false;
  41613. };
  41614. return Channel;
  41615. }(dispatcher));
  41616. /* harmony default export */ var channels_channel = (channel_Channel);
  41617. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  41618. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  41619. var extendStatics = function (d, b) {
  41620. extendStatics = Object.setPrototypeOf ||
  41621. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41622. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41623. return extendStatics(d, b);
  41624. };
  41625. return function (d, b) {
  41626. extendStatics(d, b);
  41627. function __() { this.constructor = d; }
  41628. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41629. };
  41630. })();
  41631. var private_channel_PrivateChannel = (function (_super) {
  41632. private_channel_extends(PrivateChannel, _super);
  41633. function PrivateChannel() {
  41634. return _super !== null && _super.apply(this, arguments) || this;
  41635. }
  41636. PrivateChannel.prototype.authorize = function (socketId, callback) {
  41637. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  41638. return authorizer.authorize(socketId, callback);
  41639. };
  41640. return PrivateChannel;
  41641. }(channels_channel));
  41642. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  41643. // CONCATENATED MODULE: ./src/core/channels/members.ts
  41644. var members_Members = (function () {
  41645. function Members() {
  41646. this.reset();
  41647. }
  41648. Members.prototype.get = function (id) {
  41649. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  41650. return {
  41651. id: id,
  41652. info: this.members[id]
  41653. };
  41654. }
  41655. else {
  41656. return null;
  41657. }
  41658. };
  41659. Members.prototype.each = function (callback) {
  41660. var _this = this;
  41661. objectApply(this.members, function (member, id) {
  41662. callback(_this.get(id));
  41663. });
  41664. };
  41665. Members.prototype.setMyID = function (id) {
  41666. this.myID = id;
  41667. };
  41668. Members.prototype.onSubscription = function (subscriptionData) {
  41669. this.members = subscriptionData.presence.hash;
  41670. this.count = subscriptionData.presence.count;
  41671. this.me = this.get(this.myID);
  41672. };
  41673. Members.prototype.addMember = function (memberData) {
  41674. if (this.get(memberData.user_id) === null) {
  41675. this.count++;
  41676. }
  41677. this.members[memberData.user_id] = memberData.user_info;
  41678. return this.get(memberData.user_id);
  41679. };
  41680. Members.prototype.removeMember = function (memberData) {
  41681. var member = this.get(memberData.user_id);
  41682. if (member) {
  41683. delete this.members[memberData.user_id];
  41684. this.count--;
  41685. }
  41686. return member;
  41687. };
  41688. Members.prototype.reset = function () {
  41689. this.members = {};
  41690. this.count = 0;
  41691. this.myID = null;
  41692. this.me = null;
  41693. };
  41694. return Members;
  41695. }());
  41696. /* harmony default export */ var members = (members_Members);
  41697. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  41698. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  41699. var extendStatics = function (d, b) {
  41700. extendStatics = Object.setPrototypeOf ||
  41701. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41702. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41703. return extendStatics(d, b);
  41704. };
  41705. return function (d, b) {
  41706. extendStatics(d, b);
  41707. function __() { this.constructor = d; }
  41708. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41709. };
  41710. })();
  41711. var presence_channel_PresenceChannel = (function (_super) {
  41712. presence_channel_extends(PresenceChannel, _super);
  41713. function PresenceChannel(name, pusher) {
  41714. var _this = _super.call(this, name, pusher) || this;
  41715. _this.members = new members();
  41716. return _this;
  41717. }
  41718. PresenceChannel.prototype.authorize = function (socketId, callback) {
  41719. var _this = this;
  41720. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41721. if (!error) {
  41722. if (authData.channel_data === undefined) {
  41723. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  41724. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  41725. ("expected 'channel_data' field. " + suffix));
  41726. callback("Invalid auth response");
  41727. return;
  41728. }
  41729. var channelData = JSON.parse(authData.channel_data);
  41730. _this.members.setMyID(channelData.user_id);
  41731. }
  41732. callback(error, authData);
  41733. });
  41734. };
  41735. PresenceChannel.prototype.handleEvent = function (event) {
  41736. var eventName = event.event;
  41737. if (eventName.indexOf("pusher_internal:") === 0) {
  41738. this.handleInternalEvent(event);
  41739. }
  41740. else {
  41741. var data = event.data;
  41742. var metadata = {};
  41743. if (event.user_id) {
  41744. metadata.user_id = event.user_id;
  41745. }
  41746. this.emit(eventName, data, metadata);
  41747. }
  41748. };
  41749. PresenceChannel.prototype.handleInternalEvent = function (event) {
  41750. var eventName = event.event;
  41751. var data = event.data;
  41752. switch (eventName) {
  41753. case "pusher_internal:subscription_succeeded":
  41754. this.handleSubscriptionSucceededEvent(event);
  41755. break;
  41756. case "pusher_internal:member_added":
  41757. var addedMember = this.members.addMember(data);
  41758. this.emit('pusher:member_added', addedMember);
  41759. break;
  41760. case "pusher_internal:member_removed":
  41761. var removedMember = this.members.removeMember(data);
  41762. if (removedMember) {
  41763. this.emit('pusher:member_removed', removedMember);
  41764. }
  41765. break;
  41766. }
  41767. };
  41768. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41769. this.subscriptionPending = false;
  41770. this.subscribed = true;
  41771. if (this.subscriptionCancelled) {
  41772. this.pusher.unsubscribe(this.name);
  41773. }
  41774. else {
  41775. this.members.onSubscription(event.data);
  41776. this.emit("pusher:subscription_succeeded", this.members);
  41777. }
  41778. };
  41779. PresenceChannel.prototype.disconnect = function () {
  41780. this.members.reset();
  41781. _super.prototype.disconnect.call(this);
  41782. };
  41783. return PresenceChannel;
  41784. }(private_channel));
  41785. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41786. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41787. var nacl_fast = __webpack_require__(0);
  41788. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41789. var nacl_util = __webpack_require__(1);
  41790. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41791. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41792. var extendStatics = function (d, b) {
  41793. extendStatics = Object.setPrototypeOf ||
  41794. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41795. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41796. return extendStatics(d, b);
  41797. };
  41798. return function (d, b) {
  41799. extendStatics(d, b);
  41800. function __() { this.constructor = d; }
  41801. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41802. };
  41803. })();
  41804. var encrypted_channel_EncryptedChannel = (function (_super) {
  41805. encrypted_channel_extends(EncryptedChannel, _super);
  41806. function EncryptedChannel() {
  41807. var _this = _super !== null && _super.apply(this, arguments) || this;
  41808. _this.key = null;
  41809. return _this;
  41810. }
  41811. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41812. var _this = this;
  41813. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41814. if (error) {
  41815. callback(true, authData);
  41816. return;
  41817. }
  41818. var sharedSecret = authData["shared_secret"];
  41819. if (!sharedSecret) {
  41820. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41821. callback(true, errorMsg);
  41822. return;
  41823. }
  41824. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41825. delete authData["shared_secret"];
  41826. callback(false, authData);
  41827. });
  41828. };
  41829. EncryptedChannel.prototype.trigger = function (event, data) {
  41830. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41831. };
  41832. EncryptedChannel.prototype.handleEvent = function (event) {
  41833. var eventName = event.event;
  41834. var data = event.data;
  41835. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41836. _super.prototype.handleEvent.call(this, event);
  41837. return;
  41838. }
  41839. this.handleEncryptedEvent(eventName, data);
  41840. };
  41841. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41842. var _this = this;
  41843. if (!this.key) {
  41844. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41845. return;
  41846. }
  41847. if (!data.ciphertext || !data.nonce) {
  41848. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41849. return;
  41850. }
  41851. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41852. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41853. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41854. return;
  41855. }
  41856. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41857. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41858. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41859. return;
  41860. }
  41861. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41862. if (bytes === null) {
  41863. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41864. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41865. if (error) {
  41866. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41867. return;
  41868. }
  41869. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41870. if (bytes === null) {
  41871. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41872. return;
  41873. }
  41874. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41875. return;
  41876. });
  41877. return;
  41878. }
  41879. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41880. };
  41881. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41882. try {
  41883. this.emit(eventName, JSON.parse(data));
  41884. }
  41885. catch (e) {
  41886. this.emit(eventName, data);
  41887. }
  41888. return this;
  41889. };
  41890. return EncryptedChannel;
  41891. }(private_channel));
  41892. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41893. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41894. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41895. var extendStatics = function (d, b) {
  41896. extendStatics = Object.setPrototypeOf ||
  41897. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41898. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41899. return extendStatics(d, b);
  41900. };
  41901. return function (d, b) {
  41902. extendStatics(d, b);
  41903. function __() { this.constructor = d; }
  41904. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41905. };
  41906. })();
  41907. var connection_manager_ConnectionManager = (function (_super) {
  41908. connection_manager_extends(ConnectionManager, _super);
  41909. function ConnectionManager(key, options) {
  41910. var _this = _super.call(this) || this;
  41911. _this.key = key;
  41912. _this.options = options || {};
  41913. _this.state = "initialized";
  41914. _this.connection = null;
  41915. _this.usingTLS = !!options.useTLS;
  41916. _this.timeline = _this.options.timeline;
  41917. _this.errorCallbacks = _this.buildErrorCallbacks();
  41918. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41919. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41920. var Network = runtime.getNetwork();
  41921. Network.bind("online", function () {
  41922. _this.timeline.info({ netinfo: "online" });
  41923. if (_this.state === "connecting" || _this.state === "unavailable") {
  41924. _this.retryIn(0);
  41925. }
  41926. });
  41927. Network.bind("offline", function () {
  41928. _this.timeline.info({ netinfo: "offline" });
  41929. if (_this.connection) {
  41930. _this.sendActivityCheck();
  41931. }
  41932. });
  41933. _this.updateStrategy();
  41934. return _this;
  41935. }
  41936. ConnectionManager.prototype.connect = function () {
  41937. if (this.connection || this.runner) {
  41938. return;
  41939. }
  41940. if (!this.strategy.isSupported()) {
  41941. this.updateState("failed");
  41942. return;
  41943. }
  41944. this.updateState("connecting");
  41945. this.startConnecting();
  41946. this.setUnavailableTimer();
  41947. };
  41948. ;
  41949. ConnectionManager.prototype.send = function (data) {
  41950. if (this.connection) {
  41951. return this.connection.send(data);
  41952. }
  41953. else {
  41954. return false;
  41955. }
  41956. };
  41957. ;
  41958. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41959. if (this.connection) {
  41960. return this.connection.send_event(name, data, channel);
  41961. }
  41962. else {
  41963. return false;
  41964. }
  41965. };
  41966. ;
  41967. ConnectionManager.prototype.disconnect = function () {
  41968. this.disconnectInternally();
  41969. this.updateState("disconnected");
  41970. };
  41971. ;
  41972. ConnectionManager.prototype.isUsingTLS = function () {
  41973. return this.usingTLS;
  41974. };
  41975. ;
  41976. ConnectionManager.prototype.startConnecting = function () {
  41977. var _this = this;
  41978. var callback = function (error, handshake) {
  41979. if (error) {
  41980. _this.runner = _this.strategy.connect(0, callback);
  41981. }
  41982. else {
  41983. if (handshake.action === "error") {
  41984. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41985. _this.timeline.error({ handshakeError: handshake.error });
  41986. }
  41987. else {
  41988. _this.abortConnecting();
  41989. _this.handshakeCallbacks[handshake.action](handshake);
  41990. }
  41991. }
  41992. };
  41993. this.runner = this.strategy.connect(0, callback);
  41994. };
  41995. ;
  41996. ConnectionManager.prototype.abortConnecting = function () {
  41997. if (this.runner) {
  41998. this.runner.abort();
  41999. this.runner = null;
  42000. }
  42001. };
  42002. ;
  42003. ConnectionManager.prototype.disconnectInternally = function () {
  42004. this.abortConnecting();
  42005. this.clearRetryTimer();
  42006. this.clearUnavailableTimer();
  42007. if (this.connection) {
  42008. var connection = this.abandonConnection();
  42009. connection.close();
  42010. }
  42011. };
  42012. ;
  42013. ConnectionManager.prototype.updateStrategy = function () {
  42014. this.strategy = this.options.getStrategy({
  42015. key: this.key,
  42016. timeline: this.timeline,
  42017. useTLS: this.usingTLS
  42018. });
  42019. };
  42020. ;
  42021. ConnectionManager.prototype.retryIn = function (delay) {
  42022. var _this = this;
  42023. this.timeline.info({ action: "retry", delay: delay });
  42024. if (delay > 0) {
  42025. this.emit("connecting_in", Math.round(delay / 1000));
  42026. }
  42027. this.retryTimer = new OneOffTimer(delay || 0, function () {
  42028. _this.disconnectInternally();
  42029. _this.connect();
  42030. });
  42031. };
  42032. ;
  42033. ConnectionManager.prototype.clearRetryTimer = function () {
  42034. if (this.retryTimer) {
  42035. this.retryTimer.ensureAborted();
  42036. this.retryTimer = null;
  42037. }
  42038. };
  42039. ;
  42040. ConnectionManager.prototype.setUnavailableTimer = function () {
  42041. var _this = this;
  42042. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  42043. _this.updateState("unavailable");
  42044. });
  42045. };
  42046. ;
  42047. ConnectionManager.prototype.clearUnavailableTimer = function () {
  42048. if (this.unavailableTimer) {
  42049. this.unavailableTimer.ensureAborted();
  42050. }
  42051. };
  42052. ;
  42053. ConnectionManager.prototype.sendActivityCheck = function () {
  42054. var _this = this;
  42055. this.stopActivityCheck();
  42056. this.connection.ping();
  42057. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  42058. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  42059. _this.retryIn(0);
  42060. });
  42061. };
  42062. ;
  42063. ConnectionManager.prototype.resetActivityCheck = function () {
  42064. var _this = this;
  42065. this.stopActivityCheck();
  42066. if (this.connection && !this.connection.handlesActivityChecks()) {
  42067. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  42068. _this.sendActivityCheck();
  42069. });
  42070. }
  42071. };
  42072. ;
  42073. ConnectionManager.prototype.stopActivityCheck = function () {
  42074. if (this.activityTimer) {
  42075. this.activityTimer.ensureAborted();
  42076. }
  42077. };
  42078. ;
  42079. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  42080. var _this = this;
  42081. return extend({}, errorCallbacks, {
  42082. message: function (message) {
  42083. _this.resetActivityCheck();
  42084. _this.emit('message', message);
  42085. },
  42086. ping: function () {
  42087. _this.send_event('pusher:pong', {});
  42088. },
  42089. activity: function () {
  42090. _this.resetActivityCheck();
  42091. },
  42092. error: function (error) {
  42093. _this.emit("error", { type: "WebSocketError", error: error });
  42094. },
  42095. closed: function () {
  42096. _this.abandonConnection();
  42097. if (_this.shouldRetry()) {
  42098. _this.retryIn(1000);
  42099. }
  42100. }
  42101. });
  42102. };
  42103. ;
  42104. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  42105. var _this = this;
  42106. return extend({}, errorCallbacks, {
  42107. connected: function (handshake) {
  42108. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  42109. _this.clearUnavailableTimer();
  42110. _this.setConnection(handshake.connection);
  42111. _this.socket_id = _this.connection.id;
  42112. _this.updateState("connected", { socket_id: _this.socket_id });
  42113. }
  42114. });
  42115. };
  42116. ;
  42117. ConnectionManager.prototype.buildErrorCallbacks = function () {
  42118. var _this = this;
  42119. var withErrorEmitted = function (callback) {
  42120. return function (result) {
  42121. if (result.error) {
  42122. _this.emit("error", { type: "WebSocketError", error: result.error });
  42123. }
  42124. callback(result);
  42125. };
  42126. };
  42127. return {
  42128. tls_only: withErrorEmitted(function () {
  42129. _this.usingTLS = true;
  42130. _this.updateStrategy();
  42131. _this.retryIn(0);
  42132. }),
  42133. refused: withErrorEmitted(function () {
  42134. _this.disconnect();
  42135. }),
  42136. backoff: withErrorEmitted(function () {
  42137. _this.retryIn(1000);
  42138. }),
  42139. retry: withErrorEmitted(function () {
  42140. _this.retryIn(0);
  42141. })
  42142. };
  42143. };
  42144. ;
  42145. ConnectionManager.prototype.setConnection = function (connection) {
  42146. this.connection = connection;
  42147. for (var event in this.connectionCallbacks) {
  42148. this.connection.bind(event, this.connectionCallbacks[event]);
  42149. }
  42150. this.resetActivityCheck();
  42151. };
  42152. ;
  42153. ConnectionManager.prototype.abandonConnection = function () {
  42154. if (!this.connection) {
  42155. return;
  42156. }
  42157. this.stopActivityCheck();
  42158. for (var event in this.connectionCallbacks) {
  42159. this.connection.unbind(event, this.connectionCallbacks[event]);
  42160. }
  42161. var connection = this.connection;
  42162. this.connection = null;
  42163. return connection;
  42164. };
  42165. ConnectionManager.prototype.updateState = function (newState, data) {
  42166. var previousState = this.state;
  42167. this.state = newState;
  42168. if (previousState !== newState) {
  42169. var newStateDescription = newState;
  42170. if (newStateDescription === "connected") {
  42171. newStateDescription += " with new socket ID " + data.socket_id;
  42172. }
  42173. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  42174. this.timeline.info({ state: newState, params: data });
  42175. this.emit('state_change', { previous: previousState, current: newState });
  42176. this.emit(newState, data);
  42177. }
  42178. };
  42179. ConnectionManager.prototype.shouldRetry = function () {
  42180. return this.state === "connecting" || this.state === "connected";
  42181. };
  42182. return ConnectionManager;
  42183. }(dispatcher));
  42184. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  42185. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  42186. var channels_Channels = (function () {
  42187. function Channels() {
  42188. this.channels = {};
  42189. }
  42190. Channels.prototype.add = function (name, pusher) {
  42191. if (!this.channels[name]) {
  42192. this.channels[name] = createChannel(name, pusher);
  42193. }
  42194. return this.channels[name];
  42195. };
  42196. Channels.prototype.all = function () {
  42197. return values(this.channels);
  42198. };
  42199. Channels.prototype.find = function (name) {
  42200. return this.channels[name];
  42201. };
  42202. Channels.prototype.remove = function (name) {
  42203. var channel = this.channels[name];
  42204. delete this.channels[name];
  42205. return channel;
  42206. };
  42207. Channels.prototype.disconnect = function () {
  42208. objectApply(this.channels, function (channel) {
  42209. channel.disconnect();
  42210. });
  42211. };
  42212. return Channels;
  42213. }());
  42214. /* harmony default export */ var channels = (channels_Channels);
  42215. function createChannel(name, pusher) {
  42216. if (name.indexOf('private-encrypted-') === 0) {
  42217. if (false) { var errorMsg; }
  42218. return factory.createEncryptedChannel(name, pusher);
  42219. }
  42220. else if (name.indexOf('private-') === 0) {
  42221. return factory.createPrivateChannel(name, pusher);
  42222. }
  42223. else if (name.indexOf('presence-') === 0) {
  42224. return factory.createPresenceChannel(name, pusher);
  42225. }
  42226. else {
  42227. return factory.createChannel(name, pusher);
  42228. }
  42229. }
  42230. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  42231. var Factory = {
  42232. createChannels: function () {
  42233. return new channels();
  42234. },
  42235. createConnectionManager: function (key, options) {
  42236. return new connection_manager(key, options);
  42237. },
  42238. createChannel: function (name, pusher) {
  42239. return new channels_channel(name, pusher);
  42240. },
  42241. createPrivateChannel: function (name, pusher) {
  42242. return new private_channel(name, pusher);
  42243. },
  42244. createPresenceChannel: function (name, pusher) {
  42245. return new presence_channel(name, pusher);
  42246. },
  42247. createEncryptedChannel: function (name, pusher) {
  42248. return new encrypted_channel(name, pusher);
  42249. },
  42250. createTimelineSender: function (timeline, options) {
  42251. return new timeline_sender(timeline, options);
  42252. },
  42253. createAuthorizer: function (channel, options) {
  42254. if (options.authorizer) {
  42255. return options.authorizer(channel, options);
  42256. }
  42257. return new pusher_authorizer(channel, options);
  42258. },
  42259. createHandshake: function (transport, callback) {
  42260. return new connection_handshake(transport, callback);
  42261. },
  42262. createAssistantToTheTransportManager: function (manager, transport, options) {
  42263. return new assistant_to_the_transport_manager(manager, transport, options);
  42264. }
  42265. };
  42266. /* harmony default export */ var factory = (Factory);
  42267. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  42268. var transport_manager_TransportManager = (function () {
  42269. function TransportManager(options) {
  42270. this.options = options || {};
  42271. this.livesLeft = this.options.lives || Infinity;
  42272. }
  42273. TransportManager.prototype.getAssistant = function (transport) {
  42274. return factory.createAssistantToTheTransportManager(this, transport, {
  42275. minPingDelay: this.options.minPingDelay,
  42276. maxPingDelay: this.options.maxPingDelay
  42277. });
  42278. };
  42279. TransportManager.prototype.isAlive = function () {
  42280. return this.livesLeft > 0;
  42281. };
  42282. TransportManager.prototype.reportDeath = function () {
  42283. this.livesLeft -= 1;
  42284. };
  42285. return TransportManager;
  42286. }());
  42287. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  42288. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  42289. var sequential_strategy_SequentialStrategy = (function () {
  42290. function SequentialStrategy(strategies, options) {
  42291. this.strategies = strategies;
  42292. this.loop = Boolean(options.loop);
  42293. this.failFast = Boolean(options.failFast);
  42294. this.timeout = options.timeout;
  42295. this.timeoutLimit = options.timeoutLimit;
  42296. }
  42297. SequentialStrategy.prototype.isSupported = function () {
  42298. return any(this.strategies, util.method("isSupported"));
  42299. };
  42300. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  42301. var _this = this;
  42302. var strategies = this.strategies;
  42303. var current = 0;
  42304. var timeout = this.timeout;
  42305. var runner = null;
  42306. var tryNextStrategy = function (error, handshake) {
  42307. if (handshake) {
  42308. callback(null, handshake);
  42309. }
  42310. else {
  42311. current = current + 1;
  42312. if (_this.loop) {
  42313. current = current % strategies.length;
  42314. }
  42315. if (current < strategies.length) {
  42316. if (timeout) {
  42317. timeout = timeout * 2;
  42318. if (_this.timeoutLimit) {
  42319. timeout = Math.min(timeout, _this.timeoutLimit);
  42320. }
  42321. }
  42322. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  42323. }
  42324. else {
  42325. callback(true);
  42326. }
  42327. }
  42328. };
  42329. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  42330. return {
  42331. abort: function () {
  42332. runner.abort();
  42333. },
  42334. forceMinPriority: function (p) {
  42335. minPriority = p;
  42336. if (runner) {
  42337. runner.forceMinPriority(p);
  42338. }
  42339. }
  42340. };
  42341. };
  42342. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  42343. var timer = null;
  42344. var runner = null;
  42345. if (options.timeout > 0) {
  42346. timer = new OneOffTimer(options.timeout, function () {
  42347. runner.abort();
  42348. callback(true);
  42349. });
  42350. }
  42351. runner = strategy.connect(minPriority, function (error, handshake) {
  42352. if (error && timer && timer.isRunning() && !options.failFast) {
  42353. return;
  42354. }
  42355. if (timer) {
  42356. timer.ensureAborted();
  42357. }
  42358. callback(error, handshake);
  42359. });
  42360. return {
  42361. abort: function () {
  42362. if (timer) {
  42363. timer.ensureAborted();
  42364. }
  42365. runner.abort();
  42366. },
  42367. forceMinPriority: function (p) {
  42368. runner.forceMinPriority(p);
  42369. }
  42370. };
  42371. };
  42372. return SequentialStrategy;
  42373. }());
  42374. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  42375. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  42376. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  42377. function BestConnectedEverStrategy(strategies) {
  42378. this.strategies = strategies;
  42379. }
  42380. BestConnectedEverStrategy.prototype.isSupported = function () {
  42381. return any(this.strategies, util.method("isSupported"));
  42382. };
  42383. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  42384. return connect(this.strategies, minPriority, function (i, runners) {
  42385. return function (error, handshake) {
  42386. runners[i].error = error;
  42387. if (error) {
  42388. if (allRunnersFailed(runners)) {
  42389. callback(true);
  42390. }
  42391. return;
  42392. }
  42393. apply(runners, function (runner) {
  42394. runner.forceMinPriority(handshake.transport.priority);
  42395. });
  42396. callback(null, handshake);
  42397. };
  42398. });
  42399. };
  42400. return BestConnectedEverStrategy;
  42401. }());
  42402. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  42403. function connect(strategies, minPriority, callbackBuilder) {
  42404. var runners = map(strategies, function (strategy, i, _, rs) {
  42405. return strategy.connect(minPriority, callbackBuilder(i, rs));
  42406. });
  42407. return {
  42408. abort: function () {
  42409. apply(runners, abortRunner);
  42410. },
  42411. forceMinPriority: function (p) {
  42412. apply(runners, function (runner) {
  42413. runner.forceMinPriority(p);
  42414. });
  42415. }
  42416. };
  42417. }
  42418. function allRunnersFailed(runners) {
  42419. return collections_all(runners, function (runner) {
  42420. return Boolean(runner.error);
  42421. });
  42422. }
  42423. function abortRunner(runner) {
  42424. if (!runner.error && !runner.aborted) {
  42425. runner.abort();
  42426. runner.aborted = true;
  42427. }
  42428. }
  42429. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  42430. var cached_strategy_CachedStrategy = (function () {
  42431. function CachedStrategy(strategy, transports, options) {
  42432. this.strategy = strategy;
  42433. this.transports = transports;
  42434. this.ttl = options.ttl || 1800 * 1000;
  42435. this.usingTLS = options.useTLS;
  42436. this.timeline = options.timeline;
  42437. }
  42438. CachedStrategy.prototype.isSupported = function () {
  42439. return this.strategy.isSupported();
  42440. };
  42441. CachedStrategy.prototype.connect = function (minPriority, callback) {
  42442. var usingTLS = this.usingTLS;
  42443. var info = fetchTransportCache(usingTLS);
  42444. var strategies = [this.strategy];
  42445. if (info && info.timestamp + this.ttl >= util.now()) {
  42446. var transport = this.transports[info.transport];
  42447. if (transport) {
  42448. this.timeline.info({
  42449. cached: true,
  42450. transport: info.transport,
  42451. latency: info.latency
  42452. });
  42453. strategies.push(new sequential_strategy([transport], {
  42454. timeout: info.latency * 2 + 1000,
  42455. failFast: true
  42456. }));
  42457. }
  42458. }
  42459. var startTimestamp = util.now();
  42460. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  42461. if (error) {
  42462. flushTransportCache(usingTLS);
  42463. if (strategies.length > 0) {
  42464. startTimestamp = util.now();
  42465. runner = strategies.pop().connect(minPriority, cb);
  42466. }
  42467. else {
  42468. callback(error);
  42469. }
  42470. }
  42471. else {
  42472. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  42473. callback(null, handshake);
  42474. }
  42475. });
  42476. return {
  42477. abort: function () {
  42478. runner.abort();
  42479. },
  42480. forceMinPriority: function (p) {
  42481. minPriority = p;
  42482. if (runner) {
  42483. runner.forceMinPriority(p);
  42484. }
  42485. }
  42486. };
  42487. };
  42488. return CachedStrategy;
  42489. }());
  42490. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  42491. function getTransportCacheKey(usingTLS) {
  42492. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  42493. }
  42494. function fetchTransportCache(usingTLS) {
  42495. var storage = runtime.getLocalStorage();
  42496. if (storage) {
  42497. try {
  42498. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  42499. if (serializedCache) {
  42500. return JSON.parse(serializedCache);
  42501. }
  42502. }
  42503. catch (e) {
  42504. flushTransportCache(usingTLS);
  42505. }
  42506. }
  42507. return null;
  42508. }
  42509. function storeTransportCache(usingTLS, transport, latency) {
  42510. var storage = runtime.getLocalStorage();
  42511. if (storage) {
  42512. try {
  42513. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  42514. timestamp: util.now(),
  42515. transport: transport,
  42516. latency: latency
  42517. });
  42518. }
  42519. catch (e) {
  42520. }
  42521. }
  42522. }
  42523. function flushTransportCache(usingTLS) {
  42524. var storage = runtime.getLocalStorage();
  42525. if (storage) {
  42526. try {
  42527. delete storage[getTransportCacheKey(usingTLS)];
  42528. }
  42529. catch (e) {
  42530. }
  42531. }
  42532. }
  42533. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  42534. var delayed_strategy_DelayedStrategy = (function () {
  42535. function DelayedStrategy(strategy, _a) {
  42536. var number = _a.delay;
  42537. this.strategy = strategy;
  42538. this.options = { delay: number };
  42539. }
  42540. DelayedStrategy.prototype.isSupported = function () {
  42541. return this.strategy.isSupported();
  42542. };
  42543. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  42544. var strategy = this.strategy;
  42545. var runner;
  42546. var timer = new OneOffTimer(this.options.delay, function () {
  42547. runner = strategy.connect(minPriority, callback);
  42548. });
  42549. return {
  42550. abort: function () {
  42551. timer.ensureAborted();
  42552. if (runner) {
  42553. runner.abort();
  42554. }
  42555. },
  42556. forceMinPriority: function (p) {
  42557. minPriority = p;
  42558. if (runner) {
  42559. runner.forceMinPriority(p);
  42560. }
  42561. }
  42562. };
  42563. };
  42564. return DelayedStrategy;
  42565. }());
  42566. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  42567. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  42568. var IfStrategy = (function () {
  42569. function IfStrategy(test, trueBranch, falseBranch) {
  42570. this.test = test;
  42571. this.trueBranch = trueBranch;
  42572. this.falseBranch = falseBranch;
  42573. }
  42574. IfStrategy.prototype.isSupported = function () {
  42575. var branch = this.test() ? this.trueBranch : this.falseBranch;
  42576. return branch.isSupported();
  42577. };
  42578. IfStrategy.prototype.connect = function (minPriority, callback) {
  42579. var branch = this.test() ? this.trueBranch : this.falseBranch;
  42580. return branch.connect(minPriority, callback);
  42581. };
  42582. return IfStrategy;
  42583. }());
  42584. /* harmony default export */ var if_strategy = (IfStrategy);
  42585. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  42586. var FirstConnectedStrategy = (function () {
  42587. function FirstConnectedStrategy(strategy) {
  42588. this.strategy = strategy;
  42589. }
  42590. FirstConnectedStrategy.prototype.isSupported = function () {
  42591. return this.strategy.isSupported();
  42592. };
  42593. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  42594. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  42595. if (handshake) {
  42596. runner.abort();
  42597. }
  42598. callback(error, handshake);
  42599. });
  42600. return runner;
  42601. };
  42602. return FirstConnectedStrategy;
  42603. }());
  42604. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  42605. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  42606. function testSupportsStrategy(strategy) {
  42607. return function () {
  42608. return strategy.isSupported();
  42609. };
  42610. }
  42611. var getDefaultStrategy = function (config, defineTransport) {
  42612. var definedTransports = {};
  42613. function defineTransportStrategy(name, type, priority, options, manager) {
  42614. var transport = defineTransport(config, name, type, priority, options, manager);
  42615. definedTransports[name] = transport;
  42616. return transport;
  42617. }
  42618. var ws_options = {
  42619. hostNonTLS: config.wsHost + ":" + config.wsPort,
  42620. hostTLS: config.wsHost + ":" + config.wssPort,
  42621. httpPath: config.wsPath
  42622. };
  42623. var wss_options = extend({}, ws_options, {
  42624. useTLS: true
  42625. });
  42626. var sockjs_options = {
  42627. hostNonTLS: config.httpHost + ":" + config.httpPort,
  42628. hostTLS: config.httpHost + ":" + config.httpsPort,
  42629. httpPath: config.httpPath
  42630. };
  42631. var timeouts = {
  42632. loop: true,
  42633. timeout: 15000,
  42634. timeoutLimit: 60000
  42635. };
  42636. var ws_manager = new transport_manager({
  42637. lives: 2,
  42638. minPingDelay: 10000,
  42639. maxPingDelay: config.activity_timeout
  42640. });
  42641. var streaming_manager = new transport_manager({
  42642. lives: 2,
  42643. minPingDelay: 10000,
  42644. maxPingDelay: config.activity_timeout
  42645. });
  42646. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  42647. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  42648. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  42649. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  42650. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  42651. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  42652. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  42653. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  42654. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  42655. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  42656. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  42657. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  42658. 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);
  42659. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  42660. var wsStrategy;
  42661. if (config.useTLS) {
  42662. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  42663. }
  42664. else {
  42665. wsStrategy = new best_connected_ever_strategy([
  42666. ws_loop,
  42667. new delayed_strategy(wss_loop, { delay: 2000 }),
  42668. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  42669. ]);
  42670. }
  42671. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  42672. ttl: 1800000,
  42673. timeline: config.timeline,
  42674. useTLS: config.useTLS
  42675. });
  42676. };
  42677. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  42678. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  42679. /* harmony default export */ var transport_connection_initializer = (function () {
  42680. var self = this;
  42681. self.timeline.info(self.buildTimelineMessage({
  42682. transport: self.name + (self.options.useTLS ? "s" : "")
  42683. }));
  42684. if (self.hooks.isInitialized()) {
  42685. self.changeState("initialized");
  42686. }
  42687. else if (self.hooks.file) {
  42688. self.changeState("initializing");
  42689. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  42690. if (self.hooks.isInitialized()) {
  42691. self.changeState("initialized");
  42692. callback(true);
  42693. }
  42694. else {
  42695. if (error) {
  42696. self.onError(error);
  42697. }
  42698. self.onClose();
  42699. callback(false);
  42700. }
  42701. });
  42702. }
  42703. else {
  42704. self.onClose();
  42705. }
  42706. });
  42707. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  42708. var http_xdomain_request_hooks = {
  42709. getRequest: function (socket) {
  42710. var xdr = new window.XDomainRequest();
  42711. xdr.ontimeout = function () {
  42712. socket.emit("error", new RequestTimedOut());
  42713. socket.close();
  42714. };
  42715. xdr.onerror = function (e) {
  42716. socket.emit("error", e);
  42717. socket.close();
  42718. };
  42719. xdr.onprogress = function () {
  42720. if (xdr.responseText && xdr.responseText.length > 0) {
  42721. socket.onChunk(200, xdr.responseText);
  42722. }
  42723. };
  42724. xdr.onload = function () {
  42725. if (xdr.responseText && xdr.responseText.length > 0) {
  42726. socket.onChunk(200, xdr.responseText);
  42727. }
  42728. socket.emit("finished", 200);
  42729. socket.close();
  42730. };
  42731. return xdr;
  42732. },
  42733. abortRequest: function (xdr) {
  42734. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  42735. xdr.abort();
  42736. }
  42737. };
  42738. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  42739. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  42740. var http_request_extends = (undefined && undefined.__extends) || (function () {
  42741. var extendStatics = function (d, b) {
  42742. extendStatics = Object.setPrototypeOf ||
  42743. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  42744. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  42745. return extendStatics(d, b);
  42746. };
  42747. return function (d, b) {
  42748. extendStatics(d, b);
  42749. function __() { this.constructor = d; }
  42750. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  42751. };
  42752. })();
  42753. var MAX_BUFFER_LENGTH = 256 * 1024;
  42754. var http_request_HTTPRequest = (function (_super) {
  42755. http_request_extends(HTTPRequest, _super);
  42756. function HTTPRequest(hooks, method, url) {
  42757. var _this = _super.call(this) || this;
  42758. _this.hooks = hooks;
  42759. _this.method = method;
  42760. _this.url = url;
  42761. return _this;
  42762. }
  42763. HTTPRequest.prototype.start = function (payload) {
  42764. var _this = this;
  42765. this.position = 0;
  42766. this.xhr = this.hooks.getRequest(this);
  42767. this.unloader = function () {
  42768. _this.close();
  42769. };
  42770. runtime.addUnloadListener(this.unloader);
  42771. this.xhr.open(this.method, this.url, true);
  42772. if (this.xhr.setRequestHeader) {
  42773. this.xhr.setRequestHeader("Content-Type", "application/json");
  42774. }
  42775. this.xhr.send(payload);
  42776. };
  42777. HTTPRequest.prototype.close = function () {
  42778. if (this.unloader) {
  42779. runtime.removeUnloadListener(this.unloader);
  42780. this.unloader = null;
  42781. }
  42782. if (this.xhr) {
  42783. this.hooks.abortRequest(this.xhr);
  42784. this.xhr = null;
  42785. }
  42786. };
  42787. HTTPRequest.prototype.onChunk = function (status, data) {
  42788. while (true) {
  42789. var chunk = this.advanceBuffer(data);
  42790. if (chunk) {
  42791. this.emit("chunk", { status: status, data: chunk });
  42792. }
  42793. else {
  42794. break;
  42795. }
  42796. }
  42797. if (this.isBufferTooLong(data)) {
  42798. this.emit("buffer_too_long");
  42799. }
  42800. };
  42801. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42802. var unreadData = buffer.slice(this.position);
  42803. var endOfLinePosition = unreadData.indexOf("\n");
  42804. if (endOfLinePosition !== -1) {
  42805. this.position += endOfLinePosition + 1;
  42806. return unreadData.slice(0, endOfLinePosition);
  42807. }
  42808. else {
  42809. return null;
  42810. }
  42811. };
  42812. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42813. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42814. };
  42815. return HTTPRequest;
  42816. }(dispatcher));
  42817. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42818. // CONCATENATED MODULE: ./src/core/http/state.ts
  42819. var State;
  42820. (function (State) {
  42821. State[State["CONNECTING"] = 0] = "CONNECTING";
  42822. State[State["OPEN"] = 1] = "OPEN";
  42823. State[State["CLOSED"] = 3] = "CLOSED";
  42824. })(State || (State = {}));
  42825. /* harmony default export */ var state = (State);
  42826. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42827. var autoIncrement = 1;
  42828. var http_socket_HTTPSocket = (function () {
  42829. function HTTPSocket(hooks, url) {
  42830. this.hooks = hooks;
  42831. this.session = randomNumber(1000) + "/" + randomString(8);
  42832. this.location = getLocation(url);
  42833. this.readyState = state.CONNECTING;
  42834. this.openStream();
  42835. }
  42836. HTTPSocket.prototype.send = function (payload) {
  42837. return this.sendRaw(JSON.stringify([payload]));
  42838. };
  42839. HTTPSocket.prototype.ping = function () {
  42840. this.hooks.sendHeartbeat(this);
  42841. };
  42842. HTTPSocket.prototype.close = function (code, reason) {
  42843. this.onClose(code, reason, true);
  42844. };
  42845. HTTPSocket.prototype.sendRaw = function (payload) {
  42846. if (this.readyState === state.OPEN) {
  42847. try {
  42848. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42849. return true;
  42850. }
  42851. catch (e) {
  42852. return false;
  42853. }
  42854. }
  42855. else {
  42856. return false;
  42857. }
  42858. };
  42859. HTTPSocket.prototype.reconnect = function () {
  42860. this.closeStream();
  42861. this.openStream();
  42862. };
  42863. ;
  42864. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42865. this.closeStream();
  42866. this.readyState = state.CLOSED;
  42867. if (this.onclose) {
  42868. this.onclose({
  42869. code: code,
  42870. reason: reason,
  42871. wasClean: wasClean
  42872. });
  42873. }
  42874. };
  42875. HTTPSocket.prototype.onChunk = function (chunk) {
  42876. if (chunk.status !== 200) {
  42877. return;
  42878. }
  42879. if (this.readyState === state.OPEN) {
  42880. this.onActivity();
  42881. }
  42882. var payload;
  42883. var type = chunk.data.slice(0, 1);
  42884. switch (type) {
  42885. case 'o':
  42886. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42887. this.onOpen(payload);
  42888. break;
  42889. case 'a':
  42890. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42891. for (var i = 0; i < payload.length; i++) {
  42892. this.onEvent(payload[i]);
  42893. }
  42894. break;
  42895. case 'm':
  42896. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42897. this.onEvent(payload);
  42898. break;
  42899. case 'h':
  42900. this.hooks.onHeartbeat(this);
  42901. break;
  42902. case 'c':
  42903. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42904. this.onClose(payload[0], payload[1], true);
  42905. break;
  42906. }
  42907. };
  42908. HTTPSocket.prototype.onOpen = function (options) {
  42909. if (this.readyState === state.CONNECTING) {
  42910. if (options && options.hostname) {
  42911. this.location.base = replaceHost(this.location.base, options.hostname);
  42912. }
  42913. this.readyState = state.OPEN;
  42914. if (this.onopen) {
  42915. this.onopen();
  42916. }
  42917. }
  42918. else {
  42919. this.onClose(1006, "Server lost session", true);
  42920. }
  42921. };
  42922. HTTPSocket.prototype.onEvent = function (event) {
  42923. if (this.readyState === state.OPEN && this.onmessage) {
  42924. this.onmessage({ data: event });
  42925. }
  42926. };
  42927. HTTPSocket.prototype.onActivity = function () {
  42928. if (this.onactivity) {
  42929. this.onactivity();
  42930. }
  42931. };
  42932. HTTPSocket.prototype.onError = function (error) {
  42933. if (this.onerror) {
  42934. this.onerror(error);
  42935. }
  42936. };
  42937. HTTPSocket.prototype.openStream = function () {
  42938. var _this = this;
  42939. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42940. this.stream.bind("chunk", function (chunk) {
  42941. _this.onChunk(chunk);
  42942. });
  42943. this.stream.bind("finished", function (status) {
  42944. _this.hooks.onFinished(_this, status);
  42945. });
  42946. this.stream.bind("buffer_too_long", function () {
  42947. _this.reconnect();
  42948. });
  42949. try {
  42950. this.stream.start();
  42951. }
  42952. catch (error) {
  42953. util.defer(function () {
  42954. _this.onError(error);
  42955. _this.onClose(1006, "Could not start streaming", false);
  42956. });
  42957. }
  42958. };
  42959. HTTPSocket.prototype.closeStream = function () {
  42960. if (this.stream) {
  42961. this.stream.unbind_all();
  42962. this.stream.close();
  42963. this.stream = null;
  42964. }
  42965. };
  42966. return HTTPSocket;
  42967. }());
  42968. function getLocation(url) {
  42969. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42970. return {
  42971. base: parts[1],
  42972. queryString: parts[2]
  42973. };
  42974. }
  42975. function getSendURL(url, session) {
  42976. return url.base + "/" + session + "/xhr_send";
  42977. }
  42978. function getUniqueURL(url) {
  42979. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42980. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42981. }
  42982. function replaceHost(url, hostname) {
  42983. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42984. return urlParts[1] + hostname + urlParts[3];
  42985. }
  42986. function randomNumber(max) {
  42987. return Math.floor(Math.random() * max);
  42988. }
  42989. function randomString(length) {
  42990. var result = [];
  42991. for (var i = 0; i < length; i++) {
  42992. result.push(randomNumber(32).toString(32));
  42993. }
  42994. return result.join('');
  42995. }
  42996. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42997. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42998. var http_streaming_socket_hooks = {
  42999. getReceiveURL: function (url, session) {
  43000. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  43001. },
  43002. onHeartbeat: function (socket) {
  43003. socket.sendRaw("[]");
  43004. },
  43005. sendHeartbeat: function (socket) {
  43006. socket.sendRaw("[]");
  43007. },
  43008. onFinished: function (socket, status) {
  43009. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  43010. }
  43011. };
  43012. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  43013. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  43014. var http_polling_socket_hooks = {
  43015. getReceiveURL: function (url, session) {
  43016. return url.base + "/" + session + "/xhr" + url.queryString;
  43017. },
  43018. onHeartbeat: function () {
  43019. },
  43020. sendHeartbeat: function (socket) {
  43021. socket.sendRaw("[]");
  43022. },
  43023. onFinished: function (socket, status) {
  43024. if (status === 200) {
  43025. socket.reconnect();
  43026. }
  43027. else {
  43028. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  43029. }
  43030. }
  43031. };
  43032. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  43033. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  43034. var http_xhr_request_hooks = {
  43035. getRequest: function (socket) {
  43036. var Constructor = runtime.getXHRAPI();
  43037. var xhr = new Constructor();
  43038. xhr.onreadystatechange = xhr.onprogress = function () {
  43039. switch (xhr.readyState) {
  43040. case 3:
  43041. if (xhr.responseText && xhr.responseText.length > 0) {
  43042. socket.onChunk(xhr.status, xhr.responseText);
  43043. }
  43044. break;
  43045. case 4:
  43046. if (xhr.responseText && xhr.responseText.length > 0) {
  43047. socket.onChunk(xhr.status, xhr.responseText);
  43048. }
  43049. socket.emit("finished", xhr.status);
  43050. socket.close();
  43051. break;
  43052. }
  43053. };
  43054. return xhr;
  43055. },
  43056. abortRequest: function (xhr) {
  43057. xhr.onreadystatechange = null;
  43058. xhr.abort();
  43059. }
  43060. };
  43061. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  43062. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  43063. var HTTP = {
  43064. createStreamingSocket: function (url) {
  43065. return this.createSocket(http_streaming_socket, url);
  43066. },
  43067. createPollingSocket: function (url) {
  43068. return this.createSocket(http_polling_socket, url);
  43069. },
  43070. createSocket: function (hooks, url) {
  43071. return new http_socket(hooks, url);
  43072. },
  43073. createXHR: function (method, url) {
  43074. return this.createRequest(http_xhr_request, method, url);
  43075. },
  43076. createRequest: function (hooks, method, url) {
  43077. return new http_request(hooks, method, url);
  43078. }
  43079. };
  43080. /* harmony default export */ var http_http = (HTTP);
  43081. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  43082. http_http.createXDR = function (method, url) {
  43083. return this.createRequest(http_xdomain_request, method, url);
  43084. };
  43085. /* harmony default export */ var web_http_http = (http_http);
  43086. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  43087. var Runtime = {
  43088. nextAuthCallbackID: 1,
  43089. auth_callbacks: {},
  43090. ScriptReceivers: ScriptReceivers,
  43091. DependenciesReceivers: DependenciesReceivers,
  43092. getDefaultStrategy: default_strategy,
  43093. Transports: transports_transports,
  43094. transportConnectionInitializer: transport_connection_initializer,
  43095. HTTPFactory: web_http_http,
  43096. TimelineTransport: jsonp_timeline,
  43097. getXHRAPI: function () {
  43098. return window.XMLHttpRequest;
  43099. },
  43100. getWebSocketAPI: function () {
  43101. return window.WebSocket || window.MozWebSocket;
  43102. },
  43103. setup: function (PusherClass) {
  43104. var _this = this;
  43105. window.Pusher = PusherClass;
  43106. var initializeOnDocumentBody = function () {
  43107. _this.onDocumentBody(PusherClass.ready);
  43108. };
  43109. if (!window.JSON) {
  43110. Dependencies.load("json2", {}, initializeOnDocumentBody);
  43111. }
  43112. else {
  43113. initializeOnDocumentBody();
  43114. }
  43115. },
  43116. getDocument: function () {
  43117. return document;
  43118. },
  43119. getProtocol: function () {
  43120. return this.getDocument().location.protocol;
  43121. },
  43122. getAuthorizers: function () {
  43123. return { ajax: xhr_auth, jsonp: jsonp_auth };
  43124. },
  43125. onDocumentBody: function (callback) {
  43126. var _this = this;
  43127. if (document.body) {
  43128. callback();
  43129. }
  43130. else {
  43131. setTimeout(function () {
  43132. _this.onDocumentBody(callback);
  43133. }, 0);
  43134. }
  43135. },
  43136. createJSONPRequest: function (url, data) {
  43137. return new jsonp_request(url, data);
  43138. },
  43139. createScriptRequest: function (src) {
  43140. return new script_request(src);
  43141. },
  43142. getLocalStorage: function () {
  43143. try {
  43144. return window.localStorage;
  43145. }
  43146. catch (e) {
  43147. return undefined;
  43148. }
  43149. },
  43150. createXHR: function () {
  43151. if (this.getXHRAPI()) {
  43152. return this.createXMLHttpRequest();
  43153. }
  43154. else {
  43155. return this.createMicrosoftXHR();
  43156. }
  43157. },
  43158. createXMLHttpRequest: function () {
  43159. var Constructor = this.getXHRAPI();
  43160. return new Constructor();
  43161. },
  43162. createMicrosoftXHR: function () {
  43163. return new ActiveXObject("Microsoft.XMLHTTP");
  43164. },
  43165. getNetwork: function () {
  43166. return net_info_Network;
  43167. },
  43168. createWebSocket: function (url) {
  43169. var Constructor = this.getWebSocketAPI();
  43170. return new Constructor(url);
  43171. },
  43172. createSocketRequest: function (method, url) {
  43173. if (this.isXHRSupported()) {
  43174. return this.HTTPFactory.createXHR(method, url);
  43175. }
  43176. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  43177. return this.HTTPFactory.createXDR(method, url);
  43178. }
  43179. else {
  43180. throw "Cross-origin HTTP requests are not supported";
  43181. }
  43182. },
  43183. isXHRSupported: function () {
  43184. var Constructor = this.getXHRAPI();
  43185. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  43186. },
  43187. isXDRSupported: function (useTLS) {
  43188. var protocol = useTLS ? "https:" : "http:";
  43189. var documentProtocol = this.getProtocol();
  43190. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  43191. },
  43192. addUnloadListener: function (listener) {
  43193. if (window.addEventListener !== undefined) {
  43194. window.addEventListener("unload", listener, false);
  43195. }
  43196. else if (window.attachEvent !== undefined) {
  43197. window.attachEvent("onunload", listener);
  43198. }
  43199. },
  43200. removeUnloadListener: function (listener) {
  43201. if (window.addEventListener !== undefined) {
  43202. window.removeEventListener("unload", listener, false);
  43203. }
  43204. else if (window.detachEvent !== undefined) {
  43205. window.detachEvent("onunload", listener);
  43206. }
  43207. }
  43208. };
  43209. /* harmony default export */ var runtime = (Runtime);
  43210. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  43211. var TimelineLevel;
  43212. (function (TimelineLevel) {
  43213. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  43214. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  43215. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  43216. })(TimelineLevel || (TimelineLevel = {}));
  43217. /* harmony default export */ var timeline_level = (TimelineLevel);
  43218. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  43219. var timeline_Timeline = (function () {
  43220. function Timeline(key, session, options) {
  43221. this.key = key;
  43222. this.session = session;
  43223. this.events = [];
  43224. this.options = options || {};
  43225. this.sent = 0;
  43226. this.uniqueID = 0;
  43227. }
  43228. Timeline.prototype.log = function (level, event) {
  43229. if (level <= this.options.level) {
  43230. this.events.push(extend({}, event, { timestamp: util.now() }));
  43231. if (this.options.limit && this.events.length > this.options.limit) {
  43232. this.events.shift();
  43233. }
  43234. }
  43235. };
  43236. Timeline.prototype.error = function (event) {
  43237. this.log(timeline_level.ERROR, event);
  43238. };
  43239. Timeline.prototype.info = function (event) {
  43240. this.log(timeline_level.INFO, event);
  43241. };
  43242. Timeline.prototype.debug = function (event) {
  43243. this.log(timeline_level.DEBUG, event);
  43244. };
  43245. Timeline.prototype.isEmpty = function () {
  43246. return this.events.length === 0;
  43247. };
  43248. Timeline.prototype.send = function (sendfn, callback) {
  43249. var _this = this;
  43250. var data = extend({
  43251. session: this.session,
  43252. bundle: this.sent + 1,
  43253. key: this.key,
  43254. lib: "js",
  43255. version: this.options.version,
  43256. cluster: this.options.cluster,
  43257. features: this.options.features,
  43258. timeline: this.events
  43259. }, this.options.params);
  43260. this.events = [];
  43261. sendfn(data, function (error, result) {
  43262. if (!error) {
  43263. _this.sent++;
  43264. }
  43265. if (callback) {
  43266. callback(error, result);
  43267. }
  43268. });
  43269. return true;
  43270. };
  43271. Timeline.prototype.generateUniqueID = function () {
  43272. this.uniqueID++;
  43273. return this.uniqueID;
  43274. };
  43275. return Timeline;
  43276. }());
  43277. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  43278. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  43279. var transport_strategy_TransportStrategy = (function () {
  43280. function TransportStrategy(name, priority, transport, options) {
  43281. this.name = name;
  43282. this.priority = priority;
  43283. this.transport = transport;
  43284. this.options = options || {};
  43285. }
  43286. TransportStrategy.prototype.isSupported = function () {
  43287. return this.transport.isSupported({
  43288. useTLS: this.options.useTLS
  43289. });
  43290. };
  43291. TransportStrategy.prototype.connect = function (minPriority, callback) {
  43292. var _this = this;
  43293. if (!this.isSupported()) {
  43294. return failAttempt(new UnsupportedStrategy(), callback);
  43295. }
  43296. else if (this.priority < minPriority) {
  43297. return failAttempt(new TransportPriorityTooLow(), callback);
  43298. }
  43299. var connected = false;
  43300. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  43301. var handshake = null;
  43302. var onInitialized = function () {
  43303. transport.unbind("initialized", onInitialized);
  43304. transport.connect();
  43305. };
  43306. var onOpen = function () {
  43307. handshake = factory.createHandshake(transport, function (result) {
  43308. connected = true;
  43309. unbindListeners();
  43310. callback(null, result);
  43311. });
  43312. };
  43313. var onError = function (error) {
  43314. unbindListeners();
  43315. callback(error);
  43316. };
  43317. var onClosed = function () {
  43318. unbindListeners();
  43319. var serializedTransport;
  43320. serializedTransport = safeJSONStringify(transport);
  43321. callback(new TransportClosed(serializedTransport));
  43322. };
  43323. var unbindListeners = function () {
  43324. transport.unbind("initialized", onInitialized);
  43325. transport.unbind("open", onOpen);
  43326. transport.unbind("error", onError);
  43327. transport.unbind("closed", onClosed);
  43328. };
  43329. transport.bind("initialized", onInitialized);
  43330. transport.bind("open", onOpen);
  43331. transport.bind("error", onError);
  43332. transport.bind("closed", onClosed);
  43333. transport.initialize();
  43334. return {
  43335. abort: function () {
  43336. if (connected) {
  43337. return;
  43338. }
  43339. unbindListeners();
  43340. if (handshake) {
  43341. handshake.close();
  43342. }
  43343. else {
  43344. transport.close();
  43345. }
  43346. },
  43347. forceMinPriority: function (p) {
  43348. if (connected) {
  43349. return;
  43350. }
  43351. if (_this.priority < p) {
  43352. if (handshake) {
  43353. handshake.close();
  43354. }
  43355. else {
  43356. transport.close();
  43357. }
  43358. }
  43359. }
  43360. };
  43361. };
  43362. return TransportStrategy;
  43363. }());
  43364. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  43365. function failAttempt(error, callback) {
  43366. util.defer(function () {
  43367. callback(error);
  43368. });
  43369. return {
  43370. abort: function () { },
  43371. forceMinPriority: function () { }
  43372. };
  43373. }
  43374. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  43375. var strategy_builder_Transports = runtime.Transports;
  43376. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  43377. var transportClass = strategy_builder_Transports[type];
  43378. if (!transportClass) {
  43379. throw new UnsupportedTransport(type);
  43380. }
  43381. var enabled = (!config.enabledTransports ||
  43382. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  43383. (!config.disabledTransports ||
  43384. arrayIndexOf(config.disabledTransports, name) === -1);
  43385. var transport;
  43386. if (enabled) {
  43387. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  43388. key: config.key,
  43389. useTLS: config.useTLS,
  43390. timeline: config.timeline,
  43391. ignoreNullOrigin: config.ignoreNullOrigin
  43392. }, options));
  43393. }
  43394. else {
  43395. transport = strategy_builder_UnsupportedStrategy;
  43396. }
  43397. return transport;
  43398. };
  43399. var strategy_builder_UnsupportedStrategy = {
  43400. isSupported: function () {
  43401. return false;
  43402. },
  43403. connect: function (_, callback) {
  43404. var deferred = util.defer(function () {
  43405. callback(new UnsupportedStrategy());
  43406. });
  43407. return {
  43408. abort: function () {
  43409. deferred.ensureAborted();
  43410. },
  43411. forceMinPriority: function () { }
  43412. };
  43413. }
  43414. };
  43415. // CONCATENATED MODULE: ./src/core/config.ts
  43416. var getGlobalConfig = function () {
  43417. return {
  43418. wsHost: defaults.host,
  43419. wsPort: defaults.ws_port,
  43420. wssPort: defaults.wss_port,
  43421. wsPath: defaults.ws_path,
  43422. httpHost: defaults.sockjs_host,
  43423. httpPort: defaults.sockjs_http_port,
  43424. httpsPort: defaults.sockjs_https_port,
  43425. httpPath: defaults.sockjs_path,
  43426. statsHost: defaults.stats_host,
  43427. authEndpoint: defaults.channel_auth_endpoint,
  43428. authTransport: defaults.channel_auth_transport,
  43429. activity_timeout: defaults.activity_timeout,
  43430. pong_timeout: defaults.pong_timeout,
  43431. unavailable_timeout: defaults.unavailable_timeout
  43432. };
  43433. };
  43434. var getClusterConfig = function (clusterName) {
  43435. return {
  43436. wsHost: 'ws-' + clusterName + '.pusher.com',
  43437. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  43438. };
  43439. };
  43440. // CONCATENATED MODULE: ./src/core/pusher.ts
  43441. var pusher_Pusher = (function () {
  43442. function Pusher(app_key, options) {
  43443. var _this = this;
  43444. checkAppKey(app_key);
  43445. options = options || {};
  43446. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  43447. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  43448. logger.warn("You should always specify a cluster when connecting. " + suffix);
  43449. }
  43450. this.key = app_key;
  43451. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  43452. this.channels = factory.createChannels();
  43453. this.global_emitter = new dispatcher();
  43454. this.sessionID = Math.floor(Math.random() * 1000000000);
  43455. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  43456. cluster: this.config.cluster,
  43457. features: Pusher.getClientFeatures(),
  43458. params: this.config.timelineParams || {},
  43459. limit: 50,
  43460. level: timeline_level.INFO,
  43461. version: defaults.VERSION
  43462. });
  43463. if (!this.config.disableStats) {
  43464. this.timelineSender = factory.createTimelineSender(this.timeline, {
  43465. host: this.config.statsHost,
  43466. path: '/timeline/v2/' + runtime.TimelineTransport.name
  43467. });
  43468. }
  43469. var getStrategy = function (options) {
  43470. var config = extend({}, _this.config, options);
  43471. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  43472. };
  43473. this.connection = factory.createConnectionManager(this.key, extend({
  43474. getStrategy: getStrategy,
  43475. timeline: this.timeline,
  43476. activityTimeout: this.config.activity_timeout,
  43477. pongTimeout: this.config.pong_timeout,
  43478. unavailableTimeout: this.config.unavailable_timeout
  43479. }, this.config, { useTLS: this.shouldUseTLS() }));
  43480. this.connection.bind('connected', function () {
  43481. _this.subscribeAll();
  43482. if (_this.timelineSender) {
  43483. _this.timelineSender.send(_this.connection.isUsingTLS());
  43484. }
  43485. });
  43486. this.connection.bind('message', function (event) {
  43487. var eventName = event.event;
  43488. var internal = eventName.indexOf('pusher_internal:') === 0;
  43489. if (event.channel) {
  43490. var channel = _this.channel(event.channel);
  43491. if (channel) {
  43492. channel.handleEvent(event);
  43493. }
  43494. }
  43495. if (!internal) {
  43496. _this.global_emitter.emit(event.event, event.data);
  43497. }
  43498. });
  43499. this.connection.bind('connecting', function () {
  43500. _this.channels.disconnect();
  43501. });
  43502. this.connection.bind('disconnected', function () {
  43503. _this.channels.disconnect();
  43504. });
  43505. this.connection.bind('error', function (err) {
  43506. logger.warn(err);
  43507. });
  43508. Pusher.instances.push(this);
  43509. this.timeline.info({ instances: Pusher.instances.length });
  43510. if (Pusher.isReady) {
  43511. this.connect();
  43512. }
  43513. }
  43514. Pusher.ready = function () {
  43515. Pusher.isReady = true;
  43516. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  43517. Pusher.instances[i].connect();
  43518. }
  43519. };
  43520. Pusher.getClientFeatures = function () {
  43521. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  43522. return t.isSupported({});
  43523. }));
  43524. };
  43525. Pusher.prototype.channel = function (name) {
  43526. return this.channels.find(name);
  43527. };
  43528. Pusher.prototype.allChannels = function () {
  43529. return this.channels.all();
  43530. };
  43531. Pusher.prototype.connect = function () {
  43532. this.connection.connect();
  43533. if (this.timelineSender) {
  43534. if (!this.timelineSenderTimer) {
  43535. var usingTLS = this.connection.isUsingTLS();
  43536. var timelineSender = this.timelineSender;
  43537. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  43538. timelineSender.send(usingTLS);
  43539. });
  43540. }
  43541. }
  43542. };
  43543. Pusher.prototype.disconnect = function () {
  43544. this.connection.disconnect();
  43545. if (this.timelineSenderTimer) {
  43546. this.timelineSenderTimer.ensureAborted();
  43547. this.timelineSenderTimer = null;
  43548. }
  43549. };
  43550. Pusher.prototype.bind = function (event_name, callback, context) {
  43551. this.global_emitter.bind(event_name, callback, context);
  43552. return this;
  43553. };
  43554. Pusher.prototype.unbind = function (event_name, callback, context) {
  43555. this.global_emitter.unbind(event_name, callback, context);
  43556. return this;
  43557. };
  43558. Pusher.prototype.bind_global = function (callback) {
  43559. this.global_emitter.bind_global(callback);
  43560. return this;
  43561. };
  43562. Pusher.prototype.unbind_global = function (callback) {
  43563. this.global_emitter.unbind_global(callback);
  43564. return this;
  43565. };
  43566. Pusher.prototype.unbind_all = function (callback) {
  43567. this.global_emitter.unbind_all();
  43568. return this;
  43569. };
  43570. Pusher.prototype.subscribeAll = function () {
  43571. var channelName;
  43572. for (channelName in this.channels.channels) {
  43573. if (this.channels.channels.hasOwnProperty(channelName)) {
  43574. this.subscribe(channelName);
  43575. }
  43576. }
  43577. };
  43578. Pusher.prototype.subscribe = function (channel_name) {
  43579. var channel = this.channels.add(channel_name, this);
  43580. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  43581. channel.reinstateSubscription();
  43582. }
  43583. else if (!channel.subscriptionPending &&
  43584. this.connection.state === 'connected') {
  43585. channel.subscribe();
  43586. }
  43587. return channel;
  43588. };
  43589. Pusher.prototype.unsubscribe = function (channel_name) {
  43590. var channel = this.channels.find(channel_name);
  43591. if (channel && channel.subscriptionPending) {
  43592. channel.cancelSubscription();
  43593. }
  43594. else {
  43595. channel = this.channels.remove(channel_name);
  43596. if (channel && this.connection.state === 'connected') {
  43597. channel.unsubscribe();
  43598. }
  43599. }
  43600. };
  43601. Pusher.prototype.send_event = function (event_name, data, channel) {
  43602. return this.connection.send_event(event_name, data, channel);
  43603. };
  43604. Pusher.prototype.shouldUseTLS = function () {
  43605. if (runtime.getProtocol() === 'https:') {
  43606. return true;
  43607. }
  43608. else if (this.config.forceTLS === true) {
  43609. return true;
  43610. }
  43611. else {
  43612. return Boolean(this.config.encrypted);
  43613. }
  43614. };
  43615. Pusher.instances = [];
  43616. Pusher.isReady = false;
  43617. Pusher.logToConsole = false;
  43618. Pusher.Runtime = runtime;
  43619. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  43620. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  43621. Pusher.auth_callbacks = runtime.auth_callbacks;
  43622. return Pusher;
  43623. }());
  43624. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  43625. function checkAppKey(key) {
  43626. if (key === null || key === undefined) {
  43627. throw 'You must pass your app key when you instantiate Pusher.';
  43628. }
  43629. }
  43630. runtime.setup(pusher_Pusher);
  43631. /***/ })
  43632. /******/ ]);
  43633. });
  43634. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  43635. /***/ }),
  43636. /***/ "./node_modules/setimmediate/setImmediate.js":
  43637. /*!***************************************************!*\
  43638. !*** ./node_modules/setimmediate/setImmediate.js ***!
  43639. \***************************************************/
  43640. /*! no static exports found */
  43641. /***/ (function(module, exports, __webpack_require__) {
  43642. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  43643. "use strict";
  43644. if (global.setImmediate) {
  43645. return;
  43646. }
  43647. var nextHandle = 1; // Spec says greater than zero
  43648. var tasksByHandle = {};
  43649. var currentlyRunningATask = false;
  43650. var doc = global.document;
  43651. var registerImmediate;
  43652. function setImmediate(callback) {
  43653. // Callback can either be a function or a string
  43654. if (typeof callback !== "function") {
  43655. callback = new Function("" + callback);
  43656. }
  43657. // Copy function arguments
  43658. var args = new Array(arguments.length - 1);
  43659. for (var i = 0; i < args.length; i++) {
  43660. args[i] = arguments[i + 1];
  43661. }
  43662. // Store and register the task
  43663. var task = { callback: callback, args: args };
  43664. tasksByHandle[nextHandle] = task;
  43665. registerImmediate(nextHandle);
  43666. return nextHandle++;
  43667. }
  43668. function clearImmediate(handle) {
  43669. delete tasksByHandle[handle];
  43670. }
  43671. function run(task) {
  43672. var callback = task.callback;
  43673. var args = task.args;
  43674. switch (args.length) {
  43675. case 0:
  43676. callback();
  43677. break;
  43678. case 1:
  43679. callback(args[0]);
  43680. break;
  43681. case 2:
  43682. callback(args[0], args[1]);
  43683. break;
  43684. case 3:
  43685. callback(args[0], args[1], args[2]);
  43686. break;
  43687. default:
  43688. callback.apply(undefined, args);
  43689. break;
  43690. }
  43691. }
  43692. function runIfPresent(handle) {
  43693. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  43694. // So if we're currently running a task, we'll need to delay this invocation.
  43695. if (currentlyRunningATask) {
  43696. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  43697. // "too much recursion" error.
  43698. setTimeout(runIfPresent, 0, handle);
  43699. } else {
  43700. var task = tasksByHandle[handle];
  43701. if (task) {
  43702. currentlyRunningATask = true;
  43703. try {
  43704. run(task);
  43705. } finally {
  43706. clearImmediate(handle);
  43707. currentlyRunningATask = false;
  43708. }
  43709. }
  43710. }
  43711. }
  43712. function installNextTickImplementation() {
  43713. registerImmediate = function(handle) {
  43714. process.nextTick(function () { runIfPresent(handle); });
  43715. };
  43716. }
  43717. function canUsePostMessage() {
  43718. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  43719. // where `global.postMessage` means something completely different and can't be used for this purpose.
  43720. if (global.postMessage && !global.importScripts) {
  43721. var postMessageIsAsynchronous = true;
  43722. var oldOnMessage = global.onmessage;
  43723. global.onmessage = function() {
  43724. postMessageIsAsynchronous = false;
  43725. };
  43726. global.postMessage("", "*");
  43727. global.onmessage = oldOnMessage;
  43728. return postMessageIsAsynchronous;
  43729. }
  43730. }
  43731. function installPostMessageImplementation() {
  43732. // Installs an event handler on `global` for the `message` event: see
  43733. // * https://developer.mozilla.org/en/DOM/window.postMessage
  43734. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  43735. var messagePrefix = "setImmediate$" + Math.random() + "$";
  43736. var onGlobalMessage = function(event) {
  43737. if (event.source === global &&
  43738. typeof event.data === "string" &&
  43739. event.data.indexOf(messagePrefix) === 0) {
  43740. runIfPresent(+event.data.slice(messagePrefix.length));
  43741. }
  43742. };
  43743. if (global.addEventListener) {
  43744. global.addEventListener("message", onGlobalMessage, false);
  43745. } else {
  43746. global.attachEvent("onmessage", onGlobalMessage);
  43747. }
  43748. registerImmediate = function(handle) {
  43749. global.postMessage(messagePrefix + handle, "*");
  43750. };
  43751. }
  43752. function installMessageChannelImplementation() {
  43753. var channel = new MessageChannel();
  43754. channel.port1.onmessage = function(event) {
  43755. var handle = event.data;
  43756. runIfPresent(handle);
  43757. };
  43758. registerImmediate = function(handle) {
  43759. channel.port2.postMessage(handle);
  43760. };
  43761. }
  43762. function installReadyStateChangeImplementation() {
  43763. var html = doc.documentElement;
  43764. registerImmediate = function(handle) {
  43765. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  43766. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  43767. var script = doc.createElement("script");
  43768. script.onreadystatechange = function () {
  43769. runIfPresent(handle);
  43770. script.onreadystatechange = null;
  43771. html.removeChild(script);
  43772. script = null;
  43773. };
  43774. html.appendChild(script);
  43775. };
  43776. }
  43777. function installSetTimeoutImplementation() {
  43778. registerImmediate = function(handle) {
  43779. setTimeout(runIfPresent, 0, handle);
  43780. };
  43781. }
  43782. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  43783. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43784. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43785. // Don't get fooled by e.g. browserify environments.
  43786. if ({}.toString.call(global.process) === "[object process]") {
  43787. // For Node.js before 0.9
  43788. installNextTickImplementation();
  43789. } else if (canUsePostMessage()) {
  43790. // For non-IE10 modern browsers
  43791. installPostMessageImplementation();
  43792. } else if (global.MessageChannel) {
  43793. // For web workers, where supported
  43794. installMessageChannelImplementation();
  43795. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43796. // For IE 6–8
  43797. installReadyStateChangeImplementation();
  43798. } else {
  43799. // For older browsers
  43800. installSetTimeoutImplementation();
  43801. }
  43802. attachTo.setImmediate = setImmediate;
  43803. attachTo.clearImmediate = clearImmediate;
  43804. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43805. /* 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")))
  43806. /***/ }),
  43807. /***/ "./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&":
  43808. /*!***********************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43809. !*** ./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& ***!
  43810. \***********************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43811. /*! no static exports found */
  43812. /***/ (function(module, exports, __webpack_require__) {
  43813. 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&");
  43814. if(typeof content === 'string') content = [[module.i, content, '']];
  43815. var transform;
  43816. var insertInto;
  43817. var options = {"hmr":true}
  43818. options.transform = transform
  43819. options.insertInto = undefined;
  43820. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43821. if(content.locals) module.exports = content.locals;
  43822. if(false) {}
  43823. /***/ }),
  43824. /***/ "./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&":
  43825. /*!************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  43826. !*** ./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& ***!
  43827. \************************************************************************************************************************************************************************************************************************************************************************************************************************/
  43828. /*! no static exports found */
  43829. /***/ (function(module, exports, __webpack_require__) {
  43830. 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&");
  43831. if(typeof content === 'string') content = [[module.i, content, '']];
  43832. var transform;
  43833. var insertInto;
  43834. var options = {"hmr":true}
  43835. options.transform = transform
  43836. options.insertInto = undefined;
  43837. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  43838. if(content.locals) module.exports = content.locals;
  43839. if(false) {}
  43840. /***/ }),
  43841. /***/ "./node_modules/style-loader/lib/addStyles.js":
  43842. /*!****************************************************!*\
  43843. !*** ./node_modules/style-loader/lib/addStyles.js ***!
  43844. \****************************************************/
  43845. /*! no static exports found */
  43846. /***/ (function(module, exports, __webpack_require__) {
  43847. /*
  43848. MIT License http://www.opensource.org/licenses/mit-license.php
  43849. Author Tobias Koppers @sokra
  43850. */
  43851. var stylesInDom = {};
  43852. var memoize = function (fn) {
  43853. var memo;
  43854. return function () {
  43855. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  43856. return memo;
  43857. };
  43858. };
  43859. var isOldIE = memoize(function () {
  43860. // Test for IE <= 9 as proposed by Browserhacks
  43861. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  43862. // Tests for existence of standard globals is to allow style-loader
  43863. // to operate correctly into non-standard environments
  43864. // @see https://github.com/webpack-contrib/style-loader/issues/177
  43865. return window && document && document.all && !window.atob;
  43866. });
  43867. var getTarget = function (target, parent) {
  43868. if (parent){
  43869. return parent.querySelector(target);
  43870. }
  43871. return document.querySelector(target);
  43872. };
  43873. var getElement = (function (fn) {
  43874. var memo = {};
  43875. return function(target, parent) {
  43876. // If passing function in options, then use it for resolve "head" element.
  43877. // Useful for Shadow Root style i.e
  43878. // {
  43879. // insertInto: function () { return document.querySelector("#foo").shadowRoot }
  43880. // }
  43881. if (typeof target === 'function') {
  43882. return target();
  43883. }
  43884. if (typeof memo[target] === "undefined") {
  43885. var styleTarget = getTarget.call(this, target, parent);
  43886. // Special case to return head of iframe instead of iframe itself
  43887. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  43888. try {
  43889. // This will throw an exception if access to iframe is blocked
  43890. // due to cross-origin restrictions
  43891. styleTarget = styleTarget.contentDocument.head;
  43892. } catch(e) {
  43893. styleTarget = null;
  43894. }
  43895. }
  43896. memo[target] = styleTarget;
  43897. }
  43898. return memo[target]
  43899. };
  43900. })();
  43901. var singleton = null;
  43902. var singletonCounter = 0;
  43903. var stylesInsertedAtTop = [];
  43904. var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js");
  43905. module.exports = function(list, options) {
  43906. if (typeof DEBUG !== "undefined" && DEBUG) {
  43907. if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  43908. }
  43909. options = options || {};
  43910. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  43911. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  43912. // tags it will allow on a page
  43913. if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
  43914. // By default, add <style> tags to the <head> element
  43915. if (!options.insertInto) options.insertInto = "head";
  43916. // By default, add <style> tags to the bottom of the target
  43917. if (!options.insertAt) options.insertAt = "bottom";
  43918. var styles = listToStyles(list, options);
  43919. addStylesToDom(styles, options);
  43920. return function update (newList) {
  43921. var mayRemove = [];
  43922. for (var i = 0; i < styles.length; i++) {
  43923. var item = styles[i];
  43924. var domStyle = stylesInDom[item.id];
  43925. domStyle.refs--;
  43926. mayRemove.push(domStyle);
  43927. }
  43928. if(newList) {
  43929. var newStyles = listToStyles(newList, options);
  43930. addStylesToDom(newStyles, options);
  43931. }
  43932. for (var i = 0; i < mayRemove.length; i++) {
  43933. var domStyle = mayRemove[i];
  43934. if(domStyle.refs === 0) {
  43935. for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
  43936. delete stylesInDom[domStyle.id];
  43937. }
  43938. }
  43939. };
  43940. };
  43941. function addStylesToDom (styles, options) {
  43942. for (var i = 0; i < styles.length; i++) {
  43943. var item = styles[i];
  43944. var domStyle = stylesInDom[item.id];
  43945. if(domStyle) {
  43946. domStyle.refs++;
  43947. for(var j = 0; j < domStyle.parts.length; j++) {
  43948. domStyle.parts[j](item.parts[j]);
  43949. }
  43950. for(; j < item.parts.length; j++) {
  43951. domStyle.parts.push(addStyle(item.parts[j], options));
  43952. }
  43953. } else {
  43954. var parts = [];
  43955. for(var j = 0; j < item.parts.length; j++) {
  43956. parts.push(addStyle(item.parts[j], options));
  43957. }
  43958. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  43959. }
  43960. }
  43961. }
  43962. function listToStyles (list, options) {
  43963. var styles = [];
  43964. var newStyles = {};
  43965. for (var i = 0; i < list.length; i++) {
  43966. var item = list[i];
  43967. var id = options.base ? item[0] + options.base : item[0];
  43968. var css = item[1];
  43969. var media = item[2];
  43970. var sourceMap = item[3];
  43971. var part = {css: css, media: media, sourceMap: sourceMap};
  43972. if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
  43973. else newStyles[id].parts.push(part);
  43974. }
  43975. return styles;
  43976. }
  43977. function insertStyleElement (options, style) {
  43978. var target = getElement(options.insertInto)
  43979. if (!target) {
  43980. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  43981. }
  43982. var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
  43983. if (options.insertAt === "top") {
  43984. if (!lastStyleElementInsertedAtTop) {
  43985. target.insertBefore(style, target.firstChild);
  43986. } else if (lastStyleElementInsertedAtTop.nextSibling) {
  43987. target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
  43988. } else {
  43989. target.appendChild(style);
  43990. }
  43991. stylesInsertedAtTop.push(style);
  43992. } else if (options.insertAt === "bottom") {
  43993. target.appendChild(style);
  43994. } else if (typeof options.insertAt === "object" && options.insertAt.before) {
  43995. var nextSibling = getElement(options.insertAt.before, target);
  43996. target.insertBefore(style, nextSibling);
  43997. } else {
  43998. 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");
  43999. }
  44000. }
  44001. function removeStyleElement (style) {
  44002. if (style.parentNode === null) return false;
  44003. style.parentNode.removeChild(style);
  44004. var idx = stylesInsertedAtTop.indexOf(style);
  44005. if(idx >= 0) {
  44006. stylesInsertedAtTop.splice(idx, 1);
  44007. }
  44008. }
  44009. function createStyleElement (options) {
  44010. var style = document.createElement("style");
  44011. if(options.attrs.type === undefined) {
  44012. options.attrs.type = "text/css";
  44013. }
  44014. if(options.attrs.nonce === undefined) {
  44015. var nonce = getNonce();
  44016. if (nonce) {
  44017. options.attrs.nonce = nonce;
  44018. }
  44019. }
  44020. addAttrs(style, options.attrs);
  44021. insertStyleElement(options, style);
  44022. return style;
  44023. }
  44024. function createLinkElement (options) {
  44025. var link = document.createElement("link");
  44026. if(options.attrs.type === undefined) {
  44027. options.attrs.type = "text/css";
  44028. }
  44029. options.attrs.rel = "stylesheet";
  44030. addAttrs(link, options.attrs);
  44031. insertStyleElement(options, link);
  44032. return link;
  44033. }
  44034. function addAttrs (el, attrs) {
  44035. Object.keys(attrs).forEach(function (key) {
  44036. el.setAttribute(key, attrs[key]);
  44037. });
  44038. }
  44039. function getNonce() {
  44040. if (false) {}
  44041. return __webpack_require__.nc;
  44042. }
  44043. function addStyle (obj, options) {
  44044. var style, update, remove, result;
  44045. // If a transform function was defined, run it on the css
  44046. if (options.transform && obj.css) {
  44047. result = typeof options.transform === 'function'
  44048. ? options.transform(obj.css)
  44049. : options.transform.default(obj.css);
  44050. if (result) {
  44051. // If transform returns a value, use that instead of the original css.
  44052. // This allows running runtime transformations on the css.
  44053. obj.css = result;
  44054. } else {
  44055. // If the transform function returns a falsy value, don't add this css.
  44056. // This allows conditional loading of css
  44057. return function() {
  44058. // noop
  44059. };
  44060. }
  44061. }
  44062. if (options.singleton) {
  44063. var styleIndex = singletonCounter++;
  44064. style = singleton || (singleton = createStyleElement(options));
  44065. update = applyToSingletonTag.bind(null, style, styleIndex, false);
  44066. remove = applyToSingletonTag.bind(null, style, styleIndex, true);
  44067. } else if (
  44068. obj.sourceMap &&
  44069. typeof URL === "function" &&
  44070. typeof URL.createObjectURL === "function" &&
  44071. typeof URL.revokeObjectURL === "function" &&
  44072. typeof Blob === "function" &&
  44073. typeof btoa === "function"
  44074. ) {
  44075. style = createLinkElement(options);
  44076. update = updateLink.bind(null, style, options);
  44077. remove = function () {
  44078. removeStyleElement(style);
  44079. if(style.href) URL.revokeObjectURL(style.href);
  44080. };
  44081. } else {
  44082. style = createStyleElement(options);
  44083. update = applyToTag.bind(null, style);
  44084. remove = function () {
  44085. removeStyleElement(style);
  44086. };
  44087. }
  44088. update(obj);
  44089. return function updateStyle (newObj) {
  44090. if (newObj) {
  44091. if (
  44092. newObj.css === obj.css &&
  44093. newObj.media === obj.media &&
  44094. newObj.sourceMap === obj.sourceMap
  44095. ) {
  44096. return;
  44097. }
  44098. update(obj = newObj);
  44099. } else {
  44100. remove();
  44101. }
  44102. };
  44103. }
  44104. var replaceText = (function () {
  44105. var textStore = [];
  44106. return function (index, replacement) {
  44107. textStore[index] = replacement;
  44108. return textStore.filter(Boolean).join('\n');
  44109. };
  44110. })();
  44111. function applyToSingletonTag (style, index, remove, obj) {
  44112. var css = remove ? "" : obj.css;
  44113. if (style.styleSheet) {
  44114. style.styleSheet.cssText = replaceText(index, css);
  44115. } else {
  44116. var cssNode = document.createTextNode(css);
  44117. var childNodes = style.childNodes;
  44118. if (childNodes[index]) style.removeChild(childNodes[index]);
  44119. if (childNodes.length) {
  44120. style.insertBefore(cssNode, childNodes[index]);
  44121. } else {
  44122. style.appendChild(cssNode);
  44123. }
  44124. }
  44125. }
  44126. function applyToTag (style, obj) {
  44127. var css = obj.css;
  44128. var media = obj.media;
  44129. if(media) {
  44130. style.setAttribute("media", media)
  44131. }
  44132. if(style.styleSheet) {
  44133. style.styleSheet.cssText = css;
  44134. } else {
  44135. while(style.firstChild) {
  44136. style.removeChild(style.firstChild);
  44137. }
  44138. style.appendChild(document.createTextNode(css));
  44139. }
  44140. }
  44141. function updateLink (link, options, obj) {
  44142. var css = obj.css;
  44143. var sourceMap = obj.sourceMap;
  44144. /*
  44145. If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  44146. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  44147. on by default. Otherwise default to the convertToAbsoluteUrls option
  44148. directly
  44149. */
  44150. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  44151. if (options.convertToAbsoluteUrls || autoFixUrls) {
  44152. css = fixUrls(css);
  44153. }
  44154. if (sourceMap) {
  44155. // http://stackoverflow.com/a/26603875
  44156. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  44157. }
  44158. var blob = new Blob([css], { type: "text/css" });
  44159. var oldSrc = link.href;
  44160. link.href = URL.createObjectURL(blob);
  44161. if(oldSrc) URL.revokeObjectURL(oldSrc);
  44162. }
  44163. /***/ }),
  44164. /***/ "./node_modules/style-loader/lib/urls.js":
  44165. /*!***********************************************!*\
  44166. !*** ./node_modules/style-loader/lib/urls.js ***!
  44167. \***********************************************/
  44168. /*! no static exports found */
  44169. /***/ (function(module, exports) {
  44170. /**
  44171. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  44172. * embed the css on the page. This breaks all relative urls because now they are relative to a
  44173. * bundle instead of the current page.
  44174. *
  44175. * One solution is to only use full urls, but that may be impossible.
  44176. *
  44177. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  44178. *
  44179. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  44180. *
  44181. */
  44182. module.exports = function (css) {
  44183. // get current location
  44184. var location = typeof window !== "undefined" && window.location;
  44185. if (!location) {
  44186. throw new Error("fixUrls requires window.location");
  44187. }
  44188. // blank or null?
  44189. if (!css || typeof css !== "string") {
  44190. return css;
  44191. }
  44192. var baseUrl = location.protocol + "//" + location.host;
  44193. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  44194. // convert each url(...)
  44195. /*
  44196. This regular expression is just a way to recursively match brackets within
  44197. a string.
  44198. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  44199. ( = Start a capturing group
  44200. (?: = Start a non-capturing group
  44201. [^)(] = Match anything that isn't a parentheses
  44202. | = OR
  44203. \( = Match a start parentheses
  44204. (?: = Start another non-capturing groups
  44205. [^)(]+ = Match anything that isn't a parentheses
  44206. | = OR
  44207. \( = Match a start parentheses
  44208. [^)(]* = Match anything that isn't a parentheses
  44209. \) = Match a end parentheses
  44210. ) = End Group
  44211. *\) = Match anything and then a close parens
  44212. ) = Close non-capturing group
  44213. * = Match anything
  44214. ) = Close capturing group
  44215. \) = Match a close parens
  44216. /gi = Get all matches, not the first. Be case insensitive.
  44217. */
  44218. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  44219. // strip quotes (if they exist)
  44220. var unquotedOrigUrl = origUrl
  44221. .trim()
  44222. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  44223. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  44224. // already a full url? no change
  44225. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
  44226. return fullMatch;
  44227. }
  44228. // convert the url to a full url
  44229. var newUrl;
  44230. if (unquotedOrigUrl.indexOf("//") === 0) {
  44231. //TODO: should we add protocol?
  44232. newUrl = unquotedOrigUrl;
  44233. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  44234. // path should be relative to the base url
  44235. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  44236. } else {
  44237. // path should be relative to current directory
  44238. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  44239. }
  44240. // send back the fixed url(...)
  44241. return "url(" + JSON.stringify(newUrl) + ")";
  44242. });
  44243. // send back the fixed css
  44244. return fixedCss;
  44245. };
  44246. /***/ }),
  44247. /***/ "./node_modules/timers-browserify/main.js":
  44248. /*!************************************************!*\
  44249. !*** ./node_modules/timers-browserify/main.js ***!
  44250. \************************************************/
  44251. /*! no static exports found */
  44252. /***/ (function(module, exports, __webpack_require__) {
  44253. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  44254. (typeof self !== "undefined" && self) ||
  44255. window;
  44256. var apply = Function.prototype.apply;
  44257. // DOM APIs, for completeness
  44258. exports.setTimeout = function() {
  44259. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  44260. };
  44261. exports.setInterval = function() {
  44262. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  44263. };
  44264. exports.clearTimeout =
  44265. exports.clearInterval = function(timeout) {
  44266. if (timeout) {
  44267. timeout.close();
  44268. }
  44269. };
  44270. function Timeout(id, clearFn) {
  44271. this._id = id;
  44272. this._clearFn = clearFn;
  44273. }
  44274. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  44275. Timeout.prototype.close = function() {
  44276. this._clearFn.call(scope, this._id);
  44277. };
  44278. // Does not start the time, just sets up the members needed.
  44279. exports.enroll = function(item, msecs) {
  44280. clearTimeout(item._idleTimeoutId);
  44281. item._idleTimeout = msecs;
  44282. };
  44283. exports.unenroll = function(item) {
  44284. clearTimeout(item._idleTimeoutId);
  44285. item._idleTimeout = -1;
  44286. };
  44287. exports._unrefActive = exports.active = function(item) {
  44288. clearTimeout(item._idleTimeoutId);
  44289. var msecs = item._idleTimeout;
  44290. if (msecs >= 0) {
  44291. item._idleTimeoutId = setTimeout(function onTimeout() {
  44292. if (item._onTimeout)
  44293. item._onTimeout();
  44294. }, msecs);
  44295. }
  44296. };
  44297. // setimmediate attaches itself to the global object
  44298. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  44299. // On some exotic environments, it's not clear which object `setimmediate` was
  44300. // able to install onto. Search each possibility in the same order as the
  44301. // `setimmediate` library.
  44302. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  44303. (typeof global !== "undefined" && global.setImmediate) ||
  44304. (this && this.setImmediate);
  44305. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  44306. (typeof global !== "undefined" && global.clearImmediate) ||
  44307. (this && this.clearImmediate);
  44308. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  44309. /***/ }),
  44310. /***/ "./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&":
  44311. /*!************************************************************************************************************************************************************************************************************!*\
  44312. !*** ./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& ***!
  44313. \************************************************************************************************************************************************************************************************************/
  44314. /*! exports provided: render, staticRenderFns */
  44315. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44316. "use strict";
  44317. __webpack_require__.r(__webpack_exports__);
  44318. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44319. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44320. var render = function() {
  44321. var _vm = this
  44322. var _h = _vm.$createElement
  44323. var _c = _vm._self._c || _h
  44324. return _c(
  44325. "div",
  44326. [
  44327. _c("asset-info-edit-modal", {
  44328. attrs: {
  44329. "modal-id": "asset" + _vm.asset.pcid + "editModal",
  44330. "populate-with": _vm.asset
  44331. }
  44332. }),
  44333. _vm._v(" "),
  44334. _c("h4", { staticClass: "text-center" }, [
  44335. _vm._v(
  44336. _vm._s(this.asset.pcmanu) + " " + _vm._s(this.asset.pcmake) + " - "
  44337. ),
  44338. _c("small", { staticClass: "text-muted" }, [
  44339. _vm._v(_vm._s(this.asset.pcnickname))
  44340. ])
  44341. ]),
  44342. _vm._v(" "),
  44343. _c("p", [_vm._v("OS: " + _vm._s(this.asset.pcextra[2]))]),
  44344. _vm._v(" "),
  44345. _c("p", [_vm._v("S/N: " + _vm._s(this.asset.pcextra[104]))]),
  44346. _vm._v(" "),
  44347. _c("p", [_vm._v("CPU: " + _vm._s(this.asset.pcextra[101]))]),
  44348. _vm._v(" "),
  44349. _c("p", [_vm._v("RAM: " + _vm._s(this.asset.pcextra[100]))]),
  44350. _vm._v(" "),
  44351. _c("p", [_vm._v("Graphics: " + _vm._s(this.asset.pcextra[4]))]),
  44352. _vm._v(" "),
  44353. _c(
  44354. "button",
  44355. {
  44356. staticClass: "btn btn-primary",
  44357. attrs: {
  44358. type: "button",
  44359. "data-toggle": "modal",
  44360. "data-target": "#asset" + _vm.asset.pcid + "editModal"
  44361. }
  44362. },
  44363. [_vm._v("Edit")]
  44364. )
  44365. ],
  44366. 1
  44367. )
  44368. }
  44369. var staticRenderFns = []
  44370. render._withStripped = true
  44371. /***/ }),
  44372. /***/ "./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&":
  44373. /*!*********************************************************************************************************************************************************************************************************************!*\
  44374. !*** ./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& ***!
  44375. \*********************************************************************************************************************************************************************************************************************/
  44376. /*! exports provided: render, staticRenderFns */
  44377. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44378. "use strict";
  44379. __webpack_require__.r(__webpack_exports__);
  44380. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44381. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44382. var render = function() {
  44383. var _vm = this
  44384. var _h = _vm.$createElement
  44385. var _c = _vm._self._c || _h
  44386. return _c(
  44387. "modal",
  44388. {
  44389. attrs: {
  44390. id: _vm.modalId,
  44391. tabindex: "-1",
  44392. role: "dialog",
  44393. "aria-labelledby": _vm.modalId + "Label"
  44394. }
  44395. },
  44396. [
  44397. _c(
  44398. "h5",
  44399. {
  44400. staticClass: "modal-title",
  44401. attrs: { slot: "header", id: _vm.modalId + "Label" },
  44402. slot: "header"
  44403. },
  44404. [_vm._v("\n Edit Work Order Information\n ")]
  44405. ),
  44406. _vm._v(" "),
  44407. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44408. _c("div", { staticClass: "form-group" }, [
  44409. _c("label", { attrs: { for: "manufacturer" } }, [
  44410. _vm._v("Manufacturer")
  44411. ]),
  44412. _vm._v(" "),
  44413. _c("input", {
  44414. directives: [
  44415. {
  44416. name: "model",
  44417. rawName: "v-model",
  44418. value: _vm.asset.pcmanu,
  44419. expression: "asset.pcmanu"
  44420. }
  44421. ],
  44422. staticClass: "form-control",
  44423. attrs: { type: "text", name: "manufacturer", id: "manufacturer" },
  44424. domProps: { value: _vm.asset.pcmanu },
  44425. on: {
  44426. input: function($event) {
  44427. if ($event.target.composing) {
  44428. return
  44429. }
  44430. _vm.$set(_vm.asset, "pcmanu", $event.target.value)
  44431. }
  44432. }
  44433. })
  44434. ]),
  44435. _vm._v(" "),
  44436. _c("div", { staticClass: "form-group" }, [
  44437. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  44438. _vm._v(" "),
  44439. _c("input", {
  44440. directives: [
  44441. {
  44442. name: "model",
  44443. rawName: "v-model",
  44444. value: _vm.asset.pcmake,
  44445. expression: "asset.pcmake"
  44446. }
  44447. ],
  44448. staticClass: "form-control",
  44449. attrs: { type: "text", name: "make", id: "make" },
  44450. domProps: { value: _vm.asset.pcmake },
  44451. on: {
  44452. input: function($event) {
  44453. if ($event.target.composing) {
  44454. return
  44455. }
  44456. _vm.$set(_vm.asset, "pcmake", $event.target.value)
  44457. }
  44458. }
  44459. })
  44460. ]),
  44461. _vm._v(" "),
  44462. _c("div", { staticClass: "form-group" }, [
  44463. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  44464. _vm._v(" "),
  44465. _c("input", {
  44466. directives: [
  44467. {
  44468. name: "model",
  44469. rawName: "v-model",
  44470. value: _vm.asset.pcnickname,
  44471. expression: "asset.pcnickname"
  44472. }
  44473. ],
  44474. staticClass: "form-control",
  44475. attrs: { type: "text", name: "nickname", id: "nickname" },
  44476. domProps: { value: _vm.asset.pcnickname },
  44477. on: {
  44478. input: function($event) {
  44479. if ($event.target.composing) {
  44480. return
  44481. }
  44482. _vm.$set(_vm.asset, "pcnickname", $event.target.value)
  44483. }
  44484. }
  44485. })
  44486. ]),
  44487. _vm._v(" "),
  44488. _c("div", { staticClass: "form-group" }, [
  44489. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  44490. _vm._v(" "),
  44491. _c("input", {
  44492. directives: [
  44493. {
  44494. name: "model",
  44495. rawName: "v-model",
  44496. value: _vm.asset.pcextra[2],
  44497. expression: "asset.pcextra[2]"
  44498. }
  44499. ],
  44500. staticClass: "form-control",
  44501. attrs: { type: "text", name: "os", id: "os" },
  44502. domProps: { value: _vm.asset.pcextra[2] },
  44503. on: {
  44504. input: function($event) {
  44505. if ($event.target.composing) {
  44506. return
  44507. }
  44508. _vm.$set(_vm.asset.pcextra, 2, $event.target.value)
  44509. }
  44510. }
  44511. })
  44512. ]),
  44513. _vm._v(" "),
  44514. _c("div", { staticClass: "form-group" }, [
  44515. _c("label", { attrs: { for: "serial" } }, [_vm._v("Serial Number")]),
  44516. _vm._v(" "),
  44517. _c("input", {
  44518. directives: [
  44519. {
  44520. name: "model",
  44521. rawName: "v-model",
  44522. value: _vm.asset.pcextra[104],
  44523. expression: "asset.pcextra[104]"
  44524. }
  44525. ],
  44526. staticClass: "form-control",
  44527. attrs: { type: "text", id: "serial", name: "serial" },
  44528. domProps: { value: _vm.asset.pcextra[104] },
  44529. on: {
  44530. input: function($event) {
  44531. if ($event.target.composing) {
  44532. return
  44533. }
  44534. _vm.$set(_vm.asset.pcextra, 104, $event.target.value)
  44535. }
  44536. }
  44537. })
  44538. ]),
  44539. _vm._v(" "),
  44540. _c("div", { staticClass: "form-group" }, [
  44541. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  44542. _vm._v(" "),
  44543. _c("input", {
  44544. directives: [
  44545. {
  44546. name: "model",
  44547. rawName: "v-model",
  44548. value: _vm.asset.pcextra[101],
  44549. expression: "asset.pcextra[101]"
  44550. }
  44551. ],
  44552. staticClass: "form-control",
  44553. attrs: { type: "text", id: "cpu", name: "cpu" },
  44554. domProps: { value: _vm.asset.pcextra[101] },
  44555. on: {
  44556. input: function($event) {
  44557. if ($event.target.composing) {
  44558. return
  44559. }
  44560. _vm.$set(_vm.asset.pcextra, 101, $event.target.value)
  44561. }
  44562. }
  44563. })
  44564. ]),
  44565. _vm._v(" "),
  44566. _c("div", { staticClass: "form-group" }, [
  44567. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  44568. _vm._v(" "),
  44569. _c("input", {
  44570. directives: [
  44571. {
  44572. name: "model",
  44573. rawName: "v-model",
  44574. value: _vm.asset.pcextra[100],
  44575. expression: "asset.pcextra[100]"
  44576. }
  44577. ],
  44578. staticClass: "form-control",
  44579. attrs: { type: "text", name: "ram", id: "ram" },
  44580. domProps: { value: _vm.asset.pcextra[100] },
  44581. on: {
  44582. input: function($event) {
  44583. if ($event.target.composing) {
  44584. return
  44585. }
  44586. _vm.$set(_vm.asset.pcextra, 100, $event.target.value)
  44587. }
  44588. }
  44589. })
  44590. ]),
  44591. _vm._v(" "),
  44592. _c("div", { staticClass: "form-group" }, [
  44593. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  44594. _vm._v(" "),
  44595. _c("input", {
  44596. directives: [
  44597. {
  44598. name: "model",
  44599. rawName: "v-model",
  44600. value: _vm.asset.pcextra[4],
  44601. expression: "asset.pcextra[4]"
  44602. }
  44603. ],
  44604. staticClass: "form-control",
  44605. attrs: { type: "text", name: "graphics", id: "grapics" },
  44606. domProps: { value: _vm.asset.pcextra[4] },
  44607. on: {
  44608. input: function($event) {
  44609. if ($event.target.composing) {
  44610. return
  44611. }
  44612. _vm.$set(_vm.asset.pcextra, 4, $event.target.value)
  44613. }
  44614. }
  44615. })
  44616. ])
  44617. ]),
  44618. _vm._v(" "),
  44619. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44620. _c(
  44621. "button",
  44622. {
  44623. staticClass: "btn btn-secondary",
  44624. attrs: { type: "button", "data-dismiss": "modal" }
  44625. },
  44626. [_vm._v("Close")]
  44627. ),
  44628. _vm._v(" "),
  44629. _c(
  44630. "button",
  44631. {
  44632. staticClass: "btn btn-primary",
  44633. attrs: { type: "button" },
  44634. on: {
  44635. click: function($event) {
  44636. return _vm.updateAsset()
  44637. }
  44638. }
  44639. },
  44640. [
  44641. !_vm.assetSaving
  44642. ? _c("div", [_vm._v("Save")])
  44643. : _c("circle-spinner", { attrs: { size: 2 } })
  44644. ],
  44645. 1
  44646. )
  44647. ])
  44648. ]
  44649. )
  44650. }
  44651. var staticRenderFns = []
  44652. render._withStripped = true
  44653. /***/ }),
  44654. /***/ "./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&":
  44655. /*!*****************************************************************************************************************************************************************************************************************************!*\
  44656. !*** ./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& ***!
  44657. \*****************************************************************************************************************************************************************************************************************************/
  44658. /*! exports provided: render, staticRenderFns */
  44659. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44660. "use strict";
  44661. __webpack_require__.r(__webpack_exports__);
  44662. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44663. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44664. var render = function() {
  44665. var _vm = this
  44666. var _h = _vm.$createElement
  44667. var _c = _vm._self._c || _h
  44668. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  44669. _c("div", { staticClass: "input-group" }, [
  44670. _c("input", {
  44671. directives: [
  44672. {
  44673. name: "model",
  44674. rawName: "v-model",
  44675. value: _vm.searchText,
  44676. expression: "searchText"
  44677. }
  44678. ],
  44679. staticClass: "form-control",
  44680. attrs: { type: "text" },
  44681. domProps: { value: _vm.searchText },
  44682. on: {
  44683. input: [
  44684. function($event) {
  44685. if ($event.target.composing) {
  44686. return
  44687. }
  44688. _vm.searchText = $event.target.value
  44689. },
  44690. _vm.searchChanged
  44691. ]
  44692. }
  44693. }),
  44694. _vm._v(" "),
  44695. _c("div", { staticClass: "form-group-append" }, [
  44696. _c(
  44697. "a",
  44698. {
  44699. staticClass: "toggle input-group-text bg-primary text-light",
  44700. on: {
  44701. mousedown: function($event) {
  44702. $event.preventDefault()
  44703. },
  44704. click: function($event) {
  44705. return _vm.setOpen(!_vm.open)
  44706. }
  44707. }
  44708. },
  44709. [
  44710. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  44711. _vm._v(" "),
  44712. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  44713. ]
  44714. )
  44715. ])
  44716. ]),
  44717. _vm._v(" "),
  44718. _c(
  44719. "ul",
  44720. { staticClass: "suggestion-list list-unstyled" },
  44721. _vm._l(_vm.matches, function(suggestion, index) {
  44722. return _c(
  44723. "li",
  44724. {
  44725. key: index,
  44726. on: {
  44727. mousedown: function($event) {
  44728. $event.preventDefault()
  44729. },
  44730. click: function($event) {
  44731. return _vm.suggestionSelected(suggestion)
  44732. }
  44733. }
  44734. },
  44735. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  44736. )
  44737. }),
  44738. 0
  44739. )
  44740. ])
  44741. }
  44742. var staticRenderFns = []
  44743. render._withStripped = true
  44744. /***/ }),
  44745. /***/ "./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&":
  44746. /*!****************************************************************************************************************************************************************************************************************************!*\
  44747. !*** ./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& ***!
  44748. \****************************************************************************************************************************************************************************************************************************/
  44749. /*! exports provided: render, staticRenderFns */
  44750. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44751. "use strict";
  44752. __webpack_require__.r(__webpack_exports__);
  44753. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44754. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44755. var render = function() {
  44756. var _vm = this
  44757. var _h = _vm.$createElement
  44758. var _c = _vm._self._c || _h
  44759. return _c(
  44760. "div",
  44761. {
  44762. staticClass: "loader",
  44763. style: {
  44764. fontSize: _vm.size + "px",
  44765. borderLeft: "1.1em solid " + _vm.color
  44766. }
  44767. },
  44768. [_vm._v("Loading...")]
  44769. )
  44770. }
  44771. var staticRenderFns = []
  44772. render._withStripped = true
  44773. /***/ }),
  44774. /***/ "./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&":
  44775. /*!*************************************************************************************************************************************************************************************************************!*\
  44776. !*** ./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& ***!
  44777. \*************************************************************************************************************************************************************************************************************/
  44778. /*! exports provided: render, staticRenderFns */
  44779. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44780. "use strict";
  44781. __webpack_require__.r(__webpack_exports__);
  44782. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44783. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44784. var render = function() {
  44785. var _vm = this
  44786. var _h = _vm.$createElement
  44787. var _c = _vm._self._c || _h
  44788. return _c(
  44789. "div",
  44790. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  44791. [
  44792. _c("credential-form-modal", {
  44793. attrs: {
  44794. descriptions: _vm.creddescList,
  44795. "modal-id": "credential" + this.data.credid + "editModal",
  44796. populateWith: this.data
  44797. }
  44798. }),
  44799. _vm._v(" "),
  44800. _c(
  44801. "modal",
  44802. {
  44803. attrs: {
  44804. id: "credential" + this.data.credid + "deleteModal",
  44805. tabindex: "-1"
  44806. }
  44807. },
  44808. [
  44809. _c(
  44810. "h5",
  44811. {
  44812. staticClass: "modal-title",
  44813. attrs: {
  44814. slot: "header",
  44815. id: "credential" + this.data.credid + "deleteModalLabel"
  44816. },
  44817. slot: "header"
  44818. },
  44819. [_vm._v("\r\n Delete Credential\r\n ")]
  44820. ),
  44821. _vm._v(" "),
  44822. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44823. _vm._v("\r\n Are you sure?\r\n ")
  44824. ]),
  44825. _vm._v(" "),
  44826. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44827. _c(
  44828. "button",
  44829. {
  44830. staticClass: "btn btn-secondary",
  44831. attrs: { type: "button", "data-dismiss": "modal" }
  44832. },
  44833. [_vm._v("Cancel")]
  44834. ),
  44835. _vm._v(" "),
  44836. _c(
  44837. "button",
  44838. {
  44839. staticClass: "btn btn-danger",
  44840. attrs: { type: "button" },
  44841. on: {
  44842. click: function($event) {
  44843. return _vm.deleteCredential()
  44844. }
  44845. }
  44846. },
  44847. [_vm._v("Confirm")]
  44848. )
  44849. ])
  44850. ]
  44851. ),
  44852. _vm._v(" "),
  44853. _c("div", { staticClass: "row no-gutters" }, [
  44854. _c("div", { staticClass: "h5 col-3 text-left" }, [
  44855. _vm._v(_vm._s(this.data.creddesc))
  44856. ]),
  44857. _vm._v(" "),
  44858. _c("div", { staticClass: "col-9 text-right" }, [
  44859. _vm._v(_vm._s(this.data.creddate))
  44860. ])
  44861. ]),
  44862. _vm._v(" "),
  44863. _c("div", { staticClass: "row" }, [
  44864. _c("div", { staticClass: "col-lg-9" }, [
  44865. _c("div", [
  44866. _vm._m(0),
  44867. _vm._v(" "),
  44868. _c("input", {
  44869. staticClass: "border-0 credential",
  44870. attrs: {
  44871. type: "text",
  44872. id: "username" + this.data.credid,
  44873. readonly: ""
  44874. },
  44875. domProps: { value: this.data.creduser }
  44876. }),
  44877. _vm._v(" "),
  44878. _c(
  44879. "button",
  44880. {
  44881. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  44882. attrs: {
  44883. id: "btn-username" + this.data.credid,
  44884. "data-clipboard-target": "#username" + this.data.credid
  44885. }
  44886. },
  44887. [_c("i", { staticClass: "far fa-clone" })]
  44888. )
  44889. ]),
  44890. _vm._v(" "),
  44891. _c("div", [
  44892. _vm._m(1),
  44893. _vm._v(" "),
  44894. _c("input", {
  44895. staticClass: "border-0 credential",
  44896. attrs: {
  44897. type: "text",
  44898. id: "password" + this.data.credid,
  44899. readonly: ""
  44900. },
  44901. domProps: { value: this.data.credpass }
  44902. }),
  44903. _vm._v(" "),
  44904. _c(
  44905. "button",
  44906. {
  44907. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  44908. attrs: {
  44909. id: "btn-password" + this.data.credid,
  44910. "data-clipboard-target": "#password" + this.data.credid
  44911. }
  44912. },
  44913. [_c("i", { staticClass: "far fa-clone" })]
  44914. )
  44915. ])
  44916. ]),
  44917. _vm._v(" "),
  44918. _c(
  44919. "div",
  44920. {
  44921. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  44922. attrs: { role: "group", "aria-label": "Edit and Delete" }
  44923. },
  44924. [
  44925. _c(
  44926. "button",
  44927. {
  44928. staticClass: "btn btn-sm btn-secondary p-lg-1",
  44929. attrs: {
  44930. type: "button",
  44931. "data-toggle": "modal",
  44932. "data-target": "#credential" + this.data.credid + "editModal"
  44933. }
  44934. },
  44935. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44936. ),
  44937. _vm._v(" "),
  44938. _c(
  44939. "button",
  44940. {
  44941. staticClass: "btn btn-sm btn-danger p-lg-1",
  44942. attrs: {
  44943. type: "button",
  44944. "data-toggle": "modal",
  44945. "data-target":
  44946. "#credential" + this.data.credid + "deleteModal"
  44947. }
  44948. },
  44949. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  44950. )
  44951. ]
  44952. )
  44953. ])
  44954. ],
  44955. 1
  44956. )
  44957. }
  44958. var staticRenderFns = [
  44959. function() {
  44960. var _vm = this
  44961. var _h = _vm.$createElement
  44962. var _c = _vm._self._c || _h
  44963. return _c("label", { attrs: { for: "username" } }, [
  44964. _c("i", { staticClass: "fas fa-fw fa-user" })
  44965. ])
  44966. },
  44967. function() {
  44968. var _vm = this
  44969. var _h = _vm.$createElement
  44970. var _c = _vm._self._c || _h
  44971. return _c("label", { attrs: { for: "password" } }, [
  44972. _c("i", { staticClass: "fas fa-fw fa-key" })
  44973. ])
  44974. }
  44975. ]
  44976. render._withStripped = true
  44977. /***/ }),
  44978. /***/ "./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&":
  44979. /*!**********************************************************************************************************************************************************************************************************************!*\
  44980. !*** ./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& ***!
  44981. \**********************************************************************************************************************************************************************************************************************/
  44982. /*! exports provided: render, staticRenderFns */
  44983. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44984. "use strict";
  44985. __webpack_require__.r(__webpack_exports__);
  44986. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44987. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44988. var render = function() {
  44989. var _vm = this
  44990. var _h = _vm.$createElement
  44991. var _c = _vm._self._c || _h
  44992. return _c(
  44993. "modal",
  44994. {
  44995. attrs: {
  44996. id: _vm.id,
  44997. tabindex: "-1",
  44998. role: "dialog",
  44999. "aria-labelledby": _vm.id + "Label"
  45000. }
  45001. },
  45002. [
  45003. _c(
  45004. "h5",
  45005. {
  45006. staticClass: "modal-title",
  45007. attrs: { slot: "header", id: _vm.id + "Label" },
  45008. slot: "header"
  45009. },
  45010. [_vm._v("\n Edit Credential\n ")]
  45011. ),
  45012. _vm._v(" "),
  45013. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45014. _c(
  45015. "div",
  45016. { staticClass: "form" },
  45017. [
  45018. _c("autocomplete-custom-dropdown", {
  45019. attrs: {
  45020. options: _vm.descriptions,
  45021. value: _vm.creddesc,
  45022. "allow-custom": true
  45023. },
  45024. model: {
  45025. value: _vm.creddesc,
  45026. callback: function($$v) {
  45027. _vm.creddesc = $$v
  45028. },
  45029. expression: "creddesc"
  45030. }
  45031. })
  45032. ],
  45033. 1
  45034. ),
  45035. _vm._v(" "),
  45036. _c("div", { staticClass: "form-group" }, [
  45037. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  45038. _vm._v(" "),
  45039. _c("input", {
  45040. directives: [
  45041. {
  45042. name: "model",
  45043. rawName: "v-model",
  45044. value: _vm.data.creduser,
  45045. expression: "data.creduser"
  45046. }
  45047. ],
  45048. staticClass: "form-control credential",
  45049. attrs: {
  45050. type: "text",
  45051. name: "newusername" + _vm.data.credid,
  45052. id: "newusername" + _vm.data.credid
  45053. },
  45054. domProps: { value: _vm.data.creduser },
  45055. on: {
  45056. input: function($event) {
  45057. if ($event.target.composing) {
  45058. return
  45059. }
  45060. _vm.$set(_vm.data, "creduser", $event.target.value)
  45061. }
  45062. }
  45063. })
  45064. ]),
  45065. _vm._v(" "),
  45066. _c("div", { staticClass: "form-group" }, [
  45067. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  45068. _vm._v(" "),
  45069. _c("input", {
  45070. directives: [
  45071. {
  45072. name: "model",
  45073. rawName: "v-model",
  45074. value: _vm.data.credpass,
  45075. expression: "data.credpass"
  45076. }
  45077. ],
  45078. staticClass: "form-control credential",
  45079. attrs: {
  45080. type: "text",
  45081. name: "newpassword" + _vm.data.credid,
  45082. id: "newpassword" + _vm.data.credid
  45083. },
  45084. domProps: { value: _vm.data.credpass },
  45085. on: {
  45086. input: function($event) {
  45087. if ($event.target.composing) {
  45088. return
  45089. }
  45090. _vm.$set(_vm.data, "credpass", $event.target.value)
  45091. }
  45092. }
  45093. }),
  45094. _vm._v(" "),
  45095. _c(
  45096. "button",
  45097. {
  45098. staticClass: "btn btn-secondary",
  45099. attrs: { type: "button" },
  45100. on: {
  45101. click: function($event) {
  45102. return _vm.getRandomPassword(_vm.data.credid)
  45103. }
  45104. }
  45105. },
  45106. [_vm._v("Generate Random")]
  45107. )
  45108. ]),
  45109. _vm._v(" "),
  45110. _c("div", { staticClass: "form-group" })
  45111. ]),
  45112. _vm._v(" "),
  45113. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45114. _c(
  45115. "button",
  45116. {
  45117. staticClass: "btn btn-secondary",
  45118. attrs: { type: "button", "data-dismiss": "modal" }
  45119. },
  45120. [_vm._v("Close")]
  45121. ),
  45122. _vm._v(" "),
  45123. _c(
  45124. "button",
  45125. {
  45126. staticClass: "btn btn-primary",
  45127. attrs: { type: "button" },
  45128. on: {
  45129. click: function($event) {
  45130. return _vm.updateCredential()
  45131. }
  45132. }
  45133. },
  45134. [_vm._v("Save")]
  45135. )
  45136. ])
  45137. ]
  45138. )
  45139. }
  45140. var staticRenderFns = []
  45141. render._withStripped = true
  45142. /***/ }),
  45143. /***/ "./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&":
  45144. /*!*****************************************************************************************************************************************************************************************************************!*\
  45145. !*** ./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& ***!
  45146. \*****************************************************************************************************************************************************************************************************************/
  45147. /*! exports provided: render, staticRenderFns */
  45148. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45149. "use strict";
  45150. __webpack_require__.r(__webpack_exports__);
  45151. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45152. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45153. var render = function() {
  45154. var _vm = this
  45155. var _h = _vm.$createElement
  45156. var _c = _vm._self._c || _h
  45157. return _c(
  45158. "div",
  45159. [
  45160. _c("credential-form-modal", {
  45161. attrs: {
  45162. "modal-id": "newCredentialModal",
  45163. descriptions: _vm.creddescList,
  45164. create: true,
  45165. pcid: _vm.pcid
  45166. }
  45167. }),
  45168. _vm._v(" "),
  45169. _c(
  45170. "button",
  45171. {
  45172. staticClass: "btn btn-primary",
  45173. attrs: {
  45174. type: "button",
  45175. "data-toggle": "modal",
  45176. "data-target": "#newCredentialModal"
  45177. }
  45178. },
  45179. [_vm._v("New Credential")]
  45180. ),
  45181. _vm._v(" "),
  45182. _vm._l(_vm.credentials, function(credential) {
  45183. return _c(
  45184. "div",
  45185. { key: credential.credid },
  45186. [
  45187. _c("credential", {
  45188. attrs: { credential: credential, descriptions: _vm.creddescList }
  45189. })
  45190. ],
  45191. 1
  45192. )
  45193. })
  45194. ],
  45195. 2
  45196. )
  45197. }
  45198. var staticRenderFns = []
  45199. render._withStripped = true
  45200. /***/ }),
  45201. /***/ "./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&":
  45202. /*!************************************************************************************************************************************************************************************************************!*\
  45203. !*** ./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& ***!
  45204. \************************************************************************************************************************************************************************************************************/
  45205. /*! exports provided: render, staticRenderFns */
  45206. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45207. "use strict";
  45208. __webpack_require__.r(__webpack_exports__);
  45209. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45210. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45211. var render = function() {
  45212. var _vm = this
  45213. var _h = _vm.$createElement
  45214. var _c = _vm._self._c || _h
  45215. return _c(
  45216. "ul",
  45217. { staticClass: "list-unstyled" },
  45218. _vm._l(_vm.errorList, function(error) {
  45219. return _c("li", { key: error, staticClass: "text-danger" }, [
  45220. _vm._v(" " + _vm._s(error) + " ")
  45221. ])
  45222. }),
  45223. 0
  45224. )
  45225. }
  45226. var staticRenderFns = []
  45227. render._withStripped = true
  45228. /***/ }),
  45229. /***/ "./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&":
  45230. /*!********************************************************************************************************************************************************************************************************!*\
  45231. !*** ./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& ***!
  45232. \********************************************************************************************************************************************************************************************************/
  45233. /*! exports provided: render, staticRenderFns */
  45234. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45235. "use strict";
  45236. __webpack_require__.r(__webpack_exports__);
  45237. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45238. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45239. var render = function() {
  45240. var _vm = this
  45241. var _h = _vm.$createElement
  45242. var _c = _vm._self._c || _h
  45243. return _c("div", { staticClass: "modal fade" }, [
  45244. _c(
  45245. "div",
  45246. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  45247. [
  45248. _c("div", { staticClass: "modal-content" }, [
  45249. _c(
  45250. "div",
  45251. { staticClass: "modal-header" },
  45252. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  45253. 2
  45254. ),
  45255. _vm._v(" "),
  45256. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  45257. _vm._v(" "),
  45258. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  45259. ])
  45260. ]
  45261. )
  45262. ])
  45263. }
  45264. var staticRenderFns = [
  45265. function() {
  45266. var _vm = this
  45267. var _h = _vm.$createElement
  45268. var _c = _vm._self._c || _h
  45269. return _c(
  45270. "button",
  45271. {
  45272. staticClass: "close",
  45273. attrs: {
  45274. type: "button",
  45275. "data-dismiss": "modal",
  45276. "aria-label": "Close"
  45277. }
  45278. },
  45279. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  45280. )
  45281. }
  45282. ]
  45283. render._withStripped = true
  45284. /***/ }),
  45285. /***/ "./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&":
  45286. /*!****************************************************************************************************************************************************************************************************************!*\
  45287. !*** ./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& ***!
  45288. \****************************************************************************************************************************************************************************************************************/
  45289. /*! exports provided: render, staticRenderFns */
  45290. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45291. "use strict";
  45292. __webpack_require__.r(__webpack_exports__);
  45293. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45294. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45295. var render = function() {
  45296. var _vm = this
  45297. var _h = _vm.$createElement
  45298. var _c = _vm._self._c || _h
  45299. return _c(
  45300. "modal",
  45301. {
  45302. attrs: {
  45303. id: _vm.modalId,
  45304. tabindex: "-1",
  45305. role: "dialog",
  45306. "aria-labelledby": _vm.modalId + "Label"
  45307. }
  45308. },
  45309. [
  45310. _c(
  45311. "h5",
  45312. {
  45313. staticClass: "modal-title",
  45314. attrs: { slot: "header", id: _vm.modalId + "Label" },
  45315. slot: "header"
  45316. },
  45317. [_vm._v("\n Edit Note\n ")]
  45318. ),
  45319. _vm._v(" "),
  45320. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45321. _c("div", { staticClass: "form-group" }, [
  45322. _c("label", { attrs: { for: "content" } }, [_vm._v("Content")]),
  45323. _vm._v(" "),
  45324. _c("textarea", {
  45325. directives: [
  45326. {
  45327. name: "model",
  45328. rawName: "v-model",
  45329. value: _vm.note.thenote,
  45330. expression: "note.thenote"
  45331. }
  45332. ],
  45333. staticClass: "form-control",
  45334. attrs: {
  45335. name: "content" + _vm.note.noteid,
  45336. id: "content" + _vm.note.noteid
  45337. },
  45338. domProps: { value: _vm.note.thenote },
  45339. on: {
  45340. input: function($event) {
  45341. if ($event.target.composing) {
  45342. return
  45343. }
  45344. _vm.$set(_vm.note, "thenote", $event.target.value)
  45345. }
  45346. }
  45347. })
  45348. ])
  45349. ]),
  45350. _vm._v(" "),
  45351. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45352. _c(
  45353. "button",
  45354. {
  45355. staticClass: "btn btn-secondary",
  45356. attrs: { type: "button", "data-dismiss": "modal" }
  45357. },
  45358. [_vm._v("Close")]
  45359. ),
  45360. _vm._v(" "),
  45361. _c(
  45362. "button",
  45363. {
  45364. staticClass: "btn btn-primary",
  45365. attrs: { type: "button" },
  45366. on: {
  45367. click: function($event) {
  45368. return _vm.updateNote(_vm.note)
  45369. }
  45370. }
  45371. },
  45372. [_vm._v("Save")]
  45373. )
  45374. ])
  45375. ]
  45376. )
  45377. }
  45378. var staticRenderFns = []
  45379. render._withStripped = true
  45380. /***/ }),
  45381. /***/ "./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&":
  45382. /*!********************************************************************************************************************************************************************************************************!*\
  45383. !*** ./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& ***!
  45384. \********************************************************************************************************************************************************************************************************/
  45385. /*! exports provided: render, staticRenderFns */
  45386. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45387. "use strict";
  45388. __webpack_require__.r(__webpack_exports__);
  45389. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45390. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45391. var render = function() {
  45392. var _vm = this
  45393. var _h = _vm.$createElement
  45394. var _c = _vm._self._c || _h
  45395. return _c(
  45396. "ul",
  45397. { staticClass: "list-unstyled" },
  45398. [
  45399. _c("div", { staticClass: "row" }, [
  45400. _c(
  45401. "div",
  45402. {
  45403. staticClass:
  45404. "col-md-2 d-flex justify-content-center justify-content-md-start"
  45405. },
  45406. [
  45407. _c(
  45408. "button",
  45409. {
  45410. staticClass: "btn btn-primary m-2",
  45411. attrs: {
  45412. type: "button",
  45413. "data-toggle": "collapse",
  45414. "data-target": "#note" + _vm.noteType + "add"
  45415. }
  45416. },
  45417. [
  45418. _c("i", { staticClass: "fas fa-fw fa-plus" }),
  45419. _vm._v(" Add New Note")
  45420. ]
  45421. )
  45422. ]
  45423. ),
  45424. _vm._v(" "),
  45425. _c("div", { staticClass: "col-md-10" }, [
  45426. _c(
  45427. "div",
  45428. {
  45429. staticClass: "collapse",
  45430. attrs: { id: "note" + _vm.noteType + "add" }
  45431. },
  45432. [
  45433. _c(
  45434. "div",
  45435. {
  45436. staticClass:
  45437. "d-flex flex-wrap flex-md-nowrap justify-content-center"
  45438. },
  45439. [
  45440. _c("textarea", {
  45441. directives: [
  45442. {
  45443. name: "model",
  45444. rawName: "v-model",
  45445. value: _vm.newNote.thenote,
  45446. expression: "newNote.thenote"
  45447. }
  45448. ],
  45449. staticClass: "form-control",
  45450. attrs: {
  45451. name: "newnote" + _vm.noteType,
  45452. id: "newnote" + _vm.noteType
  45453. },
  45454. domProps: { value: _vm.newNote.thenote },
  45455. on: {
  45456. input: function($event) {
  45457. if ($event.target.composing) {
  45458. return
  45459. }
  45460. _vm.$set(_vm.newNote, "thenote", $event.target.value)
  45461. }
  45462. }
  45463. }),
  45464. _vm._v(" "),
  45465. _c(
  45466. "button",
  45467. {
  45468. staticClass: "btn btn-secondary m-2",
  45469. attrs: { type: "button" },
  45470. on: {
  45471. click: function($event) {
  45472. return _vm.createNote()
  45473. }
  45474. }
  45475. },
  45476. [_vm._v("Save")]
  45477. )
  45478. ]
  45479. )
  45480. ]
  45481. )
  45482. ])
  45483. ]),
  45484. _vm._v(" "),
  45485. _vm._l(this.notes, function(note, index) {
  45486. return _c(
  45487. "li",
  45488. { key: index, staticClass: "row no-gutters mb-2" },
  45489. [
  45490. _c("note-form-modal", {
  45491. attrs: {
  45492. "modal-id": "note" + note.noteid + "editModal",
  45493. "populate-with": note
  45494. }
  45495. }),
  45496. _vm._v(" "),
  45497. _c(
  45498. "div",
  45499. {
  45500. staticClass: "col-md-1 d-flex flex-column mx-md-3",
  45501. class: _vm.noteOrders[index]
  45502. },
  45503. [
  45504. _c("div", { staticClass: "text-center p-0 m-0" }, [
  45505. _vm._v(_vm._s(note.noteuser))
  45506. ]),
  45507. _vm._v(" "),
  45508. _c(
  45509. "div",
  45510. { staticClass: "text-muted text-small text-center p-0 m-0" },
  45511. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  45512. ),
  45513. _vm._v(" "),
  45514. _c(
  45515. "div",
  45516. { staticClass: "btn-group justify-content-center p-0 m-0" },
  45517. [
  45518. _vm.authusername === note.noteuser ||
  45519. _vm.authusername === "admin"
  45520. ? [
  45521. _c(
  45522. "button",
  45523. {
  45524. staticClass: "btn btn-sm btn-primary m-1",
  45525. attrs: {
  45526. "data-toggle": "modal",
  45527. "data-target":
  45528. "#note" + note.noteid + "editModal"
  45529. }
  45530. },
  45531. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  45532. ),
  45533. _vm._v(" "),
  45534. _vm._m(0, true),
  45535. _vm._v(" "),
  45536. _vm._m(1, true)
  45537. ]
  45538. : _vm._e()
  45539. ],
  45540. 2
  45541. )
  45542. ]
  45543. ),
  45544. _vm._v(" "),
  45545. _c("div", { staticClass: "col-md-10" }, [
  45546. _c("div", { staticClass: "card m-2" }, [
  45547. _c("div", { staticClass: "card-body p-2" }, [
  45548. _vm._v(
  45549. "\n " +
  45550. _vm._s(note.thenote) +
  45551. "\n "
  45552. )
  45553. ])
  45554. ])
  45555. ])
  45556. ],
  45557. 1
  45558. )
  45559. })
  45560. ],
  45561. 2
  45562. )
  45563. }
  45564. var staticRenderFns = [
  45565. function() {
  45566. var _vm = this
  45567. var _h = _vm.$createElement
  45568. var _c = _vm._self._c || _h
  45569. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  45570. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  45571. ])
  45572. },
  45573. function() {
  45574. var _vm = this
  45575. var _h = _vm.$createElement
  45576. var _c = _vm._self._c || _h
  45577. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  45578. _c("i", { staticClass: "fa fa-fw fa-random" })
  45579. ])
  45580. }
  45581. ]
  45582. render._withStripped = true
  45583. /***/ }),
  45584. /***/ "./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&":
  45585. /*!******************************************************************************************************************************************************************************************************************!*\
  45586. !*** ./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& ***!
  45587. \******************************************************************************************************************************************************************************************************************/
  45588. /*! exports provided: render, staticRenderFns */
  45589. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45590. "use strict";
  45591. __webpack_require__.r(__webpack_exports__);
  45592. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45593. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45594. var render = function() {
  45595. var _vm = this
  45596. var _h = _vm.$createElement
  45597. var _c = _vm._self._c || _h
  45598. return _c(
  45599. "modal",
  45600. {
  45601. attrs: {
  45602. id: _vm.id,
  45603. tabindex: "-1",
  45604. role: "dialog",
  45605. "aria-labelledby": _vm.id + "Label"
  45606. }
  45607. },
  45608. [
  45609. _c(
  45610. "h5",
  45611. {
  45612. staticClass: "modal-title",
  45613. attrs: { slot: "header", id: _vm.id + "Label" },
  45614. slot: "header"
  45615. },
  45616. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  45617. ),
  45618. _vm._v(" "),
  45619. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  45620. _c(
  45621. "div",
  45622. { staticClass: "form-group" },
  45623. [
  45624. _c("label", { attrs: { for: "probdesc" } }, [
  45625. _vm._v("Problem Description")
  45626. ]),
  45627. _vm._v(" "),
  45628. _c("textarea", {
  45629. directives: [
  45630. {
  45631. name: "model",
  45632. rawName: "v-model",
  45633. value: _vm.data.probdesc,
  45634. expression: "data.probdesc"
  45635. }
  45636. ],
  45637. class: {
  45638. "form-control": true,
  45639. "is-invalid": _vm.errors.probdesc
  45640. },
  45641. attrs: { id: "probdesc", name: "probdesc" },
  45642. domProps: { value: _vm.data.probdesc },
  45643. on: {
  45644. input: function($event) {
  45645. if ($event.target.composing) {
  45646. return
  45647. }
  45648. _vm.$set(_vm.data, "probdesc", $event.target.value)
  45649. }
  45650. }
  45651. }),
  45652. _vm._v(" "),
  45653. _c("error-list", { attrs: { errors: _vm.errors.probdesc } })
  45654. ],
  45655. 1
  45656. ),
  45657. _vm._v(" "),
  45658. _c(
  45659. "div",
  45660. { staticClass: "form-group" },
  45661. [
  45662. _c("label", { attrs: { for: "suggested" } }, [
  45663. _vm._v("Suggested Solution")
  45664. ]),
  45665. _vm._v(" "),
  45666. _c("textarea", {
  45667. directives: [
  45668. {
  45669. name: "model",
  45670. rawName: "v-model",
  45671. value: _vm.data.suggested,
  45672. expression: "data.suggested"
  45673. }
  45674. ],
  45675. class: {
  45676. "form-control": true,
  45677. "is-invalid": _vm.errors.suggested
  45678. },
  45679. attrs: { id: "suggested", name: "suggested" },
  45680. domProps: { value: _vm.data.suggested },
  45681. on: {
  45682. input: function($event) {
  45683. if ($event.target.composing) {
  45684. return
  45685. }
  45686. _vm.$set(_vm.data, "suggested", $event.target.value)
  45687. }
  45688. }
  45689. }),
  45690. _vm._v(" "),
  45691. _c("error-list", { attrs: { errors: _vm.errors.suggested } })
  45692. ],
  45693. 1
  45694. ),
  45695. _vm._v(" "),
  45696. _c(
  45697. "div",
  45698. { staticClass: "form-group" },
  45699. [
  45700. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  45701. _vm._v(" "),
  45702. _c("autocomplete-custom-dropdown", {
  45703. attrs: { options: _vm.storeList, value: this.store },
  45704. model: {
  45705. value: _vm.store,
  45706. callback: function($$v) {
  45707. _vm.store = $$v
  45708. },
  45709. expression: "store"
  45710. }
  45711. })
  45712. ],
  45713. 1
  45714. )
  45715. ]),
  45716. _vm._v(" "),
  45717. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  45718. _c(
  45719. "button",
  45720. {
  45721. staticClass: "btn btn-secondary",
  45722. attrs: { type: "button", "data-dismiss": "modal" }
  45723. },
  45724. [_vm._v("Close")]
  45725. ),
  45726. _vm._v(" "),
  45727. _c(
  45728. "button",
  45729. {
  45730. staticClass: "btn btn-primary",
  45731. attrs: { type: "button" },
  45732. on: {
  45733. click: function($event) {
  45734. return _vm.updateWorkOrder()
  45735. }
  45736. }
  45737. },
  45738. [
  45739. !_vm.woInfoSaving
  45740. ? _c("div", [_vm._v("Save")])
  45741. : _c("circle-spinner", { attrs: { size: 2 } })
  45742. ],
  45743. 1
  45744. )
  45745. ])
  45746. ]
  45747. )
  45748. }
  45749. var staticRenderFns = []
  45750. render._withStripped = true
  45751. /***/ }),
  45752. /***/ "./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&":
  45753. /*!****************************************************************************************************************************************************************************************************************!*\
  45754. !*** ./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& ***!
  45755. \****************************************************************************************************************************************************************************************************************/
  45756. /*! exports provided: render, staticRenderFns */
  45757. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45758. "use strict";
  45759. __webpack_require__.r(__webpack_exports__);
  45760. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45761. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45762. var render = function() {
  45763. var _vm = this
  45764. var _h = _vm.$createElement
  45765. var _c = _vm._self._c || _h
  45766. return _c(
  45767. "div",
  45768. [
  45769. _c("wo-info-edit-modal", {
  45770. attrs: {
  45771. "modal-id": "workordereditModal",
  45772. "populate-with": _vm.workOrder,
  45773. "store-list": this.storeList
  45774. }
  45775. }),
  45776. _vm._v(" "),
  45777. _c("p", [
  45778. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  45779. _vm._v(" "),
  45780. _c("span", {
  45781. domProps: { textContent: _vm._s(_vm.workOrder.probdesc) }
  45782. })
  45783. ]),
  45784. _vm._v(" "),
  45785. _c("p", [
  45786. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  45787. _vm._v(" "),
  45788. _c("span", {
  45789. domProps: { textContent: _vm._s(_vm.workOrder.suggested) }
  45790. })
  45791. ]),
  45792. _vm._v(" "),
  45793. _c("p", [
  45794. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  45795. _vm._v(" "),
  45796. _c("span", { domProps: { textContent: _vm._s(_vm.workOrder.woid) } })
  45797. ]),
  45798. _vm._v(" "),
  45799. _c("p", [
  45800. _c("i", { staticClass: "fas fa-fw fa-building" }),
  45801. _vm._v(" "),
  45802. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.workOrder.storeid]))])
  45803. ]),
  45804. _vm._v(" "),
  45805. _c("p", [
  45806. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  45807. _vm._v(" "),
  45808. _c(
  45809. "span",
  45810. {
  45811. staticClass: "dashed-underline",
  45812. attrs: {
  45813. "data-toggle": "tooltip",
  45814. "data-placement": "bottom",
  45815. title: this.getHRDate(_vm.workOrder.dropdate)
  45816. }
  45817. },
  45818. [
  45819. _vm._v(
  45820. "\n " +
  45821. _vm._s(
  45822. Math.floor(this.daysSinceToday(_vm.workOrder.dropdate))
  45823. ) +
  45824. " days ago\n "
  45825. )
  45826. ]
  45827. )
  45828. ]),
  45829. _vm._v(" "),
  45830. _c("p", [
  45831. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  45832. _vm._v(" "),
  45833. !this.isZero(_vm.workOrder.pickupdate)
  45834. ? _c(
  45835. "span",
  45836. {
  45837. staticClass: "dashed-underline",
  45838. attrs: {
  45839. "data-toggle": "tooltip",
  45840. "data-placement": "bottom",
  45841. title: this.getHRDate(_vm.workOrder.pickupdate)
  45842. }
  45843. },
  45844. [
  45845. _vm._v(
  45846. "\n " +
  45847. _vm._s(
  45848. Math.floor(this.daysSinceToday(_vm.workOrder.pickupdate))
  45849. ) +
  45850. " days ago\n "
  45851. )
  45852. ]
  45853. )
  45854. : _vm._e()
  45855. ]),
  45856. _vm._v(" "),
  45857. _c(
  45858. "button",
  45859. {
  45860. staticClass: "btn btn-primary",
  45861. attrs: {
  45862. type: "button",
  45863. "data-toggle": "modal",
  45864. "data-target": "#workordereditModal"
  45865. }
  45866. },
  45867. [_vm._v("Edit")]
  45868. )
  45869. ],
  45870. 1
  45871. )
  45872. }
  45873. var staticRenderFns = []
  45874. render._withStripped = true
  45875. /***/ }),
  45876. /***/ "./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&":
  45877. /*!*************************************************************************************************************************************************************************************************!*\
  45878. !*** ./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& ***!
  45879. \*************************************************************************************************************************************************************************************************/
  45880. /*! exports provided: render, staticRenderFns */
  45881. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  45882. "use strict";
  45883. __webpack_require__.r(__webpack_exports__);
  45884. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  45885. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  45886. var render = function() {
  45887. var _vm = this
  45888. var _h = _vm.$createElement
  45889. var _c = _vm._self._c || _h
  45890. return _c("div", [
  45891. _c(
  45892. "nav",
  45893. {
  45894. staticClass:
  45895. "navbar navbar-expand navbar-dark bg-primary text-light shadow-sm"
  45896. },
  45897. [
  45898. _c(
  45899. "div",
  45900. { staticClass: "container-fluid" },
  45901. [
  45902. _c(
  45903. "router-link",
  45904. { staticClass: "navbar-brand", attrs: { to: { name: "home" } } },
  45905. [_vm._v("\n UPCCRT\n ")]
  45906. ),
  45907. _vm._v(" "),
  45908. _vm._m(0),
  45909. _vm._v(" "),
  45910. _c(
  45911. "div",
  45912. {
  45913. staticClass: "collapse navbar-collapse",
  45914. attrs: { id: "navbarSupportedContent" }
  45915. },
  45916. [
  45917. _c("ul", { staticClass: "navbar-nav mr-auto text-center" }, [
  45918. _vm._m(1),
  45919. _vm._v(" "),
  45920. _vm._m(2),
  45921. _vm._v(" "),
  45922. _c(
  45923. "li",
  45924. { staticClass: "nav-item" },
  45925. [
  45926. _c(
  45927. "router-link",
  45928. {
  45929. staticClass: "nav-link",
  45930. attrs: { to: { name: "dashboard" } }
  45931. },
  45932. [
  45933. _c("i", { staticClass: "fas fa-tachometer-alt" }),
  45934. _vm._v(" "),
  45935. _c(
  45936. "span",
  45937. { staticClass: "d-none d-sm-block d-md-inline" },
  45938. [_vm._v("Dashboard")]
  45939. )
  45940. ]
  45941. )
  45942. ],
  45943. 1
  45944. ),
  45945. _vm._v(" "),
  45946. _vm._m(3)
  45947. ]),
  45948. _vm._v(" "),
  45949. _c(
  45950. "ul",
  45951. { staticClass: "navbar-nav ml-auto" },
  45952. [
  45953. !_vm.isLoggedIn
  45954. ? _c(
  45955. "router-link",
  45956. {
  45957. staticClass: "nav-link",
  45958. attrs: { to: { name: "login" } }
  45959. },
  45960. [_vm._v("Login")]
  45961. )
  45962. : _vm._e(),
  45963. _vm._v(" "),
  45964. _vm.isLoggedIn
  45965. ? _c("li", { staticClass: "nav-link" }, [
  45966. _vm._v(_vm._s(_vm.username))
  45967. ])
  45968. : _vm._e(),
  45969. _vm._v(" "),
  45970. _vm.isLoggedIn
  45971. ? _c(
  45972. "router-link",
  45973. {
  45974. staticClass: "nav-link",
  45975. attrs: { to: { name: "home" } }
  45976. },
  45977. [_vm._v("Home")]
  45978. )
  45979. : _vm._e()
  45980. ],
  45981. 1
  45982. )
  45983. ]
  45984. )
  45985. ],
  45986. 1
  45987. )
  45988. ]
  45989. ),
  45990. _vm._v(" "),
  45991. _c("main", { staticClass: "py-4" }, [_c("router-view")], 1)
  45992. ])
  45993. }
  45994. var staticRenderFns = [
  45995. function() {
  45996. var _vm = this
  45997. var _h = _vm.$createElement
  45998. var _c = _vm._self._c || _h
  45999. return _c(
  46000. "button",
  46001. {
  46002. staticClass: "navbar-toggler",
  46003. attrs: {
  46004. type: "button",
  46005. "data-toggle": "collapse",
  46006. "data-target": "#navbarSupportedContent",
  46007. "aria-controls": "navbarSupportedContent",
  46008. "aria-expanded": "false"
  46009. }
  46010. },
  46011. [_c("span", { staticClass: "navbar-toggler-icon" })]
  46012. )
  46013. },
  46014. function() {
  46015. var _vm = this
  46016. var _h = _vm.$createElement
  46017. var _c = _vm._self._c || _h
  46018. return _c("li", { staticClass: "nav-item" }, [
  46019. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  46020. _c("i", { staticClass: "fas fa-sign-in-alt" }),
  46021. _vm._v(" "),
  46022. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  46023. _vm._v("Check-In")
  46024. ])
  46025. ])
  46026. ])
  46027. },
  46028. function() {
  46029. var _vm = this
  46030. var _h = _vm.$createElement
  46031. var _c = _vm._self._c || _h
  46032. return _c("li", { staticClass: "nav-item" }, [
  46033. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  46034. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  46035. _vm._v(" "),
  46036. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  46037. _vm._v("Check-Out")
  46038. ])
  46039. ])
  46040. ])
  46041. },
  46042. function() {
  46043. var _vm = this
  46044. var _h = _vm.$createElement
  46045. var _c = _vm._self._c || _h
  46046. return _c("li", { staticClass: "nav-item" }, [
  46047. _c("a", { staticClass: "nav-link", attrs: { href: "#" } }, [
  46048. _c("i", { staticClass: "fas fa-chart-bar" }),
  46049. _vm._v(" "),
  46050. _c("span", { staticClass: "d-none d-sm-block d-md-inline" }, [
  46051. _vm._v("Reports")
  46052. ])
  46053. ])
  46054. ])
  46055. }
  46056. ]
  46057. render._withStripped = true
  46058. /***/ }),
  46059. /***/ "./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&":
  46060. /*!*******************************************************************************************************************************************************************************************************!*\
  46061. !*** ./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& ***!
  46062. \*******************************************************************************************************************************************************************************************************/
  46063. /*! exports provided: render, staticRenderFns */
  46064. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46065. "use strict";
  46066. __webpack_require__.r(__webpack_exports__);
  46067. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46068. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46069. var render = function() {
  46070. var _vm = this
  46071. var _h = _vm.$createElement
  46072. var _c = _vm._self._c || _h
  46073. return _c("div", { staticClass: "container" }, [
  46074. _c("div", { staticClass: "row justify-content-center" }, [
  46075. !_vm.isLoading
  46076. ? _c(
  46077. "div",
  46078. { staticClass: "col-md-12" },
  46079. _vm._l(_vm.workOrders, function(workOrder, index) {
  46080. return _c(
  46081. "div",
  46082. { key: workOrder.woid, staticClass: "col-md-4" },
  46083. [
  46084. _c("div", { staticClass: "card" }, [
  46085. _c(
  46086. "div",
  46087. { staticClass: "card-header" },
  46088. [
  46089. _c(
  46090. "router-link",
  46091. {
  46092. staticClass: "h4 card-title",
  46093. attrs: {
  46094. to: {
  46095. name: "workorders",
  46096. params: { id: workOrder.woid }
  46097. }
  46098. }
  46099. },
  46100. [_vm._v(_vm._s(workOrder.woid))]
  46101. )
  46102. ],
  46103. 1
  46104. ),
  46105. _vm._v(" "),
  46106. _c("div", { staticClass: "card-body card-body-dark" }, [
  46107. _c("div", [
  46108. _vm._v(
  46109. "\n " +
  46110. _vm._s(workOrder.probdesc) +
  46111. "\n "
  46112. )
  46113. ]),
  46114. _vm._v(" "),
  46115. _c("div", [
  46116. _vm._v(
  46117. "\n " +
  46118. _vm._s(workOrder.suggested) +
  46119. "\n "
  46120. )
  46121. ])
  46122. ])
  46123. ])
  46124. ]
  46125. )
  46126. }),
  46127. 0
  46128. )
  46129. : _c(
  46130. "div",
  46131. { staticClass: "col-md-12" },
  46132. [_c("circle-spinner", { attrs: { color: "#663399" } })],
  46133. 1
  46134. )
  46135. ])
  46136. ])
  46137. }
  46138. var staticRenderFns = []
  46139. render._withStripped = true
  46140. /***/ }),
  46141. /***/ "./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&":
  46142. /*!***************************************************************************************************************************************************************************************************!*\
  46143. !*** ./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& ***!
  46144. \***************************************************************************************************************************************************************************************************/
  46145. /*! exports provided: render, staticRenderFns */
  46146. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46147. "use strict";
  46148. __webpack_require__.r(__webpack_exports__);
  46149. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46150. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46151. var render = function() {
  46152. var _vm = this
  46153. var _h = _vm.$createElement
  46154. var _c = _vm._self._c || _h
  46155. return _c("div", { staticClass: "container" }, [
  46156. _c("div", { staticClass: "row justify-content-center" }, [
  46157. _c("div", { staticClass: "col-md-8" }, [
  46158. _c("div", { staticClass: "card card-default" }, [
  46159. _c("div", { staticClass: "card-header" }, [_vm._v("Login")]),
  46160. _vm._v(" "),
  46161. _c("div", { staticClass: "card-body" }, [
  46162. _c("form", { attrs: { method: "POST", action: "/login" } }, [
  46163. _c("div", { staticClass: "form-group row" }, [
  46164. _c(
  46165. "label",
  46166. {
  46167. staticClass: "col-sm-4 col-form-label text-md-right",
  46168. attrs: { for: "username" }
  46169. },
  46170. [_vm._v("Username")]
  46171. ),
  46172. _vm._v(" "),
  46173. _c("div", { staticClass: "col-md-6" }, [
  46174. _c("input", {
  46175. directives: [
  46176. {
  46177. name: "model",
  46178. rawName: "v-model",
  46179. value: _vm.username,
  46180. expression: "username"
  46181. }
  46182. ],
  46183. staticClass: "form-control",
  46184. attrs: {
  46185. id: "username",
  46186. type: "username",
  46187. required: "",
  46188. autofocus: ""
  46189. },
  46190. domProps: { value: _vm.username },
  46191. on: {
  46192. input: function($event) {
  46193. if ($event.target.composing) {
  46194. return
  46195. }
  46196. _vm.username = $event.target.value
  46197. }
  46198. }
  46199. })
  46200. ])
  46201. ]),
  46202. _vm._v(" "),
  46203. _c("div", { staticClass: "form-group row" }, [
  46204. _c(
  46205. "label",
  46206. {
  46207. staticClass: "col-md-4 col-form-label text-md-right",
  46208. attrs: { for: "password" }
  46209. },
  46210. [_vm._v("Password")]
  46211. ),
  46212. _vm._v(" "),
  46213. _c("div", { staticClass: "col-md-6" }, [
  46214. _c("input", {
  46215. directives: [
  46216. {
  46217. name: "model",
  46218. rawName: "v-model",
  46219. value: _vm.password,
  46220. expression: "password"
  46221. }
  46222. ],
  46223. staticClass: "form-control",
  46224. attrs: { id: "password", type: "password", required: "" },
  46225. domProps: { value: _vm.password },
  46226. on: {
  46227. input: function($event) {
  46228. if ($event.target.composing) {
  46229. return
  46230. }
  46231. _vm.password = $event.target.value
  46232. }
  46233. }
  46234. })
  46235. ])
  46236. ]),
  46237. _vm._v(" "),
  46238. _c("div", { staticClass: "form-group row mb-0" }, [
  46239. _c("div", { staticClass: "col-md-8 offset-md-4" }, [
  46240. _c(
  46241. "button",
  46242. {
  46243. staticClass: "btn btn-primary",
  46244. attrs: { type: "submit" },
  46245. on: { click: _vm.handleSubmit }
  46246. },
  46247. [
  46248. _vm._v(
  46249. "\n Login\n "
  46250. )
  46251. ]
  46252. )
  46253. ])
  46254. ])
  46255. ])
  46256. ])
  46257. ])
  46258. ])
  46259. ])
  46260. ])
  46261. }
  46262. var staticRenderFns = []
  46263. render._withStripped = true
  46264. /***/ }),
  46265. /***/ "./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&":
  46266. /*!*****************************************************************************************************************************************************************************************************************!*\
  46267. !*** ./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& ***!
  46268. \*****************************************************************************************************************************************************************************************************************/
  46269. /*! exports provided: render, staticRenderFns */
  46270. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46271. "use strict";
  46272. __webpack_require__.r(__webpack_exports__);
  46273. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46274. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46275. var render = function() {
  46276. var _vm = this
  46277. var _h = _vm.$createElement
  46278. var _c = _vm._self._c || _h
  46279. return _vm._m(0)
  46280. }
  46281. var staticRenderFns = [
  46282. function() {
  46283. var _vm = this
  46284. var _h = _vm.$createElement
  46285. var _c = _vm._self._c || _h
  46286. return _c("div", { staticClass: "flex-center position-ref full-height" }, [
  46287. _c("div", { staticClass: "content" }, [
  46288. _c("div", { staticClass: "m-b-md" }, [
  46289. _c("h2", { staticClass: "title m-b-md" }, [
  46290. _vm._v("\n UPCCRT\n ")
  46291. ]),
  46292. _vm._v(" "),
  46293. _c("h3", [
  46294. _vm._v(
  46295. "\n University PC Care Repair Tracker\n "
  46296. )
  46297. ])
  46298. ])
  46299. ])
  46300. ])
  46301. }
  46302. ]
  46303. render._withStripped = true
  46304. /***/ }),
  46305. /***/ "./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&":
  46306. /*!*******************************************************************************************************************************************************************************************************!*\
  46307. !*** ./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& ***!
  46308. \*******************************************************************************************************************************************************************************************************/
  46309. /*! exports provided: render, staticRenderFns */
  46310. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46311. "use strict";
  46312. __webpack_require__.r(__webpack_exports__);
  46313. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  46314. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  46315. var render = function() {
  46316. var _vm = this
  46317. var _h = _vm.$createElement
  46318. var _c = _vm._self._c || _h
  46319. return _c("div", { staticClass: "container-fluid" }, [
  46320. _c("div", { staticClass: "row my-3" }, [
  46321. _c("div", { staticClass: "col-lg-6" }, [
  46322. _c("div", { staticClass: "card h-100" }, [
  46323. _vm._m(0),
  46324. _vm._v(" "),
  46325. _c("div", { staticClass: "card-body" }, [
  46326. _c("div", { staticClass: "tab-content" }, [
  46327. _c(
  46328. "div",
  46329. {
  46330. staticClass: "tab-pane active",
  46331. attrs: {
  46332. id: "assetinfo",
  46333. role: "tabpanel",
  46334. "aria-labelledby": "assetinfo-tab"
  46335. }
  46336. },
  46337. [
  46338. !_vm.assetLoading
  46339. ? _c("asset-info", { attrs: { asset: _vm.asset } })
  46340. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46341. ],
  46342. 1
  46343. ),
  46344. _vm._v(" "),
  46345. _c(
  46346. "div",
  46347. {
  46348. staticClass: "tab-pane",
  46349. attrs: {
  46350. id: "credentials",
  46351. role: "tabpanel",
  46352. "aria-labelledby": "credentials-tab"
  46353. }
  46354. },
  46355. [
  46356. !_vm.credentialsLoading && !_vm.credentialDescriptionsLoading
  46357. ? _c("credential-list", {
  46358. attrs: {
  46359. credentials: _vm.credentials,
  46360. descriptions: _vm.credentialDescriptions,
  46361. pcid: _vm.asset.pcid
  46362. }
  46363. })
  46364. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46365. ],
  46366. 1
  46367. )
  46368. ])
  46369. ])
  46370. ])
  46371. ]),
  46372. _vm._v(" "),
  46373. _c("div", { staticClass: "col-lg-6" }, [
  46374. _c("div", { staticClass: "card h-100" }, [
  46375. _vm._m(1),
  46376. _vm._v(" "),
  46377. _c("div", { staticClass: "card-body" }, [
  46378. _c("div", { staticClass: "tab-content" }, [
  46379. _c(
  46380. "div",
  46381. {
  46382. staticClass: "tab-pane active",
  46383. attrs: {
  46384. id: "workordersumm",
  46385. role: "tabpanel",
  46386. "aria-labelledby": "workordersumm-tab"
  46387. }
  46388. },
  46389. [
  46390. !_vm.woLoading && !_vm.storesLoading
  46391. ? _c("work-order-info", {
  46392. attrs: {
  46393. "work-order": _vm.workOrder,
  46394. stores: _vm.stores
  46395. }
  46396. })
  46397. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46398. ],
  46399. 1
  46400. ),
  46401. _vm._v(" "),
  46402. _c(
  46403. "div",
  46404. {
  46405. staticClass: "tab-pane",
  46406. attrs: {
  46407. id: "attachments",
  46408. role: "tabpanel",
  46409. "aria-labelledby": "attachments-tab"
  46410. }
  46411. },
  46412. [
  46413. _vm._v(
  46414. "\n TODO 2\n "
  46415. )
  46416. ]
  46417. )
  46418. ])
  46419. ])
  46420. ])
  46421. ])
  46422. ]),
  46423. _vm._v(" "),
  46424. _c("div", { staticClass: "row my-3 no-gutters" }, [
  46425. _c("div", { staticClass: "col-12" }, [
  46426. _c("div", { staticClass: "card" }, [
  46427. _c(
  46428. "div",
  46429. { staticClass: "card-body" },
  46430. [
  46431. _c("h5", { staticClass: "card-title" }, [
  46432. _vm._v("Customer Notes")
  46433. ]),
  46434. _vm._v(" "),
  46435. !_vm.workOrderNotesLoading
  46436. ? _c("notes", {
  46437. attrs: {
  46438. notes: _vm.publicNotes,
  46439. authusername: _vm.authUser,
  46440. "note-type": 0,
  46441. woid: _vm.id
  46442. }
  46443. })
  46444. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46445. ],
  46446. 1
  46447. )
  46448. ])
  46449. ])
  46450. ]),
  46451. _vm._v(" "),
  46452. _c("div", { staticClass: "row my-3 no-gutters" }, [
  46453. _c("div", { staticClass: "col-12" }, [
  46454. _c("div", { staticClass: "card" }, [
  46455. _c(
  46456. "div",
  46457. { staticClass: "card-body" },
  46458. [
  46459. _c("h5", { staticClass: "card-title" }, [
  46460. _vm._v("Private/Billing Notes")
  46461. ]),
  46462. _vm._v(" "),
  46463. !_vm.workOrderNotesLoading
  46464. ? _c("notes", {
  46465. attrs: {
  46466. notes: _vm.privateNotes,
  46467. authusername: _vm.authUser,
  46468. "note-type": 1,
  46469. woid: _vm.id
  46470. }
  46471. })
  46472. : _c("circle-spinner", { attrs: { color: "#663399" } })
  46473. ],
  46474. 1
  46475. )
  46476. ])
  46477. ])
  46478. ])
  46479. ])
  46480. }
  46481. var staticRenderFns = [
  46482. function() {
  46483. var _vm = this
  46484. var _h = _vm.$createElement
  46485. var _c = _vm._self._c || _h
  46486. return _c("div", { staticClass: "card-header text-right" }, [
  46487. _c(
  46488. "button",
  46489. {
  46490. staticClass: "btn btn-default xs-toggle",
  46491. attrs: {
  46492. type: "button",
  46493. "data-toggle": "collapse",
  46494. "data-target": "#assetTab"
  46495. }
  46496. },
  46497. [
  46498. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  46499. _vm._v(" "),
  46500. _c("span", { staticClass: "icon-bar" }),
  46501. _vm._v(" "),
  46502. _c("span", { staticClass: "icon-bar" }),
  46503. _vm._v(" "),
  46504. _c("span", { staticClass: "icon-bar" })
  46505. ]
  46506. ),
  46507. _vm._v(" "),
  46508. _c(
  46509. "ul",
  46510. {
  46511. staticClass:
  46512. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  46513. attrs: { id: "assetTab", role: "tablist" }
  46514. },
  46515. [
  46516. _c("li", { staticClass: "nav-item" }, [
  46517. _c(
  46518. "a",
  46519. {
  46520. staticClass: "nav-link active",
  46521. attrs: {
  46522. id: "assetinfo-tab",
  46523. "data-toggle": "pill",
  46524. href: "#assetinfo",
  46525. role: "tab",
  46526. "aria-controls": "assetinfo",
  46527. "aria-selected": "true"
  46528. }
  46529. },
  46530. [_vm._v("Hardware")]
  46531. )
  46532. ]),
  46533. _vm._v(" "),
  46534. _c("li", { staticClass: "nav-item" }, [
  46535. _c(
  46536. "a",
  46537. {
  46538. staticClass: "nav-link",
  46539. attrs: {
  46540. id: "credentials-tab",
  46541. "data-toggle": "pill",
  46542. href: "#credentials",
  46543. role: "tab",
  46544. "aria-controls": "credentials",
  46545. "aria-selected": "false"
  46546. }
  46547. },
  46548. [_vm._v("Credentials")]
  46549. )
  46550. ])
  46551. ]
  46552. )
  46553. ])
  46554. },
  46555. function() {
  46556. var _vm = this
  46557. var _h = _vm.$createElement
  46558. var _c = _vm._self._c || _h
  46559. return _c("div", { staticClass: "card-header text-right" }, [
  46560. _c(
  46561. "button",
  46562. {
  46563. staticClass: "btn btn-default xs-toggle",
  46564. attrs: {
  46565. type: "button",
  46566. "data-toggle": "collapse",
  46567. "data-target": "#workorderTab"
  46568. }
  46569. },
  46570. [
  46571. _c("span", { staticClass: "sr-only" }, [_vm._v("Toggle Navigation")]),
  46572. _vm._v(" "),
  46573. _c("span", { staticClass: "icon-bar" }),
  46574. _vm._v(" "),
  46575. _c("span", { staticClass: "icon-bar" }),
  46576. _vm._v(" "),
  46577. _c("span", { staticClass: "icon-bar" })
  46578. ]
  46579. ),
  46580. _vm._v(" "),
  46581. _c(
  46582. "ul",
  46583. {
  46584. staticClass:
  46585. "nav nav-pills card-header-pills nav-justified xs-collapse collapse",
  46586. attrs: { id: "workorderTab", role: "tablist" }
  46587. },
  46588. [
  46589. _c("li", { staticClass: "nav-item" }, [
  46590. _c(
  46591. "a",
  46592. {
  46593. staticClass: "nav-link active",
  46594. attrs: {
  46595. id: "workordersumm-tab",
  46596. "data-toggle": "pill",
  46597. href: "#workordersumm",
  46598. role: "tab",
  46599. "aria-controls": "workordersumm",
  46600. "aria-selected": "true"
  46601. }
  46602. },
  46603. [_vm._v("Summary")]
  46604. )
  46605. ]),
  46606. _vm._v(" "),
  46607. _c("li", { staticClass: "nav-item" }, [
  46608. _c(
  46609. "a",
  46610. {
  46611. staticClass: "nav-link",
  46612. attrs: {
  46613. id: "attachments-tab",
  46614. "data-toggle": "pill",
  46615. href: "#attachments",
  46616. role: "tab",
  46617. "aria-controls": "attachments",
  46618. "aria-selected": "false"
  46619. }
  46620. },
  46621. [_vm._v("Attachments")]
  46622. )
  46623. ])
  46624. ]
  46625. )
  46626. ])
  46627. }
  46628. ]
  46629. render._withStripped = true
  46630. /***/ }),
  46631. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  46632. /*!********************************************************************!*\
  46633. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  46634. \********************************************************************/
  46635. /*! exports provided: default */
  46636. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46637. "use strict";
  46638. __webpack_require__.r(__webpack_exports__);
  46639. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  46640. /* globals __VUE_SSR_CONTEXT__ */
  46641. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  46642. // This module is a runtime utility for cleaner component module output and will
  46643. // be included in the final webpack user bundle.
  46644. function normalizeComponent (
  46645. scriptExports,
  46646. render,
  46647. staticRenderFns,
  46648. functionalTemplate,
  46649. injectStyles,
  46650. scopeId,
  46651. moduleIdentifier, /* server only */
  46652. shadowMode /* vue-cli only */
  46653. ) {
  46654. // Vue.extend constructor export interop
  46655. var options = typeof scriptExports === 'function'
  46656. ? scriptExports.options
  46657. : scriptExports
  46658. // render functions
  46659. if (render) {
  46660. options.render = render
  46661. options.staticRenderFns = staticRenderFns
  46662. options._compiled = true
  46663. }
  46664. // functional template
  46665. if (functionalTemplate) {
  46666. options.functional = true
  46667. }
  46668. // scopedId
  46669. if (scopeId) {
  46670. options._scopeId = 'data-v-' + scopeId
  46671. }
  46672. var hook
  46673. if (moduleIdentifier) { // server build
  46674. hook = function (context) {
  46675. // 2.3 injection
  46676. context =
  46677. context || // cached call
  46678. (this.$vnode && this.$vnode.ssrContext) || // stateful
  46679. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  46680. // 2.2 with runInNewContext: true
  46681. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  46682. context = __VUE_SSR_CONTEXT__
  46683. }
  46684. // inject component styles
  46685. if (injectStyles) {
  46686. injectStyles.call(this, context)
  46687. }
  46688. // register component module identifier for async chunk inferrence
  46689. if (context && context._registeredComponents) {
  46690. context._registeredComponents.add(moduleIdentifier)
  46691. }
  46692. }
  46693. // used by ssr in case component is cached and beforeCreate
  46694. // never gets called
  46695. options._ssrRegister = hook
  46696. } else if (injectStyles) {
  46697. hook = shadowMode
  46698. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  46699. : injectStyles
  46700. }
  46701. if (hook) {
  46702. if (options.functional) {
  46703. // for template-only hot-reload because in that case the render fn doesn't
  46704. // go through the normalizer
  46705. options._injectStyles = hook
  46706. // register for functioal component in vue file
  46707. var originalRender = options.render
  46708. options.render = function renderWithStyleInjection (h, context) {
  46709. hook.call(context)
  46710. return originalRender(h, context)
  46711. }
  46712. } else {
  46713. // inject component registration as beforeCreate hook
  46714. var existing = options.beforeCreate
  46715. options.beforeCreate = existing
  46716. ? [].concat(existing, hook)
  46717. : [hook]
  46718. }
  46719. }
  46720. return {
  46721. exports: scriptExports,
  46722. options: options
  46723. }
  46724. }
  46725. /***/ }),
  46726. /***/ "./node_modules/vue-router/dist/vue-router.esm.js":
  46727. /*!********************************************************!*\
  46728. !*** ./node_modules/vue-router/dist/vue-router.esm.js ***!
  46729. \********************************************************/
  46730. /*! exports provided: default */
  46731. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  46732. "use strict";
  46733. __webpack_require__.r(__webpack_exports__);
  46734. /*!
  46735. * vue-router v3.1.6
  46736. * (c) 2020 Evan You
  46737. * @license MIT
  46738. */
  46739. /* */
  46740. function assert (condition, message) {
  46741. if (!condition) {
  46742. throw new Error(("[vue-router] " + message))
  46743. }
  46744. }
  46745. function warn (condition, message) {
  46746. if ( true && !condition) {
  46747. typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
  46748. }
  46749. }
  46750. function isError (err) {
  46751. return Object.prototype.toString.call(err).indexOf('Error') > -1
  46752. }
  46753. function isExtendedError (constructor, err) {
  46754. return (
  46755. err instanceof constructor ||
  46756. // _name is to support IE9 too
  46757. (err && (err.name === constructor.name || err._name === constructor._name))
  46758. )
  46759. }
  46760. function extend (a, b) {
  46761. for (var key in b) {
  46762. a[key] = b[key];
  46763. }
  46764. return a
  46765. }
  46766. var View = {
  46767. name: 'RouterView',
  46768. functional: true,
  46769. props: {
  46770. name: {
  46771. type: String,
  46772. default: 'default'
  46773. }
  46774. },
  46775. render: function render (_, ref) {
  46776. var props = ref.props;
  46777. var children = ref.children;
  46778. var parent = ref.parent;
  46779. var data = ref.data;
  46780. // used by devtools to display a router-view badge
  46781. data.routerView = true;
  46782. // directly use parent context's createElement() function
  46783. // so that components rendered by router-view can resolve named slots
  46784. var h = parent.$createElement;
  46785. var name = props.name;
  46786. var route = parent.$route;
  46787. var cache = parent._routerViewCache || (parent._routerViewCache = {});
  46788. // determine current view depth, also check to see if the tree
  46789. // has been toggled inactive but kept-alive.
  46790. var depth = 0;
  46791. var inactive = false;
  46792. while (parent && parent._routerRoot !== parent) {
  46793. var vnodeData = parent.$vnode ? parent.$vnode.data : {};
  46794. if (vnodeData.routerView) {
  46795. depth++;
  46796. }
  46797. if (vnodeData.keepAlive && parent._directInactive && parent._inactive) {
  46798. inactive = true;
  46799. }
  46800. parent = parent.$parent;
  46801. }
  46802. data.routerViewDepth = depth;
  46803. // render previous view if the tree is inactive and kept-alive
  46804. if (inactive) {
  46805. var cachedData = cache[name];
  46806. var cachedComponent = cachedData && cachedData.component;
  46807. if (cachedComponent) {
  46808. // #2301
  46809. // pass props
  46810. if (cachedData.configProps) {
  46811. fillPropsinData(cachedComponent, data, cachedData.route, cachedData.configProps);
  46812. }
  46813. return h(cachedComponent, data, children)
  46814. } else {
  46815. // render previous empty view
  46816. return h()
  46817. }
  46818. }
  46819. var matched = route.matched[depth];
  46820. var component = matched && matched.components[name];
  46821. // render empty node if no matched route or no config component
  46822. if (!matched || !component) {
  46823. cache[name] = null;
  46824. return h()
  46825. }
  46826. // cache component
  46827. cache[name] = { component: component };
  46828. // attach instance registration hook
  46829. // this will be called in the instance's injected lifecycle hooks
  46830. data.registerRouteInstance = function (vm, val) {
  46831. // val could be undefined for unregistration
  46832. var current = matched.instances[name];
  46833. if (
  46834. (val && current !== vm) ||
  46835. (!val && current === vm)
  46836. ) {
  46837. matched.instances[name] = val;
  46838. }
  46839. }
  46840. // also register instance in prepatch hook
  46841. // in case the same component instance is reused across different routes
  46842. ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
  46843. matched.instances[name] = vnode.componentInstance;
  46844. };
  46845. // register instance in init hook
  46846. // in case kept-alive component be actived when routes changed
  46847. data.hook.init = function (vnode) {
  46848. if (vnode.data.keepAlive &&
  46849. vnode.componentInstance &&
  46850. vnode.componentInstance !== matched.instances[name]
  46851. ) {
  46852. matched.instances[name] = vnode.componentInstance;
  46853. }
  46854. };
  46855. var configProps = matched.props && matched.props[name];
  46856. // save route and configProps in cachce
  46857. if (configProps) {
  46858. extend(cache[name], {
  46859. route: route,
  46860. configProps: configProps
  46861. });
  46862. fillPropsinData(component, data, route, configProps);
  46863. }
  46864. return h(component, data, children)
  46865. }
  46866. };
  46867. function fillPropsinData (component, data, route, configProps) {
  46868. // resolve props
  46869. var propsToPass = data.props = resolveProps(route, configProps);
  46870. if (propsToPass) {
  46871. // clone to prevent mutation
  46872. propsToPass = data.props = extend({}, propsToPass);
  46873. // pass non-declared props as attrs
  46874. var attrs = data.attrs = data.attrs || {};
  46875. for (var key in propsToPass) {
  46876. if (!component.props || !(key in component.props)) {
  46877. attrs[key] = propsToPass[key];
  46878. delete propsToPass[key];
  46879. }
  46880. }
  46881. }
  46882. }
  46883. function resolveProps (route, config) {
  46884. switch (typeof config) {
  46885. case 'undefined':
  46886. return
  46887. case 'object':
  46888. return config
  46889. case 'function':
  46890. return config(route)
  46891. case 'boolean':
  46892. return config ? route.params : undefined
  46893. default:
  46894. if (true) {
  46895. warn(
  46896. false,
  46897. "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
  46898. "expecting an object, function or boolean."
  46899. );
  46900. }
  46901. }
  46902. }
  46903. /* */
  46904. var encodeReserveRE = /[!'()*]/g;
  46905. var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
  46906. var commaRE = /%2C/g;
  46907. // fixed encodeURIComponent which is more conformant to RFC3986:
  46908. // - escapes [!'()*]
  46909. // - preserve commas
  46910. var encode = function (str) { return encodeURIComponent(str)
  46911. .replace(encodeReserveRE, encodeReserveReplacer)
  46912. .replace(commaRE, ','); };
  46913. var decode = decodeURIComponent;
  46914. function resolveQuery (
  46915. query,
  46916. extraQuery,
  46917. _parseQuery
  46918. ) {
  46919. if ( extraQuery === void 0 ) extraQuery = {};
  46920. var parse = _parseQuery || parseQuery;
  46921. var parsedQuery;
  46922. try {
  46923. parsedQuery = parse(query || '');
  46924. } catch (e) {
  46925. true && warn(false, e.message);
  46926. parsedQuery = {};
  46927. }
  46928. for (var key in extraQuery) {
  46929. parsedQuery[key] = extraQuery[key];
  46930. }
  46931. return parsedQuery
  46932. }
  46933. function parseQuery (query) {
  46934. var res = {};
  46935. query = query.trim().replace(/^(\?|#|&)/, '');
  46936. if (!query) {
  46937. return res
  46938. }
  46939. query.split('&').forEach(function (param) {
  46940. var parts = param.replace(/\+/g, ' ').split('=');
  46941. var key = decode(parts.shift());
  46942. var val = parts.length > 0
  46943. ? decode(parts.join('='))
  46944. : null;
  46945. if (res[key] === undefined) {
  46946. res[key] = val;
  46947. } else if (Array.isArray(res[key])) {
  46948. res[key].push(val);
  46949. } else {
  46950. res[key] = [res[key], val];
  46951. }
  46952. });
  46953. return res
  46954. }
  46955. function stringifyQuery (obj) {
  46956. var res = obj ? Object.keys(obj).map(function (key) {
  46957. var val = obj[key];
  46958. if (val === undefined) {
  46959. return ''
  46960. }
  46961. if (val === null) {
  46962. return encode(key)
  46963. }
  46964. if (Array.isArray(val)) {
  46965. var result = [];
  46966. val.forEach(function (val2) {
  46967. if (val2 === undefined) {
  46968. return
  46969. }
  46970. if (val2 === null) {
  46971. result.push(encode(key));
  46972. } else {
  46973. result.push(encode(key) + '=' + encode(val2));
  46974. }
  46975. });
  46976. return result.join('&')
  46977. }
  46978. return encode(key) + '=' + encode(val)
  46979. }).filter(function (x) { return x.length > 0; }).join('&') : null;
  46980. return res ? ("?" + res) : ''
  46981. }
  46982. /* */
  46983. var trailingSlashRE = /\/?$/;
  46984. function createRoute (
  46985. record,
  46986. location,
  46987. redirectedFrom,
  46988. router
  46989. ) {
  46990. var stringifyQuery = router && router.options.stringifyQuery;
  46991. var query = location.query || {};
  46992. try {
  46993. query = clone(query);
  46994. } catch (e) {}
  46995. var route = {
  46996. name: location.name || (record && record.name),
  46997. meta: (record && record.meta) || {},
  46998. path: location.path || '/',
  46999. hash: location.hash || '',
  47000. query: query,
  47001. params: location.params || {},
  47002. fullPath: getFullPath(location, stringifyQuery),
  47003. matched: record ? formatMatch(record) : []
  47004. };
  47005. if (redirectedFrom) {
  47006. route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery);
  47007. }
  47008. return Object.freeze(route)
  47009. }
  47010. function clone (value) {
  47011. if (Array.isArray(value)) {
  47012. return value.map(clone)
  47013. } else if (value && typeof value === 'object') {
  47014. var res = {};
  47015. for (var key in value) {
  47016. res[key] = clone(value[key]);
  47017. }
  47018. return res
  47019. } else {
  47020. return value
  47021. }
  47022. }
  47023. // the starting route that represents the initial state
  47024. var START = createRoute(null, {
  47025. path: '/'
  47026. });
  47027. function formatMatch (record) {
  47028. var res = [];
  47029. while (record) {
  47030. res.unshift(record);
  47031. record = record.parent;
  47032. }
  47033. return res
  47034. }
  47035. function getFullPath (
  47036. ref,
  47037. _stringifyQuery
  47038. ) {
  47039. var path = ref.path;
  47040. var query = ref.query; if ( query === void 0 ) query = {};
  47041. var hash = ref.hash; if ( hash === void 0 ) hash = '';
  47042. var stringify = _stringifyQuery || stringifyQuery;
  47043. return (path || '/') + stringify(query) + hash
  47044. }
  47045. function isSameRoute (a, b) {
  47046. if (b === START) {
  47047. return a === b
  47048. } else if (!b) {
  47049. return false
  47050. } else if (a.path && b.path) {
  47051. return (
  47052. a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
  47053. a.hash === b.hash &&
  47054. isObjectEqual(a.query, b.query)
  47055. )
  47056. } else if (a.name && b.name) {
  47057. return (
  47058. a.name === b.name &&
  47059. a.hash === b.hash &&
  47060. isObjectEqual(a.query, b.query) &&
  47061. isObjectEqual(a.params, b.params)
  47062. )
  47063. } else {
  47064. return false
  47065. }
  47066. }
  47067. function isObjectEqual (a, b) {
  47068. if ( a === void 0 ) a = {};
  47069. if ( b === void 0 ) b = {};
  47070. // handle null value #1566
  47071. if (!a || !b) { return a === b }
  47072. var aKeys = Object.keys(a);
  47073. var bKeys = Object.keys(b);
  47074. if (aKeys.length !== bKeys.length) {
  47075. return false
  47076. }
  47077. return aKeys.every(function (key) {
  47078. var aVal = a[key];
  47079. var bVal = b[key];
  47080. // check nested equality
  47081. if (typeof aVal === 'object' && typeof bVal === 'object') {
  47082. return isObjectEqual(aVal, bVal)
  47083. }
  47084. return String(aVal) === String(bVal)
  47085. })
  47086. }
  47087. function isIncludedRoute (current, target) {
  47088. return (
  47089. current.path.replace(trailingSlashRE, '/').indexOf(
  47090. target.path.replace(trailingSlashRE, '/')
  47091. ) === 0 &&
  47092. (!target.hash || current.hash === target.hash) &&
  47093. queryIncludes(current.query, target.query)
  47094. )
  47095. }
  47096. function queryIncludes (current, target) {
  47097. for (var key in target) {
  47098. if (!(key in current)) {
  47099. return false
  47100. }
  47101. }
  47102. return true
  47103. }
  47104. /* */
  47105. function resolvePath (
  47106. relative,
  47107. base,
  47108. append
  47109. ) {
  47110. var firstChar = relative.charAt(0);
  47111. if (firstChar === '/') {
  47112. return relative
  47113. }
  47114. if (firstChar === '?' || firstChar === '#') {
  47115. return base + relative
  47116. }
  47117. var stack = base.split('/');
  47118. // remove trailing segment if:
  47119. // - not appending
  47120. // - appending to trailing slash (last segment is empty)
  47121. if (!append || !stack[stack.length - 1]) {
  47122. stack.pop();
  47123. }
  47124. // resolve relative path
  47125. var segments = relative.replace(/^\//, '').split('/');
  47126. for (var i = 0; i < segments.length; i++) {
  47127. var segment = segments[i];
  47128. if (segment === '..') {
  47129. stack.pop();
  47130. } else if (segment !== '.') {
  47131. stack.push(segment);
  47132. }
  47133. }
  47134. // ensure leading slash
  47135. if (stack[0] !== '') {
  47136. stack.unshift('');
  47137. }
  47138. return stack.join('/')
  47139. }
  47140. function parsePath (path) {
  47141. var hash = '';
  47142. var query = '';
  47143. var hashIndex = path.indexOf('#');
  47144. if (hashIndex >= 0) {
  47145. hash = path.slice(hashIndex);
  47146. path = path.slice(0, hashIndex);
  47147. }
  47148. var queryIndex = path.indexOf('?');
  47149. if (queryIndex >= 0) {
  47150. query = path.slice(queryIndex + 1);
  47151. path = path.slice(0, queryIndex);
  47152. }
  47153. return {
  47154. path: path,
  47155. query: query,
  47156. hash: hash
  47157. }
  47158. }
  47159. function cleanPath (path) {
  47160. return path.replace(/\/\//g, '/')
  47161. }
  47162. var isarray = Array.isArray || function (arr) {
  47163. return Object.prototype.toString.call(arr) == '[object Array]';
  47164. };
  47165. /**
  47166. * Expose `pathToRegexp`.
  47167. */
  47168. var pathToRegexp_1 = pathToRegexp;
  47169. var parse_1 = parse;
  47170. var compile_1 = compile;
  47171. var tokensToFunction_1 = tokensToFunction;
  47172. var tokensToRegExp_1 = tokensToRegExp;
  47173. /**
  47174. * The main path matching regexp utility.
  47175. *
  47176. * @type {RegExp}
  47177. */
  47178. var PATH_REGEXP = new RegExp([
  47179. // Match escaped characters that would otherwise appear in future matches.
  47180. // This allows the user to escape special characters that won't transform.
  47181. '(\\\\.)',
  47182. // Match Express-style parameters and un-named parameters with a prefix
  47183. // and optional suffixes. Matches appear as:
  47184. //
  47185. // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
  47186. // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
  47187. // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
  47188. '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
  47189. ].join('|'), 'g');
  47190. /**
  47191. * Parse a string for the raw tokens.
  47192. *
  47193. * @param {string} str
  47194. * @param {Object=} options
  47195. * @return {!Array}
  47196. */
  47197. function parse (str, options) {
  47198. var tokens = [];
  47199. var key = 0;
  47200. var index = 0;
  47201. var path = '';
  47202. var defaultDelimiter = options && options.delimiter || '/';
  47203. var res;
  47204. while ((res = PATH_REGEXP.exec(str)) != null) {
  47205. var m = res[0];
  47206. var escaped = res[1];
  47207. var offset = res.index;
  47208. path += str.slice(index, offset);
  47209. index = offset + m.length;
  47210. // Ignore already escaped sequences.
  47211. if (escaped) {
  47212. path += escaped[1];
  47213. continue
  47214. }
  47215. var next = str[index];
  47216. var prefix = res[2];
  47217. var name = res[3];
  47218. var capture = res[4];
  47219. var group = res[5];
  47220. var modifier = res[6];
  47221. var asterisk = res[7];
  47222. // Push the current path onto the tokens.
  47223. if (path) {
  47224. tokens.push(path);
  47225. path = '';
  47226. }
  47227. var partial = prefix != null && next != null && next !== prefix;
  47228. var repeat = modifier === '+' || modifier === '*';
  47229. var optional = modifier === '?' || modifier === '*';
  47230. var delimiter = res[2] || defaultDelimiter;
  47231. var pattern = capture || group;
  47232. tokens.push({
  47233. name: name || key++,
  47234. prefix: prefix || '',
  47235. delimiter: delimiter,
  47236. optional: optional,
  47237. repeat: repeat,
  47238. partial: partial,
  47239. asterisk: !!asterisk,
  47240. pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
  47241. });
  47242. }
  47243. // Match any characters still remaining.
  47244. if (index < str.length) {
  47245. path += str.substr(index);
  47246. }
  47247. // If the path exists, push it onto the end.
  47248. if (path) {
  47249. tokens.push(path);
  47250. }
  47251. return tokens
  47252. }
  47253. /**
  47254. * Compile a string to a template function for the path.
  47255. *
  47256. * @param {string} str
  47257. * @param {Object=} options
  47258. * @return {!function(Object=, Object=)}
  47259. */
  47260. function compile (str, options) {
  47261. return tokensToFunction(parse(str, options))
  47262. }
  47263. /**
  47264. * Prettier encoding of URI path segments.
  47265. *
  47266. * @param {string}
  47267. * @return {string}
  47268. */
  47269. function encodeURIComponentPretty (str) {
  47270. return encodeURI(str).replace(/[\/?#]/g, function (c) {
  47271. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  47272. })
  47273. }
  47274. /**
  47275. * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
  47276. *
  47277. * @param {string}
  47278. * @return {string}
  47279. */
  47280. function encodeAsterisk (str) {
  47281. return encodeURI(str).replace(/[?#]/g, function (c) {
  47282. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  47283. })
  47284. }
  47285. /**
  47286. * Expose a method for transforming tokens into the path function.
  47287. */
  47288. function tokensToFunction (tokens) {
  47289. // Compile all the tokens into regexps.
  47290. var matches = new Array(tokens.length);
  47291. // Compile all the patterns before compilation.
  47292. for (var i = 0; i < tokens.length; i++) {
  47293. if (typeof tokens[i] === 'object') {
  47294. matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
  47295. }
  47296. }
  47297. return function (obj, opts) {
  47298. var path = '';
  47299. var data = obj || {};
  47300. var options = opts || {};
  47301. var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
  47302. for (var i = 0; i < tokens.length; i++) {
  47303. var token = tokens[i];
  47304. if (typeof token === 'string') {
  47305. path += token;
  47306. continue
  47307. }
  47308. var value = data[token.name];
  47309. var segment;
  47310. if (value == null) {
  47311. if (token.optional) {
  47312. // Prepend partial segment prefixes.
  47313. if (token.partial) {
  47314. path += token.prefix;
  47315. }
  47316. continue
  47317. } else {
  47318. throw new TypeError('Expected "' + token.name + '" to be defined')
  47319. }
  47320. }
  47321. if (isarray(value)) {
  47322. if (!token.repeat) {
  47323. throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
  47324. }
  47325. if (value.length === 0) {
  47326. if (token.optional) {
  47327. continue
  47328. } else {
  47329. throw new TypeError('Expected "' + token.name + '" to not be empty')
  47330. }
  47331. }
  47332. for (var j = 0; j < value.length; j++) {
  47333. segment = encode(value[j]);
  47334. if (!matches[i].test(segment)) {
  47335. throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
  47336. }
  47337. path += (j === 0 ? token.prefix : token.delimiter) + segment;
  47338. }
  47339. continue
  47340. }
  47341. segment = token.asterisk ? encodeAsterisk(value) : encode(value);
  47342. if (!matches[i].test(segment)) {
  47343. throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
  47344. }
  47345. path += token.prefix + segment;
  47346. }
  47347. return path
  47348. }
  47349. }
  47350. /**
  47351. * Escape a regular expression string.
  47352. *
  47353. * @param {string} str
  47354. * @return {string}
  47355. */
  47356. function escapeString (str) {
  47357. return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
  47358. }
  47359. /**
  47360. * Escape the capturing group by escaping special characters and meaning.
  47361. *
  47362. * @param {string} group
  47363. * @return {string}
  47364. */
  47365. function escapeGroup (group) {
  47366. return group.replace(/([=!:$\/()])/g, '\\$1')
  47367. }
  47368. /**
  47369. * Attach the keys as a property of the regexp.
  47370. *
  47371. * @param {!RegExp} re
  47372. * @param {Array} keys
  47373. * @return {!RegExp}
  47374. */
  47375. function attachKeys (re, keys) {
  47376. re.keys = keys;
  47377. return re
  47378. }
  47379. /**
  47380. * Get the flags for a regexp from the options.
  47381. *
  47382. * @param {Object} options
  47383. * @return {string}
  47384. */
  47385. function flags (options) {
  47386. return options.sensitive ? '' : 'i'
  47387. }
  47388. /**
  47389. * Pull out keys from a regexp.
  47390. *
  47391. * @param {!RegExp} path
  47392. * @param {!Array} keys
  47393. * @return {!RegExp}
  47394. */
  47395. function regexpToRegexp (path, keys) {
  47396. // Use a negative lookahead to match only capturing groups.
  47397. var groups = path.source.match(/\((?!\?)/g);
  47398. if (groups) {
  47399. for (var i = 0; i < groups.length; i++) {
  47400. keys.push({
  47401. name: i,
  47402. prefix: null,
  47403. delimiter: null,
  47404. optional: false,
  47405. repeat: false,
  47406. partial: false,
  47407. asterisk: false,
  47408. pattern: null
  47409. });
  47410. }
  47411. }
  47412. return attachKeys(path, keys)
  47413. }
  47414. /**
  47415. * Transform an array into a regexp.
  47416. *
  47417. * @param {!Array} path
  47418. * @param {Array} keys
  47419. * @param {!Object} options
  47420. * @return {!RegExp}
  47421. */
  47422. function arrayToRegexp (path, keys, options) {
  47423. var parts = [];
  47424. for (var i = 0; i < path.length; i++) {
  47425. parts.push(pathToRegexp(path[i], keys, options).source);
  47426. }
  47427. var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
  47428. return attachKeys(regexp, keys)
  47429. }
  47430. /**
  47431. * Create a path regexp from string input.
  47432. *
  47433. * @param {string} path
  47434. * @param {!Array} keys
  47435. * @param {!Object} options
  47436. * @return {!RegExp}
  47437. */
  47438. function stringToRegexp (path, keys, options) {
  47439. return tokensToRegExp(parse(path, options), keys, options)
  47440. }
  47441. /**
  47442. * Expose a function for taking tokens and returning a RegExp.
  47443. *
  47444. * @param {!Array} tokens
  47445. * @param {(Array|Object)=} keys
  47446. * @param {Object=} options
  47447. * @return {!RegExp}
  47448. */
  47449. function tokensToRegExp (tokens, keys, options) {
  47450. if (!isarray(keys)) {
  47451. options = /** @type {!Object} */ (keys || options);
  47452. keys = [];
  47453. }
  47454. options = options || {};
  47455. var strict = options.strict;
  47456. var end = options.end !== false;
  47457. var route = '';
  47458. // Iterate over the tokens and create our regexp string.
  47459. for (var i = 0; i < tokens.length; i++) {
  47460. var token = tokens[i];
  47461. if (typeof token === 'string') {
  47462. route += escapeString(token);
  47463. } else {
  47464. var prefix = escapeString(token.prefix);
  47465. var capture = '(?:' + token.pattern + ')';
  47466. keys.push(token);
  47467. if (token.repeat) {
  47468. capture += '(?:' + prefix + capture + ')*';
  47469. }
  47470. if (token.optional) {
  47471. if (!token.partial) {
  47472. capture = '(?:' + prefix + '(' + capture + '))?';
  47473. } else {
  47474. capture = prefix + '(' + capture + ')?';
  47475. }
  47476. } else {
  47477. capture = prefix + '(' + capture + ')';
  47478. }
  47479. route += capture;
  47480. }
  47481. }
  47482. var delimiter = escapeString(options.delimiter || '/');
  47483. var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
  47484. // In non-strict mode we allow a slash at the end of match. If the path to
  47485. // match already ends with a slash, we remove it for consistency. The slash
  47486. // is valid at the end of a path match, not in the middle. This is important
  47487. // in non-ending mode, where "/test/" shouldn't match "/test//route".
  47488. if (!strict) {
  47489. route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
  47490. }
  47491. if (end) {
  47492. route += '$';
  47493. } else {
  47494. // In non-ending mode, we need the capturing groups to match as much as
  47495. // possible by using a positive lookahead to the end or next path segment.
  47496. route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
  47497. }
  47498. return attachKeys(new RegExp('^' + route, flags(options)), keys)
  47499. }
  47500. /**
  47501. * Normalize the given path string, returning a regular expression.
  47502. *
  47503. * An empty array can be passed in for the keys, which will hold the
  47504. * placeholder key descriptions. For example, using `/user/:id`, `keys` will
  47505. * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  47506. *
  47507. * @param {(string|RegExp|Array)} path
  47508. * @param {(Array|Object)=} keys
  47509. * @param {Object=} options
  47510. * @return {!RegExp}
  47511. */
  47512. function pathToRegexp (path, keys, options) {
  47513. if (!isarray(keys)) {
  47514. options = /** @type {!Object} */ (keys || options);
  47515. keys = [];
  47516. }
  47517. options = options || {};
  47518. if (path instanceof RegExp) {
  47519. return regexpToRegexp(path, /** @type {!Array} */ (keys))
  47520. }
  47521. if (isarray(path)) {
  47522. return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
  47523. }
  47524. return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
  47525. }
  47526. pathToRegexp_1.parse = parse_1;
  47527. pathToRegexp_1.compile = compile_1;
  47528. pathToRegexp_1.tokensToFunction = tokensToFunction_1;
  47529. pathToRegexp_1.tokensToRegExp = tokensToRegExp_1;
  47530. /* */
  47531. // $flow-disable-line
  47532. var regexpCompileCache = Object.create(null);
  47533. function fillParams (
  47534. path,
  47535. params,
  47536. routeMsg
  47537. ) {
  47538. params = params || {};
  47539. try {
  47540. var filler =
  47541. regexpCompileCache[path] ||
  47542. (regexpCompileCache[path] = pathToRegexp_1.compile(path));
  47543. // Fix #2505 resolving asterisk routes { name: 'not-found', params: { pathMatch: '/not-found' }}
  47544. // and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string
  47545. if (typeof params.pathMatch === 'string') { params[0] = params.pathMatch; }
  47546. return filler(params, { pretty: true })
  47547. } catch (e) {
  47548. if (true) {
  47549. // Fix #3072 no warn if `pathMatch` is string
  47550. warn(typeof params.pathMatch === 'string', ("missing param for " + routeMsg + ": " + (e.message)));
  47551. }
  47552. return ''
  47553. } finally {
  47554. // delete the 0 if it was added
  47555. delete params[0];
  47556. }
  47557. }
  47558. /* */
  47559. function normalizeLocation (
  47560. raw,
  47561. current,
  47562. append,
  47563. router
  47564. ) {
  47565. var next = typeof raw === 'string' ? { path: raw } : raw;
  47566. // named target
  47567. if (next._normalized) {
  47568. return next
  47569. } else if (next.name) {
  47570. next = extend({}, raw);
  47571. var params = next.params;
  47572. if (params && typeof params === 'object') {
  47573. next.params = extend({}, params);
  47574. }
  47575. return next
  47576. }
  47577. // relative params
  47578. if (!next.path && next.params && current) {
  47579. next = extend({}, next);
  47580. next._normalized = true;
  47581. var params$1 = extend(extend({}, current.params), next.params);
  47582. if (current.name) {
  47583. next.name = current.name;
  47584. next.params = params$1;
  47585. } else if (current.matched.length) {
  47586. var rawPath = current.matched[current.matched.length - 1].path;
  47587. next.path = fillParams(rawPath, params$1, ("path " + (current.path)));
  47588. } else if (true) {
  47589. warn(false, "relative params navigation requires a current route.");
  47590. }
  47591. return next
  47592. }
  47593. var parsedPath = parsePath(next.path || '');
  47594. var basePath = (current && current.path) || '/';
  47595. var path = parsedPath.path
  47596. ? resolvePath(parsedPath.path, basePath, append || next.append)
  47597. : basePath;
  47598. var query = resolveQuery(
  47599. parsedPath.query,
  47600. next.query,
  47601. router && router.options.parseQuery
  47602. );
  47603. var hash = next.hash || parsedPath.hash;
  47604. if (hash && hash.charAt(0) !== '#') {
  47605. hash = "#" + hash;
  47606. }
  47607. return {
  47608. _normalized: true,
  47609. path: path,
  47610. query: query,
  47611. hash: hash
  47612. }
  47613. }
  47614. /* */
  47615. // work around weird flow bug
  47616. var toTypes = [String, Object];
  47617. var eventTypes = [String, Array];
  47618. var noop = function () {};
  47619. var Link = {
  47620. name: 'RouterLink',
  47621. props: {
  47622. to: {
  47623. type: toTypes,
  47624. required: true
  47625. },
  47626. tag: {
  47627. type: String,
  47628. default: 'a'
  47629. },
  47630. exact: Boolean,
  47631. append: Boolean,
  47632. replace: Boolean,
  47633. activeClass: String,
  47634. exactActiveClass: String,
  47635. event: {
  47636. type: eventTypes,
  47637. default: 'click'
  47638. }
  47639. },
  47640. render: function render (h) {
  47641. var this$1 = this;
  47642. var router = this.$router;
  47643. var current = this.$route;
  47644. var ref = router.resolve(
  47645. this.to,
  47646. current,
  47647. this.append
  47648. );
  47649. var location = ref.location;
  47650. var route = ref.route;
  47651. var href = ref.href;
  47652. var classes = {};
  47653. var globalActiveClass = router.options.linkActiveClass;
  47654. var globalExactActiveClass = router.options.linkExactActiveClass;
  47655. // Support global empty active class
  47656. var activeClassFallback =
  47657. globalActiveClass == null ? 'router-link-active' : globalActiveClass;
  47658. var exactActiveClassFallback =
  47659. globalExactActiveClass == null
  47660. ? 'router-link-exact-active'
  47661. : globalExactActiveClass;
  47662. var activeClass =
  47663. this.activeClass == null ? activeClassFallback : this.activeClass;
  47664. var exactActiveClass =
  47665. this.exactActiveClass == null
  47666. ? exactActiveClassFallback
  47667. : this.exactActiveClass;
  47668. var compareTarget = route.redirectedFrom
  47669. ? createRoute(null, normalizeLocation(route.redirectedFrom), null, router)
  47670. : route;
  47671. classes[exactActiveClass] = isSameRoute(current, compareTarget);
  47672. classes[activeClass] = this.exact
  47673. ? classes[exactActiveClass]
  47674. : isIncludedRoute(current, compareTarget);
  47675. var handler = function (e) {
  47676. if (guardEvent(e)) {
  47677. if (this$1.replace) {
  47678. router.replace(location, noop);
  47679. } else {
  47680. router.push(location, noop);
  47681. }
  47682. }
  47683. };
  47684. var on = { click: guardEvent };
  47685. if (Array.isArray(this.event)) {
  47686. this.event.forEach(function (e) {
  47687. on[e] = handler;
  47688. });
  47689. } else {
  47690. on[this.event] = handler;
  47691. }
  47692. var data = { class: classes };
  47693. var scopedSlot =
  47694. !this.$scopedSlots.$hasNormal &&
  47695. this.$scopedSlots.default &&
  47696. this.$scopedSlots.default({
  47697. href: href,
  47698. route: route,
  47699. navigate: handler,
  47700. isActive: classes[activeClass],
  47701. isExactActive: classes[exactActiveClass]
  47702. });
  47703. if (scopedSlot) {
  47704. if (scopedSlot.length === 1) {
  47705. return scopedSlot[0]
  47706. } else if (scopedSlot.length > 1 || !scopedSlot.length) {
  47707. if (true) {
  47708. warn(
  47709. false,
  47710. ("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.")
  47711. );
  47712. }
  47713. return scopedSlot.length === 0 ? h() : h('span', {}, scopedSlot)
  47714. }
  47715. }
  47716. if (this.tag === 'a') {
  47717. data.on = on;
  47718. data.attrs = { href: href };
  47719. } else {
  47720. // find the first <a> child and apply listener and href
  47721. var a = findAnchor(this.$slots.default);
  47722. if (a) {
  47723. // in case the <a> is a static node
  47724. a.isStatic = false;
  47725. var aData = (a.data = extend({}, a.data));
  47726. aData.on = aData.on || {};
  47727. // transform existing events in both objects into arrays so we can push later
  47728. for (var event in aData.on) {
  47729. var handler$1 = aData.on[event];
  47730. if (event in on) {
  47731. aData.on[event] = Array.isArray(handler$1) ? handler$1 : [handler$1];
  47732. }
  47733. }
  47734. // append new listeners for router-link
  47735. for (var event$1 in on) {
  47736. if (event$1 in aData.on) {
  47737. // on[event] is always a function
  47738. aData.on[event$1].push(on[event$1]);
  47739. } else {
  47740. aData.on[event$1] = handler;
  47741. }
  47742. }
  47743. var aAttrs = (a.data.attrs = extend({}, a.data.attrs));
  47744. aAttrs.href = href;
  47745. } else {
  47746. // doesn't have <a> child, apply listener to self
  47747. data.on = on;
  47748. }
  47749. }
  47750. return h(this.tag, data, this.$slots.default)
  47751. }
  47752. };
  47753. function guardEvent (e) {
  47754. // don't redirect with control keys
  47755. if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
  47756. // don't redirect when preventDefault called
  47757. if (e.defaultPrevented) { return }
  47758. // don't redirect on right click
  47759. if (e.button !== undefined && e.button !== 0) { return }
  47760. // don't redirect if `target="_blank"`
  47761. if (e.currentTarget && e.currentTarget.getAttribute) {
  47762. var target = e.currentTarget.getAttribute('target');
  47763. if (/\b_blank\b/i.test(target)) { return }
  47764. }
  47765. // this may be a Weex event which doesn't have this method
  47766. if (e.preventDefault) {
  47767. e.preventDefault();
  47768. }
  47769. return true
  47770. }
  47771. function findAnchor (children) {
  47772. if (children) {
  47773. var child;
  47774. for (var i = 0; i < children.length; i++) {
  47775. child = children[i];
  47776. if (child.tag === 'a') {
  47777. return child
  47778. }
  47779. if (child.children && (child = findAnchor(child.children))) {
  47780. return child
  47781. }
  47782. }
  47783. }
  47784. }
  47785. var _Vue;
  47786. function install (Vue) {
  47787. if (install.installed && _Vue === Vue) { return }
  47788. install.installed = true;
  47789. _Vue = Vue;
  47790. var isDef = function (v) { return v !== undefined; };
  47791. var registerInstance = function (vm, callVal) {
  47792. var i = vm.$options._parentVnode;
  47793. if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
  47794. i(vm, callVal);
  47795. }
  47796. };
  47797. Vue.mixin({
  47798. beforeCreate: function beforeCreate () {
  47799. if (isDef(this.$options.router)) {
  47800. this._routerRoot = this;
  47801. this._router = this.$options.router;
  47802. this._router.init(this);
  47803. Vue.util.defineReactive(this, '_route', this._router.history.current);
  47804. } else {
  47805. this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
  47806. }
  47807. registerInstance(this, this);
  47808. },
  47809. destroyed: function destroyed () {
  47810. registerInstance(this);
  47811. }
  47812. });
  47813. Object.defineProperty(Vue.prototype, '$router', {
  47814. get: function get () { return this._routerRoot._router }
  47815. });
  47816. Object.defineProperty(Vue.prototype, '$route', {
  47817. get: function get () { return this._routerRoot._route }
  47818. });
  47819. Vue.component('RouterView', View);
  47820. Vue.component('RouterLink', Link);
  47821. var strats = Vue.config.optionMergeStrategies;
  47822. // use the same hook merging strategy for route hooks
  47823. strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
  47824. }
  47825. /* */
  47826. var inBrowser = typeof window !== 'undefined';
  47827. /* */
  47828. function createRouteMap (
  47829. routes,
  47830. oldPathList,
  47831. oldPathMap,
  47832. oldNameMap
  47833. ) {
  47834. // the path list is used to control path matching priority
  47835. var pathList = oldPathList || [];
  47836. // $flow-disable-line
  47837. var pathMap = oldPathMap || Object.create(null);
  47838. // $flow-disable-line
  47839. var nameMap = oldNameMap || Object.create(null);
  47840. routes.forEach(function (route) {
  47841. addRouteRecord(pathList, pathMap, nameMap, route);
  47842. });
  47843. // ensure wildcard routes are always at the end
  47844. for (var i = 0, l = pathList.length; i < l; i++) {
  47845. if (pathList[i] === '*') {
  47846. pathList.push(pathList.splice(i, 1)[0]);
  47847. l--;
  47848. i--;
  47849. }
  47850. }
  47851. if (true) {
  47852. // warn if routes do not include leading slashes
  47853. var found = pathList
  47854. // check for missing leading slash
  47855. .filter(function (path) { return path && path.charAt(0) !== '*' && path.charAt(0) !== '/'; });
  47856. if (found.length > 0) {
  47857. var pathNames = found.map(function (path) { return ("- " + path); }).join('\n');
  47858. warn(false, ("Non-nested routes must include a leading slash character. Fix the following routes: \n" + pathNames));
  47859. }
  47860. }
  47861. return {
  47862. pathList: pathList,
  47863. pathMap: pathMap,
  47864. nameMap: nameMap
  47865. }
  47866. }
  47867. function addRouteRecord (
  47868. pathList,
  47869. pathMap,
  47870. nameMap,
  47871. route,
  47872. parent,
  47873. matchAs
  47874. ) {
  47875. var path = route.path;
  47876. var name = route.name;
  47877. if (true) {
  47878. assert(path != null, "\"path\" is required in a route configuration.");
  47879. assert(
  47880. typeof route.component !== 'string',
  47881. "route config \"component\" for path: " + (String(
  47882. path || name
  47883. )) + " cannot be a " + "string id. Use an actual component instead."
  47884. );
  47885. }
  47886. var pathToRegexpOptions =
  47887. route.pathToRegexpOptions || {};
  47888. var normalizedPath = normalizePath(path, parent, pathToRegexpOptions.strict);
  47889. if (typeof route.caseSensitive === 'boolean') {
  47890. pathToRegexpOptions.sensitive = route.caseSensitive;
  47891. }
  47892. var record = {
  47893. path: normalizedPath,
  47894. regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
  47895. components: route.components || { default: route.component },
  47896. instances: {},
  47897. name: name,
  47898. parent: parent,
  47899. matchAs: matchAs,
  47900. redirect: route.redirect,
  47901. beforeEnter: route.beforeEnter,
  47902. meta: route.meta || {},
  47903. props:
  47904. route.props == null
  47905. ? {}
  47906. : route.components
  47907. ? route.props
  47908. : { default: route.props }
  47909. };
  47910. if (route.children) {
  47911. // Warn if route is named, does not redirect and has a default child route.
  47912. // If users navigate to this route by name, the default child will
  47913. // not be rendered (GH Issue #629)
  47914. if (true) {
  47915. if (
  47916. route.name &&
  47917. !route.redirect &&
  47918. route.children.some(function (child) { return /^\/?$/.test(child.path); })
  47919. ) {
  47920. warn(
  47921. false,
  47922. "Named Route '" + (route.name) + "' has a default child route. " +
  47923. "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " +
  47924. "the default child route will not be rendered. Remove the name from " +
  47925. "this route and use the name of the default child route for named " +
  47926. "links instead."
  47927. );
  47928. }
  47929. }
  47930. route.children.forEach(function (child) {
  47931. var childMatchAs = matchAs
  47932. ? cleanPath((matchAs + "/" + (child.path)))
  47933. : undefined;
  47934. addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
  47935. });
  47936. }
  47937. if (!pathMap[record.path]) {
  47938. pathList.push(record.path);
  47939. pathMap[record.path] = record;
  47940. }
  47941. if (route.alias !== undefined) {
  47942. var aliases = Array.isArray(route.alias) ? route.alias : [route.alias];
  47943. for (var i = 0; i < aliases.length; ++i) {
  47944. var alias = aliases[i];
  47945. if ( true && alias === path) {
  47946. warn(
  47947. false,
  47948. ("Found an alias with the same value as the path: \"" + path + "\". You have to remove that alias. It will be ignored in development.")
  47949. );
  47950. // skip in dev to make it work
  47951. continue
  47952. }
  47953. var aliasRoute = {
  47954. path: alias,
  47955. children: route.children
  47956. };
  47957. addRouteRecord(
  47958. pathList,
  47959. pathMap,
  47960. nameMap,
  47961. aliasRoute,
  47962. parent,
  47963. record.path || '/' // matchAs
  47964. );
  47965. }
  47966. }
  47967. if (name) {
  47968. if (!nameMap[name]) {
  47969. nameMap[name] = record;
  47970. } else if ( true && !matchAs) {
  47971. warn(
  47972. false,
  47973. "Duplicate named routes definition: " +
  47974. "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
  47975. );
  47976. }
  47977. }
  47978. }
  47979. function compileRouteRegex (
  47980. path,
  47981. pathToRegexpOptions
  47982. ) {
  47983. var regex = pathToRegexp_1(path, [], pathToRegexpOptions);
  47984. if (true) {
  47985. var keys = Object.create(null);
  47986. regex.keys.forEach(function (key) {
  47987. warn(
  47988. !keys[key.name],
  47989. ("Duplicate param keys in route with path: \"" + path + "\"")
  47990. );
  47991. keys[key.name] = true;
  47992. });
  47993. }
  47994. return regex
  47995. }
  47996. function normalizePath (
  47997. path,
  47998. parent,
  47999. strict
  48000. ) {
  48001. if (!strict) { path = path.replace(/\/$/, ''); }
  48002. if (path[0] === '/') { return path }
  48003. if (parent == null) { return path }
  48004. return cleanPath(((parent.path) + "/" + path))
  48005. }
  48006. /* */
  48007. function createMatcher (
  48008. routes,
  48009. router
  48010. ) {
  48011. var ref = createRouteMap(routes);
  48012. var pathList = ref.pathList;
  48013. var pathMap = ref.pathMap;
  48014. var nameMap = ref.nameMap;
  48015. function addRoutes (routes) {
  48016. createRouteMap(routes, pathList, pathMap, nameMap);
  48017. }
  48018. function match (
  48019. raw,
  48020. currentRoute,
  48021. redirectedFrom
  48022. ) {
  48023. var location = normalizeLocation(raw, currentRoute, false, router);
  48024. var name = location.name;
  48025. if (name) {
  48026. var record = nameMap[name];
  48027. if (true) {
  48028. warn(record, ("Route with name '" + name + "' does not exist"));
  48029. }
  48030. if (!record) { return _createRoute(null, location) }
  48031. var paramNames = record.regex.keys
  48032. .filter(function (key) { return !key.optional; })
  48033. .map(function (key) { return key.name; });
  48034. if (typeof location.params !== 'object') {
  48035. location.params = {};
  48036. }
  48037. if (currentRoute && typeof currentRoute.params === 'object') {
  48038. for (var key in currentRoute.params) {
  48039. if (!(key in location.params) && paramNames.indexOf(key) > -1) {
  48040. location.params[key] = currentRoute.params[key];
  48041. }
  48042. }
  48043. }
  48044. location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
  48045. return _createRoute(record, location, redirectedFrom)
  48046. } else if (location.path) {
  48047. location.params = {};
  48048. for (var i = 0; i < pathList.length; i++) {
  48049. var path = pathList[i];
  48050. var record$1 = pathMap[path];
  48051. if (matchRoute(record$1.regex, location.path, location.params)) {
  48052. return _createRoute(record$1, location, redirectedFrom)
  48053. }
  48054. }
  48055. }
  48056. // no match
  48057. return _createRoute(null, location)
  48058. }
  48059. function redirect (
  48060. record,
  48061. location
  48062. ) {
  48063. var originalRedirect = record.redirect;
  48064. var redirect = typeof originalRedirect === 'function'
  48065. ? originalRedirect(createRoute(record, location, null, router))
  48066. : originalRedirect;
  48067. if (typeof redirect === 'string') {
  48068. redirect = { path: redirect };
  48069. }
  48070. if (!redirect || typeof redirect !== 'object') {
  48071. if (true) {
  48072. warn(
  48073. false, ("invalid redirect option: " + (JSON.stringify(redirect)))
  48074. );
  48075. }
  48076. return _createRoute(null, location)
  48077. }
  48078. var re = redirect;
  48079. var name = re.name;
  48080. var path = re.path;
  48081. var query = location.query;
  48082. var hash = location.hash;
  48083. var params = location.params;
  48084. query = re.hasOwnProperty('query') ? re.query : query;
  48085. hash = re.hasOwnProperty('hash') ? re.hash : hash;
  48086. params = re.hasOwnProperty('params') ? re.params : params;
  48087. if (name) {
  48088. // resolved named direct
  48089. var targetRecord = nameMap[name];
  48090. if (true) {
  48091. assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
  48092. }
  48093. return match({
  48094. _normalized: true,
  48095. name: name,
  48096. query: query,
  48097. hash: hash,
  48098. params: params
  48099. }, undefined, location)
  48100. } else if (path) {
  48101. // 1. resolve relative redirect
  48102. var rawPath = resolveRecordPath(path, record);
  48103. // 2. resolve params
  48104. var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
  48105. // 3. rematch with existing query and hash
  48106. return match({
  48107. _normalized: true,
  48108. path: resolvedPath,
  48109. query: query,
  48110. hash: hash
  48111. }, undefined, location)
  48112. } else {
  48113. if (true) {
  48114. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
  48115. }
  48116. return _createRoute(null, location)
  48117. }
  48118. }
  48119. function alias (
  48120. record,
  48121. location,
  48122. matchAs
  48123. ) {
  48124. var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
  48125. var aliasedMatch = match({
  48126. _normalized: true,
  48127. path: aliasedPath
  48128. });
  48129. if (aliasedMatch) {
  48130. var matched = aliasedMatch.matched;
  48131. var aliasedRecord = matched[matched.length - 1];
  48132. location.params = aliasedMatch.params;
  48133. return _createRoute(aliasedRecord, location)
  48134. }
  48135. return _createRoute(null, location)
  48136. }
  48137. function _createRoute (
  48138. record,
  48139. location,
  48140. redirectedFrom
  48141. ) {
  48142. if (record && record.redirect) {
  48143. return redirect(record, redirectedFrom || location)
  48144. }
  48145. if (record && record.matchAs) {
  48146. return alias(record, location, record.matchAs)
  48147. }
  48148. return createRoute(record, location, redirectedFrom, router)
  48149. }
  48150. return {
  48151. match: match,
  48152. addRoutes: addRoutes
  48153. }
  48154. }
  48155. function matchRoute (
  48156. regex,
  48157. path,
  48158. params
  48159. ) {
  48160. var m = path.match(regex);
  48161. if (!m) {
  48162. return false
  48163. } else if (!params) {
  48164. return true
  48165. }
  48166. for (var i = 1, len = m.length; i < len; ++i) {
  48167. var key = regex.keys[i - 1];
  48168. var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
  48169. if (key) {
  48170. // Fix #1994: using * with props: true generates a param named 0
  48171. params[key.name || 'pathMatch'] = val;
  48172. }
  48173. }
  48174. return true
  48175. }
  48176. function resolveRecordPath (path, record) {
  48177. return resolvePath(path, record.parent ? record.parent.path : '/', true)
  48178. }
  48179. /* */
  48180. // use User Timing api (if present) for more accurate key precision
  48181. var Time =
  48182. inBrowser && window.performance && window.performance.now
  48183. ? window.performance
  48184. : Date;
  48185. function genStateKey () {
  48186. return Time.now().toFixed(3)
  48187. }
  48188. var _key = genStateKey();
  48189. function getStateKey () {
  48190. return _key
  48191. }
  48192. function setStateKey (key) {
  48193. return (_key = key)
  48194. }
  48195. /* */
  48196. var positionStore = Object.create(null);
  48197. function setupScroll () {
  48198. // Fix for #1585 for Firefox
  48199. // Fix for #2195 Add optional third attribute to workaround a bug in safari https://bugs.webkit.org/show_bug.cgi?id=182678
  48200. // Fix for #2774 Support for apps loaded from Windows file shares not mapped to network drives: replaced location.origin with
  48201. // window.location.protocol + '//' + window.location.host
  48202. // location.host contains the port and location.hostname doesn't
  48203. var protocolAndPath = window.location.protocol + '//' + window.location.host;
  48204. var absolutePath = window.location.href.replace(protocolAndPath, '');
  48205. // preserve existing history state as it could be overriden by the user
  48206. var stateCopy = extend({}, window.history.state);
  48207. stateCopy.key = getStateKey();
  48208. window.history.replaceState(stateCopy, '', absolutePath);
  48209. window.addEventListener('popstate', function (e) {
  48210. saveScrollPosition();
  48211. if (e.state && e.state.key) {
  48212. setStateKey(e.state.key);
  48213. }
  48214. });
  48215. }
  48216. function handleScroll (
  48217. router,
  48218. to,
  48219. from,
  48220. isPop
  48221. ) {
  48222. if (!router.app) {
  48223. return
  48224. }
  48225. var behavior = router.options.scrollBehavior;
  48226. if (!behavior) {
  48227. return
  48228. }
  48229. if (true) {
  48230. assert(typeof behavior === 'function', "scrollBehavior must be a function");
  48231. }
  48232. // wait until re-render finishes before scrolling
  48233. router.app.$nextTick(function () {
  48234. var position = getScrollPosition();
  48235. var shouldScroll = behavior.call(
  48236. router,
  48237. to,
  48238. from,
  48239. isPop ? position : null
  48240. );
  48241. if (!shouldScroll) {
  48242. return
  48243. }
  48244. if (typeof shouldScroll.then === 'function') {
  48245. shouldScroll
  48246. .then(function (shouldScroll) {
  48247. scrollToPosition((shouldScroll), position);
  48248. })
  48249. .catch(function (err) {
  48250. if (true) {
  48251. assert(false, err.toString());
  48252. }
  48253. });
  48254. } else {
  48255. scrollToPosition(shouldScroll, position);
  48256. }
  48257. });
  48258. }
  48259. function saveScrollPosition () {
  48260. var key = getStateKey();
  48261. if (key) {
  48262. positionStore[key] = {
  48263. x: window.pageXOffset,
  48264. y: window.pageYOffset
  48265. };
  48266. }
  48267. }
  48268. function getScrollPosition () {
  48269. var key = getStateKey();
  48270. if (key) {
  48271. return positionStore[key]
  48272. }
  48273. }
  48274. function getElementPosition (el, offset) {
  48275. var docEl = document.documentElement;
  48276. var docRect = docEl.getBoundingClientRect();
  48277. var elRect = el.getBoundingClientRect();
  48278. return {
  48279. x: elRect.left - docRect.left - offset.x,
  48280. y: elRect.top - docRect.top - offset.y
  48281. }
  48282. }
  48283. function isValidPosition (obj) {
  48284. return isNumber(obj.x) || isNumber(obj.y)
  48285. }
  48286. function normalizePosition (obj) {
  48287. return {
  48288. x: isNumber(obj.x) ? obj.x : window.pageXOffset,
  48289. y: isNumber(obj.y) ? obj.y : window.pageYOffset
  48290. }
  48291. }
  48292. function normalizeOffset (obj) {
  48293. return {
  48294. x: isNumber(obj.x) ? obj.x : 0,
  48295. y: isNumber(obj.y) ? obj.y : 0
  48296. }
  48297. }
  48298. function isNumber (v) {
  48299. return typeof v === 'number'
  48300. }
  48301. var hashStartsWithNumberRE = /^#\d/;
  48302. function scrollToPosition (shouldScroll, position) {
  48303. var isObject = typeof shouldScroll === 'object';
  48304. if (isObject && typeof shouldScroll.selector === 'string') {
  48305. // getElementById would still fail if the selector contains a more complicated query like #main[data-attr]
  48306. // but at the same time, it doesn't make much sense to select an element with an id and an extra selector
  48307. var el = hashStartsWithNumberRE.test(shouldScroll.selector) // $flow-disable-line
  48308. ? document.getElementById(shouldScroll.selector.slice(1)) // $flow-disable-line
  48309. : document.querySelector(shouldScroll.selector);
  48310. if (el) {
  48311. var offset =
  48312. shouldScroll.offset && typeof shouldScroll.offset === 'object'
  48313. ? shouldScroll.offset
  48314. : {};
  48315. offset = normalizeOffset(offset);
  48316. position = getElementPosition(el, offset);
  48317. } else if (isValidPosition(shouldScroll)) {
  48318. position = normalizePosition(shouldScroll);
  48319. }
  48320. } else if (isObject && isValidPosition(shouldScroll)) {
  48321. position = normalizePosition(shouldScroll);
  48322. }
  48323. if (position) {
  48324. window.scrollTo(position.x, position.y);
  48325. }
  48326. }
  48327. /* */
  48328. var supportsPushState =
  48329. inBrowser &&
  48330. (function () {
  48331. var ua = window.navigator.userAgent;
  48332. if (
  48333. (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
  48334. ua.indexOf('Mobile Safari') !== -1 &&
  48335. ua.indexOf('Chrome') === -1 &&
  48336. ua.indexOf('Windows Phone') === -1
  48337. ) {
  48338. return false
  48339. }
  48340. return window.history && 'pushState' in window.history
  48341. })();
  48342. function pushState (url, replace) {
  48343. saveScrollPosition();
  48344. // try...catch the pushState call to get around Safari
  48345. // DOM Exception 18 where it limits to 100 pushState calls
  48346. var history = window.history;
  48347. try {
  48348. if (replace) {
  48349. // preserve existing history state as it could be overriden by the user
  48350. var stateCopy = extend({}, history.state);
  48351. stateCopy.key = getStateKey();
  48352. history.replaceState(stateCopy, '', url);
  48353. } else {
  48354. history.pushState({ key: setStateKey(genStateKey()) }, '', url);
  48355. }
  48356. } catch (e) {
  48357. window.location[replace ? 'replace' : 'assign'](url);
  48358. }
  48359. }
  48360. function replaceState (url) {
  48361. pushState(url, true);
  48362. }
  48363. /* */
  48364. function runQueue (queue, fn, cb) {
  48365. var step = function (index) {
  48366. if (index >= queue.length) {
  48367. cb();
  48368. } else {
  48369. if (queue[index]) {
  48370. fn(queue[index], function () {
  48371. step(index + 1);
  48372. });
  48373. } else {
  48374. step(index + 1);
  48375. }
  48376. }
  48377. };
  48378. step(0);
  48379. }
  48380. /* */
  48381. function resolveAsyncComponents (matched) {
  48382. return function (to, from, next) {
  48383. var hasAsync = false;
  48384. var pending = 0;
  48385. var error = null;
  48386. flatMapComponents(matched, function (def, _, match, key) {
  48387. // if it's a function and doesn't have cid attached,
  48388. // assume it's an async component resolve function.
  48389. // we are not using Vue's default async resolving mechanism because
  48390. // we want to halt the navigation until the incoming component has been
  48391. // resolved.
  48392. if (typeof def === 'function' && def.cid === undefined) {
  48393. hasAsync = true;
  48394. pending++;
  48395. var resolve = once(function (resolvedDef) {
  48396. if (isESModule(resolvedDef)) {
  48397. resolvedDef = resolvedDef.default;
  48398. }
  48399. // save resolved on async factory in case it's used elsewhere
  48400. def.resolved = typeof resolvedDef === 'function'
  48401. ? resolvedDef
  48402. : _Vue.extend(resolvedDef);
  48403. match.components[key] = resolvedDef;
  48404. pending--;
  48405. if (pending <= 0) {
  48406. next();
  48407. }
  48408. });
  48409. var reject = once(function (reason) {
  48410. var msg = "Failed to resolve async component " + key + ": " + reason;
  48411. true && warn(false, msg);
  48412. if (!error) {
  48413. error = isError(reason)
  48414. ? reason
  48415. : new Error(msg);
  48416. next(error);
  48417. }
  48418. });
  48419. var res;
  48420. try {
  48421. res = def(resolve, reject);
  48422. } catch (e) {
  48423. reject(e);
  48424. }
  48425. if (res) {
  48426. if (typeof res.then === 'function') {
  48427. res.then(resolve, reject);
  48428. } else {
  48429. // new syntax in Vue 2.3
  48430. var comp = res.component;
  48431. if (comp && typeof comp.then === 'function') {
  48432. comp.then(resolve, reject);
  48433. }
  48434. }
  48435. }
  48436. }
  48437. });
  48438. if (!hasAsync) { next(); }
  48439. }
  48440. }
  48441. function flatMapComponents (
  48442. matched,
  48443. fn
  48444. ) {
  48445. return flatten(matched.map(function (m) {
  48446. return Object.keys(m.components).map(function (key) { return fn(
  48447. m.components[key],
  48448. m.instances[key],
  48449. m, key
  48450. ); })
  48451. }))
  48452. }
  48453. function flatten (arr) {
  48454. return Array.prototype.concat.apply([], arr)
  48455. }
  48456. var hasSymbol =
  48457. typeof Symbol === 'function' &&
  48458. typeof Symbol.toStringTag === 'symbol';
  48459. function isESModule (obj) {
  48460. return obj.__esModule || (hasSymbol && obj[Symbol.toStringTag] === 'Module')
  48461. }
  48462. // in Webpack 2, require.ensure now also returns a Promise
  48463. // so the resolve/reject functions may get called an extra time
  48464. // if the user uses an arrow function shorthand that happens to
  48465. // return that Promise.
  48466. function once (fn) {
  48467. var called = false;
  48468. return function () {
  48469. var args = [], len = arguments.length;
  48470. while ( len-- ) args[ len ] = arguments[ len ];
  48471. if (called) { return }
  48472. called = true;
  48473. return fn.apply(this, args)
  48474. }
  48475. }
  48476. var NavigationDuplicated = /*@__PURE__*/(function (Error) {
  48477. function NavigationDuplicated (normalizedLocation) {
  48478. Error.call(this);
  48479. this.name = this._name = 'NavigationDuplicated';
  48480. // passing the message to super() doesn't seem to work in the transpiled version
  48481. this.message = "Navigating to current location (\"" + (normalizedLocation.fullPath) + "\") is not allowed";
  48482. // add a stack property so services like Sentry can correctly display it
  48483. Object.defineProperty(this, 'stack', {
  48484. value: new Error().stack,
  48485. writable: true,
  48486. configurable: true
  48487. });
  48488. // we could also have used
  48489. // Error.captureStackTrace(this, this.constructor)
  48490. // but it only exists on node and chrome
  48491. }
  48492. if ( Error ) NavigationDuplicated.__proto__ = Error;
  48493. NavigationDuplicated.prototype = Object.create( Error && Error.prototype );
  48494. NavigationDuplicated.prototype.constructor = NavigationDuplicated;
  48495. return NavigationDuplicated;
  48496. }(Error));
  48497. // support IE9
  48498. NavigationDuplicated._name = 'NavigationDuplicated';
  48499. /* */
  48500. var History = function History (router, base) {
  48501. this.router = router;
  48502. this.base = normalizeBase(base);
  48503. // start with a route object that stands for "nowhere"
  48504. this.current = START;
  48505. this.pending = null;
  48506. this.ready = false;
  48507. this.readyCbs = [];
  48508. this.readyErrorCbs = [];
  48509. this.errorCbs = [];
  48510. };
  48511. History.prototype.listen = function listen (cb) {
  48512. this.cb = cb;
  48513. };
  48514. History.prototype.onReady = function onReady (cb, errorCb) {
  48515. if (this.ready) {
  48516. cb();
  48517. } else {
  48518. this.readyCbs.push(cb);
  48519. if (errorCb) {
  48520. this.readyErrorCbs.push(errorCb);
  48521. }
  48522. }
  48523. };
  48524. History.prototype.onError = function onError (errorCb) {
  48525. this.errorCbs.push(errorCb);
  48526. };
  48527. History.prototype.transitionTo = function transitionTo (
  48528. location,
  48529. onComplete,
  48530. onAbort
  48531. ) {
  48532. var this$1 = this;
  48533. var route = this.router.match(location, this.current);
  48534. this.confirmTransition(
  48535. route,
  48536. function () {
  48537. this$1.updateRoute(route);
  48538. onComplete && onComplete(route);
  48539. this$1.ensureURL();
  48540. // fire ready cbs once
  48541. if (!this$1.ready) {
  48542. this$1.ready = true;
  48543. this$1.readyCbs.forEach(function (cb) {
  48544. cb(route);
  48545. });
  48546. }
  48547. },
  48548. function (err) {
  48549. if (onAbort) {
  48550. onAbort(err);
  48551. }
  48552. if (err && !this$1.ready) {
  48553. this$1.ready = true;
  48554. this$1.readyErrorCbs.forEach(function (cb) {
  48555. cb(err);
  48556. });
  48557. }
  48558. }
  48559. );
  48560. };
  48561. History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
  48562. var this$1 = this;
  48563. var current = this.current;
  48564. var abort = function (err) {
  48565. // after merging https://github.com/vuejs/vue-router/pull/2771 we
  48566. // When the user navigates through history through back/forward buttons
  48567. // we do not want to throw the error. We only throw it if directly calling
  48568. // push/replace. That's why it's not included in isError
  48569. if (!isExtendedError(NavigationDuplicated, err) && isError(err)) {
  48570. if (this$1.errorCbs.length) {
  48571. this$1.errorCbs.forEach(function (cb) {
  48572. cb(err);
  48573. });
  48574. } else {
  48575. warn(false, 'uncaught error during route navigation:');
  48576. console.error(err);
  48577. }
  48578. }
  48579. onAbort && onAbort(err);
  48580. };
  48581. if (
  48582. isSameRoute(route, current) &&
  48583. // in the case the route map has been dynamically appended to
  48584. route.matched.length === current.matched.length
  48585. ) {
  48586. this.ensureURL();
  48587. return abort(new NavigationDuplicated(route))
  48588. }
  48589. var ref = resolveQueue(
  48590. this.current.matched,
  48591. route.matched
  48592. );
  48593. var updated = ref.updated;
  48594. var deactivated = ref.deactivated;
  48595. var activated = ref.activated;
  48596. var queue = [].concat(
  48597. // in-component leave guards
  48598. extractLeaveGuards(deactivated),
  48599. // global before hooks
  48600. this.router.beforeHooks,
  48601. // in-component update hooks
  48602. extractUpdateHooks(updated),
  48603. // in-config enter guards
  48604. activated.map(function (m) { return m.beforeEnter; }),
  48605. // async components
  48606. resolveAsyncComponents(activated)
  48607. );
  48608. this.pending = route;
  48609. var iterator = function (hook, next) {
  48610. if (this$1.pending !== route) {
  48611. return abort()
  48612. }
  48613. try {
  48614. hook(route, current, function (to) {
  48615. if (to === false || isError(to)) {
  48616. // next(false) -> abort navigation, ensure current URL
  48617. this$1.ensureURL(true);
  48618. abort(to);
  48619. } else if (
  48620. typeof to === 'string' ||
  48621. (typeof to === 'object' &&
  48622. (typeof to.path === 'string' || typeof to.name === 'string'))
  48623. ) {
  48624. // next('/') or next({ path: '/' }) -> redirect
  48625. abort();
  48626. if (typeof to === 'object' && to.replace) {
  48627. this$1.replace(to);
  48628. } else {
  48629. this$1.push(to);
  48630. }
  48631. } else {
  48632. // confirm transition and pass on the value
  48633. next(to);
  48634. }
  48635. });
  48636. } catch (e) {
  48637. abort(e);
  48638. }
  48639. };
  48640. runQueue(queue, iterator, function () {
  48641. var postEnterCbs = [];
  48642. var isValid = function () { return this$1.current === route; };
  48643. // wait until async components are resolved before
  48644. // extracting in-component enter guards
  48645. var enterGuards = extractEnterGuards(activated, postEnterCbs, isValid);
  48646. var queue = enterGuards.concat(this$1.router.resolveHooks);
  48647. runQueue(queue, iterator, function () {
  48648. if (this$1.pending !== route) {
  48649. return abort()
  48650. }
  48651. this$1.pending = null;
  48652. onComplete(route);
  48653. if (this$1.router.app) {
  48654. this$1.router.app.$nextTick(function () {
  48655. postEnterCbs.forEach(function (cb) {
  48656. cb();
  48657. });
  48658. });
  48659. }
  48660. });
  48661. });
  48662. };
  48663. History.prototype.updateRoute = function updateRoute (route) {
  48664. var prev = this.current;
  48665. this.current = route;
  48666. this.cb && this.cb(route);
  48667. this.router.afterHooks.forEach(function (hook) {
  48668. hook && hook(route, prev);
  48669. });
  48670. };
  48671. function normalizeBase (base) {
  48672. if (!base) {
  48673. if (inBrowser) {
  48674. // respect <base> tag
  48675. var baseEl = document.querySelector('base');
  48676. base = (baseEl && baseEl.getAttribute('href')) || '/';
  48677. // strip full URL origin
  48678. base = base.replace(/^https?:\/\/[^\/]+/, '');
  48679. } else {
  48680. base = '/';
  48681. }
  48682. }
  48683. // make sure there's the starting slash
  48684. if (base.charAt(0) !== '/') {
  48685. base = '/' + base;
  48686. }
  48687. // remove trailing slash
  48688. return base.replace(/\/$/, '')
  48689. }
  48690. function resolveQueue (
  48691. current,
  48692. next
  48693. ) {
  48694. var i;
  48695. var max = Math.max(current.length, next.length);
  48696. for (i = 0; i < max; i++) {
  48697. if (current[i] !== next[i]) {
  48698. break
  48699. }
  48700. }
  48701. return {
  48702. updated: next.slice(0, i),
  48703. activated: next.slice(i),
  48704. deactivated: current.slice(i)
  48705. }
  48706. }
  48707. function extractGuards (
  48708. records,
  48709. name,
  48710. bind,
  48711. reverse
  48712. ) {
  48713. var guards = flatMapComponents(records, function (def, instance, match, key) {
  48714. var guard = extractGuard(def, name);
  48715. if (guard) {
  48716. return Array.isArray(guard)
  48717. ? guard.map(function (guard) { return bind(guard, instance, match, key); })
  48718. : bind(guard, instance, match, key)
  48719. }
  48720. });
  48721. return flatten(reverse ? guards.reverse() : guards)
  48722. }
  48723. function extractGuard (
  48724. def,
  48725. key
  48726. ) {
  48727. if (typeof def !== 'function') {
  48728. // extend now so that global mixins are applied.
  48729. def = _Vue.extend(def);
  48730. }
  48731. return def.options[key]
  48732. }
  48733. function extractLeaveGuards (deactivated) {
  48734. return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
  48735. }
  48736. function extractUpdateHooks (updated) {
  48737. return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
  48738. }
  48739. function bindGuard (guard, instance) {
  48740. if (instance) {
  48741. return function boundRouteGuard () {
  48742. return guard.apply(instance, arguments)
  48743. }
  48744. }
  48745. }
  48746. function extractEnterGuards (
  48747. activated,
  48748. cbs,
  48749. isValid
  48750. ) {
  48751. return extractGuards(
  48752. activated,
  48753. 'beforeRouteEnter',
  48754. function (guard, _, match, key) {
  48755. return bindEnterGuard(guard, match, key, cbs, isValid)
  48756. }
  48757. )
  48758. }
  48759. function bindEnterGuard (
  48760. guard,
  48761. match,
  48762. key,
  48763. cbs,
  48764. isValid
  48765. ) {
  48766. return function routeEnterGuard (to, from, next) {
  48767. return guard(to, from, function (cb) {
  48768. if (typeof cb === 'function') {
  48769. cbs.push(function () {
  48770. // #750
  48771. // if a router-view is wrapped with an out-in transition,
  48772. // the instance may not have been registered at this time.
  48773. // we will need to poll for registration until current route
  48774. // is no longer valid.
  48775. poll(cb, match.instances, key, isValid);
  48776. });
  48777. }
  48778. next(cb);
  48779. })
  48780. }
  48781. }
  48782. function poll (
  48783. cb, // somehow flow cannot infer this is a function
  48784. instances,
  48785. key,
  48786. isValid
  48787. ) {
  48788. if (
  48789. instances[key] &&
  48790. !instances[key]._isBeingDestroyed // do not reuse being destroyed instance
  48791. ) {
  48792. cb(instances[key]);
  48793. } else if (isValid()) {
  48794. setTimeout(function () {
  48795. poll(cb, instances, key, isValid);
  48796. }, 16);
  48797. }
  48798. }
  48799. /* */
  48800. var HTML5History = /*@__PURE__*/(function (History) {
  48801. function HTML5History (router, base) {
  48802. var this$1 = this;
  48803. History.call(this, router, base);
  48804. var expectScroll = router.options.scrollBehavior;
  48805. var supportsScroll = supportsPushState && expectScroll;
  48806. if (supportsScroll) {
  48807. setupScroll();
  48808. }
  48809. var initLocation = getLocation(this.base);
  48810. window.addEventListener('popstate', function (e) {
  48811. var current = this$1.current;
  48812. // Avoiding first `popstate` event dispatched in some browsers but first
  48813. // history route not updated since async guard at the same time.
  48814. var location = getLocation(this$1.base);
  48815. if (this$1.current === START && location === initLocation) {
  48816. return
  48817. }
  48818. this$1.transitionTo(location, function (route) {
  48819. if (supportsScroll) {
  48820. handleScroll(router, route, current, true);
  48821. }
  48822. });
  48823. });
  48824. }
  48825. if ( History ) HTML5History.__proto__ = History;
  48826. HTML5History.prototype = Object.create( History && History.prototype );
  48827. HTML5History.prototype.constructor = HTML5History;
  48828. HTML5History.prototype.go = function go (n) {
  48829. window.history.go(n);
  48830. };
  48831. HTML5History.prototype.push = function push (location, onComplete, onAbort) {
  48832. var this$1 = this;
  48833. var ref = this;
  48834. var fromRoute = ref.current;
  48835. this.transitionTo(location, function (route) {
  48836. pushState(cleanPath(this$1.base + route.fullPath));
  48837. handleScroll(this$1.router, route, fromRoute, false);
  48838. onComplete && onComplete(route);
  48839. }, onAbort);
  48840. };
  48841. HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
  48842. var this$1 = this;
  48843. var ref = this;
  48844. var fromRoute = ref.current;
  48845. this.transitionTo(location, function (route) {
  48846. replaceState(cleanPath(this$1.base + route.fullPath));
  48847. handleScroll(this$1.router, route, fromRoute, false);
  48848. onComplete && onComplete(route);
  48849. }, onAbort);
  48850. };
  48851. HTML5History.prototype.ensureURL = function ensureURL (push) {
  48852. if (getLocation(this.base) !== this.current.fullPath) {
  48853. var current = cleanPath(this.base + this.current.fullPath);
  48854. push ? pushState(current) : replaceState(current);
  48855. }
  48856. };
  48857. HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
  48858. return getLocation(this.base)
  48859. };
  48860. return HTML5History;
  48861. }(History));
  48862. function getLocation (base) {
  48863. var path = decodeURI(window.location.pathname);
  48864. if (base && path.indexOf(base) === 0) {
  48865. path = path.slice(base.length);
  48866. }
  48867. return (path || '/') + window.location.search + window.location.hash
  48868. }
  48869. /* */
  48870. var HashHistory = /*@__PURE__*/(function (History) {
  48871. function HashHistory (router, base, fallback) {
  48872. History.call(this, router, base);
  48873. // check history fallback deeplinking
  48874. if (fallback && checkFallback(this.base)) {
  48875. return
  48876. }
  48877. ensureSlash();
  48878. }
  48879. if ( History ) HashHistory.__proto__ = History;
  48880. HashHistory.prototype = Object.create( History && History.prototype );
  48881. HashHistory.prototype.constructor = HashHistory;
  48882. // this is delayed until the app mounts
  48883. // to avoid the hashchange listener being fired too early
  48884. HashHistory.prototype.setupListeners = function setupListeners () {
  48885. var this$1 = this;
  48886. var router = this.router;
  48887. var expectScroll = router.options.scrollBehavior;
  48888. var supportsScroll = supportsPushState && expectScroll;
  48889. if (supportsScroll) {
  48890. setupScroll();
  48891. }
  48892. window.addEventListener(
  48893. supportsPushState ? 'popstate' : 'hashchange',
  48894. function () {
  48895. var current = this$1.current;
  48896. if (!ensureSlash()) {
  48897. return
  48898. }
  48899. this$1.transitionTo(getHash(), function (route) {
  48900. if (supportsScroll) {
  48901. handleScroll(this$1.router, route, current, true);
  48902. }
  48903. if (!supportsPushState) {
  48904. replaceHash(route.fullPath);
  48905. }
  48906. });
  48907. }
  48908. );
  48909. };
  48910. HashHistory.prototype.push = function push (location, onComplete, onAbort) {
  48911. var this$1 = this;
  48912. var ref = this;
  48913. var fromRoute = ref.current;
  48914. this.transitionTo(
  48915. location,
  48916. function (route) {
  48917. pushHash(route.fullPath);
  48918. handleScroll(this$1.router, route, fromRoute, false);
  48919. onComplete && onComplete(route);
  48920. },
  48921. onAbort
  48922. );
  48923. };
  48924. HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  48925. var this$1 = this;
  48926. var ref = this;
  48927. var fromRoute = ref.current;
  48928. this.transitionTo(
  48929. location,
  48930. function (route) {
  48931. replaceHash(route.fullPath);
  48932. handleScroll(this$1.router, route, fromRoute, false);
  48933. onComplete && onComplete(route);
  48934. },
  48935. onAbort
  48936. );
  48937. };
  48938. HashHistory.prototype.go = function go (n) {
  48939. window.history.go(n);
  48940. };
  48941. HashHistory.prototype.ensureURL = function ensureURL (push) {
  48942. var current = this.current.fullPath;
  48943. if (getHash() !== current) {
  48944. push ? pushHash(current) : replaceHash(current);
  48945. }
  48946. };
  48947. HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  48948. return getHash()
  48949. };
  48950. return HashHistory;
  48951. }(History));
  48952. function checkFallback (base) {
  48953. var location = getLocation(base);
  48954. if (!/^\/#/.test(location)) {
  48955. window.location.replace(cleanPath(base + '/#' + location));
  48956. return true
  48957. }
  48958. }
  48959. function ensureSlash () {
  48960. var path = getHash();
  48961. if (path.charAt(0) === '/') {
  48962. return true
  48963. }
  48964. replaceHash('/' + path);
  48965. return false
  48966. }
  48967. function getHash () {
  48968. // We can't use window.location.hash here because it's not
  48969. // consistent across browsers - Firefox will pre-decode it!
  48970. var href = window.location.href;
  48971. var index = href.indexOf('#');
  48972. // empty path
  48973. if (index < 0) { return '' }
  48974. href = href.slice(index + 1);
  48975. // decode the hash but not the search or hash
  48976. // as search(query) is already decoded
  48977. // https://github.com/vuejs/vue-router/issues/2708
  48978. var searchIndex = href.indexOf('?');
  48979. if (searchIndex < 0) {
  48980. var hashIndex = href.indexOf('#');
  48981. if (hashIndex > -1) {
  48982. href = decodeURI(href.slice(0, hashIndex)) + href.slice(hashIndex);
  48983. } else { href = decodeURI(href); }
  48984. } else {
  48985. href = decodeURI(href.slice(0, searchIndex)) + href.slice(searchIndex);
  48986. }
  48987. return href
  48988. }
  48989. function getUrl (path) {
  48990. var href = window.location.href;
  48991. var i = href.indexOf('#');
  48992. var base = i >= 0 ? href.slice(0, i) : href;
  48993. return (base + "#" + path)
  48994. }
  48995. function pushHash (path) {
  48996. if (supportsPushState) {
  48997. pushState(getUrl(path));
  48998. } else {
  48999. window.location.hash = path;
  49000. }
  49001. }
  49002. function replaceHash (path) {
  49003. if (supportsPushState) {
  49004. replaceState(getUrl(path));
  49005. } else {
  49006. window.location.replace(getUrl(path));
  49007. }
  49008. }
  49009. /* */
  49010. var AbstractHistory = /*@__PURE__*/(function (History) {
  49011. function AbstractHistory (router, base) {
  49012. History.call(this, router, base);
  49013. this.stack = [];
  49014. this.index = -1;
  49015. }
  49016. if ( History ) AbstractHistory.__proto__ = History;
  49017. AbstractHistory.prototype = Object.create( History && History.prototype );
  49018. AbstractHistory.prototype.constructor = AbstractHistory;
  49019. AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
  49020. var this$1 = this;
  49021. this.transitionTo(
  49022. location,
  49023. function (route) {
  49024. this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route);
  49025. this$1.index++;
  49026. onComplete && onComplete(route);
  49027. },
  49028. onAbort
  49029. );
  49030. };
  49031. AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
  49032. var this$1 = this;
  49033. this.transitionTo(
  49034. location,
  49035. function (route) {
  49036. this$1.stack = this$1.stack.slice(0, this$1.index).concat(route);
  49037. onComplete && onComplete(route);
  49038. },
  49039. onAbort
  49040. );
  49041. };
  49042. AbstractHistory.prototype.go = function go (n) {
  49043. var this$1 = this;
  49044. var targetIndex = this.index + n;
  49045. if (targetIndex < 0 || targetIndex >= this.stack.length) {
  49046. return
  49047. }
  49048. var route = this.stack[targetIndex];
  49049. this.confirmTransition(
  49050. route,
  49051. function () {
  49052. this$1.index = targetIndex;
  49053. this$1.updateRoute(route);
  49054. },
  49055. function (err) {
  49056. if (isExtendedError(NavigationDuplicated, err)) {
  49057. this$1.index = targetIndex;
  49058. }
  49059. }
  49060. );
  49061. };
  49062. AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
  49063. var current = this.stack[this.stack.length - 1];
  49064. return current ? current.fullPath : '/'
  49065. };
  49066. AbstractHistory.prototype.ensureURL = function ensureURL () {
  49067. // noop
  49068. };
  49069. return AbstractHistory;
  49070. }(History));
  49071. /* */
  49072. var VueRouter = function VueRouter (options) {
  49073. if ( options === void 0 ) options = {};
  49074. this.app = null;
  49075. this.apps = [];
  49076. this.options = options;
  49077. this.beforeHooks = [];
  49078. this.resolveHooks = [];
  49079. this.afterHooks = [];
  49080. this.matcher = createMatcher(options.routes || [], this);
  49081. var mode = options.mode || 'hash';
  49082. this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
  49083. if (this.fallback) {
  49084. mode = 'hash';
  49085. }
  49086. if (!inBrowser) {
  49087. mode = 'abstract';
  49088. }
  49089. this.mode = mode;
  49090. switch (mode) {
  49091. case 'history':
  49092. this.history = new HTML5History(this, options.base);
  49093. break
  49094. case 'hash':
  49095. this.history = new HashHistory(this, options.base, this.fallback);
  49096. break
  49097. case 'abstract':
  49098. this.history = new AbstractHistory(this, options.base);
  49099. break
  49100. default:
  49101. if (true) {
  49102. assert(false, ("invalid mode: " + mode));
  49103. }
  49104. }
  49105. };
  49106. var prototypeAccessors = { currentRoute: { configurable: true } };
  49107. VueRouter.prototype.match = function match (
  49108. raw,
  49109. current,
  49110. redirectedFrom
  49111. ) {
  49112. return this.matcher.match(raw, current, redirectedFrom)
  49113. };
  49114. prototypeAccessors.currentRoute.get = function () {
  49115. return this.history && this.history.current
  49116. };
  49117. VueRouter.prototype.init = function init (app /* Vue component instance */) {
  49118. var this$1 = this;
  49119. true && assert(
  49120. install.installed,
  49121. "not installed. Make sure to call `Vue.use(VueRouter)` " +
  49122. "before creating root instance."
  49123. );
  49124. this.apps.push(app);
  49125. // set up app destroyed handler
  49126. // https://github.com/vuejs/vue-router/issues/2639
  49127. app.$once('hook:destroyed', function () {
  49128. // clean out app from this.apps array once destroyed
  49129. var index = this$1.apps.indexOf(app);
  49130. if (index > -1) { this$1.apps.splice(index, 1); }
  49131. // ensure we still have a main app or null if no apps
  49132. // we do not release the router so it can be reused
  49133. if (this$1.app === app) { this$1.app = this$1.apps[0] || null; }
  49134. });
  49135. // main app previously initialized
  49136. // return as we don't need to set up new history listener
  49137. if (this.app) {
  49138. return
  49139. }
  49140. this.app = app;
  49141. var history = this.history;
  49142. if (history instanceof HTML5History) {
  49143. history.transitionTo(history.getCurrentLocation());
  49144. } else if (history instanceof HashHistory) {
  49145. var setupHashListener = function () {
  49146. history.setupListeners();
  49147. };
  49148. history.transitionTo(
  49149. history.getCurrentLocation(),
  49150. setupHashListener,
  49151. setupHashListener
  49152. );
  49153. }
  49154. history.listen(function (route) {
  49155. this$1.apps.forEach(function (app) {
  49156. app._route = route;
  49157. });
  49158. });
  49159. };
  49160. VueRouter.prototype.beforeEach = function beforeEach (fn) {
  49161. return registerHook(this.beforeHooks, fn)
  49162. };
  49163. VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
  49164. return registerHook(this.resolveHooks, fn)
  49165. };
  49166. VueRouter.prototype.afterEach = function afterEach (fn) {
  49167. return registerHook(this.afterHooks, fn)
  49168. };
  49169. VueRouter.prototype.onReady = function onReady (cb, errorCb) {
  49170. this.history.onReady(cb, errorCb);
  49171. };
  49172. VueRouter.prototype.onError = function onError (errorCb) {
  49173. this.history.onError(errorCb);
  49174. };
  49175. VueRouter.prototype.push = function push (location, onComplete, onAbort) {
  49176. var this$1 = this;
  49177. // $flow-disable-line
  49178. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  49179. return new Promise(function (resolve, reject) {
  49180. this$1.history.push(location, resolve, reject);
  49181. })
  49182. } else {
  49183. this.history.push(location, onComplete, onAbort);
  49184. }
  49185. };
  49186. VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
  49187. var this$1 = this;
  49188. // $flow-disable-line
  49189. if (!onComplete && !onAbort && typeof Promise !== 'undefined') {
  49190. return new Promise(function (resolve, reject) {
  49191. this$1.history.replace(location, resolve, reject);
  49192. })
  49193. } else {
  49194. this.history.replace(location, onComplete, onAbort);
  49195. }
  49196. };
  49197. VueRouter.prototype.go = function go (n) {
  49198. this.history.go(n);
  49199. };
  49200. VueRouter.prototype.back = function back () {
  49201. this.go(-1);
  49202. };
  49203. VueRouter.prototype.forward = function forward () {
  49204. this.go(1);
  49205. };
  49206. VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
  49207. var route = to
  49208. ? to.matched
  49209. ? to
  49210. : this.resolve(to).route
  49211. : this.currentRoute;
  49212. if (!route) {
  49213. return []
  49214. }
  49215. return [].concat.apply([], route.matched.map(function (m) {
  49216. return Object.keys(m.components).map(function (key) {
  49217. return m.components[key]
  49218. })
  49219. }))
  49220. };
  49221. VueRouter.prototype.resolve = function resolve (
  49222. to,
  49223. current,
  49224. append
  49225. ) {
  49226. current = current || this.history.current;
  49227. var location = normalizeLocation(
  49228. to,
  49229. current,
  49230. append,
  49231. this
  49232. );
  49233. var route = this.match(location, current);
  49234. var fullPath = route.redirectedFrom || route.fullPath;
  49235. var base = this.history.base;
  49236. var href = createHref(base, fullPath, this.mode);
  49237. return {
  49238. location: location,
  49239. route: route,
  49240. href: href,
  49241. // for backwards compat
  49242. normalizedTo: location,
  49243. resolved: route
  49244. }
  49245. };
  49246. VueRouter.prototype.addRoutes = function addRoutes (routes) {
  49247. this.matcher.addRoutes(routes);
  49248. if (this.history.current !== START) {
  49249. this.history.transitionTo(this.history.getCurrentLocation());
  49250. }
  49251. };
  49252. Object.defineProperties( VueRouter.prototype, prototypeAccessors );
  49253. function registerHook (list, fn) {
  49254. list.push(fn);
  49255. return function () {
  49256. var i = list.indexOf(fn);
  49257. if (i > -1) { list.splice(i, 1); }
  49258. }
  49259. }
  49260. function createHref (base, fullPath, mode) {
  49261. var path = mode === 'hash' ? '#' + fullPath : fullPath;
  49262. return base ? cleanPath(base + '/' + path) : path
  49263. }
  49264. VueRouter.install = install;
  49265. VueRouter.version = '3.1.6';
  49266. if (inBrowser && window.Vue) {
  49267. window.Vue.use(VueRouter);
  49268. }
  49269. /* harmony default export */ __webpack_exports__["default"] = (VueRouter);
  49270. /***/ }),
  49271. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  49272. /*!*************************************************!*\
  49273. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  49274. \*************************************************/
  49275. /*! no static exports found */
  49276. /***/ (function(module, exports, __webpack_require__) {
  49277. "use strict";
  49278. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  49279. * Vue.js v2.6.11
  49280. * (c) 2014-2019 Evan You
  49281. * Released under the MIT License.
  49282. */
  49283. /* */
  49284. var emptyObject = Object.freeze({});
  49285. // These helpers produce better VM code in JS engines due to their
  49286. // explicitness and function inlining.
  49287. function isUndef (v) {
  49288. return v === undefined || v === null
  49289. }
  49290. function isDef (v) {
  49291. return v !== undefined && v !== null
  49292. }
  49293. function isTrue (v) {
  49294. return v === true
  49295. }
  49296. function isFalse (v) {
  49297. return v === false
  49298. }
  49299. /**
  49300. * Check if value is primitive.
  49301. */
  49302. function isPrimitive (value) {
  49303. return (
  49304. typeof value === 'string' ||
  49305. typeof value === 'number' ||
  49306. // $flow-disable-line
  49307. typeof value === 'symbol' ||
  49308. typeof value === 'boolean'
  49309. )
  49310. }
  49311. /**
  49312. * Quick object check - this is primarily used to tell
  49313. * Objects from primitive values when we know the value
  49314. * is a JSON-compliant type.
  49315. */
  49316. function isObject (obj) {
  49317. return obj !== null && typeof obj === 'object'
  49318. }
  49319. /**
  49320. * Get the raw type string of a value, e.g., [object Object].
  49321. */
  49322. var _toString = Object.prototype.toString;
  49323. function toRawType (value) {
  49324. return _toString.call(value).slice(8, -1)
  49325. }
  49326. /**
  49327. * Strict object type check. Only returns true
  49328. * for plain JavaScript objects.
  49329. */
  49330. function isPlainObject (obj) {
  49331. return _toString.call(obj) === '[object Object]'
  49332. }
  49333. function isRegExp (v) {
  49334. return _toString.call(v) === '[object RegExp]'
  49335. }
  49336. /**
  49337. * Check if val is a valid array index.
  49338. */
  49339. function isValidArrayIndex (val) {
  49340. var n = parseFloat(String(val));
  49341. return n >= 0 && Math.floor(n) === n && isFinite(val)
  49342. }
  49343. function isPromise (val) {
  49344. return (
  49345. isDef(val) &&
  49346. typeof val.then === 'function' &&
  49347. typeof val.catch === 'function'
  49348. )
  49349. }
  49350. /**
  49351. * Convert a value to a string that is actually rendered.
  49352. */
  49353. function toString (val) {
  49354. return val == null
  49355. ? ''
  49356. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  49357. ? JSON.stringify(val, null, 2)
  49358. : String(val)
  49359. }
  49360. /**
  49361. * Convert an input value to a number for persistence.
  49362. * If the conversion fails, return original string.
  49363. */
  49364. function toNumber (val) {
  49365. var n = parseFloat(val);
  49366. return isNaN(n) ? val : n
  49367. }
  49368. /**
  49369. * Make a map and return a function for checking if a key
  49370. * is in that map.
  49371. */
  49372. function makeMap (
  49373. str,
  49374. expectsLowerCase
  49375. ) {
  49376. var map = Object.create(null);
  49377. var list = str.split(',');
  49378. for (var i = 0; i < list.length; i++) {
  49379. map[list[i]] = true;
  49380. }
  49381. return expectsLowerCase
  49382. ? function (val) { return map[val.toLowerCase()]; }
  49383. : function (val) { return map[val]; }
  49384. }
  49385. /**
  49386. * Check if a tag is a built-in tag.
  49387. */
  49388. var isBuiltInTag = makeMap('slot,component', true);
  49389. /**
  49390. * Check if an attribute is a reserved attribute.
  49391. */
  49392. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  49393. /**
  49394. * Remove an item from an array.
  49395. */
  49396. function remove (arr, item) {
  49397. if (arr.length) {
  49398. var index = arr.indexOf(item);
  49399. if (index > -1) {
  49400. return arr.splice(index, 1)
  49401. }
  49402. }
  49403. }
  49404. /**
  49405. * Check whether an object has the property.
  49406. */
  49407. var hasOwnProperty = Object.prototype.hasOwnProperty;
  49408. function hasOwn (obj, key) {
  49409. return hasOwnProperty.call(obj, key)
  49410. }
  49411. /**
  49412. * Create a cached version of a pure function.
  49413. */
  49414. function cached (fn) {
  49415. var cache = Object.create(null);
  49416. return (function cachedFn (str) {
  49417. var hit = cache[str];
  49418. return hit || (cache[str] = fn(str))
  49419. })
  49420. }
  49421. /**
  49422. * Camelize a hyphen-delimited string.
  49423. */
  49424. var camelizeRE = /-(\w)/g;
  49425. var camelize = cached(function (str) {
  49426. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  49427. });
  49428. /**
  49429. * Capitalize a string.
  49430. */
  49431. var capitalize = cached(function (str) {
  49432. return str.charAt(0).toUpperCase() + str.slice(1)
  49433. });
  49434. /**
  49435. * Hyphenate a camelCase string.
  49436. */
  49437. var hyphenateRE = /\B([A-Z])/g;
  49438. var hyphenate = cached(function (str) {
  49439. return str.replace(hyphenateRE, '-$1').toLowerCase()
  49440. });
  49441. /**
  49442. * Simple bind polyfill for environments that do not support it,
  49443. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  49444. * since native bind is now performant enough in most browsers.
  49445. * But removing it would mean breaking code that was able to run in
  49446. * PhantomJS 1.x, so this must be kept for backward compatibility.
  49447. */
  49448. /* istanbul ignore next */
  49449. function polyfillBind (fn, ctx) {
  49450. function boundFn (a) {
  49451. var l = arguments.length;
  49452. return l
  49453. ? l > 1
  49454. ? fn.apply(ctx, arguments)
  49455. : fn.call(ctx, a)
  49456. : fn.call(ctx)
  49457. }
  49458. boundFn._length = fn.length;
  49459. return boundFn
  49460. }
  49461. function nativeBind (fn, ctx) {
  49462. return fn.bind(ctx)
  49463. }
  49464. var bind = Function.prototype.bind
  49465. ? nativeBind
  49466. : polyfillBind;
  49467. /**
  49468. * Convert an Array-like object to a real Array.
  49469. */
  49470. function toArray (list, start) {
  49471. start = start || 0;
  49472. var i = list.length - start;
  49473. var ret = new Array(i);
  49474. while (i--) {
  49475. ret[i] = list[i + start];
  49476. }
  49477. return ret
  49478. }
  49479. /**
  49480. * Mix properties into target object.
  49481. */
  49482. function extend (to, _from) {
  49483. for (var key in _from) {
  49484. to[key] = _from[key];
  49485. }
  49486. return to
  49487. }
  49488. /**
  49489. * Merge an Array of Objects into a single Object.
  49490. */
  49491. function toObject (arr) {
  49492. var res = {};
  49493. for (var i = 0; i < arr.length; i++) {
  49494. if (arr[i]) {
  49495. extend(res, arr[i]);
  49496. }
  49497. }
  49498. return res
  49499. }
  49500. /* eslint-disable no-unused-vars */
  49501. /**
  49502. * Perform no operation.
  49503. * Stubbing args to make Flow happy without leaving useless transpiled code
  49504. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  49505. */
  49506. function noop (a, b, c) {}
  49507. /**
  49508. * Always return false.
  49509. */
  49510. var no = function (a, b, c) { return false; };
  49511. /* eslint-enable no-unused-vars */
  49512. /**
  49513. * Return the same value.
  49514. */
  49515. var identity = function (_) { return _; };
  49516. /**
  49517. * Generate a string containing static keys from compiler modules.
  49518. */
  49519. function genStaticKeys (modules) {
  49520. return modules.reduce(function (keys, m) {
  49521. return keys.concat(m.staticKeys || [])
  49522. }, []).join(',')
  49523. }
  49524. /**
  49525. * Check if two values are loosely equal - that is,
  49526. * if they are plain objects, do they have the same shape?
  49527. */
  49528. function looseEqual (a, b) {
  49529. if (a === b) { return true }
  49530. var isObjectA = isObject(a);
  49531. var isObjectB = isObject(b);
  49532. if (isObjectA && isObjectB) {
  49533. try {
  49534. var isArrayA = Array.isArray(a);
  49535. var isArrayB = Array.isArray(b);
  49536. if (isArrayA && isArrayB) {
  49537. return a.length === b.length && a.every(function (e, i) {
  49538. return looseEqual(e, b[i])
  49539. })
  49540. } else if (a instanceof Date && b instanceof Date) {
  49541. return a.getTime() === b.getTime()
  49542. } else if (!isArrayA && !isArrayB) {
  49543. var keysA = Object.keys(a);
  49544. var keysB = Object.keys(b);
  49545. return keysA.length === keysB.length && keysA.every(function (key) {
  49546. return looseEqual(a[key], b[key])
  49547. })
  49548. } else {
  49549. /* istanbul ignore next */
  49550. return false
  49551. }
  49552. } catch (e) {
  49553. /* istanbul ignore next */
  49554. return false
  49555. }
  49556. } else if (!isObjectA && !isObjectB) {
  49557. return String(a) === String(b)
  49558. } else {
  49559. return false
  49560. }
  49561. }
  49562. /**
  49563. * Return the first index at which a loosely equal value can be
  49564. * found in the array (if value is a plain object, the array must
  49565. * contain an object of the same shape), or -1 if it is not present.
  49566. */
  49567. function looseIndexOf (arr, val) {
  49568. for (var i = 0; i < arr.length; i++) {
  49569. if (looseEqual(arr[i], val)) { return i }
  49570. }
  49571. return -1
  49572. }
  49573. /**
  49574. * Ensure a function is called only once.
  49575. */
  49576. function once (fn) {
  49577. var called = false;
  49578. return function () {
  49579. if (!called) {
  49580. called = true;
  49581. fn.apply(this, arguments);
  49582. }
  49583. }
  49584. }
  49585. var SSR_ATTR = 'data-server-rendered';
  49586. var ASSET_TYPES = [
  49587. 'component',
  49588. 'directive',
  49589. 'filter'
  49590. ];
  49591. var LIFECYCLE_HOOKS = [
  49592. 'beforeCreate',
  49593. 'created',
  49594. 'beforeMount',
  49595. 'mounted',
  49596. 'beforeUpdate',
  49597. 'updated',
  49598. 'beforeDestroy',
  49599. 'destroyed',
  49600. 'activated',
  49601. 'deactivated',
  49602. 'errorCaptured',
  49603. 'serverPrefetch'
  49604. ];
  49605. /* */
  49606. var config = ({
  49607. /**
  49608. * Option merge strategies (used in core/util/options)
  49609. */
  49610. // $flow-disable-line
  49611. optionMergeStrategies: Object.create(null),
  49612. /**
  49613. * Whether to suppress warnings.
  49614. */
  49615. silent: false,
  49616. /**
  49617. * Show production mode tip message on boot?
  49618. */
  49619. productionTip: "development" !== 'production',
  49620. /**
  49621. * Whether to enable devtools
  49622. */
  49623. devtools: "development" !== 'production',
  49624. /**
  49625. * Whether to record perf
  49626. */
  49627. performance: false,
  49628. /**
  49629. * Error handler for watcher errors
  49630. */
  49631. errorHandler: null,
  49632. /**
  49633. * Warn handler for watcher warns
  49634. */
  49635. warnHandler: null,
  49636. /**
  49637. * Ignore certain custom elements
  49638. */
  49639. ignoredElements: [],
  49640. /**
  49641. * Custom user key aliases for v-on
  49642. */
  49643. // $flow-disable-line
  49644. keyCodes: Object.create(null),
  49645. /**
  49646. * Check if a tag is reserved so that it cannot be registered as a
  49647. * component. This is platform-dependent and may be overwritten.
  49648. */
  49649. isReservedTag: no,
  49650. /**
  49651. * Check if an attribute is reserved so that it cannot be used as a component
  49652. * prop. This is platform-dependent and may be overwritten.
  49653. */
  49654. isReservedAttr: no,
  49655. /**
  49656. * Check if a tag is an unknown element.
  49657. * Platform-dependent.
  49658. */
  49659. isUnknownElement: no,
  49660. /**
  49661. * Get the namespace of an element
  49662. */
  49663. getTagNamespace: noop,
  49664. /**
  49665. * Parse the real tag name for the specific platform.
  49666. */
  49667. parsePlatformTagName: identity,
  49668. /**
  49669. * Check if an attribute must be bound using property, e.g. value
  49670. * Platform-dependent.
  49671. */
  49672. mustUseProp: no,
  49673. /**
  49674. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  49675. * This will significantly reduce performance if set to false.
  49676. */
  49677. async: true,
  49678. /**
  49679. * Exposed for legacy reasons
  49680. */
  49681. _lifecycleHooks: LIFECYCLE_HOOKS
  49682. });
  49683. /* */
  49684. /**
  49685. * unicode letters used for parsing html tags, component names and property paths.
  49686. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  49687. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  49688. */
  49689. 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/;
  49690. /**
  49691. * Check if a string starts with $ or _
  49692. */
  49693. function isReserved (str) {
  49694. var c = (str + '').charCodeAt(0);
  49695. return c === 0x24 || c === 0x5F
  49696. }
  49697. /**
  49698. * Define a property.
  49699. */
  49700. function def (obj, key, val, enumerable) {
  49701. Object.defineProperty(obj, key, {
  49702. value: val,
  49703. enumerable: !!enumerable,
  49704. writable: true,
  49705. configurable: true
  49706. });
  49707. }
  49708. /**
  49709. * Parse simple path.
  49710. */
  49711. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  49712. function parsePath (path) {
  49713. if (bailRE.test(path)) {
  49714. return
  49715. }
  49716. var segments = path.split('.');
  49717. return function (obj) {
  49718. for (var i = 0; i < segments.length; i++) {
  49719. if (!obj) { return }
  49720. obj = obj[segments[i]];
  49721. }
  49722. return obj
  49723. }
  49724. }
  49725. /* */
  49726. // can we use __proto__?
  49727. var hasProto = '__proto__' in {};
  49728. // Browser environment sniffing
  49729. var inBrowser = typeof window !== 'undefined';
  49730. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  49731. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  49732. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  49733. var isIE = UA && /msie|trident/.test(UA);
  49734. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  49735. var isEdge = UA && UA.indexOf('edge/') > 0;
  49736. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  49737. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  49738. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  49739. var isPhantomJS = UA && /phantomjs/.test(UA);
  49740. var isFF = UA && UA.match(/firefox\/(\d+)/);
  49741. // Firefox has a "watch" function on Object.prototype...
  49742. var nativeWatch = ({}).watch;
  49743. var supportsPassive = false;
  49744. if (inBrowser) {
  49745. try {
  49746. var opts = {};
  49747. Object.defineProperty(opts, 'passive', ({
  49748. get: function get () {
  49749. /* istanbul ignore next */
  49750. supportsPassive = true;
  49751. }
  49752. })); // https://github.com/facebook/flow/issues/285
  49753. window.addEventListener('test-passive', null, opts);
  49754. } catch (e) {}
  49755. }
  49756. // this needs to be lazy-evaled because vue may be required before
  49757. // vue-server-renderer can set VUE_ENV
  49758. var _isServer;
  49759. var isServerRendering = function () {
  49760. if (_isServer === undefined) {
  49761. /* istanbul ignore if */
  49762. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  49763. // detect presence of vue-server-renderer and avoid
  49764. // Webpack shimming the process
  49765. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  49766. } else {
  49767. _isServer = false;
  49768. }
  49769. }
  49770. return _isServer
  49771. };
  49772. // detect devtools
  49773. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  49774. /* istanbul ignore next */
  49775. function isNative (Ctor) {
  49776. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  49777. }
  49778. var hasSymbol =
  49779. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  49780. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  49781. var _Set;
  49782. /* istanbul ignore if */ // $flow-disable-line
  49783. if (typeof Set !== 'undefined' && isNative(Set)) {
  49784. // use native Set when available.
  49785. _Set = Set;
  49786. } else {
  49787. // a non-standard Set polyfill that only works with primitive keys.
  49788. _Set = /*@__PURE__*/(function () {
  49789. function Set () {
  49790. this.set = Object.create(null);
  49791. }
  49792. Set.prototype.has = function has (key) {
  49793. return this.set[key] === true
  49794. };
  49795. Set.prototype.add = function add (key) {
  49796. this.set[key] = true;
  49797. };
  49798. Set.prototype.clear = function clear () {
  49799. this.set = Object.create(null);
  49800. };
  49801. return Set;
  49802. }());
  49803. }
  49804. /* */
  49805. var warn = noop;
  49806. var tip = noop;
  49807. var generateComponentTrace = (noop); // work around flow check
  49808. var formatComponentName = (noop);
  49809. {
  49810. var hasConsole = typeof console !== 'undefined';
  49811. var classifyRE = /(?:^|[-_])(\w)/g;
  49812. var classify = function (str) { return str
  49813. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  49814. .replace(/[-_]/g, ''); };
  49815. warn = function (msg, vm) {
  49816. var trace = vm ? generateComponentTrace(vm) : '';
  49817. if (config.warnHandler) {
  49818. config.warnHandler.call(null, msg, vm, trace);
  49819. } else if (hasConsole && (!config.silent)) {
  49820. console.error(("[Vue warn]: " + msg + trace));
  49821. }
  49822. };
  49823. tip = function (msg, vm) {
  49824. if (hasConsole && (!config.silent)) {
  49825. console.warn("[Vue tip]: " + msg + (
  49826. vm ? generateComponentTrace(vm) : ''
  49827. ));
  49828. }
  49829. };
  49830. formatComponentName = function (vm, includeFile) {
  49831. if (vm.$root === vm) {
  49832. return '<Root>'
  49833. }
  49834. var options = typeof vm === 'function' && vm.cid != null
  49835. ? vm.options
  49836. : vm._isVue
  49837. ? vm.$options || vm.constructor.options
  49838. : vm;
  49839. var name = options.name || options._componentTag;
  49840. var file = options.__file;
  49841. if (!name && file) {
  49842. var match = file.match(/([^/\\]+)\.vue$/);
  49843. name = match && match[1];
  49844. }
  49845. return (
  49846. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  49847. (file && includeFile !== false ? (" at " + file) : '')
  49848. )
  49849. };
  49850. var repeat = function (str, n) {
  49851. var res = '';
  49852. while (n) {
  49853. if (n % 2 === 1) { res += str; }
  49854. if (n > 1) { str += str; }
  49855. n >>= 1;
  49856. }
  49857. return res
  49858. };
  49859. generateComponentTrace = function (vm) {
  49860. if (vm._isVue && vm.$parent) {
  49861. var tree = [];
  49862. var currentRecursiveSequence = 0;
  49863. while (vm) {
  49864. if (tree.length > 0) {
  49865. var last = tree[tree.length - 1];
  49866. if (last.constructor === vm.constructor) {
  49867. currentRecursiveSequence++;
  49868. vm = vm.$parent;
  49869. continue
  49870. } else if (currentRecursiveSequence > 0) {
  49871. tree[tree.length - 1] = [last, currentRecursiveSequence];
  49872. currentRecursiveSequence = 0;
  49873. }
  49874. }
  49875. tree.push(vm);
  49876. vm = vm.$parent;
  49877. }
  49878. return '\n\nfound in\n\n' + tree
  49879. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  49880. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  49881. : formatComponentName(vm))); })
  49882. .join('\n')
  49883. } else {
  49884. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  49885. }
  49886. };
  49887. }
  49888. /* */
  49889. var uid = 0;
  49890. /**
  49891. * A dep is an observable that can have multiple
  49892. * directives subscribing to it.
  49893. */
  49894. var Dep = function Dep () {
  49895. this.id = uid++;
  49896. this.subs = [];
  49897. };
  49898. Dep.prototype.addSub = function addSub (sub) {
  49899. this.subs.push(sub);
  49900. };
  49901. Dep.prototype.removeSub = function removeSub (sub) {
  49902. remove(this.subs, sub);
  49903. };
  49904. Dep.prototype.depend = function depend () {
  49905. if (Dep.target) {
  49906. Dep.target.addDep(this);
  49907. }
  49908. };
  49909. Dep.prototype.notify = function notify () {
  49910. // stabilize the subscriber list first
  49911. var subs = this.subs.slice();
  49912. if (!config.async) {
  49913. // subs aren't sorted in scheduler if not running async
  49914. // we need to sort them now to make sure they fire in correct
  49915. // order
  49916. subs.sort(function (a, b) { return a.id - b.id; });
  49917. }
  49918. for (var i = 0, l = subs.length; i < l; i++) {
  49919. subs[i].update();
  49920. }
  49921. };
  49922. // The current target watcher being evaluated.
  49923. // This is globally unique because only one watcher
  49924. // can be evaluated at a time.
  49925. Dep.target = null;
  49926. var targetStack = [];
  49927. function pushTarget (target) {
  49928. targetStack.push(target);
  49929. Dep.target = target;
  49930. }
  49931. function popTarget () {
  49932. targetStack.pop();
  49933. Dep.target = targetStack[targetStack.length - 1];
  49934. }
  49935. /* */
  49936. var VNode = function VNode (
  49937. tag,
  49938. data,
  49939. children,
  49940. text,
  49941. elm,
  49942. context,
  49943. componentOptions,
  49944. asyncFactory
  49945. ) {
  49946. this.tag = tag;
  49947. this.data = data;
  49948. this.children = children;
  49949. this.text = text;
  49950. this.elm = elm;
  49951. this.ns = undefined;
  49952. this.context = context;
  49953. this.fnContext = undefined;
  49954. this.fnOptions = undefined;
  49955. this.fnScopeId = undefined;
  49956. this.key = data && data.key;
  49957. this.componentOptions = componentOptions;
  49958. this.componentInstance = undefined;
  49959. this.parent = undefined;
  49960. this.raw = false;
  49961. this.isStatic = false;
  49962. this.isRootInsert = true;
  49963. this.isComment = false;
  49964. this.isCloned = false;
  49965. this.isOnce = false;
  49966. this.asyncFactory = asyncFactory;
  49967. this.asyncMeta = undefined;
  49968. this.isAsyncPlaceholder = false;
  49969. };
  49970. var prototypeAccessors = { child: { configurable: true } };
  49971. // DEPRECATED: alias for componentInstance for backwards compat.
  49972. /* istanbul ignore next */
  49973. prototypeAccessors.child.get = function () {
  49974. return this.componentInstance
  49975. };
  49976. Object.defineProperties( VNode.prototype, prototypeAccessors );
  49977. var createEmptyVNode = function (text) {
  49978. if ( text === void 0 ) text = '';
  49979. var node = new VNode();
  49980. node.text = text;
  49981. node.isComment = true;
  49982. return node
  49983. };
  49984. function createTextVNode (val) {
  49985. return new VNode(undefined, undefined, undefined, String(val))
  49986. }
  49987. // optimized shallow clone
  49988. // used for static nodes and slot nodes because they may be reused across
  49989. // multiple renders, cloning them avoids errors when DOM manipulations rely
  49990. // on their elm reference.
  49991. function cloneVNode (vnode) {
  49992. var cloned = new VNode(
  49993. vnode.tag,
  49994. vnode.data,
  49995. // #7975
  49996. // clone children array to avoid mutating original in case of cloning
  49997. // a child.
  49998. vnode.children && vnode.children.slice(),
  49999. vnode.text,
  50000. vnode.elm,
  50001. vnode.context,
  50002. vnode.componentOptions,
  50003. vnode.asyncFactory
  50004. );
  50005. cloned.ns = vnode.ns;
  50006. cloned.isStatic = vnode.isStatic;
  50007. cloned.key = vnode.key;
  50008. cloned.isComment = vnode.isComment;
  50009. cloned.fnContext = vnode.fnContext;
  50010. cloned.fnOptions = vnode.fnOptions;
  50011. cloned.fnScopeId = vnode.fnScopeId;
  50012. cloned.asyncMeta = vnode.asyncMeta;
  50013. cloned.isCloned = true;
  50014. return cloned
  50015. }
  50016. /*
  50017. * not type checking this file because flow doesn't play well with
  50018. * dynamically accessing methods on Array prototype
  50019. */
  50020. var arrayProto = Array.prototype;
  50021. var arrayMethods = Object.create(arrayProto);
  50022. var methodsToPatch = [
  50023. 'push',
  50024. 'pop',
  50025. 'shift',
  50026. 'unshift',
  50027. 'splice',
  50028. 'sort',
  50029. 'reverse'
  50030. ];
  50031. /**
  50032. * Intercept mutating methods and emit events
  50033. */
  50034. methodsToPatch.forEach(function (method) {
  50035. // cache original method
  50036. var original = arrayProto[method];
  50037. def(arrayMethods, method, function mutator () {
  50038. var args = [], len = arguments.length;
  50039. while ( len-- ) args[ len ] = arguments[ len ];
  50040. var result = original.apply(this, args);
  50041. var ob = this.__ob__;
  50042. var inserted;
  50043. switch (method) {
  50044. case 'push':
  50045. case 'unshift':
  50046. inserted = args;
  50047. break
  50048. case 'splice':
  50049. inserted = args.slice(2);
  50050. break
  50051. }
  50052. if (inserted) { ob.observeArray(inserted); }
  50053. // notify change
  50054. ob.dep.notify();
  50055. return result
  50056. });
  50057. });
  50058. /* */
  50059. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  50060. /**
  50061. * In some cases we may want to disable observation inside a component's
  50062. * update computation.
  50063. */
  50064. var shouldObserve = true;
  50065. function toggleObserving (value) {
  50066. shouldObserve = value;
  50067. }
  50068. /**
  50069. * Observer class that is attached to each observed
  50070. * object. Once attached, the observer converts the target
  50071. * object's property keys into getter/setters that
  50072. * collect dependencies and dispatch updates.
  50073. */
  50074. var Observer = function Observer (value) {
  50075. this.value = value;
  50076. this.dep = new Dep();
  50077. this.vmCount = 0;
  50078. def(value, '__ob__', this);
  50079. if (Array.isArray(value)) {
  50080. if (hasProto) {
  50081. protoAugment(value, arrayMethods);
  50082. } else {
  50083. copyAugment(value, arrayMethods, arrayKeys);
  50084. }
  50085. this.observeArray(value);
  50086. } else {
  50087. this.walk(value);
  50088. }
  50089. };
  50090. /**
  50091. * Walk through all properties and convert them into
  50092. * getter/setters. This method should only be called when
  50093. * value type is Object.
  50094. */
  50095. Observer.prototype.walk = function walk (obj) {
  50096. var keys = Object.keys(obj);
  50097. for (var i = 0; i < keys.length; i++) {
  50098. defineReactive$$1(obj, keys[i]);
  50099. }
  50100. };
  50101. /**
  50102. * Observe a list of Array items.
  50103. */
  50104. Observer.prototype.observeArray = function observeArray (items) {
  50105. for (var i = 0, l = items.length; i < l; i++) {
  50106. observe(items[i]);
  50107. }
  50108. };
  50109. // helpers
  50110. /**
  50111. * Augment a target Object or Array by intercepting
  50112. * the prototype chain using __proto__
  50113. */
  50114. function protoAugment (target, src) {
  50115. /* eslint-disable no-proto */
  50116. target.__proto__ = src;
  50117. /* eslint-enable no-proto */
  50118. }
  50119. /**
  50120. * Augment a target Object or Array by defining
  50121. * hidden properties.
  50122. */
  50123. /* istanbul ignore next */
  50124. function copyAugment (target, src, keys) {
  50125. for (var i = 0, l = keys.length; i < l; i++) {
  50126. var key = keys[i];
  50127. def(target, key, src[key]);
  50128. }
  50129. }
  50130. /**
  50131. * Attempt to create an observer instance for a value,
  50132. * returns the new observer if successfully observed,
  50133. * or the existing observer if the value already has one.
  50134. */
  50135. function observe (value, asRootData) {
  50136. if (!isObject(value) || value instanceof VNode) {
  50137. return
  50138. }
  50139. var ob;
  50140. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  50141. ob = value.__ob__;
  50142. } else if (
  50143. shouldObserve &&
  50144. !isServerRendering() &&
  50145. (Array.isArray(value) || isPlainObject(value)) &&
  50146. Object.isExtensible(value) &&
  50147. !value._isVue
  50148. ) {
  50149. ob = new Observer(value);
  50150. }
  50151. if (asRootData && ob) {
  50152. ob.vmCount++;
  50153. }
  50154. return ob
  50155. }
  50156. /**
  50157. * Define a reactive property on an Object.
  50158. */
  50159. function defineReactive$$1 (
  50160. obj,
  50161. key,
  50162. val,
  50163. customSetter,
  50164. shallow
  50165. ) {
  50166. var dep = new Dep();
  50167. var property = Object.getOwnPropertyDescriptor(obj, key);
  50168. if (property && property.configurable === false) {
  50169. return
  50170. }
  50171. // cater for pre-defined getter/setters
  50172. var getter = property && property.get;
  50173. var setter = property && property.set;
  50174. if ((!getter || setter) && arguments.length === 2) {
  50175. val = obj[key];
  50176. }
  50177. var childOb = !shallow && observe(val);
  50178. Object.defineProperty(obj, key, {
  50179. enumerable: true,
  50180. configurable: true,
  50181. get: function reactiveGetter () {
  50182. var value = getter ? getter.call(obj) : val;
  50183. if (Dep.target) {
  50184. dep.depend();
  50185. if (childOb) {
  50186. childOb.dep.depend();
  50187. if (Array.isArray(value)) {
  50188. dependArray(value);
  50189. }
  50190. }
  50191. }
  50192. return value
  50193. },
  50194. set: function reactiveSetter (newVal) {
  50195. var value = getter ? getter.call(obj) : val;
  50196. /* eslint-disable no-self-compare */
  50197. if (newVal === value || (newVal !== newVal && value !== value)) {
  50198. return
  50199. }
  50200. /* eslint-enable no-self-compare */
  50201. if (customSetter) {
  50202. customSetter();
  50203. }
  50204. // #7981: for accessor properties without setter
  50205. if (getter && !setter) { return }
  50206. if (setter) {
  50207. setter.call(obj, newVal);
  50208. } else {
  50209. val = newVal;
  50210. }
  50211. childOb = !shallow && observe(newVal);
  50212. dep.notify();
  50213. }
  50214. });
  50215. }
  50216. /**
  50217. * Set a property on an object. Adds the new property and
  50218. * triggers change notification if the property doesn't
  50219. * already exist.
  50220. */
  50221. function set (target, key, val) {
  50222. if (isUndef(target) || isPrimitive(target)
  50223. ) {
  50224. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  50225. }
  50226. if (Array.isArray(target) && isValidArrayIndex(key)) {
  50227. target.length = Math.max(target.length, key);
  50228. target.splice(key, 1, val);
  50229. return val
  50230. }
  50231. if (key in target && !(key in Object.prototype)) {
  50232. target[key] = val;
  50233. return val
  50234. }
  50235. var ob = (target).__ob__;
  50236. if (target._isVue || (ob && ob.vmCount)) {
  50237. warn(
  50238. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  50239. 'at runtime - declare it upfront in the data option.'
  50240. );
  50241. return val
  50242. }
  50243. if (!ob) {
  50244. target[key] = val;
  50245. return val
  50246. }
  50247. defineReactive$$1(ob.value, key, val);
  50248. ob.dep.notify();
  50249. return val
  50250. }
  50251. /**
  50252. * Delete a property and trigger change if necessary.
  50253. */
  50254. function del (target, key) {
  50255. if (isUndef(target) || isPrimitive(target)
  50256. ) {
  50257. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  50258. }
  50259. if (Array.isArray(target) && isValidArrayIndex(key)) {
  50260. target.splice(key, 1);
  50261. return
  50262. }
  50263. var ob = (target).__ob__;
  50264. if (target._isVue || (ob && ob.vmCount)) {
  50265. warn(
  50266. 'Avoid deleting properties on a Vue instance or its root $data ' +
  50267. '- just set it to null.'
  50268. );
  50269. return
  50270. }
  50271. if (!hasOwn(target, key)) {
  50272. return
  50273. }
  50274. delete target[key];
  50275. if (!ob) {
  50276. return
  50277. }
  50278. ob.dep.notify();
  50279. }
  50280. /**
  50281. * Collect dependencies on array elements when the array is touched, since
  50282. * we cannot intercept array element access like property getters.
  50283. */
  50284. function dependArray (value) {
  50285. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  50286. e = value[i];
  50287. e && e.__ob__ && e.__ob__.dep.depend();
  50288. if (Array.isArray(e)) {
  50289. dependArray(e);
  50290. }
  50291. }
  50292. }
  50293. /* */
  50294. /**
  50295. * Option overwriting strategies are functions that handle
  50296. * how to merge a parent option value and a child option
  50297. * value into the final value.
  50298. */
  50299. var strats = config.optionMergeStrategies;
  50300. /**
  50301. * Options with restrictions
  50302. */
  50303. {
  50304. strats.el = strats.propsData = function (parent, child, vm, key) {
  50305. if (!vm) {
  50306. warn(
  50307. "option \"" + key + "\" can only be used during instance " +
  50308. 'creation with the `new` keyword.'
  50309. );
  50310. }
  50311. return defaultStrat(parent, child)
  50312. };
  50313. }
  50314. /**
  50315. * Helper that recursively merges two data objects together.
  50316. */
  50317. function mergeData (to, from) {
  50318. if (!from) { return to }
  50319. var key, toVal, fromVal;
  50320. var keys = hasSymbol
  50321. ? Reflect.ownKeys(from)
  50322. : Object.keys(from);
  50323. for (var i = 0; i < keys.length; i++) {
  50324. key = keys[i];
  50325. // in case the object is already observed...
  50326. if (key === '__ob__') { continue }
  50327. toVal = to[key];
  50328. fromVal = from[key];
  50329. if (!hasOwn(to, key)) {
  50330. set(to, key, fromVal);
  50331. } else if (
  50332. toVal !== fromVal &&
  50333. isPlainObject(toVal) &&
  50334. isPlainObject(fromVal)
  50335. ) {
  50336. mergeData(toVal, fromVal);
  50337. }
  50338. }
  50339. return to
  50340. }
  50341. /**
  50342. * Data
  50343. */
  50344. function mergeDataOrFn (
  50345. parentVal,
  50346. childVal,
  50347. vm
  50348. ) {
  50349. if (!vm) {
  50350. // in a Vue.extend merge, both should be functions
  50351. if (!childVal) {
  50352. return parentVal
  50353. }
  50354. if (!parentVal) {
  50355. return childVal
  50356. }
  50357. // when parentVal & childVal are both present,
  50358. // we need to return a function that returns the
  50359. // merged result of both functions... no need to
  50360. // check if parentVal is a function here because
  50361. // it has to be a function to pass previous merges.
  50362. return function mergedDataFn () {
  50363. return mergeData(
  50364. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  50365. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  50366. )
  50367. }
  50368. } else {
  50369. return function mergedInstanceDataFn () {
  50370. // instance merge
  50371. var instanceData = typeof childVal === 'function'
  50372. ? childVal.call(vm, vm)
  50373. : childVal;
  50374. var defaultData = typeof parentVal === 'function'
  50375. ? parentVal.call(vm, vm)
  50376. : parentVal;
  50377. if (instanceData) {
  50378. return mergeData(instanceData, defaultData)
  50379. } else {
  50380. return defaultData
  50381. }
  50382. }
  50383. }
  50384. }
  50385. strats.data = function (
  50386. parentVal,
  50387. childVal,
  50388. vm
  50389. ) {
  50390. if (!vm) {
  50391. if (childVal && typeof childVal !== 'function') {
  50392. warn(
  50393. 'The "data" option should be a function ' +
  50394. 'that returns a per-instance value in component ' +
  50395. 'definitions.',
  50396. vm
  50397. );
  50398. return parentVal
  50399. }
  50400. return mergeDataOrFn(parentVal, childVal)
  50401. }
  50402. return mergeDataOrFn(parentVal, childVal, vm)
  50403. };
  50404. /**
  50405. * Hooks and props are merged as arrays.
  50406. */
  50407. function mergeHook (
  50408. parentVal,
  50409. childVal
  50410. ) {
  50411. var res = childVal
  50412. ? parentVal
  50413. ? parentVal.concat(childVal)
  50414. : Array.isArray(childVal)
  50415. ? childVal
  50416. : [childVal]
  50417. : parentVal;
  50418. return res
  50419. ? dedupeHooks(res)
  50420. : res
  50421. }
  50422. function dedupeHooks (hooks) {
  50423. var res = [];
  50424. for (var i = 0; i < hooks.length; i++) {
  50425. if (res.indexOf(hooks[i]) === -1) {
  50426. res.push(hooks[i]);
  50427. }
  50428. }
  50429. return res
  50430. }
  50431. LIFECYCLE_HOOKS.forEach(function (hook) {
  50432. strats[hook] = mergeHook;
  50433. });
  50434. /**
  50435. * Assets
  50436. *
  50437. * When a vm is present (instance creation), we need to do
  50438. * a three-way merge between constructor options, instance
  50439. * options and parent options.
  50440. */
  50441. function mergeAssets (
  50442. parentVal,
  50443. childVal,
  50444. vm,
  50445. key
  50446. ) {
  50447. var res = Object.create(parentVal || null);
  50448. if (childVal) {
  50449. assertObjectType(key, childVal, vm);
  50450. return extend(res, childVal)
  50451. } else {
  50452. return res
  50453. }
  50454. }
  50455. ASSET_TYPES.forEach(function (type) {
  50456. strats[type + 's'] = mergeAssets;
  50457. });
  50458. /**
  50459. * Watchers.
  50460. *
  50461. * Watchers hashes should not overwrite one
  50462. * another, so we merge them as arrays.
  50463. */
  50464. strats.watch = function (
  50465. parentVal,
  50466. childVal,
  50467. vm,
  50468. key
  50469. ) {
  50470. // work around Firefox's Object.prototype.watch...
  50471. if (parentVal === nativeWatch) { parentVal = undefined; }
  50472. if (childVal === nativeWatch) { childVal = undefined; }
  50473. /* istanbul ignore if */
  50474. if (!childVal) { return Object.create(parentVal || null) }
  50475. {
  50476. assertObjectType(key, childVal, vm);
  50477. }
  50478. if (!parentVal) { return childVal }
  50479. var ret = {};
  50480. extend(ret, parentVal);
  50481. for (var key$1 in childVal) {
  50482. var parent = ret[key$1];
  50483. var child = childVal[key$1];
  50484. if (parent && !Array.isArray(parent)) {
  50485. parent = [parent];
  50486. }
  50487. ret[key$1] = parent
  50488. ? parent.concat(child)
  50489. : Array.isArray(child) ? child : [child];
  50490. }
  50491. return ret
  50492. };
  50493. /**
  50494. * Other object hashes.
  50495. */
  50496. strats.props =
  50497. strats.methods =
  50498. strats.inject =
  50499. strats.computed = function (
  50500. parentVal,
  50501. childVal,
  50502. vm,
  50503. key
  50504. ) {
  50505. if (childVal && "development" !== 'production') {
  50506. assertObjectType(key, childVal, vm);
  50507. }
  50508. if (!parentVal) { return childVal }
  50509. var ret = Object.create(null);
  50510. extend(ret, parentVal);
  50511. if (childVal) { extend(ret, childVal); }
  50512. return ret
  50513. };
  50514. strats.provide = mergeDataOrFn;
  50515. /**
  50516. * Default strategy.
  50517. */
  50518. var defaultStrat = function (parentVal, childVal) {
  50519. return childVal === undefined
  50520. ? parentVal
  50521. : childVal
  50522. };
  50523. /**
  50524. * Validate component names
  50525. */
  50526. function checkComponents (options) {
  50527. for (var key in options.components) {
  50528. validateComponentName(key);
  50529. }
  50530. }
  50531. function validateComponentName (name) {
  50532. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  50533. warn(
  50534. 'Invalid component name: "' + name + '". Component names ' +
  50535. 'should conform to valid custom element name in html5 specification.'
  50536. );
  50537. }
  50538. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  50539. warn(
  50540. 'Do not use built-in or reserved HTML elements as component ' +
  50541. 'id: ' + name
  50542. );
  50543. }
  50544. }
  50545. /**
  50546. * Ensure all props option syntax are normalized into the
  50547. * Object-based format.
  50548. */
  50549. function normalizeProps (options, vm) {
  50550. var props = options.props;
  50551. if (!props) { return }
  50552. var res = {};
  50553. var i, val, name;
  50554. if (Array.isArray(props)) {
  50555. i = props.length;
  50556. while (i--) {
  50557. val = props[i];
  50558. if (typeof val === 'string') {
  50559. name = camelize(val);
  50560. res[name] = { type: null };
  50561. } else {
  50562. warn('props must be strings when using array syntax.');
  50563. }
  50564. }
  50565. } else if (isPlainObject(props)) {
  50566. for (var key in props) {
  50567. val = props[key];
  50568. name = camelize(key);
  50569. res[name] = isPlainObject(val)
  50570. ? val
  50571. : { type: val };
  50572. }
  50573. } else {
  50574. warn(
  50575. "Invalid value for option \"props\": expected an Array or an Object, " +
  50576. "but got " + (toRawType(props)) + ".",
  50577. vm
  50578. );
  50579. }
  50580. options.props = res;
  50581. }
  50582. /**
  50583. * Normalize all injections into Object-based format
  50584. */
  50585. function normalizeInject (options, vm) {
  50586. var inject = options.inject;
  50587. if (!inject) { return }
  50588. var normalized = options.inject = {};
  50589. if (Array.isArray(inject)) {
  50590. for (var i = 0; i < inject.length; i++) {
  50591. normalized[inject[i]] = { from: inject[i] };
  50592. }
  50593. } else if (isPlainObject(inject)) {
  50594. for (var key in inject) {
  50595. var val = inject[key];
  50596. normalized[key] = isPlainObject(val)
  50597. ? extend({ from: key }, val)
  50598. : { from: val };
  50599. }
  50600. } else {
  50601. warn(
  50602. "Invalid value for option \"inject\": expected an Array or an Object, " +
  50603. "but got " + (toRawType(inject)) + ".",
  50604. vm
  50605. );
  50606. }
  50607. }
  50608. /**
  50609. * Normalize raw function directives into object format.
  50610. */
  50611. function normalizeDirectives (options) {
  50612. var dirs = options.directives;
  50613. if (dirs) {
  50614. for (var key in dirs) {
  50615. var def$$1 = dirs[key];
  50616. if (typeof def$$1 === 'function') {
  50617. dirs[key] = { bind: def$$1, update: def$$1 };
  50618. }
  50619. }
  50620. }
  50621. }
  50622. function assertObjectType (name, value, vm) {
  50623. if (!isPlainObject(value)) {
  50624. warn(
  50625. "Invalid value for option \"" + name + "\": expected an Object, " +
  50626. "but got " + (toRawType(value)) + ".",
  50627. vm
  50628. );
  50629. }
  50630. }
  50631. /**
  50632. * Merge two option objects into a new one.
  50633. * Core utility used in both instantiation and inheritance.
  50634. */
  50635. function mergeOptions (
  50636. parent,
  50637. child,
  50638. vm
  50639. ) {
  50640. {
  50641. checkComponents(child);
  50642. }
  50643. if (typeof child === 'function') {
  50644. child = child.options;
  50645. }
  50646. normalizeProps(child, vm);
  50647. normalizeInject(child, vm);
  50648. normalizeDirectives(child);
  50649. // Apply extends and mixins on the child options,
  50650. // but only if it is a raw options object that isn't
  50651. // the result of another mergeOptions call.
  50652. // Only merged options has the _base property.
  50653. if (!child._base) {
  50654. if (child.extends) {
  50655. parent = mergeOptions(parent, child.extends, vm);
  50656. }
  50657. if (child.mixins) {
  50658. for (var i = 0, l = child.mixins.length; i < l; i++) {
  50659. parent = mergeOptions(parent, child.mixins[i], vm);
  50660. }
  50661. }
  50662. }
  50663. var options = {};
  50664. var key;
  50665. for (key in parent) {
  50666. mergeField(key);
  50667. }
  50668. for (key in child) {
  50669. if (!hasOwn(parent, key)) {
  50670. mergeField(key);
  50671. }
  50672. }
  50673. function mergeField (key) {
  50674. var strat = strats[key] || defaultStrat;
  50675. options[key] = strat(parent[key], child[key], vm, key);
  50676. }
  50677. return options
  50678. }
  50679. /**
  50680. * Resolve an asset.
  50681. * This function is used because child instances need access
  50682. * to assets defined in its ancestor chain.
  50683. */
  50684. function resolveAsset (
  50685. options,
  50686. type,
  50687. id,
  50688. warnMissing
  50689. ) {
  50690. /* istanbul ignore if */
  50691. if (typeof id !== 'string') {
  50692. return
  50693. }
  50694. var assets = options[type];
  50695. // check local registration variations first
  50696. if (hasOwn(assets, id)) { return assets[id] }
  50697. var camelizedId = camelize(id);
  50698. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  50699. var PascalCaseId = capitalize(camelizedId);
  50700. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  50701. // fallback to prototype chain
  50702. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  50703. if (warnMissing && !res) {
  50704. warn(
  50705. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  50706. options
  50707. );
  50708. }
  50709. return res
  50710. }
  50711. /* */
  50712. function validateProp (
  50713. key,
  50714. propOptions,
  50715. propsData,
  50716. vm
  50717. ) {
  50718. var prop = propOptions[key];
  50719. var absent = !hasOwn(propsData, key);
  50720. var value = propsData[key];
  50721. // boolean casting
  50722. var booleanIndex = getTypeIndex(Boolean, prop.type);
  50723. if (booleanIndex > -1) {
  50724. if (absent && !hasOwn(prop, 'default')) {
  50725. value = false;
  50726. } else if (value === '' || value === hyphenate(key)) {
  50727. // only cast empty string / same name to boolean if
  50728. // boolean has higher priority
  50729. var stringIndex = getTypeIndex(String, prop.type);
  50730. if (stringIndex < 0 || booleanIndex < stringIndex) {
  50731. value = true;
  50732. }
  50733. }
  50734. }
  50735. // check default value
  50736. if (value === undefined) {
  50737. value = getPropDefaultValue(vm, prop, key);
  50738. // since the default value is a fresh copy,
  50739. // make sure to observe it.
  50740. var prevShouldObserve = shouldObserve;
  50741. toggleObserving(true);
  50742. observe(value);
  50743. toggleObserving(prevShouldObserve);
  50744. }
  50745. {
  50746. assertProp(prop, key, value, vm, absent);
  50747. }
  50748. return value
  50749. }
  50750. /**
  50751. * Get the default value of a prop.
  50752. */
  50753. function getPropDefaultValue (vm, prop, key) {
  50754. // no default, return undefined
  50755. if (!hasOwn(prop, 'default')) {
  50756. return undefined
  50757. }
  50758. var def = prop.default;
  50759. // warn against non-factory defaults for Object & Array
  50760. if (isObject(def)) {
  50761. warn(
  50762. 'Invalid default value for prop "' + key + '": ' +
  50763. 'Props with type Object/Array must use a factory function ' +
  50764. 'to return the default value.',
  50765. vm
  50766. );
  50767. }
  50768. // the raw prop value was also undefined from previous render,
  50769. // return previous default value to avoid unnecessary watcher trigger
  50770. if (vm && vm.$options.propsData &&
  50771. vm.$options.propsData[key] === undefined &&
  50772. vm._props[key] !== undefined
  50773. ) {
  50774. return vm._props[key]
  50775. }
  50776. // call factory function for non-Function types
  50777. // a value is Function if its prototype is function even across different execution context
  50778. return typeof def === 'function' && getType(prop.type) !== 'Function'
  50779. ? def.call(vm)
  50780. : def
  50781. }
  50782. /**
  50783. * Assert whether a prop is valid.
  50784. */
  50785. function assertProp (
  50786. prop,
  50787. name,
  50788. value,
  50789. vm,
  50790. absent
  50791. ) {
  50792. if (prop.required && absent) {
  50793. warn(
  50794. 'Missing required prop: "' + name + '"',
  50795. vm
  50796. );
  50797. return
  50798. }
  50799. if (value == null && !prop.required) {
  50800. return
  50801. }
  50802. var type = prop.type;
  50803. var valid = !type || type === true;
  50804. var expectedTypes = [];
  50805. if (type) {
  50806. if (!Array.isArray(type)) {
  50807. type = [type];
  50808. }
  50809. for (var i = 0; i < type.length && !valid; i++) {
  50810. var assertedType = assertType(value, type[i]);
  50811. expectedTypes.push(assertedType.expectedType || '');
  50812. valid = assertedType.valid;
  50813. }
  50814. }
  50815. if (!valid) {
  50816. warn(
  50817. getInvalidTypeMessage(name, value, expectedTypes),
  50818. vm
  50819. );
  50820. return
  50821. }
  50822. var validator = prop.validator;
  50823. if (validator) {
  50824. if (!validator(value)) {
  50825. warn(
  50826. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  50827. vm
  50828. );
  50829. }
  50830. }
  50831. }
  50832. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  50833. function assertType (value, type) {
  50834. var valid;
  50835. var expectedType = getType(type);
  50836. if (simpleCheckRE.test(expectedType)) {
  50837. var t = typeof value;
  50838. valid = t === expectedType.toLowerCase();
  50839. // for primitive wrapper objects
  50840. if (!valid && t === 'object') {
  50841. valid = value instanceof type;
  50842. }
  50843. } else if (expectedType === 'Object') {
  50844. valid = isPlainObject(value);
  50845. } else if (expectedType === 'Array') {
  50846. valid = Array.isArray(value);
  50847. } else {
  50848. valid = value instanceof type;
  50849. }
  50850. return {
  50851. valid: valid,
  50852. expectedType: expectedType
  50853. }
  50854. }
  50855. /**
  50856. * Use function string name to check built-in types,
  50857. * because a simple equality check will fail when running
  50858. * across different vms / iframes.
  50859. */
  50860. function getType (fn) {
  50861. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  50862. return match ? match[1] : ''
  50863. }
  50864. function isSameType (a, b) {
  50865. return getType(a) === getType(b)
  50866. }
  50867. function getTypeIndex (type, expectedTypes) {
  50868. if (!Array.isArray(expectedTypes)) {
  50869. return isSameType(expectedTypes, type) ? 0 : -1
  50870. }
  50871. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  50872. if (isSameType(expectedTypes[i], type)) {
  50873. return i
  50874. }
  50875. }
  50876. return -1
  50877. }
  50878. function getInvalidTypeMessage (name, value, expectedTypes) {
  50879. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  50880. " Expected " + (expectedTypes.map(capitalize).join(', '));
  50881. var expectedType = expectedTypes[0];
  50882. var receivedType = toRawType(value);
  50883. var expectedValue = styleValue(value, expectedType);
  50884. var receivedValue = styleValue(value, receivedType);
  50885. // check if we need to specify expected value
  50886. if (expectedTypes.length === 1 &&
  50887. isExplicable(expectedType) &&
  50888. !isBoolean(expectedType, receivedType)) {
  50889. message += " with value " + expectedValue;
  50890. }
  50891. message += ", got " + receivedType + " ";
  50892. // check if we need to specify received value
  50893. if (isExplicable(receivedType)) {
  50894. message += "with value " + receivedValue + ".";
  50895. }
  50896. return message
  50897. }
  50898. function styleValue (value, type) {
  50899. if (type === 'String') {
  50900. return ("\"" + value + "\"")
  50901. } else if (type === 'Number') {
  50902. return ("" + (Number(value)))
  50903. } else {
  50904. return ("" + value)
  50905. }
  50906. }
  50907. function isExplicable (value) {
  50908. var explicitTypes = ['string', 'number', 'boolean'];
  50909. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  50910. }
  50911. function isBoolean () {
  50912. var args = [], len = arguments.length;
  50913. while ( len-- ) args[ len ] = arguments[ len ];
  50914. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  50915. }
  50916. /* */
  50917. function handleError (err, vm, info) {
  50918. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  50919. // See: https://github.com/vuejs/vuex/issues/1505
  50920. pushTarget();
  50921. try {
  50922. if (vm) {
  50923. var cur = vm;
  50924. while ((cur = cur.$parent)) {
  50925. var hooks = cur.$options.errorCaptured;
  50926. if (hooks) {
  50927. for (var i = 0; i < hooks.length; i++) {
  50928. try {
  50929. var capture = hooks[i].call(cur, err, vm, info) === false;
  50930. if (capture) { return }
  50931. } catch (e) {
  50932. globalHandleError(e, cur, 'errorCaptured hook');
  50933. }
  50934. }
  50935. }
  50936. }
  50937. }
  50938. globalHandleError(err, vm, info);
  50939. } finally {
  50940. popTarget();
  50941. }
  50942. }
  50943. function invokeWithErrorHandling (
  50944. handler,
  50945. context,
  50946. args,
  50947. vm,
  50948. info
  50949. ) {
  50950. var res;
  50951. try {
  50952. res = args ? handler.apply(context, args) : handler.call(context);
  50953. if (res && !res._isVue && isPromise(res) && !res._handled) {
  50954. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  50955. // issue #9511
  50956. // avoid catch triggering multiple times when nested calls
  50957. res._handled = true;
  50958. }
  50959. } catch (e) {
  50960. handleError(e, vm, info);
  50961. }
  50962. return res
  50963. }
  50964. function globalHandleError (err, vm, info) {
  50965. if (config.errorHandler) {
  50966. try {
  50967. return config.errorHandler.call(null, err, vm, info)
  50968. } catch (e) {
  50969. // if the user intentionally throws the original error in the handler,
  50970. // do not log it twice
  50971. if (e !== err) {
  50972. logError(e, null, 'config.errorHandler');
  50973. }
  50974. }
  50975. }
  50976. logError(err, vm, info);
  50977. }
  50978. function logError (err, vm, info) {
  50979. {
  50980. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  50981. }
  50982. /* istanbul ignore else */
  50983. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  50984. console.error(err);
  50985. } else {
  50986. throw err
  50987. }
  50988. }
  50989. /* */
  50990. var isUsingMicroTask = false;
  50991. var callbacks = [];
  50992. var pending = false;
  50993. function flushCallbacks () {
  50994. pending = false;
  50995. var copies = callbacks.slice(0);
  50996. callbacks.length = 0;
  50997. for (var i = 0; i < copies.length; i++) {
  50998. copies[i]();
  50999. }
  51000. }
  51001. // Here we have async deferring wrappers using microtasks.
  51002. // In 2.5 we used (macro) tasks (in combination with microtasks).
  51003. // However, it has subtle problems when state is changed right before repaint
  51004. // (e.g. #6813, out-in transitions).
  51005. // Also, using (macro) tasks in event handler would cause some weird behaviors
  51006. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  51007. // So we now use microtasks everywhere, again.
  51008. // A major drawback of this tradeoff is that there are some scenarios
  51009. // where microtasks have too high a priority and fire in between supposedly
  51010. // sequential events (e.g. #4521, #6690, which have workarounds)
  51011. // or even between bubbling of the same event (#6566).
  51012. var timerFunc;
  51013. // The nextTick behavior leverages the microtask queue, which can be accessed
  51014. // via either native Promise.then or MutationObserver.
  51015. // MutationObserver has wider support, however it is seriously bugged in
  51016. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  51017. // completely stops working after triggering a few times... so, if native
  51018. // Promise is available, we will use it:
  51019. /* istanbul ignore next, $flow-disable-line */
  51020. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  51021. var p = Promise.resolve();
  51022. timerFunc = function () {
  51023. p.then(flushCallbacks);
  51024. // In problematic UIWebViews, Promise.then doesn't completely break, but
  51025. // it can get stuck in a weird state where callbacks are pushed into the
  51026. // microtask queue but the queue isn't being flushed, until the browser
  51027. // needs to do some other work, e.g. handle a timer. Therefore we can
  51028. // "force" the microtask queue to be flushed by adding an empty timer.
  51029. if (isIOS) { setTimeout(noop); }
  51030. };
  51031. isUsingMicroTask = true;
  51032. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  51033. isNative(MutationObserver) ||
  51034. // PhantomJS and iOS 7.x
  51035. MutationObserver.toString() === '[object MutationObserverConstructor]'
  51036. )) {
  51037. // Use MutationObserver where native Promise is not available,
  51038. // e.g. PhantomJS, iOS7, Android 4.4
  51039. // (#6466 MutationObserver is unreliable in IE11)
  51040. var counter = 1;
  51041. var observer = new MutationObserver(flushCallbacks);
  51042. var textNode = document.createTextNode(String(counter));
  51043. observer.observe(textNode, {
  51044. characterData: true
  51045. });
  51046. timerFunc = function () {
  51047. counter = (counter + 1) % 2;
  51048. textNode.data = String(counter);
  51049. };
  51050. isUsingMicroTask = true;
  51051. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  51052. // Fallback to setImmediate.
  51053. // Technically it leverages the (macro) task queue,
  51054. // but it is still a better choice than setTimeout.
  51055. timerFunc = function () {
  51056. setImmediate(flushCallbacks);
  51057. };
  51058. } else {
  51059. // Fallback to setTimeout.
  51060. timerFunc = function () {
  51061. setTimeout(flushCallbacks, 0);
  51062. };
  51063. }
  51064. function nextTick (cb, ctx) {
  51065. var _resolve;
  51066. callbacks.push(function () {
  51067. if (cb) {
  51068. try {
  51069. cb.call(ctx);
  51070. } catch (e) {
  51071. handleError(e, ctx, 'nextTick');
  51072. }
  51073. } else if (_resolve) {
  51074. _resolve(ctx);
  51075. }
  51076. });
  51077. if (!pending) {
  51078. pending = true;
  51079. timerFunc();
  51080. }
  51081. // $flow-disable-line
  51082. if (!cb && typeof Promise !== 'undefined') {
  51083. return new Promise(function (resolve) {
  51084. _resolve = resolve;
  51085. })
  51086. }
  51087. }
  51088. /* */
  51089. var mark;
  51090. var measure;
  51091. {
  51092. var perf = inBrowser && window.performance;
  51093. /* istanbul ignore if */
  51094. if (
  51095. perf &&
  51096. perf.mark &&
  51097. perf.measure &&
  51098. perf.clearMarks &&
  51099. perf.clearMeasures
  51100. ) {
  51101. mark = function (tag) { return perf.mark(tag); };
  51102. measure = function (name, startTag, endTag) {
  51103. perf.measure(name, startTag, endTag);
  51104. perf.clearMarks(startTag);
  51105. perf.clearMarks(endTag);
  51106. // perf.clearMeasures(name)
  51107. };
  51108. }
  51109. }
  51110. /* not type checking this file because flow doesn't play well with Proxy */
  51111. var initProxy;
  51112. {
  51113. var allowedGlobals = makeMap(
  51114. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  51115. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  51116. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  51117. 'require' // for Webpack/Browserify
  51118. );
  51119. var warnNonPresent = function (target, key) {
  51120. warn(
  51121. "Property or method \"" + key + "\" is not defined on the instance but " +
  51122. 'referenced during render. Make sure that this property is reactive, ' +
  51123. 'either in the data option, or for class-based components, by ' +
  51124. 'initializing the property. ' +
  51125. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  51126. target
  51127. );
  51128. };
  51129. var warnReservedPrefix = function (target, key) {
  51130. warn(
  51131. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  51132. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  51133. 'prevent conflicts with Vue internals. ' +
  51134. 'See: https://vuejs.org/v2/api/#data',
  51135. target
  51136. );
  51137. };
  51138. var hasProxy =
  51139. typeof Proxy !== 'undefined' && isNative(Proxy);
  51140. if (hasProxy) {
  51141. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  51142. config.keyCodes = new Proxy(config.keyCodes, {
  51143. set: function set (target, key, value) {
  51144. if (isBuiltInModifier(key)) {
  51145. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  51146. return false
  51147. } else {
  51148. target[key] = value;
  51149. return true
  51150. }
  51151. }
  51152. });
  51153. }
  51154. var hasHandler = {
  51155. has: function has (target, key) {
  51156. var has = key in target;
  51157. var isAllowed = allowedGlobals(key) ||
  51158. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  51159. if (!has && !isAllowed) {
  51160. if (key in target.$data) { warnReservedPrefix(target, key); }
  51161. else { warnNonPresent(target, key); }
  51162. }
  51163. return has || !isAllowed
  51164. }
  51165. };
  51166. var getHandler = {
  51167. get: function get (target, key) {
  51168. if (typeof key === 'string' && !(key in target)) {
  51169. if (key in target.$data) { warnReservedPrefix(target, key); }
  51170. else { warnNonPresent(target, key); }
  51171. }
  51172. return target[key]
  51173. }
  51174. };
  51175. initProxy = function initProxy (vm) {
  51176. if (hasProxy) {
  51177. // determine which proxy handler to use
  51178. var options = vm.$options;
  51179. var handlers = options.render && options.render._withStripped
  51180. ? getHandler
  51181. : hasHandler;
  51182. vm._renderProxy = new Proxy(vm, handlers);
  51183. } else {
  51184. vm._renderProxy = vm;
  51185. }
  51186. };
  51187. }
  51188. /* */
  51189. var seenObjects = new _Set();
  51190. /**
  51191. * Recursively traverse an object to evoke all converted
  51192. * getters, so that every nested property inside the object
  51193. * is collected as a "deep" dependency.
  51194. */
  51195. function traverse (val) {
  51196. _traverse(val, seenObjects);
  51197. seenObjects.clear();
  51198. }
  51199. function _traverse (val, seen) {
  51200. var i, keys;
  51201. var isA = Array.isArray(val);
  51202. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  51203. return
  51204. }
  51205. if (val.__ob__) {
  51206. var depId = val.__ob__.dep.id;
  51207. if (seen.has(depId)) {
  51208. return
  51209. }
  51210. seen.add(depId);
  51211. }
  51212. if (isA) {
  51213. i = val.length;
  51214. while (i--) { _traverse(val[i], seen); }
  51215. } else {
  51216. keys = Object.keys(val);
  51217. i = keys.length;
  51218. while (i--) { _traverse(val[keys[i]], seen); }
  51219. }
  51220. }
  51221. /* */
  51222. var normalizeEvent = cached(function (name) {
  51223. var passive = name.charAt(0) === '&';
  51224. name = passive ? name.slice(1) : name;
  51225. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  51226. name = once$$1 ? name.slice(1) : name;
  51227. var capture = name.charAt(0) === '!';
  51228. name = capture ? name.slice(1) : name;
  51229. return {
  51230. name: name,
  51231. once: once$$1,
  51232. capture: capture,
  51233. passive: passive
  51234. }
  51235. });
  51236. function createFnInvoker (fns, vm) {
  51237. function invoker () {
  51238. var arguments$1 = arguments;
  51239. var fns = invoker.fns;
  51240. if (Array.isArray(fns)) {
  51241. var cloned = fns.slice();
  51242. for (var i = 0; i < cloned.length; i++) {
  51243. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  51244. }
  51245. } else {
  51246. // return handler return value for single handlers
  51247. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  51248. }
  51249. }
  51250. invoker.fns = fns;
  51251. return invoker
  51252. }
  51253. function updateListeners (
  51254. on,
  51255. oldOn,
  51256. add,
  51257. remove$$1,
  51258. createOnceHandler,
  51259. vm
  51260. ) {
  51261. var name, def$$1, cur, old, event;
  51262. for (name in on) {
  51263. def$$1 = cur = on[name];
  51264. old = oldOn[name];
  51265. event = normalizeEvent(name);
  51266. if (isUndef(cur)) {
  51267. warn(
  51268. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  51269. vm
  51270. );
  51271. } else if (isUndef(old)) {
  51272. if (isUndef(cur.fns)) {
  51273. cur = on[name] = createFnInvoker(cur, vm);
  51274. }
  51275. if (isTrue(event.once)) {
  51276. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  51277. }
  51278. add(event.name, cur, event.capture, event.passive, event.params);
  51279. } else if (cur !== old) {
  51280. old.fns = cur;
  51281. on[name] = old;
  51282. }
  51283. }
  51284. for (name in oldOn) {
  51285. if (isUndef(on[name])) {
  51286. event = normalizeEvent(name);
  51287. remove$$1(event.name, oldOn[name], event.capture);
  51288. }
  51289. }
  51290. }
  51291. /* */
  51292. function mergeVNodeHook (def, hookKey, hook) {
  51293. if (def instanceof VNode) {
  51294. def = def.data.hook || (def.data.hook = {});
  51295. }
  51296. var invoker;
  51297. var oldHook = def[hookKey];
  51298. function wrappedHook () {
  51299. hook.apply(this, arguments);
  51300. // important: remove merged hook to ensure it's called only once
  51301. // and prevent memory leak
  51302. remove(invoker.fns, wrappedHook);
  51303. }
  51304. if (isUndef(oldHook)) {
  51305. // no existing hook
  51306. invoker = createFnInvoker([wrappedHook]);
  51307. } else {
  51308. /* istanbul ignore if */
  51309. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  51310. // already a merged invoker
  51311. invoker = oldHook;
  51312. invoker.fns.push(wrappedHook);
  51313. } else {
  51314. // existing plain hook
  51315. invoker = createFnInvoker([oldHook, wrappedHook]);
  51316. }
  51317. }
  51318. invoker.merged = true;
  51319. def[hookKey] = invoker;
  51320. }
  51321. /* */
  51322. function extractPropsFromVNodeData (
  51323. data,
  51324. Ctor,
  51325. tag
  51326. ) {
  51327. // we are only extracting raw values here.
  51328. // validation and default values are handled in the child
  51329. // component itself.
  51330. var propOptions = Ctor.options.props;
  51331. if (isUndef(propOptions)) {
  51332. return
  51333. }
  51334. var res = {};
  51335. var attrs = data.attrs;
  51336. var props = data.props;
  51337. if (isDef(attrs) || isDef(props)) {
  51338. for (var key in propOptions) {
  51339. var altKey = hyphenate(key);
  51340. {
  51341. var keyInLowerCase = key.toLowerCase();
  51342. if (
  51343. key !== keyInLowerCase &&
  51344. attrs && hasOwn(attrs, keyInLowerCase)
  51345. ) {
  51346. tip(
  51347. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  51348. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  51349. " \"" + key + "\". " +
  51350. "Note that HTML attributes are case-insensitive and camelCased " +
  51351. "props need to use their kebab-case equivalents when using in-DOM " +
  51352. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  51353. );
  51354. }
  51355. }
  51356. checkProp(res, props, key, altKey, true) ||
  51357. checkProp(res, attrs, key, altKey, false);
  51358. }
  51359. }
  51360. return res
  51361. }
  51362. function checkProp (
  51363. res,
  51364. hash,
  51365. key,
  51366. altKey,
  51367. preserve
  51368. ) {
  51369. if (isDef(hash)) {
  51370. if (hasOwn(hash, key)) {
  51371. res[key] = hash[key];
  51372. if (!preserve) {
  51373. delete hash[key];
  51374. }
  51375. return true
  51376. } else if (hasOwn(hash, altKey)) {
  51377. res[key] = hash[altKey];
  51378. if (!preserve) {
  51379. delete hash[altKey];
  51380. }
  51381. return true
  51382. }
  51383. }
  51384. return false
  51385. }
  51386. /* */
  51387. // The template compiler attempts to minimize the need for normalization by
  51388. // statically analyzing the template at compile time.
  51389. //
  51390. // For plain HTML markup, normalization can be completely skipped because the
  51391. // generated render function is guaranteed to return Array<VNode>. There are
  51392. // two cases where extra normalization is needed:
  51393. // 1. When the children contains components - because a functional component
  51394. // may return an Array instead of a single root. In this case, just a simple
  51395. // normalization is needed - if any child is an Array, we flatten the whole
  51396. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  51397. // because functional components already normalize their own children.
  51398. function simpleNormalizeChildren (children) {
  51399. for (var i = 0; i < children.length; i++) {
  51400. if (Array.isArray(children[i])) {
  51401. return Array.prototype.concat.apply([], children)
  51402. }
  51403. }
  51404. return children
  51405. }
  51406. // 2. When the children contains constructs that always generated nested Arrays,
  51407. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  51408. // with hand-written render functions / JSX. In such cases a full normalization
  51409. // is needed to cater to all possible types of children values.
  51410. function normalizeChildren (children) {
  51411. return isPrimitive(children)
  51412. ? [createTextVNode(children)]
  51413. : Array.isArray(children)
  51414. ? normalizeArrayChildren(children)
  51415. : undefined
  51416. }
  51417. function isTextNode (node) {
  51418. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  51419. }
  51420. function normalizeArrayChildren (children, nestedIndex) {
  51421. var res = [];
  51422. var i, c, lastIndex, last;
  51423. for (i = 0; i < children.length; i++) {
  51424. c = children[i];
  51425. if (isUndef(c) || typeof c === 'boolean') { continue }
  51426. lastIndex = res.length - 1;
  51427. last = res[lastIndex];
  51428. // nested
  51429. if (Array.isArray(c)) {
  51430. if (c.length > 0) {
  51431. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  51432. // merge adjacent text nodes
  51433. if (isTextNode(c[0]) && isTextNode(last)) {
  51434. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  51435. c.shift();
  51436. }
  51437. res.push.apply(res, c);
  51438. }
  51439. } else if (isPrimitive(c)) {
  51440. if (isTextNode(last)) {
  51441. // merge adjacent text nodes
  51442. // this is necessary for SSR hydration because text nodes are
  51443. // essentially merged when rendered to HTML strings
  51444. res[lastIndex] = createTextVNode(last.text + c);
  51445. } else if (c !== '') {
  51446. // convert primitive to vnode
  51447. res.push(createTextVNode(c));
  51448. }
  51449. } else {
  51450. if (isTextNode(c) && isTextNode(last)) {
  51451. // merge adjacent text nodes
  51452. res[lastIndex] = createTextVNode(last.text + c.text);
  51453. } else {
  51454. // default key for nested array children (likely generated by v-for)
  51455. if (isTrue(children._isVList) &&
  51456. isDef(c.tag) &&
  51457. isUndef(c.key) &&
  51458. isDef(nestedIndex)) {
  51459. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  51460. }
  51461. res.push(c);
  51462. }
  51463. }
  51464. }
  51465. return res
  51466. }
  51467. /* */
  51468. function initProvide (vm) {
  51469. var provide = vm.$options.provide;
  51470. if (provide) {
  51471. vm._provided = typeof provide === 'function'
  51472. ? provide.call(vm)
  51473. : provide;
  51474. }
  51475. }
  51476. function initInjections (vm) {
  51477. var result = resolveInject(vm.$options.inject, vm);
  51478. if (result) {
  51479. toggleObserving(false);
  51480. Object.keys(result).forEach(function (key) {
  51481. /* istanbul ignore else */
  51482. {
  51483. defineReactive$$1(vm, key, result[key], function () {
  51484. warn(
  51485. "Avoid mutating an injected value directly since the changes will be " +
  51486. "overwritten whenever the provided component re-renders. " +
  51487. "injection being mutated: \"" + key + "\"",
  51488. vm
  51489. );
  51490. });
  51491. }
  51492. });
  51493. toggleObserving(true);
  51494. }
  51495. }
  51496. function resolveInject (inject, vm) {
  51497. if (inject) {
  51498. // inject is :any because flow is not smart enough to figure out cached
  51499. var result = Object.create(null);
  51500. var keys = hasSymbol
  51501. ? Reflect.ownKeys(inject)
  51502. : Object.keys(inject);
  51503. for (var i = 0; i < keys.length; i++) {
  51504. var key = keys[i];
  51505. // #6574 in case the inject object is observed...
  51506. if (key === '__ob__') { continue }
  51507. var provideKey = inject[key].from;
  51508. var source = vm;
  51509. while (source) {
  51510. if (source._provided && hasOwn(source._provided, provideKey)) {
  51511. result[key] = source._provided[provideKey];
  51512. break
  51513. }
  51514. source = source.$parent;
  51515. }
  51516. if (!source) {
  51517. if ('default' in inject[key]) {
  51518. var provideDefault = inject[key].default;
  51519. result[key] = typeof provideDefault === 'function'
  51520. ? provideDefault.call(vm)
  51521. : provideDefault;
  51522. } else {
  51523. warn(("Injection \"" + key + "\" not found"), vm);
  51524. }
  51525. }
  51526. }
  51527. return result
  51528. }
  51529. }
  51530. /* */
  51531. /**
  51532. * Runtime helper for resolving raw children VNodes into a slot object.
  51533. */
  51534. function resolveSlots (
  51535. children,
  51536. context
  51537. ) {
  51538. if (!children || !children.length) {
  51539. return {}
  51540. }
  51541. var slots = {};
  51542. for (var i = 0, l = children.length; i < l; i++) {
  51543. var child = children[i];
  51544. var data = child.data;
  51545. // remove slot attribute if the node is resolved as a Vue slot node
  51546. if (data && data.attrs && data.attrs.slot) {
  51547. delete data.attrs.slot;
  51548. }
  51549. // named slots should only be respected if the vnode was rendered in the
  51550. // same context.
  51551. if ((child.context === context || child.fnContext === context) &&
  51552. data && data.slot != null
  51553. ) {
  51554. var name = data.slot;
  51555. var slot = (slots[name] || (slots[name] = []));
  51556. if (child.tag === 'template') {
  51557. slot.push.apply(slot, child.children || []);
  51558. } else {
  51559. slot.push(child);
  51560. }
  51561. } else {
  51562. (slots.default || (slots.default = [])).push(child);
  51563. }
  51564. }
  51565. // ignore slots that contains only whitespace
  51566. for (var name$1 in slots) {
  51567. if (slots[name$1].every(isWhitespace)) {
  51568. delete slots[name$1];
  51569. }
  51570. }
  51571. return slots
  51572. }
  51573. function isWhitespace (node) {
  51574. return (node.isComment && !node.asyncFactory) || node.text === ' '
  51575. }
  51576. /* */
  51577. function normalizeScopedSlots (
  51578. slots,
  51579. normalSlots,
  51580. prevSlots
  51581. ) {
  51582. var res;
  51583. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  51584. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  51585. var key = slots && slots.$key;
  51586. if (!slots) {
  51587. res = {};
  51588. } else if (slots._normalized) {
  51589. // fast path 1: child component re-render only, parent did not change
  51590. return slots._normalized
  51591. } else if (
  51592. isStable &&
  51593. prevSlots &&
  51594. prevSlots !== emptyObject &&
  51595. key === prevSlots.$key &&
  51596. !hasNormalSlots &&
  51597. !prevSlots.$hasNormal
  51598. ) {
  51599. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  51600. // only need to normalize once
  51601. return prevSlots
  51602. } else {
  51603. res = {};
  51604. for (var key$1 in slots) {
  51605. if (slots[key$1] && key$1[0] !== '$') {
  51606. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  51607. }
  51608. }
  51609. }
  51610. // expose normal slots on scopedSlots
  51611. for (var key$2 in normalSlots) {
  51612. if (!(key$2 in res)) {
  51613. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  51614. }
  51615. }
  51616. // avoriaz seems to mock a non-extensible $scopedSlots object
  51617. // and when that is passed down this would cause an error
  51618. if (slots && Object.isExtensible(slots)) {
  51619. (slots)._normalized = res;
  51620. }
  51621. def(res, '$stable', isStable);
  51622. def(res, '$key', key);
  51623. def(res, '$hasNormal', hasNormalSlots);
  51624. return res
  51625. }
  51626. function normalizeScopedSlot(normalSlots, key, fn) {
  51627. var normalized = function () {
  51628. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  51629. res = res && typeof res === 'object' && !Array.isArray(res)
  51630. ? [res] // single vnode
  51631. : normalizeChildren(res);
  51632. return res && (
  51633. res.length === 0 ||
  51634. (res.length === 1 && res[0].isComment) // #9658
  51635. ) ? undefined
  51636. : res
  51637. };
  51638. // this is a slot using the new v-slot syntax without scope. although it is
  51639. // compiled as a scoped slot, render fn users would expect it to be present
  51640. // on this.$slots because the usage is semantically a normal slot.
  51641. if (fn.proxy) {
  51642. Object.defineProperty(normalSlots, key, {
  51643. get: normalized,
  51644. enumerable: true,
  51645. configurable: true
  51646. });
  51647. }
  51648. return normalized
  51649. }
  51650. function proxyNormalSlot(slots, key) {
  51651. return function () { return slots[key]; }
  51652. }
  51653. /* */
  51654. /**
  51655. * Runtime helper for rendering v-for lists.
  51656. */
  51657. function renderList (
  51658. val,
  51659. render
  51660. ) {
  51661. var ret, i, l, keys, key;
  51662. if (Array.isArray(val) || typeof val === 'string') {
  51663. ret = new Array(val.length);
  51664. for (i = 0, l = val.length; i < l; i++) {
  51665. ret[i] = render(val[i], i);
  51666. }
  51667. } else if (typeof val === 'number') {
  51668. ret = new Array(val);
  51669. for (i = 0; i < val; i++) {
  51670. ret[i] = render(i + 1, i);
  51671. }
  51672. } else if (isObject(val)) {
  51673. if (hasSymbol && val[Symbol.iterator]) {
  51674. ret = [];
  51675. var iterator = val[Symbol.iterator]();
  51676. var result = iterator.next();
  51677. while (!result.done) {
  51678. ret.push(render(result.value, ret.length));
  51679. result = iterator.next();
  51680. }
  51681. } else {
  51682. keys = Object.keys(val);
  51683. ret = new Array(keys.length);
  51684. for (i = 0, l = keys.length; i < l; i++) {
  51685. key = keys[i];
  51686. ret[i] = render(val[key], key, i);
  51687. }
  51688. }
  51689. }
  51690. if (!isDef(ret)) {
  51691. ret = [];
  51692. }
  51693. (ret)._isVList = true;
  51694. return ret
  51695. }
  51696. /* */
  51697. /**
  51698. * Runtime helper for rendering <slot>
  51699. */
  51700. function renderSlot (
  51701. name,
  51702. fallback,
  51703. props,
  51704. bindObject
  51705. ) {
  51706. var scopedSlotFn = this.$scopedSlots[name];
  51707. var nodes;
  51708. if (scopedSlotFn) { // scoped slot
  51709. props = props || {};
  51710. if (bindObject) {
  51711. if (!isObject(bindObject)) {
  51712. warn(
  51713. 'slot v-bind without argument expects an Object',
  51714. this
  51715. );
  51716. }
  51717. props = extend(extend({}, bindObject), props);
  51718. }
  51719. nodes = scopedSlotFn(props) || fallback;
  51720. } else {
  51721. nodes = this.$slots[name] || fallback;
  51722. }
  51723. var target = props && props.slot;
  51724. if (target) {
  51725. return this.$createElement('template', { slot: target }, nodes)
  51726. } else {
  51727. return nodes
  51728. }
  51729. }
  51730. /* */
  51731. /**
  51732. * Runtime helper for resolving filters
  51733. */
  51734. function resolveFilter (id) {
  51735. return resolveAsset(this.$options, 'filters', id, true) || identity
  51736. }
  51737. /* */
  51738. function isKeyNotMatch (expect, actual) {
  51739. if (Array.isArray(expect)) {
  51740. return expect.indexOf(actual) === -1
  51741. } else {
  51742. return expect !== actual
  51743. }
  51744. }
  51745. /**
  51746. * Runtime helper for checking keyCodes from config.
  51747. * exposed as Vue.prototype._k
  51748. * passing in eventKeyName as last argument separately for backwards compat
  51749. */
  51750. function checkKeyCodes (
  51751. eventKeyCode,
  51752. key,
  51753. builtInKeyCode,
  51754. eventKeyName,
  51755. builtInKeyName
  51756. ) {
  51757. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  51758. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  51759. return isKeyNotMatch(builtInKeyName, eventKeyName)
  51760. } else if (mappedKeyCode) {
  51761. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  51762. } else if (eventKeyName) {
  51763. return hyphenate(eventKeyName) !== key
  51764. }
  51765. }
  51766. /* */
  51767. /**
  51768. * Runtime helper for merging v-bind="object" into a VNode's data.
  51769. */
  51770. function bindObjectProps (
  51771. data,
  51772. tag,
  51773. value,
  51774. asProp,
  51775. isSync
  51776. ) {
  51777. if (value) {
  51778. if (!isObject(value)) {
  51779. warn(
  51780. 'v-bind without argument expects an Object or Array value',
  51781. this
  51782. );
  51783. } else {
  51784. if (Array.isArray(value)) {
  51785. value = toObject(value);
  51786. }
  51787. var hash;
  51788. var loop = function ( key ) {
  51789. if (
  51790. key === 'class' ||
  51791. key === 'style' ||
  51792. isReservedAttribute(key)
  51793. ) {
  51794. hash = data;
  51795. } else {
  51796. var type = data.attrs && data.attrs.type;
  51797. hash = asProp || config.mustUseProp(tag, type, key)
  51798. ? data.domProps || (data.domProps = {})
  51799. : data.attrs || (data.attrs = {});
  51800. }
  51801. var camelizedKey = camelize(key);
  51802. var hyphenatedKey = hyphenate(key);
  51803. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  51804. hash[key] = value[key];
  51805. if (isSync) {
  51806. var on = data.on || (data.on = {});
  51807. on[("update:" + key)] = function ($event) {
  51808. value[key] = $event;
  51809. };
  51810. }
  51811. }
  51812. };
  51813. for (var key in value) loop( key );
  51814. }
  51815. }
  51816. return data
  51817. }
  51818. /* */
  51819. /**
  51820. * Runtime helper for rendering static trees.
  51821. */
  51822. function renderStatic (
  51823. index,
  51824. isInFor
  51825. ) {
  51826. var cached = this._staticTrees || (this._staticTrees = []);
  51827. var tree = cached[index];
  51828. // if has already-rendered static tree and not inside v-for,
  51829. // we can reuse the same tree.
  51830. if (tree && !isInFor) {
  51831. return tree
  51832. }
  51833. // otherwise, render a fresh tree.
  51834. tree = cached[index] = this.$options.staticRenderFns[index].call(
  51835. this._renderProxy,
  51836. null,
  51837. this // for render fns generated for functional component templates
  51838. );
  51839. markStatic(tree, ("__static__" + index), false);
  51840. return tree
  51841. }
  51842. /**
  51843. * Runtime helper for v-once.
  51844. * Effectively it means marking the node as static with a unique key.
  51845. */
  51846. function markOnce (
  51847. tree,
  51848. index,
  51849. key
  51850. ) {
  51851. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  51852. return tree
  51853. }
  51854. function markStatic (
  51855. tree,
  51856. key,
  51857. isOnce
  51858. ) {
  51859. if (Array.isArray(tree)) {
  51860. for (var i = 0; i < tree.length; i++) {
  51861. if (tree[i] && typeof tree[i] !== 'string') {
  51862. markStaticNode(tree[i], (key + "_" + i), isOnce);
  51863. }
  51864. }
  51865. } else {
  51866. markStaticNode(tree, key, isOnce);
  51867. }
  51868. }
  51869. function markStaticNode (node, key, isOnce) {
  51870. node.isStatic = true;
  51871. node.key = key;
  51872. node.isOnce = isOnce;
  51873. }
  51874. /* */
  51875. function bindObjectListeners (data, value) {
  51876. if (value) {
  51877. if (!isPlainObject(value)) {
  51878. warn(
  51879. 'v-on without argument expects an Object value',
  51880. this
  51881. );
  51882. } else {
  51883. var on = data.on = data.on ? extend({}, data.on) : {};
  51884. for (var key in value) {
  51885. var existing = on[key];
  51886. var ours = value[key];
  51887. on[key] = existing ? [].concat(existing, ours) : ours;
  51888. }
  51889. }
  51890. }
  51891. return data
  51892. }
  51893. /* */
  51894. function resolveScopedSlots (
  51895. fns, // see flow/vnode
  51896. res,
  51897. // the following are added in 2.6
  51898. hasDynamicKeys,
  51899. contentHashKey
  51900. ) {
  51901. res = res || { $stable: !hasDynamicKeys };
  51902. for (var i = 0; i < fns.length; i++) {
  51903. var slot = fns[i];
  51904. if (Array.isArray(slot)) {
  51905. resolveScopedSlots(slot, res, hasDynamicKeys);
  51906. } else if (slot) {
  51907. // marker for reverse proxying v-slot without scope on this.$slots
  51908. if (slot.proxy) {
  51909. slot.fn.proxy = true;
  51910. }
  51911. res[slot.key] = slot.fn;
  51912. }
  51913. }
  51914. if (contentHashKey) {
  51915. (res).$key = contentHashKey;
  51916. }
  51917. return res
  51918. }
  51919. /* */
  51920. function bindDynamicKeys (baseObj, values) {
  51921. for (var i = 0; i < values.length; i += 2) {
  51922. var key = values[i];
  51923. if (typeof key === 'string' && key) {
  51924. baseObj[values[i]] = values[i + 1];
  51925. } else if (key !== '' && key !== null) {
  51926. // null is a special value for explicitly removing a binding
  51927. warn(
  51928. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  51929. this
  51930. );
  51931. }
  51932. }
  51933. return baseObj
  51934. }
  51935. // helper to dynamically append modifier runtime markers to event names.
  51936. // ensure only append when value is already string, otherwise it will be cast
  51937. // to string and cause the type check to miss.
  51938. function prependModifier (value, symbol) {
  51939. return typeof value === 'string' ? symbol + value : value
  51940. }
  51941. /* */
  51942. function installRenderHelpers (target) {
  51943. target._o = markOnce;
  51944. target._n = toNumber;
  51945. target._s = toString;
  51946. target._l = renderList;
  51947. target._t = renderSlot;
  51948. target._q = looseEqual;
  51949. target._i = looseIndexOf;
  51950. target._m = renderStatic;
  51951. target._f = resolveFilter;
  51952. target._k = checkKeyCodes;
  51953. target._b = bindObjectProps;
  51954. target._v = createTextVNode;
  51955. target._e = createEmptyVNode;
  51956. target._u = resolveScopedSlots;
  51957. target._g = bindObjectListeners;
  51958. target._d = bindDynamicKeys;
  51959. target._p = prependModifier;
  51960. }
  51961. /* */
  51962. function FunctionalRenderContext (
  51963. data,
  51964. props,
  51965. children,
  51966. parent,
  51967. Ctor
  51968. ) {
  51969. var this$1 = this;
  51970. var options = Ctor.options;
  51971. // ensure the createElement function in functional components
  51972. // gets a unique context - this is necessary for correct named slot check
  51973. var contextVm;
  51974. if (hasOwn(parent, '_uid')) {
  51975. contextVm = Object.create(parent);
  51976. // $flow-disable-line
  51977. contextVm._original = parent;
  51978. } else {
  51979. // the context vm passed in is a functional context as well.
  51980. // in this case we want to make sure we are able to get a hold to the
  51981. // real context instance.
  51982. contextVm = parent;
  51983. // $flow-disable-line
  51984. parent = parent._original;
  51985. }
  51986. var isCompiled = isTrue(options._compiled);
  51987. var needNormalization = !isCompiled;
  51988. this.data = data;
  51989. this.props = props;
  51990. this.children = children;
  51991. this.parent = parent;
  51992. this.listeners = data.on || emptyObject;
  51993. this.injections = resolveInject(options.inject, parent);
  51994. this.slots = function () {
  51995. if (!this$1.$slots) {
  51996. normalizeScopedSlots(
  51997. data.scopedSlots,
  51998. this$1.$slots = resolveSlots(children, parent)
  51999. );
  52000. }
  52001. return this$1.$slots
  52002. };
  52003. Object.defineProperty(this, 'scopedSlots', ({
  52004. enumerable: true,
  52005. get: function get () {
  52006. return normalizeScopedSlots(data.scopedSlots, this.slots())
  52007. }
  52008. }));
  52009. // support for compiled functional template
  52010. if (isCompiled) {
  52011. // exposing $options for renderStatic()
  52012. this.$options = options;
  52013. // pre-resolve slots for renderSlot()
  52014. this.$slots = this.slots();
  52015. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  52016. }
  52017. if (options._scopeId) {
  52018. this._c = function (a, b, c, d) {
  52019. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  52020. if (vnode && !Array.isArray(vnode)) {
  52021. vnode.fnScopeId = options._scopeId;
  52022. vnode.fnContext = parent;
  52023. }
  52024. return vnode
  52025. };
  52026. } else {
  52027. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  52028. }
  52029. }
  52030. installRenderHelpers(FunctionalRenderContext.prototype);
  52031. function createFunctionalComponent (
  52032. Ctor,
  52033. propsData,
  52034. data,
  52035. contextVm,
  52036. children
  52037. ) {
  52038. var options = Ctor.options;
  52039. var props = {};
  52040. var propOptions = options.props;
  52041. if (isDef(propOptions)) {
  52042. for (var key in propOptions) {
  52043. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  52044. }
  52045. } else {
  52046. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  52047. if (isDef(data.props)) { mergeProps(props, data.props); }
  52048. }
  52049. var renderContext = new FunctionalRenderContext(
  52050. data,
  52051. props,
  52052. children,
  52053. contextVm,
  52054. Ctor
  52055. );
  52056. var vnode = options.render.call(null, renderContext._c, renderContext);
  52057. if (vnode instanceof VNode) {
  52058. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  52059. } else if (Array.isArray(vnode)) {
  52060. var vnodes = normalizeChildren(vnode) || [];
  52061. var res = new Array(vnodes.length);
  52062. for (var i = 0; i < vnodes.length; i++) {
  52063. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  52064. }
  52065. return res
  52066. }
  52067. }
  52068. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  52069. // #7817 clone node before setting fnContext, otherwise if the node is reused
  52070. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  52071. // that should not be matched to match.
  52072. var clone = cloneVNode(vnode);
  52073. clone.fnContext = contextVm;
  52074. clone.fnOptions = options;
  52075. {
  52076. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  52077. }
  52078. if (data.slot) {
  52079. (clone.data || (clone.data = {})).slot = data.slot;
  52080. }
  52081. return clone
  52082. }
  52083. function mergeProps (to, from) {
  52084. for (var key in from) {
  52085. to[camelize(key)] = from[key];
  52086. }
  52087. }
  52088. /* */
  52089. /* */
  52090. /* */
  52091. /* */
  52092. // inline hooks to be invoked on component VNodes during patch
  52093. var componentVNodeHooks = {
  52094. init: function init (vnode, hydrating) {
  52095. if (
  52096. vnode.componentInstance &&
  52097. !vnode.componentInstance._isDestroyed &&
  52098. vnode.data.keepAlive
  52099. ) {
  52100. // kept-alive components, treat as a patch
  52101. var mountedNode = vnode; // work around flow
  52102. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  52103. } else {
  52104. var child = vnode.componentInstance = createComponentInstanceForVnode(
  52105. vnode,
  52106. activeInstance
  52107. );
  52108. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  52109. }
  52110. },
  52111. prepatch: function prepatch (oldVnode, vnode) {
  52112. var options = vnode.componentOptions;
  52113. var child = vnode.componentInstance = oldVnode.componentInstance;
  52114. updateChildComponent(
  52115. child,
  52116. options.propsData, // updated props
  52117. options.listeners, // updated listeners
  52118. vnode, // new parent vnode
  52119. options.children // new children
  52120. );
  52121. },
  52122. insert: function insert (vnode) {
  52123. var context = vnode.context;
  52124. var componentInstance = vnode.componentInstance;
  52125. if (!componentInstance._isMounted) {
  52126. componentInstance._isMounted = true;
  52127. callHook(componentInstance, 'mounted');
  52128. }
  52129. if (vnode.data.keepAlive) {
  52130. if (context._isMounted) {
  52131. // vue-router#1212
  52132. // During updates, a kept-alive component's child components may
  52133. // change, so directly walking the tree here may call activated hooks
  52134. // on incorrect children. Instead we push them into a queue which will
  52135. // be processed after the whole patch process ended.
  52136. queueActivatedComponent(componentInstance);
  52137. } else {
  52138. activateChildComponent(componentInstance, true /* direct */);
  52139. }
  52140. }
  52141. },
  52142. destroy: function destroy (vnode) {
  52143. var componentInstance = vnode.componentInstance;
  52144. if (!componentInstance._isDestroyed) {
  52145. if (!vnode.data.keepAlive) {
  52146. componentInstance.$destroy();
  52147. } else {
  52148. deactivateChildComponent(componentInstance, true /* direct */);
  52149. }
  52150. }
  52151. }
  52152. };
  52153. var hooksToMerge = Object.keys(componentVNodeHooks);
  52154. function createComponent (
  52155. Ctor,
  52156. data,
  52157. context,
  52158. children,
  52159. tag
  52160. ) {
  52161. if (isUndef(Ctor)) {
  52162. return
  52163. }
  52164. var baseCtor = context.$options._base;
  52165. // plain options object: turn it into a constructor
  52166. if (isObject(Ctor)) {
  52167. Ctor = baseCtor.extend(Ctor);
  52168. }
  52169. // if at this stage it's not a constructor or an async component factory,
  52170. // reject.
  52171. if (typeof Ctor !== 'function') {
  52172. {
  52173. warn(("Invalid Component definition: " + (String(Ctor))), context);
  52174. }
  52175. return
  52176. }
  52177. // async component
  52178. var asyncFactory;
  52179. if (isUndef(Ctor.cid)) {
  52180. asyncFactory = Ctor;
  52181. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  52182. if (Ctor === undefined) {
  52183. // return a placeholder node for async component, which is rendered
  52184. // as a comment node but preserves all the raw information for the node.
  52185. // the information will be used for async server-rendering and hydration.
  52186. return createAsyncPlaceholder(
  52187. asyncFactory,
  52188. data,
  52189. context,
  52190. children,
  52191. tag
  52192. )
  52193. }
  52194. }
  52195. data = data || {};
  52196. // resolve constructor options in case global mixins are applied after
  52197. // component constructor creation
  52198. resolveConstructorOptions(Ctor);
  52199. // transform component v-model data into props & events
  52200. if (isDef(data.model)) {
  52201. transformModel(Ctor.options, data);
  52202. }
  52203. // extract props
  52204. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  52205. // functional component
  52206. if (isTrue(Ctor.options.functional)) {
  52207. return createFunctionalComponent(Ctor, propsData, data, context, children)
  52208. }
  52209. // extract listeners, since these needs to be treated as
  52210. // child component listeners instead of DOM listeners
  52211. var listeners = data.on;
  52212. // replace with listeners with .native modifier
  52213. // so it gets processed during parent component patch.
  52214. data.on = data.nativeOn;
  52215. if (isTrue(Ctor.options.abstract)) {
  52216. // abstract components do not keep anything
  52217. // other than props & listeners & slot
  52218. // work around flow
  52219. var slot = data.slot;
  52220. data = {};
  52221. if (slot) {
  52222. data.slot = slot;
  52223. }
  52224. }
  52225. // install component management hooks onto the placeholder node
  52226. installComponentHooks(data);
  52227. // return a placeholder vnode
  52228. var name = Ctor.options.name || tag;
  52229. var vnode = new VNode(
  52230. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  52231. data, undefined, undefined, undefined, context,
  52232. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  52233. asyncFactory
  52234. );
  52235. return vnode
  52236. }
  52237. function createComponentInstanceForVnode (
  52238. vnode, // we know it's MountedComponentVNode but flow doesn't
  52239. parent // activeInstance in lifecycle state
  52240. ) {
  52241. var options = {
  52242. _isComponent: true,
  52243. _parentVnode: vnode,
  52244. parent: parent
  52245. };
  52246. // check inline-template render functions
  52247. var inlineTemplate = vnode.data.inlineTemplate;
  52248. if (isDef(inlineTemplate)) {
  52249. options.render = inlineTemplate.render;
  52250. options.staticRenderFns = inlineTemplate.staticRenderFns;
  52251. }
  52252. return new vnode.componentOptions.Ctor(options)
  52253. }
  52254. function installComponentHooks (data) {
  52255. var hooks = data.hook || (data.hook = {});
  52256. for (var i = 0; i < hooksToMerge.length; i++) {
  52257. var key = hooksToMerge[i];
  52258. var existing = hooks[key];
  52259. var toMerge = componentVNodeHooks[key];
  52260. if (existing !== toMerge && !(existing && existing._merged)) {
  52261. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  52262. }
  52263. }
  52264. }
  52265. function mergeHook$1 (f1, f2) {
  52266. var merged = function (a, b) {
  52267. // flow complains about extra args which is why we use any
  52268. f1(a, b);
  52269. f2(a, b);
  52270. };
  52271. merged._merged = true;
  52272. return merged
  52273. }
  52274. // transform component v-model info (value and callback) into
  52275. // prop and event handler respectively.
  52276. function transformModel (options, data) {
  52277. var prop = (options.model && options.model.prop) || 'value';
  52278. var event = (options.model && options.model.event) || 'input'
  52279. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  52280. var on = data.on || (data.on = {});
  52281. var existing = on[event];
  52282. var callback = data.model.callback;
  52283. if (isDef(existing)) {
  52284. if (
  52285. Array.isArray(existing)
  52286. ? existing.indexOf(callback) === -1
  52287. : existing !== callback
  52288. ) {
  52289. on[event] = [callback].concat(existing);
  52290. }
  52291. } else {
  52292. on[event] = callback;
  52293. }
  52294. }
  52295. /* */
  52296. var SIMPLE_NORMALIZE = 1;
  52297. var ALWAYS_NORMALIZE = 2;
  52298. // wrapper function for providing a more flexible interface
  52299. // without getting yelled at by flow
  52300. function createElement (
  52301. context,
  52302. tag,
  52303. data,
  52304. children,
  52305. normalizationType,
  52306. alwaysNormalize
  52307. ) {
  52308. if (Array.isArray(data) || isPrimitive(data)) {
  52309. normalizationType = children;
  52310. children = data;
  52311. data = undefined;
  52312. }
  52313. if (isTrue(alwaysNormalize)) {
  52314. normalizationType = ALWAYS_NORMALIZE;
  52315. }
  52316. return _createElement(context, tag, data, children, normalizationType)
  52317. }
  52318. function _createElement (
  52319. context,
  52320. tag,
  52321. data,
  52322. children,
  52323. normalizationType
  52324. ) {
  52325. if (isDef(data) && isDef((data).__ob__)) {
  52326. warn(
  52327. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  52328. 'Always create fresh vnode data objects in each render!',
  52329. context
  52330. );
  52331. return createEmptyVNode()
  52332. }
  52333. // object syntax in v-bind
  52334. if (isDef(data) && isDef(data.is)) {
  52335. tag = data.is;
  52336. }
  52337. if (!tag) {
  52338. // in case of component :is set to falsy value
  52339. return createEmptyVNode()
  52340. }
  52341. // warn against non-primitive key
  52342. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  52343. ) {
  52344. {
  52345. warn(
  52346. 'Avoid using non-primitive value as key, ' +
  52347. 'use string/number value instead.',
  52348. context
  52349. );
  52350. }
  52351. }
  52352. // support single function children as default scoped slot
  52353. if (Array.isArray(children) &&
  52354. typeof children[0] === 'function'
  52355. ) {
  52356. data = data || {};
  52357. data.scopedSlots = { default: children[0] };
  52358. children.length = 0;
  52359. }
  52360. if (normalizationType === ALWAYS_NORMALIZE) {
  52361. children = normalizeChildren(children);
  52362. } else if (normalizationType === SIMPLE_NORMALIZE) {
  52363. children = simpleNormalizeChildren(children);
  52364. }
  52365. var vnode, ns;
  52366. if (typeof tag === 'string') {
  52367. var Ctor;
  52368. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  52369. if (config.isReservedTag(tag)) {
  52370. // platform built-in elements
  52371. if (isDef(data) && isDef(data.nativeOn)) {
  52372. warn(
  52373. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  52374. context
  52375. );
  52376. }
  52377. vnode = new VNode(
  52378. config.parsePlatformTagName(tag), data, children,
  52379. undefined, undefined, context
  52380. );
  52381. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  52382. // component
  52383. vnode = createComponent(Ctor, data, context, children, tag);
  52384. } else {
  52385. // unknown or unlisted namespaced elements
  52386. // check at runtime because it may get assigned a namespace when its
  52387. // parent normalizes children
  52388. vnode = new VNode(
  52389. tag, data, children,
  52390. undefined, undefined, context
  52391. );
  52392. }
  52393. } else {
  52394. // direct component options / constructor
  52395. vnode = createComponent(tag, data, context, children);
  52396. }
  52397. if (Array.isArray(vnode)) {
  52398. return vnode
  52399. } else if (isDef(vnode)) {
  52400. if (isDef(ns)) { applyNS(vnode, ns); }
  52401. if (isDef(data)) { registerDeepBindings(data); }
  52402. return vnode
  52403. } else {
  52404. return createEmptyVNode()
  52405. }
  52406. }
  52407. function applyNS (vnode, ns, force) {
  52408. vnode.ns = ns;
  52409. if (vnode.tag === 'foreignObject') {
  52410. // use default namespace inside foreignObject
  52411. ns = undefined;
  52412. force = true;
  52413. }
  52414. if (isDef(vnode.children)) {
  52415. for (var i = 0, l = vnode.children.length; i < l; i++) {
  52416. var child = vnode.children[i];
  52417. if (isDef(child.tag) && (
  52418. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  52419. applyNS(child, ns, force);
  52420. }
  52421. }
  52422. }
  52423. }
  52424. // ref #5318
  52425. // necessary to ensure parent re-render when deep bindings like :style and
  52426. // :class are used on slot nodes
  52427. function registerDeepBindings (data) {
  52428. if (isObject(data.style)) {
  52429. traverse(data.style);
  52430. }
  52431. if (isObject(data.class)) {
  52432. traverse(data.class);
  52433. }
  52434. }
  52435. /* */
  52436. function initRender (vm) {
  52437. vm._vnode = null; // the root of the child tree
  52438. vm._staticTrees = null; // v-once cached trees
  52439. var options = vm.$options;
  52440. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  52441. var renderContext = parentVnode && parentVnode.context;
  52442. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  52443. vm.$scopedSlots = emptyObject;
  52444. // bind the createElement fn to this instance
  52445. // so that we get proper render context inside it.
  52446. // args order: tag, data, children, normalizationType, alwaysNormalize
  52447. // internal version is used by render functions compiled from templates
  52448. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  52449. // normalization is always applied for the public version, used in
  52450. // user-written render functions.
  52451. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  52452. // $attrs & $listeners are exposed for easier HOC creation.
  52453. // they need to be reactive so that HOCs using them are always updated
  52454. var parentData = parentVnode && parentVnode.data;
  52455. /* istanbul ignore else */
  52456. {
  52457. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  52458. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  52459. }, true);
  52460. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  52461. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  52462. }, true);
  52463. }
  52464. }
  52465. var currentRenderingInstance = null;
  52466. function renderMixin (Vue) {
  52467. // install runtime convenience helpers
  52468. installRenderHelpers(Vue.prototype);
  52469. Vue.prototype.$nextTick = function (fn) {
  52470. return nextTick(fn, this)
  52471. };
  52472. Vue.prototype._render = function () {
  52473. var vm = this;
  52474. var ref = vm.$options;
  52475. var render = ref.render;
  52476. var _parentVnode = ref._parentVnode;
  52477. if (_parentVnode) {
  52478. vm.$scopedSlots = normalizeScopedSlots(
  52479. _parentVnode.data.scopedSlots,
  52480. vm.$slots,
  52481. vm.$scopedSlots
  52482. );
  52483. }
  52484. // set parent vnode. this allows render functions to have access
  52485. // to the data on the placeholder node.
  52486. vm.$vnode = _parentVnode;
  52487. // render self
  52488. var vnode;
  52489. try {
  52490. // There's no need to maintain a stack because all render fns are called
  52491. // separately from one another. Nested component's render fns are called
  52492. // when parent component is patched.
  52493. currentRenderingInstance = vm;
  52494. vnode = render.call(vm._renderProxy, vm.$createElement);
  52495. } catch (e) {
  52496. handleError(e, vm, "render");
  52497. // return error render result,
  52498. // or previous vnode to prevent render error causing blank component
  52499. /* istanbul ignore else */
  52500. if (vm.$options.renderError) {
  52501. try {
  52502. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  52503. } catch (e) {
  52504. handleError(e, vm, "renderError");
  52505. vnode = vm._vnode;
  52506. }
  52507. } else {
  52508. vnode = vm._vnode;
  52509. }
  52510. } finally {
  52511. currentRenderingInstance = null;
  52512. }
  52513. // if the returned array contains only a single node, allow it
  52514. if (Array.isArray(vnode) && vnode.length === 1) {
  52515. vnode = vnode[0];
  52516. }
  52517. // return empty vnode in case the render function errored out
  52518. if (!(vnode instanceof VNode)) {
  52519. if (Array.isArray(vnode)) {
  52520. warn(
  52521. 'Multiple root nodes returned from render function. Render function ' +
  52522. 'should return a single root node.',
  52523. vm
  52524. );
  52525. }
  52526. vnode = createEmptyVNode();
  52527. }
  52528. // set parent
  52529. vnode.parent = _parentVnode;
  52530. return vnode
  52531. };
  52532. }
  52533. /* */
  52534. function ensureCtor (comp, base) {
  52535. if (
  52536. comp.__esModule ||
  52537. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  52538. ) {
  52539. comp = comp.default;
  52540. }
  52541. return isObject(comp)
  52542. ? base.extend(comp)
  52543. : comp
  52544. }
  52545. function createAsyncPlaceholder (
  52546. factory,
  52547. data,
  52548. context,
  52549. children,
  52550. tag
  52551. ) {
  52552. var node = createEmptyVNode();
  52553. node.asyncFactory = factory;
  52554. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  52555. return node
  52556. }
  52557. function resolveAsyncComponent (
  52558. factory,
  52559. baseCtor
  52560. ) {
  52561. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  52562. return factory.errorComp
  52563. }
  52564. if (isDef(factory.resolved)) {
  52565. return factory.resolved
  52566. }
  52567. var owner = currentRenderingInstance;
  52568. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  52569. // already pending
  52570. factory.owners.push(owner);
  52571. }
  52572. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  52573. return factory.loadingComp
  52574. }
  52575. if (owner && !isDef(factory.owners)) {
  52576. var owners = factory.owners = [owner];
  52577. var sync = true;
  52578. var timerLoading = null;
  52579. var timerTimeout = null
  52580. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  52581. var forceRender = function (renderCompleted) {
  52582. for (var i = 0, l = owners.length; i < l; i++) {
  52583. (owners[i]).$forceUpdate();
  52584. }
  52585. if (renderCompleted) {
  52586. owners.length = 0;
  52587. if (timerLoading !== null) {
  52588. clearTimeout(timerLoading);
  52589. timerLoading = null;
  52590. }
  52591. if (timerTimeout !== null) {
  52592. clearTimeout(timerTimeout);
  52593. timerTimeout = null;
  52594. }
  52595. }
  52596. };
  52597. var resolve = once(function (res) {
  52598. // cache resolved
  52599. factory.resolved = ensureCtor(res, baseCtor);
  52600. // invoke callbacks only if this is not a synchronous resolve
  52601. // (async resolves are shimmed as synchronous during SSR)
  52602. if (!sync) {
  52603. forceRender(true);
  52604. } else {
  52605. owners.length = 0;
  52606. }
  52607. });
  52608. var reject = once(function (reason) {
  52609. warn(
  52610. "Failed to resolve async component: " + (String(factory)) +
  52611. (reason ? ("\nReason: " + reason) : '')
  52612. );
  52613. if (isDef(factory.errorComp)) {
  52614. factory.error = true;
  52615. forceRender(true);
  52616. }
  52617. });
  52618. var res = factory(resolve, reject);
  52619. if (isObject(res)) {
  52620. if (isPromise(res)) {
  52621. // () => Promise
  52622. if (isUndef(factory.resolved)) {
  52623. res.then(resolve, reject);
  52624. }
  52625. } else if (isPromise(res.component)) {
  52626. res.component.then(resolve, reject);
  52627. if (isDef(res.error)) {
  52628. factory.errorComp = ensureCtor(res.error, baseCtor);
  52629. }
  52630. if (isDef(res.loading)) {
  52631. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  52632. if (res.delay === 0) {
  52633. factory.loading = true;
  52634. } else {
  52635. timerLoading = setTimeout(function () {
  52636. timerLoading = null;
  52637. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  52638. factory.loading = true;
  52639. forceRender(false);
  52640. }
  52641. }, res.delay || 200);
  52642. }
  52643. }
  52644. if (isDef(res.timeout)) {
  52645. timerTimeout = setTimeout(function () {
  52646. timerTimeout = null;
  52647. if (isUndef(factory.resolved)) {
  52648. reject(
  52649. "timeout (" + (res.timeout) + "ms)"
  52650. );
  52651. }
  52652. }, res.timeout);
  52653. }
  52654. }
  52655. }
  52656. sync = false;
  52657. // return in case resolved synchronously
  52658. return factory.loading
  52659. ? factory.loadingComp
  52660. : factory.resolved
  52661. }
  52662. }
  52663. /* */
  52664. function isAsyncPlaceholder (node) {
  52665. return node.isComment && node.asyncFactory
  52666. }
  52667. /* */
  52668. function getFirstComponentChild (children) {
  52669. if (Array.isArray(children)) {
  52670. for (var i = 0; i < children.length; i++) {
  52671. var c = children[i];
  52672. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  52673. return c
  52674. }
  52675. }
  52676. }
  52677. }
  52678. /* */
  52679. /* */
  52680. function initEvents (vm) {
  52681. vm._events = Object.create(null);
  52682. vm._hasHookEvent = false;
  52683. // init parent attached events
  52684. var listeners = vm.$options._parentListeners;
  52685. if (listeners) {
  52686. updateComponentListeners(vm, listeners);
  52687. }
  52688. }
  52689. var target;
  52690. function add (event, fn) {
  52691. target.$on(event, fn);
  52692. }
  52693. function remove$1 (event, fn) {
  52694. target.$off(event, fn);
  52695. }
  52696. function createOnceHandler (event, fn) {
  52697. var _target = target;
  52698. return function onceHandler () {
  52699. var res = fn.apply(null, arguments);
  52700. if (res !== null) {
  52701. _target.$off(event, onceHandler);
  52702. }
  52703. }
  52704. }
  52705. function updateComponentListeners (
  52706. vm,
  52707. listeners,
  52708. oldListeners
  52709. ) {
  52710. target = vm;
  52711. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  52712. target = undefined;
  52713. }
  52714. function eventsMixin (Vue) {
  52715. var hookRE = /^hook:/;
  52716. Vue.prototype.$on = function (event, fn) {
  52717. var vm = this;
  52718. if (Array.isArray(event)) {
  52719. for (var i = 0, l = event.length; i < l; i++) {
  52720. vm.$on(event[i], fn);
  52721. }
  52722. } else {
  52723. (vm._events[event] || (vm._events[event] = [])).push(fn);
  52724. // optimize hook:event cost by using a boolean flag marked at registration
  52725. // instead of a hash lookup
  52726. if (hookRE.test(event)) {
  52727. vm._hasHookEvent = true;
  52728. }
  52729. }
  52730. return vm
  52731. };
  52732. Vue.prototype.$once = function (event, fn) {
  52733. var vm = this;
  52734. function on () {
  52735. vm.$off(event, on);
  52736. fn.apply(vm, arguments);
  52737. }
  52738. on.fn = fn;
  52739. vm.$on(event, on);
  52740. return vm
  52741. };
  52742. Vue.prototype.$off = function (event, fn) {
  52743. var vm = this;
  52744. // all
  52745. if (!arguments.length) {
  52746. vm._events = Object.create(null);
  52747. return vm
  52748. }
  52749. // array of events
  52750. if (Array.isArray(event)) {
  52751. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  52752. vm.$off(event[i$1], fn);
  52753. }
  52754. return vm
  52755. }
  52756. // specific event
  52757. var cbs = vm._events[event];
  52758. if (!cbs) {
  52759. return vm
  52760. }
  52761. if (!fn) {
  52762. vm._events[event] = null;
  52763. return vm
  52764. }
  52765. // specific handler
  52766. var cb;
  52767. var i = cbs.length;
  52768. while (i--) {
  52769. cb = cbs[i];
  52770. if (cb === fn || cb.fn === fn) {
  52771. cbs.splice(i, 1);
  52772. break
  52773. }
  52774. }
  52775. return vm
  52776. };
  52777. Vue.prototype.$emit = function (event) {
  52778. var vm = this;
  52779. {
  52780. var lowerCaseEvent = event.toLowerCase();
  52781. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  52782. tip(
  52783. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  52784. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  52785. "Note that HTML attributes are case-insensitive and you cannot use " +
  52786. "v-on to listen to camelCase events when using in-DOM templates. " +
  52787. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  52788. );
  52789. }
  52790. }
  52791. var cbs = vm._events[event];
  52792. if (cbs) {
  52793. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  52794. var args = toArray(arguments, 1);
  52795. var info = "event handler for \"" + event + "\"";
  52796. for (var i = 0, l = cbs.length; i < l; i++) {
  52797. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  52798. }
  52799. }
  52800. return vm
  52801. };
  52802. }
  52803. /* */
  52804. var activeInstance = null;
  52805. var isUpdatingChildComponent = false;
  52806. function setActiveInstance(vm) {
  52807. var prevActiveInstance = activeInstance;
  52808. activeInstance = vm;
  52809. return function () {
  52810. activeInstance = prevActiveInstance;
  52811. }
  52812. }
  52813. function initLifecycle (vm) {
  52814. var options = vm.$options;
  52815. // locate first non-abstract parent
  52816. var parent = options.parent;
  52817. if (parent && !options.abstract) {
  52818. while (parent.$options.abstract && parent.$parent) {
  52819. parent = parent.$parent;
  52820. }
  52821. parent.$children.push(vm);
  52822. }
  52823. vm.$parent = parent;
  52824. vm.$root = parent ? parent.$root : vm;
  52825. vm.$children = [];
  52826. vm.$refs = {};
  52827. vm._watcher = null;
  52828. vm._inactive = null;
  52829. vm._directInactive = false;
  52830. vm._isMounted = false;
  52831. vm._isDestroyed = false;
  52832. vm._isBeingDestroyed = false;
  52833. }
  52834. function lifecycleMixin (Vue) {
  52835. Vue.prototype._update = function (vnode, hydrating) {
  52836. var vm = this;
  52837. var prevEl = vm.$el;
  52838. var prevVnode = vm._vnode;
  52839. var restoreActiveInstance = setActiveInstance(vm);
  52840. vm._vnode = vnode;
  52841. // Vue.prototype.__patch__ is injected in entry points
  52842. // based on the rendering backend used.
  52843. if (!prevVnode) {
  52844. // initial render
  52845. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  52846. } else {
  52847. // updates
  52848. vm.$el = vm.__patch__(prevVnode, vnode);
  52849. }
  52850. restoreActiveInstance();
  52851. // update __vue__ reference
  52852. if (prevEl) {
  52853. prevEl.__vue__ = null;
  52854. }
  52855. if (vm.$el) {
  52856. vm.$el.__vue__ = vm;
  52857. }
  52858. // if parent is an HOC, update its $el as well
  52859. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  52860. vm.$parent.$el = vm.$el;
  52861. }
  52862. // updated hook is called by the scheduler to ensure that children are
  52863. // updated in a parent's updated hook.
  52864. };
  52865. Vue.prototype.$forceUpdate = function () {
  52866. var vm = this;
  52867. if (vm._watcher) {
  52868. vm._watcher.update();
  52869. }
  52870. };
  52871. Vue.prototype.$destroy = function () {
  52872. var vm = this;
  52873. if (vm._isBeingDestroyed) {
  52874. return
  52875. }
  52876. callHook(vm, 'beforeDestroy');
  52877. vm._isBeingDestroyed = true;
  52878. // remove self from parent
  52879. var parent = vm.$parent;
  52880. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  52881. remove(parent.$children, vm);
  52882. }
  52883. // teardown watchers
  52884. if (vm._watcher) {
  52885. vm._watcher.teardown();
  52886. }
  52887. var i = vm._watchers.length;
  52888. while (i--) {
  52889. vm._watchers[i].teardown();
  52890. }
  52891. // remove reference from data ob
  52892. // frozen object may not have observer.
  52893. if (vm._data.__ob__) {
  52894. vm._data.__ob__.vmCount--;
  52895. }
  52896. // call the last hook...
  52897. vm._isDestroyed = true;
  52898. // invoke destroy hooks on current rendered tree
  52899. vm.__patch__(vm._vnode, null);
  52900. // fire destroyed hook
  52901. callHook(vm, 'destroyed');
  52902. // turn off all instance listeners.
  52903. vm.$off();
  52904. // remove __vue__ reference
  52905. if (vm.$el) {
  52906. vm.$el.__vue__ = null;
  52907. }
  52908. // release circular reference (#6759)
  52909. if (vm.$vnode) {
  52910. vm.$vnode.parent = null;
  52911. }
  52912. };
  52913. }
  52914. function mountComponent (
  52915. vm,
  52916. el,
  52917. hydrating
  52918. ) {
  52919. vm.$el = el;
  52920. if (!vm.$options.render) {
  52921. vm.$options.render = createEmptyVNode;
  52922. {
  52923. /* istanbul ignore if */
  52924. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  52925. vm.$options.el || el) {
  52926. warn(
  52927. 'You are using the runtime-only build of Vue where the template ' +
  52928. 'compiler is not available. Either pre-compile the templates into ' +
  52929. 'render functions, or use the compiler-included build.',
  52930. vm
  52931. );
  52932. } else {
  52933. warn(
  52934. 'Failed to mount component: template or render function not defined.',
  52935. vm
  52936. );
  52937. }
  52938. }
  52939. }
  52940. callHook(vm, 'beforeMount');
  52941. var updateComponent;
  52942. /* istanbul ignore if */
  52943. if (config.performance && mark) {
  52944. updateComponent = function () {
  52945. var name = vm._name;
  52946. var id = vm._uid;
  52947. var startTag = "vue-perf-start:" + id;
  52948. var endTag = "vue-perf-end:" + id;
  52949. mark(startTag);
  52950. var vnode = vm._render();
  52951. mark(endTag);
  52952. measure(("vue " + name + " render"), startTag, endTag);
  52953. mark(startTag);
  52954. vm._update(vnode, hydrating);
  52955. mark(endTag);
  52956. measure(("vue " + name + " patch"), startTag, endTag);
  52957. };
  52958. } else {
  52959. updateComponent = function () {
  52960. vm._update(vm._render(), hydrating);
  52961. };
  52962. }
  52963. // we set this to vm._watcher inside the watcher's constructor
  52964. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  52965. // component's mounted hook), which relies on vm._watcher being already defined
  52966. new Watcher(vm, updateComponent, noop, {
  52967. before: function before () {
  52968. if (vm._isMounted && !vm._isDestroyed) {
  52969. callHook(vm, 'beforeUpdate');
  52970. }
  52971. }
  52972. }, true /* isRenderWatcher */);
  52973. hydrating = false;
  52974. // manually mounted instance, call mounted on self
  52975. // mounted is called for render-created child components in its inserted hook
  52976. if (vm.$vnode == null) {
  52977. vm._isMounted = true;
  52978. callHook(vm, 'mounted');
  52979. }
  52980. return vm
  52981. }
  52982. function updateChildComponent (
  52983. vm,
  52984. propsData,
  52985. listeners,
  52986. parentVnode,
  52987. renderChildren
  52988. ) {
  52989. {
  52990. isUpdatingChildComponent = true;
  52991. }
  52992. // determine whether component has slot children
  52993. // we need to do this before overwriting $options._renderChildren.
  52994. // check if there are dynamic scopedSlots (hand-written or compiled but with
  52995. // dynamic slot names). Static scoped slots compiled from template has the
  52996. // "$stable" marker.
  52997. var newScopedSlots = parentVnode.data.scopedSlots;
  52998. var oldScopedSlots = vm.$scopedSlots;
  52999. var hasDynamicScopedSlot = !!(
  53000. (newScopedSlots && !newScopedSlots.$stable) ||
  53001. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  53002. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  53003. );
  53004. // Any static slot children from the parent may have changed during parent's
  53005. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  53006. // update is necessary to ensure correctness.
  53007. var needsForceUpdate = !!(
  53008. renderChildren || // has new static slots
  53009. vm.$options._renderChildren || // has old static slots
  53010. hasDynamicScopedSlot
  53011. );
  53012. vm.$options._parentVnode = parentVnode;
  53013. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  53014. if (vm._vnode) { // update child tree's parent
  53015. vm._vnode.parent = parentVnode;
  53016. }
  53017. vm.$options._renderChildren = renderChildren;
  53018. // update $attrs and $listeners hash
  53019. // these are also reactive so they may trigger child update if the child
  53020. // used them during render
  53021. vm.$attrs = parentVnode.data.attrs || emptyObject;
  53022. vm.$listeners = listeners || emptyObject;
  53023. // update props
  53024. if (propsData && vm.$options.props) {
  53025. toggleObserving(false);
  53026. var props = vm._props;
  53027. var propKeys = vm.$options._propKeys || [];
  53028. for (var i = 0; i < propKeys.length; i++) {
  53029. var key = propKeys[i];
  53030. var propOptions = vm.$options.props; // wtf flow?
  53031. props[key] = validateProp(key, propOptions, propsData, vm);
  53032. }
  53033. toggleObserving(true);
  53034. // keep a copy of raw propsData
  53035. vm.$options.propsData = propsData;
  53036. }
  53037. // update listeners
  53038. listeners = listeners || emptyObject;
  53039. var oldListeners = vm.$options._parentListeners;
  53040. vm.$options._parentListeners = listeners;
  53041. updateComponentListeners(vm, listeners, oldListeners);
  53042. // resolve slots + force update if has children
  53043. if (needsForceUpdate) {
  53044. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  53045. vm.$forceUpdate();
  53046. }
  53047. {
  53048. isUpdatingChildComponent = false;
  53049. }
  53050. }
  53051. function isInInactiveTree (vm) {
  53052. while (vm && (vm = vm.$parent)) {
  53053. if (vm._inactive) { return true }
  53054. }
  53055. return false
  53056. }
  53057. function activateChildComponent (vm, direct) {
  53058. if (direct) {
  53059. vm._directInactive = false;
  53060. if (isInInactiveTree(vm)) {
  53061. return
  53062. }
  53063. } else if (vm._directInactive) {
  53064. return
  53065. }
  53066. if (vm._inactive || vm._inactive === null) {
  53067. vm._inactive = false;
  53068. for (var i = 0; i < vm.$children.length; i++) {
  53069. activateChildComponent(vm.$children[i]);
  53070. }
  53071. callHook(vm, 'activated');
  53072. }
  53073. }
  53074. function deactivateChildComponent (vm, direct) {
  53075. if (direct) {
  53076. vm._directInactive = true;
  53077. if (isInInactiveTree(vm)) {
  53078. return
  53079. }
  53080. }
  53081. if (!vm._inactive) {
  53082. vm._inactive = true;
  53083. for (var i = 0; i < vm.$children.length; i++) {
  53084. deactivateChildComponent(vm.$children[i]);
  53085. }
  53086. callHook(vm, 'deactivated');
  53087. }
  53088. }
  53089. function callHook (vm, hook) {
  53090. // #7573 disable dep collection when invoking lifecycle hooks
  53091. pushTarget();
  53092. var handlers = vm.$options[hook];
  53093. var info = hook + " hook";
  53094. if (handlers) {
  53095. for (var i = 0, j = handlers.length; i < j; i++) {
  53096. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  53097. }
  53098. }
  53099. if (vm._hasHookEvent) {
  53100. vm.$emit('hook:' + hook);
  53101. }
  53102. popTarget();
  53103. }
  53104. /* */
  53105. var MAX_UPDATE_COUNT = 100;
  53106. var queue = [];
  53107. var activatedChildren = [];
  53108. var has = {};
  53109. var circular = {};
  53110. var waiting = false;
  53111. var flushing = false;
  53112. var index = 0;
  53113. /**
  53114. * Reset the scheduler's state.
  53115. */
  53116. function resetSchedulerState () {
  53117. index = queue.length = activatedChildren.length = 0;
  53118. has = {};
  53119. {
  53120. circular = {};
  53121. }
  53122. waiting = flushing = false;
  53123. }
  53124. // Async edge case #6566 requires saving the timestamp when event listeners are
  53125. // attached. However, calling performance.now() has a perf overhead especially
  53126. // if the page has thousands of event listeners. Instead, we take a timestamp
  53127. // every time the scheduler flushes and use that for all event listeners
  53128. // attached during that flush.
  53129. var currentFlushTimestamp = 0;
  53130. // Async edge case fix requires storing an event listener's attach timestamp.
  53131. var getNow = Date.now;
  53132. // Determine what event timestamp the browser is using. Annoyingly, the
  53133. // timestamp can either be hi-res (relative to page load) or low-res
  53134. // (relative to UNIX epoch), so in order to compare time we have to use the
  53135. // same timestamp type when saving the flush timestamp.
  53136. // All IE versions use low-res event timestamps, and have problematic clock
  53137. // implementations (#9632)
  53138. if (inBrowser && !isIE) {
  53139. var performance = window.performance;
  53140. if (
  53141. performance &&
  53142. typeof performance.now === 'function' &&
  53143. getNow() > document.createEvent('Event').timeStamp
  53144. ) {
  53145. // if the event timestamp, although evaluated AFTER the Date.now(), is
  53146. // smaller than it, it means the event is using a hi-res timestamp,
  53147. // and we need to use the hi-res version for event listener timestamps as
  53148. // well.
  53149. getNow = function () { return performance.now(); };
  53150. }
  53151. }
  53152. /**
  53153. * Flush both queues and run the watchers.
  53154. */
  53155. function flushSchedulerQueue () {
  53156. currentFlushTimestamp = getNow();
  53157. flushing = true;
  53158. var watcher, id;
  53159. // Sort queue before flush.
  53160. // This ensures that:
  53161. // 1. Components are updated from parent to child. (because parent is always
  53162. // created before the child)
  53163. // 2. A component's user watchers are run before its render watcher (because
  53164. // user watchers are created before the render watcher)
  53165. // 3. If a component is destroyed during a parent component's watcher run,
  53166. // its watchers can be skipped.
  53167. queue.sort(function (a, b) { return a.id - b.id; });
  53168. // do not cache length because more watchers might be pushed
  53169. // as we run existing watchers
  53170. for (index = 0; index < queue.length; index++) {
  53171. watcher = queue[index];
  53172. if (watcher.before) {
  53173. watcher.before();
  53174. }
  53175. id = watcher.id;
  53176. has[id] = null;
  53177. watcher.run();
  53178. // in dev build, check and stop circular updates.
  53179. if (has[id] != null) {
  53180. circular[id] = (circular[id] || 0) + 1;
  53181. if (circular[id] > MAX_UPDATE_COUNT) {
  53182. warn(
  53183. 'You may have an infinite update loop ' + (
  53184. watcher.user
  53185. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  53186. : "in a component render function."
  53187. ),
  53188. watcher.vm
  53189. );
  53190. break
  53191. }
  53192. }
  53193. }
  53194. // keep copies of post queues before resetting state
  53195. var activatedQueue = activatedChildren.slice();
  53196. var updatedQueue = queue.slice();
  53197. resetSchedulerState();
  53198. // call component updated and activated hooks
  53199. callActivatedHooks(activatedQueue);
  53200. callUpdatedHooks(updatedQueue);
  53201. // devtool hook
  53202. /* istanbul ignore if */
  53203. if (devtools && config.devtools) {
  53204. devtools.emit('flush');
  53205. }
  53206. }
  53207. function callUpdatedHooks (queue) {
  53208. var i = queue.length;
  53209. while (i--) {
  53210. var watcher = queue[i];
  53211. var vm = watcher.vm;
  53212. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  53213. callHook(vm, 'updated');
  53214. }
  53215. }
  53216. }
  53217. /**
  53218. * Queue a kept-alive component that was activated during patch.
  53219. * The queue will be processed after the entire tree has been patched.
  53220. */
  53221. function queueActivatedComponent (vm) {
  53222. // setting _inactive to false here so that a render function can
  53223. // rely on checking whether it's in an inactive tree (e.g. router-view)
  53224. vm._inactive = false;
  53225. activatedChildren.push(vm);
  53226. }
  53227. function callActivatedHooks (queue) {
  53228. for (var i = 0; i < queue.length; i++) {
  53229. queue[i]._inactive = true;
  53230. activateChildComponent(queue[i], true /* true */);
  53231. }
  53232. }
  53233. /**
  53234. * Push a watcher into the watcher queue.
  53235. * Jobs with duplicate IDs will be skipped unless it's
  53236. * pushed when the queue is being flushed.
  53237. */
  53238. function queueWatcher (watcher) {
  53239. var id = watcher.id;
  53240. if (has[id] == null) {
  53241. has[id] = true;
  53242. if (!flushing) {
  53243. queue.push(watcher);
  53244. } else {
  53245. // if already flushing, splice the watcher based on its id
  53246. // if already past its id, it will be run next immediately.
  53247. var i = queue.length - 1;
  53248. while (i > index && queue[i].id > watcher.id) {
  53249. i--;
  53250. }
  53251. queue.splice(i + 1, 0, watcher);
  53252. }
  53253. // queue the flush
  53254. if (!waiting) {
  53255. waiting = true;
  53256. if (!config.async) {
  53257. flushSchedulerQueue();
  53258. return
  53259. }
  53260. nextTick(flushSchedulerQueue);
  53261. }
  53262. }
  53263. }
  53264. /* */
  53265. var uid$2 = 0;
  53266. /**
  53267. * A watcher parses an expression, collects dependencies,
  53268. * and fires callback when the expression value changes.
  53269. * This is used for both the $watch() api and directives.
  53270. */
  53271. var Watcher = function Watcher (
  53272. vm,
  53273. expOrFn,
  53274. cb,
  53275. options,
  53276. isRenderWatcher
  53277. ) {
  53278. this.vm = vm;
  53279. if (isRenderWatcher) {
  53280. vm._watcher = this;
  53281. }
  53282. vm._watchers.push(this);
  53283. // options
  53284. if (options) {
  53285. this.deep = !!options.deep;
  53286. this.user = !!options.user;
  53287. this.lazy = !!options.lazy;
  53288. this.sync = !!options.sync;
  53289. this.before = options.before;
  53290. } else {
  53291. this.deep = this.user = this.lazy = this.sync = false;
  53292. }
  53293. this.cb = cb;
  53294. this.id = ++uid$2; // uid for batching
  53295. this.active = true;
  53296. this.dirty = this.lazy; // for lazy watchers
  53297. this.deps = [];
  53298. this.newDeps = [];
  53299. this.depIds = new _Set();
  53300. this.newDepIds = new _Set();
  53301. this.expression = expOrFn.toString();
  53302. // parse expression for getter
  53303. if (typeof expOrFn === 'function') {
  53304. this.getter = expOrFn;
  53305. } else {
  53306. this.getter = parsePath(expOrFn);
  53307. if (!this.getter) {
  53308. this.getter = noop;
  53309. warn(
  53310. "Failed watching path: \"" + expOrFn + "\" " +
  53311. 'Watcher only accepts simple dot-delimited paths. ' +
  53312. 'For full control, use a function instead.',
  53313. vm
  53314. );
  53315. }
  53316. }
  53317. this.value = this.lazy
  53318. ? undefined
  53319. : this.get();
  53320. };
  53321. /**
  53322. * Evaluate the getter, and re-collect dependencies.
  53323. */
  53324. Watcher.prototype.get = function get () {
  53325. pushTarget(this);
  53326. var value;
  53327. var vm = this.vm;
  53328. try {
  53329. value = this.getter.call(vm, vm);
  53330. } catch (e) {
  53331. if (this.user) {
  53332. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  53333. } else {
  53334. throw e
  53335. }
  53336. } finally {
  53337. // "touch" every property so they are all tracked as
  53338. // dependencies for deep watching
  53339. if (this.deep) {
  53340. traverse(value);
  53341. }
  53342. popTarget();
  53343. this.cleanupDeps();
  53344. }
  53345. return value
  53346. };
  53347. /**
  53348. * Add a dependency to this directive.
  53349. */
  53350. Watcher.prototype.addDep = function addDep (dep) {
  53351. var id = dep.id;
  53352. if (!this.newDepIds.has(id)) {
  53353. this.newDepIds.add(id);
  53354. this.newDeps.push(dep);
  53355. if (!this.depIds.has(id)) {
  53356. dep.addSub(this);
  53357. }
  53358. }
  53359. };
  53360. /**
  53361. * Clean up for dependency collection.
  53362. */
  53363. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  53364. var i = this.deps.length;
  53365. while (i--) {
  53366. var dep = this.deps[i];
  53367. if (!this.newDepIds.has(dep.id)) {
  53368. dep.removeSub(this);
  53369. }
  53370. }
  53371. var tmp = this.depIds;
  53372. this.depIds = this.newDepIds;
  53373. this.newDepIds = tmp;
  53374. this.newDepIds.clear();
  53375. tmp = this.deps;
  53376. this.deps = this.newDeps;
  53377. this.newDeps = tmp;
  53378. this.newDeps.length = 0;
  53379. };
  53380. /**
  53381. * Subscriber interface.
  53382. * Will be called when a dependency changes.
  53383. */
  53384. Watcher.prototype.update = function update () {
  53385. /* istanbul ignore else */
  53386. if (this.lazy) {
  53387. this.dirty = true;
  53388. } else if (this.sync) {
  53389. this.run();
  53390. } else {
  53391. queueWatcher(this);
  53392. }
  53393. };
  53394. /**
  53395. * Scheduler job interface.
  53396. * Will be called by the scheduler.
  53397. */
  53398. Watcher.prototype.run = function run () {
  53399. if (this.active) {
  53400. var value = this.get();
  53401. if (
  53402. value !== this.value ||
  53403. // Deep watchers and watchers on Object/Arrays should fire even
  53404. // when the value is the same, because the value may
  53405. // have mutated.
  53406. isObject(value) ||
  53407. this.deep
  53408. ) {
  53409. // set new value
  53410. var oldValue = this.value;
  53411. this.value = value;
  53412. if (this.user) {
  53413. try {
  53414. this.cb.call(this.vm, value, oldValue);
  53415. } catch (e) {
  53416. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  53417. }
  53418. } else {
  53419. this.cb.call(this.vm, value, oldValue);
  53420. }
  53421. }
  53422. }
  53423. };
  53424. /**
  53425. * Evaluate the value of the watcher.
  53426. * This only gets called for lazy watchers.
  53427. */
  53428. Watcher.prototype.evaluate = function evaluate () {
  53429. this.value = this.get();
  53430. this.dirty = false;
  53431. };
  53432. /**
  53433. * Depend on all deps collected by this watcher.
  53434. */
  53435. Watcher.prototype.depend = function depend () {
  53436. var i = this.deps.length;
  53437. while (i--) {
  53438. this.deps[i].depend();
  53439. }
  53440. };
  53441. /**
  53442. * Remove self from all dependencies' subscriber list.
  53443. */
  53444. Watcher.prototype.teardown = function teardown () {
  53445. if (this.active) {
  53446. // remove self from vm's watcher list
  53447. // this is a somewhat expensive operation so we skip it
  53448. // if the vm is being destroyed.
  53449. if (!this.vm._isBeingDestroyed) {
  53450. remove(this.vm._watchers, this);
  53451. }
  53452. var i = this.deps.length;
  53453. while (i--) {
  53454. this.deps[i].removeSub(this);
  53455. }
  53456. this.active = false;
  53457. }
  53458. };
  53459. /* */
  53460. var sharedPropertyDefinition = {
  53461. enumerable: true,
  53462. configurable: true,
  53463. get: noop,
  53464. set: noop
  53465. };
  53466. function proxy (target, sourceKey, key) {
  53467. sharedPropertyDefinition.get = function proxyGetter () {
  53468. return this[sourceKey][key]
  53469. };
  53470. sharedPropertyDefinition.set = function proxySetter (val) {
  53471. this[sourceKey][key] = val;
  53472. };
  53473. Object.defineProperty(target, key, sharedPropertyDefinition);
  53474. }
  53475. function initState (vm) {
  53476. vm._watchers = [];
  53477. var opts = vm.$options;
  53478. if (opts.props) { initProps(vm, opts.props); }
  53479. if (opts.methods) { initMethods(vm, opts.methods); }
  53480. if (opts.data) {
  53481. initData(vm);
  53482. } else {
  53483. observe(vm._data = {}, true /* asRootData */);
  53484. }
  53485. if (opts.computed) { initComputed(vm, opts.computed); }
  53486. if (opts.watch && opts.watch !== nativeWatch) {
  53487. initWatch(vm, opts.watch);
  53488. }
  53489. }
  53490. function initProps (vm, propsOptions) {
  53491. var propsData = vm.$options.propsData || {};
  53492. var props = vm._props = {};
  53493. // cache prop keys so that future props updates can iterate using Array
  53494. // instead of dynamic object key enumeration.
  53495. var keys = vm.$options._propKeys = [];
  53496. var isRoot = !vm.$parent;
  53497. // root instance props should be converted
  53498. if (!isRoot) {
  53499. toggleObserving(false);
  53500. }
  53501. var loop = function ( key ) {
  53502. keys.push(key);
  53503. var value = validateProp(key, propsOptions, propsData, vm);
  53504. /* istanbul ignore else */
  53505. {
  53506. var hyphenatedKey = hyphenate(key);
  53507. if (isReservedAttribute(hyphenatedKey) ||
  53508. config.isReservedAttr(hyphenatedKey)) {
  53509. warn(
  53510. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  53511. vm
  53512. );
  53513. }
  53514. defineReactive$$1(props, key, value, function () {
  53515. if (!isRoot && !isUpdatingChildComponent) {
  53516. warn(
  53517. "Avoid mutating a prop directly since the value will be " +
  53518. "overwritten whenever the parent component re-renders. " +
  53519. "Instead, use a data or computed property based on the prop's " +
  53520. "value. Prop being mutated: \"" + key + "\"",
  53521. vm
  53522. );
  53523. }
  53524. });
  53525. }
  53526. // static props are already proxied on the component's prototype
  53527. // during Vue.extend(). We only need to proxy props defined at
  53528. // instantiation here.
  53529. if (!(key in vm)) {
  53530. proxy(vm, "_props", key);
  53531. }
  53532. };
  53533. for (var key in propsOptions) loop( key );
  53534. toggleObserving(true);
  53535. }
  53536. function initData (vm) {
  53537. var data = vm.$options.data;
  53538. data = vm._data = typeof data === 'function'
  53539. ? getData(data, vm)
  53540. : data || {};
  53541. if (!isPlainObject(data)) {
  53542. data = {};
  53543. warn(
  53544. 'data functions should return an object:\n' +
  53545. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  53546. vm
  53547. );
  53548. }
  53549. // proxy data on instance
  53550. var keys = Object.keys(data);
  53551. var props = vm.$options.props;
  53552. var methods = vm.$options.methods;
  53553. var i = keys.length;
  53554. while (i--) {
  53555. var key = keys[i];
  53556. {
  53557. if (methods && hasOwn(methods, key)) {
  53558. warn(
  53559. ("Method \"" + key + "\" has already been defined as a data property."),
  53560. vm
  53561. );
  53562. }
  53563. }
  53564. if (props && hasOwn(props, key)) {
  53565. warn(
  53566. "The data property \"" + key + "\" is already declared as a prop. " +
  53567. "Use prop default value instead.",
  53568. vm
  53569. );
  53570. } else if (!isReserved(key)) {
  53571. proxy(vm, "_data", key);
  53572. }
  53573. }
  53574. // observe data
  53575. observe(data, true /* asRootData */);
  53576. }
  53577. function getData (data, vm) {
  53578. // #7573 disable dep collection when invoking data getters
  53579. pushTarget();
  53580. try {
  53581. return data.call(vm, vm)
  53582. } catch (e) {
  53583. handleError(e, vm, "data()");
  53584. return {}
  53585. } finally {
  53586. popTarget();
  53587. }
  53588. }
  53589. var computedWatcherOptions = { lazy: true };
  53590. function initComputed (vm, computed) {
  53591. // $flow-disable-line
  53592. var watchers = vm._computedWatchers = Object.create(null);
  53593. // computed properties are just getters during SSR
  53594. var isSSR = isServerRendering();
  53595. for (var key in computed) {
  53596. var userDef = computed[key];
  53597. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  53598. if (getter == null) {
  53599. warn(
  53600. ("Getter is missing for computed property \"" + key + "\"."),
  53601. vm
  53602. );
  53603. }
  53604. if (!isSSR) {
  53605. // create internal watcher for the computed property.
  53606. watchers[key] = new Watcher(
  53607. vm,
  53608. getter || noop,
  53609. noop,
  53610. computedWatcherOptions
  53611. );
  53612. }
  53613. // component-defined computed properties are already defined on the
  53614. // component prototype. We only need to define computed properties defined
  53615. // at instantiation here.
  53616. if (!(key in vm)) {
  53617. defineComputed(vm, key, userDef);
  53618. } else {
  53619. if (key in vm.$data) {
  53620. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  53621. } else if (vm.$options.props && key in vm.$options.props) {
  53622. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  53623. }
  53624. }
  53625. }
  53626. }
  53627. function defineComputed (
  53628. target,
  53629. key,
  53630. userDef
  53631. ) {
  53632. var shouldCache = !isServerRendering();
  53633. if (typeof userDef === 'function') {
  53634. sharedPropertyDefinition.get = shouldCache
  53635. ? createComputedGetter(key)
  53636. : createGetterInvoker(userDef);
  53637. sharedPropertyDefinition.set = noop;
  53638. } else {
  53639. sharedPropertyDefinition.get = userDef.get
  53640. ? shouldCache && userDef.cache !== false
  53641. ? createComputedGetter(key)
  53642. : createGetterInvoker(userDef.get)
  53643. : noop;
  53644. sharedPropertyDefinition.set = userDef.set || noop;
  53645. }
  53646. if (sharedPropertyDefinition.set === noop) {
  53647. sharedPropertyDefinition.set = function () {
  53648. warn(
  53649. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  53650. this
  53651. );
  53652. };
  53653. }
  53654. Object.defineProperty(target, key, sharedPropertyDefinition);
  53655. }
  53656. function createComputedGetter (key) {
  53657. return function computedGetter () {
  53658. var watcher = this._computedWatchers && this._computedWatchers[key];
  53659. if (watcher) {
  53660. if (watcher.dirty) {
  53661. watcher.evaluate();
  53662. }
  53663. if (Dep.target) {
  53664. watcher.depend();
  53665. }
  53666. return watcher.value
  53667. }
  53668. }
  53669. }
  53670. function createGetterInvoker(fn) {
  53671. return function computedGetter () {
  53672. return fn.call(this, this)
  53673. }
  53674. }
  53675. function initMethods (vm, methods) {
  53676. var props = vm.$options.props;
  53677. for (var key in methods) {
  53678. {
  53679. if (typeof methods[key] !== 'function') {
  53680. warn(
  53681. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  53682. "Did you reference the function correctly?",
  53683. vm
  53684. );
  53685. }
  53686. if (props && hasOwn(props, key)) {
  53687. warn(
  53688. ("Method \"" + key + "\" has already been defined as a prop."),
  53689. vm
  53690. );
  53691. }
  53692. if ((key in vm) && isReserved(key)) {
  53693. warn(
  53694. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  53695. "Avoid defining component methods that start with _ or $."
  53696. );
  53697. }
  53698. }
  53699. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  53700. }
  53701. }
  53702. function initWatch (vm, watch) {
  53703. for (var key in watch) {
  53704. var handler = watch[key];
  53705. if (Array.isArray(handler)) {
  53706. for (var i = 0; i < handler.length; i++) {
  53707. createWatcher(vm, key, handler[i]);
  53708. }
  53709. } else {
  53710. createWatcher(vm, key, handler);
  53711. }
  53712. }
  53713. }
  53714. function createWatcher (
  53715. vm,
  53716. expOrFn,
  53717. handler,
  53718. options
  53719. ) {
  53720. if (isPlainObject(handler)) {
  53721. options = handler;
  53722. handler = handler.handler;
  53723. }
  53724. if (typeof handler === 'string') {
  53725. handler = vm[handler];
  53726. }
  53727. return vm.$watch(expOrFn, handler, options)
  53728. }
  53729. function stateMixin (Vue) {
  53730. // flow somehow has problems with directly declared definition object
  53731. // when using Object.defineProperty, so we have to procedurally build up
  53732. // the object here.
  53733. var dataDef = {};
  53734. dataDef.get = function () { return this._data };
  53735. var propsDef = {};
  53736. propsDef.get = function () { return this._props };
  53737. {
  53738. dataDef.set = function () {
  53739. warn(
  53740. 'Avoid replacing instance root $data. ' +
  53741. 'Use nested data properties instead.',
  53742. this
  53743. );
  53744. };
  53745. propsDef.set = function () {
  53746. warn("$props is readonly.", this);
  53747. };
  53748. }
  53749. Object.defineProperty(Vue.prototype, '$data', dataDef);
  53750. Object.defineProperty(Vue.prototype, '$props', propsDef);
  53751. Vue.prototype.$set = set;
  53752. Vue.prototype.$delete = del;
  53753. Vue.prototype.$watch = function (
  53754. expOrFn,
  53755. cb,
  53756. options
  53757. ) {
  53758. var vm = this;
  53759. if (isPlainObject(cb)) {
  53760. return createWatcher(vm, expOrFn, cb, options)
  53761. }
  53762. options = options || {};
  53763. options.user = true;
  53764. var watcher = new Watcher(vm, expOrFn, cb, options);
  53765. if (options.immediate) {
  53766. try {
  53767. cb.call(vm, watcher.value);
  53768. } catch (error) {
  53769. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  53770. }
  53771. }
  53772. return function unwatchFn () {
  53773. watcher.teardown();
  53774. }
  53775. };
  53776. }
  53777. /* */
  53778. var uid$3 = 0;
  53779. function initMixin (Vue) {
  53780. Vue.prototype._init = function (options) {
  53781. var vm = this;
  53782. // a uid
  53783. vm._uid = uid$3++;
  53784. var startTag, endTag;
  53785. /* istanbul ignore if */
  53786. if (config.performance && mark) {
  53787. startTag = "vue-perf-start:" + (vm._uid);
  53788. endTag = "vue-perf-end:" + (vm._uid);
  53789. mark(startTag);
  53790. }
  53791. // a flag to avoid this being observed
  53792. vm._isVue = true;
  53793. // merge options
  53794. if (options && options._isComponent) {
  53795. // optimize internal component instantiation
  53796. // since dynamic options merging is pretty slow, and none of the
  53797. // internal component options needs special treatment.
  53798. initInternalComponent(vm, options);
  53799. } else {
  53800. vm.$options = mergeOptions(
  53801. resolveConstructorOptions(vm.constructor),
  53802. options || {},
  53803. vm
  53804. );
  53805. }
  53806. /* istanbul ignore else */
  53807. {
  53808. initProxy(vm);
  53809. }
  53810. // expose real self
  53811. vm._self = vm;
  53812. initLifecycle(vm);
  53813. initEvents(vm);
  53814. initRender(vm);
  53815. callHook(vm, 'beforeCreate');
  53816. initInjections(vm); // resolve injections before data/props
  53817. initState(vm);
  53818. initProvide(vm); // resolve provide after data/props
  53819. callHook(vm, 'created');
  53820. /* istanbul ignore if */
  53821. if (config.performance && mark) {
  53822. vm._name = formatComponentName(vm, false);
  53823. mark(endTag);
  53824. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  53825. }
  53826. if (vm.$options.el) {
  53827. vm.$mount(vm.$options.el);
  53828. }
  53829. };
  53830. }
  53831. function initInternalComponent (vm, options) {
  53832. var opts = vm.$options = Object.create(vm.constructor.options);
  53833. // doing this because it's faster than dynamic enumeration.
  53834. var parentVnode = options._parentVnode;
  53835. opts.parent = options.parent;
  53836. opts._parentVnode = parentVnode;
  53837. var vnodeComponentOptions = parentVnode.componentOptions;
  53838. opts.propsData = vnodeComponentOptions.propsData;
  53839. opts._parentListeners = vnodeComponentOptions.listeners;
  53840. opts._renderChildren = vnodeComponentOptions.children;
  53841. opts._componentTag = vnodeComponentOptions.tag;
  53842. if (options.render) {
  53843. opts.render = options.render;
  53844. opts.staticRenderFns = options.staticRenderFns;
  53845. }
  53846. }
  53847. function resolveConstructorOptions (Ctor) {
  53848. var options = Ctor.options;
  53849. if (Ctor.super) {
  53850. var superOptions = resolveConstructorOptions(Ctor.super);
  53851. var cachedSuperOptions = Ctor.superOptions;
  53852. if (superOptions !== cachedSuperOptions) {
  53853. // super option changed,
  53854. // need to resolve new options.
  53855. Ctor.superOptions = superOptions;
  53856. // check if there are any late-modified/attached options (#4976)
  53857. var modifiedOptions = resolveModifiedOptions(Ctor);
  53858. // update base extend options
  53859. if (modifiedOptions) {
  53860. extend(Ctor.extendOptions, modifiedOptions);
  53861. }
  53862. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  53863. if (options.name) {
  53864. options.components[options.name] = Ctor;
  53865. }
  53866. }
  53867. }
  53868. return options
  53869. }
  53870. function resolveModifiedOptions (Ctor) {
  53871. var modified;
  53872. var latest = Ctor.options;
  53873. var sealed = Ctor.sealedOptions;
  53874. for (var key in latest) {
  53875. if (latest[key] !== sealed[key]) {
  53876. if (!modified) { modified = {}; }
  53877. modified[key] = latest[key];
  53878. }
  53879. }
  53880. return modified
  53881. }
  53882. function Vue (options) {
  53883. if (!(this instanceof Vue)
  53884. ) {
  53885. warn('Vue is a constructor and should be called with the `new` keyword');
  53886. }
  53887. this._init(options);
  53888. }
  53889. initMixin(Vue);
  53890. stateMixin(Vue);
  53891. eventsMixin(Vue);
  53892. lifecycleMixin(Vue);
  53893. renderMixin(Vue);
  53894. /* */
  53895. function initUse (Vue) {
  53896. Vue.use = function (plugin) {
  53897. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  53898. if (installedPlugins.indexOf(plugin) > -1) {
  53899. return this
  53900. }
  53901. // additional parameters
  53902. var args = toArray(arguments, 1);
  53903. args.unshift(this);
  53904. if (typeof plugin.install === 'function') {
  53905. plugin.install.apply(plugin, args);
  53906. } else if (typeof plugin === 'function') {
  53907. plugin.apply(null, args);
  53908. }
  53909. installedPlugins.push(plugin);
  53910. return this
  53911. };
  53912. }
  53913. /* */
  53914. function initMixin$1 (Vue) {
  53915. Vue.mixin = function (mixin) {
  53916. this.options = mergeOptions(this.options, mixin);
  53917. return this
  53918. };
  53919. }
  53920. /* */
  53921. function initExtend (Vue) {
  53922. /**
  53923. * Each instance constructor, including Vue, has a unique
  53924. * cid. This enables us to create wrapped "child
  53925. * constructors" for prototypal inheritance and cache them.
  53926. */
  53927. Vue.cid = 0;
  53928. var cid = 1;
  53929. /**
  53930. * Class inheritance
  53931. */
  53932. Vue.extend = function (extendOptions) {
  53933. extendOptions = extendOptions || {};
  53934. var Super = this;
  53935. var SuperId = Super.cid;
  53936. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  53937. if (cachedCtors[SuperId]) {
  53938. return cachedCtors[SuperId]
  53939. }
  53940. var name = extendOptions.name || Super.options.name;
  53941. if (name) {
  53942. validateComponentName(name);
  53943. }
  53944. var Sub = function VueComponent (options) {
  53945. this._init(options);
  53946. };
  53947. Sub.prototype = Object.create(Super.prototype);
  53948. Sub.prototype.constructor = Sub;
  53949. Sub.cid = cid++;
  53950. Sub.options = mergeOptions(
  53951. Super.options,
  53952. extendOptions
  53953. );
  53954. Sub['super'] = Super;
  53955. // For props and computed properties, we define the proxy getters on
  53956. // the Vue instances at extension time, on the extended prototype. This
  53957. // avoids Object.defineProperty calls for each instance created.
  53958. if (Sub.options.props) {
  53959. initProps$1(Sub);
  53960. }
  53961. if (Sub.options.computed) {
  53962. initComputed$1(Sub);
  53963. }
  53964. // allow further extension/mixin/plugin usage
  53965. Sub.extend = Super.extend;
  53966. Sub.mixin = Super.mixin;
  53967. Sub.use = Super.use;
  53968. // create asset registers, so extended classes
  53969. // can have their private assets too.
  53970. ASSET_TYPES.forEach(function (type) {
  53971. Sub[type] = Super[type];
  53972. });
  53973. // enable recursive self-lookup
  53974. if (name) {
  53975. Sub.options.components[name] = Sub;
  53976. }
  53977. // keep a reference to the super options at extension time.
  53978. // later at instantiation we can check if Super's options have
  53979. // been updated.
  53980. Sub.superOptions = Super.options;
  53981. Sub.extendOptions = extendOptions;
  53982. Sub.sealedOptions = extend({}, Sub.options);
  53983. // cache constructor
  53984. cachedCtors[SuperId] = Sub;
  53985. return Sub
  53986. };
  53987. }
  53988. function initProps$1 (Comp) {
  53989. var props = Comp.options.props;
  53990. for (var key in props) {
  53991. proxy(Comp.prototype, "_props", key);
  53992. }
  53993. }
  53994. function initComputed$1 (Comp) {
  53995. var computed = Comp.options.computed;
  53996. for (var key in computed) {
  53997. defineComputed(Comp.prototype, key, computed[key]);
  53998. }
  53999. }
  54000. /* */
  54001. function initAssetRegisters (Vue) {
  54002. /**
  54003. * Create asset registration methods.
  54004. */
  54005. ASSET_TYPES.forEach(function (type) {
  54006. Vue[type] = function (
  54007. id,
  54008. definition
  54009. ) {
  54010. if (!definition) {
  54011. return this.options[type + 's'][id]
  54012. } else {
  54013. /* istanbul ignore if */
  54014. if (type === 'component') {
  54015. validateComponentName(id);
  54016. }
  54017. if (type === 'component' && isPlainObject(definition)) {
  54018. definition.name = definition.name || id;
  54019. definition = this.options._base.extend(definition);
  54020. }
  54021. if (type === 'directive' && typeof definition === 'function') {
  54022. definition = { bind: definition, update: definition };
  54023. }
  54024. this.options[type + 's'][id] = definition;
  54025. return definition
  54026. }
  54027. };
  54028. });
  54029. }
  54030. /* */
  54031. function getComponentName (opts) {
  54032. return opts && (opts.Ctor.options.name || opts.tag)
  54033. }
  54034. function matches (pattern, name) {
  54035. if (Array.isArray(pattern)) {
  54036. return pattern.indexOf(name) > -1
  54037. } else if (typeof pattern === 'string') {
  54038. return pattern.split(',').indexOf(name) > -1
  54039. } else if (isRegExp(pattern)) {
  54040. return pattern.test(name)
  54041. }
  54042. /* istanbul ignore next */
  54043. return false
  54044. }
  54045. function pruneCache (keepAliveInstance, filter) {
  54046. var cache = keepAliveInstance.cache;
  54047. var keys = keepAliveInstance.keys;
  54048. var _vnode = keepAliveInstance._vnode;
  54049. for (var key in cache) {
  54050. var cachedNode = cache[key];
  54051. if (cachedNode) {
  54052. var name = getComponentName(cachedNode.componentOptions);
  54053. if (name && !filter(name)) {
  54054. pruneCacheEntry(cache, key, keys, _vnode);
  54055. }
  54056. }
  54057. }
  54058. }
  54059. function pruneCacheEntry (
  54060. cache,
  54061. key,
  54062. keys,
  54063. current
  54064. ) {
  54065. var cached$$1 = cache[key];
  54066. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  54067. cached$$1.componentInstance.$destroy();
  54068. }
  54069. cache[key] = null;
  54070. remove(keys, key);
  54071. }
  54072. var patternTypes = [String, RegExp, Array];
  54073. var KeepAlive = {
  54074. name: 'keep-alive',
  54075. abstract: true,
  54076. props: {
  54077. include: patternTypes,
  54078. exclude: patternTypes,
  54079. max: [String, Number]
  54080. },
  54081. created: function created () {
  54082. this.cache = Object.create(null);
  54083. this.keys = [];
  54084. },
  54085. destroyed: function destroyed () {
  54086. for (var key in this.cache) {
  54087. pruneCacheEntry(this.cache, key, this.keys);
  54088. }
  54089. },
  54090. mounted: function mounted () {
  54091. var this$1 = this;
  54092. this.$watch('include', function (val) {
  54093. pruneCache(this$1, function (name) { return matches(val, name); });
  54094. });
  54095. this.$watch('exclude', function (val) {
  54096. pruneCache(this$1, function (name) { return !matches(val, name); });
  54097. });
  54098. },
  54099. render: function render () {
  54100. var slot = this.$slots.default;
  54101. var vnode = getFirstComponentChild(slot);
  54102. var componentOptions = vnode && vnode.componentOptions;
  54103. if (componentOptions) {
  54104. // check pattern
  54105. var name = getComponentName(componentOptions);
  54106. var ref = this;
  54107. var include = ref.include;
  54108. var exclude = ref.exclude;
  54109. if (
  54110. // not included
  54111. (include && (!name || !matches(include, name))) ||
  54112. // excluded
  54113. (exclude && name && matches(exclude, name))
  54114. ) {
  54115. return vnode
  54116. }
  54117. var ref$1 = this;
  54118. var cache = ref$1.cache;
  54119. var keys = ref$1.keys;
  54120. var key = vnode.key == null
  54121. // same constructor may get registered as different local components
  54122. // so cid alone is not enough (#3269)
  54123. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  54124. : vnode.key;
  54125. if (cache[key]) {
  54126. vnode.componentInstance = cache[key].componentInstance;
  54127. // make current key freshest
  54128. remove(keys, key);
  54129. keys.push(key);
  54130. } else {
  54131. cache[key] = vnode;
  54132. keys.push(key);
  54133. // prune oldest entry
  54134. if (this.max && keys.length > parseInt(this.max)) {
  54135. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  54136. }
  54137. }
  54138. vnode.data.keepAlive = true;
  54139. }
  54140. return vnode || (slot && slot[0])
  54141. }
  54142. };
  54143. var builtInComponents = {
  54144. KeepAlive: KeepAlive
  54145. };
  54146. /* */
  54147. function initGlobalAPI (Vue) {
  54148. // config
  54149. var configDef = {};
  54150. configDef.get = function () { return config; };
  54151. {
  54152. configDef.set = function () {
  54153. warn(
  54154. 'Do not replace the Vue.config object, set individual fields instead.'
  54155. );
  54156. };
  54157. }
  54158. Object.defineProperty(Vue, 'config', configDef);
  54159. // exposed util methods.
  54160. // NOTE: these are not considered part of the public API - avoid relying on
  54161. // them unless you are aware of the risk.
  54162. Vue.util = {
  54163. warn: warn,
  54164. extend: extend,
  54165. mergeOptions: mergeOptions,
  54166. defineReactive: defineReactive$$1
  54167. };
  54168. Vue.set = set;
  54169. Vue.delete = del;
  54170. Vue.nextTick = nextTick;
  54171. // 2.6 explicit observable API
  54172. Vue.observable = function (obj) {
  54173. observe(obj);
  54174. return obj
  54175. };
  54176. Vue.options = Object.create(null);
  54177. ASSET_TYPES.forEach(function (type) {
  54178. Vue.options[type + 's'] = Object.create(null);
  54179. });
  54180. // this is used to identify the "base" constructor to extend all plain-object
  54181. // components with in Weex's multi-instance scenarios.
  54182. Vue.options._base = Vue;
  54183. extend(Vue.options.components, builtInComponents);
  54184. initUse(Vue);
  54185. initMixin$1(Vue);
  54186. initExtend(Vue);
  54187. initAssetRegisters(Vue);
  54188. }
  54189. initGlobalAPI(Vue);
  54190. Object.defineProperty(Vue.prototype, '$isServer', {
  54191. get: isServerRendering
  54192. });
  54193. Object.defineProperty(Vue.prototype, '$ssrContext', {
  54194. get: function get () {
  54195. /* istanbul ignore next */
  54196. return this.$vnode && this.$vnode.ssrContext
  54197. }
  54198. });
  54199. // expose FunctionalRenderContext for ssr runtime helper installation
  54200. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  54201. value: FunctionalRenderContext
  54202. });
  54203. Vue.version = '2.6.11';
  54204. /* */
  54205. // these are reserved for web because they are directly compiled away
  54206. // during template compilation
  54207. var isReservedAttr = makeMap('style,class');
  54208. // attributes that should be using props for binding
  54209. var acceptValue = makeMap('input,textarea,option,select,progress');
  54210. var mustUseProp = function (tag, type, attr) {
  54211. return (
  54212. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  54213. (attr === 'selected' && tag === 'option') ||
  54214. (attr === 'checked' && tag === 'input') ||
  54215. (attr === 'muted' && tag === 'video')
  54216. )
  54217. };
  54218. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  54219. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  54220. var convertEnumeratedValue = function (key, value) {
  54221. return isFalsyAttrValue(value) || value === 'false'
  54222. ? 'false'
  54223. // allow arbitrary string value for contenteditable
  54224. : key === 'contenteditable' && isValidContentEditableValue(value)
  54225. ? value
  54226. : 'true'
  54227. };
  54228. var isBooleanAttr = makeMap(
  54229. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  54230. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  54231. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  54232. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  54233. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  54234. 'truespeed,typemustmatch,visible'
  54235. );
  54236. var xlinkNS = 'http://www.w3.org/1999/xlink';
  54237. var isXlink = function (name) {
  54238. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  54239. };
  54240. var getXlinkProp = function (name) {
  54241. return isXlink(name) ? name.slice(6, name.length) : ''
  54242. };
  54243. var isFalsyAttrValue = function (val) {
  54244. return val == null || val === false
  54245. };
  54246. /* */
  54247. function genClassForVnode (vnode) {
  54248. var data = vnode.data;
  54249. var parentNode = vnode;
  54250. var childNode = vnode;
  54251. while (isDef(childNode.componentInstance)) {
  54252. childNode = childNode.componentInstance._vnode;
  54253. if (childNode && childNode.data) {
  54254. data = mergeClassData(childNode.data, data);
  54255. }
  54256. }
  54257. while (isDef(parentNode = parentNode.parent)) {
  54258. if (parentNode && parentNode.data) {
  54259. data = mergeClassData(data, parentNode.data);
  54260. }
  54261. }
  54262. return renderClass(data.staticClass, data.class)
  54263. }
  54264. function mergeClassData (child, parent) {
  54265. return {
  54266. staticClass: concat(child.staticClass, parent.staticClass),
  54267. class: isDef(child.class)
  54268. ? [child.class, parent.class]
  54269. : parent.class
  54270. }
  54271. }
  54272. function renderClass (
  54273. staticClass,
  54274. dynamicClass
  54275. ) {
  54276. if (isDef(staticClass) || isDef(dynamicClass)) {
  54277. return concat(staticClass, stringifyClass(dynamicClass))
  54278. }
  54279. /* istanbul ignore next */
  54280. return ''
  54281. }
  54282. function concat (a, b) {
  54283. return a ? b ? (a + ' ' + b) : a : (b || '')
  54284. }
  54285. function stringifyClass (value) {
  54286. if (Array.isArray(value)) {
  54287. return stringifyArray(value)
  54288. }
  54289. if (isObject(value)) {
  54290. return stringifyObject(value)
  54291. }
  54292. if (typeof value === 'string') {
  54293. return value
  54294. }
  54295. /* istanbul ignore next */
  54296. return ''
  54297. }
  54298. function stringifyArray (value) {
  54299. var res = '';
  54300. var stringified;
  54301. for (var i = 0, l = value.length; i < l; i++) {
  54302. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  54303. if (res) { res += ' '; }
  54304. res += stringified;
  54305. }
  54306. }
  54307. return res
  54308. }
  54309. function stringifyObject (value) {
  54310. var res = '';
  54311. for (var key in value) {
  54312. if (value[key]) {
  54313. if (res) { res += ' '; }
  54314. res += key;
  54315. }
  54316. }
  54317. return res
  54318. }
  54319. /* */
  54320. var namespaceMap = {
  54321. svg: 'http://www.w3.org/2000/svg',
  54322. math: 'http://www.w3.org/1998/Math/MathML'
  54323. };
  54324. var isHTMLTag = makeMap(
  54325. 'html,body,base,head,link,meta,style,title,' +
  54326. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  54327. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  54328. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  54329. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  54330. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  54331. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  54332. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  54333. 'output,progress,select,textarea,' +
  54334. 'details,dialog,menu,menuitem,summary,' +
  54335. 'content,element,shadow,template,blockquote,iframe,tfoot'
  54336. );
  54337. // this map is intentionally selective, only covering SVG elements that may
  54338. // contain child elements.
  54339. var isSVG = makeMap(
  54340. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  54341. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  54342. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  54343. true
  54344. );
  54345. var isPreTag = function (tag) { return tag === 'pre'; };
  54346. var isReservedTag = function (tag) {
  54347. return isHTMLTag(tag) || isSVG(tag)
  54348. };
  54349. function getTagNamespace (tag) {
  54350. if (isSVG(tag)) {
  54351. return 'svg'
  54352. }
  54353. // basic support for MathML
  54354. // note it doesn't support other MathML elements being component roots
  54355. if (tag === 'math') {
  54356. return 'math'
  54357. }
  54358. }
  54359. var unknownElementCache = Object.create(null);
  54360. function isUnknownElement (tag) {
  54361. /* istanbul ignore if */
  54362. if (!inBrowser) {
  54363. return true
  54364. }
  54365. if (isReservedTag(tag)) {
  54366. return false
  54367. }
  54368. tag = tag.toLowerCase();
  54369. /* istanbul ignore if */
  54370. if (unknownElementCache[tag] != null) {
  54371. return unknownElementCache[tag]
  54372. }
  54373. var el = document.createElement(tag);
  54374. if (tag.indexOf('-') > -1) {
  54375. // http://stackoverflow.com/a/28210364/1070244
  54376. return (unknownElementCache[tag] = (
  54377. el.constructor === window.HTMLUnknownElement ||
  54378. el.constructor === window.HTMLElement
  54379. ))
  54380. } else {
  54381. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  54382. }
  54383. }
  54384. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  54385. /* */
  54386. /**
  54387. * Query an element selector if it's not an element already.
  54388. */
  54389. function query (el) {
  54390. if (typeof el === 'string') {
  54391. var selected = document.querySelector(el);
  54392. if (!selected) {
  54393. warn(
  54394. 'Cannot find element: ' + el
  54395. );
  54396. return document.createElement('div')
  54397. }
  54398. return selected
  54399. } else {
  54400. return el
  54401. }
  54402. }
  54403. /* */
  54404. function createElement$1 (tagName, vnode) {
  54405. var elm = document.createElement(tagName);
  54406. if (tagName !== 'select') {
  54407. return elm
  54408. }
  54409. // false or null will remove the attribute but undefined will not
  54410. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  54411. elm.setAttribute('multiple', 'multiple');
  54412. }
  54413. return elm
  54414. }
  54415. function createElementNS (namespace, tagName) {
  54416. return document.createElementNS(namespaceMap[namespace], tagName)
  54417. }
  54418. function createTextNode (text) {
  54419. return document.createTextNode(text)
  54420. }
  54421. function createComment (text) {
  54422. return document.createComment(text)
  54423. }
  54424. function insertBefore (parentNode, newNode, referenceNode) {
  54425. parentNode.insertBefore(newNode, referenceNode);
  54426. }
  54427. function removeChild (node, child) {
  54428. node.removeChild(child);
  54429. }
  54430. function appendChild (node, child) {
  54431. node.appendChild(child);
  54432. }
  54433. function parentNode (node) {
  54434. return node.parentNode
  54435. }
  54436. function nextSibling (node) {
  54437. return node.nextSibling
  54438. }
  54439. function tagName (node) {
  54440. return node.tagName
  54441. }
  54442. function setTextContent (node, text) {
  54443. node.textContent = text;
  54444. }
  54445. function setStyleScope (node, scopeId) {
  54446. node.setAttribute(scopeId, '');
  54447. }
  54448. var nodeOps = /*#__PURE__*/Object.freeze({
  54449. createElement: createElement$1,
  54450. createElementNS: createElementNS,
  54451. createTextNode: createTextNode,
  54452. createComment: createComment,
  54453. insertBefore: insertBefore,
  54454. removeChild: removeChild,
  54455. appendChild: appendChild,
  54456. parentNode: parentNode,
  54457. nextSibling: nextSibling,
  54458. tagName: tagName,
  54459. setTextContent: setTextContent,
  54460. setStyleScope: setStyleScope
  54461. });
  54462. /* */
  54463. var ref = {
  54464. create: function create (_, vnode) {
  54465. registerRef(vnode);
  54466. },
  54467. update: function update (oldVnode, vnode) {
  54468. if (oldVnode.data.ref !== vnode.data.ref) {
  54469. registerRef(oldVnode, true);
  54470. registerRef(vnode);
  54471. }
  54472. },
  54473. destroy: function destroy (vnode) {
  54474. registerRef(vnode, true);
  54475. }
  54476. };
  54477. function registerRef (vnode, isRemoval) {
  54478. var key = vnode.data.ref;
  54479. if (!isDef(key)) { return }
  54480. var vm = vnode.context;
  54481. var ref = vnode.componentInstance || vnode.elm;
  54482. var refs = vm.$refs;
  54483. if (isRemoval) {
  54484. if (Array.isArray(refs[key])) {
  54485. remove(refs[key], ref);
  54486. } else if (refs[key] === ref) {
  54487. refs[key] = undefined;
  54488. }
  54489. } else {
  54490. if (vnode.data.refInFor) {
  54491. if (!Array.isArray(refs[key])) {
  54492. refs[key] = [ref];
  54493. } else if (refs[key].indexOf(ref) < 0) {
  54494. // $flow-disable-line
  54495. refs[key].push(ref);
  54496. }
  54497. } else {
  54498. refs[key] = ref;
  54499. }
  54500. }
  54501. }
  54502. /**
  54503. * Virtual DOM patching algorithm based on Snabbdom by
  54504. * Simon Friis Vindum (@paldepind)
  54505. * Licensed under the MIT License
  54506. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  54507. *
  54508. * modified by Evan You (@yyx990803)
  54509. *
  54510. * Not type-checking this because this file is perf-critical and the cost
  54511. * of making flow understand it is not worth it.
  54512. */
  54513. var emptyNode = new VNode('', {}, []);
  54514. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  54515. function sameVnode (a, b) {
  54516. return (
  54517. a.key === b.key && (
  54518. (
  54519. a.tag === b.tag &&
  54520. a.isComment === b.isComment &&
  54521. isDef(a.data) === isDef(b.data) &&
  54522. sameInputType(a, b)
  54523. ) || (
  54524. isTrue(a.isAsyncPlaceholder) &&
  54525. a.asyncFactory === b.asyncFactory &&
  54526. isUndef(b.asyncFactory.error)
  54527. )
  54528. )
  54529. )
  54530. }
  54531. function sameInputType (a, b) {
  54532. if (a.tag !== 'input') { return true }
  54533. var i;
  54534. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  54535. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  54536. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  54537. }
  54538. function createKeyToOldIdx (children, beginIdx, endIdx) {
  54539. var i, key;
  54540. var map = {};
  54541. for (i = beginIdx; i <= endIdx; ++i) {
  54542. key = children[i].key;
  54543. if (isDef(key)) { map[key] = i; }
  54544. }
  54545. return map
  54546. }
  54547. function createPatchFunction (backend) {
  54548. var i, j;
  54549. var cbs = {};
  54550. var modules = backend.modules;
  54551. var nodeOps = backend.nodeOps;
  54552. for (i = 0; i < hooks.length; ++i) {
  54553. cbs[hooks[i]] = [];
  54554. for (j = 0; j < modules.length; ++j) {
  54555. if (isDef(modules[j][hooks[i]])) {
  54556. cbs[hooks[i]].push(modules[j][hooks[i]]);
  54557. }
  54558. }
  54559. }
  54560. function emptyNodeAt (elm) {
  54561. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  54562. }
  54563. function createRmCb (childElm, listeners) {
  54564. function remove$$1 () {
  54565. if (--remove$$1.listeners === 0) {
  54566. removeNode(childElm);
  54567. }
  54568. }
  54569. remove$$1.listeners = listeners;
  54570. return remove$$1
  54571. }
  54572. function removeNode (el) {
  54573. var parent = nodeOps.parentNode(el);
  54574. // element may have already been removed due to v-html / v-text
  54575. if (isDef(parent)) {
  54576. nodeOps.removeChild(parent, el);
  54577. }
  54578. }
  54579. function isUnknownElement$$1 (vnode, inVPre) {
  54580. return (
  54581. !inVPre &&
  54582. !vnode.ns &&
  54583. !(
  54584. config.ignoredElements.length &&
  54585. config.ignoredElements.some(function (ignore) {
  54586. return isRegExp(ignore)
  54587. ? ignore.test(vnode.tag)
  54588. : ignore === vnode.tag
  54589. })
  54590. ) &&
  54591. config.isUnknownElement(vnode.tag)
  54592. )
  54593. }
  54594. var creatingElmInVPre = 0;
  54595. function createElm (
  54596. vnode,
  54597. insertedVnodeQueue,
  54598. parentElm,
  54599. refElm,
  54600. nested,
  54601. ownerArray,
  54602. index
  54603. ) {
  54604. if (isDef(vnode.elm) && isDef(ownerArray)) {
  54605. // This vnode was used in a previous render!
  54606. // now it's used as a new node, overwriting its elm would cause
  54607. // potential patch errors down the road when it's used as an insertion
  54608. // reference node. Instead, we clone the node on-demand before creating
  54609. // associated DOM element for it.
  54610. vnode = ownerArray[index] = cloneVNode(vnode);
  54611. }
  54612. vnode.isRootInsert = !nested; // for transition enter check
  54613. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  54614. return
  54615. }
  54616. var data = vnode.data;
  54617. var children = vnode.children;
  54618. var tag = vnode.tag;
  54619. if (isDef(tag)) {
  54620. {
  54621. if (data && data.pre) {
  54622. creatingElmInVPre++;
  54623. }
  54624. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  54625. warn(
  54626. 'Unknown custom element: <' + tag + '> - did you ' +
  54627. 'register the component correctly? For recursive components, ' +
  54628. 'make sure to provide the "name" option.',
  54629. vnode.context
  54630. );
  54631. }
  54632. }
  54633. vnode.elm = vnode.ns
  54634. ? nodeOps.createElementNS(vnode.ns, tag)
  54635. : nodeOps.createElement(tag, vnode);
  54636. setScope(vnode);
  54637. /* istanbul ignore if */
  54638. {
  54639. createChildren(vnode, children, insertedVnodeQueue);
  54640. if (isDef(data)) {
  54641. invokeCreateHooks(vnode, insertedVnodeQueue);
  54642. }
  54643. insert(parentElm, vnode.elm, refElm);
  54644. }
  54645. if (data && data.pre) {
  54646. creatingElmInVPre--;
  54647. }
  54648. } else if (isTrue(vnode.isComment)) {
  54649. vnode.elm = nodeOps.createComment(vnode.text);
  54650. insert(parentElm, vnode.elm, refElm);
  54651. } else {
  54652. vnode.elm = nodeOps.createTextNode(vnode.text);
  54653. insert(parentElm, vnode.elm, refElm);
  54654. }
  54655. }
  54656. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  54657. var i = vnode.data;
  54658. if (isDef(i)) {
  54659. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  54660. if (isDef(i = i.hook) && isDef(i = i.init)) {
  54661. i(vnode, false /* hydrating */);
  54662. }
  54663. // after calling the init hook, if the vnode is a child component
  54664. // it should've created a child instance and mounted it. the child
  54665. // component also has set the placeholder vnode's elm.
  54666. // in that case we can just return the element and be done.
  54667. if (isDef(vnode.componentInstance)) {
  54668. initComponent(vnode, insertedVnodeQueue);
  54669. insert(parentElm, vnode.elm, refElm);
  54670. if (isTrue(isReactivated)) {
  54671. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  54672. }
  54673. return true
  54674. }
  54675. }
  54676. }
  54677. function initComponent (vnode, insertedVnodeQueue) {
  54678. if (isDef(vnode.data.pendingInsert)) {
  54679. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  54680. vnode.data.pendingInsert = null;
  54681. }
  54682. vnode.elm = vnode.componentInstance.$el;
  54683. if (isPatchable(vnode)) {
  54684. invokeCreateHooks(vnode, insertedVnodeQueue);
  54685. setScope(vnode);
  54686. } else {
  54687. // empty component root.
  54688. // skip all element-related modules except for ref (#3455)
  54689. registerRef(vnode);
  54690. // make sure to invoke the insert hook
  54691. insertedVnodeQueue.push(vnode);
  54692. }
  54693. }
  54694. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  54695. var i;
  54696. // hack for #4339: a reactivated component with inner transition
  54697. // does not trigger because the inner node's created hooks are not called
  54698. // again. It's not ideal to involve module-specific logic in here but
  54699. // there doesn't seem to be a better way to do it.
  54700. var innerNode = vnode;
  54701. while (innerNode.componentInstance) {
  54702. innerNode = innerNode.componentInstance._vnode;
  54703. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  54704. for (i = 0; i < cbs.activate.length; ++i) {
  54705. cbs.activate[i](emptyNode, innerNode);
  54706. }
  54707. insertedVnodeQueue.push(innerNode);
  54708. break
  54709. }
  54710. }
  54711. // unlike a newly created component,
  54712. // a reactivated keep-alive component doesn't insert itself
  54713. insert(parentElm, vnode.elm, refElm);
  54714. }
  54715. function insert (parent, elm, ref$$1) {
  54716. if (isDef(parent)) {
  54717. if (isDef(ref$$1)) {
  54718. if (nodeOps.parentNode(ref$$1) === parent) {
  54719. nodeOps.insertBefore(parent, elm, ref$$1);
  54720. }
  54721. } else {
  54722. nodeOps.appendChild(parent, elm);
  54723. }
  54724. }
  54725. }
  54726. function createChildren (vnode, children, insertedVnodeQueue) {
  54727. if (Array.isArray(children)) {
  54728. {
  54729. checkDuplicateKeys(children);
  54730. }
  54731. for (var i = 0; i < children.length; ++i) {
  54732. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  54733. }
  54734. } else if (isPrimitive(vnode.text)) {
  54735. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  54736. }
  54737. }
  54738. function isPatchable (vnode) {
  54739. while (vnode.componentInstance) {
  54740. vnode = vnode.componentInstance._vnode;
  54741. }
  54742. return isDef(vnode.tag)
  54743. }
  54744. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  54745. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  54746. cbs.create[i$1](emptyNode, vnode);
  54747. }
  54748. i = vnode.data.hook; // Reuse variable
  54749. if (isDef(i)) {
  54750. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  54751. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  54752. }
  54753. }
  54754. // set scope id attribute for scoped CSS.
  54755. // this is implemented as a special case to avoid the overhead
  54756. // of going through the normal attribute patching process.
  54757. function setScope (vnode) {
  54758. var i;
  54759. if (isDef(i = vnode.fnScopeId)) {
  54760. nodeOps.setStyleScope(vnode.elm, i);
  54761. } else {
  54762. var ancestor = vnode;
  54763. while (ancestor) {
  54764. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  54765. nodeOps.setStyleScope(vnode.elm, i);
  54766. }
  54767. ancestor = ancestor.parent;
  54768. }
  54769. }
  54770. // for slot content they should also get the scopeId from the host instance.
  54771. if (isDef(i = activeInstance) &&
  54772. i !== vnode.context &&
  54773. i !== vnode.fnContext &&
  54774. isDef(i = i.$options._scopeId)
  54775. ) {
  54776. nodeOps.setStyleScope(vnode.elm, i);
  54777. }
  54778. }
  54779. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  54780. for (; startIdx <= endIdx; ++startIdx) {
  54781. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  54782. }
  54783. }
  54784. function invokeDestroyHook (vnode) {
  54785. var i, j;
  54786. var data = vnode.data;
  54787. if (isDef(data)) {
  54788. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  54789. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  54790. }
  54791. if (isDef(i = vnode.children)) {
  54792. for (j = 0; j < vnode.children.length; ++j) {
  54793. invokeDestroyHook(vnode.children[j]);
  54794. }
  54795. }
  54796. }
  54797. function removeVnodes (vnodes, startIdx, endIdx) {
  54798. for (; startIdx <= endIdx; ++startIdx) {
  54799. var ch = vnodes[startIdx];
  54800. if (isDef(ch)) {
  54801. if (isDef(ch.tag)) {
  54802. removeAndInvokeRemoveHook(ch);
  54803. invokeDestroyHook(ch);
  54804. } else { // Text node
  54805. removeNode(ch.elm);
  54806. }
  54807. }
  54808. }
  54809. }
  54810. function removeAndInvokeRemoveHook (vnode, rm) {
  54811. if (isDef(rm) || isDef(vnode.data)) {
  54812. var i;
  54813. var listeners = cbs.remove.length + 1;
  54814. if (isDef(rm)) {
  54815. // we have a recursively passed down rm callback
  54816. // increase the listeners count
  54817. rm.listeners += listeners;
  54818. } else {
  54819. // directly removing
  54820. rm = createRmCb(vnode.elm, listeners);
  54821. }
  54822. // recursively invoke hooks on child component root node
  54823. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  54824. removeAndInvokeRemoveHook(i, rm);
  54825. }
  54826. for (i = 0; i < cbs.remove.length; ++i) {
  54827. cbs.remove[i](vnode, rm);
  54828. }
  54829. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  54830. i(vnode, rm);
  54831. } else {
  54832. rm();
  54833. }
  54834. } else {
  54835. removeNode(vnode.elm);
  54836. }
  54837. }
  54838. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  54839. var oldStartIdx = 0;
  54840. var newStartIdx = 0;
  54841. var oldEndIdx = oldCh.length - 1;
  54842. var oldStartVnode = oldCh[0];
  54843. var oldEndVnode = oldCh[oldEndIdx];
  54844. var newEndIdx = newCh.length - 1;
  54845. var newStartVnode = newCh[0];
  54846. var newEndVnode = newCh[newEndIdx];
  54847. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  54848. // removeOnly is a special flag used only by <transition-group>
  54849. // to ensure removed elements stay in correct relative positions
  54850. // during leaving transitions
  54851. var canMove = !removeOnly;
  54852. {
  54853. checkDuplicateKeys(newCh);
  54854. }
  54855. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  54856. if (isUndef(oldStartVnode)) {
  54857. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  54858. } else if (isUndef(oldEndVnode)) {
  54859. oldEndVnode = oldCh[--oldEndIdx];
  54860. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  54861. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54862. oldStartVnode = oldCh[++oldStartIdx];
  54863. newStartVnode = newCh[++newStartIdx];
  54864. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  54865. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  54866. oldEndVnode = oldCh[--oldEndIdx];
  54867. newEndVnode = newCh[--newEndIdx];
  54868. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  54869. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  54870. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  54871. oldStartVnode = oldCh[++oldStartIdx];
  54872. newEndVnode = newCh[--newEndIdx];
  54873. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  54874. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54875. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  54876. oldEndVnode = oldCh[--oldEndIdx];
  54877. newStartVnode = newCh[++newStartIdx];
  54878. } else {
  54879. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  54880. idxInOld = isDef(newStartVnode.key)
  54881. ? oldKeyToIdx[newStartVnode.key]
  54882. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  54883. if (isUndef(idxInOld)) { // New element
  54884. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  54885. } else {
  54886. vnodeToMove = oldCh[idxInOld];
  54887. if (sameVnode(vnodeToMove, newStartVnode)) {
  54888. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  54889. oldCh[idxInOld] = undefined;
  54890. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  54891. } else {
  54892. // same key but different element. treat as new element
  54893. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  54894. }
  54895. }
  54896. newStartVnode = newCh[++newStartIdx];
  54897. }
  54898. }
  54899. if (oldStartIdx > oldEndIdx) {
  54900. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  54901. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  54902. } else if (newStartIdx > newEndIdx) {
  54903. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  54904. }
  54905. }
  54906. function checkDuplicateKeys (children) {
  54907. var seenKeys = {};
  54908. for (var i = 0; i < children.length; i++) {
  54909. var vnode = children[i];
  54910. var key = vnode.key;
  54911. if (isDef(key)) {
  54912. if (seenKeys[key]) {
  54913. warn(
  54914. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  54915. vnode.context
  54916. );
  54917. } else {
  54918. seenKeys[key] = true;
  54919. }
  54920. }
  54921. }
  54922. }
  54923. function findIdxInOld (node, oldCh, start, end) {
  54924. for (var i = start; i < end; i++) {
  54925. var c = oldCh[i];
  54926. if (isDef(c) && sameVnode(node, c)) { return i }
  54927. }
  54928. }
  54929. function patchVnode (
  54930. oldVnode,
  54931. vnode,
  54932. insertedVnodeQueue,
  54933. ownerArray,
  54934. index,
  54935. removeOnly
  54936. ) {
  54937. if (oldVnode === vnode) {
  54938. return
  54939. }
  54940. if (isDef(vnode.elm) && isDef(ownerArray)) {
  54941. // clone reused vnode
  54942. vnode = ownerArray[index] = cloneVNode(vnode);
  54943. }
  54944. var elm = vnode.elm = oldVnode.elm;
  54945. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  54946. if (isDef(vnode.asyncFactory.resolved)) {
  54947. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  54948. } else {
  54949. vnode.isAsyncPlaceholder = true;
  54950. }
  54951. return
  54952. }
  54953. // reuse element for static trees.
  54954. // note we only do this if the vnode is cloned -
  54955. // if the new node is not cloned it means the render functions have been
  54956. // reset by the hot-reload-api and we need to do a proper re-render.
  54957. if (isTrue(vnode.isStatic) &&
  54958. isTrue(oldVnode.isStatic) &&
  54959. vnode.key === oldVnode.key &&
  54960. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  54961. ) {
  54962. vnode.componentInstance = oldVnode.componentInstance;
  54963. return
  54964. }
  54965. var i;
  54966. var data = vnode.data;
  54967. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  54968. i(oldVnode, vnode);
  54969. }
  54970. var oldCh = oldVnode.children;
  54971. var ch = vnode.children;
  54972. if (isDef(data) && isPatchable(vnode)) {
  54973. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  54974. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  54975. }
  54976. if (isUndef(vnode.text)) {
  54977. if (isDef(oldCh) && isDef(ch)) {
  54978. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  54979. } else if (isDef(ch)) {
  54980. {
  54981. checkDuplicateKeys(ch);
  54982. }
  54983. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  54984. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  54985. } else if (isDef(oldCh)) {
  54986. removeVnodes(oldCh, 0, oldCh.length - 1);
  54987. } else if (isDef(oldVnode.text)) {
  54988. nodeOps.setTextContent(elm, '');
  54989. }
  54990. } else if (oldVnode.text !== vnode.text) {
  54991. nodeOps.setTextContent(elm, vnode.text);
  54992. }
  54993. if (isDef(data)) {
  54994. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  54995. }
  54996. }
  54997. function invokeInsertHook (vnode, queue, initial) {
  54998. // delay insert hooks for component root nodes, invoke them after the
  54999. // element is really inserted
  55000. if (isTrue(initial) && isDef(vnode.parent)) {
  55001. vnode.parent.data.pendingInsert = queue;
  55002. } else {
  55003. for (var i = 0; i < queue.length; ++i) {
  55004. queue[i].data.hook.insert(queue[i]);
  55005. }
  55006. }
  55007. }
  55008. var hydrationBailed = false;
  55009. // list of modules that can skip create hook during hydration because they
  55010. // are already rendered on the client or has no need for initialization
  55011. // Note: style is excluded because it relies on initial clone for future
  55012. // deep updates (#7063).
  55013. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  55014. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  55015. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  55016. var i;
  55017. var tag = vnode.tag;
  55018. var data = vnode.data;
  55019. var children = vnode.children;
  55020. inVPre = inVPre || (data && data.pre);
  55021. vnode.elm = elm;
  55022. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  55023. vnode.isAsyncPlaceholder = true;
  55024. return true
  55025. }
  55026. // assert node match
  55027. {
  55028. if (!assertNodeMatch(elm, vnode, inVPre)) {
  55029. return false
  55030. }
  55031. }
  55032. if (isDef(data)) {
  55033. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  55034. if (isDef(i = vnode.componentInstance)) {
  55035. // child component. it should have hydrated its own tree.
  55036. initComponent(vnode, insertedVnodeQueue);
  55037. return true
  55038. }
  55039. }
  55040. if (isDef(tag)) {
  55041. if (isDef(children)) {
  55042. // empty element, allow client to pick up and populate children
  55043. if (!elm.hasChildNodes()) {
  55044. createChildren(vnode, children, insertedVnodeQueue);
  55045. } else {
  55046. // v-html and domProps: innerHTML
  55047. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  55048. if (i !== elm.innerHTML) {
  55049. /* istanbul ignore if */
  55050. if (typeof console !== 'undefined' &&
  55051. !hydrationBailed
  55052. ) {
  55053. hydrationBailed = true;
  55054. console.warn('Parent: ', elm);
  55055. console.warn('server innerHTML: ', i);
  55056. console.warn('client innerHTML: ', elm.innerHTML);
  55057. }
  55058. return false
  55059. }
  55060. } else {
  55061. // iterate and compare children lists
  55062. var childrenMatch = true;
  55063. var childNode = elm.firstChild;
  55064. for (var i$1 = 0; i$1 < children.length; i$1++) {
  55065. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  55066. childrenMatch = false;
  55067. break
  55068. }
  55069. childNode = childNode.nextSibling;
  55070. }
  55071. // if childNode is not null, it means the actual childNodes list is
  55072. // longer than the virtual children list.
  55073. if (!childrenMatch || childNode) {
  55074. /* istanbul ignore if */
  55075. if (typeof console !== 'undefined' &&
  55076. !hydrationBailed
  55077. ) {
  55078. hydrationBailed = true;
  55079. console.warn('Parent: ', elm);
  55080. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  55081. }
  55082. return false
  55083. }
  55084. }
  55085. }
  55086. }
  55087. if (isDef(data)) {
  55088. var fullInvoke = false;
  55089. for (var key in data) {
  55090. if (!isRenderedModule(key)) {
  55091. fullInvoke = true;
  55092. invokeCreateHooks(vnode, insertedVnodeQueue);
  55093. break
  55094. }
  55095. }
  55096. if (!fullInvoke && data['class']) {
  55097. // ensure collecting deps for deep class bindings for future updates
  55098. traverse(data['class']);
  55099. }
  55100. }
  55101. } else if (elm.data !== vnode.text) {
  55102. elm.data = vnode.text;
  55103. }
  55104. return true
  55105. }
  55106. function assertNodeMatch (node, vnode, inVPre) {
  55107. if (isDef(vnode.tag)) {
  55108. return vnode.tag.indexOf('vue-component') === 0 || (
  55109. !isUnknownElement$$1(vnode, inVPre) &&
  55110. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  55111. )
  55112. } else {
  55113. return node.nodeType === (vnode.isComment ? 8 : 3)
  55114. }
  55115. }
  55116. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  55117. if (isUndef(vnode)) {
  55118. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  55119. return
  55120. }
  55121. var isInitialPatch = false;
  55122. var insertedVnodeQueue = [];
  55123. if (isUndef(oldVnode)) {
  55124. // empty mount (likely as component), create new root element
  55125. isInitialPatch = true;
  55126. createElm(vnode, insertedVnodeQueue);
  55127. } else {
  55128. var isRealElement = isDef(oldVnode.nodeType);
  55129. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  55130. // patch existing root node
  55131. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  55132. } else {
  55133. if (isRealElement) {
  55134. // mounting to a real element
  55135. // check if this is server-rendered content and if we can perform
  55136. // a successful hydration.
  55137. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  55138. oldVnode.removeAttribute(SSR_ATTR);
  55139. hydrating = true;
  55140. }
  55141. if (isTrue(hydrating)) {
  55142. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  55143. invokeInsertHook(vnode, insertedVnodeQueue, true);
  55144. return oldVnode
  55145. } else {
  55146. warn(
  55147. 'The client-side rendered virtual DOM tree is not matching ' +
  55148. 'server-rendered content. This is likely caused by incorrect ' +
  55149. 'HTML markup, for example nesting block-level elements inside ' +
  55150. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  55151. 'full client-side render.'
  55152. );
  55153. }
  55154. }
  55155. // either not server-rendered, or hydration failed.
  55156. // create an empty node and replace it
  55157. oldVnode = emptyNodeAt(oldVnode);
  55158. }
  55159. // replacing existing element
  55160. var oldElm = oldVnode.elm;
  55161. var parentElm = nodeOps.parentNode(oldElm);
  55162. // create new node
  55163. createElm(
  55164. vnode,
  55165. insertedVnodeQueue,
  55166. // extremely rare edge case: do not insert if old element is in a
  55167. // leaving transition. Only happens when combining transition +
  55168. // keep-alive + HOCs. (#4590)
  55169. oldElm._leaveCb ? null : parentElm,
  55170. nodeOps.nextSibling(oldElm)
  55171. );
  55172. // update parent placeholder node element, recursively
  55173. if (isDef(vnode.parent)) {
  55174. var ancestor = vnode.parent;
  55175. var patchable = isPatchable(vnode);
  55176. while (ancestor) {
  55177. for (var i = 0; i < cbs.destroy.length; ++i) {
  55178. cbs.destroy[i](ancestor);
  55179. }
  55180. ancestor.elm = vnode.elm;
  55181. if (patchable) {
  55182. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  55183. cbs.create[i$1](emptyNode, ancestor);
  55184. }
  55185. // #6513
  55186. // invoke insert hooks that may have been merged by create hooks.
  55187. // e.g. for directives that uses the "inserted" hook.
  55188. var insert = ancestor.data.hook.insert;
  55189. if (insert.merged) {
  55190. // start at index 1 to avoid re-invoking component mounted hook
  55191. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  55192. insert.fns[i$2]();
  55193. }
  55194. }
  55195. } else {
  55196. registerRef(ancestor);
  55197. }
  55198. ancestor = ancestor.parent;
  55199. }
  55200. }
  55201. // destroy old node
  55202. if (isDef(parentElm)) {
  55203. removeVnodes([oldVnode], 0, 0);
  55204. } else if (isDef(oldVnode.tag)) {
  55205. invokeDestroyHook(oldVnode);
  55206. }
  55207. }
  55208. }
  55209. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  55210. return vnode.elm
  55211. }
  55212. }
  55213. /* */
  55214. var directives = {
  55215. create: updateDirectives,
  55216. update: updateDirectives,
  55217. destroy: function unbindDirectives (vnode) {
  55218. updateDirectives(vnode, emptyNode);
  55219. }
  55220. };
  55221. function updateDirectives (oldVnode, vnode) {
  55222. if (oldVnode.data.directives || vnode.data.directives) {
  55223. _update(oldVnode, vnode);
  55224. }
  55225. }
  55226. function _update (oldVnode, vnode) {
  55227. var isCreate = oldVnode === emptyNode;
  55228. var isDestroy = vnode === emptyNode;
  55229. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  55230. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  55231. var dirsWithInsert = [];
  55232. var dirsWithPostpatch = [];
  55233. var key, oldDir, dir;
  55234. for (key in newDirs) {
  55235. oldDir = oldDirs[key];
  55236. dir = newDirs[key];
  55237. if (!oldDir) {
  55238. // new directive, bind
  55239. callHook$1(dir, 'bind', vnode, oldVnode);
  55240. if (dir.def && dir.def.inserted) {
  55241. dirsWithInsert.push(dir);
  55242. }
  55243. } else {
  55244. // existing directive, update
  55245. dir.oldValue = oldDir.value;
  55246. dir.oldArg = oldDir.arg;
  55247. callHook$1(dir, 'update', vnode, oldVnode);
  55248. if (dir.def && dir.def.componentUpdated) {
  55249. dirsWithPostpatch.push(dir);
  55250. }
  55251. }
  55252. }
  55253. if (dirsWithInsert.length) {
  55254. var callInsert = function () {
  55255. for (var i = 0; i < dirsWithInsert.length; i++) {
  55256. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  55257. }
  55258. };
  55259. if (isCreate) {
  55260. mergeVNodeHook(vnode, 'insert', callInsert);
  55261. } else {
  55262. callInsert();
  55263. }
  55264. }
  55265. if (dirsWithPostpatch.length) {
  55266. mergeVNodeHook(vnode, 'postpatch', function () {
  55267. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  55268. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  55269. }
  55270. });
  55271. }
  55272. if (!isCreate) {
  55273. for (key in oldDirs) {
  55274. if (!newDirs[key]) {
  55275. // no longer present, unbind
  55276. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  55277. }
  55278. }
  55279. }
  55280. }
  55281. var emptyModifiers = Object.create(null);
  55282. function normalizeDirectives$1 (
  55283. dirs,
  55284. vm
  55285. ) {
  55286. var res = Object.create(null);
  55287. if (!dirs) {
  55288. // $flow-disable-line
  55289. return res
  55290. }
  55291. var i, dir;
  55292. for (i = 0; i < dirs.length; i++) {
  55293. dir = dirs[i];
  55294. if (!dir.modifiers) {
  55295. // $flow-disable-line
  55296. dir.modifiers = emptyModifiers;
  55297. }
  55298. res[getRawDirName(dir)] = dir;
  55299. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  55300. }
  55301. // $flow-disable-line
  55302. return res
  55303. }
  55304. function getRawDirName (dir) {
  55305. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  55306. }
  55307. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  55308. var fn = dir.def && dir.def[hook];
  55309. if (fn) {
  55310. try {
  55311. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  55312. } catch (e) {
  55313. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  55314. }
  55315. }
  55316. }
  55317. var baseModules = [
  55318. ref,
  55319. directives
  55320. ];
  55321. /* */
  55322. function updateAttrs (oldVnode, vnode) {
  55323. var opts = vnode.componentOptions;
  55324. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  55325. return
  55326. }
  55327. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  55328. return
  55329. }
  55330. var key, cur, old;
  55331. var elm = vnode.elm;
  55332. var oldAttrs = oldVnode.data.attrs || {};
  55333. var attrs = vnode.data.attrs || {};
  55334. // clone observed objects, as the user probably wants to mutate it
  55335. if (isDef(attrs.__ob__)) {
  55336. attrs = vnode.data.attrs = extend({}, attrs);
  55337. }
  55338. for (key in attrs) {
  55339. cur = attrs[key];
  55340. old = oldAttrs[key];
  55341. if (old !== cur) {
  55342. setAttr(elm, key, cur);
  55343. }
  55344. }
  55345. // #4391: in IE9, setting type can reset value for input[type=radio]
  55346. // #6666: IE/Edge forces progress value down to 1 before setting a max
  55347. /* istanbul ignore if */
  55348. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  55349. setAttr(elm, 'value', attrs.value);
  55350. }
  55351. for (key in oldAttrs) {
  55352. if (isUndef(attrs[key])) {
  55353. if (isXlink(key)) {
  55354. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  55355. } else if (!isEnumeratedAttr(key)) {
  55356. elm.removeAttribute(key);
  55357. }
  55358. }
  55359. }
  55360. }
  55361. function setAttr (el, key, value) {
  55362. if (el.tagName.indexOf('-') > -1) {
  55363. baseSetAttr(el, key, value);
  55364. } else if (isBooleanAttr(key)) {
  55365. // set attribute for blank value
  55366. // e.g. <option disabled>Select one</option>
  55367. if (isFalsyAttrValue(value)) {
  55368. el.removeAttribute(key);
  55369. } else {
  55370. // technically allowfullscreen is a boolean attribute for <iframe>,
  55371. // but Flash expects a value of "true" when used on <embed> tag
  55372. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  55373. ? 'true'
  55374. : key;
  55375. el.setAttribute(key, value);
  55376. }
  55377. } else if (isEnumeratedAttr(key)) {
  55378. el.setAttribute(key, convertEnumeratedValue(key, value));
  55379. } else if (isXlink(key)) {
  55380. if (isFalsyAttrValue(value)) {
  55381. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  55382. } else {
  55383. el.setAttributeNS(xlinkNS, key, value);
  55384. }
  55385. } else {
  55386. baseSetAttr(el, key, value);
  55387. }
  55388. }
  55389. function baseSetAttr (el, key, value) {
  55390. if (isFalsyAttrValue(value)) {
  55391. el.removeAttribute(key);
  55392. } else {
  55393. // #7138: IE10 & 11 fires input event when setting placeholder on
  55394. // <textarea>... block the first input event and remove the blocker
  55395. // immediately.
  55396. /* istanbul ignore if */
  55397. if (
  55398. isIE && !isIE9 &&
  55399. el.tagName === 'TEXTAREA' &&
  55400. key === 'placeholder' && value !== '' && !el.__ieph
  55401. ) {
  55402. var blocker = function (e) {
  55403. e.stopImmediatePropagation();
  55404. el.removeEventListener('input', blocker);
  55405. };
  55406. el.addEventListener('input', blocker);
  55407. // $flow-disable-line
  55408. el.__ieph = true; /* IE placeholder patched */
  55409. }
  55410. el.setAttribute(key, value);
  55411. }
  55412. }
  55413. var attrs = {
  55414. create: updateAttrs,
  55415. update: updateAttrs
  55416. };
  55417. /* */
  55418. function updateClass (oldVnode, vnode) {
  55419. var el = vnode.elm;
  55420. var data = vnode.data;
  55421. var oldData = oldVnode.data;
  55422. if (
  55423. isUndef(data.staticClass) &&
  55424. isUndef(data.class) && (
  55425. isUndef(oldData) || (
  55426. isUndef(oldData.staticClass) &&
  55427. isUndef(oldData.class)
  55428. )
  55429. )
  55430. ) {
  55431. return
  55432. }
  55433. var cls = genClassForVnode(vnode);
  55434. // handle transition classes
  55435. var transitionClass = el._transitionClasses;
  55436. if (isDef(transitionClass)) {
  55437. cls = concat(cls, stringifyClass(transitionClass));
  55438. }
  55439. // set the class
  55440. if (cls !== el._prevClass) {
  55441. el.setAttribute('class', cls);
  55442. el._prevClass = cls;
  55443. }
  55444. }
  55445. var klass = {
  55446. create: updateClass,
  55447. update: updateClass
  55448. };
  55449. /* */
  55450. var validDivisionCharRE = /[\w).+\-_$\]]/;
  55451. function parseFilters (exp) {
  55452. var inSingle = false;
  55453. var inDouble = false;
  55454. var inTemplateString = false;
  55455. var inRegex = false;
  55456. var curly = 0;
  55457. var square = 0;
  55458. var paren = 0;
  55459. var lastFilterIndex = 0;
  55460. var c, prev, i, expression, filters;
  55461. for (i = 0; i < exp.length; i++) {
  55462. prev = c;
  55463. c = exp.charCodeAt(i);
  55464. if (inSingle) {
  55465. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  55466. } else if (inDouble) {
  55467. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  55468. } else if (inTemplateString) {
  55469. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  55470. } else if (inRegex) {
  55471. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  55472. } else if (
  55473. c === 0x7C && // pipe
  55474. exp.charCodeAt(i + 1) !== 0x7C &&
  55475. exp.charCodeAt(i - 1) !== 0x7C &&
  55476. !curly && !square && !paren
  55477. ) {
  55478. if (expression === undefined) {
  55479. // first filter, end of expression
  55480. lastFilterIndex = i + 1;
  55481. expression = exp.slice(0, i).trim();
  55482. } else {
  55483. pushFilter();
  55484. }
  55485. } else {
  55486. switch (c) {
  55487. case 0x22: inDouble = true; break // "
  55488. case 0x27: inSingle = true; break // '
  55489. case 0x60: inTemplateString = true; break // `
  55490. case 0x28: paren++; break // (
  55491. case 0x29: paren--; break // )
  55492. case 0x5B: square++; break // [
  55493. case 0x5D: square--; break // ]
  55494. case 0x7B: curly++; break // {
  55495. case 0x7D: curly--; break // }
  55496. }
  55497. if (c === 0x2f) { // /
  55498. var j = i - 1;
  55499. var p = (void 0);
  55500. // find first non-whitespace prev char
  55501. for (; j >= 0; j--) {
  55502. p = exp.charAt(j);
  55503. if (p !== ' ') { break }
  55504. }
  55505. if (!p || !validDivisionCharRE.test(p)) {
  55506. inRegex = true;
  55507. }
  55508. }
  55509. }
  55510. }
  55511. if (expression === undefined) {
  55512. expression = exp.slice(0, i).trim();
  55513. } else if (lastFilterIndex !== 0) {
  55514. pushFilter();
  55515. }
  55516. function pushFilter () {
  55517. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  55518. lastFilterIndex = i + 1;
  55519. }
  55520. if (filters) {
  55521. for (i = 0; i < filters.length; i++) {
  55522. expression = wrapFilter(expression, filters[i]);
  55523. }
  55524. }
  55525. return expression
  55526. }
  55527. function wrapFilter (exp, filter) {
  55528. var i = filter.indexOf('(');
  55529. if (i < 0) {
  55530. // _f: resolveFilter
  55531. return ("_f(\"" + filter + "\")(" + exp + ")")
  55532. } else {
  55533. var name = filter.slice(0, i);
  55534. var args = filter.slice(i + 1);
  55535. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  55536. }
  55537. }
  55538. /* */
  55539. /* eslint-disable no-unused-vars */
  55540. function baseWarn (msg, range) {
  55541. console.error(("[Vue compiler]: " + msg));
  55542. }
  55543. /* eslint-enable no-unused-vars */
  55544. function pluckModuleFunction (
  55545. modules,
  55546. key
  55547. ) {
  55548. return modules
  55549. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  55550. : []
  55551. }
  55552. function addProp (el, name, value, range, dynamic) {
  55553. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  55554. el.plain = false;
  55555. }
  55556. function addAttr (el, name, value, range, dynamic) {
  55557. var attrs = dynamic
  55558. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  55559. : (el.attrs || (el.attrs = []));
  55560. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  55561. el.plain = false;
  55562. }
  55563. // add a raw attr (use this in preTransforms)
  55564. function addRawAttr (el, name, value, range) {
  55565. el.attrsMap[name] = value;
  55566. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  55567. }
  55568. function addDirective (
  55569. el,
  55570. name,
  55571. rawName,
  55572. value,
  55573. arg,
  55574. isDynamicArg,
  55575. modifiers,
  55576. range
  55577. ) {
  55578. (el.directives || (el.directives = [])).push(rangeSetItem({
  55579. name: name,
  55580. rawName: rawName,
  55581. value: value,
  55582. arg: arg,
  55583. isDynamicArg: isDynamicArg,
  55584. modifiers: modifiers
  55585. }, range));
  55586. el.plain = false;
  55587. }
  55588. function prependModifierMarker (symbol, name, dynamic) {
  55589. return dynamic
  55590. ? ("_p(" + name + ",\"" + symbol + "\")")
  55591. : symbol + name // mark the event as captured
  55592. }
  55593. function addHandler (
  55594. el,
  55595. name,
  55596. value,
  55597. modifiers,
  55598. important,
  55599. warn,
  55600. range,
  55601. dynamic
  55602. ) {
  55603. modifiers = modifiers || emptyObject;
  55604. // warn prevent and passive modifier
  55605. /* istanbul ignore if */
  55606. if (
  55607. warn &&
  55608. modifiers.prevent && modifiers.passive
  55609. ) {
  55610. warn(
  55611. 'passive and prevent can\'t be used together. ' +
  55612. 'Passive handler can\'t prevent default event.',
  55613. range
  55614. );
  55615. }
  55616. // normalize click.right and click.middle since they don't actually fire
  55617. // this is technically browser-specific, but at least for now browsers are
  55618. // the only target envs that have right/middle clicks.
  55619. if (modifiers.right) {
  55620. if (dynamic) {
  55621. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  55622. } else if (name === 'click') {
  55623. name = 'contextmenu';
  55624. delete modifiers.right;
  55625. }
  55626. } else if (modifiers.middle) {
  55627. if (dynamic) {
  55628. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  55629. } else if (name === 'click') {
  55630. name = 'mouseup';
  55631. }
  55632. }
  55633. // check capture modifier
  55634. if (modifiers.capture) {
  55635. delete modifiers.capture;
  55636. name = prependModifierMarker('!', name, dynamic);
  55637. }
  55638. if (modifiers.once) {
  55639. delete modifiers.once;
  55640. name = prependModifierMarker('~', name, dynamic);
  55641. }
  55642. /* istanbul ignore if */
  55643. if (modifiers.passive) {
  55644. delete modifiers.passive;
  55645. name = prependModifierMarker('&', name, dynamic);
  55646. }
  55647. var events;
  55648. if (modifiers.native) {
  55649. delete modifiers.native;
  55650. events = el.nativeEvents || (el.nativeEvents = {});
  55651. } else {
  55652. events = el.events || (el.events = {});
  55653. }
  55654. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  55655. if (modifiers !== emptyObject) {
  55656. newHandler.modifiers = modifiers;
  55657. }
  55658. var handlers = events[name];
  55659. /* istanbul ignore if */
  55660. if (Array.isArray(handlers)) {
  55661. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  55662. } else if (handlers) {
  55663. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  55664. } else {
  55665. events[name] = newHandler;
  55666. }
  55667. el.plain = false;
  55668. }
  55669. function getRawBindingAttr (
  55670. el,
  55671. name
  55672. ) {
  55673. return el.rawAttrsMap[':' + name] ||
  55674. el.rawAttrsMap['v-bind:' + name] ||
  55675. el.rawAttrsMap[name]
  55676. }
  55677. function getBindingAttr (
  55678. el,
  55679. name,
  55680. getStatic
  55681. ) {
  55682. var dynamicValue =
  55683. getAndRemoveAttr(el, ':' + name) ||
  55684. getAndRemoveAttr(el, 'v-bind:' + name);
  55685. if (dynamicValue != null) {
  55686. return parseFilters(dynamicValue)
  55687. } else if (getStatic !== false) {
  55688. var staticValue = getAndRemoveAttr(el, name);
  55689. if (staticValue != null) {
  55690. return JSON.stringify(staticValue)
  55691. }
  55692. }
  55693. }
  55694. // note: this only removes the attr from the Array (attrsList) so that it
  55695. // doesn't get processed by processAttrs.
  55696. // By default it does NOT remove it from the map (attrsMap) because the map is
  55697. // needed during codegen.
  55698. function getAndRemoveAttr (
  55699. el,
  55700. name,
  55701. removeFromMap
  55702. ) {
  55703. var val;
  55704. if ((val = el.attrsMap[name]) != null) {
  55705. var list = el.attrsList;
  55706. for (var i = 0, l = list.length; i < l; i++) {
  55707. if (list[i].name === name) {
  55708. list.splice(i, 1);
  55709. break
  55710. }
  55711. }
  55712. }
  55713. if (removeFromMap) {
  55714. delete el.attrsMap[name];
  55715. }
  55716. return val
  55717. }
  55718. function getAndRemoveAttrByRegex (
  55719. el,
  55720. name
  55721. ) {
  55722. var list = el.attrsList;
  55723. for (var i = 0, l = list.length; i < l; i++) {
  55724. var attr = list[i];
  55725. if (name.test(attr.name)) {
  55726. list.splice(i, 1);
  55727. return attr
  55728. }
  55729. }
  55730. }
  55731. function rangeSetItem (
  55732. item,
  55733. range
  55734. ) {
  55735. if (range) {
  55736. if (range.start != null) {
  55737. item.start = range.start;
  55738. }
  55739. if (range.end != null) {
  55740. item.end = range.end;
  55741. }
  55742. }
  55743. return item
  55744. }
  55745. /* */
  55746. /**
  55747. * Cross-platform code generation for component v-model
  55748. */
  55749. function genComponentModel (
  55750. el,
  55751. value,
  55752. modifiers
  55753. ) {
  55754. var ref = modifiers || {};
  55755. var number = ref.number;
  55756. var trim = ref.trim;
  55757. var baseValueExpression = '$$v';
  55758. var valueExpression = baseValueExpression;
  55759. if (trim) {
  55760. valueExpression =
  55761. "(typeof " + baseValueExpression + " === 'string'" +
  55762. "? " + baseValueExpression + ".trim()" +
  55763. ": " + baseValueExpression + ")";
  55764. }
  55765. if (number) {
  55766. valueExpression = "_n(" + valueExpression + ")";
  55767. }
  55768. var assignment = genAssignmentCode(value, valueExpression);
  55769. el.model = {
  55770. value: ("(" + value + ")"),
  55771. expression: JSON.stringify(value),
  55772. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  55773. };
  55774. }
  55775. /**
  55776. * Cross-platform codegen helper for generating v-model value assignment code.
  55777. */
  55778. function genAssignmentCode (
  55779. value,
  55780. assignment
  55781. ) {
  55782. var res = parseModel(value);
  55783. if (res.key === null) {
  55784. return (value + "=" + assignment)
  55785. } else {
  55786. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  55787. }
  55788. }
  55789. /**
  55790. * Parse a v-model expression into a base path and a final key segment.
  55791. * Handles both dot-path and possible square brackets.
  55792. *
  55793. * Possible cases:
  55794. *
  55795. * - test
  55796. * - test[key]
  55797. * - test[test1[key]]
  55798. * - test["a"][key]
  55799. * - xxx.test[a[a].test1[key]]
  55800. * - test.xxx.a["asa"][test1[key]]
  55801. *
  55802. */
  55803. var len, str, chr, index$1, expressionPos, expressionEndPos;
  55804. function parseModel (val) {
  55805. // Fix https://github.com/vuejs/vue/pull/7730
  55806. // allow v-model="obj.val " (trailing whitespace)
  55807. val = val.trim();
  55808. len = val.length;
  55809. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  55810. index$1 = val.lastIndexOf('.');
  55811. if (index$1 > -1) {
  55812. return {
  55813. exp: val.slice(0, index$1),
  55814. key: '"' + val.slice(index$1 + 1) + '"'
  55815. }
  55816. } else {
  55817. return {
  55818. exp: val,
  55819. key: null
  55820. }
  55821. }
  55822. }
  55823. str = val;
  55824. index$1 = expressionPos = expressionEndPos = 0;
  55825. while (!eof()) {
  55826. chr = next();
  55827. /* istanbul ignore if */
  55828. if (isStringStart(chr)) {
  55829. parseString(chr);
  55830. } else if (chr === 0x5B) {
  55831. parseBracket(chr);
  55832. }
  55833. }
  55834. return {
  55835. exp: val.slice(0, expressionPos),
  55836. key: val.slice(expressionPos + 1, expressionEndPos)
  55837. }
  55838. }
  55839. function next () {
  55840. return str.charCodeAt(++index$1)
  55841. }
  55842. function eof () {
  55843. return index$1 >= len
  55844. }
  55845. function isStringStart (chr) {
  55846. return chr === 0x22 || chr === 0x27
  55847. }
  55848. function parseBracket (chr) {
  55849. var inBracket = 1;
  55850. expressionPos = index$1;
  55851. while (!eof()) {
  55852. chr = next();
  55853. if (isStringStart(chr)) {
  55854. parseString(chr);
  55855. continue
  55856. }
  55857. if (chr === 0x5B) { inBracket++; }
  55858. if (chr === 0x5D) { inBracket--; }
  55859. if (inBracket === 0) {
  55860. expressionEndPos = index$1;
  55861. break
  55862. }
  55863. }
  55864. }
  55865. function parseString (chr) {
  55866. var stringQuote = chr;
  55867. while (!eof()) {
  55868. chr = next();
  55869. if (chr === stringQuote) {
  55870. break
  55871. }
  55872. }
  55873. }
  55874. /* */
  55875. var warn$1;
  55876. // in some cases, the event used has to be determined at runtime
  55877. // so we used some reserved tokens during compile.
  55878. var RANGE_TOKEN = '__r';
  55879. var CHECKBOX_RADIO_TOKEN = '__c';
  55880. function model (
  55881. el,
  55882. dir,
  55883. _warn
  55884. ) {
  55885. warn$1 = _warn;
  55886. var value = dir.value;
  55887. var modifiers = dir.modifiers;
  55888. var tag = el.tag;
  55889. var type = el.attrsMap.type;
  55890. {
  55891. // inputs with type="file" are read only and setting the input's
  55892. // value will throw an error.
  55893. if (tag === 'input' && type === 'file') {
  55894. warn$1(
  55895. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  55896. "File inputs are read only. Use a v-on:change listener instead.",
  55897. el.rawAttrsMap['v-model']
  55898. );
  55899. }
  55900. }
  55901. if (el.component) {
  55902. genComponentModel(el, value, modifiers);
  55903. // component v-model doesn't need extra runtime
  55904. return false
  55905. } else if (tag === 'select') {
  55906. genSelect(el, value, modifiers);
  55907. } else if (tag === 'input' && type === 'checkbox') {
  55908. genCheckboxModel(el, value, modifiers);
  55909. } else if (tag === 'input' && type === 'radio') {
  55910. genRadioModel(el, value, modifiers);
  55911. } else if (tag === 'input' || tag === 'textarea') {
  55912. genDefaultModel(el, value, modifiers);
  55913. } else if (!config.isReservedTag(tag)) {
  55914. genComponentModel(el, value, modifiers);
  55915. // component v-model doesn't need extra runtime
  55916. return false
  55917. } else {
  55918. warn$1(
  55919. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  55920. "v-model is not supported on this element type. " +
  55921. 'If you are working with contenteditable, it\'s recommended to ' +
  55922. 'wrap a library dedicated for that purpose inside a custom component.',
  55923. el.rawAttrsMap['v-model']
  55924. );
  55925. }
  55926. // ensure runtime directive metadata
  55927. return true
  55928. }
  55929. function genCheckboxModel (
  55930. el,
  55931. value,
  55932. modifiers
  55933. ) {
  55934. var number = modifiers && modifiers.number;
  55935. var valueBinding = getBindingAttr(el, 'value') || 'null';
  55936. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  55937. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  55938. addProp(el, 'checked',
  55939. "Array.isArray(" + value + ")" +
  55940. "?_i(" + value + "," + valueBinding + ")>-1" + (
  55941. trueValueBinding === 'true'
  55942. ? (":(" + value + ")")
  55943. : (":_q(" + value + "," + trueValueBinding + ")")
  55944. )
  55945. );
  55946. addHandler(el, 'change',
  55947. "var $$a=" + value + "," +
  55948. '$$el=$event.target,' +
  55949. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  55950. 'if(Array.isArray($$a)){' +
  55951. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  55952. '$$i=_i($$a,$$v);' +
  55953. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  55954. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  55955. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  55956. null, true
  55957. );
  55958. }
  55959. function genRadioModel (
  55960. el,
  55961. value,
  55962. modifiers
  55963. ) {
  55964. var number = modifiers && modifiers.number;
  55965. var valueBinding = getBindingAttr(el, 'value') || 'null';
  55966. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  55967. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  55968. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  55969. }
  55970. function genSelect (
  55971. el,
  55972. value,
  55973. modifiers
  55974. ) {
  55975. var number = modifiers && modifiers.number;
  55976. var selectedVal = "Array.prototype.filter" +
  55977. ".call($event.target.options,function(o){return o.selected})" +
  55978. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  55979. "return " + (number ? '_n(val)' : 'val') + "})";
  55980. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  55981. var code = "var $$selectedVal = " + selectedVal + ";";
  55982. code = code + " " + (genAssignmentCode(value, assignment));
  55983. addHandler(el, 'change', code, null, true);
  55984. }
  55985. function genDefaultModel (
  55986. el,
  55987. value,
  55988. modifiers
  55989. ) {
  55990. var type = el.attrsMap.type;
  55991. // warn if v-bind:value conflicts with v-model
  55992. // except for inputs with v-bind:type
  55993. {
  55994. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  55995. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  55996. if (value$1 && !typeBinding) {
  55997. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  55998. warn$1(
  55999. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  56000. 'because the latter already expands to a value binding internally',
  56001. el.rawAttrsMap[binding]
  56002. );
  56003. }
  56004. }
  56005. var ref = modifiers || {};
  56006. var lazy = ref.lazy;
  56007. var number = ref.number;
  56008. var trim = ref.trim;
  56009. var needCompositionGuard = !lazy && type !== 'range';
  56010. var event = lazy
  56011. ? 'change'
  56012. : type === 'range'
  56013. ? RANGE_TOKEN
  56014. : 'input';
  56015. var valueExpression = '$event.target.value';
  56016. if (trim) {
  56017. valueExpression = "$event.target.value.trim()";
  56018. }
  56019. if (number) {
  56020. valueExpression = "_n(" + valueExpression + ")";
  56021. }
  56022. var code = genAssignmentCode(value, valueExpression);
  56023. if (needCompositionGuard) {
  56024. code = "if($event.target.composing)return;" + code;
  56025. }
  56026. addProp(el, 'value', ("(" + value + ")"));
  56027. addHandler(el, event, code, null, true);
  56028. if (trim || number) {
  56029. addHandler(el, 'blur', '$forceUpdate()');
  56030. }
  56031. }
  56032. /* */
  56033. // normalize v-model event tokens that can only be determined at runtime.
  56034. // it's important to place the event as the first in the array because
  56035. // the whole point is ensuring the v-model callback gets called before
  56036. // user-attached handlers.
  56037. function normalizeEvents (on) {
  56038. /* istanbul ignore if */
  56039. if (isDef(on[RANGE_TOKEN])) {
  56040. // IE input[type=range] only supports `change` event
  56041. var event = isIE ? 'change' : 'input';
  56042. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  56043. delete on[RANGE_TOKEN];
  56044. }
  56045. // This was originally intended to fix #4521 but no longer necessary
  56046. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  56047. /* istanbul ignore if */
  56048. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  56049. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  56050. delete on[CHECKBOX_RADIO_TOKEN];
  56051. }
  56052. }
  56053. var target$1;
  56054. function createOnceHandler$1 (event, handler, capture) {
  56055. var _target = target$1; // save current target element in closure
  56056. return function onceHandler () {
  56057. var res = handler.apply(null, arguments);
  56058. if (res !== null) {
  56059. remove$2(event, onceHandler, capture, _target);
  56060. }
  56061. }
  56062. }
  56063. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  56064. // implementation and does not fire microtasks in between event propagation, so
  56065. // safe to exclude.
  56066. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  56067. function add$1 (
  56068. name,
  56069. handler,
  56070. capture,
  56071. passive
  56072. ) {
  56073. // async edge case #6566: inner click event triggers patch, event handler
  56074. // attached to outer element during patch, and triggered again. This
  56075. // happens because browsers fire microtask ticks between event propagation.
  56076. // the solution is simple: we save the timestamp when a handler is attached,
  56077. // and the handler would only fire if the event passed to it was fired
  56078. // AFTER it was attached.
  56079. if (useMicrotaskFix) {
  56080. var attachedTimestamp = currentFlushTimestamp;
  56081. var original = handler;
  56082. handler = original._wrapper = function (e) {
  56083. if (
  56084. // no bubbling, should always fire.
  56085. // this is just a safety net in case event.timeStamp is unreliable in
  56086. // certain weird environments...
  56087. e.target === e.currentTarget ||
  56088. // event is fired after handler attachment
  56089. e.timeStamp >= attachedTimestamp ||
  56090. // bail for environments that have buggy event.timeStamp implementations
  56091. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  56092. // #9681 QtWebEngine event.timeStamp is negative value
  56093. e.timeStamp <= 0 ||
  56094. // #9448 bail if event is fired in another document in a multi-page
  56095. // electron/nw.js app, since event.timeStamp will be using a different
  56096. // starting reference
  56097. e.target.ownerDocument !== document
  56098. ) {
  56099. return original.apply(this, arguments)
  56100. }
  56101. };
  56102. }
  56103. target$1.addEventListener(
  56104. name,
  56105. handler,
  56106. supportsPassive
  56107. ? { capture: capture, passive: passive }
  56108. : capture
  56109. );
  56110. }
  56111. function remove$2 (
  56112. name,
  56113. handler,
  56114. capture,
  56115. _target
  56116. ) {
  56117. (_target || target$1).removeEventListener(
  56118. name,
  56119. handler._wrapper || handler,
  56120. capture
  56121. );
  56122. }
  56123. function updateDOMListeners (oldVnode, vnode) {
  56124. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  56125. return
  56126. }
  56127. var on = vnode.data.on || {};
  56128. var oldOn = oldVnode.data.on || {};
  56129. target$1 = vnode.elm;
  56130. normalizeEvents(on);
  56131. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  56132. target$1 = undefined;
  56133. }
  56134. var events = {
  56135. create: updateDOMListeners,
  56136. update: updateDOMListeners
  56137. };
  56138. /* */
  56139. var svgContainer;
  56140. function updateDOMProps (oldVnode, vnode) {
  56141. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  56142. return
  56143. }
  56144. var key, cur;
  56145. var elm = vnode.elm;
  56146. var oldProps = oldVnode.data.domProps || {};
  56147. var props = vnode.data.domProps || {};
  56148. // clone observed objects, as the user probably wants to mutate it
  56149. if (isDef(props.__ob__)) {
  56150. props = vnode.data.domProps = extend({}, props);
  56151. }
  56152. for (key in oldProps) {
  56153. if (!(key in props)) {
  56154. elm[key] = '';
  56155. }
  56156. }
  56157. for (key in props) {
  56158. cur = props[key];
  56159. // ignore children if the node has textContent or innerHTML,
  56160. // as these will throw away existing DOM nodes and cause removal errors
  56161. // on subsequent patches (#3360)
  56162. if (key === 'textContent' || key === 'innerHTML') {
  56163. if (vnode.children) { vnode.children.length = 0; }
  56164. if (cur === oldProps[key]) { continue }
  56165. // #6601 work around Chrome version <= 55 bug where single textNode
  56166. // replaced by innerHTML/textContent retains its parentNode property
  56167. if (elm.childNodes.length === 1) {
  56168. elm.removeChild(elm.childNodes[0]);
  56169. }
  56170. }
  56171. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  56172. // store value as _value as well since
  56173. // non-string values will be stringified
  56174. elm._value = cur;
  56175. // avoid resetting cursor position when value is the same
  56176. var strCur = isUndef(cur) ? '' : String(cur);
  56177. if (shouldUpdateValue(elm, strCur)) {
  56178. elm.value = strCur;
  56179. }
  56180. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  56181. // IE doesn't support innerHTML for SVG elements
  56182. svgContainer = svgContainer || document.createElement('div');
  56183. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  56184. var svg = svgContainer.firstChild;
  56185. while (elm.firstChild) {
  56186. elm.removeChild(elm.firstChild);
  56187. }
  56188. while (svg.firstChild) {
  56189. elm.appendChild(svg.firstChild);
  56190. }
  56191. } else if (
  56192. // skip the update if old and new VDOM state is the same.
  56193. // `value` is handled separately because the DOM value may be temporarily
  56194. // out of sync with VDOM state due to focus, composition and modifiers.
  56195. // This #4521 by skipping the unnecesarry `checked` update.
  56196. cur !== oldProps[key]
  56197. ) {
  56198. // some property updates can throw
  56199. // e.g. `value` on <progress> w/ non-finite value
  56200. try {
  56201. elm[key] = cur;
  56202. } catch (e) {}
  56203. }
  56204. }
  56205. }
  56206. // check platforms/web/util/attrs.js acceptValue
  56207. function shouldUpdateValue (elm, checkVal) {
  56208. return (!elm.composing && (
  56209. elm.tagName === 'OPTION' ||
  56210. isNotInFocusAndDirty(elm, checkVal) ||
  56211. isDirtyWithModifiers(elm, checkVal)
  56212. ))
  56213. }
  56214. function isNotInFocusAndDirty (elm, checkVal) {
  56215. // return true when textbox (.number and .trim) loses focus and its value is
  56216. // not equal to the updated value
  56217. var notInFocus = true;
  56218. // #6157
  56219. // work around IE bug when accessing document.activeElement in an iframe
  56220. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  56221. return notInFocus && elm.value !== checkVal
  56222. }
  56223. function isDirtyWithModifiers (elm, newVal) {
  56224. var value = elm.value;
  56225. var modifiers = elm._vModifiers; // injected by v-model runtime
  56226. if (isDef(modifiers)) {
  56227. if (modifiers.number) {
  56228. return toNumber(value) !== toNumber(newVal)
  56229. }
  56230. if (modifiers.trim) {
  56231. return value.trim() !== newVal.trim()
  56232. }
  56233. }
  56234. return value !== newVal
  56235. }
  56236. var domProps = {
  56237. create: updateDOMProps,
  56238. update: updateDOMProps
  56239. };
  56240. /* */
  56241. var parseStyleText = cached(function (cssText) {
  56242. var res = {};
  56243. var listDelimiter = /;(?![^(]*\))/g;
  56244. var propertyDelimiter = /:(.+)/;
  56245. cssText.split(listDelimiter).forEach(function (item) {
  56246. if (item) {
  56247. var tmp = item.split(propertyDelimiter);
  56248. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  56249. }
  56250. });
  56251. return res
  56252. });
  56253. // merge static and dynamic style data on the same vnode
  56254. function normalizeStyleData (data) {
  56255. var style = normalizeStyleBinding(data.style);
  56256. // static style is pre-processed into an object during compilation
  56257. // and is always a fresh object, so it's safe to merge into it
  56258. return data.staticStyle
  56259. ? extend(data.staticStyle, style)
  56260. : style
  56261. }
  56262. // normalize possible array / string values into Object
  56263. function normalizeStyleBinding (bindingStyle) {
  56264. if (Array.isArray(bindingStyle)) {
  56265. return toObject(bindingStyle)
  56266. }
  56267. if (typeof bindingStyle === 'string') {
  56268. return parseStyleText(bindingStyle)
  56269. }
  56270. return bindingStyle
  56271. }
  56272. /**
  56273. * parent component style should be after child's
  56274. * so that parent component's style could override it
  56275. */
  56276. function getStyle (vnode, checkChild) {
  56277. var res = {};
  56278. var styleData;
  56279. if (checkChild) {
  56280. var childNode = vnode;
  56281. while (childNode.componentInstance) {
  56282. childNode = childNode.componentInstance._vnode;
  56283. if (
  56284. childNode && childNode.data &&
  56285. (styleData = normalizeStyleData(childNode.data))
  56286. ) {
  56287. extend(res, styleData);
  56288. }
  56289. }
  56290. }
  56291. if ((styleData = normalizeStyleData(vnode.data))) {
  56292. extend(res, styleData);
  56293. }
  56294. var parentNode = vnode;
  56295. while ((parentNode = parentNode.parent)) {
  56296. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  56297. extend(res, styleData);
  56298. }
  56299. }
  56300. return res
  56301. }
  56302. /* */
  56303. var cssVarRE = /^--/;
  56304. var importantRE = /\s*!important$/;
  56305. var setProp = function (el, name, val) {
  56306. /* istanbul ignore if */
  56307. if (cssVarRE.test(name)) {
  56308. el.style.setProperty(name, val);
  56309. } else if (importantRE.test(val)) {
  56310. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  56311. } else {
  56312. var normalizedName = normalize(name);
  56313. if (Array.isArray(val)) {
  56314. // Support values array created by autoprefixer, e.g.
  56315. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  56316. // Set them one by one, and the browser will only set those it can recognize
  56317. for (var i = 0, len = val.length; i < len; i++) {
  56318. el.style[normalizedName] = val[i];
  56319. }
  56320. } else {
  56321. el.style[normalizedName] = val;
  56322. }
  56323. }
  56324. };
  56325. var vendorNames = ['Webkit', 'Moz', 'ms'];
  56326. var emptyStyle;
  56327. var normalize = cached(function (prop) {
  56328. emptyStyle = emptyStyle || document.createElement('div').style;
  56329. prop = camelize(prop);
  56330. if (prop !== 'filter' && (prop in emptyStyle)) {
  56331. return prop
  56332. }
  56333. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  56334. for (var i = 0; i < vendorNames.length; i++) {
  56335. var name = vendorNames[i] + capName;
  56336. if (name in emptyStyle) {
  56337. return name
  56338. }
  56339. }
  56340. });
  56341. function updateStyle (oldVnode, vnode) {
  56342. var data = vnode.data;
  56343. var oldData = oldVnode.data;
  56344. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  56345. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  56346. ) {
  56347. return
  56348. }
  56349. var cur, name;
  56350. var el = vnode.elm;
  56351. var oldStaticStyle = oldData.staticStyle;
  56352. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  56353. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  56354. var oldStyle = oldStaticStyle || oldStyleBinding;
  56355. var style = normalizeStyleBinding(vnode.data.style) || {};
  56356. // store normalized style under a different key for next diff
  56357. // make sure to clone it if it's reactive, since the user likely wants
  56358. // to mutate it.
  56359. vnode.data.normalizedStyle = isDef(style.__ob__)
  56360. ? extend({}, style)
  56361. : style;
  56362. var newStyle = getStyle(vnode, true);
  56363. for (name in oldStyle) {
  56364. if (isUndef(newStyle[name])) {
  56365. setProp(el, name, '');
  56366. }
  56367. }
  56368. for (name in newStyle) {
  56369. cur = newStyle[name];
  56370. if (cur !== oldStyle[name]) {
  56371. // ie9 setting to null has no effect, must use empty string
  56372. setProp(el, name, cur == null ? '' : cur);
  56373. }
  56374. }
  56375. }
  56376. var style = {
  56377. create: updateStyle,
  56378. update: updateStyle
  56379. };
  56380. /* */
  56381. var whitespaceRE = /\s+/;
  56382. /**
  56383. * Add class with compatibility for SVG since classList is not supported on
  56384. * SVG elements in IE
  56385. */
  56386. function addClass (el, cls) {
  56387. /* istanbul ignore if */
  56388. if (!cls || !(cls = cls.trim())) {
  56389. return
  56390. }
  56391. /* istanbul ignore else */
  56392. if (el.classList) {
  56393. if (cls.indexOf(' ') > -1) {
  56394. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  56395. } else {
  56396. el.classList.add(cls);
  56397. }
  56398. } else {
  56399. var cur = " " + (el.getAttribute('class') || '') + " ";
  56400. if (cur.indexOf(' ' + cls + ' ') < 0) {
  56401. el.setAttribute('class', (cur + cls).trim());
  56402. }
  56403. }
  56404. }
  56405. /**
  56406. * Remove class with compatibility for SVG since classList is not supported on
  56407. * SVG elements in IE
  56408. */
  56409. function removeClass (el, cls) {
  56410. /* istanbul ignore if */
  56411. if (!cls || !(cls = cls.trim())) {
  56412. return
  56413. }
  56414. /* istanbul ignore else */
  56415. if (el.classList) {
  56416. if (cls.indexOf(' ') > -1) {
  56417. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  56418. } else {
  56419. el.classList.remove(cls);
  56420. }
  56421. if (!el.classList.length) {
  56422. el.removeAttribute('class');
  56423. }
  56424. } else {
  56425. var cur = " " + (el.getAttribute('class') || '') + " ";
  56426. var tar = ' ' + cls + ' ';
  56427. while (cur.indexOf(tar) >= 0) {
  56428. cur = cur.replace(tar, ' ');
  56429. }
  56430. cur = cur.trim();
  56431. if (cur) {
  56432. el.setAttribute('class', cur);
  56433. } else {
  56434. el.removeAttribute('class');
  56435. }
  56436. }
  56437. }
  56438. /* */
  56439. function resolveTransition (def$$1) {
  56440. if (!def$$1) {
  56441. return
  56442. }
  56443. /* istanbul ignore else */
  56444. if (typeof def$$1 === 'object') {
  56445. var res = {};
  56446. if (def$$1.css !== false) {
  56447. extend(res, autoCssTransition(def$$1.name || 'v'));
  56448. }
  56449. extend(res, def$$1);
  56450. return res
  56451. } else if (typeof def$$1 === 'string') {
  56452. return autoCssTransition(def$$1)
  56453. }
  56454. }
  56455. var autoCssTransition = cached(function (name) {
  56456. return {
  56457. enterClass: (name + "-enter"),
  56458. enterToClass: (name + "-enter-to"),
  56459. enterActiveClass: (name + "-enter-active"),
  56460. leaveClass: (name + "-leave"),
  56461. leaveToClass: (name + "-leave-to"),
  56462. leaveActiveClass: (name + "-leave-active")
  56463. }
  56464. });
  56465. var hasTransition = inBrowser && !isIE9;
  56466. var TRANSITION = 'transition';
  56467. var ANIMATION = 'animation';
  56468. // Transition property/event sniffing
  56469. var transitionProp = 'transition';
  56470. var transitionEndEvent = 'transitionend';
  56471. var animationProp = 'animation';
  56472. var animationEndEvent = 'animationend';
  56473. if (hasTransition) {
  56474. /* istanbul ignore if */
  56475. if (window.ontransitionend === undefined &&
  56476. window.onwebkittransitionend !== undefined
  56477. ) {
  56478. transitionProp = 'WebkitTransition';
  56479. transitionEndEvent = 'webkitTransitionEnd';
  56480. }
  56481. if (window.onanimationend === undefined &&
  56482. window.onwebkitanimationend !== undefined
  56483. ) {
  56484. animationProp = 'WebkitAnimation';
  56485. animationEndEvent = 'webkitAnimationEnd';
  56486. }
  56487. }
  56488. // binding to window is necessary to make hot reload work in IE in strict mode
  56489. var raf = inBrowser
  56490. ? window.requestAnimationFrame
  56491. ? window.requestAnimationFrame.bind(window)
  56492. : setTimeout
  56493. : /* istanbul ignore next */ function (fn) { return fn(); };
  56494. function nextFrame (fn) {
  56495. raf(function () {
  56496. raf(fn);
  56497. });
  56498. }
  56499. function addTransitionClass (el, cls) {
  56500. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  56501. if (transitionClasses.indexOf(cls) < 0) {
  56502. transitionClasses.push(cls);
  56503. addClass(el, cls);
  56504. }
  56505. }
  56506. function removeTransitionClass (el, cls) {
  56507. if (el._transitionClasses) {
  56508. remove(el._transitionClasses, cls);
  56509. }
  56510. removeClass(el, cls);
  56511. }
  56512. function whenTransitionEnds (
  56513. el,
  56514. expectedType,
  56515. cb
  56516. ) {
  56517. var ref = getTransitionInfo(el, expectedType);
  56518. var type = ref.type;
  56519. var timeout = ref.timeout;
  56520. var propCount = ref.propCount;
  56521. if (!type) { return cb() }
  56522. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  56523. var ended = 0;
  56524. var end = function () {
  56525. el.removeEventListener(event, onEnd);
  56526. cb();
  56527. };
  56528. var onEnd = function (e) {
  56529. if (e.target === el) {
  56530. if (++ended >= propCount) {
  56531. end();
  56532. }
  56533. }
  56534. };
  56535. setTimeout(function () {
  56536. if (ended < propCount) {
  56537. end();
  56538. }
  56539. }, timeout + 1);
  56540. el.addEventListener(event, onEnd);
  56541. }
  56542. var transformRE = /\b(transform|all)(,|$)/;
  56543. function getTransitionInfo (el, expectedType) {
  56544. var styles = window.getComputedStyle(el);
  56545. // JSDOM may return undefined for transition properties
  56546. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  56547. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  56548. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  56549. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  56550. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  56551. var animationTimeout = getTimeout(animationDelays, animationDurations);
  56552. var type;
  56553. var timeout = 0;
  56554. var propCount = 0;
  56555. /* istanbul ignore if */
  56556. if (expectedType === TRANSITION) {
  56557. if (transitionTimeout > 0) {
  56558. type = TRANSITION;
  56559. timeout = transitionTimeout;
  56560. propCount = transitionDurations.length;
  56561. }
  56562. } else if (expectedType === ANIMATION) {
  56563. if (animationTimeout > 0) {
  56564. type = ANIMATION;
  56565. timeout = animationTimeout;
  56566. propCount = animationDurations.length;
  56567. }
  56568. } else {
  56569. timeout = Math.max(transitionTimeout, animationTimeout);
  56570. type = timeout > 0
  56571. ? transitionTimeout > animationTimeout
  56572. ? TRANSITION
  56573. : ANIMATION
  56574. : null;
  56575. propCount = type
  56576. ? type === TRANSITION
  56577. ? transitionDurations.length
  56578. : animationDurations.length
  56579. : 0;
  56580. }
  56581. var hasTransform =
  56582. type === TRANSITION &&
  56583. transformRE.test(styles[transitionProp + 'Property']);
  56584. return {
  56585. type: type,
  56586. timeout: timeout,
  56587. propCount: propCount,
  56588. hasTransform: hasTransform
  56589. }
  56590. }
  56591. function getTimeout (delays, durations) {
  56592. /* istanbul ignore next */
  56593. while (delays.length < durations.length) {
  56594. delays = delays.concat(delays);
  56595. }
  56596. return Math.max.apply(null, durations.map(function (d, i) {
  56597. return toMs(d) + toMs(delays[i])
  56598. }))
  56599. }
  56600. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  56601. // in a locale-dependent way, using a comma instead of a dot.
  56602. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  56603. // as a floor function) causing unexpected behaviors
  56604. function toMs (s) {
  56605. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  56606. }
  56607. /* */
  56608. function enter (vnode, toggleDisplay) {
  56609. var el = vnode.elm;
  56610. // call leave callback now
  56611. if (isDef(el._leaveCb)) {
  56612. el._leaveCb.cancelled = true;
  56613. el._leaveCb();
  56614. }
  56615. var data = resolveTransition(vnode.data.transition);
  56616. if (isUndef(data)) {
  56617. return
  56618. }
  56619. /* istanbul ignore if */
  56620. if (isDef(el._enterCb) || el.nodeType !== 1) {
  56621. return
  56622. }
  56623. var css = data.css;
  56624. var type = data.type;
  56625. var enterClass = data.enterClass;
  56626. var enterToClass = data.enterToClass;
  56627. var enterActiveClass = data.enterActiveClass;
  56628. var appearClass = data.appearClass;
  56629. var appearToClass = data.appearToClass;
  56630. var appearActiveClass = data.appearActiveClass;
  56631. var beforeEnter = data.beforeEnter;
  56632. var enter = data.enter;
  56633. var afterEnter = data.afterEnter;
  56634. var enterCancelled = data.enterCancelled;
  56635. var beforeAppear = data.beforeAppear;
  56636. var appear = data.appear;
  56637. var afterAppear = data.afterAppear;
  56638. var appearCancelled = data.appearCancelled;
  56639. var duration = data.duration;
  56640. // activeInstance will always be the <transition> component managing this
  56641. // transition. One edge case to check is when the <transition> is placed
  56642. // as the root node of a child component. In that case we need to check
  56643. // <transition>'s parent for appear check.
  56644. var context = activeInstance;
  56645. var transitionNode = activeInstance.$vnode;
  56646. while (transitionNode && transitionNode.parent) {
  56647. context = transitionNode.context;
  56648. transitionNode = transitionNode.parent;
  56649. }
  56650. var isAppear = !context._isMounted || !vnode.isRootInsert;
  56651. if (isAppear && !appear && appear !== '') {
  56652. return
  56653. }
  56654. var startClass = isAppear && appearClass
  56655. ? appearClass
  56656. : enterClass;
  56657. var activeClass = isAppear && appearActiveClass
  56658. ? appearActiveClass
  56659. : enterActiveClass;
  56660. var toClass = isAppear && appearToClass
  56661. ? appearToClass
  56662. : enterToClass;
  56663. var beforeEnterHook = isAppear
  56664. ? (beforeAppear || beforeEnter)
  56665. : beforeEnter;
  56666. var enterHook = isAppear
  56667. ? (typeof appear === 'function' ? appear : enter)
  56668. : enter;
  56669. var afterEnterHook = isAppear
  56670. ? (afterAppear || afterEnter)
  56671. : afterEnter;
  56672. var enterCancelledHook = isAppear
  56673. ? (appearCancelled || enterCancelled)
  56674. : enterCancelled;
  56675. var explicitEnterDuration = toNumber(
  56676. isObject(duration)
  56677. ? duration.enter
  56678. : duration
  56679. );
  56680. if (explicitEnterDuration != null) {
  56681. checkDuration(explicitEnterDuration, 'enter', vnode);
  56682. }
  56683. var expectsCSS = css !== false && !isIE9;
  56684. var userWantsControl = getHookArgumentsLength(enterHook);
  56685. var cb = el._enterCb = once(function () {
  56686. if (expectsCSS) {
  56687. removeTransitionClass(el, toClass);
  56688. removeTransitionClass(el, activeClass);
  56689. }
  56690. if (cb.cancelled) {
  56691. if (expectsCSS) {
  56692. removeTransitionClass(el, startClass);
  56693. }
  56694. enterCancelledHook && enterCancelledHook(el);
  56695. } else {
  56696. afterEnterHook && afterEnterHook(el);
  56697. }
  56698. el._enterCb = null;
  56699. });
  56700. if (!vnode.data.show) {
  56701. // remove pending leave element on enter by injecting an insert hook
  56702. mergeVNodeHook(vnode, 'insert', function () {
  56703. var parent = el.parentNode;
  56704. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  56705. if (pendingNode &&
  56706. pendingNode.tag === vnode.tag &&
  56707. pendingNode.elm._leaveCb
  56708. ) {
  56709. pendingNode.elm._leaveCb();
  56710. }
  56711. enterHook && enterHook(el, cb);
  56712. });
  56713. }
  56714. // start enter transition
  56715. beforeEnterHook && beforeEnterHook(el);
  56716. if (expectsCSS) {
  56717. addTransitionClass(el, startClass);
  56718. addTransitionClass(el, activeClass);
  56719. nextFrame(function () {
  56720. removeTransitionClass(el, startClass);
  56721. if (!cb.cancelled) {
  56722. addTransitionClass(el, toClass);
  56723. if (!userWantsControl) {
  56724. if (isValidDuration(explicitEnterDuration)) {
  56725. setTimeout(cb, explicitEnterDuration);
  56726. } else {
  56727. whenTransitionEnds(el, type, cb);
  56728. }
  56729. }
  56730. }
  56731. });
  56732. }
  56733. if (vnode.data.show) {
  56734. toggleDisplay && toggleDisplay();
  56735. enterHook && enterHook(el, cb);
  56736. }
  56737. if (!expectsCSS && !userWantsControl) {
  56738. cb();
  56739. }
  56740. }
  56741. function leave (vnode, rm) {
  56742. var el = vnode.elm;
  56743. // call enter callback now
  56744. if (isDef(el._enterCb)) {
  56745. el._enterCb.cancelled = true;
  56746. el._enterCb();
  56747. }
  56748. var data = resolveTransition(vnode.data.transition);
  56749. if (isUndef(data) || el.nodeType !== 1) {
  56750. return rm()
  56751. }
  56752. /* istanbul ignore if */
  56753. if (isDef(el._leaveCb)) {
  56754. return
  56755. }
  56756. var css = data.css;
  56757. var type = data.type;
  56758. var leaveClass = data.leaveClass;
  56759. var leaveToClass = data.leaveToClass;
  56760. var leaveActiveClass = data.leaveActiveClass;
  56761. var beforeLeave = data.beforeLeave;
  56762. var leave = data.leave;
  56763. var afterLeave = data.afterLeave;
  56764. var leaveCancelled = data.leaveCancelled;
  56765. var delayLeave = data.delayLeave;
  56766. var duration = data.duration;
  56767. var expectsCSS = css !== false && !isIE9;
  56768. var userWantsControl = getHookArgumentsLength(leave);
  56769. var explicitLeaveDuration = toNumber(
  56770. isObject(duration)
  56771. ? duration.leave
  56772. : duration
  56773. );
  56774. if (isDef(explicitLeaveDuration)) {
  56775. checkDuration(explicitLeaveDuration, 'leave', vnode);
  56776. }
  56777. var cb = el._leaveCb = once(function () {
  56778. if (el.parentNode && el.parentNode._pending) {
  56779. el.parentNode._pending[vnode.key] = null;
  56780. }
  56781. if (expectsCSS) {
  56782. removeTransitionClass(el, leaveToClass);
  56783. removeTransitionClass(el, leaveActiveClass);
  56784. }
  56785. if (cb.cancelled) {
  56786. if (expectsCSS) {
  56787. removeTransitionClass(el, leaveClass);
  56788. }
  56789. leaveCancelled && leaveCancelled(el);
  56790. } else {
  56791. rm();
  56792. afterLeave && afterLeave(el);
  56793. }
  56794. el._leaveCb = null;
  56795. });
  56796. if (delayLeave) {
  56797. delayLeave(performLeave);
  56798. } else {
  56799. performLeave();
  56800. }
  56801. function performLeave () {
  56802. // the delayed leave may have already been cancelled
  56803. if (cb.cancelled) {
  56804. return
  56805. }
  56806. // record leaving element
  56807. if (!vnode.data.show && el.parentNode) {
  56808. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  56809. }
  56810. beforeLeave && beforeLeave(el);
  56811. if (expectsCSS) {
  56812. addTransitionClass(el, leaveClass);
  56813. addTransitionClass(el, leaveActiveClass);
  56814. nextFrame(function () {
  56815. removeTransitionClass(el, leaveClass);
  56816. if (!cb.cancelled) {
  56817. addTransitionClass(el, leaveToClass);
  56818. if (!userWantsControl) {
  56819. if (isValidDuration(explicitLeaveDuration)) {
  56820. setTimeout(cb, explicitLeaveDuration);
  56821. } else {
  56822. whenTransitionEnds(el, type, cb);
  56823. }
  56824. }
  56825. }
  56826. });
  56827. }
  56828. leave && leave(el, cb);
  56829. if (!expectsCSS && !userWantsControl) {
  56830. cb();
  56831. }
  56832. }
  56833. }
  56834. // only used in dev mode
  56835. function checkDuration (val, name, vnode) {
  56836. if (typeof val !== 'number') {
  56837. warn(
  56838. "<transition> explicit " + name + " duration is not a valid number - " +
  56839. "got " + (JSON.stringify(val)) + ".",
  56840. vnode.context
  56841. );
  56842. } else if (isNaN(val)) {
  56843. warn(
  56844. "<transition> explicit " + name + " duration is NaN - " +
  56845. 'the duration expression might be incorrect.',
  56846. vnode.context
  56847. );
  56848. }
  56849. }
  56850. function isValidDuration (val) {
  56851. return typeof val === 'number' && !isNaN(val)
  56852. }
  56853. /**
  56854. * Normalize a transition hook's argument length. The hook may be:
  56855. * - a merged hook (invoker) with the original in .fns
  56856. * - a wrapped component method (check ._length)
  56857. * - a plain function (.length)
  56858. */
  56859. function getHookArgumentsLength (fn) {
  56860. if (isUndef(fn)) {
  56861. return false
  56862. }
  56863. var invokerFns = fn.fns;
  56864. if (isDef(invokerFns)) {
  56865. // invoker
  56866. return getHookArgumentsLength(
  56867. Array.isArray(invokerFns)
  56868. ? invokerFns[0]
  56869. : invokerFns
  56870. )
  56871. } else {
  56872. return (fn._length || fn.length) > 1
  56873. }
  56874. }
  56875. function _enter (_, vnode) {
  56876. if (vnode.data.show !== true) {
  56877. enter(vnode);
  56878. }
  56879. }
  56880. var transition = inBrowser ? {
  56881. create: _enter,
  56882. activate: _enter,
  56883. remove: function remove$$1 (vnode, rm) {
  56884. /* istanbul ignore else */
  56885. if (vnode.data.show !== true) {
  56886. leave(vnode, rm);
  56887. } else {
  56888. rm();
  56889. }
  56890. }
  56891. } : {};
  56892. var platformModules = [
  56893. attrs,
  56894. klass,
  56895. events,
  56896. domProps,
  56897. style,
  56898. transition
  56899. ];
  56900. /* */
  56901. // the directive module should be applied last, after all
  56902. // built-in modules have been applied.
  56903. var modules = platformModules.concat(baseModules);
  56904. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  56905. /**
  56906. * Not type checking this file because flow doesn't like attaching
  56907. * properties to Elements.
  56908. */
  56909. /* istanbul ignore if */
  56910. if (isIE9) {
  56911. // http://www.matts411.com/post/internet-explorer-9-oninput/
  56912. document.addEventListener('selectionchange', function () {
  56913. var el = document.activeElement;
  56914. if (el && el.vmodel) {
  56915. trigger(el, 'input');
  56916. }
  56917. });
  56918. }
  56919. var directive = {
  56920. inserted: function inserted (el, binding, vnode, oldVnode) {
  56921. if (vnode.tag === 'select') {
  56922. // #6903
  56923. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  56924. mergeVNodeHook(vnode, 'postpatch', function () {
  56925. directive.componentUpdated(el, binding, vnode);
  56926. });
  56927. } else {
  56928. setSelected(el, binding, vnode.context);
  56929. }
  56930. el._vOptions = [].map.call(el.options, getValue);
  56931. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  56932. el._vModifiers = binding.modifiers;
  56933. if (!binding.modifiers.lazy) {
  56934. el.addEventListener('compositionstart', onCompositionStart);
  56935. el.addEventListener('compositionend', onCompositionEnd);
  56936. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  56937. // switching focus before confirming composition choice
  56938. // this also fixes the issue where some browsers e.g. iOS Chrome
  56939. // fires "change" instead of "input" on autocomplete.
  56940. el.addEventListener('change', onCompositionEnd);
  56941. /* istanbul ignore if */
  56942. if (isIE9) {
  56943. el.vmodel = true;
  56944. }
  56945. }
  56946. }
  56947. },
  56948. componentUpdated: function componentUpdated (el, binding, vnode) {
  56949. if (vnode.tag === 'select') {
  56950. setSelected(el, binding, vnode.context);
  56951. // in case the options rendered by v-for have changed,
  56952. // it's possible that the value is out-of-sync with the rendered options.
  56953. // detect such cases and filter out values that no longer has a matching
  56954. // option in the DOM.
  56955. var prevOptions = el._vOptions;
  56956. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  56957. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  56958. // trigger change event if
  56959. // no matching option found for at least one value
  56960. var needReset = el.multiple
  56961. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  56962. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  56963. if (needReset) {
  56964. trigger(el, 'change');
  56965. }
  56966. }
  56967. }
  56968. }
  56969. };
  56970. function setSelected (el, binding, vm) {
  56971. actuallySetSelected(el, binding, vm);
  56972. /* istanbul ignore if */
  56973. if (isIE || isEdge) {
  56974. setTimeout(function () {
  56975. actuallySetSelected(el, binding, vm);
  56976. }, 0);
  56977. }
  56978. }
  56979. function actuallySetSelected (el, binding, vm) {
  56980. var value = binding.value;
  56981. var isMultiple = el.multiple;
  56982. if (isMultiple && !Array.isArray(value)) {
  56983. warn(
  56984. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  56985. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  56986. vm
  56987. );
  56988. return
  56989. }
  56990. var selected, option;
  56991. for (var i = 0, l = el.options.length; i < l; i++) {
  56992. option = el.options[i];
  56993. if (isMultiple) {
  56994. selected = looseIndexOf(value, getValue(option)) > -1;
  56995. if (option.selected !== selected) {
  56996. option.selected = selected;
  56997. }
  56998. } else {
  56999. if (looseEqual(getValue(option), value)) {
  57000. if (el.selectedIndex !== i) {
  57001. el.selectedIndex = i;
  57002. }
  57003. return
  57004. }
  57005. }
  57006. }
  57007. if (!isMultiple) {
  57008. el.selectedIndex = -1;
  57009. }
  57010. }
  57011. function hasNoMatchingOption (value, options) {
  57012. return options.every(function (o) { return !looseEqual(o, value); })
  57013. }
  57014. function getValue (option) {
  57015. return '_value' in option
  57016. ? option._value
  57017. : option.value
  57018. }
  57019. function onCompositionStart (e) {
  57020. e.target.composing = true;
  57021. }
  57022. function onCompositionEnd (e) {
  57023. // prevent triggering an input event for no reason
  57024. if (!e.target.composing) { return }
  57025. e.target.composing = false;
  57026. trigger(e.target, 'input');
  57027. }
  57028. function trigger (el, type) {
  57029. var e = document.createEvent('HTMLEvents');
  57030. e.initEvent(type, true, true);
  57031. el.dispatchEvent(e);
  57032. }
  57033. /* */
  57034. // recursively search for possible transition defined inside the component root
  57035. function locateNode (vnode) {
  57036. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  57037. ? locateNode(vnode.componentInstance._vnode)
  57038. : vnode
  57039. }
  57040. var show = {
  57041. bind: function bind (el, ref, vnode) {
  57042. var value = ref.value;
  57043. vnode = locateNode(vnode);
  57044. var transition$$1 = vnode.data && vnode.data.transition;
  57045. var originalDisplay = el.__vOriginalDisplay =
  57046. el.style.display === 'none' ? '' : el.style.display;
  57047. if (value && transition$$1) {
  57048. vnode.data.show = true;
  57049. enter(vnode, function () {
  57050. el.style.display = originalDisplay;
  57051. });
  57052. } else {
  57053. el.style.display = value ? originalDisplay : 'none';
  57054. }
  57055. },
  57056. update: function update (el, ref, vnode) {
  57057. var value = ref.value;
  57058. var oldValue = ref.oldValue;
  57059. /* istanbul ignore if */
  57060. if (!value === !oldValue) { return }
  57061. vnode = locateNode(vnode);
  57062. var transition$$1 = vnode.data && vnode.data.transition;
  57063. if (transition$$1) {
  57064. vnode.data.show = true;
  57065. if (value) {
  57066. enter(vnode, function () {
  57067. el.style.display = el.__vOriginalDisplay;
  57068. });
  57069. } else {
  57070. leave(vnode, function () {
  57071. el.style.display = 'none';
  57072. });
  57073. }
  57074. } else {
  57075. el.style.display = value ? el.__vOriginalDisplay : 'none';
  57076. }
  57077. },
  57078. unbind: function unbind (
  57079. el,
  57080. binding,
  57081. vnode,
  57082. oldVnode,
  57083. isDestroy
  57084. ) {
  57085. if (!isDestroy) {
  57086. el.style.display = el.__vOriginalDisplay;
  57087. }
  57088. }
  57089. };
  57090. var platformDirectives = {
  57091. model: directive,
  57092. show: show
  57093. };
  57094. /* */
  57095. var transitionProps = {
  57096. name: String,
  57097. appear: Boolean,
  57098. css: Boolean,
  57099. mode: String,
  57100. type: String,
  57101. enterClass: String,
  57102. leaveClass: String,
  57103. enterToClass: String,
  57104. leaveToClass: String,
  57105. enterActiveClass: String,
  57106. leaveActiveClass: String,
  57107. appearClass: String,
  57108. appearActiveClass: String,
  57109. appearToClass: String,
  57110. duration: [Number, String, Object]
  57111. };
  57112. // in case the child is also an abstract component, e.g. <keep-alive>
  57113. // we want to recursively retrieve the real component to be rendered
  57114. function getRealChild (vnode) {
  57115. var compOptions = vnode && vnode.componentOptions;
  57116. if (compOptions && compOptions.Ctor.options.abstract) {
  57117. return getRealChild(getFirstComponentChild(compOptions.children))
  57118. } else {
  57119. return vnode
  57120. }
  57121. }
  57122. function extractTransitionData (comp) {
  57123. var data = {};
  57124. var options = comp.$options;
  57125. // props
  57126. for (var key in options.propsData) {
  57127. data[key] = comp[key];
  57128. }
  57129. // events.
  57130. // extract listeners and pass them directly to the transition methods
  57131. var listeners = options._parentListeners;
  57132. for (var key$1 in listeners) {
  57133. data[camelize(key$1)] = listeners[key$1];
  57134. }
  57135. return data
  57136. }
  57137. function placeholder (h, rawChild) {
  57138. if (/\d-keep-alive$/.test(rawChild.tag)) {
  57139. return h('keep-alive', {
  57140. props: rawChild.componentOptions.propsData
  57141. })
  57142. }
  57143. }
  57144. function hasParentTransition (vnode) {
  57145. while ((vnode = vnode.parent)) {
  57146. if (vnode.data.transition) {
  57147. return true
  57148. }
  57149. }
  57150. }
  57151. function isSameChild (child, oldChild) {
  57152. return oldChild.key === child.key && oldChild.tag === child.tag
  57153. }
  57154. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  57155. var isVShowDirective = function (d) { return d.name === 'show'; };
  57156. var Transition = {
  57157. name: 'transition',
  57158. props: transitionProps,
  57159. abstract: true,
  57160. render: function render (h) {
  57161. var this$1 = this;
  57162. var children = this.$slots.default;
  57163. if (!children) {
  57164. return
  57165. }
  57166. // filter out text nodes (possible whitespaces)
  57167. children = children.filter(isNotTextNode);
  57168. /* istanbul ignore if */
  57169. if (!children.length) {
  57170. return
  57171. }
  57172. // warn multiple elements
  57173. if (children.length > 1) {
  57174. warn(
  57175. '<transition> can only be used on a single element. Use ' +
  57176. '<transition-group> for lists.',
  57177. this.$parent
  57178. );
  57179. }
  57180. var mode = this.mode;
  57181. // warn invalid mode
  57182. if (mode && mode !== 'in-out' && mode !== 'out-in'
  57183. ) {
  57184. warn(
  57185. 'invalid <transition> mode: ' + mode,
  57186. this.$parent
  57187. );
  57188. }
  57189. var rawChild = children[0];
  57190. // if this is a component root node and the component's
  57191. // parent container node also has transition, skip.
  57192. if (hasParentTransition(this.$vnode)) {
  57193. return rawChild
  57194. }
  57195. // apply transition data to child
  57196. // use getRealChild() to ignore abstract components e.g. keep-alive
  57197. var child = getRealChild(rawChild);
  57198. /* istanbul ignore if */
  57199. if (!child) {
  57200. return rawChild
  57201. }
  57202. if (this._leaving) {
  57203. return placeholder(h, rawChild)
  57204. }
  57205. // ensure a key that is unique to the vnode type and to this transition
  57206. // component instance. This key will be used to remove pending leaving nodes
  57207. // during entering.
  57208. var id = "__transition-" + (this._uid) + "-";
  57209. child.key = child.key == null
  57210. ? child.isComment
  57211. ? id + 'comment'
  57212. : id + child.tag
  57213. : isPrimitive(child.key)
  57214. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  57215. : child.key;
  57216. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  57217. var oldRawChild = this._vnode;
  57218. var oldChild = getRealChild(oldRawChild);
  57219. // mark v-show
  57220. // so that the transition module can hand over the control to the directive
  57221. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  57222. child.data.show = true;
  57223. }
  57224. if (
  57225. oldChild &&
  57226. oldChild.data &&
  57227. !isSameChild(child, oldChild) &&
  57228. !isAsyncPlaceholder(oldChild) &&
  57229. // #6687 component root is a comment node
  57230. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  57231. ) {
  57232. // replace old child transition data with fresh one
  57233. // important for dynamic transitions!
  57234. var oldData = oldChild.data.transition = extend({}, data);
  57235. // handle transition mode
  57236. if (mode === 'out-in') {
  57237. // return placeholder node and queue update when leave finishes
  57238. this._leaving = true;
  57239. mergeVNodeHook(oldData, 'afterLeave', function () {
  57240. this$1._leaving = false;
  57241. this$1.$forceUpdate();
  57242. });
  57243. return placeholder(h, rawChild)
  57244. } else if (mode === 'in-out') {
  57245. if (isAsyncPlaceholder(child)) {
  57246. return oldRawChild
  57247. }
  57248. var delayedLeave;
  57249. var performLeave = function () { delayedLeave(); };
  57250. mergeVNodeHook(data, 'afterEnter', performLeave);
  57251. mergeVNodeHook(data, 'enterCancelled', performLeave);
  57252. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  57253. }
  57254. }
  57255. return rawChild
  57256. }
  57257. };
  57258. /* */
  57259. var props = extend({
  57260. tag: String,
  57261. moveClass: String
  57262. }, transitionProps);
  57263. delete props.mode;
  57264. var TransitionGroup = {
  57265. props: props,
  57266. beforeMount: function beforeMount () {
  57267. var this$1 = this;
  57268. var update = this._update;
  57269. this._update = function (vnode, hydrating) {
  57270. var restoreActiveInstance = setActiveInstance(this$1);
  57271. // force removing pass
  57272. this$1.__patch__(
  57273. this$1._vnode,
  57274. this$1.kept,
  57275. false, // hydrating
  57276. true // removeOnly (!important, avoids unnecessary moves)
  57277. );
  57278. this$1._vnode = this$1.kept;
  57279. restoreActiveInstance();
  57280. update.call(this$1, vnode, hydrating);
  57281. };
  57282. },
  57283. render: function render (h) {
  57284. var tag = this.tag || this.$vnode.data.tag || 'span';
  57285. var map = Object.create(null);
  57286. var prevChildren = this.prevChildren = this.children;
  57287. var rawChildren = this.$slots.default || [];
  57288. var children = this.children = [];
  57289. var transitionData = extractTransitionData(this);
  57290. for (var i = 0; i < rawChildren.length; i++) {
  57291. var c = rawChildren[i];
  57292. if (c.tag) {
  57293. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  57294. children.push(c);
  57295. map[c.key] = c
  57296. ;(c.data || (c.data = {})).transition = transitionData;
  57297. } else {
  57298. var opts = c.componentOptions;
  57299. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  57300. warn(("<transition-group> children must be keyed: <" + name + ">"));
  57301. }
  57302. }
  57303. }
  57304. if (prevChildren) {
  57305. var kept = [];
  57306. var removed = [];
  57307. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  57308. var c$1 = prevChildren[i$1];
  57309. c$1.data.transition = transitionData;
  57310. c$1.data.pos = c$1.elm.getBoundingClientRect();
  57311. if (map[c$1.key]) {
  57312. kept.push(c$1);
  57313. } else {
  57314. removed.push(c$1);
  57315. }
  57316. }
  57317. this.kept = h(tag, null, kept);
  57318. this.removed = removed;
  57319. }
  57320. return h(tag, null, children)
  57321. },
  57322. updated: function updated () {
  57323. var children = this.prevChildren;
  57324. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  57325. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  57326. return
  57327. }
  57328. // we divide the work into three loops to avoid mixing DOM reads and writes
  57329. // in each iteration - which helps prevent layout thrashing.
  57330. children.forEach(callPendingCbs);
  57331. children.forEach(recordPosition);
  57332. children.forEach(applyTranslation);
  57333. // force reflow to put everything in position
  57334. // assign to this to avoid being removed in tree-shaking
  57335. // $flow-disable-line
  57336. this._reflow = document.body.offsetHeight;
  57337. children.forEach(function (c) {
  57338. if (c.data.moved) {
  57339. var el = c.elm;
  57340. var s = el.style;
  57341. addTransitionClass(el, moveClass);
  57342. s.transform = s.WebkitTransform = s.transitionDuration = '';
  57343. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  57344. if (e && e.target !== el) {
  57345. return
  57346. }
  57347. if (!e || /transform$/.test(e.propertyName)) {
  57348. el.removeEventListener(transitionEndEvent, cb);
  57349. el._moveCb = null;
  57350. removeTransitionClass(el, moveClass);
  57351. }
  57352. });
  57353. }
  57354. });
  57355. },
  57356. methods: {
  57357. hasMove: function hasMove (el, moveClass) {
  57358. /* istanbul ignore if */
  57359. if (!hasTransition) {
  57360. return false
  57361. }
  57362. /* istanbul ignore if */
  57363. if (this._hasMove) {
  57364. return this._hasMove
  57365. }
  57366. // Detect whether an element with the move class applied has
  57367. // CSS transitions. Since the element may be inside an entering
  57368. // transition at this very moment, we make a clone of it and remove
  57369. // all other transition classes applied to ensure only the move class
  57370. // is applied.
  57371. var clone = el.cloneNode();
  57372. if (el._transitionClasses) {
  57373. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  57374. }
  57375. addClass(clone, moveClass);
  57376. clone.style.display = 'none';
  57377. this.$el.appendChild(clone);
  57378. var info = getTransitionInfo(clone);
  57379. this.$el.removeChild(clone);
  57380. return (this._hasMove = info.hasTransform)
  57381. }
  57382. }
  57383. };
  57384. function callPendingCbs (c) {
  57385. /* istanbul ignore if */
  57386. if (c.elm._moveCb) {
  57387. c.elm._moveCb();
  57388. }
  57389. /* istanbul ignore if */
  57390. if (c.elm._enterCb) {
  57391. c.elm._enterCb();
  57392. }
  57393. }
  57394. function recordPosition (c) {
  57395. c.data.newPos = c.elm.getBoundingClientRect();
  57396. }
  57397. function applyTranslation (c) {
  57398. var oldPos = c.data.pos;
  57399. var newPos = c.data.newPos;
  57400. var dx = oldPos.left - newPos.left;
  57401. var dy = oldPos.top - newPos.top;
  57402. if (dx || dy) {
  57403. c.data.moved = true;
  57404. var s = c.elm.style;
  57405. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  57406. s.transitionDuration = '0s';
  57407. }
  57408. }
  57409. var platformComponents = {
  57410. Transition: Transition,
  57411. TransitionGroup: TransitionGroup
  57412. };
  57413. /* */
  57414. // install platform specific utils
  57415. Vue.config.mustUseProp = mustUseProp;
  57416. Vue.config.isReservedTag = isReservedTag;
  57417. Vue.config.isReservedAttr = isReservedAttr;
  57418. Vue.config.getTagNamespace = getTagNamespace;
  57419. Vue.config.isUnknownElement = isUnknownElement;
  57420. // install platform runtime directives & components
  57421. extend(Vue.options.directives, platformDirectives);
  57422. extend(Vue.options.components, platformComponents);
  57423. // install platform patch function
  57424. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  57425. // public mount method
  57426. Vue.prototype.$mount = function (
  57427. el,
  57428. hydrating
  57429. ) {
  57430. el = el && inBrowser ? query(el) : undefined;
  57431. return mountComponent(this, el, hydrating)
  57432. };
  57433. // devtools global hook
  57434. /* istanbul ignore next */
  57435. if (inBrowser) {
  57436. setTimeout(function () {
  57437. if (config.devtools) {
  57438. if (devtools) {
  57439. devtools.emit('init', Vue);
  57440. } else {
  57441. console[console.info ? 'info' : 'log'](
  57442. 'Download the Vue Devtools extension for a better development experience:\n' +
  57443. 'https://github.com/vuejs/vue-devtools'
  57444. );
  57445. }
  57446. }
  57447. if (config.productionTip !== false &&
  57448. typeof console !== 'undefined'
  57449. ) {
  57450. console[console.info ? 'info' : 'log'](
  57451. "You are running Vue in development mode.\n" +
  57452. "Make sure to turn on production mode when deploying for production.\n" +
  57453. "See more tips at https://vuejs.org/guide/deployment.html"
  57454. );
  57455. }
  57456. }, 0);
  57457. }
  57458. /* */
  57459. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  57460. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  57461. var buildRegex = cached(function (delimiters) {
  57462. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  57463. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  57464. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  57465. });
  57466. function parseText (
  57467. text,
  57468. delimiters
  57469. ) {
  57470. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  57471. if (!tagRE.test(text)) {
  57472. return
  57473. }
  57474. var tokens = [];
  57475. var rawTokens = [];
  57476. var lastIndex = tagRE.lastIndex = 0;
  57477. var match, index, tokenValue;
  57478. while ((match = tagRE.exec(text))) {
  57479. index = match.index;
  57480. // push text token
  57481. if (index > lastIndex) {
  57482. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  57483. tokens.push(JSON.stringify(tokenValue));
  57484. }
  57485. // tag token
  57486. var exp = parseFilters(match[1].trim());
  57487. tokens.push(("_s(" + exp + ")"));
  57488. rawTokens.push({ '@binding': exp });
  57489. lastIndex = index + match[0].length;
  57490. }
  57491. if (lastIndex < text.length) {
  57492. rawTokens.push(tokenValue = text.slice(lastIndex));
  57493. tokens.push(JSON.stringify(tokenValue));
  57494. }
  57495. return {
  57496. expression: tokens.join('+'),
  57497. tokens: rawTokens
  57498. }
  57499. }
  57500. /* */
  57501. function transformNode (el, options) {
  57502. var warn = options.warn || baseWarn;
  57503. var staticClass = getAndRemoveAttr(el, 'class');
  57504. if (staticClass) {
  57505. var res = parseText(staticClass, options.delimiters);
  57506. if (res) {
  57507. warn(
  57508. "class=\"" + staticClass + "\": " +
  57509. 'Interpolation inside attributes has been removed. ' +
  57510. 'Use v-bind or the colon shorthand instead. For example, ' +
  57511. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  57512. el.rawAttrsMap['class']
  57513. );
  57514. }
  57515. }
  57516. if (staticClass) {
  57517. el.staticClass = JSON.stringify(staticClass);
  57518. }
  57519. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  57520. if (classBinding) {
  57521. el.classBinding = classBinding;
  57522. }
  57523. }
  57524. function genData (el) {
  57525. var data = '';
  57526. if (el.staticClass) {
  57527. data += "staticClass:" + (el.staticClass) + ",";
  57528. }
  57529. if (el.classBinding) {
  57530. data += "class:" + (el.classBinding) + ",";
  57531. }
  57532. return data
  57533. }
  57534. var klass$1 = {
  57535. staticKeys: ['staticClass'],
  57536. transformNode: transformNode,
  57537. genData: genData
  57538. };
  57539. /* */
  57540. function transformNode$1 (el, options) {
  57541. var warn = options.warn || baseWarn;
  57542. var staticStyle = getAndRemoveAttr(el, 'style');
  57543. if (staticStyle) {
  57544. /* istanbul ignore if */
  57545. {
  57546. var res = parseText(staticStyle, options.delimiters);
  57547. if (res) {
  57548. warn(
  57549. "style=\"" + staticStyle + "\": " +
  57550. 'Interpolation inside attributes has been removed. ' +
  57551. 'Use v-bind or the colon shorthand instead. For example, ' +
  57552. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  57553. el.rawAttrsMap['style']
  57554. );
  57555. }
  57556. }
  57557. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  57558. }
  57559. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  57560. if (styleBinding) {
  57561. el.styleBinding = styleBinding;
  57562. }
  57563. }
  57564. function genData$1 (el) {
  57565. var data = '';
  57566. if (el.staticStyle) {
  57567. data += "staticStyle:" + (el.staticStyle) + ",";
  57568. }
  57569. if (el.styleBinding) {
  57570. data += "style:(" + (el.styleBinding) + "),";
  57571. }
  57572. return data
  57573. }
  57574. var style$1 = {
  57575. staticKeys: ['staticStyle'],
  57576. transformNode: transformNode$1,
  57577. genData: genData$1
  57578. };
  57579. /* */
  57580. var decoder;
  57581. var he = {
  57582. decode: function decode (html) {
  57583. decoder = decoder || document.createElement('div');
  57584. decoder.innerHTML = html;
  57585. return decoder.textContent
  57586. }
  57587. };
  57588. /* */
  57589. var isUnaryTag = makeMap(
  57590. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  57591. 'link,meta,param,source,track,wbr'
  57592. );
  57593. // Elements that you can, intentionally, leave open
  57594. // (and which close themselves)
  57595. var canBeLeftOpenTag = makeMap(
  57596. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  57597. );
  57598. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  57599. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  57600. var isNonPhrasingTag = makeMap(
  57601. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  57602. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  57603. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  57604. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  57605. 'title,tr,track'
  57606. );
  57607. /**
  57608. * Not type-checking this file because it's mostly vendor code.
  57609. */
  57610. // Regular Expressions for parsing tags and attributes
  57611. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  57612. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  57613. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  57614. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  57615. var startTagOpen = new RegExp(("^<" + qnameCapture));
  57616. var startTagClose = /^\s*(\/?)>/;
  57617. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  57618. var doctype = /^<!DOCTYPE [^>]+>/i;
  57619. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  57620. var comment = /^<!\--/;
  57621. var conditionalComment = /^<!\[/;
  57622. // Special Elements (can contain anything)
  57623. var isPlainTextElement = makeMap('script,style,textarea', true);
  57624. var reCache = {};
  57625. var decodingMap = {
  57626. '&lt;': '<',
  57627. '&gt;': '>',
  57628. '&quot;': '"',
  57629. '&amp;': '&',
  57630. '&#10;': '\n',
  57631. '&#9;': '\t',
  57632. '&#39;': "'"
  57633. };
  57634. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  57635. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  57636. // #5992
  57637. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  57638. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  57639. function decodeAttr (value, shouldDecodeNewlines) {
  57640. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  57641. return value.replace(re, function (match) { return decodingMap[match]; })
  57642. }
  57643. function parseHTML (html, options) {
  57644. var stack = [];
  57645. var expectHTML = options.expectHTML;
  57646. var isUnaryTag$$1 = options.isUnaryTag || no;
  57647. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  57648. var index = 0;
  57649. var last, lastTag;
  57650. while (html) {
  57651. last = html;
  57652. // Make sure we're not in a plaintext content element like script/style
  57653. if (!lastTag || !isPlainTextElement(lastTag)) {
  57654. var textEnd = html.indexOf('<');
  57655. if (textEnd === 0) {
  57656. // Comment:
  57657. if (comment.test(html)) {
  57658. var commentEnd = html.indexOf('-->');
  57659. if (commentEnd >= 0) {
  57660. if (options.shouldKeepComment) {
  57661. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  57662. }
  57663. advance(commentEnd + 3);
  57664. continue
  57665. }
  57666. }
  57667. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  57668. if (conditionalComment.test(html)) {
  57669. var conditionalEnd = html.indexOf(']>');
  57670. if (conditionalEnd >= 0) {
  57671. advance(conditionalEnd + 2);
  57672. continue
  57673. }
  57674. }
  57675. // Doctype:
  57676. var doctypeMatch = html.match(doctype);
  57677. if (doctypeMatch) {
  57678. advance(doctypeMatch[0].length);
  57679. continue
  57680. }
  57681. // End tag:
  57682. var endTagMatch = html.match(endTag);
  57683. if (endTagMatch) {
  57684. var curIndex = index;
  57685. advance(endTagMatch[0].length);
  57686. parseEndTag(endTagMatch[1], curIndex, index);
  57687. continue
  57688. }
  57689. // Start tag:
  57690. var startTagMatch = parseStartTag();
  57691. if (startTagMatch) {
  57692. handleStartTag(startTagMatch);
  57693. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  57694. advance(1);
  57695. }
  57696. continue
  57697. }
  57698. }
  57699. var text = (void 0), rest = (void 0), next = (void 0);
  57700. if (textEnd >= 0) {
  57701. rest = html.slice(textEnd);
  57702. while (
  57703. !endTag.test(rest) &&
  57704. !startTagOpen.test(rest) &&
  57705. !comment.test(rest) &&
  57706. !conditionalComment.test(rest)
  57707. ) {
  57708. // < in plain text, be forgiving and treat it as text
  57709. next = rest.indexOf('<', 1);
  57710. if (next < 0) { break }
  57711. textEnd += next;
  57712. rest = html.slice(textEnd);
  57713. }
  57714. text = html.substring(0, textEnd);
  57715. }
  57716. if (textEnd < 0) {
  57717. text = html;
  57718. }
  57719. if (text) {
  57720. advance(text.length);
  57721. }
  57722. if (options.chars && text) {
  57723. options.chars(text, index - text.length, index);
  57724. }
  57725. } else {
  57726. var endTagLength = 0;
  57727. var stackedTag = lastTag.toLowerCase();
  57728. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  57729. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  57730. endTagLength = endTag.length;
  57731. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  57732. text = text
  57733. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  57734. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  57735. }
  57736. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  57737. text = text.slice(1);
  57738. }
  57739. if (options.chars) {
  57740. options.chars(text);
  57741. }
  57742. return ''
  57743. });
  57744. index += html.length - rest$1.length;
  57745. html = rest$1;
  57746. parseEndTag(stackedTag, index - endTagLength, index);
  57747. }
  57748. if (html === last) {
  57749. options.chars && options.chars(html);
  57750. if (!stack.length && options.warn) {
  57751. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  57752. }
  57753. break
  57754. }
  57755. }
  57756. // Clean up any remaining tags
  57757. parseEndTag();
  57758. function advance (n) {
  57759. index += n;
  57760. html = html.substring(n);
  57761. }
  57762. function parseStartTag () {
  57763. var start = html.match(startTagOpen);
  57764. if (start) {
  57765. var match = {
  57766. tagName: start[1],
  57767. attrs: [],
  57768. start: index
  57769. };
  57770. advance(start[0].length);
  57771. var end, attr;
  57772. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  57773. attr.start = index;
  57774. advance(attr[0].length);
  57775. attr.end = index;
  57776. match.attrs.push(attr);
  57777. }
  57778. if (end) {
  57779. match.unarySlash = end[1];
  57780. advance(end[0].length);
  57781. match.end = index;
  57782. return match
  57783. }
  57784. }
  57785. }
  57786. function handleStartTag (match) {
  57787. var tagName = match.tagName;
  57788. var unarySlash = match.unarySlash;
  57789. if (expectHTML) {
  57790. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  57791. parseEndTag(lastTag);
  57792. }
  57793. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  57794. parseEndTag(tagName);
  57795. }
  57796. }
  57797. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  57798. var l = match.attrs.length;
  57799. var attrs = new Array(l);
  57800. for (var i = 0; i < l; i++) {
  57801. var args = match.attrs[i];
  57802. var value = args[3] || args[4] || args[5] || '';
  57803. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  57804. ? options.shouldDecodeNewlinesForHref
  57805. : options.shouldDecodeNewlines;
  57806. attrs[i] = {
  57807. name: args[1],
  57808. value: decodeAttr(value, shouldDecodeNewlines)
  57809. };
  57810. if (options.outputSourceRange) {
  57811. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  57812. attrs[i].end = args.end;
  57813. }
  57814. }
  57815. if (!unary) {
  57816. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  57817. lastTag = tagName;
  57818. }
  57819. if (options.start) {
  57820. options.start(tagName, attrs, unary, match.start, match.end);
  57821. }
  57822. }
  57823. function parseEndTag (tagName, start, end) {
  57824. var pos, lowerCasedTagName;
  57825. if (start == null) { start = index; }
  57826. if (end == null) { end = index; }
  57827. // Find the closest opened tag of the same type
  57828. if (tagName) {
  57829. lowerCasedTagName = tagName.toLowerCase();
  57830. for (pos = stack.length - 1; pos >= 0; pos--) {
  57831. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  57832. break
  57833. }
  57834. }
  57835. } else {
  57836. // If no tag name is provided, clean shop
  57837. pos = 0;
  57838. }
  57839. if (pos >= 0) {
  57840. // Close all the open elements, up the stack
  57841. for (var i = stack.length - 1; i >= pos; i--) {
  57842. if (i > pos || !tagName &&
  57843. options.warn
  57844. ) {
  57845. options.warn(
  57846. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  57847. { start: stack[i].start, end: stack[i].end }
  57848. );
  57849. }
  57850. if (options.end) {
  57851. options.end(stack[i].tag, start, end);
  57852. }
  57853. }
  57854. // Remove the open elements from the stack
  57855. stack.length = pos;
  57856. lastTag = pos && stack[pos - 1].tag;
  57857. } else if (lowerCasedTagName === 'br') {
  57858. if (options.start) {
  57859. options.start(tagName, [], true, start, end);
  57860. }
  57861. } else if (lowerCasedTagName === 'p') {
  57862. if (options.start) {
  57863. options.start(tagName, [], false, start, end);
  57864. }
  57865. if (options.end) {
  57866. options.end(tagName, start, end);
  57867. }
  57868. }
  57869. }
  57870. }
  57871. /* */
  57872. var onRE = /^@|^v-on:/;
  57873. var dirRE = /^v-|^@|^:|^#/;
  57874. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  57875. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  57876. var stripParensRE = /^\(|\)$/g;
  57877. var dynamicArgRE = /^\[.*\]$/;
  57878. var argRE = /:(.*)$/;
  57879. var bindRE = /^:|^\.|^v-bind:/;
  57880. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  57881. var slotRE = /^v-slot(:|$)|^#/;
  57882. var lineBreakRE = /[\r\n]/;
  57883. var whitespaceRE$1 = /\s+/g;
  57884. var invalidAttributeRE = /[\s"'<>\/=]/;
  57885. var decodeHTMLCached = cached(he.decode);
  57886. var emptySlotScopeToken = "_empty_";
  57887. // configurable state
  57888. var warn$2;
  57889. var delimiters;
  57890. var transforms;
  57891. var preTransforms;
  57892. var postTransforms;
  57893. var platformIsPreTag;
  57894. var platformMustUseProp;
  57895. var platformGetTagNamespace;
  57896. var maybeComponent;
  57897. function createASTElement (
  57898. tag,
  57899. attrs,
  57900. parent
  57901. ) {
  57902. return {
  57903. type: 1,
  57904. tag: tag,
  57905. attrsList: attrs,
  57906. attrsMap: makeAttrsMap(attrs),
  57907. rawAttrsMap: {},
  57908. parent: parent,
  57909. children: []
  57910. }
  57911. }
  57912. /**
  57913. * Convert HTML string to AST.
  57914. */
  57915. function parse (
  57916. template,
  57917. options
  57918. ) {
  57919. warn$2 = options.warn || baseWarn;
  57920. platformIsPreTag = options.isPreTag || no;
  57921. platformMustUseProp = options.mustUseProp || no;
  57922. platformGetTagNamespace = options.getTagNamespace || no;
  57923. var isReservedTag = options.isReservedTag || no;
  57924. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  57925. transforms = pluckModuleFunction(options.modules, 'transformNode');
  57926. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  57927. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  57928. delimiters = options.delimiters;
  57929. var stack = [];
  57930. var preserveWhitespace = options.preserveWhitespace !== false;
  57931. var whitespaceOption = options.whitespace;
  57932. var root;
  57933. var currentParent;
  57934. var inVPre = false;
  57935. var inPre = false;
  57936. var warned = false;
  57937. function warnOnce (msg, range) {
  57938. if (!warned) {
  57939. warned = true;
  57940. warn$2(msg, range);
  57941. }
  57942. }
  57943. function closeElement (element) {
  57944. trimEndingWhitespace(element);
  57945. if (!inVPre && !element.processed) {
  57946. element = processElement(element, options);
  57947. }
  57948. // tree management
  57949. if (!stack.length && element !== root) {
  57950. // allow root elements with v-if, v-else-if and v-else
  57951. if (root.if && (element.elseif || element.else)) {
  57952. {
  57953. checkRootConstraints(element);
  57954. }
  57955. addIfCondition(root, {
  57956. exp: element.elseif,
  57957. block: element
  57958. });
  57959. } else {
  57960. warnOnce(
  57961. "Component template should contain exactly one root element. " +
  57962. "If you are using v-if on multiple elements, " +
  57963. "use v-else-if to chain them instead.",
  57964. { start: element.start }
  57965. );
  57966. }
  57967. }
  57968. if (currentParent && !element.forbidden) {
  57969. if (element.elseif || element.else) {
  57970. processIfConditions(element, currentParent);
  57971. } else {
  57972. if (element.slotScope) {
  57973. // scoped slot
  57974. // keep it in the children list so that v-else(-if) conditions can
  57975. // find it as the prev node.
  57976. var name = element.slotTarget || '"default"'
  57977. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  57978. }
  57979. currentParent.children.push(element);
  57980. element.parent = currentParent;
  57981. }
  57982. }
  57983. // final children cleanup
  57984. // filter out scoped slots
  57985. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  57986. // remove trailing whitespace node again
  57987. trimEndingWhitespace(element);
  57988. // check pre state
  57989. if (element.pre) {
  57990. inVPre = false;
  57991. }
  57992. if (platformIsPreTag(element.tag)) {
  57993. inPre = false;
  57994. }
  57995. // apply post-transforms
  57996. for (var i = 0; i < postTransforms.length; i++) {
  57997. postTransforms[i](element, options);
  57998. }
  57999. }
  58000. function trimEndingWhitespace (el) {
  58001. // remove trailing whitespace node
  58002. if (!inPre) {
  58003. var lastNode;
  58004. while (
  58005. (lastNode = el.children[el.children.length - 1]) &&
  58006. lastNode.type === 3 &&
  58007. lastNode.text === ' '
  58008. ) {
  58009. el.children.pop();
  58010. }
  58011. }
  58012. }
  58013. function checkRootConstraints (el) {
  58014. if (el.tag === 'slot' || el.tag === 'template') {
  58015. warnOnce(
  58016. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  58017. 'contain multiple nodes.',
  58018. { start: el.start }
  58019. );
  58020. }
  58021. if (el.attrsMap.hasOwnProperty('v-for')) {
  58022. warnOnce(
  58023. 'Cannot use v-for on stateful component root element because ' +
  58024. 'it renders multiple elements.',
  58025. el.rawAttrsMap['v-for']
  58026. );
  58027. }
  58028. }
  58029. parseHTML(template, {
  58030. warn: warn$2,
  58031. expectHTML: options.expectHTML,
  58032. isUnaryTag: options.isUnaryTag,
  58033. canBeLeftOpenTag: options.canBeLeftOpenTag,
  58034. shouldDecodeNewlines: options.shouldDecodeNewlines,
  58035. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  58036. shouldKeepComment: options.comments,
  58037. outputSourceRange: options.outputSourceRange,
  58038. start: function start (tag, attrs, unary, start$1, end) {
  58039. // check namespace.
  58040. // inherit parent ns if there is one
  58041. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  58042. // handle IE svg bug
  58043. /* istanbul ignore if */
  58044. if (isIE && ns === 'svg') {
  58045. attrs = guardIESVGBug(attrs);
  58046. }
  58047. var element = createASTElement(tag, attrs, currentParent);
  58048. if (ns) {
  58049. element.ns = ns;
  58050. }
  58051. {
  58052. if (options.outputSourceRange) {
  58053. element.start = start$1;
  58054. element.end = end;
  58055. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  58056. cumulated[attr.name] = attr;
  58057. return cumulated
  58058. }, {});
  58059. }
  58060. attrs.forEach(function (attr) {
  58061. if (invalidAttributeRE.test(attr.name)) {
  58062. warn$2(
  58063. "Invalid dynamic argument expression: attribute names cannot contain " +
  58064. "spaces, quotes, <, >, / or =.",
  58065. {
  58066. start: attr.start + attr.name.indexOf("["),
  58067. end: attr.start + attr.name.length
  58068. }
  58069. );
  58070. }
  58071. });
  58072. }
  58073. if (isForbiddenTag(element) && !isServerRendering()) {
  58074. element.forbidden = true;
  58075. warn$2(
  58076. 'Templates should only be responsible for mapping the state to the ' +
  58077. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  58078. "<" + tag + ">" + ', as they will not be parsed.',
  58079. { start: element.start }
  58080. );
  58081. }
  58082. // apply pre-transforms
  58083. for (var i = 0; i < preTransforms.length; i++) {
  58084. element = preTransforms[i](element, options) || element;
  58085. }
  58086. if (!inVPre) {
  58087. processPre(element);
  58088. if (element.pre) {
  58089. inVPre = true;
  58090. }
  58091. }
  58092. if (platformIsPreTag(element.tag)) {
  58093. inPre = true;
  58094. }
  58095. if (inVPre) {
  58096. processRawAttrs(element);
  58097. } else if (!element.processed) {
  58098. // structural directives
  58099. processFor(element);
  58100. processIf(element);
  58101. processOnce(element);
  58102. }
  58103. if (!root) {
  58104. root = element;
  58105. {
  58106. checkRootConstraints(root);
  58107. }
  58108. }
  58109. if (!unary) {
  58110. currentParent = element;
  58111. stack.push(element);
  58112. } else {
  58113. closeElement(element);
  58114. }
  58115. },
  58116. end: function end (tag, start, end$1) {
  58117. var element = stack[stack.length - 1];
  58118. // pop stack
  58119. stack.length -= 1;
  58120. currentParent = stack[stack.length - 1];
  58121. if (options.outputSourceRange) {
  58122. element.end = end$1;
  58123. }
  58124. closeElement(element);
  58125. },
  58126. chars: function chars (text, start, end) {
  58127. if (!currentParent) {
  58128. {
  58129. if (text === template) {
  58130. warnOnce(
  58131. 'Component template requires a root element, rather than just text.',
  58132. { start: start }
  58133. );
  58134. } else if ((text = text.trim())) {
  58135. warnOnce(
  58136. ("text \"" + text + "\" outside root element will be ignored."),
  58137. { start: start }
  58138. );
  58139. }
  58140. }
  58141. return
  58142. }
  58143. // IE textarea placeholder bug
  58144. /* istanbul ignore if */
  58145. if (isIE &&
  58146. currentParent.tag === 'textarea' &&
  58147. currentParent.attrsMap.placeholder === text
  58148. ) {
  58149. return
  58150. }
  58151. var children = currentParent.children;
  58152. if (inPre || text.trim()) {
  58153. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  58154. } else if (!children.length) {
  58155. // remove the whitespace-only node right after an opening tag
  58156. text = '';
  58157. } else if (whitespaceOption) {
  58158. if (whitespaceOption === 'condense') {
  58159. // in condense mode, remove the whitespace node if it contains
  58160. // line break, otherwise condense to a single space
  58161. text = lineBreakRE.test(text) ? '' : ' ';
  58162. } else {
  58163. text = ' ';
  58164. }
  58165. } else {
  58166. text = preserveWhitespace ? ' ' : '';
  58167. }
  58168. if (text) {
  58169. if (!inPre && whitespaceOption === 'condense') {
  58170. // condense consecutive whitespaces into single space
  58171. text = text.replace(whitespaceRE$1, ' ');
  58172. }
  58173. var res;
  58174. var child;
  58175. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  58176. child = {
  58177. type: 2,
  58178. expression: res.expression,
  58179. tokens: res.tokens,
  58180. text: text
  58181. };
  58182. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  58183. child = {
  58184. type: 3,
  58185. text: text
  58186. };
  58187. }
  58188. if (child) {
  58189. if (options.outputSourceRange) {
  58190. child.start = start;
  58191. child.end = end;
  58192. }
  58193. children.push(child);
  58194. }
  58195. }
  58196. },
  58197. comment: function comment (text, start, end) {
  58198. // adding anyting as a sibling to the root node is forbidden
  58199. // comments should still be allowed, but ignored
  58200. if (currentParent) {
  58201. var child = {
  58202. type: 3,
  58203. text: text,
  58204. isComment: true
  58205. };
  58206. if (options.outputSourceRange) {
  58207. child.start = start;
  58208. child.end = end;
  58209. }
  58210. currentParent.children.push(child);
  58211. }
  58212. }
  58213. });
  58214. return root
  58215. }
  58216. function processPre (el) {
  58217. if (getAndRemoveAttr(el, 'v-pre') != null) {
  58218. el.pre = true;
  58219. }
  58220. }
  58221. function processRawAttrs (el) {
  58222. var list = el.attrsList;
  58223. var len = list.length;
  58224. if (len) {
  58225. var attrs = el.attrs = new Array(len);
  58226. for (var i = 0; i < len; i++) {
  58227. attrs[i] = {
  58228. name: list[i].name,
  58229. value: JSON.stringify(list[i].value)
  58230. };
  58231. if (list[i].start != null) {
  58232. attrs[i].start = list[i].start;
  58233. attrs[i].end = list[i].end;
  58234. }
  58235. }
  58236. } else if (!el.pre) {
  58237. // non root node in pre blocks with no attributes
  58238. el.plain = true;
  58239. }
  58240. }
  58241. function processElement (
  58242. element,
  58243. options
  58244. ) {
  58245. processKey(element);
  58246. // determine whether this is a plain element after
  58247. // removing structural attributes
  58248. element.plain = (
  58249. !element.key &&
  58250. !element.scopedSlots &&
  58251. !element.attrsList.length
  58252. );
  58253. processRef(element);
  58254. processSlotContent(element);
  58255. processSlotOutlet(element);
  58256. processComponent(element);
  58257. for (var i = 0; i < transforms.length; i++) {
  58258. element = transforms[i](element, options) || element;
  58259. }
  58260. processAttrs(element);
  58261. return element
  58262. }
  58263. function processKey (el) {
  58264. var exp = getBindingAttr(el, 'key');
  58265. if (exp) {
  58266. {
  58267. if (el.tag === 'template') {
  58268. warn$2(
  58269. "<template> cannot be keyed. Place the key on real elements instead.",
  58270. getRawBindingAttr(el, 'key')
  58271. );
  58272. }
  58273. if (el.for) {
  58274. var iterator = el.iterator2 || el.iterator1;
  58275. var parent = el.parent;
  58276. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  58277. warn$2(
  58278. "Do not use v-for index as key on <transition-group> children, " +
  58279. "this is the same as not using keys.",
  58280. getRawBindingAttr(el, 'key'),
  58281. true /* tip */
  58282. );
  58283. }
  58284. }
  58285. }
  58286. el.key = exp;
  58287. }
  58288. }
  58289. function processRef (el) {
  58290. var ref = getBindingAttr(el, 'ref');
  58291. if (ref) {
  58292. el.ref = ref;
  58293. el.refInFor = checkInFor(el);
  58294. }
  58295. }
  58296. function processFor (el) {
  58297. var exp;
  58298. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  58299. var res = parseFor(exp);
  58300. if (res) {
  58301. extend(el, res);
  58302. } else {
  58303. warn$2(
  58304. ("Invalid v-for expression: " + exp),
  58305. el.rawAttrsMap['v-for']
  58306. );
  58307. }
  58308. }
  58309. }
  58310. function parseFor (exp) {
  58311. var inMatch = exp.match(forAliasRE);
  58312. if (!inMatch) { return }
  58313. var res = {};
  58314. res.for = inMatch[2].trim();
  58315. var alias = inMatch[1].trim().replace(stripParensRE, '');
  58316. var iteratorMatch = alias.match(forIteratorRE);
  58317. if (iteratorMatch) {
  58318. res.alias = alias.replace(forIteratorRE, '').trim();
  58319. res.iterator1 = iteratorMatch[1].trim();
  58320. if (iteratorMatch[2]) {
  58321. res.iterator2 = iteratorMatch[2].trim();
  58322. }
  58323. } else {
  58324. res.alias = alias;
  58325. }
  58326. return res
  58327. }
  58328. function processIf (el) {
  58329. var exp = getAndRemoveAttr(el, 'v-if');
  58330. if (exp) {
  58331. el.if = exp;
  58332. addIfCondition(el, {
  58333. exp: exp,
  58334. block: el
  58335. });
  58336. } else {
  58337. if (getAndRemoveAttr(el, 'v-else') != null) {
  58338. el.else = true;
  58339. }
  58340. var elseif = getAndRemoveAttr(el, 'v-else-if');
  58341. if (elseif) {
  58342. el.elseif = elseif;
  58343. }
  58344. }
  58345. }
  58346. function processIfConditions (el, parent) {
  58347. var prev = findPrevElement(parent.children);
  58348. if (prev && prev.if) {
  58349. addIfCondition(prev, {
  58350. exp: el.elseif,
  58351. block: el
  58352. });
  58353. } else {
  58354. warn$2(
  58355. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  58356. "used on element <" + (el.tag) + "> without corresponding v-if.",
  58357. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  58358. );
  58359. }
  58360. }
  58361. function findPrevElement (children) {
  58362. var i = children.length;
  58363. while (i--) {
  58364. if (children[i].type === 1) {
  58365. return children[i]
  58366. } else {
  58367. if (children[i].text !== ' ') {
  58368. warn$2(
  58369. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  58370. "will be ignored.",
  58371. children[i]
  58372. );
  58373. }
  58374. children.pop();
  58375. }
  58376. }
  58377. }
  58378. function addIfCondition (el, condition) {
  58379. if (!el.ifConditions) {
  58380. el.ifConditions = [];
  58381. }
  58382. el.ifConditions.push(condition);
  58383. }
  58384. function processOnce (el) {
  58385. var once$$1 = getAndRemoveAttr(el, 'v-once');
  58386. if (once$$1 != null) {
  58387. el.once = true;
  58388. }
  58389. }
  58390. // handle content being passed to a component as slot,
  58391. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  58392. function processSlotContent (el) {
  58393. var slotScope;
  58394. if (el.tag === 'template') {
  58395. slotScope = getAndRemoveAttr(el, 'scope');
  58396. /* istanbul ignore if */
  58397. if (slotScope) {
  58398. warn$2(
  58399. "the \"scope\" attribute for scoped slots have been deprecated and " +
  58400. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  58401. "can also be used on plain elements in addition to <template> to " +
  58402. "denote scoped slots.",
  58403. el.rawAttrsMap['scope'],
  58404. true
  58405. );
  58406. }
  58407. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  58408. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  58409. /* istanbul ignore if */
  58410. if (el.attrsMap['v-for']) {
  58411. warn$2(
  58412. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  58413. "(v-for takes higher priority). Use a wrapper <template> for the " +
  58414. "scoped slot to make it clearer.",
  58415. el.rawAttrsMap['slot-scope'],
  58416. true
  58417. );
  58418. }
  58419. el.slotScope = slotScope;
  58420. }
  58421. // slot="xxx"
  58422. var slotTarget = getBindingAttr(el, 'slot');
  58423. if (slotTarget) {
  58424. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  58425. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  58426. // preserve slot as an attribute for native shadow DOM compat
  58427. // only for non-scoped slots.
  58428. if (el.tag !== 'template' && !el.slotScope) {
  58429. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  58430. }
  58431. }
  58432. // 2.6 v-slot syntax
  58433. {
  58434. if (el.tag === 'template') {
  58435. // v-slot on <template>
  58436. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  58437. if (slotBinding) {
  58438. {
  58439. if (el.slotTarget || el.slotScope) {
  58440. warn$2(
  58441. "Unexpected mixed usage of different slot syntaxes.",
  58442. el
  58443. );
  58444. }
  58445. if (el.parent && !maybeComponent(el.parent)) {
  58446. warn$2(
  58447. "<template v-slot> can only appear at the root level inside " +
  58448. "the receiving component",
  58449. el
  58450. );
  58451. }
  58452. }
  58453. var ref = getSlotName(slotBinding);
  58454. var name = ref.name;
  58455. var dynamic = ref.dynamic;
  58456. el.slotTarget = name;
  58457. el.slotTargetDynamic = dynamic;
  58458. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  58459. }
  58460. } else {
  58461. // v-slot on component, denotes default slot
  58462. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  58463. if (slotBinding$1) {
  58464. {
  58465. if (!maybeComponent(el)) {
  58466. warn$2(
  58467. "v-slot can only be used on components or <template>.",
  58468. slotBinding$1
  58469. );
  58470. }
  58471. if (el.slotScope || el.slotTarget) {
  58472. warn$2(
  58473. "Unexpected mixed usage of different slot syntaxes.",
  58474. el
  58475. );
  58476. }
  58477. if (el.scopedSlots) {
  58478. warn$2(
  58479. "To avoid scope ambiguity, the default slot should also use " +
  58480. "<template> syntax when there are other named slots.",
  58481. slotBinding$1
  58482. );
  58483. }
  58484. }
  58485. // add the component's children to its default slot
  58486. var slots = el.scopedSlots || (el.scopedSlots = {});
  58487. var ref$1 = getSlotName(slotBinding$1);
  58488. var name$1 = ref$1.name;
  58489. var dynamic$1 = ref$1.dynamic;
  58490. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  58491. slotContainer.slotTarget = name$1;
  58492. slotContainer.slotTargetDynamic = dynamic$1;
  58493. slotContainer.children = el.children.filter(function (c) {
  58494. if (!c.slotScope) {
  58495. c.parent = slotContainer;
  58496. return true
  58497. }
  58498. });
  58499. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  58500. // remove children as they are returned from scopedSlots now
  58501. el.children = [];
  58502. // mark el non-plain so data gets generated
  58503. el.plain = false;
  58504. }
  58505. }
  58506. }
  58507. }
  58508. function getSlotName (binding) {
  58509. var name = binding.name.replace(slotRE, '');
  58510. if (!name) {
  58511. if (binding.name[0] !== '#') {
  58512. name = 'default';
  58513. } else {
  58514. warn$2(
  58515. "v-slot shorthand syntax requires a slot name.",
  58516. binding
  58517. );
  58518. }
  58519. }
  58520. return dynamicArgRE.test(name)
  58521. // dynamic [name]
  58522. ? { name: name.slice(1, -1), dynamic: true }
  58523. // static name
  58524. : { name: ("\"" + name + "\""), dynamic: false }
  58525. }
  58526. // handle <slot/> outlets
  58527. function processSlotOutlet (el) {
  58528. if (el.tag === 'slot') {
  58529. el.slotName = getBindingAttr(el, 'name');
  58530. if (el.key) {
  58531. warn$2(
  58532. "`key` does not work on <slot> because slots are abstract outlets " +
  58533. "and can possibly expand into multiple elements. " +
  58534. "Use the key on a wrapping element instead.",
  58535. getRawBindingAttr(el, 'key')
  58536. );
  58537. }
  58538. }
  58539. }
  58540. function processComponent (el) {
  58541. var binding;
  58542. if ((binding = getBindingAttr(el, 'is'))) {
  58543. el.component = binding;
  58544. }
  58545. if (getAndRemoveAttr(el, 'inline-template') != null) {
  58546. el.inlineTemplate = true;
  58547. }
  58548. }
  58549. function processAttrs (el) {
  58550. var list = el.attrsList;
  58551. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  58552. for (i = 0, l = list.length; i < l; i++) {
  58553. name = rawName = list[i].name;
  58554. value = list[i].value;
  58555. if (dirRE.test(name)) {
  58556. // mark element as dynamic
  58557. el.hasBindings = true;
  58558. // modifiers
  58559. modifiers = parseModifiers(name.replace(dirRE, ''));
  58560. // support .foo shorthand syntax for the .prop modifier
  58561. if (modifiers) {
  58562. name = name.replace(modifierRE, '');
  58563. }
  58564. if (bindRE.test(name)) { // v-bind
  58565. name = name.replace(bindRE, '');
  58566. value = parseFilters(value);
  58567. isDynamic = dynamicArgRE.test(name);
  58568. if (isDynamic) {
  58569. name = name.slice(1, -1);
  58570. }
  58571. if (
  58572. value.trim().length === 0
  58573. ) {
  58574. warn$2(
  58575. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  58576. );
  58577. }
  58578. if (modifiers) {
  58579. if (modifiers.prop && !isDynamic) {
  58580. name = camelize(name);
  58581. if (name === 'innerHtml') { name = 'innerHTML'; }
  58582. }
  58583. if (modifiers.camel && !isDynamic) {
  58584. name = camelize(name);
  58585. }
  58586. if (modifiers.sync) {
  58587. syncGen = genAssignmentCode(value, "$event");
  58588. if (!isDynamic) {
  58589. addHandler(
  58590. el,
  58591. ("update:" + (camelize(name))),
  58592. syncGen,
  58593. null,
  58594. false,
  58595. warn$2,
  58596. list[i]
  58597. );
  58598. if (hyphenate(name) !== camelize(name)) {
  58599. addHandler(
  58600. el,
  58601. ("update:" + (hyphenate(name))),
  58602. syncGen,
  58603. null,
  58604. false,
  58605. warn$2,
  58606. list[i]
  58607. );
  58608. }
  58609. } else {
  58610. // handler w/ dynamic event name
  58611. addHandler(
  58612. el,
  58613. ("\"update:\"+(" + name + ")"),
  58614. syncGen,
  58615. null,
  58616. false,
  58617. warn$2,
  58618. list[i],
  58619. true // dynamic
  58620. );
  58621. }
  58622. }
  58623. }
  58624. if ((modifiers && modifiers.prop) || (
  58625. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  58626. )) {
  58627. addProp(el, name, value, list[i], isDynamic);
  58628. } else {
  58629. addAttr(el, name, value, list[i], isDynamic);
  58630. }
  58631. } else if (onRE.test(name)) { // v-on
  58632. name = name.replace(onRE, '');
  58633. isDynamic = dynamicArgRE.test(name);
  58634. if (isDynamic) {
  58635. name = name.slice(1, -1);
  58636. }
  58637. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  58638. } else { // normal directives
  58639. name = name.replace(dirRE, '');
  58640. // parse arg
  58641. var argMatch = name.match(argRE);
  58642. var arg = argMatch && argMatch[1];
  58643. isDynamic = false;
  58644. if (arg) {
  58645. name = name.slice(0, -(arg.length + 1));
  58646. if (dynamicArgRE.test(arg)) {
  58647. arg = arg.slice(1, -1);
  58648. isDynamic = true;
  58649. }
  58650. }
  58651. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  58652. if (name === 'model') {
  58653. checkForAliasModel(el, value);
  58654. }
  58655. }
  58656. } else {
  58657. // literal attribute
  58658. {
  58659. var res = parseText(value, delimiters);
  58660. if (res) {
  58661. warn$2(
  58662. name + "=\"" + value + "\": " +
  58663. 'Interpolation inside attributes has been removed. ' +
  58664. 'Use v-bind or the colon shorthand instead. For example, ' +
  58665. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  58666. list[i]
  58667. );
  58668. }
  58669. }
  58670. addAttr(el, name, JSON.stringify(value), list[i]);
  58671. // #6887 firefox doesn't update muted state if set via attribute
  58672. // even immediately after element creation
  58673. if (!el.component &&
  58674. name === 'muted' &&
  58675. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  58676. addProp(el, name, 'true', list[i]);
  58677. }
  58678. }
  58679. }
  58680. }
  58681. function checkInFor (el) {
  58682. var parent = el;
  58683. while (parent) {
  58684. if (parent.for !== undefined) {
  58685. return true
  58686. }
  58687. parent = parent.parent;
  58688. }
  58689. return false
  58690. }
  58691. function parseModifiers (name) {
  58692. var match = name.match(modifierRE);
  58693. if (match) {
  58694. var ret = {};
  58695. match.forEach(function (m) { ret[m.slice(1)] = true; });
  58696. return ret
  58697. }
  58698. }
  58699. function makeAttrsMap (attrs) {
  58700. var map = {};
  58701. for (var i = 0, l = attrs.length; i < l; i++) {
  58702. if (
  58703. map[attrs[i].name] && !isIE && !isEdge
  58704. ) {
  58705. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  58706. }
  58707. map[attrs[i].name] = attrs[i].value;
  58708. }
  58709. return map
  58710. }
  58711. // for script (e.g. type="x/template") or style, do not decode content
  58712. function isTextTag (el) {
  58713. return el.tag === 'script' || el.tag === 'style'
  58714. }
  58715. function isForbiddenTag (el) {
  58716. return (
  58717. el.tag === 'style' ||
  58718. (el.tag === 'script' && (
  58719. !el.attrsMap.type ||
  58720. el.attrsMap.type === 'text/javascript'
  58721. ))
  58722. )
  58723. }
  58724. var ieNSBug = /^xmlns:NS\d+/;
  58725. var ieNSPrefix = /^NS\d+:/;
  58726. /* istanbul ignore next */
  58727. function guardIESVGBug (attrs) {
  58728. var res = [];
  58729. for (var i = 0; i < attrs.length; i++) {
  58730. var attr = attrs[i];
  58731. if (!ieNSBug.test(attr.name)) {
  58732. attr.name = attr.name.replace(ieNSPrefix, '');
  58733. res.push(attr);
  58734. }
  58735. }
  58736. return res
  58737. }
  58738. function checkForAliasModel (el, value) {
  58739. var _el = el;
  58740. while (_el) {
  58741. if (_el.for && _el.alias === value) {
  58742. warn$2(
  58743. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  58744. "You are binding v-model directly to a v-for iteration alias. " +
  58745. "This will not be able to modify the v-for source array because " +
  58746. "writing to the alias is like modifying a function local variable. " +
  58747. "Consider using an array of objects and use v-model on an object property instead.",
  58748. el.rawAttrsMap['v-model']
  58749. );
  58750. }
  58751. _el = _el.parent;
  58752. }
  58753. }
  58754. /* */
  58755. function preTransformNode (el, options) {
  58756. if (el.tag === 'input') {
  58757. var map = el.attrsMap;
  58758. if (!map['v-model']) {
  58759. return
  58760. }
  58761. var typeBinding;
  58762. if (map[':type'] || map['v-bind:type']) {
  58763. typeBinding = getBindingAttr(el, 'type');
  58764. }
  58765. if (!map.type && !typeBinding && map['v-bind']) {
  58766. typeBinding = "(" + (map['v-bind']) + ").type";
  58767. }
  58768. if (typeBinding) {
  58769. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  58770. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  58771. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  58772. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  58773. // 1. checkbox
  58774. var branch0 = cloneASTElement(el);
  58775. // process for on the main node
  58776. processFor(branch0);
  58777. addRawAttr(branch0, 'type', 'checkbox');
  58778. processElement(branch0, options);
  58779. branch0.processed = true; // prevent it from double-processed
  58780. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  58781. addIfCondition(branch0, {
  58782. exp: branch0.if,
  58783. block: branch0
  58784. });
  58785. // 2. add radio else-if condition
  58786. var branch1 = cloneASTElement(el);
  58787. getAndRemoveAttr(branch1, 'v-for', true);
  58788. addRawAttr(branch1, 'type', 'radio');
  58789. processElement(branch1, options);
  58790. addIfCondition(branch0, {
  58791. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  58792. block: branch1
  58793. });
  58794. // 3. other
  58795. var branch2 = cloneASTElement(el);
  58796. getAndRemoveAttr(branch2, 'v-for', true);
  58797. addRawAttr(branch2, ':type', typeBinding);
  58798. processElement(branch2, options);
  58799. addIfCondition(branch0, {
  58800. exp: ifCondition,
  58801. block: branch2
  58802. });
  58803. if (hasElse) {
  58804. branch0.else = true;
  58805. } else if (elseIfCondition) {
  58806. branch0.elseif = elseIfCondition;
  58807. }
  58808. return branch0
  58809. }
  58810. }
  58811. }
  58812. function cloneASTElement (el) {
  58813. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  58814. }
  58815. var model$1 = {
  58816. preTransformNode: preTransformNode
  58817. };
  58818. var modules$1 = [
  58819. klass$1,
  58820. style$1,
  58821. model$1
  58822. ];
  58823. /* */
  58824. function text (el, dir) {
  58825. if (dir.value) {
  58826. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  58827. }
  58828. }
  58829. /* */
  58830. function html (el, dir) {
  58831. if (dir.value) {
  58832. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  58833. }
  58834. }
  58835. var directives$1 = {
  58836. model: model,
  58837. text: text,
  58838. html: html
  58839. };
  58840. /* */
  58841. var baseOptions = {
  58842. expectHTML: true,
  58843. modules: modules$1,
  58844. directives: directives$1,
  58845. isPreTag: isPreTag,
  58846. isUnaryTag: isUnaryTag,
  58847. mustUseProp: mustUseProp,
  58848. canBeLeftOpenTag: canBeLeftOpenTag,
  58849. isReservedTag: isReservedTag,
  58850. getTagNamespace: getTagNamespace,
  58851. staticKeys: genStaticKeys(modules$1)
  58852. };
  58853. /* */
  58854. var isStaticKey;
  58855. var isPlatformReservedTag;
  58856. var genStaticKeysCached = cached(genStaticKeys$1);
  58857. /**
  58858. * Goal of the optimizer: walk the generated template AST tree
  58859. * and detect sub-trees that are purely static, i.e. parts of
  58860. * the DOM that never needs to change.
  58861. *
  58862. * Once we detect these sub-trees, we can:
  58863. *
  58864. * 1. Hoist them into constants, so that we no longer need to
  58865. * create fresh nodes for them on each re-render;
  58866. * 2. Completely skip them in the patching process.
  58867. */
  58868. function optimize (root, options) {
  58869. if (!root) { return }
  58870. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  58871. isPlatformReservedTag = options.isReservedTag || no;
  58872. // first pass: mark all non-static nodes.
  58873. markStatic$1(root);
  58874. // second pass: mark static roots.
  58875. markStaticRoots(root, false);
  58876. }
  58877. function genStaticKeys$1 (keys) {
  58878. return makeMap(
  58879. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  58880. (keys ? ',' + keys : '')
  58881. )
  58882. }
  58883. function markStatic$1 (node) {
  58884. node.static = isStatic(node);
  58885. if (node.type === 1) {
  58886. // do not make component slot content static. this avoids
  58887. // 1. components not able to mutate slot nodes
  58888. // 2. static slot content fails for hot-reloading
  58889. if (
  58890. !isPlatformReservedTag(node.tag) &&
  58891. node.tag !== 'slot' &&
  58892. node.attrsMap['inline-template'] == null
  58893. ) {
  58894. return
  58895. }
  58896. for (var i = 0, l = node.children.length; i < l; i++) {
  58897. var child = node.children[i];
  58898. markStatic$1(child);
  58899. if (!child.static) {
  58900. node.static = false;
  58901. }
  58902. }
  58903. if (node.ifConditions) {
  58904. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  58905. var block = node.ifConditions[i$1].block;
  58906. markStatic$1(block);
  58907. if (!block.static) {
  58908. node.static = false;
  58909. }
  58910. }
  58911. }
  58912. }
  58913. }
  58914. function markStaticRoots (node, isInFor) {
  58915. if (node.type === 1) {
  58916. if (node.static || node.once) {
  58917. node.staticInFor = isInFor;
  58918. }
  58919. // For a node to qualify as a static root, it should have children that
  58920. // are not just static text. Otherwise the cost of hoisting out will
  58921. // outweigh the benefits and it's better off to just always render it fresh.
  58922. if (node.static && node.children.length && !(
  58923. node.children.length === 1 &&
  58924. node.children[0].type === 3
  58925. )) {
  58926. node.staticRoot = true;
  58927. return
  58928. } else {
  58929. node.staticRoot = false;
  58930. }
  58931. if (node.children) {
  58932. for (var i = 0, l = node.children.length; i < l; i++) {
  58933. markStaticRoots(node.children[i], isInFor || !!node.for);
  58934. }
  58935. }
  58936. if (node.ifConditions) {
  58937. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  58938. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  58939. }
  58940. }
  58941. }
  58942. }
  58943. function isStatic (node) {
  58944. if (node.type === 2) { // expression
  58945. return false
  58946. }
  58947. if (node.type === 3) { // text
  58948. return true
  58949. }
  58950. return !!(node.pre || (
  58951. !node.hasBindings && // no dynamic bindings
  58952. !node.if && !node.for && // not v-if or v-for or v-else
  58953. !isBuiltInTag(node.tag) && // not a built-in
  58954. isPlatformReservedTag(node.tag) && // not a component
  58955. !isDirectChildOfTemplateFor(node) &&
  58956. Object.keys(node).every(isStaticKey)
  58957. ))
  58958. }
  58959. function isDirectChildOfTemplateFor (node) {
  58960. while (node.parent) {
  58961. node = node.parent;
  58962. if (node.tag !== 'template') {
  58963. return false
  58964. }
  58965. if (node.for) {
  58966. return true
  58967. }
  58968. }
  58969. return false
  58970. }
  58971. /* */
  58972. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  58973. var fnInvokeRE = /\([^)]*?\);*$/;
  58974. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  58975. // KeyboardEvent.keyCode aliases
  58976. var keyCodes = {
  58977. esc: 27,
  58978. tab: 9,
  58979. enter: 13,
  58980. space: 32,
  58981. up: 38,
  58982. left: 37,
  58983. right: 39,
  58984. down: 40,
  58985. 'delete': [8, 46]
  58986. };
  58987. // KeyboardEvent.key aliases
  58988. var keyNames = {
  58989. // #7880: IE11 and Edge use `Esc` for Escape key name.
  58990. esc: ['Esc', 'Escape'],
  58991. tab: 'Tab',
  58992. enter: 'Enter',
  58993. // #9112: IE11 uses `Spacebar` for Space key name.
  58994. space: [' ', 'Spacebar'],
  58995. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  58996. up: ['Up', 'ArrowUp'],
  58997. left: ['Left', 'ArrowLeft'],
  58998. right: ['Right', 'ArrowRight'],
  58999. down: ['Down', 'ArrowDown'],
  59000. // #9112: IE11 uses `Del` for Delete key name.
  59001. 'delete': ['Backspace', 'Delete', 'Del']
  59002. };
  59003. // #4868: modifiers that prevent the execution of the listener
  59004. // need to explicitly return null so that we can determine whether to remove
  59005. // the listener for .once
  59006. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  59007. var modifierCode = {
  59008. stop: '$event.stopPropagation();',
  59009. prevent: '$event.preventDefault();',
  59010. self: genGuard("$event.target !== $event.currentTarget"),
  59011. ctrl: genGuard("!$event.ctrlKey"),
  59012. shift: genGuard("!$event.shiftKey"),
  59013. alt: genGuard("!$event.altKey"),
  59014. meta: genGuard("!$event.metaKey"),
  59015. left: genGuard("'button' in $event && $event.button !== 0"),
  59016. middle: genGuard("'button' in $event && $event.button !== 1"),
  59017. right: genGuard("'button' in $event && $event.button !== 2")
  59018. };
  59019. function genHandlers (
  59020. events,
  59021. isNative
  59022. ) {
  59023. var prefix = isNative ? 'nativeOn:' : 'on:';
  59024. var staticHandlers = "";
  59025. var dynamicHandlers = "";
  59026. for (var name in events) {
  59027. var handlerCode = genHandler(events[name]);
  59028. if (events[name] && events[name].dynamic) {
  59029. dynamicHandlers += name + "," + handlerCode + ",";
  59030. } else {
  59031. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  59032. }
  59033. }
  59034. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  59035. if (dynamicHandlers) {
  59036. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  59037. } else {
  59038. return prefix + staticHandlers
  59039. }
  59040. }
  59041. function genHandler (handler) {
  59042. if (!handler) {
  59043. return 'function(){}'
  59044. }
  59045. if (Array.isArray(handler)) {
  59046. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  59047. }
  59048. var isMethodPath = simplePathRE.test(handler.value);
  59049. var isFunctionExpression = fnExpRE.test(handler.value);
  59050. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  59051. if (!handler.modifiers) {
  59052. if (isMethodPath || isFunctionExpression) {
  59053. return handler.value
  59054. }
  59055. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  59056. } else {
  59057. var code = '';
  59058. var genModifierCode = '';
  59059. var keys = [];
  59060. for (var key in handler.modifiers) {
  59061. if (modifierCode[key]) {
  59062. genModifierCode += modifierCode[key];
  59063. // left/right
  59064. if (keyCodes[key]) {
  59065. keys.push(key);
  59066. }
  59067. } else if (key === 'exact') {
  59068. var modifiers = (handler.modifiers);
  59069. genModifierCode += genGuard(
  59070. ['ctrl', 'shift', 'alt', 'meta']
  59071. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  59072. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  59073. .join('||')
  59074. );
  59075. } else {
  59076. keys.push(key);
  59077. }
  59078. }
  59079. if (keys.length) {
  59080. code += genKeyFilter(keys);
  59081. }
  59082. // Make sure modifiers like prevent and stop get executed after key filtering
  59083. if (genModifierCode) {
  59084. code += genModifierCode;
  59085. }
  59086. var handlerCode = isMethodPath
  59087. ? ("return " + (handler.value) + "($event)")
  59088. : isFunctionExpression
  59089. ? ("return (" + (handler.value) + ")($event)")
  59090. : isFunctionInvocation
  59091. ? ("return " + (handler.value))
  59092. : handler.value;
  59093. return ("function($event){" + code + handlerCode + "}")
  59094. }
  59095. }
  59096. function genKeyFilter (keys) {
  59097. return (
  59098. // make sure the key filters only apply to KeyboardEvents
  59099. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  59100. // key events that do not have keyCode property...
  59101. "if(!$event.type.indexOf('key')&&" +
  59102. (keys.map(genFilterCode).join('&&')) + ")return null;"
  59103. )
  59104. }
  59105. function genFilterCode (key) {
  59106. var keyVal = parseInt(key, 10);
  59107. if (keyVal) {
  59108. return ("$event.keyCode!==" + keyVal)
  59109. }
  59110. var keyCode = keyCodes[key];
  59111. var keyName = keyNames[key];
  59112. return (
  59113. "_k($event.keyCode," +
  59114. (JSON.stringify(key)) + "," +
  59115. (JSON.stringify(keyCode)) + "," +
  59116. "$event.key," +
  59117. "" + (JSON.stringify(keyName)) +
  59118. ")"
  59119. )
  59120. }
  59121. /* */
  59122. function on (el, dir) {
  59123. if (dir.modifiers) {
  59124. warn("v-on without argument does not support modifiers.");
  59125. }
  59126. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  59127. }
  59128. /* */
  59129. function bind$1 (el, dir) {
  59130. el.wrapData = function (code) {
  59131. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  59132. };
  59133. }
  59134. /* */
  59135. var baseDirectives = {
  59136. on: on,
  59137. bind: bind$1,
  59138. cloak: noop
  59139. };
  59140. /* */
  59141. var CodegenState = function CodegenState (options) {
  59142. this.options = options;
  59143. this.warn = options.warn || baseWarn;
  59144. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  59145. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  59146. this.directives = extend(extend({}, baseDirectives), options.directives);
  59147. var isReservedTag = options.isReservedTag || no;
  59148. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  59149. this.onceId = 0;
  59150. this.staticRenderFns = [];
  59151. this.pre = false;
  59152. };
  59153. function generate (
  59154. ast,
  59155. options
  59156. ) {
  59157. var state = new CodegenState(options);
  59158. var code = ast ? genElement(ast, state) : '_c("div")';
  59159. return {
  59160. render: ("with(this){return " + code + "}"),
  59161. staticRenderFns: state.staticRenderFns
  59162. }
  59163. }
  59164. function genElement (el, state) {
  59165. if (el.parent) {
  59166. el.pre = el.pre || el.parent.pre;
  59167. }
  59168. if (el.staticRoot && !el.staticProcessed) {
  59169. return genStatic(el, state)
  59170. } else if (el.once && !el.onceProcessed) {
  59171. return genOnce(el, state)
  59172. } else if (el.for && !el.forProcessed) {
  59173. return genFor(el, state)
  59174. } else if (el.if && !el.ifProcessed) {
  59175. return genIf(el, state)
  59176. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  59177. return genChildren(el, state) || 'void 0'
  59178. } else if (el.tag === 'slot') {
  59179. return genSlot(el, state)
  59180. } else {
  59181. // component or element
  59182. var code;
  59183. if (el.component) {
  59184. code = genComponent(el.component, el, state);
  59185. } else {
  59186. var data;
  59187. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  59188. data = genData$2(el, state);
  59189. }
  59190. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  59191. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  59192. }
  59193. // module transforms
  59194. for (var i = 0; i < state.transforms.length; i++) {
  59195. code = state.transforms[i](el, code);
  59196. }
  59197. return code
  59198. }
  59199. }
  59200. // hoist static sub-trees out
  59201. function genStatic (el, state) {
  59202. el.staticProcessed = true;
  59203. // Some elements (templates) need to behave differently inside of a v-pre
  59204. // node. All pre nodes are static roots, so we can use this as a location to
  59205. // wrap a state change and reset it upon exiting the pre node.
  59206. var originalPreState = state.pre;
  59207. if (el.pre) {
  59208. state.pre = el.pre;
  59209. }
  59210. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  59211. state.pre = originalPreState;
  59212. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  59213. }
  59214. // v-once
  59215. function genOnce (el, state) {
  59216. el.onceProcessed = true;
  59217. if (el.if && !el.ifProcessed) {
  59218. return genIf(el, state)
  59219. } else if (el.staticInFor) {
  59220. var key = '';
  59221. var parent = el.parent;
  59222. while (parent) {
  59223. if (parent.for) {
  59224. key = parent.key;
  59225. break
  59226. }
  59227. parent = parent.parent;
  59228. }
  59229. if (!key) {
  59230. state.warn(
  59231. "v-once can only be used inside v-for that is keyed. ",
  59232. el.rawAttrsMap['v-once']
  59233. );
  59234. return genElement(el, state)
  59235. }
  59236. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  59237. } else {
  59238. return genStatic(el, state)
  59239. }
  59240. }
  59241. function genIf (
  59242. el,
  59243. state,
  59244. altGen,
  59245. altEmpty
  59246. ) {
  59247. el.ifProcessed = true; // avoid recursion
  59248. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  59249. }
  59250. function genIfConditions (
  59251. conditions,
  59252. state,
  59253. altGen,
  59254. altEmpty
  59255. ) {
  59256. if (!conditions.length) {
  59257. return altEmpty || '_e()'
  59258. }
  59259. var condition = conditions.shift();
  59260. if (condition.exp) {
  59261. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  59262. } else {
  59263. return ("" + (genTernaryExp(condition.block)))
  59264. }
  59265. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  59266. function genTernaryExp (el) {
  59267. return altGen
  59268. ? altGen(el, state)
  59269. : el.once
  59270. ? genOnce(el, state)
  59271. : genElement(el, state)
  59272. }
  59273. }
  59274. function genFor (
  59275. el,
  59276. state,
  59277. altGen,
  59278. altHelper
  59279. ) {
  59280. var exp = el.for;
  59281. var alias = el.alias;
  59282. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  59283. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  59284. if (state.maybeComponent(el) &&
  59285. el.tag !== 'slot' &&
  59286. el.tag !== 'template' &&
  59287. !el.key
  59288. ) {
  59289. state.warn(
  59290. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  59291. "v-for should have explicit keys. " +
  59292. "See https://vuejs.org/guide/list.html#key for more info.",
  59293. el.rawAttrsMap['v-for'],
  59294. true /* tip */
  59295. );
  59296. }
  59297. el.forProcessed = true; // avoid recursion
  59298. return (altHelper || '_l') + "((" + exp + ")," +
  59299. "function(" + alias + iterator1 + iterator2 + "){" +
  59300. "return " + ((altGen || genElement)(el, state)) +
  59301. '})'
  59302. }
  59303. function genData$2 (el, state) {
  59304. var data = '{';
  59305. // directives first.
  59306. // directives may mutate the el's other properties before they are generated.
  59307. var dirs = genDirectives(el, state);
  59308. if (dirs) { data += dirs + ','; }
  59309. // key
  59310. if (el.key) {
  59311. data += "key:" + (el.key) + ",";
  59312. }
  59313. // ref
  59314. if (el.ref) {
  59315. data += "ref:" + (el.ref) + ",";
  59316. }
  59317. if (el.refInFor) {
  59318. data += "refInFor:true,";
  59319. }
  59320. // pre
  59321. if (el.pre) {
  59322. data += "pre:true,";
  59323. }
  59324. // record original tag name for components using "is" attribute
  59325. if (el.component) {
  59326. data += "tag:\"" + (el.tag) + "\",";
  59327. }
  59328. // module data generation functions
  59329. for (var i = 0; i < state.dataGenFns.length; i++) {
  59330. data += state.dataGenFns[i](el);
  59331. }
  59332. // attributes
  59333. if (el.attrs) {
  59334. data += "attrs:" + (genProps(el.attrs)) + ",";
  59335. }
  59336. // DOM props
  59337. if (el.props) {
  59338. data += "domProps:" + (genProps(el.props)) + ",";
  59339. }
  59340. // event handlers
  59341. if (el.events) {
  59342. data += (genHandlers(el.events, false)) + ",";
  59343. }
  59344. if (el.nativeEvents) {
  59345. data += (genHandlers(el.nativeEvents, true)) + ",";
  59346. }
  59347. // slot target
  59348. // only for non-scoped slots
  59349. if (el.slotTarget && !el.slotScope) {
  59350. data += "slot:" + (el.slotTarget) + ",";
  59351. }
  59352. // scoped slots
  59353. if (el.scopedSlots) {
  59354. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  59355. }
  59356. // component v-model
  59357. if (el.model) {
  59358. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  59359. }
  59360. // inline-template
  59361. if (el.inlineTemplate) {
  59362. var inlineTemplate = genInlineTemplate(el, state);
  59363. if (inlineTemplate) {
  59364. data += inlineTemplate + ",";
  59365. }
  59366. }
  59367. data = data.replace(/,$/, '') + '}';
  59368. // v-bind dynamic argument wrap
  59369. // v-bind with dynamic arguments must be applied using the same v-bind object
  59370. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  59371. if (el.dynamicAttrs) {
  59372. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  59373. }
  59374. // v-bind data wrap
  59375. if (el.wrapData) {
  59376. data = el.wrapData(data);
  59377. }
  59378. // v-on data wrap
  59379. if (el.wrapListeners) {
  59380. data = el.wrapListeners(data);
  59381. }
  59382. return data
  59383. }
  59384. function genDirectives (el, state) {
  59385. var dirs = el.directives;
  59386. if (!dirs) { return }
  59387. var res = 'directives:[';
  59388. var hasRuntime = false;
  59389. var i, l, dir, needRuntime;
  59390. for (i = 0, l = dirs.length; i < l; i++) {
  59391. dir = dirs[i];
  59392. needRuntime = true;
  59393. var gen = state.directives[dir.name];
  59394. if (gen) {
  59395. // compile-time directive that manipulates AST.
  59396. // returns true if it also needs a runtime counterpart.
  59397. needRuntime = !!gen(el, dir, state.warn);
  59398. }
  59399. if (needRuntime) {
  59400. hasRuntime = true;
  59401. 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))) : '') + "},";
  59402. }
  59403. }
  59404. if (hasRuntime) {
  59405. return res.slice(0, -1) + ']'
  59406. }
  59407. }
  59408. function genInlineTemplate (el, state) {
  59409. var ast = el.children[0];
  59410. if (el.children.length !== 1 || ast.type !== 1) {
  59411. state.warn(
  59412. 'Inline-template components must have exactly one child element.',
  59413. { start: el.start }
  59414. );
  59415. }
  59416. if (ast && ast.type === 1) {
  59417. var inlineRenderFns = generate(ast, state.options);
  59418. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  59419. }
  59420. }
  59421. function genScopedSlots (
  59422. el,
  59423. slots,
  59424. state
  59425. ) {
  59426. // by default scoped slots are considered "stable", this allows child
  59427. // components with only scoped slots to skip forced updates from parent.
  59428. // but in some cases we have to bail-out of this optimization
  59429. // for example if the slot contains dynamic names, has v-if or v-for on them...
  59430. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  59431. var slot = slots[key];
  59432. return (
  59433. slot.slotTargetDynamic ||
  59434. slot.if ||
  59435. slot.for ||
  59436. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  59437. )
  59438. });
  59439. // #9534: if a component with scoped slots is inside a conditional branch,
  59440. // it's possible for the same component to be reused but with different
  59441. // compiled slot content. To avoid that, we generate a unique key based on
  59442. // the generated code of all the slot contents.
  59443. var needsKey = !!el.if;
  59444. // OR when it is inside another scoped slot or v-for (the reactivity may be
  59445. // disconnected due to the intermediate scope variable)
  59446. // #9438, #9506
  59447. // TODO: this can be further optimized by properly analyzing in-scope bindings
  59448. // and skip force updating ones that do not actually use scope variables.
  59449. if (!needsForceUpdate) {
  59450. var parent = el.parent;
  59451. while (parent) {
  59452. if (
  59453. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  59454. parent.for
  59455. ) {
  59456. needsForceUpdate = true;
  59457. break
  59458. }
  59459. if (parent.if) {
  59460. needsKey = true;
  59461. }
  59462. parent = parent.parent;
  59463. }
  59464. }
  59465. var generatedSlots = Object.keys(slots)
  59466. .map(function (key) { return genScopedSlot(slots[key], state); })
  59467. .join(',');
  59468. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  59469. }
  59470. function hash(str) {
  59471. var hash = 5381;
  59472. var i = str.length;
  59473. while(i) {
  59474. hash = (hash * 33) ^ str.charCodeAt(--i);
  59475. }
  59476. return hash >>> 0
  59477. }
  59478. function containsSlotChild (el) {
  59479. if (el.type === 1) {
  59480. if (el.tag === 'slot') {
  59481. return true
  59482. }
  59483. return el.children.some(containsSlotChild)
  59484. }
  59485. return false
  59486. }
  59487. function genScopedSlot (
  59488. el,
  59489. state
  59490. ) {
  59491. var isLegacySyntax = el.attrsMap['slot-scope'];
  59492. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  59493. return genIf(el, state, genScopedSlot, "null")
  59494. }
  59495. if (el.for && !el.forProcessed) {
  59496. return genFor(el, state, genScopedSlot)
  59497. }
  59498. var slotScope = el.slotScope === emptySlotScopeToken
  59499. ? ""
  59500. : String(el.slotScope);
  59501. var fn = "function(" + slotScope + "){" +
  59502. "return " + (el.tag === 'template'
  59503. ? el.if && isLegacySyntax
  59504. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  59505. : genChildren(el, state) || 'undefined'
  59506. : genElement(el, state)) + "}";
  59507. // reverse proxy v-slot without scope on this.$slots
  59508. var reverseProxy = slotScope ? "" : ",proxy:true";
  59509. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  59510. }
  59511. function genChildren (
  59512. el,
  59513. state,
  59514. checkSkip,
  59515. altGenElement,
  59516. altGenNode
  59517. ) {
  59518. var children = el.children;
  59519. if (children.length) {
  59520. var el$1 = children[0];
  59521. // optimize single v-for
  59522. if (children.length === 1 &&
  59523. el$1.for &&
  59524. el$1.tag !== 'template' &&
  59525. el$1.tag !== 'slot'
  59526. ) {
  59527. var normalizationType = checkSkip
  59528. ? state.maybeComponent(el$1) ? ",1" : ",0"
  59529. : "";
  59530. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  59531. }
  59532. var normalizationType$1 = checkSkip
  59533. ? getNormalizationType(children, state.maybeComponent)
  59534. : 0;
  59535. var gen = altGenNode || genNode;
  59536. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  59537. }
  59538. }
  59539. // determine the normalization needed for the children array.
  59540. // 0: no normalization needed
  59541. // 1: simple normalization needed (possible 1-level deep nested array)
  59542. // 2: full normalization needed
  59543. function getNormalizationType (
  59544. children,
  59545. maybeComponent
  59546. ) {
  59547. var res = 0;
  59548. for (var i = 0; i < children.length; i++) {
  59549. var el = children[i];
  59550. if (el.type !== 1) {
  59551. continue
  59552. }
  59553. if (needsNormalization(el) ||
  59554. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  59555. res = 2;
  59556. break
  59557. }
  59558. if (maybeComponent(el) ||
  59559. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  59560. res = 1;
  59561. }
  59562. }
  59563. return res
  59564. }
  59565. function needsNormalization (el) {
  59566. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  59567. }
  59568. function genNode (node, state) {
  59569. if (node.type === 1) {
  59570. return genElement(node, state)
  59571. } else if (node.type === 3 && node.isComment) {
  59572. return genComment(node)
  59573. } else {
  59574. return genText(node)
  59575. }
  59576. }
  59577. function genText (text) {
  59578. return ("_v(" + (text.type === 2
  59579. ? text.expression // no need for () because already wrapped in _s()
  59580. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  59581. }
  59582. function genComment (comment) {
  59583. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  59584. }
  59585. function genSlot (el, state) {
  59586. var slotName = el.slotName || '"default"';
  59587. var children = genChildren(el, state);
  59588. var res = "_t(" + slotName + (children ? ("," + children) : '');
  59589. var attrs = el.attrs || el.dynamicAttrs
  59590. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  59591. // slot props are camelized
  59592. name: camelize(attr.name),
  59593. value: attr.value,
  59594. dynamic: attr.dynamic
  59595. }); }))
  59596. : null;
  59597. var bind$$1 = el.attrsMap['v-bind'];
  59598. if ((attrs || bind$$1) && !children) {
  59599. res += ",null";
  59600. }
  59601. if (attrs) {
  59602. res += "," + attrs;
  59603. }
  59604. if (bind$$1) {
  59605. res += (attrs ? '' : ',null') + "," + bind$$1;
  59606. }
  59607. return res + ')'
  59608. }
  59609. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  59610. function genComponent (
  59611. componentName,
  59612. el,
  59613. state
  59614. ) {
  59615. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  59616. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  59617. }
  59618. function genProps (props) {
  59619. var staticProps = "";
  59620. var dynamicProps = "";
  59621. for (var i = 0; i < props.length; i++) {
  59622. var prop = props[i];
  59623. var value = transformSpecialNewlines(prop.value);
  59624. if (prop.dynamic) {
  59625. dynamicProps += (prop.name) + "," + value + ",";
  59626. } else {
  59627. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  59628. }
  59629. }
  59630. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  59631. if (dynamicProps) {
  59632. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  59633. } else {
  59634. return staticProps
  59635. }
  59636. }
  59637. // #3895, #4268
  59638. function transformSpecialNewlines (text) {
  59639. return text
  59640. .replace(/\u2028/g, '\\u2028')
  59641. .replace(/\u2029/g, '\\u2029')
  59642. }
  59643. /* */
  59644. // these keywords should not appear inside expressions, but operators like
  59645. // typeof, instanceof and in are allowed
  59646. var prohibitedKeywordRE = new RegExp('\\b' + (
  59647. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  59648. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  59649. 'extends,finally,continue,debugger,function,arguments'
  59650. ).split(',').join('\\b|\\b') + '\\b');
  59651. // these unary operators should not be used as property/method names
  59652. var unaryOperatorsRE = new RegExp('\\b' + (
  59653. 'delete,typeof,void'
  59654. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  59655. // strip strings in expressions
  59656. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  59657. // detect problematic expressions in a template
  59658. function detectErrors (ast, warn) {
  59659. if (ast) {
  59660. checkNode(ast, warn);
  59661. }
  59662. }
  59663. function checkNode (node, warn) {
  59664. if (node.type === 1) {
  59665. for (var name in node.attrsMap) {
  59666. if (dirRE.test(name)) {
  59667. var value = node.attrsMap[name];
  59668. if (value) {
  59669. var range = node.rawAttrsMap[name];
  59670. if (name === 'v-for') {
  59671. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  59672. } else if (name === 'v-slot' || name[0] === '#') {
  59673. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  59674. } else if (onRE.test(name)) {
  59675. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  59676. } else {
  59677. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  59678. }
  59679. }
  59680. }
  59681. }
  59682. if (node.children) {
  59683. for (var i = 0; i < node.children.length; i++) {
  59684. checkNode(node.children[i], warn);
  59685. }
  59686. }
  59687. } else if (node.type === 2) {
  59688. checkExpression(node.expression, node.text, warn, node);
  59689. }
  59690. }
  59691. function checkEvent (exp, text, warn, range) {
  59692. var stripped = exp.replace(stripStringRE, '');
  59693. var keywordMatch = stripped.match(unaryOperatorsRE);
  59694. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  59695. warn(
  59696. "avoid using JavaScript unary operator as property name: " +
  59697. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  59698. range
  59699. );
  59700. }
  59701. checkExpression(exp, text, warn, range);
  59702. }
  59703. function checkFor (node, text, warn, range) {
  59704. checkExpression(node.for || '', text, warn, range);
  59705. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  59706. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  59707. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  59708. }
  59709. function checkIdentifier (
  59710. ident,
  59711. type,
  59712. text,
  59713. warn,
  59714. range
  59715. ) {
  59716. if (typeof ident === 'string') {
  59717. try {
  59718. new Function(("var " + ident + "=_"));
  59719. } catch (e) {
  59720. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  59721. }
  59722. }
  59723. }
  59724. function checkExpression (exp, text, warn, range) {
  59725. try {
  59726. new Function(("return " + exp));
  59727. } catch (e) {
  59728. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  59729. if (keywordMatch) {
  59730. warn(
  59731. "avoid using JavaScript keyword as property name: " +
  59732. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  59733. range
  59734. );
  59735. } else {
  59736. warn(
  59737. "invalid expression: " + (e.message) + " in\n\n" +
  59738. " " + exp + "\n\n" +
  59739. " Raw expression: " + (text.trim()) + "\n",
  59740. range
  59741. );
  59742. }
  59743. }
  59744. }
  59745. function checkFunctionParameterExpression (exp, text, warn, range) {
  59746. try {
  59747. new Function(exp, '');
  59748. } catch (e) {
  59749. warn(
  59750. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  59751. " " + exp + "\n\n" +
  59752. " Raw expression: " + (text.trim()) + "\n",
  59753. range
  59754. );
  59755. }
  59756. }
  59757. /* */
  59758. var range = 2;
  59759. function generateCodeFrame (
  59760. source,
  59761. start,
  59762. end
  59763. ) {
  59764. if ( start === void 0 ) start = 0;
  59765. if ( end === void 0 ) end = source.length;
  59766. var lines = source.split(/\r?\n/);
  59767. var count = 0;
  59768. var res = [];
  59769. for (var i = 0; i < lines.length; i++) {
  59770. count += lines[i].length + 1;
  59771. if (count >= start) {
  59772. for (var j = i - range; j <= i + range || end > count; j++) {
  59773. if (j < 0 || j >= lines.length) { continue }
  59774. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  59775. var lineLength = lines[j].length;
  59776. if (j === i) {
  59777. // push underline
  59778. var pad = start - (count - lineLength) + 1;
  59779. var length = end > count ? lineLength - pad : end - start;
  59780. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  59781. } else if (j > i) {
  59782. if (end > count) {
  59783. var length$1 = Math.min(end - count, lineLength);
  59784. res.push(" | " + repeat$1("^", length$1));
  59785. }
  59786. count += lineLength + 1;
  59787. }
  59788. }
  59789. break
  59790. }
  59791. }
  59792. return res.join('\n')
  59793. }
  59794. function repeat$1 (str, n) {
  59795. var result = '';
  59796. if (n > 0) {
  59797. while (true) { // eslint-disable-line
  59798. if (n & 1) { result += str; }
  59799. n >>>= 1;
  59800. if (n <= 0) { break }
  59801. str += str;
  59802. }
  59803. }
  59804. return result
  59805. }
  59806. /* */
  59807. function createFunction (code, errors) {
  59808. try {
  59809. return new Function(code)
  59810. } catch (err) {
  59811. errors.push({ err: err, code: code });
  59812. return noop
  59813. }
  59814. }
  59815. function createCompileToFunctionFn (compile) {
  59816. var cache = Object.create(null);
  59817. return function compileToFunctions (
  59818. template,
  59819. options,
  59820. vm
  59821. ) {
  59822. options = extend({}, options);
  59823. var warn$$1 = options.warn || warn;
  59824. delete options.warn;
  59825. /* istanbul ignore if */
  59826. {
  59827. // detect possible CSP restriction
  59828. try {
  59829. new Function('return 1');
  59830. } catch (e) {
  59831. if (e.toString().match(/unsafe-eval|CSP/)) {
  59832. warn$$1(
  59833. 'It seems you are using the standalone build of Vue.js in an ' +
  59834. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  59835. 'The template compiler cannot work in this environment. Consider ' +
  59836. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  59837. 'templates into render functions.'
  59838. );
  59839. }
  59840. }
  59841. }
  59842. // check cache
  59843. var key = options.delimiters
  59844. ? String(options.delimiters) + template
  59845. : template;
  59846. if (cache[key]) {
  59847. return cache[key]
  59848. }
  59849. // compile
  59850. var compiled = compile(template, options);
  59851. // check compilation errors/tips
  59852. {
  59853. if (compiled.errors && compiled.errors.length) {
  59854. if (options.outputSourceRange) {
  59855. compiled.errors.forEach(function (e) {
  59856. warn$$1(
  59857. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  59858. generateCodeFrame(template, e.start, e.end),
  59859. vm
  59860. );
  59861. });
  59862. } else {
  59863. warn$$1(
  59864. "Error compiling template:\n\n" + template + "\n\n" +
  59865. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  59866. vm
  59867. );
  59868. }
  59869. }
  59870. if (compiled.tips && compiled.tips.length) {
  59871. if (options.outputSourceRange) {
  59872. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  59873. } else {
  59874. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  59875. }
  59876. }
  59877. }
  59878. // turn code into functions
  59879. var res = {};
  59880. var fnGenErrors = [];
  59881. res.render = createFunction(compiled.render, fnGenErrors);
  59882. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  59883. return createFunction(code, fnGenErrors)
  59884. });
  59885. // check function generation errors.
  59886. // this should only happen if there is a bug in the compiler itself.
  59887. // mostly for codegen development use
  59888. /* istanbul ignore if */
  59889. {
  59890. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  59891. warn$$1(
  59892. "Failed to generate render function:\n\n" +
  59893. fnGenErrors.map(function (ref) {
  59894. var err = ref.err;
  59895. var code = ref.code;
  59896. return ((err.toString()) + " in\n\n" + code + "\n");
  59897. }).join('\n'),
  59898. vm
  59899. );
  59900. }
  59901. }
  59902. return (cache[key] = res)
  59903. }
  59904. }
  59905. /* */
  59906. function createCompilerCreator (baseCompile) {
  59907. return function createCompiler (baseOptions) {
  59908. function compile (
  59909. template,
  59910. options
  59911. ) {
  59912. var finalOptions = Object.create(baseOptions);
  59913. var errors = [];
  59914. var tips = [];
  59915. var warn = function (msg, range, tip) {
  59916. (tip ? tips : errors).push(msg);
  59917. };
  59918. if (options) {
  59919. if (options.outputSourceRange) {
  59920. // $flow-disable-line
  59921. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  59922. warn = function (msg, range, tip) {
  59923. var data = { msg: msg };
  59924. if (range) {
  59925. if (range.start != null) {
  59926. data.start = range.start + leadingSpaceLength;
  59927. }
  59928. if (range.end != null) {
  59929. data.end = range.end + leadingSpaceLength;
  59930. }
  59931. }
  59932. (tip ? tips : errors).push(data);
  59933. };
  59934. }
  59935. // merge custom modules
  59936. if (options.modules) {
  59937. finalOptions.modules =
  59938. (baseOptions.modules || []).concat(options.modules);
  59939. }
  59940. // merge custom directives
  59941. if (options.directives) {
  59942. finalOptions.directives = extend(
  59943. Object.create(baseOptions.directives || null),
  59944. options.directives
  59945. );
  59946. }
  59947. // copy other options
  59948. for (var key in options) {
  59949. if (key !== 'modules' && key !== 'directives') {
  59950. finalOptions[key] = options[key];
  59951. }
  59952. }
  59953. }
  59954. finalOptions.warn = warn;
  59955. var compiled = baseCompile(template.trim(), finalOptions);
  59956. {
  59957. detectErrors(compiled.ast, warn);
  59958. }
  59959. compiled.errors = errors;
  59960. compiled.tips = tips;
  59961. return compiled
  59962. }
  59963. return {
  59964. compile: compile,
  59965. compileToFunctions: createCompileToFunctionFn(compile)
  59966. }
  59967. }
  59968. }
  59969. /* */
  59970. // `createCompilerCreator` allows creating compilers that use alternative
  59971. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  59972. // Here we just export a default compiler using the default parts.
  59973. var createCompiler = createCompilerCreator(function baseCompile (
  59974. template,
  59975. options
  59976. ) {
  59977. var ast = parse(template.trim(), options);
  59978. if (options.optimize !== false) {
  59979. optimize(ast, options);
  59980. }
  59981. var code = generate(ast, options);
  59982. return {
  59983. ast: ast,
  59984. render: code.render,
  59985. staticRenderFns: code.staticRenderFns
  59986. }
  59987. });
  59988. /* */
  59989. var ref$1 = createCompiler(baseOptions);
  59990. var compile = ref$1.compile;
  59991. var compileToFunctions = ref$1.compileToFunctions;
  59992. /* */
  59993. // check whether current browser encodes a char inside attribute values
  59994. var div;
  59995. function getShouldDecode (href) {
  59996. div = div || document.createElement('div');
  59997. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  59998. return div.innerHTML.indexOf('&#10;') > 0
  59999. }
  60000. // #3663: IE encodes newlines inside attribute values while other browsers don't
  60001. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  60002. // #6828: chrome encodes content in a[href]
  60003. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  60004. /* */
  60005. var idToTemplate = cached(function (id) {
  60006. var el = query(id);
  60007. return el && el.innerHTML
  60008. });
  60009. var mount = Vue.prototype.$mount;
  60010. Vue.prototype.$mount = function (
  60011. el,
  60012. hydrating
  60013. ) {
  60014. el = el && query(el);
  60015. /* istanbul ignore if */
  60016. if (el === document.body || el === document.documentElement) {
  60017. warn(
  60018. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  60019. );
  60020. return this
  60021. }
  60022. var options = this.$options;
  60023. // resolve template/el and convert to render function
  60024. if (!options.render) {
  60025. var template = options.template;
  60026. if (template) {
  60027. if (typeof template === 'string') {
  60028. if (template.charAt(0) === '#') {
  60029. template = idToTemplate(template);
  60030. /* istanbul ignore if */
  60031. if (!template) {
  60032. warn(
  60033. ("Template element not found or is empty: " + (options.template)),
  60034. this
  60035. );
  60036. }
  60037. }
  60038. } else if (template.nodeType) {
  60039. template = template.innerHTML;
  60040. } else {
  60041. {
  60042. warn('invalid template option:' + template, this);
  60043. }
  60044. return this
  60045. }
  60046. } else if (el) {
  60047. template = getOuterHTML(el);
  60048. }
  60049. if (template) {
  60050. /* istanbul ignore if */
  60051. if (config.performance && mark) {
  60052. mark('compile');
  60053. }
  60054. var ref = compileToFunctions(template, {
  60055. outputSourceRange: "development" !== 'production',
  60056. shouldDecodeNewlines: shouldDecodeNewlines,
  60057. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  60058. delimiters: options.delimiters,
  60059. comments: options.comments
  60060. }, this);
  60061. var render = ref.render;
  60062. var staticRenderFns = ref.staticRenderFns;
  60063. options.render = render;
  60064. options.staticRenderFns = staticRenderFns;
  60065. /* istanbul ignore if */
  60066. if (config.performance && mark) {
  60067. mark('compile end');
  60068. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  60069. }
  60070. }
  60071. }
  60072. return mount.call(this, el, hydrating)
  60073. };
  60074. /**
  60075. * Get outerHTML of elements, taking care
  60076. * of SVG elements in IE as well.
  60077. */
  60078. function getOuterHTML (el) {
  60079. if (el.outerHTML) {
  60080. return el.outerHTML
  60081. } else {
  60082. var container = document.createElement('div');
  60083. container.appendChild(el.cloneNode(true));
  60084. return container.innerHTML
  60085. }
  60086. }
  60087. Vue.compile = compileToFunctions;
  60088. module.exports = Vue;
  60089. /* 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))
  60090. /***/ }),
  60091. /***/ "./node_modules/vue/dist/vue.common.js":
  60092. /*!*********************************************!*\
  60093. !*** ./node_modules/vue/dist/vue.common.js ***!
  60094. \*********************************************/
  60095. /*! no static exports found */
  60096. /***/ (function(module, exports, __webpack_require__) {
  60097. if (false) {} else {
  60098. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  60099. }
  60100. /***/ }),
  60101. /***/ "./node_modules/webpack/buildin/global.js":
  60102. /*!***********************************!*\
  60103. !*** (webpack)/buildin/global.js ***!
  60104. \***********************************/
  60105. /*! no static exports found */
  60106. /***/ (function(module, exports) {
  60107. var g;
  60108. // This works in non-strict mode
  60109. g = (function() {
  60110. return this;
  60111. })();
  60112. try {
  60113. // This works if eval is allowed (see CSP)
  60114. g = g || new Function("return this")();
  60115. } catch (e) {
  60116. // This works if the window reference is available
  60117. if (typeof window === "object") g = window;
  60118. }
  60119. // g can still be undefined, but nothing to do about it...
  60120. // We return undefined, instead of nothing here, so it's
  60121. // easier to handle this case. if(!global) { ...}
  60122. module.exports = g;
  60123. /***/ }),
  60124. /***/ "./node_modules/webpack/buildin/module.js":
  60125. /*!***********************************!*\
  60126. !*** (webpack)/buildin/module.js ***!
  60127. \***********************************/
  60128. /*! no static exports found */
  60129. /***/ (function(module, exports) {
  60130. module.exports = function(module) {
  60131. if (!module.webpackPolyfill) {
  60132. module.deprecate = function() {};
  60133. module.paths = [];
  60134. // module.parent = undefined by default
  60135. if (!module.children) module.children = [];
  60136. Object.defineProperty(module, "loaded", {
  60137. enumerable: true,
  60138. get: function() {
  60139. return module.l;
  60140. }
  60141. });
  60142. Object.defineProperty(module, "id", {
  60143. enumerable: true,
  60144. get: function() {
  60145. return module.i;
  60146. }
  60147. });
  60148. module.webpackPolyfill = 1;
  60149. }
  60150. return module;
  60151. };
  60152. /***/ }),
  60153. /***/ "./resources/js/app.js":
  60154. /*!*****************************!*\
  60155. !*** ./resources/js/app.js ***!
  60156. \*****************************/
  60157. /*! no exports provided */
  60158. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60159. "use strict";
  60160. __webpack_require__.r(__webpack_exports__);
  60161. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  60162. /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
  60163. /* harmony import */ var vue_router__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-router */ "./node_modules/vue-router/dist/vue-router.esm.js");
  60164. /* harmony import */ var _views_App__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./views/App */ "./resources/js/views/App.vue");
  60165. /* harmony import */ var _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./views/Dashboard */ "./resources/js/views/Dashboard.vue");
  60166. /* harmony import */ var _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./views/WorkOrder */ "./resources/js/views/WorkOrder.vue");
  60167. /* harmony import */ var _views_Login__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./views/Login */ "./resources/js/views/Login.vue");
  60168. /* harmony import */ var _views_Welcome__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./views/Welcome */ "./resources/js/views/Welcome.vue");
  60169. /**
  60170. * First we will load all of this project's JavaScript dependencies which
  60171. * includes Vue and other libraries. It is a great starting point when
  60172. * building robust, powerful web applications using Vue and Laravel.
  60173. */
  60174. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  60175. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  60176. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  60177. vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]);
  60178. var router = new vue_router__WEBPACK_IMPORTED_MODULE_1__["default"]({
  60179. mode: 'history',
  60180. routes: [{
  60181. path: '/',
  60182. name: 'home',
  60183. component: _views_Welcome__WEBPACK_IMPORTED_MODULE_6__["default"]
  60184. }, {
  60185. path: '/login',
  60186. name: 'login',
  60187. component: _views_Login__WEBPACK_IMPORTED_MODULE_5__["default"]
  60188. }, {
  60189. path: '/dashboard',
  60190. name: 'dashboard',
  60191. component: _views_Dashboard__WEBPACK_IMPORTED_MODULE_3__["default"]
  60192. }, {
  60193. path: '/workorders/:id',
  60194. name: 'workorders',
  60195. component: _views_WorkOrder__WEBPACK_IMPORTED_MODULE_4__["default"],
  60196. props: true
  60197. }]
  60198. });
  60199. var app = new vue__WEBPACK_IMPORTED_MODULE_0___default.a({
  60200. el: '#app',
  60201. components: {
  60202. App: _views_App__WEBPACK_IMPORTED_MODULE_2__["default"]
  60203. },
  60204. router: router
  60205. });
  60206. $(function () {
  60207. $('[data-toggle="tooltip"]').tooltip();
  60208. });
  60209. var clipboard = new Clipboard('.btn-clip');
  60210. clipboard.on('success', function (e) {
  60211. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  60212. position: "right",
  60213. className: 'success'
  60214. });
  60215. e.clearSelection();
  60216. });
  60217. /***/ }),
  60218. /***/ "./resources/js/bootstrap.js":
  60219. /*!***********************************!*\
  60220. !*** ./resources/js/bootstrap.js ***!
  60221. \***********************************/
  60222. /*! no exports provided */
  60223. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60224. "use strict";
  60225. __webpack_require__.r(__webpack_exports__);
  60226. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  60227. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  60228. /**
  60229. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  60230. * for JavaScript based Bootstrap features such as modals and tabs. This
  60231. * code may be modified to fit the specific needs of your application.
  60232. */
  60233. try {
  60234. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  60235. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  60236. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  60237. } catch (e) {}
  60238. /**
  60239. * We'll load the axios HTTP library which allows us to easily issue requests
  60240. * to our Laravel back-end. This library automatically handles sending the
  60241. * CSRF token as a header based on the value of the "XSRF" token cookie.
  60242. */
  60243. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  60244. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  60245. /**
  60246. * Echo exposes an expressive API for subscribing to channels and listening
  60247. * for events that are broadcast by Laravel. Echo and event broadcasting
  60248. * allows your team to easily build robust real-time web applications.
  60249. */
  60250. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  60251. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  60252. broadcaster: 'pusher',
  60253. key: "upccrt",
  60254. wsHost: window.location.hostname,
  60255. wsPort: 6001,
  60256. disableStats: true
  60257. });
  60258. /***/ }),
  60259. /***/ "./resources/js/components/AssetInfo.vue":
  60260. /*!***********************************************!*\
  60261. !*** ./resources/js/components/AssetInfo.vue ***!
  60262. \***********************************************/
  60263. /*! exports provided: default */
  60264. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60265. "use strict";
  60266. __webpack_require__.r(__webpack_exports__);
  60267. /* 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&");
  60268. /* 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&");
  60269. /* 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");
  60270. /* normalize component */
  60271. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60272. _AssetInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60273. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["render"],
  60274. _AssetInfo_vue_vue_type_template_id_f949323a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60275. false,
  60276. null,
  60277. null,
  60278. null
  60279. )
  60280. /* hot reload */
  60281. if (false) { var api; }
  60282. component.options.__file = "resources/js/components/AssetInfo.vue"
  60283. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60284. /***/ }),
  60285. /***/ "./resources/js/components/AssetInfo.vue?vue&type=script&lang=js&":
  60286. /*!************************************************************************!*\
  60287. !*** ./resources/js/components/AssetInfo.vue?vue&type=script&lang=js& ***!
  60288. \************************************************************************/
  60289. /*! exports provided: default */
  60290. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60291. "use strict";
  60292. __webpack_require__.r(__webpack_exports__);
  60293. /* 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&");
  60294. /* 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"]);
  60295. /***/ }),
  60296. /***/ "./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a&":
  60297. /*!******************************************************************************!*\
  60298. !*** ./resources/js/components/AssetInfo.vue?vue&type=template&id=f949323a& ***!
  60299. \******************************************************************************/
  60300. /*! exports provided: render, staticRenderFns */
  60301. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60302. "use strict";
  60303. __webpack_require__.r(__webpack_exports__);
  60304. /* 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&");
  60305. /* 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"]; });
  60306. /* 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"]; });
  60307. /***/ }),
  60308. /***/ "./resources/js/components/AssetInfoEditModal.vue":
  60309. /*!********************************************************!*\
  60310. !*** ./resources/js/components/AssetInfoEditModal.vue ***!
  60311. \********************************************************/
  60312. /*! exports provided: default */
  60313. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60314. "use strict";
  60315. __webpack_require__.r(__webpack_exports__);
  60316. /* 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&");
  60317. /* 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&");
  60318. /* 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");
  60319. /* normalize component */
  60320. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60321. _AssetInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60322. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["render"],
  60323. _AssetInfoEditModal_vue_vue_type_template_id_24c98bd0___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60324. false,
  60325. null,
  60326. null,
  60327. null
  60328. )
  60329. /* hot reload */
  60330. if (false) { var api; }
  60331. component.options.__file = "resources/js/components/AssetInfoEditModal.vue"
  60332. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60333. /***/ }),
  60334. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js&":
  60335. /*!*********************************************************************************!*\
  60336. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=script&lang=js& ***!
  60337. \*********************************************************************************/
  60338. /*! exports provided: default */
  60339. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60340. "use strict";
  60341. __webpack_require__.r(__webpack_exports__);
  60342. /* 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&");
  60343. /* 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"]);
  60344. /***/ }),
  60345. /***/ "./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0&":
  60346. /*!***************************************************************************************!*\
  60347. !*** ./resources/js/components/AssetInfoEditModal.vue?vue&type=template&id=24c98bd0& ***!
  60348. \***************************************************************************************/
  60349. /*! exports provided: render, staticRenderFns */
  60350. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60351. "use strict";
  60352. __webpack_require__.r(__webpack_exports__);
  60353. /* 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&");
  60354. /* 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"]; });
  60355. /* 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"]; });
  60356. /***/ }),
  60357. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue":
  60358. /*!****************************************************************!*\
  60359. !*** ./resources/js/components/AutocompleteCustomDropdown.vue ***!
  60360. \****************************************************************/
  60361. /*! exports provided: default */
  60362. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60363. "use strict";
  60364. __webpack_require__.r(__webpack_exports__);
  60365. /* 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&");
  60366. /* 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&");
  60367. /* 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");
  60368. /* normalize component */
  60369. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60370. _AutocompleteCustomDropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60371. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["render"],
  60372. _AutocompleteCustomDropdown_vue_vue_type_template_id_5fcc8b56___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60373. false,
  60374. null,
  60375. null,
  60376. null
  60377. )
  60378. /* hot reload */
  60379. if (false) { var api; }
  60380. component.options.__file = "resources/js/components/AutocompleteCustomDropdown.vue"
  60381. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60382. /***/ }),
  60383. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js&":
  60384. /*!*****************************************************************************************!*\
  60385. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=script&lang=js& ***!
  60386. \*****************************************************************************************/
  60387. /*! exports provided: default */
  60388. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60389. "use strict";
  60390. __webpack_require__.r(__webpack_exports__);
  60391. /* 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&");
  60392. /* 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"]);
  60393. /***/ }),
  60394. /***/ "./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56&":
  60395. /*!***********************************************************************************************!*\
  60396. !*** ./resources/js/components/AutocompleteCustomDropdown.vue?vue&type=template&id=5fcc8b56& ***!
  60397. \***********************************************************************************************/
  60398. /*! exports provided: render, staticRenderFns */
  60399. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60400. "use strict";
  60401. __webpack_require__.r(__webpack_exports__);
  60402. /* 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&");
  60403. /* 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"]; });
  60404. /* 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"]; });
  60405. /***/ }),
  60406. /***/ "./resources/js/components/CircleSpinner.vue":
  60407. /*!***************************************************!*\
  60408. !*** ./resources/js/components/CircleSpinner.vue ***!
  60409. \***************************************************/
  60410. /*! exports provided: default */
  60411. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60412. "use strict";
  60413. __webpack_require__.r(__webpack_exports__);
  60414. /* 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&");
  60415. /* 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&");
  60416. /* 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&");
  60417. /* 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");
  60418. /* normalize component */
  60419. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  60420. _CircleSpinner_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60421. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  60422. _CircleSpinner_vue_vue_type_template_id_9a543b64_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60423. false,
  60424. null,
  60425. "9a543b64",
  60426. null
  60427. )
  60428. /* hot reload */
  60429. if (false) { var api; }
  60430. component.options.__file = "resources/js/components/CircleSpinner.vue"
  60431. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60432. /***/ }),
  60433. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js&":
  60434. /*!****************************************************************************!*\
  60435. !*** ./resources/js/components/CircleSpinner.vue?vue&type=script&lang=js& ***!
  60436. \****************************************************************************/
  60437. /*! exports provided: default */
  60438. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60439. "use strict";
  60440. __webpack_require__.r(__webpack_exports__);
  60441. /* 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&");
  60442. /* 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"]);
  60443. /***/ }),
  60444. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css&":
  60445. /*!************************************************************************************************************!*\
  60446. !*** ./resources/js/components/CircleSpinner.vue?vue&type=style&index=0&id=9a543b64&scoped=true&lang=css& ***!
  60447. \************************************************************************************************************/
  60448. /*! no static exports found */
  60449. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60450. "use strict";
  60451. __webpack_require__.r(__webpack_exports__);
  60452. /* 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&");
  60453. /* 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__);
  60454. /* 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__));
  60455. /* 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);
  60456. /***/ }),
  60457. /***/ "./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true&":
  60458. /*!**********************************************************************************************!*\
  60459. !*** ./resources/js/components/CircleSpinner.vue?vue&type=template&id=9a543b64&scoped=true& ***!
  60460. \**********************************************************************************************/
  60461. /*! exports provided: render, staticRenderFns */
  60462. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60463. "use strict";
  60464. __webpack_require__.r(__webpack_exports__);
  60465. /* 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&");
  60466. /* 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"]; });
  60467. /* 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"]; });
  60468. /***/ }),
  60469. /***/ "./resources/js/components/Credential.vue":
  60470. /*!************************************************!*\
  60471. !*** ./resources/js/components/Credential.vue ***!
  60472. \************************************************/
  60473. /*! exports provided: default */
  60474. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60475. "use strict";
  60476. __webpack_require__.r(__webpack_exports__);
  60477. /* 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&");
  60478. /* 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&");
  60479. /* 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");
  60480. /* normalize component */
  60481. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60482. _Credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60483. _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["render"],
  60484. _Credential_vue_vue_type_template_id_58b8dcfc___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60485. false,
  60486. null,
  60487. null,
  60488. null
  60489. )
  60490. /* hot reload */
  60491. if (false) { var api; }
  60492. component.options.__file = "resources/js/components/Credential.vue"
  60493. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60494. /***/ }),
  60495. /***/ "./resources/js/components/Credential.vue?vue&type=script&lang=js&":
  60496. /*!*************************************************************************!*\
  60497. !*** ./resources/js/components/Credential.vue?vue&type=script&lang=js& ***!
  60498. \*************************************************************************/
  60499. /*! exports provided: default */
  60500. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60501. "use strict";
  60502. __webpack_require__.r(__webpack_exports__);
  60503. /* 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&");
  60504. /* 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"]);
  60505. /***/ }),
  60506. /***/ "./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc&":
  60507. /*!*******************************************************************************!*\
  60508. !*** ./resources/js/components/Credential.vue?vue&type=template&id=58b8dcfc& ***!
  60509. \*******************************************************************************/
  60510. /*! exports provided: render, staticRenderFns */
  60511. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60512. "use strict";
  60513. __webpack_require__.r(__webpack_exports__);
  60514. /* 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&");
  60515. /* 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"]; });
  60516. /* 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"]; });
  60517. /***/ }),
  60518. /***/ "./resources/js/components/CredentialFormModal.vue":
  60519. /*!*********************************************************!*\
  60520. !*** ./resources/js/components/CredentialFormModal.vue ***!
  60521. \*********************************************************/
  60522. /*! exports provided: default */
  60523. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60524. "use strict";
  60525. __webpack_require__.r(__webpack_exports__);
  60526. /* 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&");
  60527. /* 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&");
  60528. /* 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");
  60529. /* normalize component */
  60530. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60531. _CredentialFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60532. _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["render"],
  60533. _CredentialFormModal_vue_vue_type_template_id_3cdb3697___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60534. false,
  60535. null,
  60536. null,
  60537. null
  60538. )
  60539. /* hot reload */
  60540. if (false) { var api; }
  60541. component.options.__file = "resources/js/components/CredentialFormModal.vue"
  60542. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60543. /***/ }),
  60544. /***/ "./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js&":
  60545. /*!**********************************************************************************!*\
  60546. !*** ./resources/js/components/CredentialFormModal.vue?vue&type=script&lang=js& ***!
  60547. \**********************************************************************************/
  60548. /*! exports provided: default */
  60549. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60550. "use strict";
  60551. __webpack_require__.r(__webpack_exports__);
  60552. /* 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&");
  60553. /* 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"]);
  60554. /***/ }),
  60555. /***/ "./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697&":
  60556. /*!****************************************************************************************!*\
  60557. !*** ./resources/js/components/CredentialFormModal.vue?vue&type=template&id=3cdb3697& ***!
  60558. \****************************************************************************************/
  60559. /*! exports provided: render, staticRenderFns */
  60560. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60561. "use strict";
  60562. __webpack_require__.r(__webpack_exports__);
  60563. /* 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&");
  60564. /* 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"]; });
  60565. /* 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"]; });
  60566. /***/ }),
  60567. /***/ "./resources/js/components/CredentialList.vue":
  60568. /*!****************************************************!*\
  60569. !*** ./resources/js/components/CredentialList.vue ***!
  60570. \****************************************************/
  60571. /*! exports provided: default */
  60572. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60573. "use strict";
  60574. __webpack_require__.r(__webpack_exports__);
  60575. /* 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&");
  60576. /* 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&");
  60577. /* 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");
  60578. /* normalize component */
  60579. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60580. _CredentialList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60581. _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["render"],
  60582. _CredentialList_vue_vue_type_template_id_7264bb80___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60583. false,
  60584. null,
  60585. null,
  60586. null
  60587. )
  60588. /* hot reload */
  60589. if (false) { var api; }
  60590. component.options.__file = "resources/js/components/CredentialList.vue"
  60591. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60592. /***/ }),
  60593. /***/ "./resources/js/components/CredentialList.vue?vue&type=script&lang=js&":
  60594. /*!*****************************************************************************!*\
  60595. !*** ./resources/js/components/CredentialList.vue?vue&type=script&lang=js& ***!
  60596. \*****************************************************************************/
  60597. /*! exports provided: default */
  60598. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60599. "use strict";
  60600. __webpack_require__.r(__webpack_exports__);
  60601. /* 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&");
  60602. /* 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"]);
  60603. /***/ }),
  60604. /***/ "./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80&":
  60605. /*!***********************************************************************************!*\
  60606. !*** ./resources/js/components/CredentialList.vue?vue&type=template&id=7264bb80& ***!
  60607. \***********************************************************************************/
  60608. /*! exports provided: render, staticRenderFns */
  60609. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60610. "use strict";
  60611. __webpack_require__.r(__webpack_exports__);
  60612. /* 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&");
  60613. /* 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"]; });
  60614. /* 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"]; });
  60615. /***/ }),
  60616. /***/ "./resources/js/components/ErrorList.vue":
  60617. /*!***********************************************!*\
  60618. !*** ./resources/js/components/ErrorList.vue ***!
  60619. \***********************************************/
  60620. /*! exports provided: default */
  60621. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60622. "use strict";
  60623. __webpack_require__.r(__webpack_exports__);
  60624. /* 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&");
  60625. /* 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&");
  60626. /* 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");
  60627. /* normalize component */
  60628. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60629. _ErrorList_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60630. _ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  60631. _ErrorList_vue_vue_type_template_id_48c089eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60632. false,
  60633. null,
  60634. null,
  60635. null
  60636. )
  60637. /* hot reload */
  60638. if (false) { var api; }
  60639. component.options.__file = "resources/js/components/ErrorList.vue"
  60640. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60641. /***/ }),
  60642. /***/ "./resources/js/components/ErrorList.vue?vue&type=script&lang=js&":
  60643. /*!************************************************************************!*\
  60644. !*** ./resources/js/components/ErrorList.vue?vue&type=script&lang=js& ***!
  60645. \************************************************************************/
  60646. /*! exports provided: default */
  60647. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60648. "use strict";
  60649. __webpack_require__.r(__webpack_exports__);
  60650. /* 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&");
  60651. /* 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"]);
  60652. /***/ }),
  60653. /***/ "./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb&":
  60654. /*!******************************************************************************!*\
  60655. !*** ./resources/js/components/ErrorList.vue?vue&type=template&id=48c089eb& ***!
  60656. \******************************************************************************/
  60657. /*! exports provided: render, staticRenderFns */
  60658. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60659. "use strict";
  60660. __webpack_require__.r(__webpack_exports__);
  60661. /* 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&");
  60662. /* 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"]; });
  60663. /* 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"]; });
  60664. /***/ }),
  60665. /***/ "./resources/js/components/Modal.vue":
  60666. /*!*******************************************!*\
  60667. !*** ./resources/js/components/Modal.vue ***!
  60668. \*******************************************/
  60669. /*! exports provided: default */
  60670. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60671. "use strict";
  60672. __webpack_require__.r(__webpack_exports__);
  60673. /* 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&");
  60674. /* 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");
  60675. var script = {}
  60676. /* normalize component */
  60677. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  60678. script,
  60679. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["render"],
  60680. _Modal_vue_vue_type_template_id_53ab54d2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60681. false,
  60682. null,
  60683. null,
  60684. null
  60685. )
  60686. /* hot reload */
  60687. if (false) { var api; }
  60688. component.options.__file = "resources/js/components/Modal.vue"
  60689. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60690. /***/ }),
  60691. /***/ "./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2&":
  60692. /*!**************************************************************************!*\
  60693. !*** ./resources/js/components/Modal.vue?vue&type=template&id=53ab54d2& ***!
  60694. \**************************************************************************/
  60695. /*! exports provided: render, staticRenderFns */
  60696. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60697. "use strict";
  60698. __webpack_require__.r(__webpack_exports__);
  60699. /* 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&");
  60700. /* 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"]; });
  60701. /* 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"]; });
  60702. /***/ }),
  60703. /***/ "./resources/js/components/NoteFormModal.vue":
  60704. /*!***************************************************!*\
  60705. !*** ./resources/js/components/NoteFormModal.vue ***!
  60706. \***************************************************/
  60707. /*! exports provided: default */
  60708. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60709. "use strict";
  60710. __webpack_require__.r(__webpack_exports__);
  60711. /* harmony import */ var _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&");
  60712. /* 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&");
  60713. /* 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");
  60714. /* normalize component */
  60715. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60716. _NoteFormModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60717. _NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__["render"],
  60718. _NoteFormModal_vue_vue_type_template_id_1391a09c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60719. false,
  60720. null,
  60721. null,
  60722. null
  60723. )
  60724. /* hot reload */
  60725. if (false) { var api; }
  60726. component.options.__file = "resources/js/components/NoteFormModal.vue"
  60727. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60728. /***/ }),
  60729. /***/ "./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js&":
  60730. /*!****************************************************************************!*\
  60731. !*** ./resources/js/components/NoteFormModal.vue?vue&type=script&lang=js& ***!
  60732. \****************************************************************************/
  60733. /*! exports provided: default */
  60734. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60735. "use strict";
  60736. __webpack_require__.r(__webpack_exports__);
  60737. /* 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&");
  60738. /* 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"]);
  60739. /***/ }),
  60740. /***/ "./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c&":
  60741. /*!**********************************************************************************!*\
  60742. !*** ./resources/js/components/NoteFormModal.vue?vue&type=template&id=1391a09c& ***!
  60743. \**********************************************************************************/
  60744. /*! exports provided: render, staticRenderFns */
  60745. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60746. "use strict";
  60747. __webpack_require__.r(__webpack_exports__);
  60748. /* 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&");
  60749. /* 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"]; });
  60750. /* 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"]; });
  60751. /***/ }),
  60752. /***/ "./resources/js/components/Notes.vue":
  60753. /*!*******************************************!*\
  60754. !*** ./resources/js/components/Notes.vue ***!
  60755. \*******************************************/
  60756. /*! exports provided: default */
  60757. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60758. "use strict";
  60759. __webpack_require__.r(__webpack_exports__);
  60760. /* 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&");
  60761. /* 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&");
  60762. /* 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");
  60763. /* normalize component */
  60764. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60765. _Notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60766. _Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__["render"],
  60767. _Notes_vue_vue_type_template_id_3d897ee6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60768. false,
  60769. null,
  60770. null,
  60771. null
  60772. )
  60773. /* hot reload */
  60774. if (false) { var api; }
  60775. component.options.__file = "resources/js/components/Notes.vue"
  60776. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60777. /***/ }),
  60778. /***/ "./resources/js/components/Notes.vue?vue&type=script&lang=js&":
  60779. /*!********************************************************************!*\
  60780. !*** ./resources/js/components/Notes.vue?vue&type=script&lang=js& ***!
  60781. \********************************************************************/
  60782. /*! exports provided: default */
  60783. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60784. "use strict";
  60785. __webpack_require__.r(__webpack_exports__);
  60786. /* 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&");
  60787. /* 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"]);
  60788. /***/ }),
  60789. /***/ "./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6&":
  60790. /*!**************************************************************************!*\
  60791. !*** ./resources/js/components/Notes.vue?vue&type=template&id=3d897ee6& ***!
  60792. \**************************************************************************/
  60793. /*! exports provided: render, staticRenderFns */
  60794. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60795. "use strict";
  60796. __webpack_require__.r(__webpack_exports__);
  60797. /* 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&");
  60798. /* 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"]; });
  60799. /* 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"]; });
  60800. /***/ }),
  60801. /***/ "./resources/js/components/WoInfoEditModal.vue":
  60802. /*!*****************************************************!*\
  60803. !*** ./resources/js/components/WoInfoEditModal.vue ***!
  60804. \*****************************************************/
  60805. /*! exports provided: default */
  60806. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60807. "use strict";
  60808. __webpack_require__.r(__webpack_exports__);
  60809. /* 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&");
  60810. /* 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&");
  60811. /* 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");
  60812. /* normalize component */
  60813. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60814. _WoInfoEditModal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60815. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["render"],
  60816. _WoInfoEditModal_vue_vue_type_template_id_352dd7a2___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60817. false,
  60818. null,
  60819. null,
  60820. null
  60821. )
  60822. /* hot reload */
  60823. if (false) { var api; }
  60824. component.options.__file = "resources/js/components/WoInfoEditModal.vue"
  60825. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60826. /***/ }),
  60827. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js&":
  60828. /*!******************************************************************************!*\
  60829. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=script&lang=js& ***!
  60830. \******************************************************************************/
  60831. /*! exports provided: default */
  60832. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60833. "use strict";
  60834. __webpack_require__.r(__webpack_exports__);
  60835. /* 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&");
  60836. /* 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"]);
  60837. /***/ }),
  60838. /***/ "./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2&":
  60839. /*!************************************************************************************!*\
  60840. !*** ./resources/js/components/WoInfoEditModal.vue?vue&type=template&id=352dd7a2& ***!
  60841. \************************************************************************************/
  60842. /*! exports provided: render, staticRenderFns */
  60843. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60844. "use strict";
  60845. __webpack_require__.r(__webpack_exports__);
  60846. /* 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&");
  60847. /* 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"]; });
  60848. /* 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"]; });
  60849. /***/ }),
  60850. /***/ "./resources/js/components/WorkOrderInfo.vue":
  60851. /*!***************************************************!*\
  60852. !*** ./resources/js/components/WorkOrderInfo.vue ***!
  60853. \***************************************************/
  60854. /*! exports provided: default */
  60855. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60856. "use strict";
  60857. __webpack_require__.r(__webpack_exports__);
  60858. /* 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&");
  60859. /* 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&");
  60860. /* 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");
  60861. /* normalize component */
  60862. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  60863. _WorkOrderInfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  60864. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["render"],
  60865. _WorkOrderInfo_vue_vue_type_template_id_50116330___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  60866. false,
  60867. null,
  60868. null,
  60869. null
  60870. )
  60871. /* hot reload */
  60872. if (false) { var api; }
  60873. component.options.__file = "resources/js/components/WorkOrderInfo.vue"
  60874. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  60875. /***/ }),
  60876. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js&":
  60877. /*!****************************************************************************!*\
  60878. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=script&lang=js& ***!
  60879. \****************************************************************************/
  60880. /*! exports provided: default */
  60881. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60882. "use strict";
  60883. __webpack_require__.r(__webpack_exports__);
  60884. /* 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&");
  60885. /* 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"]);
  60886. /***/ }),
  60887. /***/ "./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330&":
  60888. /*!**********************************************************************************!*\
  60889. !*** ./resources/js/components/WorkOrderInfo.vue?vue&type=template&id=50116330& ***!
  60890. \**********************************************************************************/
  60891. /*! exports provided: render, staticRenderFns */
  60892. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60893. "use strict";
  60894. __webpack_require__.r(__webpack_exports__);
  60895. /* 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&");
  60896. /* 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"]; });
  60897. /* 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"]; });
  60898. /***/ }),
  60899. /***/ "./resources/js/mixins/dateMixin.js":
  60900. /*!******************************************!*\
  60901. !*** ./resources/js/mixins/dateMixin.js ***!
  60902. \******************************************/
  60903. /*! exports provided: default */
  60904. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60905. "use strict";
  60906. __webpack_require__.r(__webpack_exports__);
  60907. /* harmony default export */ __webpack_exports__["default"] = ({
  60908. methods: {
  60909. treatAsUTC: function treatAsUTC(date) {
  60910. var result = new Date(date);
  60911. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  60912. return result;
  60913. },
  60914. daysSinceToday: function daysSinceToday(date) {
  60915. var currentDate = new Date();
  60916. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  60917. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  60918. },
  60919. getHRDate: function getHRDate(dateString) {
  60920. var date = new Date(dateString);
  60921. return date.toLocaleString('default', {
  60922. month: 'short',
  60923. day: 'numeric',
  60924. year: 'numeric',
  60925. hour: 'numeric',
  60926. minute: 'numeric'
  60927. });
  60928. },
  60929. isZero: function isZero(dateString) {
  60930. return dateString === '0000-00-00 00:00:00';
  60931. }
  60932. }
  60933. });
  60934. /***/ }),
  60935. /***/ "./resources/js/notify.min.js":
  60936. /*!************************************!*\
  60937. !*** ./resources/js/notify.min.js ***!
  60938. \************************************/
  60939. /*! no static exports found */
  60940. /***/ (function(module, exports, __webpack_require__) {
  60941. 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); }
  60942. (function (e) {
  60943. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  60944. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  60945. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  60946. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  60947. })(function (e) {
  60948. function A(t, n, i) {
  60949. typeof i == "string" && (i = {
  60950. className: i
  60951. }), 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);
  60952. }
  60953. var t = [].indexOf || function (e) {
  60954. for (var t = 0, n = this.length; t < n; t++) {
  60955. if (t in this && this[t] === e) return t;
  60956. }
  60957. return -1;
  60958. },
  60959. n = "notify",
  60960. r = n + "js",
  60961. i = n + "!blank",
  60962. s = {
  60963. t: "top",
  60964. m: "middle",
  60965. b: "bottom",
  60966. l: "left",
  60967. c: "center",
  60968. r: "right"
  60969. },
  60970. o = ["l", "c", "r"],
  60971. u = ["t", "m", "b"],
  60972. a = ["t", "b", "l", "r"],
  60973. f = {
  60974. t: "b",
  60975. m: null,
  60976. b: "t",
  60977. l: "r",
  60978. c: null,
  60979. r: "l"
  60980. },
  60981. l = function l(t) {
  60982. var n;
  60983. return n = [], e.each(t.split(/\W+/), function (e, t) {
  60984. var r;
  60985. r = t.toLowerCase().charAt(0);
  60986. if (s[r]) return n.push(r);
  60987. }), n;
  60988. },
  60989. c = {},
  60990. h = {
  60991. name: "core",
  60992. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  60993. 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}"
  60994. },
  60995. p = {
  60996. "border-radius": ["-webkit-", "-moz-"]
  60997. },
  60998. d = function d(e) {
  60999. return c[e];
  61000. },
  61001. v = function v(e) {
  61002. if (!e) throw "Missing Style name";
  61003. c[e] && delete c[e];
  61004. },
  61005. m = function m(t, i) {
  61006. if (!t) throw "Missing Style name";
  61007. if (!i) throw "Missing Style definition";
  61008. if (!i.html) throw "Missing Style HTML";
  61009. var s = c[t];
  61010. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  61011. var o = "";
  61012. i.classes && e.each(i.classes, function (t, n) {
  61013. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  61014. return p[t] && e.each(p[t], function (e, r) {
  61015. return o += " " + r + t + ": " + n + ";\n";
  61016. }), o += " " + t + ": " + n + ";\n";
  61017. }), o += "}\n";
  61018. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  61019. var u = {},
  61020. a = e(i.html);
  61021. y("html", a, u), y("text", a, u), i.fields = u;
  61022. },
  61023. g = function g(t) {
  61024. var n, r, i;
  61025. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  61026. try {
  61027. r.html(t);
  61028. } catch (s) {
  61029. r[0].styleSheet.cssText = t;
  61030. }
  61031. return r;
  61032. },
  61033. y = function y(t, n, r) {
  61034. var s;
  61035. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  61036. var n;
  61037. n = e(this).attr(s), n || (n = i), r[n] = t;
  61038. });
  61039. },
  61040. b = function b(e, t) {
  61041. return e.is(t) ? e : e.find(t);
  61042. },
  61043. w = {
  61044. clickToHide: !0,
  61045. autoHide: !0,
  61046. autoHideDelay: 5e3,
  61047. arrowShow: !0,
  61048. arrowSize: 5,
  61049. breakNewLines: !0,
  61050. elementPosition: "bottom",
  61051. globalPosition: "top right",
  61052. style: "bootstrap",
  61053. className: "error",
  61054. showAnimation: "slideDown",
  61055. showDuration: 400,
  61056. hideAnimation: "slideUp",
  61057. hideDuration: 200,
  61058. gap: 5
  61059. },
  61060. E = function E(t, n) {
  61061. var r;
  61062. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  61063. },
  61064. S = function S(t) {
  61065. return e.extend(w, t);
  61066. },
  61067. x = function x(t) {
  61068. return e("<" + t + "></" + t + ">");
  61069. },
  61070. T = {},
  61071. N = function N(t) {
  61072. var n;
  61073. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  61074. return e(r).attr("name") === t.attr("name");
  61075. }), t = n.first()), t;
  61076. },
  61077. C = function C(e, t, n) {
  61078. var r, i;
  61079. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  61080. if (isNaN(n)) return;
  61081. 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;
  61082. },
  61083. k = function k(e, t, n) {
  61084. if (e === "l" || e === "t") return 0;
  61085. if (e === "c" || e === "m") return n / 2 - t / 2;
  61086. if (e === "r" || e === "b") return n - t;
  61087. throw "Invalid alignment";
  61088. },
  61089. L = function L(e) {
  61090. return L.e = L.e || x("div"), L.e.text(e).html();
  61091. };
  61092. A.prototype.loadHTML = function () {
  61093. var t;
  61094. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  61095. }, A.prototype.show = function (e, t) {
  61096. var n, r, i, s, o;
  61097. r = function (n) {
  61098. return function () {
  61099. !e && !n.elem && n.destroy();
  61100. if (t) return t();
  61101. };
  61102. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  61103. 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 {
  61104. if (!!o || !!e) return r();
  61105. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  61106. }
  61107. return n.push(r), i[s].apply(i, n);
  61108. }, A.prototype.setGlobalPosition = function () {
  61109. var t = this.getPosition(),
  61110. n = t[0],
  61111. i = t[1],
  61112. o = s[n],
  61113. u = s[i],
  61114. a = n + "|" + i,
  61115. f = T[a];
  61116. if (!f || !document.body.contains(f[0])) {
  61117. f = T[a] = x("div");
  61118. var l = {};
  61119. 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);
  61120. }
  61121. return f.prepend(this.wrapper);
  61122. }, A.prototype.setElementPosition = function () {
  61123. 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;
  61124. 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"];
  61125. for (w = 0, S = B.length; w < S; w++) {
  61126. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  61127. }
  61128. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  61129. if (!this.options.arrowShow) this.arrow.hide();else {
  61130. 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";
  61131. for (E = 0, x = a.length; E < x; E++) {
  61132. D = a[E], P = s[D];
  61133. if (D === L) continue;
  61134. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  61135. }
  61136. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  61137. }
  61138. 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);
  61139. if (r) return this.arrow.removeAttr("style").css(r);
  61140. }, A.prototype.getPosition = function () {
  61141. var e, n, r, i, s, f, c, h;
  61142. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  61143. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  61144. 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";
  61145. return e.length === 2 && (e[2] = e[1]), e;
  61146. }, A.prototype.getStyle = function (e) {
  61147. var t;
  61148. e || (e = this.options.style), e || (e = "default"), t = c[e];
  61149. if (!t) throw "Missing style: " + e;
  61150. return t;
  61151. }, A.prototype.updateClasses = function () {
  61152. var t, n;
  61153. 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) {
  61154. return r + "-" + n.name + "-" + e;
  61155. }).join(" "), this.userContainer.attr("class", t);
  61156. }, A.prototype.run = function (t, n) {
  61157. var r, s, o, u, a;
  61158. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  61159. if (this.container && !t) {
  61160. this.show(!1);
  61161. return;
  61162. }
  61163. if (!this.container && !t) return;
  61164. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  61165. for (o in s) {
  61166. r = s[o], u = this.userFields[o];
  61167. if (!u) continue;
  61168. 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);
  61169. }
  61170. 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));
  61171. }, A.prototype.destroy = function () {
  61172. this.wrapper.data(r, null), this.wrapper.remove();
  61173. }, e[n] = function (t, r, i) {
  61174. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  61175. }, e.fn[n] = function (t, n) {
  61176. return e(this).each(function () {
  61177. var i = N(e(this)).data(r);
  61178. i && i.destroy();
  61179. var s = new A(e(this), t, n);
  61180. }), this;
  61181. }, e.extend(e[n], {
  61182. defaults: S,
  61183. addStyle: m,
  61184. removeStyle: v,
  61185. pluginOptions: w,
  61186. getStyle: d,
  61187. insertCSS: g
  61188. }), m("bootstrap", {
  61189. html: "<div>\n<span data-notify-text></span>\n</div>",
  61190. classes: {
  61191. base: {
  61192. "font-weight": "bold",
  61193. padding: "8px 15px 8px 14px",
  61194. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  61195. "background-color": "#fcf8e3",
  61196. border: "1px solid #fbeed5",
  61197. "border-radius": "4px",
  61198. "white-space": "nowrap",
  61199. "padding-left": "25px",
  61200. "background-repeat": "no-repeat",
  61201. "background-position": "3px 7px"
  61202. },
  61203. error: {
  61204. color: "#B94A48",
  61205. "background-color": "#F2DEDE",
  61206. "border-color": "#EED3D7",
  61207. "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=)"
  61208. },
  61209. success: {
  61210. color: "#468847",
  61211. "background-color": "#DFF0D8",
  61212. "border-color": "#D6E9C6",
  61213. "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==)"
  61214. },
  61215. info: {
  61216. color: "#3A87AD",
  61217. "background-color": "#D9EDF7",
  61218. "border-color": "#BCE8F1",
  61219. "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=)"
  61220. },
  61221. warn: {
  61222. color: "#C09853",
  61223. "background-color": "#FCF8E3",
  61224. "border-color": "#FBEED5",
  61225. "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)"
  61226. }
  61227. }
  61228. }), e(function () {
  61229. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  61230. e(this).trigger("notify-hide");
  61231. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  61232. var n = e(this).data(r);
  61233. n && n.show(!1);
  61234. });
  61235. });
  61236. });
  61237. /***/ }),
  61238. /***/ "./resources/js/views/App.vue":
  61239. /*!************************************!*\
  61240. !*** ./resources/js/views/App.vue ***!
  61241. \************************************/
  61242. /*! exports provided: default */
  61243. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61244. "use strict";
  61245. __webpack_require__.r(__webpack_exports__);
  61246. /* 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&");
  61247. /* 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&");
  61248. /* 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");
  61249. /* normalize component */
  61250. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61251. _App_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61252. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["render"],
  61253. _App_vue_vue_type_template_id_91ac6b5c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61254. false,
  61255. null,
  61256. null,
  61257. null
  61258. )
  61259. /* hot reload */
  61260. if (false) { var api; }
  61261. component.options.__file = "resources/js/views/App.vue"
  61262. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61263. /***/ }),
  61264. /***/ "./resources/js/views/App.vue?vue&type=script&lang=js&":
  61265. /*!*************************************************************!*\
  61266. !*** ./resources/js/views/App.vue?vue&type=script&lang=js& ***!
  61267. \*************************************************************/
  61268. /*! exports provided: default */
  61269. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61270. "use strict";
  61271. __webpack_require__.r(__webpack_exports__);
  61272. /* 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&");
  61273. /* 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"]);
  61274. /***/ }),
  61275. /***/ "./resources/js/views/App.vue?vue&type=template&id=91ac6b5c&":
  61276. /*!*******************************************************************!*\
  61277. !*** ./resources/js/views/App.vue?vue&type=template&id=91ac6b5c& ***!
  61278. \*******************************************************************/
  61279. /*! exports provided: render, staticRenderFns */
  61280. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61281. "use strict";
  61282. __webpack_require__.r(__webpack_exports__);
  61283. /* 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&");
  61284. /* 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"]; });
  61285. /* 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"]; });
  61286. /***/ }),
  61287. /***/ "./resources/js/views/Dashboard.vue":
  61288. /*!******************************************!*\
  61289. !*** ./resources/js/views/Dashboard.vue ***!
  61290. \******************************************/
  61291. /*! exports provided: default */
  61292. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61293. "use strict";
  61294. __webpack_require__.r(__webpack_exports__);
  61295. /* 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&");
  61296. /* 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&");
  61297. /* 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");
  61298. /* normalize component */
  61299. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61300. _Dashboard_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61301. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["render"],
  61302. _Dashboard_vue_vue_type_template_id_1f79daf6___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61303. false,
  61304. null,
  61305. null,
  61306. null
  61307. )
  61308. /* hot reload */
  61309. if (false) { var api; }
  61310. component.options.__file = "resources/js/views/Dashboard.vue"
  61311. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61312. /***/ }),
  61313. /***/ "./resources/js/views/Dashboard.vue?vue&type=script&lang=js&":
  61314. /*!*******************************************************************!*\
  61315. !*** ./resources/js/views/Dashboard.vue?vue&type=script&lang=js& ***!
  61316. \*******************************************************************/
  61317. /*! exports provided: default */
  61318. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61319. "use strict";
  61320. __webpack_require__.r(__webpack_exports__);
  61321. /* 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&");
  61322. /* 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"]);
  61323. /***/ }),
  61324. /***/ "./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6&":
  61325. /*!*************************************************************************!*\
  61326. !*** ./resources/js/views/Dashboard.vue?vue&type=template&id=1f79daf6& ***!
  61327. \*************************************************************************/
  61328. /*! exports provided: render, staticRenderFns */
  61329. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61330. "use strict";
  61331. __webpack_require__.r(__webpack_exports__);
  61332. /* 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&");
  61333. /* 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"]; });
  61334. /* 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"]; });
  61335. /***/ }),
  61336. /***/ "./resources/js/views/Login.vue":
  61337. /*!**************************************!*\
  61338. !*** ./resources/js/views/Login.vue ***!
  61339. \**************************************/
  61340. /*! exports provided: default */
  61341. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61342. "use strict";
  61343. __webpack_require__.r(__webpack_exports__);
  61344. /* 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&");
  61345. /* 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&");
  61346. /* 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");
  61347. /* normalize component */
  61348. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61349. _Login_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61350. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["render"],
  61351. _Login_vue_vue_type_template_id_12f5395a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61352. false,
  61353. null,
  61354. null,
  61355. null
  61356. )
  61357. /* hot reload */
  61358. if (false) { var api; }
  61359. component.options.__file = "resources/js/views/Login.vue"
  61360. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61361. /***/ }),
  61362. /***/ "./resources/js/views/Login.vue?vue&type=script&lang=js&":
  61363. /*!***************************************************************!*\
  61364. !*** ./resources/js/views/Login.vue?vue&type=script&lang=js& ***!
  61365. \***************************************************************/
  61366. /*! exports provided: default */
  61367. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61368. "use strict";
  61369. __webpack_require__.r(__webpack_exports__);
  61370. /* 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&");
  61371. /* 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"]);
  61372. /***/ }),
  61373. /***/ "./resources/js/views/Login.vue?vue&type=template&id=12f5395a&":
  61374. /*!*********************************************************************!*\
  61375. !*** ./resources/js/views/Login.vue?vue&type=template&id=12f5395a& ***!
  61376. \*********************************************************************/
  61377. /*! exports provided: render, staticRenderFns */
  61378. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61379. "use strict";
  61380. __webpack_require__.r(__webpack_exports__);
  61381. /* 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&");
  61382. /* 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"]; });
  61383. /* 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"]; });
  61384. /***/ }),
  61385. /***/ "./resources/js/views/Welcome.vue":
  61386. /*!****************************************!*\
  61387. !*** ./resources/js/views/Welcome.vue ***!
  61388. \****************************************/
  61389. /*! exports provided: default */
  61390. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61391. "use strict";
  61392. __webpack_require__.r(__webpack_exports__);
  61393. /* 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&");
  61394. /* 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&");
  61395. /* 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&");
  61396. /* 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");
  61397. /* normalize component */
  61398. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_3__["default"])(
  61399. _Welcome_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61400. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["render"],
  61401. _Welcome_vue_vue_type_template_id_1ae8ae93_scoped_true___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61402. false,
  61403. null,
  61404. "1ae8ae93",
  61405. null
  61406. )
  61407. /* hot reload */
  61408. if (false) { var api; }
  61409. component.options.__file = "resources/js/views/Welcome.vue"
  61410. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61411. /***/ }),
  61412. /***/ "./resources/js/views/Welcome.vue?vue&type=script&lang=js&":
  61413. /*!*****************************************************************!*\
  61414. !*** ./resources/js/views/Welcome.vue?vue&type=script&lang=js& ***!
  61415. \*****************************************************************/
  61416. /*! exports provided: default */
  61417. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61418. "use strict";
  61419. __webpack_require__.r(__webpack_exports__);
  61420. /* 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&");
  61421. /* 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"]);
  61422. /***/ }),
  61423. /***/ "./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css&":
  61424. /*!*************************************************************************************************!*\
  61425. !*** ./resources/js/views/Welcome.vue?vue&type=style&index=0&id=1ae8ae93&scoped=true&lang=css& ***!
  61426. \*************************************************************************************************/
  61427. /*! no static exports found */
  61428. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61429. "use strict";
  61430. __webpack_require__.r(__webpack_exports__);
  61431. /* 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&");
  61432. /* 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__);
  61433. /* 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__));
  61434. /* 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);
  61435. /***/ }),
  61436. /***/ "./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true&":
  61437. /*!***********************************************************************************!*\
  61438. !*** ./resources/js/views/Welcome.vue?vue&type=template&id=1ae8ae93&scoped=true& ***!
  61439. \***********************************************************************************/
  61440. /*! exports provided: render, staticRenderFns */
  61441. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61442. "use strict";
  61443. __webpack_require__.r(__webpack_exports__);
  61444. /* 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&");
  61445. /* 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"]; });
  61446. /* 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"]; });
  61447. /***/ }),
  61448. /***/ "./resources/js/views/WorkOrder.vue":
  61449. /*!******************************************!*\
  61450. !*** ./resources/js/views/WorkOrder.vue ***!
  61451. \******************************************/
  61452. /*! exports provided: default */
  61453. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61454. "use strict";
  61455. __webpack_require__.r(__webpack_exports__);
  61456. /* 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&");
  61457. /* 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&");
  61458. /* 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");
  61459. /* normalize component */
  61460. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  61461. _WorkOrder_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  61462. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["render"],
  61463. _WorkOrder_vue_vue_type_template_id_17837e2e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  61464. false,
  61465. null,
  61466. null,
  61467. null
  61468. )
  61469. /* hot reload */
  61470. if (false) { var api; }
  61471. component.options.__file = "resources/js/views/WorkOrder.vue"
  61472. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  61473. /***/ }),
  61474. /***/ "./resources/js/views/WorkOrder.vue?vue&type=script&lang=js&":
  61475. /*!*******************************************************************!*\
  61476. !*** ./resources/js/views/WorkOrder.vue?vue&type=script&lang=js& ***!
  61477. \*******************************************************************/
  61478. /*! exports provided: default */
  61479. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61480. "use strict";
  61481. __webpack_require__.r(__webpack_exports__);
  61482. /* 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&");
  61483. /* 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"]);
  61484. /***/ }),
  61485. /***/ "./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e&":
  61486. /*!*************************************************************************!*\
  61487. !*** ./resources/js/views/WorkOrder.vue?vue&type=template&id=17837e2e& ***!
  61488. \*************************************************************************/
  61489. /*! exports provided: render, staticRenderFns */
  61490. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  61491. "use strict";
  61492. __webpack_require__.r(__webpack_exports__);
  61493. /* 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&");
  61494. /* 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"]; });
  61495. /* 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"]; });
  61496. /***/ }),
  61497. /***/ "./resources/sass/app.scss":
  61498. /*!*********************************!*\
  61499. !*** ./resources/sass/app.scss ***!
  61500. \*********************************/
  61501. /*! no static exports found */
  61502. /***/ (function(module, exports) {
  61503. // removed by extract-text-webpack-plugin
  61504. /***/ }),
  61505. /***/ 0:
  61506. /*!*************************************************************!*\
  61507. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  61508. \*************************************************************/
  61509. /*! no static exports found */
  61510. /***/ (function(module, exports, __webpack_require__) {
  61511. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  61512. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  61513. /***/ })
  61514. /******/ });