app.js 1.8 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741
  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/ExampleComponent.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/ExampleComponent.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. //
  1582. //
  1583. //
  1584. //
  1585. //
  1586. //
  1587. //
  1588. //
  1589. //
  1590. //
  1591. //
  1592. //
  1593. //
  1594. //
  1595. //
  1596. //
  1597. /* harmony default export */ __webpack_exports__["default"] = ({
  1598. mounted: function mounted() {
  1599. console.log('Component mounted.');
  1600. }
  1601. });
  1602. /***/ }),
  1603. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  1604. /*!********************************************************************************************************************************************************************!*\
  1605. !*** ./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& ***!
  1606. \********************************************************************************************************************************************************************/
  1607. /*! exports provided: default */
  1608. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1609. "use strict";
  1610. __webpack_require__.r(__webpack_exports__);
  1611. //
  1612. //
  1613. //
  1614. //
  1615. //
  1616. //
  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. //
  1667. /* harmony default export */ __webpack_exports__["default"] = ({
  1668. props: ['asset', 'pcextraStart'],
  1669. data: function data() {
  1670. return {
  1671. data: JSON.parse(this.asset),
  1672. pcextra: JSON.parse(this.pcextraStart)
  1673. };
  1674. },
  1675. mounted: function mounted() {
  1676. var _this = this;
  1677. Echo.channel('assets').listen('AssetUpdated', function (e) {
  1678. _this.data = JSON.parse(e.data);
  1679. _this.pcextra = JSON.parse(e.pcextra);
  1680. });
  1681. },
  1682. methods: {
  1683. updateAsset: function updateAsset() {
  1684. this.data.pcextra = this.pcextra;
  1685. axios.put('/api/assets/' + this.data.pcid, this.data).then(function (response) {})["catch"](function (error) {});
  1686. $('#asseteditModal').modal('hide');
  1687. }
  1688. }
  1689. });
  1690. /***/ }),
  1691. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  1692. /*!***************************************************************************************************************************************************************************************!*\
  1693. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  1694. \***************************************************************************************************************************************************************************************/
  1695. /*! exports provided: default */
  1696. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1697. "use strict";
  1698. __webpack_require__.r(__webpack_exports__);
  1699. //
  1700. //
  1701. //
  1702. //
  1703. //
  1704. //
  1705. //
  1706. //
  1707. //
  1708. //
  1709. //
  1710. //
  1711. //
  1712. //
  1713. //
  1714. //
  1715. //
  1716. //
  1717. //
  1718. //
  1719. //
  1720. /* harmony default export */ __webpack_exports__["default"] = ({
  1721. props: {
  1722. value: null,
  1723. // An object with the following format
  1724. // {
  1725. // key: value,
  1726. // key: value,
  1727. // }
  1728. options: {
  1729. type: Object,
  1730. required: true
  1731. },
  1732. allowCustom: {
  1733. type: Boolean,
  1734. "default": false
  1735. }
  1736. },
  1737. data: function data() {
  1738. return {
  1739. searchText: '',
  1740. selectedOption: null,
  1741. open: false,
  1742. // allows for checking whether button was clicked or text was typed.
  1743. // If button was clicked, we show all options without having to clear
  1744. // out any searchText that was autofilled when page loaded.
  1745. isSearching: false
  1746. };
  1747. },
  1748. computed: {
  1749. matches: function matches() {
  1750. var _this = this;
  1751. // If button was clicked, show all options, if typing, filter
  1752. // options based on searchText
  1753. return Object.entries(this.options).filter(function (option) {
  1754. var optionText = option[1].toUpperCase();
  1755. if (_this.isSearching) {
  1756. return optionText.match(_this.searchText.toUpperCase());
  1757. } else {
  1758. return optionText.match('');
  1759. }
  1760. });
  1761. }
  1762. },
  1763. methods: {
  1764. // if button is clicked, show all options
  1765. setOpen: function setOpen(isOpen) {
  1766. this.open = isOpen;
  1767. this.isSearching = false;
  1768. },
  1769. // if typing in the box, start filtering options
  1770. searchChanged: function searchChanged() {
  1771. if (!this.open) {
  1772. this.open = true;
  1773. }
  1774. if (!this.isSearching) {
  1775. this.isSearching = true;
  1776. } // If custom values are allowed, emits {id: 'custom', name: searchtext}
  1777. if (this.allowCustom) {
  1778. this.$emit('input', {
  1779. 'id': 'custom',
  1780. 'name': this.searchText
  1781. });
  1782. }
  1783. },
  1784. // emits { id: suggestion_id, name: suggestion_name} to v-model when
  1785. // a suggestion is selected
  1786. suggestionSelected: function suggestionSelected(suggestion) {
  1787. this.open = false;
  1788. this.searchText = suggestion[1];
  1789. this.$emit('input', {
  1790. 'id': suggestion[0],
  1791. 'name': suggestion[1]
  1792. });
  1793. },
  1794. updateComponentWithValue: function updateComponentWithValue(newValue) {
  1795. if (this.allowCustom) {
  1796. this.searchText = this.value.name;
  1797. } else {
  1798. if (newValue.id > -1) {
  1799. // Find the matching text for the supplied option value
  1800. for (var id in this.options) {
  1801. if (this.options.hasOwnProperty(id)) {
  1802. if (this.options[id] === this.options[newValue.id]) {
  1803. this.searchText = this.options[id];
  1804. }
  1805. }
  1806. }
  1807. }
  1808. }
  1809. }
  1810. },
  1811. mounted: function mounted() {
  1812. this.updateComponentWithValue(this.value);
  1813. },
  1814. watch: {
  1815. value: function value(newValue) {
  1816. this.updateComponentWithValue(newValue);
  1817. }
  1818. }
  1819. });
  1820. /***/ }),
  1821. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  1822. /*!********************************************************************************************************************************************************************************!*\
  1823. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  1824. \********************************************************************************************************************************************************************************/
  1825. /*! exports provided: default */
  1826. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1827. "use strict";
  1828. __webpack_require__.r(__webpack_exports__);
  1829. //
  1830. //
  1831. //
  1832. //
  1833. //
  1834. //
  1835. //
  1836. //
  1837. //
  1838. //
  1839. //
  1840. //
  1841. //
  1842. //
  1843. //
  1844. //
  1845. //
  1846. //
  1847. //
  1848. //
  1849. //
  1850. //
  1851. //
  1852. //
  1853. //
  1854. //
  1855. /* harmony default export */ __webpack_exports__["default"] = ({
  1856. props: {
  1857. populateWith: {
  1858. type: Object,
  1859. "default": function _default() {
  1860. return {
  1861. creddesc: null,
  1862. creduser: null,
  1863. credpass: null,
  1864. groupid: null,
  1865. pcid: null,
  1866. credtype: null
  1867. };
  1868. }
  1869. },
  1870. modalId: {
  1871. type: String,
  1872. required: true
  1873. },
  1874. descriptions: {
  1875. type: Object,
  1876. required: true
  1877. },
  1878. create: {
  1879. type: Boolean
  1880. },
  1881. pcid: {
  1882. type: Number
  1883. },
  1884. groupid: {
  1885. type: Number
  1886. }
  1887. },
  1888. data: function data() {
  1889. return {
  1890. data: JSON.parse(JSON.stringify(this.populateWith)),
  1891. creddesc: {},
  1892. id: this.modalId,
  1893. errors: []
  1894. };
  1895. },
  1896. mounted: function mounted() {
  1897. this.creddesc = {
  1898. 'id': this.data.credtype,
  1899. 'name': this.data.creddesc
  1900. };
  1901. },
  1902. methods: {
  1903. rndStr: function rndStr(len) {
  1904. var text = "";
  1905. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  1906. for (var i = 0; i < len; i++) {
  1907. text += chars.charAt(Math.floor(Math.random() * chars.length));
  1908. }
  1909. return text;
  1910. },
  1911. getRandomPassword: function getRandomPassword(id) {
  1912. this.data.credpass = this.rndStr(16);
  1913. },
  1914. updateCredential: function updateCredential() {
  1915. var _this = this;
  1916. if (this.creddesc.id === "custom") {
  1917. this.data.credtype = 1;
  1918. this.data.creddesc = this.creddesc.name;
  1919. } else {
  1920. this.data.credtype = this.creddesc.id;
  1921. this.data.creddesc = this.creddesc.name;
  1922. }
  1923. if (this.create) {
  1924. if (this.pcid) {
  1925. this.data.pcid = this.pcid;
  1926. }
  1927. if (this.groupid) {
  1928. this.data.groupid = this.groupid;
  1929. }
  1930. axios.post('/api/credentials/', this.data).then(function (response) {
  1931. $('#' + _this.id).modal('hide');
  1932. });
  1933. } else {
  1934. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  1935. $('#' + _this.id).modal('hide');
  1936. })["catch"](function (error) {
  1937. console.error(error);
  1938. });
  1939. }
  1940. }
  1941. }
  1942. });
  1943. /***/ }),
  1944. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  1945. /*!**************************************************************************************************************************************************************************!*\
  1946. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  1947. \**************************************************************************************************************************************************************************/
  1948. /*! exports provided: default */
  1949. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1950. "use strict";
  1951. __webpack_require__.r(__webpack_exports__);
  1952. //
  1953. //
  1954. //
  1955. //
  1956. //
  1957. //
  1958. //
  1959. //
  1960. //
  1961. /* harmony default export */ __webpack_exports__["default"] = ({
  1962. props: {
  1963. credentialList: {
  1964. type: Array,
  1965. required: true
  1966. },
  1967. descriptions: {
  1968. type: Array,
  1969. required: true
  1970. },
  1971. pcid: {
  1972. type: Number
  1973. },
  1974. groupid: {
  1975. type: Number
  1976. }
  1977. },
  1978. data: function data() {
  1979. return {
  1980. credentials: this.credentialList
  1981. };
  1982. },
  1983. computed: {
  1984. creddescList: function creddescList() {
  1985. var list = {};
  1986. this.descriptions.map(function (val) {
  1987. list[val.creddescid] = val.credtitle;
  1988. });
  1989. return list;
  1990. }
  1991. }
  1992. });
  1993. /***/ }),
  1994. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&":
  1995. /*!*********************************************************************************************************************************************************************!*\
  1996. !*** ./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& ***!
  1997. \*********************************************************************************************************************************************************************/
  1998. /*! exports provided: default */
  1999. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2000. "use strict";
  2001. __webpack_require__.r(__webpack_exports__);
  2002. //
  2003. //
  2004. //
  2005. //
  2006. //
  2007. //
  2008. //
  2009. //
  2010. //
  2011. //
  2012. //
  2013. //
  2014. //
  2015. //
  2016. //
  2017. //
  2018. //
  2019. //
  2020. //
  2021. //
  2022. //
  2023. //
  2024. //
  2025. //
  2026. //
  2027. //
  2028. //
  2029. //
  2030. //
  2031. //
  2032. //
  2033. //
  2034. //
  2035. //
  2036. //
  2037. //
  2038. //
  2039. //
  2040. //
  2041. //
  2042. //
  2043. //
  2044. //
  2045. /* harmony default export */ __webpack_exports__["default"] = ({
  2046. props: ['credential', 'descriptions'],
  2047. data: function data() {
  2048. return {
  2049. data: this.credential,
  2050. creddescList: this.descriptions
  2051. };
  2052. },
  2053. mounted: function mounted() {
  2054. var _this = this;
  2055. console.log('credential.' + this.data.credid);
  2056. Echo.channel('credential.' + this.data.credid).listen('CredentialUpdated', function (e) {
  2057. // This part could potentially use a refactor.
  2058. // Probably needs a credential list component to listen for this
  2059. // even and update the corresponding credential. Currently every
  2060. // credential on the page receives this event and checks whether it was intended
  2061. // for its credential or not. I would imagine this could cause a problem
  2062. // on the group page, which will potentially have a lot more credentials from
  2063. // various assets. Better solution may be to have a credentials list component
  2064. // That listens for credential update events and updates the appropriate credential.
  2065. // There would still be multiples of those on the group credentials page, but an
  2066. // order of magnitude less of those than of individual credentials.
  2067. // It also may not be a big deal performance wise to do it like this, not sure.
  2068. _this.data = e.credential;
  2069. });
  2070. },
  2071. methods: {
  2072. deleteCredential: function deleteCredential() {
  2073. var _this2 = this;
  2074. axios["delete"]('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2075. $('#credential' + _this2.data.credid + 'deleteModal').modal('hide');
  2076. })["catch"](function (error) {
  2077. console.error(error);
  2078. });
  2079. }
  2080. }
  2081. });
  2082. /***/ }),
  2083. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  2084. /*!********************************************************************************************************************************************************************!*\
  2085. !*** ./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& ***!
  2086. \********************************************************************************************************************************************************************/
  2087. /*! exports provided: default */
  2088. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2089. "use strict";
  2090. __webpack_require__.r(__webpack_exports__);
  2091. //
  2092. //
  2093. //
  2094. //
  2095. //
  2096. /* harmony default export */ __webpack_exports__["default"] = ({
  2097. props: ['errors'],
  2098. data: function data() {
  2099. return {
  2100. errorList: this.errors
  2101. };
  2102. },
  2103. watch: {
  2104. errors: function errors(newErrors) {
  2105. this.errorList = newErrors;
  2106. }
  2107. }
  2108. });
  2109. /***/ }),
  2110. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  2111. /*!****************************************************************************************************************************************************************!*\
  2112. !*** ./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& ***!
  2113. \****************************************************************************************************************************************************************/
  2114. /*! exports provided: default */
  2115. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2116. "use strict";
  2117. __webpack_require__.r(__webpack_exports__);
  2118. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2119. //
  2120. //
  2121. //
  2122. //
  2123. //
  2124. //
  2125. //
  2126. //
  2127. //
  2128. //
  2129. //
  2130. //
  2131. //
  2132. //
  2133. //
  2134. //
  2135. //
  2136. //
  2137. //
  2138. //
  2139. //
  2140. //
  2141. //
  2142. //
  2143. //
  2144. //
  2145. //
  2146. //
  2147. //
  2148. //
  2149. //
  2150. //
  2151. //
  2152. //
  2153. //
  2154. //
  2155. //
  2156. //
  2157. //
  2158. /* harmony default export */ __webpack_exports__["default"] = ({
  2159. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2160. props: ['initialnotes', 'authusername'],
  2161. data: function data() {
  2162. return {
  2163. notes: this.initialnotes
  2164. };
  2165. }
  2166. });
  2167. /***/ }),
  2168. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  2169. /*!****************************************************************************************************************************************************************************!*\
  2170. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  2171. \****************************************************************************************************************************************************************************/
  2172. /*! exports provided: default */
  2173. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2174. "use strict";
  2175. __webpack_require__.r(__webpack_exports__);
  2176. //
  2177. //
  2178. //
  2179. //
  2180. //
  2181. //
  2182. //
  2183. //
  2184. //
  2185. //
  2186. //
  2187. //
  2188. //
  2189. //
  2190. //
  2191. //
  2192. //
  2193. //
  2194. //
  2195. //
  2196. //
  2197. //
  2198. //
  2199. //
  2200. //
  2201. //
  2202. //
  2203. //
  2204. //
  2205. //
  2206. //
  2207. //
  2208. //
  2209. /* harmony default export */ __webpack_exports__["default"] = ({
  2210. props: ['populateWith', 'storeList', 'modalId'],
  2211. data: function data() {
  2212. return {
  2213. // Copies object from prop, so it doesn't mutate the object
  2214. // from the parent component. Parent component will be updated via
  2215. // Websocket if updateWorkOrder is successful.
  2216. data: JSON.parse(JSON.stringify(this.populateWith)),
  2217. id: this.modalId,
  2218. store: {},
  2219. errors: []
  2220. };
  2221. },
  2222. mounted: function mounted() {
  2223. this.store = {
  2224. 'id': this.data.storeid,
  2225. 'name': this.storeList[this.data.storeid]
  2226. };
  2227. },
  2228. methods: {
  2229. updateWorkOrder: function updateWorkOrder() {
  2230. var _this = this;
  2231. this.data.storeid = this.store.id;
  2232. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2233. $('#workordereditModal').modal('hide');
  2234. })["catch"](function (error) {
  2235. _this.errors = JSON.parse(error.response.request.response).errors;
  2236. });
  2237. }
  2238. }
  2239. });
  2240. /***/ }),
  2241. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  2242. /*!*****************************************************************************************************************************************************************!*\
  2243. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  2244. \*****************************************************************************************************************************************************************/
  2245. /*! exports provided: default */
  2246. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2247. "use strict";
  2248. __webpack_require__.r(__webpack_exports__);
  2249. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2250. //
  2251. //
  2252. //
  2253. //
  2254. //
  2255. //
  2256. //
  2257. //
  2258. //
  2259. //
  2260. //
  2261. //
  2262. //
  2263. //
  2264. //
  2265. //
  2266. //
  2267. //
  2268. //
  2269. //
  2270. /* harmony default export */ __webpack_exports__["default"] = ({
  2271. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2272. props: ['workOrder', 'stores'],
  2273. data: function data() {
  2274. return {
  2275. data: JSON.parse(this.workOrder)
  2276. };
  2277. },
  2278. computed: {
  2279. storeList: function storeList() {
  2280. var list = {};
  2281. JSON.parse(this.stores).map(function (val) {
  2282. list[val.storeid] = val.storesname;
  2283. });
  2284. return list;
  2285. }
  2286. },
  2287. mounted: function mounted() {
  2288. var _this = this;
  2289. Echo.channel('work-orders').listen('WorkOrderUpdated', function (e) {
  2290. _this.data = JSON.parse(e.data);
  2291. });
  2292. }
  2293. });
  2294. /***/ }),
  2295. /***/ "./node_modules/base64-js/index.js":
  2296. /*!*****************************************!*\
  2297. !*** ./node_modules/base64-js/index.js ***!
  2298. \*****************************************/
  2299. /*! no static exports found */
  2300. /***/ (function(module, exports, __webpack_require__) {
  2301. "use strict";
  2302. exports.byteLength = byteLength
  2303. exports.toByteArray = toByteArray
  2304. exports.fromByteArray = fromByteArray
  2305. var lookup = []
  2306. var revLookup = []
  2307. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2308. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2309. for (var i = 0, len = code.length; i < len; ++i) {
  2310. lookup[i] = code[i]
  2311. revLookup[code.charCodeAt(i)] = i
  2312. }
  2313. // Support decoding URL-safe base64 strings, as Node.js does.
  2314. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2315. revLookup['-'.charCodeAt(0)] = 62
  2316. revLookup['_'.charCodeAt(0)] = 63
  2317. function getLens (b64) {
  2318. var len = b64.length
  2319. if (len % 4 > 0) {
  2320. throw new Error('Invalid string. Length must be a multiple of 4')
  2321. }
  2322. // Trim off extra bytes after placeholder bytes are found
  2323. // See: https://github.com/beatgammit/base64-js/issues/42
  2324. var validLen = b64.indexOf('=')
  2325. if (validLen === -1) validLen = len
  2326. var placeHoldersLen = validLen === len
  2327. ? 0
  2328. : 4 - (validLen % 4)
  2329. return [validLen, placeHoldersLen]
  2330. }
  2331. // base64 is 4/3 + up to two characters of the original data
  2332. function byteLength (b64) {
  2333. var lens = getLens(b64)
  2334. var validLen = lens[0]
  2335. var placeHoldersLen = lens[1]
  2336. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2337. }
  2338. function _byteLength (b64, validLen, placeHoldersLen) {
  2339. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2340. }
  2341. function toByteArray (b64) {
  2342. var tmp
  2343. var lens = getLens(b64)
  2344. var validLen = lens[0]
  2345. var placeHoldersLen = lens[1]
  2346. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2347. var curByte = 0
  2348. // if there are placeholders, only get up to the last complete 4 chars
  2349. var len = placeHoldersLen > 0
  2350. ? validLen - 4
  2351. : validLen
  2352. var i
  2353. for (i = 0; i < len; i += 4) {
  2354. tmp =
  2355. (revLookup[b64.charCodeAt(i)] << 18) |
  2356. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2357. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2358. revLookup[b64.charCodeAt(i + 3)]
  2359. arr[curByte++] = (tmp >> 16) & 0xFF
  2360. arr[curByte++] = (tmp >> 8) & 0xFF
  2361. arr[curByte++] = tmp & 0xFF
  2362. }
  2363. if (placeHoldersLen === 2) {
  2364. tmp =
  2365. (revLookup[b64.charCodeAt(i)] << 2) |
  2366. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2367. arr[curByte++] = tmp & 0xFF
  2368. }
  2369. if (placeHoldersLen === 1) {
  2370. tmp =
  2371. (revLookup[b64.charCodeAt(i)] << 10) |
  2372. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2373. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2374. arr[curByte++] = (tmp >> 8) & 0xFF
  2375. arr[curByte++] = tmp & 0xFF
  2376. }
  2377. return arr
  2378. }
  2379. function tripletToBase64 (num) {
  2380. return lookup[num >> 18 & 0x3F] +
  2381. lookup[num >> 12 & 0x3F] +
  2382. lookup[num >> 6 & 0x3F] +
  2383. lookup[num & 0x3F]
  2384. }
  2385. function encodeChunk (uint8, start, end) {
  2386. var tmp
  2387. var output = []
  2388. for (var i = start; i < end; i += 3) {
  2389. tmp =
  2390. ((uint8[i] << 16) & 0xFF0000) +
  2391. ((uint8[i + 1] << 8) & 0xFF00) +
  2392. (uint8[i + 2] & 0xFF)
  2393. output.push(tripletToBase64(tmp))
  2394. }
  2395. return output.join('')
  2396. }
  2397. function fromByteArray (uint8) {
  2398. var tmp
  2399. var len = uint8.length
  2400. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2401. var parts = []
  2402. var maxChunkLength = 16383 // must be multiple of 3
  2403. // go through the array every three bytes, we'll deal with trailing stuff later
  2404. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2405. parts.push(encodeChunk(
  2406. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2407. ))
  2408. }
  2409. // pad the end with zeros, but make sure to not forget the extra bytes
  2410. if (extraBytes === 1) {
  2411. tmp = uint8[len - 1]
  2412. parts.push(
  2413. lookup[tmp >> 2] +
  2414. lookup[(tmp << 4) & 0x3F] +
  2415. '=='
  2416. )
  2417. } else if (extraBytes === 2) {
  2418. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2419. parts.push(
  2420. lookup[tmp >> 10] +
  2421. lookup[(tmp >> 4) & 0x3F] +
  2422. lookup[(tmp << 2) & 0x3F] +
  2423. '='
  2424. )
  2425. }
  2426. return parts.join('')
  2427. }
  2428. /***/ }),
  2429. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2430. /*!*****************************************************!*\
  2431. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2432. \*****************************************************/
  2433. /*! no static exports found */
  2434. /***/ (function(module, exports, __webpack_require__) {
  2435. /*!
  2436. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2437. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2438. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2439. */
  2440. (function (global, factory) {
  2441. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2442. undefined;
  2443. }(this, (function (exports, $, Popper) { 'use strict';
  2444. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2445. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2446. function _defineProperties(target, props) {
  2447. for (var i = 0; i < props.length; i++) {
  2448. var descriptor = props[i];
  2449. descriptor.enumerable = descriptor.enumerable || false;
  2450. descriptor.configurable = true;
  2451. if ("value" in descriptor) descriptor.writable = true;
  2452. Object.defineProperty(target, descriptor.key, descriptor);
  2453. }
  2454. }
  2455. function _createClass(Constructor, protoProps, staticProps) {
  2456. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2457. if (staticProps) _defineProperties(Constructor, staticProps);
  2458. return Constructor;
  2459. }
  2460. function _defineProperty(obj, key, value) {
  2461. if (key in obj) {
  2462. Object.defineProperty(obj, key, {
  2463. value: value,
  2464. enumerable: true,
  2465. configurable: true,
  2466. writable: true
  2467. });
  2468. } else {
  2469. obj[key] = value;
  2470. }
  2471. return obj;
  2472. }
  2473. function ownKeys(object, enumerableOnly) {
  2474. var keys = Object.keys(object);
  2475. if (Object.getOwnPropertySymbols) {
  2476. var symbols = Object.getOwnPropertySymbols(object);
  2477. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2478. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2479. });
  2480. keys.push.apply(keys, symbols);
  2481. }
  2482. return keys;
  2483. }
  2484. function _objectSpread2(target) {
  2485. for (var i = 1; i < arguments.length; i++) {
  2486. var source = arguments[i] != null ? arguments[i] : {};
  2487. if (i % 2) {
  2488. ownKeys(Object(source), true).forEach(function (key) {
  2489. _defineProperty(target, key, source[key]);
  2490. });
  2491. } else if (Object.getOwnPropertyDescriptors) {
  2492. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2493. } else {
  2494. ownKeys(Object(source)).forEach(function (key) {
  2495. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2496. });
  2497. }
  2498. }
  2499. return target;
  2500. }
  2501. function _inheritsLoose(subClass, superClass) {
  2502. subClass.prototype = Object.create(superClass.prototype);
  2503. subClass.prototype.constructor = subClass;
  2504. subClass.__proto__ = superClass;
  2505. }
  2506. /**
  2507. * --------------------------------------------------------------------------
  2508. * Bootstrap (v4.4.1): util.js
  2509. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2510. * --------------------------------------------------------------------------
  2511. */
  2512. /**
  2513. * ------------------------------------------------------------------------
  2514. * Private TransitionEnd Helpers
  2515. * ------------------------------------------------------------------------
  2516. */
  2517. var TRANSITION_END = 'transitionend';
  2518. var MAX_UID = 1000000;
  2519. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2520. function toType(obj) {
  2521. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2522. }
  2523. function getSpecialTransitionEndEvent() {
  2524. return {
  2525. bindType: TRANSITION_END,
  2526. delegateType: TRANSITION_END,
  2527. handle: function handle(event) {
  2528. if ($(event.target).is(this)) {
  2529. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2530. }
  2531. return undefined; // eslint-disable-line no-undefined
  2532. }
  2533. };
  2534. }
  2535. function transitionEndEmulator(duration) {
  2536. var _this = this;
  2537. var called = false;
  2538. $(this).one(Util.TRANSITION_END, function () {
  2539. called = true;
  2540. });
  2541. setTimeout(function () {
  2542. if (!called) {
  2543. Util.triggerTransitionEnd(_this);
  2544. }
  2545. }, duration);
  2546. return this;
  2547. }
  2548. function setTransitionEndSupport() {
  2549. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2550. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2551. }
  2552. /**
  2553. * --------------------------------------------------------------------------
  2554. * Public Util Api
  2555. * --------------------------------------------------------------------------
  2556. */
  2557. var Util = {
  2558. TRANSITION_END: 'bsTransitionEnd',
  2559. getUID: function getUID(prefix) {
  2560. do {
  2561. // eslint-disable-next-line no-bitwise
  2562. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2563. } while (document.getElementById(prefix));
  2564. return prefix;
  2565. },
  2566. getSelectorFromElement: function getSelectorFromElement(element) {
  2567. var selector = element.getAttribute('data-target');
  2568. if (!selector || selector === '#') {
  2569. var hrefAttr = element.getAttribute('href');
  2570. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2571. }
  2572. try {
  2573. return document.querySelector(selector) ? selector : null;
  2574. } catch (err) {
  2575. return null;
  2576. }
  2577. },
  2578. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2579. if (!element) {
  2580. return 0;
  2581. } // Get transition-duration of the element
  2582. var transitionDuration = $(element).css('transition-duration');
  2583. var transitionDelay = $(element).css('transition-delay');
  2584. var floatTransitionDuration = parseFloat(transitionDuration);
  2585. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2586. if (!floatTransitionDuration && !floatTransitionDelay) {
  2587. return 0;
  2588. } // If multiple durations are defined, take the first
  2589. transitionDuration = transitionDuration.split(',')[0];
  2590. transitionDelay = transitionDelay.split(',')[0];
  2591. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2592. },
  2593. reflow: function reflow(element) {
  2594. return element.offsetHeight;
  2595. },
  2596. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2597. $(element).trigger(TRANSITION_END);
  2598. },
  2599. // TODO: Remove in v5
  2600. supportsTransitionEnd: function supportsTransitionEnd() {
  2601. return Boolean(TRANSITION_END);
  2602. },
  2603. isElement: function isElement(obj) {
  2604. return (obj[0] || obj).nodeType;
  2605. },
  2606. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2607. for (var property in configTypes) {
  2608. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2609. var expectedTypes = configTypes[property];
  2610. var value = config[property];
  2611. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2612. if (!new RegExp(expectedTypes).test(valueType)) {
  2613. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2614. }
  2615. }
  2616. }
  2617. },
  2618. findShadowRoot: function findShadowRoot(element) {
  2619. if (!document.documentElement.attachShadow) {
  2620. return null;
  2621. } // Can find the shadow root otherwise it'll return the document
  2622. if (typeof element.getRootNode === 'function') {
  2623. var root = element.getRootNode();
  2624. return root instanceof ShadowRoot ? root : null;
  2625. }
  2626. if (element instanceof ShadowRoot) {
  2627. return element;
  2628. } // when we don't find a shadow root
  2629. if (!element.parentNode) {
  2630. return null;
  2631. }
  2632. return Util.findShadowRoot(element.parentNode);
  2633. },
  2634. jQueryDetection: function jQueryDetection() {
  2635. if (typeof $ === 'undefined') {
  2636. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2637. }
  2638. var version = $.fn.jquery.split(' ')[0].split('.');
  2639. var minMajor = 1;
  2640. var ltMajor = 2;
  2641. var minMinor = 9;
  2642. var minPatch = 1;
  2643. var maxMajor = 4;
  2644. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2645. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2646. }
  2647. }
  2648. };
  2649. Util.jQueryDetection();
  2650. setTransitionEndSupport();
  2651. /**
  2652. * ------------------------------------------------------------------------
  2653. * Constants
  2654. * ------------------------------------------------------------------------
  2655. */
  2656. var NAME = 'alert';
  2657. var VERSION = '4.4.1';
  2658. var DATA_KEY = 'bs.alert';
  2659. var EVENT_KEY = "." + DATA_KEY;
  2660. var DATA_API_KEY = '.data-api';
  2661. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2662. var Selector = {
  2663. DISMISS: '[data-dismiss="alert"]'
  2664. };
  2665. var Event = {
  2666. CLOSE: "close" + EVENT_KEY,
  2667. CLOSED: "closed" + EVENT_KEY,
  2668. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2669. };
  2670. var ClassName = {
  2671. ALERT: 'alert',
  2672. FADE: 'fade',
  2673. SHOW: 'show'
  2674. };
  2675. /**
  2676. * ------------------------------------------------------------------------
  2677. * Class Definition
  2678. * ------------------------------------------------------------------------
  2679. */
  2680. var Alert =
  2681. /*#__PURE__*/
  2682. function () {
  2683. function Alert(element) {
  2684. this._element = element;
  2685. } // Getters
  2686. var _proto = Alert.prototype;
  2687. // Public
  2688. _proto.close = function close(element) {
  2689. var rootElement = this._element;
  2690. if (element) {
  2691. rootElement = this._getRootElement(element);
  2692. }
  2693. var customEvent = this._triggerCloseEvent(rootElement);
  2694. if (customEvent.isDefaultPrevented()) {
  2695. return;
  2696. }
  2697. this._removeElement(rootElement);
  2698. };
  2699. _proto.dispose = function dispose() {
  2700. $.removeData(this._element, DATA_KEY);
  2701. this._element = null;
  2702. } // Private
  2703. ;
  2704. _proto._getRootElement = function _getRootElement(element) {
  2705. var selector = Util.getSelectorFromElement(element);
  2706. var parent = false;
  2707. if (selector) {
  2708. parent = document.querySelector(selector);
  2709. }
  2710. if (!parent) {
  2711. parent = $(element).closest("." + ClassName.ALERT)[0];
  2712. }
  2713. return parent;
  2714. };
  2715. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2716. var closeEvent = $.Event(Event.CLOSE);
  2717. $(element).trigger(closeEvent);
  2718. return closeEvent;
  2719. };
  2720. _proto._removeElement = function _removeElement(element) {
  2721. var _this = this;
  2722. $(element).removeClass(ClassName.SHOW);
  2723. if (!$(element).hasClass(ClassName.FADE)) {
  2724. this._destroyElement(element);
  2725. return;
  2726. }
  2727. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2728. $(element).one(Util.TRANSITION_END, function (event) {
  2729. return _this._destroyElement(element, event);
  2730. }).emulateTransitionEnd(transitionDuration);
  2731. };
  2732. _proto._destroyElement = function _destroyElement(element) {
  2733. $(element).detach().trigger(Event.CLOSED).remove();
  2734. } // Static
  2735. ;
  2736. Alert._jQueryInterface = function _jQueryInterface(config) {
  2737. return this.each(function () {
  2738. var $element = $(this);
  2739. var data = $element.data(DATA_KEY);
  2740. if (!data) {
  2741. data = new Alert(this);
  2742. $element.data(DATA_KEY, data);
  2743. }
  2744. if (config === 'close') {
  2745. data[config](this);
  2746. }
  2747. });
  2748. };
  2749. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2750. return function (event) {
  2751. if (event) {
  2752. event.preventDefault();
  2753. }
  2754. alertInstance.close(this);
  2755. };
  2756. };
  2757. _createClass(Alert, null, [{
  2758. key: "VERSION",
  2759. get: function get() {
  2760. return VERSION;
  2761. }
  2762. }]);
  2763. return Alert;
  2764. }();
  2765. /**
  2766. * ------------------------------------------------------------------------
  2767. * Data Api implementation
  2768. * ------------------------------------------------------------------------
  2769. */
  2770. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2771. /**
  2772. * ------------------------------------------------------------------------
  2773. * jQuery
  2774. * ------------------------------------------------------------------------
  2775. */
  2776. $.fn[NAME] = Alert._jQueryInterface;
  2777. $.fn[NAME].Constructor = Alert;
  2778. $.fn[NAME].noConflict = function () {
  2779. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2780. return Alert._jQueryInterface;
  2781. };
  2782. /**
  2783. * ------------------------------------------------------------------------
  2784. * Constants
  2785. * ------------------------------------------------------------------------
  2786. */
  2787. var NAME$1 = 'button';
  2788. var VERSION$1 = '4.4.1';
  2789. var DATA_KEY$1 = 'bs.button';
  2790. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2791. var DATA_API_KEY$1 = '.data-api';
  2792. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2793. var ClassName$1 = {
  2794. ACTIVE: 'active',
  2795. BUTTON: 'btn',
  2796. FOCUS: 'focus'
  2797. };
  2798. var Selector$1 = {
  2799. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2800. DATA_TOGGLES: '[data-toggle="buttons"]',
  2801. DATA_TOGGLE: '[data-toggle="button"]',
  2802. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2803. INPUT: 'input:not([type="hidden"])',
  2804. ACTIVE: '.active',
  2805. BUTTON: '.btn'
  2806. };
  2807. var Event$1 = {
  2808. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2809. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2810. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2811. };
  2812. /**
  2813. * ------------------------------------------------------------------------
  2814. * Class Definition
  2815. * ------------------------------------------------------------------------
  2816. */
  2817. var Button =
  2818. /*#__PURE__*/
  2819. function () {
  2820. function Button(element) {
  2821. this._element = element;
  2822. } // Getters
  2823. var _proto = Button.prototype;
  2824. // Public
  2825. _proto.toggle = function toggle() {
  2826. var triggerChangeEvent = true;
  2827. var addAriaPressed = true;
  2828. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2829. if (rootElement) {
  2830. var input = this._element.querySelector(Selector$1.INPUT);
  2831. if (input) {
  2832. if (input.type === 'radio') {
  2833. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2834. triggerChangeEvent = false;
  2835. } else {
  2836. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2837. if (activeElement) {
  2838. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2839. }
  2840. }
  2841. } else if (input.type === 'checkbox') {
  2842. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2843. triggerChangeEvent = false;
  2844. }
  2845. } else {
  2846. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2847. triggerChangeEvent = false;
  2848. }
  2849. if (triggerChangeEvent) {
  2850. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2851. $(input).trigger('change');
  2852. }
  2853. input.focus();
  2854. addAriaPressed = false;
  2855. }
  2856. }
  2857. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2858. if (addAriaPressed) {
  2859. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2860. }
  2861. if (triggerChangeEvent) {
  2862. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2863. }
  2864. }
  2865. };
  2866. _proto.dispose = function dispose() {
  2867. $.removeData(this._element, DATA_KEY$1);
  2868. this._element = null;
  2869. } // Static
  2870. ;
  2871. Button._jQueryInterface = function _jQueryInterface(config) {
  2872. return this.each(function () {
  2873. var data = $(this).data(DATA_KEY$1);
  2874. if (!data) {
  2875. data = new Button(this);
  2876. $(this).data(DATA_KEY$1, data);
  2877. }
  2878. if (config === 'toggle') {
  2879. data[config]();
  2880. }
  2881. });
  2882. };
  2883. _createClass(Button, null, [{
  2884. key: "VERSION",
  2885. get: function get() {
  2886. return VERSION$1;
  2887. }
  2888. }]);
  2889. return Button;
  2890. }();
  2891. /**
  2892. * ------------------------------------------------------------------------
  2893. * Data Api implementation
  2894. * ------------------------------------------------------------------------
  2895. */
  2896. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2897. var button = event.target;
  2898. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2899. button = $(button).closest(Selector$1.BUTTON)[0];
  2900. }
  2901. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2902. event.preventDefault(); // work around Firefox bug #1540995
  2903. } else {
  2904. var inputBtn = button.querySelector(Selector$1.INPUT);
  2905. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2906. event.preventDefault(); // work around Firefox bug #1540995
  2907. return;
  2908. }
  2909. Button._jQueryInterface.call($(button), 'toggle');
  2910. }
  2911. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2912. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2913. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2914. });
  2915. $(window).on(Event$1.LOAD_DATA_API, function () {
  2916. // ensure correct active class is set to match the controls' actual values/states
  2917. // find all checkboxes/readio buttons inside data-toggle groups
  2918. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2919. for (var i = 0, len = buttons.length; i < len; i++) {
  2920. var button = buttons[i];
  2921. var input = button.querySelector(Selector$1.INPUT);
  2922. if (input.checked || input.hasAttribute('checked')) {
  2923. button.classList.add(ClassName$1.ACTIVE);
  2924. } else {
  2925. button.classList.remove(ClassName$1.ACTIVE);
  2926. }
  2927. } // find all button toggles
  2928. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2929. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2930. var _button = buttons[_i];
  2931. if (_button.getAttribute('aria-pressed') === 'true') {
  2932. _button.classList.add(ClassName$1.ACTIVE);
  2933. } else {
  2934. _button.classList.remove(ClassName$1.ACTIVE);
  2935. }
  2936. }
  2937. });
  2938. /**
  2939. * ------------------------------------------------------------------------
  2940. * jQuery
  2941. * ------------------------------------------------------------------------
  2942. */
  2943. $.fn[NAME$1] = Button._jQueryInterface;
  2944. $.fn[NAME$1].Constructor = Button;
  2945. $.fn[NAME$1].noConflict = function () {
  2946. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2947. return Button._jQueryInterface;
  2948. };
  2949. /**
  2950. * ------------------------------------------------------------------------
  2951. * Constants
  2952. * ------------------------------------------------------------------------
  2953. */
  2954. var NAME$2 = 'carousel';
  2955. var VERSION$2 = '4.4.1';
  2956. var DATA_KEY$2 = 'bs.carousel';
  2957. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2958. var DATA_API_KEY$2 = '.data-api';
  2959. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2960. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2961. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2962. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2963. var SWIPE_THRESHOLD = 40;
  2964. var Default = {
  2965. interval: 5000,
  2966. keyboard: true,
  2967. slide: false,
  2968. pause: 'hover',
  2969. wrap: true,
  2970. touch: true
  2971. };
  2972. var DefaultType = {
  2973. interval: '(number|boolean)',
  2974. keyboard: 'boolean',
  2975. slide: '(boolean|string)',
  2976. pause: '(string|boolean)',
  2977. wrap: 'boolean',
  2978. touch: 'boolean'
  2979. };
  2980. var Direction = {
  2981. NEXT: 'next',
  2982. PREV: 'prev',
  2983. LEFT: 'left',
  2984. RIGHT: 'right'
  2985. };
  2986. var Event$2 = {
  2987. SLIDE: "slide" + EVENT_KEY$2,
  2988. SLID: "slid" + EVENT_KEY$2,
  2989. KEYDOWN: "keydown" + EVENT_KEY$2,
  2990. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  2991. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  2992. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  2993. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  2994. TOUCHEND: "touchend" + EVENT_KEY$2,
  2995. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  2996. POINTERUP: "pointerup" + EVENT_KEY$2,
  2997. DRAG_START: "dragstart" + EVENT_KEY$2,
  2998. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  2999. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3000. };
  3001. var ClassName$2 = {
  3002. CAROUSEL: 'carousel',
  3003. ACTIVE: 'active',
  3004. SLIDE: 'slide',
  3005. RIGHT: 'carousel-item-right',
  3006. LEFT: 'carousel-item-left',
  3007. NEXT: 'carousel-item-next',
  3008. PREV: 'carousel-item-prev',
  3009. ITEM: 'carousel-item',
  3010. POINTER_EVENT: 'pointer-event'
  3011. };
  3012. var Selector$2 = {
  3013. ACTIVE: '.active',
  3014. ACTIVE_ITEM: '.active.carousel-item',
  3015. ITEM: '.carousel-item',
  3016. ITEM_IMG: '.carousel-item img',
  3017. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3018. INDICATORS: '.carousel-indicators',
  3019. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3020. DATA_RIDE: '[data-ride="carousel"]'
  3021. };
  3022. var PointerType = {
  3023. TOUCH: 'touch',
  3024. PEN: 'pen'
  3025. };
  3026. /**
  3027. * ------------------------------------------------------------------------
  3028. * Class Definition
  3029. * ------------------------------------------------------------------------
  3030. */
  3031. var Carousel =
  3032. /*#__PURE__*/
  3033. function () {
  3034. function Carousel(element, config) {
  3035. this._items = null;
  3036. this._interval = null;
  3037. this._activeElement = null;
  3038. this._isPaused = false;
  3039. this._isSliding = false;
  3040. this.touchTimeout = null;
  3041. this.touchStartX = 0;
  3042. this.touchDeltaX = 0;
  3043. this._config = this._getConfig(config);
  3044. this._element = element;
  3045. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3046. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3047. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3048. this._addEventListeners();
  3049. } // Getters
  3050. var _proto = Carousel.prototype;
  3051. // Public
  3052. _proto.next = function next() {
  3053. if (!this._isSliding) {
  3054. this._slide(Direction.NEXT);
  3055. }
  3056. };
  3057. _proto.nextWhenVisible = function nextWhenVisible() {
  3058. // Don't call next when the page isn't visible
  3059. // or the carousel or its parent isn't visible
  3060. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3061. this.next();
  3062. }
  3063. };
  3064. _proto.prev = function prev() {
  3065. if (!this._isSliding) {
  3066. this._slide(Direction.PREV);
  3067. }
  3068. };
  3069. _proto.pause = function pause(event) {
  3070. if (!event) {
  3071. this._isPaused = true;
  3072. }
  3073. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3074. Util.triggerTransitionEnd(this._element);
  3075. this.cycle(true);
  3076. }
  3077. clearInterval(this._interval);
  3078. this._interval = null;
  3079. };
  3080. _proto.cycle = function cycle(event) {
  3081. if (!event) {
  3082. this._isPaused = false;
  3083. }
  3084. if (this._interval) {
  3085. clearInterval(this._interval);
  3086. this._interval = null;
  3087. }
  3088. if (this._config.interval && !this._isPaused) {
  3089. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3090. }
  3091. };
  3092. _proto.to = function to(index) {
  3093. var _this = this;
  3094. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3095. var activeIndex = this._getItemIndex(this._activeElement);
  3096. if (index > this._items.length - 1 || index < 0) {
  3097. return;
  3098. }
  3099. if (this._isSliding) {
  3100. $(this._element).one(Event$2.SLID, function () {
  3101. return _this.to(index);
  3102. });
  3103. return;
  3104. }
  3105. if (activeIndex === index) {
  3106. this.pause();
  3107. this.cycle();
  3108. return;
  3109. }
  3110. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3111. this._slide(direction, this._items[index]);
  3112. };
  3113. _proto.dispose = function dispose() {
  3114. $(this._element).off(EVENT_KEY$2);
  3115. $.removeData(this._element, DATA_KEY$2);
  3116. this._items = null;
  3117. this._config = null;
  3118. this._element = null;
  3119. this._interval = null;
  3120. this._isPaused = null;
  3121. this._isSliding = null;
  3122. this._activeElement = null;
  3123. this._indicatorsElement = null;
  3124. } // Private
  3125. ;
  3126. _proto._getConfig = function _getConfig(config) {
  3127. config = _objectSpread2({}, Default, {}, config);
  3128. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3129. return config;
  3130. };
  3131. _proto._handleSwipe = function _handleSwipe() {
  3132. var absDeltax = Math.abs(this.touchDeltaX);
  3133. if (absDeltax <= SWIPE_THRESHOLD) {
  3134. return;
  3135. }
  3136. var direction = absDeltax / this.touchDeltaX;
  3137. this.touchDeltaX = 0; // swipe left
  3138. if (direction > 0) {
  3139. this.prev();
  3140. } // swipe right
  3141. if (direction < 0) {
  3142. this.next();
  3143. }
  3144. };
  3145. _proto._addEventListeners = function _addEventListeners() {
  3146. var _this2 = this;
  3147. if (this._config.keyboard) {
  3148. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3149. return _this2._keydown(event);
  3150. });
  3151. }
  3152. if (this._config.pause === 'hover') {
  3153. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3154. return _this2.pause(event);
  3155. }).on(Event$2.MOUSELEAVE, function (event) {
  3156. return _this2.cycle(event);
  3157. });
  3158. }
  3159. if (this._config.touch) {
  3160. this._addTouchEventListeners();
  3161. }
  3162. };
  3163. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3164. var _this3 = this;
  3165. if (!this._touchSupported) {
  3166. return;
  3167. }
  3168. var start = function start(event) {
  3169. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3170. _this3.touchStartX = event.originalEvent.clientX;
  3171. } else if (!_this3._pointerEvent) {
  3172. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3173. }
  3174. };
  3175. var move = function move(event) {
  3176. // ensure swiping with one touch and not pinching
  3177. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3178. _this3.touchDeltaX = 0;
  3179. } else {
  3180. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3181. }
  3182. };
  3183. var end = function end(event) {
  3184. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3185. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3186. }
  3187. _this3._handleSwipe();
  3188. if (_this3._config.pause === 'hover') {
  3189. // If it's a touch-enabled device, mouseenter/leave are fired as
  3190. // part of the mouse compatibility events on first tap - the carousel
  3191. // would stop cycling until user tapped out of it;
  3192. // here, we listen for touchend, explicitly pause the carousel
  3193. // (as if it's the second time we tap on it, mouseenter compat event
  3194. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3195. // events to fire) we explicitly restart cycling
  3196. _this3.pause();
  3197. if (_this3.touchTimeout) {
  3198. clearTimeout(_this3.touchTimeout);
  3199. }
  3200. _this3.touchTimeout = setTimeout(function (event) {
  3201. return _this3.cycle(event);
  3202. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3203. }
  3204. };
  3205. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3206. return e.preventDefault();
  3207. });
  3208. if (this._pointerEvent) {
  3209. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3210. return start(event);
  3211. });
  3212. $(this._element).on(Event$2.POINTERUP, function (event) {
  3213. return end(event);
  3214. });
  3215. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3216. } else {
  3217. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3218. return start(event);
  3219. });
  3220. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3221. return move(event);
  3222. });
  3223. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3224. return end(event);
  3225. });
  3226. }
  3227. };
  3228. _proto._keydown = function _keydown(event) {
  3229. if (/input|textarea/i.test(event.target.tagName)) {
  3230. return;
  3231. }
  3232. switch (event.which) {
  3233. case ARROW_LEFT_KEYCODE:
  3234. event.preventDefault();
  3235. this.prev();
  3236. break;
  3237. case ARROW_RIGHT_KEYCODE:
  3238. event.preventDefault();
  3239. this.next();
  3240. break;
  3241. }
  3242. };
  3243. _proto._getItemIndex = function _getItemIndex(element) {
  3244. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3245. return this._items.indexOf(element);
  3246. };
  3247. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3248. var isNextDirection = direction === Direction.NEXT;
  3249. var isPrevDirection = direction === Direction.PREV;
  3250. var activeIndex = this._getItemIndex(activeElement);
  3251. var lastItemIndex = this._items.length - 1;
  3252. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3253. if (isGoingToWrap && !this._config.wrap) {
  3254. return activeElement;
  3255. }
  3256. var delta = direction === Direction.PREV ? -1 : 1;
  3257. var itemIndex = (activeIndex + delta) % this._items.length;
  3258. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3259. };
  3260. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3261. var targetIndex = this._getItemIndex(relatedTarget);
  3262. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3263. var slideEvent = $.Event(Event$2.SLIDE, {
  3264. relatedTarget: relatedTarget,
  3265. direction: eventDirectionName,
  3266. from: fromIndex,
  3267. to: targetIndex
  3268. });
  3269. $(this._element).trigger(slideEvent);
  3270. return slideEvent;
  3271. };
  3272. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3273. if (this._indicatorsElement) {
  3274. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3275. $(indicators).removeClass(ClassName$2.ACTIVE);
  3276. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3277. if (nextIndicator) {
  3278. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3279. }
  3280. }
  3281. };
  3282. _proto._slide = function _slide(direction, element) {
  3283. var _this4 = this;
  3284. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3285. var activeElementIndex = this._getItemIndex(activeElement);
  3286. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3287. var nextElementIndex = this._getItemIndex(nextElement);
  3288. var isCycling = Boolean(this._interval);
  3289. var directionalClassName;
  3290. var orderClassName;
  3291. var eventDirectionName;
  3292. if (direction === Direction.NEXT) {
  3293. directionalClassName = ClassName$2.LEFT;
  3294. orderClassName = ClassName$2.NEXT;
  3295. eventDirectionName = Direction.LEFT;
  3296. } else {
  3297. directionalClassName = ClassName$2.RIGHT;
  3298. orderClassName = ClassName$2.PREV;
  3299. eventDirectionName = Direction.RIGHT;
  3300. }
  3301. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3302. this._isSliding = false;
  3303. return;
  3304. }
  3305. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3306. if (slideEvent.isDefaultPrevented()) {
  3307. return;
  3308. }
  3309. if (!activeElement || !nextElement) {
  3310. // Some weirdness is happening, so we bail
  3311. return;
  3312. }
  3313. this._isSliding = true;
  3314. if (isCycling) {
  3315. this.pause();
  3316. }
  3317. this._setActiveIndicatorElement(nextElement);
  3318. var slidEvent = $.Event(Event$2.SLID, {
  3319. relatedTarget: nextElement,
  3320. direction: eventDirectionName,
  3321. from: activeElementIndex,
  3322. to: nextElementIndex
  3323. });
  3324. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3325. $(nextElement).addClass(orderClassName);
  3326. Util.reflow(nextElement);
  3327. $(activeElement).addClass(directionalClassName);
  3328. $(nextElement).addClass(directionalClassName);
  3329. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3330. if (nextElementInterval) {
  3331. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3332. this._config.interval = nextElementInterval;
  3333. } else {
  3334. this._config.interval = this._config.defaultInterval || this._config.interval;
  3335. }
  3336. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3337. $(activeElement).one(Util.TRANSITION_END, function () {
  3338. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3339. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3340. _this4._isSliding = false;
  3341. setTimeout(function () {
  3342. return $(_this4._element).trigger(slidEvent);
  3343. }, 0);
  3344. }).emulateTransitionEnd(transitionDuration);
  3345. } else {
  3346. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3347. $(nextElement).addClass(ClassName$2.ACTIVE);
  3348. this._isSliding = false;
  3349. $(this._element).trigger(slidEvent);
  3350. }
  3351. if (isCycling) {
  3352. this.cycle();
  3353. }
  3354. } // Static
  3355. ;
  3356. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3357. return this.each(function () {
  3358. var data = $(this).data(DATA_KEY$2);
  3359. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3360. if (typeof config === 'object') {
  3361. _config = _objectSpread2({}, _config, {}, config);
  3362. }
  3363. var action = typeof config === 'string' ? config : _config.slide;
  3364. if (!data) {
  3365. data = new Carousel(this, _config);
  3366. $(this).data(DATA_KEY$2, data);
  3367. }
  3368. if (typeof config === 'number') {
  3369. data.to(config);
  3370. } else if (typeof action === 'string') {
  3371. if (typeof data[action] === 'undefined') {
  3372. throw new TypeError("No method named \"" + action + "\"");
  3373. }
  3374. data[action]();
  3375. } else if (_config.interval && _config.ride) {
  3376. data.pause();
  3377. data.cycle();
  3378. }
  3379. });
  3380. };
  3381. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3382. var selector = Util.getSelectorFromElement(this);
  3383. if (!selector) {
  3384. return;
  3385. }
  3386. var target = $(selector)[0];
  3387. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3388. return;
  3389. }
  3390. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3391. var slideIndex = this.getAttribute('data-slide-to');
  3392. if (slideIndex) {
  3393. config.interval = false;
  3394. }
  3395. Carousel._jQueryInterface.call($(target), config);
  3396. if (slideIndex) {
  3397. $(target).data(DATA_KEY$2).to(slideIndex);
  3398. }
  3399. event.preventDefault();
  3400. };
  3401. _createClass(Carousel, null, [{
  3402. key: "VERSION",
  3403. get: function get() {
  3404. return VERSION$2;
  3405. }
  3406. }, {
  3407. key: "Default",
  3408. get: function get() {
  3409. return Default;
  3410. }
  3411. }]);
  3412. return Carousel;
  3413. }();
  3414. /**
  3415. * ------------------------------------------------------------------------
  3416. * Data Api implementation
  3417. * ------------------------------------------------------------------------
  3418. */
  3419. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3420. $(window).on(Event$2.LOAD_DATA_API, function () {
  3421. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3422. for (var i = 0, len = carousels.length; i < len; i++) {
  3423. var $carousel = $(carousels[i]);
  3424. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3425. }
  3426. });
  3427. /**
  3428. * ------------------------------------------------------------------------
  3429. * jQuery
  3430. * ------------------------------------------------------------------------
  3431. */
  3432. $.fn[NAME$2] = Carousel._jQueryInterface;
  3433. $.fn[NAME$2].Constructor = Carousel;
  3434. $.fn[NAME$2].noConflict = function () {
  3435. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3436. return Carousel._jQueryInterface;
  3437. };
  3438. /**
  3439. * ------------------------------------------------------------------------
  3440. * Constants
  3441. * ------------------------------------------------------------------------
  3442. */
  3443. var NAME$3 = 'collapse';
  3444. var VERSION$3 = '4.4.1';
  3445. var DATA_KEY$3 = 'bs.collapse';
  3446. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3447. var DATA_API_KEY$3 = '.data-api';
  3448. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3449. var Default$1 = {
  3450. toggle: true,
  3451. parent: ''
  3452. };
  3453. var DefaultType$1 = {
  3454. toggle: 'boolean',
  3455. parent: '(string|element)'
  3456. };
  3457. var Event$3 = {
  3458. SHOW: "show" + EVENT_KEY$3,
  3459. SHOWN: "shown" + EVENT_KEY$3,
  3460. HIDE: "hide" + EVENT_KEY$3,
  3461. HIDDEN: "hidden" + EVENT_KEY$3,
  3462. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3463. };
  3464. var ClassName$3 = {
  3465. SHOW: 'show',
  3466. COLLAPSE: 'collapse',
  3467. COLLAPSING: 'collapsing',
  3468. COLLAPSED: 'collapsed'
  3469. };
  3470. var Dimension = {
  3471. WIDTH: 'width',
  3472. HEIGHT: 'height'
  3473. };
  3474. var Selector$3 = {
  3475. ACTIVES: '.show, .collapsing',
  3476. DATA_TOGGLE: '[data-toggle="collapse"]'
  3477. };
  3478. /**
  3479. * ------------------------------------------------------------------------
  3480. * Class Definition
  3481. * ------------------------------------------------------------------------
  3482. */
  3483. var Collapse =
  3484. /*#__PURE__*/
  3485. function () {
  3486. function Collapse(element, config) {
  3487. this._isTransitioning = false;
  3488. this._element = element;
  3489. this._config = this._getConfig(config);
  3490. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3491. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3492. for (var i = 0, len = toggleList.length; i < len; i++) {
  3493. var elem = toggleList[i];
  3494. var selector = Util.getSelectorFromElement(elem);
  3495. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3496. return foundElem === element;
  3497. });
  3498. if (selector !== null && filterElement.length > 0) {
  3499. this._selector = selector;
  3500. this._triggerArray.push(elem);
  3501. }
  3502. }
  3503. this._parent = this._config.parent ? this._getParent() : null;
  3504. if (!this._config.parent) {
  3505. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3506. }
  3507. if (this._config.toggle) {
  3508. this.toggle();
  3509. }
  3510. } // Getters
  3511. var _proto = Collapse.prototype;
  3512. // Public
  3513. _proto.toggle = function toggle() {
  3514. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3515. this.hide();
  3516. } else {
  3517. this.show();
  3518. }
  3519. };
  3520. _proto.show = function show() {
  3521. var _this = this;
  3522. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3523. return;
  3524. }
  3525. var actives;
  3526. var activesData;
  3527. if (this._parent) {
  3528. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3529. if (typeof _this._config.parent === 'string') {
  3530. return elem.getAttribute('data-parent') === _this._config.parent;
  3531. }
  3532. return elem.classList.contains(ClassName$3.COLLAPSE);
  3533. });
  3534. if (actives.length === 0) {
  3535. actives = null;
  3536. }
  3537. }
  3538. if (actives) {
  3539. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3540. if (activesData && activesData._isTransitioning) {
  3541. return;
  3542. }
  3543. }
  3544. var startEvent = $.Event(Event$3.SHOW);
  3545. $(this._element).trigger(startEvent);
  3546. if (startEvent.isDefaultPrevented()) {
  3547. return;
  3548. }
  3549. if (actives) {
  3550. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3551. if (!activesData) {
  3552. $(actives).data(DATA_KEY$3, null);
  3553. }
  3554. }
  3555. var dimension = this._getDimension();
  3556. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3557. this._element.style[dimension] = 0;
  3558. if (this._triggerArray.length) {
  3559. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3560. }
  3561. this.setTransitioning(true);
  3562. var complete = function complete() {
  3563. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3564. _this._element.style[dimension] = '';
  3565. _this.setTransitioning(false);
  3566. $(_this._element).trigger(Event$3.SHOWN);
  3567. };
  3568. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3569. var scrollSize = "scroll" + capitalizedDimension;
  3570. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3571. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3572. this._element.style[dimension] = this._element[scrollSize] + "px";
  3573. };
  3574. _proto.hide = function hide() {
  3575. var _this2 = this;
  3576. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3577. return;
  3578. }
  3579. var startEvent = $.Event(Event$3.HIDE);
  3580. $(this._element).trigger(startEvent);
  3581. if (startEvent.isDefaultPrevented()) {
  3582. return;
  3583. }
  3584. var dimension = this._getDimension();
  3585. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3586. Util.reflow(this._element);
  3587. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3588. var triggerArrayLength = this._triggerArray.length;
  3589. if (triggerArrayLength > 0) {
  3590. for (var i = 0; i < triggerArrayLength; i++) {
  3591. var trigger = this._triggerArray[i];
  3592. var selector = Util.getSelectorFromElement(trigger);
  3593. if (selector !== null) {
  3594. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3595. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3596. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3597. }
  3598. }
  3599. }
  3600. }
  3601. this.setTransitioning(true);
  3602. var complete = function complete() {
  3603. _this2.setTransitioning(false);
  3604. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3605. };
  3606. this._element.style[dimension] = '';
  3607. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3608. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3609. };
  3610. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3611. this._isTransitioning = isTransitioning;
  3612. };
  3613. _proto.dispose = function dispose() {
  3614. $.removeData(this._element, DATA_KEY$3);
  3615. this._config = null;
  3616. this._parent = null;
  3617. this._element = null;
  3618. this._triggerArray = null;
  3619. this._isTransitioning = null;
  3620. } // Private
  3621. ;
  3622. _proto._getConfig = function _getConfig(config) {
  3623. config = _objectSpread2({}, Default$1, {}, config);
  3624. config.toggle = Boolean(config.toggle); // Coerce string values
  3625. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3626. return config;
  3627. };
  3628. _proto._getDimension = function _getDimension() {
  3629. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3630. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3631. };
  3632. _proto._getParent = function _getParent() {
  3633. var _this3 = this;
  3634. var parent;
  3635. if (Util.isElement(this._config.parent)) {
  3636. parent = this._config.parent; // It's a jQuery object
  3637. if (typeof this._config.parent.jquery !== 'undefined') {
  3638. parent = this._config.parent[0];
  3639. }
  3640. } else {
  3641. parent = document.querySelector(this._config.parent);
  3642. }
  3643. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3644. var children = [].slice.call(parent.querySelectorAll(selector));
  3645. $(children).each(function (i, element) {
  3646. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3647. });
  3648. return parent;
  3649. };
  3650. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3651. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3652. if (triggerArray.length) {
  3653. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3654. }
  3655. } // Static
  3656. ;
  3657. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3658. var selector = Util.getSelectorFromElement(element);
  3659. return selector ? document.querySelector(selector) : null;
  3660. };
  3661. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3662. return this.each(function () {
  3663. var $this = $(this);
  3664. var data = $this.data(DATA_KEY$3);
  3665. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3666. if (!data && _config.toggle && /show|hide/.test(config)) {
  3667. _config.toggle = false;
  3668. }
  3669. if (!data) {
  3670. data = new Collapse(this, _config);
  3671. $this.data(DATA_KEY$3, data);
  3672. }
  3673. if (typeof config === 'string') {
  3674. if (typeof data[config] === 'undefined') {
  3675. throw new TypeError("No method named \"" + config + "\"");
  3676. }
  3677. data[config]();
  3678. }
  3679. });
  3680. };
  3681. _createClass(Collapse, null, [{
  3682. key: "VERSION",
  3683. get: function get() {
  3684. return VERSION$3;
  3685. }
  3686. }, {
  3687. key: "Default",
  3688. get: function get() {
  3689. return Default$1;
  3690. }
  3691. }]);
  3692. return Collapse;
  3693. }();
  3694. /**
  3695. * ------------------------------------------------------------------------
  3696. * Data Api implementation
  3697. * ------------------------------------------------------------------------
  3698. */
  3699. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3700. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3701. if (event.currentTarget.tagName === 'A') {
  3702. event.preventDefault();
  3703. }
  3704. var $trigger = $(this);
  3705. var selector = Util.getSelectorFromElement(this);
  3706. var selectors = [].slice.call(document.querySelectorAll(selector));
  3707. $(selectors).each(function () {
  3708. var $target = $(this);
  3709. var data = $target.data(DATA_KEY$3);
  3710. var config = data ? 'toggle' : $trigger.data();
  3711. Collapse._jQueryInterface.call($target, config);
  3712. });
  3713. });
  3714. /**
  3715. * ------------------------------------------------------------------------
  3716. * jQuery
  3717. * ------------------------------------------------------------------------
  3718. */
  3719. $.fn[NAME$3] = Collapse._jQueryInterface;
  3720. $.fn[NAME$3].Constructor = Collapse;
  3721. $.fn[NAME$3].noConflict = function () {
  3722. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3723. return Collapse._jQueryInterface;
  3724. };
  3725. /**
  3726. * ------------------------------------------------------------------------
  3727. * Constants
  3728. * ------------------------------------------------------------------------
  3729. */
  3730. var NAME$4 = 'dropdown';
  3731. var VERSION$4 = '4.4.1';
  3732. var DATA_KEY$4 = 'bs.dropdown';
  3733. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3734. var DATA_API_KEY$4 = '.data-api';
  3735. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3736. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3737. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3738. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3739. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3740. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3741. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3742. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3743. var Event$4 = {
  3744. HIDE: "hide" + EVENT_KEY$4,
  3745. HIDDEN: "hidden" + EVENT_KEY$4,
  3746. SHOW: "show" + EVENT_KEY$4,
  3747. SHOWN: "shown" + EVENT_KEY$4,
  3748. CLICK: "click" + EVENT_KEY$4,
  3749. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3750. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3751. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3752. };
  3753. var ClassName$4 = {
  3754. DISABLED: 'disabled',
  3755. SHOW: 'show',
  3756. DROPUP: 'dropup',
  3757. DROPRIGHT: 'dropright',
  3758. DROPLEFT: 'dropleft',
  3759. MENURIGHT: 'dropdown-menu-right',
  3760. MENULEFT: 'dropdown-menu-left',
  3761. POSITION_STATIC: 'position-static'
  3762. };
  3763. var Selector$4 = {
  3764. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3765. FORM_CHILD: '.dropdown form',
  3766. MENU: '.dropdown-menu',
  3767. NAVBAR_NAV: '.navbar-nav',
  3768. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3769. };
  3770. var AttachmentMap = {
  3771. TOP: 'top-start',
  3772. TOPEND: 'top-end',
  3773. BOTTOM: 'bottom-start',
  3774. BOTTOMEND: 'bottom-end',
  3775. RIGHT: 'right-start',
  3776. RIGHTEND: 'right-end',
  3777. LEFT: 'left-start',
  3778. LEFTEND: 'left-end'
  3779. };
  3780. var Default$2 = {
  3781. offset: 0,
  3782. flip: true,
  3783. boundary: 'scrollParent',
  3784. reference: 'toggle',
  3785. display: 'dynamic',
  3786. popperConfig: null
  3787. };
  3788. var DefaultType$2 = {
  3789. offset: '(number|string|function)',
  3790. flip: 'boolean',
  3791. boundary: '(string|element)',
  3792. reference: '(string|element)',
  3793. display: 'string',
  3794. popperConfig: '(null|object)'
  3795. };
  3796. /**
  3797. * ------------------------------------------------------------------------
  3798. * Class Definition
  3799. * ------------------------------------------------------------------------
  3800. */
  3801. var Dropdown =
  3802. /*#__PURE__*/
  3803. function () {
  3804. function Dropdown(element, config) {
  3805. this._element = element;
  3806. this._popper = null;
  3807. this._config = this._getConfig(config);
  3808. this._menu = this._getMenuElement();
  3809. this._inNavbar = this._detectNavbar();
  3810. this._addEventListeners();
  3811. } // Getters
  3812. var _proto = Dropdown.prototype;
  3813. // Public
  3814. _proto.toggle = function toggle() {
  3815. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3816. return;
  3817. }
  3818. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3819. Dropdown._clearMenus();
  3820. if (isActive) {
  3821. return;
  3822. }
  3823. this.show(true);
  3824. };
  3825. _proto.show = function show(usePopper) {
  3826. if (usePopper === void 0) {
  3827. usePopper = false;
  3828. }
  3829. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3830. return;
  3831. }
  3832. var relatedTarget = {
  3833. relatedTarget: this._element
  3834. };
  3835. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3836. var parent = Dropdown._getParentFromElement(this._element);
  3837. $(parent).trigger(showEvent);
  3838. if (showEvent.isDefaultPrevented()) {
  3839. return;
  3840. } // Disable totally Popper.js for Dropdown in Navbar
  3841. if (!this._inNavbar && usePopper) {
  3842. /**
  3843. * Check for Popper dependency
  3844. * Popper - https://popper.js.org
  3845. */
  3846. if (typeof Popper === 'undefined') {
  3847. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3848. }
  3849. var referenceElement = this._element;
  3850. if (this._config.reference === 'parent') {
  3851. referenceElement = parent;
  3852. } else if (Util.isElement(this._config.reference)) {
  3853. referenceElement = this._config.reference; // Check if it's jQuery element
  3854. if (typeof this._config.reference.jquery !== 'undefined') {
  3855. referenceElement = this._config.reference[0];
  3856. }
  3857. } // If boundary is not `scrollParent`, then set position to `static`
  3858. // to allow the menu to "escape" the scroll parent's boundaries
  3859. // https://github.com/twbs/bootstrap/issues/24251
  3860. if (this._config.boundary !== 'scrollParent') {
  3861. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3862. }
  3863. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3864. } // If this is a touch-enabled device we add extra
  3865. // empty mouseover listeners to the body's immediate children;
  3866. // only needed because of broken event delegation on iOS
  3867. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3868. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3869. $(document.body).children().on('mouseover', null, $.noop);
  3870. }
  3871. this._element.focus();
  3872. this._element.setAttribute('aria-expanded', true);
  3873. $(this._menu).toggleClass(ClassName$4.SHOW);
  3874. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3875. };
  3876. _proto.hide = function hide() {
  3877. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3878. return;
  3879. }
  3880. var relatedTarget = {
  3881. relatedTarget: this._element
  3882. };
  3883. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3884. var parent = Dropdown._getParentFromElement(this._element);
  3885. $(parent).trigger(hideEvent);
  3886. if (hideEvent.isDefaultPrevented()) {
  3887. return;
  3888. }
  3889. if (this._popper) {
  3890. this._popper.destroy();
  3891. }
  3892. $(this._menu).toggleClass(ClassName$4.SHOW);
  3893. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3894. };
  3895. _proto.dispose = function dispose() {
  3896. $.removeData(this._element, DATA_KEY$4);
  3897. $(this._element).off(EVENT_KEY$4);
  3898. this._element = null;
  3899. this._menu = null;
  3900. if (this._popper !== null) {
  3901. this._popper.destroy();
  3902. this._popper = null;
  3903. }
  3904. };
  3905. _proto.update = function update() {
  3906. this._inNavbar = this._detectNavbar();
  3907. if (this._popper !== null) {
  3908. this._popper.scheduleUpdate();
  3909. }
  3910. } // Private
  3911. ;
  3912. _proto._addEventListeners = function _addEventListeners() {
  3913. var _this = this;
  3914. $(this._element).on(Event$4.CLICK, function (event) {
  3915. event.preventDefault();
  3916. event.stopPropagation();
  3917. _this.toggle();
  3918. });
  3919. };
  3920. _proto._getConfig = function _getConfig(config) {
  3921. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3922. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3923. return config;
  3924. };
  3925. _proto._getMenuElement = function _getMenuElement() {
  3926. if (!this._menu) {
  3927. var parent = Dropdown._getParentFromElement(this._element);
  3928. if (parent) {
  3929. this._menu = parent.querySelector(Selector$4.MENU);
  3930. }
  3931. }
  3932. return this._menu;
  3933. };
  3934. _proto._getPlacement = function _getPlacement() {
  3935. var $parentDropdown = $(this._element.parentNode);
  3936. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3937. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3938. placement = AttachmentMap.TOP;
  3939. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3940. placement = AttachmentMap.TOPEND;
  3941. }
  3942. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3943. placement = AttachmentMap.RIGHT;
  3944. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3945. placement = AttachmentMap.LEFT;
  3946. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3947. placement = AttachmentMap.BOTTOMEND;
  3948. }
  3949. return placement;
  3950. };
  3951. _proto._detectNavbar = function _detectNavbar() {
  3952. return $(this._element).closest('.navbar').length > 0;
  3953. };
  3954. _proto._getOffset = function _getOffset() {
  3955. var _this2 = this;
  3956. var offset = {};
  3957. if (typeof this._config.offset === 'function') {
  3958. offset.fn = function (data) {
  3959. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3960. return data;
  3961. };
  3962. } else {
  3963. offset.offset = this._config.offset;
  3964. }
  3965. return offset;
  3966. };
  3967. _proto._getPopperConfig = function _getPopperConfig() {
  3968. var popperConfig = {
  3969. placement: this._getPlacement(),
  3970. modifiers: {
  3971. offset: this._getOffset(),
  3972. flip: {
  3973. enabled: this._config.flip
  3974. },
  3975. preventOverflow: {
  3976. boundariesElement: this._config.boundary
  3977. }
  3978. }
  3979. }; // Disable Popper.js if we have a static display
  3980. if (this._config.display === 'static') {
  3981. popperConfig.modifiers.applyStyle = {
  3982. enabled: false
  3983. };
  3984. }
  3985. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  3986. } // Static
  3987. ;
  3988. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  3989. return this.each(function () {
  3990. var data = $(this).data(DATA_KEY$4);
  3991. var _config = typeof config === 'object' ? config : null;
  3992. if (!data) {
  3993. data = new Dropdown(this, _config);
  3994. $(this).data(DATA_KEY$4, data);
  3995. }
  3996. if (typeof config === 'string') {
  3997. if (typeof data[config] === 'undefined') {
  3998. throw new TypeError("No method named \"" + config + "\"");
  3999. }
  4000. data[config]();
  4001. }
  4002. });
  4003. };
  4004. Dropdown._clearMenus = function _clearMenus(event) {
  4005. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4006. return;
  4007. }
  4008. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4009. for (var i = 0, len = toggles.length; i < len; i++) {
  4010. var parent = Dropdown._getParentFromElement(toggles[i]);
  4011. var context = $(toggles[i]).data(DATA_KEY$4);
  4012. var relatedTarget = {
  4013. relatedTarget: toggles[i]
  4014. };
  4015. if (event && event.type === 'click') {
  4016. relatedTarget.clickEvent = event;
  4017. }
  4018. if (!context) {
  4019. continue;
  4020. }
  4021. var dropdownMenu = context._menu;
  4022. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4023. continue;
  4024. }
  4025. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4026. continue;
  4027. }
  4028. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4029. $(parent).trigger(hideEvent);
  4030. if (hideEvent.isDefaultPrevented()) {
  4031. continue;
  4032. } // If this is a touch-enabled device we remove the extra
  4033. // empty mouseover listeners we added for iOS support
  4034. if ('ontouchstart' in document.documentElement) {
  4035. $(document.body).children().off('mouseover', null, $.noop);
  4036. }
  4037. toggles[i].setAttribute('aria-expanded', 'false');
  4038. if (context._popper) {
  4039. context._popper.destroy();
  4040. }
  4041. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4042. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4043. }
  4044. };
  4045. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4046. var parent;
  4047. var selector = Util.getSelectorFromElement(element);
  4048. if (selector) {
  4049. parent = document.querySelector(selector);
  4050. }
  4051. return parent || element.parentNode;
  4052. } // eslint-disable-next-line complexity
  4053. ;
  4054. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4055. // If not input/textarea:
  4056. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4057. // If input/textarea:
  4058. // - If space key => not a dropdown command
  4059. // - If key is other than escape
  4060. // - If key is not up or down => not a dropdown command
  4061. // - If trigger inside the menu => not a dropdown command
  4062. 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)) {
  4063. return;
  4064. }
  4065. event.preventDefault();
  4066. event.stopPropagation();
  4067. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4068. return;
  4069. }
  4070. var parent = Dropdown._getParentFromElement(this);
  4071. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4072. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4073. return;
  4074. }
  4075. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4076. if (event.which === ESCAPE_KEYCODE) {
  4077. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4078. $(toggle).trigger('focus');
  4079. }
  4080. $(this).trigger('click');
  4081. return;
  4082. }
  4083. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4084. return $(item).is(':visible');
  4085. });
  4086. if (items.length === 0) {
  4087. return;
  4088. }
  4089. var index = items.indexOf(event.target);
  4090. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4091. // Up
  4092. index--;
  4093. }
  4094. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4095. // Down
  4096. index++;
  4097. }
  4098. if (index < 0) {
  4099. index = 0;
  4100. }
  4101. items[index].focus();
  4102. };
  4103. _createClass(Dropdown, null, [{
  4104. key: "VERSION",
  4105. get: function get() {
  4106. return VERSION$4;
  4107. }
  4108. }, {
  4109. key: "Default",
  4110. get: function get() {
  4111. return Default$2;
  4112. }
  4113. }, {
  4114. key: "DefaultType",
  4115. get: function get() {
  4116. return DefaultType$2;
  4117. }
  4118. }]);
  4119. return Dropdown;
  4120. }();
  4121. /**
  4122. * ------------------------------------------------------------------------
  4123. * Data Api implementation
  4124. * ------------------------------------------------------------------------
  4125. */
  4126. $(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) {
  4127. event.preventDefault();
  4128. event.stopPropagation();
  4129. Dropdown._jQueryInterface.call($(this), 'toggle');
  4130. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4131. e.stopPropagation();
  4132. });
  4133. /**
  4134. * ------------------------------------------------------------------------
  4135. * jQuery
  4136. * ------------------------------------------------------------------------
  4137. */
  4138. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4139. $.fn[NAME$4].Constructor = Dropdown;
  4140. $.fn[NAME$4].noConflict = function () {
  4141. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4142. return Dropdown._jQueryInterface;
  4143. };
  4144. /**
  4145. * ------------------------------------------------------------------------
  4146. * Constants
  4147. * ------------------------------------------------------------------------
  4148. */
  4149. var NAME$5 = 'modal';
  4150. var VERSION$5 = '4.4.1';
  4151. var DATA_KEY$5 = 'bs.modal';
  4152. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4153. var DATA_API_KEY$5 = '.data-api';
  4154. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4155. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4156. var Default$3 = {
  4157. backdrop: true,
  4158. keyboard: true,
  4159. focus: true,
  4160. show: true
  4161. };
  4162. var DefaultType$3 = {
  4163. backdrop: '(boolean|string)',
  4164. keyboard: 'boolean',
  4165. focus: 'boolean',
  4166. show: 'boolean'
  4167. };
  4168. var Event$5 = {
  4169. HIDE: "hide" + EVENT_KEY$5,
  4170. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4171. HIDDEN: "hidden" + EVENT_KEY$5,
  4172. SHOW: "show" + EVENT_KEY$5,
  4173. SHOWN: "shown" + EVENT_KEY$5,
  4174. FOCUSIN: "focusin" + EVENT_KEY$5,
  4175. RESIZE: "resize" + EVENT_KEY$5,
  4176. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4177. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4178. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4179. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4180. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4181. };
  4182. var ClassName$5 = {
  4183. SCROLLABLE: 'modal-dialog-scrollable',
  4184. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4185. BACKDROP: 'modal-backdrop',
  4186. OPEN: 'modal-open',
  4187. FADE: 'fade',
  4188. SHOW: 'show',
  4189. STATIC: 'modal-static'
  4190. };
  4191. var Selector$5 = {
  4192. DIALOG: '.modal-dialog',
  4193. MODAL_BODY: '.modal-body',
  4194. DATA_TOGGLE: '[data-toggle="modal"]',
  4195. DATA_DISMISS: '[data-dismiss="modal"]',
  4196. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4197. STICKY_CONTENT: '.sticky-top'
  4198. };
  4199. /**
  4200. * ------------------------------------------------------------------------
  4201. * Class Definition
  4202. * ------------------------------------------------------------------------
  4203. */
  4204. var Modal =
  4205. /*#__PURE__*/
  4206. function () {
  4207. function Modal(element, config) {
  4208. this._config = this._getConfig(config);
  4209. this._element = element;
  4210. this._dialog = element.querySelector(Selector$5.DIALOG);
  4211. this._backdrop = null;
  4212. this._isShown = false;
  4213. this._isBodyOverflowing = false;
  4214. this._ignoreBackdropClick = false;
  4215. this._isTransitioning = false;
  4216. this._scrollbarWidth = 0;
  4217. } // Getters
  4218. var _proto = Modal.prototype;
  4219. // Public
  4220. _proto.toggle = function toggle(relatedTarget) {
  4221. return this._isShown ? this.hide() : this.show(relatedTarget);
  4222. };
  4223. _proto.show = function show(relatedTarget) {
  4224. var _this = this;
  4225. if (this._isShown || this._isTransitioning) {
  4226. return;
  4227. }
  4228. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4229. this._isTransitioning = true;
  4230. }
  4231. var showEvent = $.Event(Event$5.SHOW, {
  4232. relatedTarget: relatedTarget
  4233. });
  4234. $(this._element).trigger(showEvent);
  4235. if (this._isShown || showEvent.isDefaultPrevented()) {
  4236. return;
  4237. }
  4238. this._isShown = true;
  4239. this._checkScrollbar();
  4240. this._setScrollbar();
  4241. this._adjustDialog();
  4242. this._setEscapeEvent();
  4243. this._setResizeEvent();
  4244. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4245. return _this.hide(event);
  4246. });
  4247. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4248. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4249. if ($(event.target).is(_this._element)) {
  4250. _this._ignoreBackdropClick = true;
  4251. }
  4252. });
  4253. });
  4254. this._showBackdrop(function () {
  4255. return _this._showElement(relatedTarget);
  4256. });
  4257. };
  4258. _proto.hide = function hide(event) {
  4259. var _this2 = this;
  4260. if (event) {
  4261. event.preventDefault();
  4262. }
  4263. if (!this._isShown || this._isTransitioning) {
  4264. return;
  4265. }
  4266. var hideEvent = $.Event(Event$5.HIDE);
  4267. $(this._element).trigger(hideEvent);
  4268. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4269. return;
  4270. }
  4271. this._isShown = false;
  4272. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4273. if (transition) {
  4274. this._isTransitioning = true;
  4275. }
  4276. this._setEscapeEvent();
  4277. this._setResizeEvent();
  4278. $(document).off(Event$5.FOCUSIN);
  4279. $(this._element).removeClass(ClassName$5.SHOW);
  4280. $(this._element).off(Event$5.CLICK_DISMISS);
  4281. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4282. if (transition) {
  4283. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4284. $(this._element).one(Util.TRANSITION_END, function (event) {
  4285. return _this2._hideModal(event);
  4286. }).emulateTransitionEnd(transitionDuration);
  4287. } else {
  4288. this._hideModal();
  4289. }
  4290. };
  4291. _proto.dispose = function dispose() {
  4292. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4293. return $(htmlElement).off(EVENT_KEY$5);
  4294. });
  4295. /**
  4296. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4297. * Do not move `document` in `htmlElements` array
  4298. * It will remove `Event.CLICK_DATA_API` event that should remain
  4299. */
  4300. $(document).off(Event$5.FOCUSIN);
  4301. $.removeData(this._element, DATA_KEY$5);
  4302. this._config = null;
  4303. this._element = null;
  4304. this._dialog = null;
  4305. this._backdrop = null;
  4306. this._isShown = null;
  4307. this._isBodyOverflowing = null;
  4308. this._ignoreBackdropClick = null;
  4309. this._isTransitioning = null;
  4310. this._scrollbarWidth = null;
  4311. };
  4312. _proto.handleUpdate = function handleUpdate() {
  4313. this._adjustDialog();
  4314. } // Private
  4315. ;
  4316. _proto._getConfig = function _getConfig(config) {
  4317. config = _objectSpread2({}, Default$3, {}, config);
  4318. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4319. return config;
  4320. };
  4321. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4322. var _this3 = this;
  4323. if (this._config.backdrop === 'static') {
  4324. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4325. $(this._element).trigger(hideEventPrevented);
  4326. if (hideEventPrevented.defaultPrevented) {
  4327. return;
  4328. }
  4329. this._element.classList.add(ClassName$5.STATIC);
  4330. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4331. $(this._element).one(Util.TRANSITION_END, function () {
  4332. _this3._element.classList.remove(ClassName$5.STATIC);
  4333. }).emulateTransitionEnd(modalTransitionDuration);
  4334. this._element.focus();
  4335. } else {
  4336. this.hide();
  4337. }
  4338. };
  4339. _proto._showElement = function _showElement(relatedTarget) {
  4340. var _this4 = this;
  4341. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4342. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4343. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4344. // Don't move modal's DOM position
  4345. document.body.appendChild(this._element);
  4346. }
  4347. this._element.style.display = 'block';
  4348. this._element.removeAttribute('aria-hidden');
  4349. this._element.setAttribute('aria-modal', true);
  4350. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4351. modalBody.scrollTop = 0;
  4352. } else {
  4353. this._element.scrollTop = 0;
  4354. }
  4355. if (transition) {
  4356. Util.reflow(this._element);
  4357. }
  4358. $(this._element).addClass(ClassName$5.SHOW);
  4359. if (this._config.focus) {
  4360. this._enforceFocus();
  4361. }
  4362. var shownEvent = $.Event(Event$5.SHOWN, {
  4363. relatedTarget: relatedTarget
  4364. });
  4365. var transitionComplete = function transitionComplete() {
  4366. if (_this4._config.focus) {
  4367. _this4._element.focus();
  4368. }
  4369. _this4._isTransitioning = false;
  4370. $(_this4._element).trigger(shownEvent);
  4371. };
  4372. if (transition) {
  4373. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4374. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4375. } else {
  4376. transitionComplete();
  4377. }
  4378. };
  4379. _proto._enforceFocus = function _enforceFocus() {
  4380. var _this5 = this;
  4381. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4382. .on(Event$5.FOCUSIN, function (event) {
  4383. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4384. _this5._element.focus();
  4385. }
  4386. });
  4387. };
  4388. _proto._setEscapeEvent = function _setEscapeEvent() {
  4389. var _this6 = this;
  4390. if (this._isShown && this._config.keyboard) {
  4391. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4392. if (event.which === ESCAPE_KEYCODE$1) {
  4393. _this6._triggerBackdropTransition();
  4394. }
  4395. });
  4396. } else if (!this._isShown) {
  4397. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4398. }
  4399. };
  4400. _proto._setResizeEvent = function _setResizeEvent() {
  4401. var _this7 = this;
  4402. if (this._isShown) {
  4403. $(window).on(Event$5.RESIZE, function (event) {
  4404. return _this7.handleUpdate(event);
  4405. });
  4406. } else {
  4407. $(window).off(Event$5.RESIZE);
  4408. }
  4409. };
  4410. _proto._hideModal = function _hideModal() {
  4411. var _this8 = this;
  4412. this._element.style.display = 'none';
  4413. this._element.setAttribute('aria-hidden', true);
  4414. this._element.removeAttribute('aria-modal');
  4415. this._isTransitioning = false;
  4416. this._showBackdrop(function () {
  4417. $(document.body).removeClass(ClassName$5.OPEN);
  4418. _this8._resetAdjustments();
  4419. _this8._resetScrollbar();
  4420. $(_this8._element).trigger(Event$5.HIDDEN);
  4421. });
  4422. };
  4423. _proto._removeBackdrop = function _removeBackdrop() {
  4424. if (this._backdrop) {
  4425. $(this._backdrop).remove();
  4426. this._backdrop = null;
  4427. }
  4428. };
  4429. _proto._showBackdrop = function _showBackdrop(callback) {
  4430. var _this9 = this;
  4431. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4432. if (this._isShown && this._config.backdrop) {
  4433. this._backdrop = document.createElement('div');
  4434. this._backdrop.className = ClassName$5.BACKDROP;
  4435. if (animate) {
  4436. this._backdrop.classList.add(animate);
  4437. }
  4438. $(this._backdrop).appendTo(document.body);
  4439. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4440. if (_this9._ignoreBackdropClick) {
  4441. _this9._ignoreBackdropClick = false;
  4442. return;
  4443. }
  4444. if (event.target !== event.currentTarget) {
  4445. return;
  4446. }
  4447. _this9._triggerBackdropTransition();
  4448. });
  4449. if (animate) {
  4450. Util.reflow(this._backdrop);
  4451. }
  4452. $(this._backdrop).addClass(ClassName$5.SHOW);
  4453. if (!callback) {
  4454. return;
  4455. }
  4456. if (!animate) {
  4457. callback();
  4458. return;
  4459. }
  4460. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4461. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4462. } else if (!this._isShown && this._backdrop) {
  4463. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4464. var callbackRemove = function callbackRemove() {
  4465. _this9._removeBackdrop();
  4466. if (callback) {
  4467. callback();
  4468. }
  4469. };
  4470. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4471. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4472. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4473. } else {
  4474. callbackRemove();
  4475. }
  4476. } else if (callback) {
  4477. callback();
  4478. }
  4479. } // ----------------------------------------------------------------------
  4480. // the following methods are used to handle overflowing modals
  4481. // todo (fat): these should probably be refactored out of modal.js
  4482. // ----------------------------------------------------------------------
  4483. ;
  4484. _proto._adjustDialog = function _adjustDialog() {
  4485. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4486. if (!this._isBodyOverflowing && isModalOverflowing) {
  4487. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4488. }
  4489. if (this._isBodyOverflowing && !isModalOverflowing) {
  4490. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4491. }
  4492. };
  4493. _proto._resetAdjustments = function _resetAdjustments() {
  4494. this._element.style.paddingLeft = '';
  4495. this._element.style.paddingRight = '';
  4496. };
  4497. _proto._checkScrollbar = function _checkScrollbar() {
  4498. var rect = document.body.getBoundingClientRect();
  4499. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4500. this._scrollbarWidth = this._getScrollbarWidth();
  4501. };
  4502. _proto._setScrollbar = function _setScrollbar() {
  4503. var _this10 = this;
  4504. if (this._isBodyOverflowing) {
  4505. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4506. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4507. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4508. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4509. $(fixedContent).each(function (index, element) {
  4510. var actualPadding = element.style.paddingRight;
  4511. var calculatedPadding = $(element).css('padding-right');
  4512. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4513. }); // Adjust sticky content margin
  4514. $(stickyContent).each(function (index, element) {
  4515. var actualMargin = element.style.marginRight;
  4516. var calculatedMargin = $(element).css('margin-right');
  4517. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4518. }); // Adjust body padding
  4519. var actualPadding = document.body.style.paddingRight;
  4520. var calculatedPadding = $(document.body).css('padding-right');
  4521. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4522. }
  4523. $(document.body).addClass(ClassName$5.OPEN);
  4524. };
  4525. _proto._resetScrollbar = function _resetScrollbar() {
  4526. // Restore fixed content padding
  4527. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4528. $(fixedContent).each(function (index, element) {
  4529. var padding = $(element).data('padding-right');
  4530. $(element).removeData('padding-right');
  4531. element.style.paddingRight = padding ? padding : '';
  4532. }); // Restore sticky content
  4533. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4534. $(elements).each(function (index, element) {
  4535. var margin = $(element).data('margin-right');
  4536. if (typeof margin !== 'undefined') {
  4537. $(element).css('margin-right', margin).removeData('margin-right');
  4538. }
  4539. }); // Restore body padding
  4540. var padding = $(document.body).data('padding-right');
  4541. $(document.body).removeData('padding-right');
  4542. document.body.style.paddingRight = padding ? padding : '';
  4543. };
  4544. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4545. // thx d.walsh
  4546. var scrollDiv = document.createElement('div');
  4547. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4548. document.body.appendChild(scrollDiv);
  4549. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4550. document.body.removeChild(scrollDiv);
  4551. return scrollbarWidth;
  4552. } // Static
  4553. ;
  4554. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4555. return this.each(function () {
  4556. var data = $(this).data(DATA_KEY$5);
  4557. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4558. if (!data) {
  4559. data = new Modal(this, _config);
  4560. $(this).data(DATA_KEY$5, data);
  4561. }
  4562. if (typeof config === 'string') {
  4563. if (typeof data[config] === 'undefined') {
  4564. throw new TypeError("No method named \"" + config + "\"");
  4565. }
  4566. data[config](relatedTarget);
  4567. } else if (_config.show) {
  4568. data.show(relatedTarget);
  4569. }
  4570. });
  4571. };
  4572. _createClass(Modal, null, [{
  4573. key: "VERSION",
  4574. get: function get() {
  4575. return VERSION$5;
  4576. }
  4577. }, {
  4578. key: "Default",
  4579. get: function get() {
  4580. return Default$3;
  4581. }
  4582. }]);
  4583. return Modal;
  4584. }();
  4585. /**
  4586. * ------------------------------------------------------------------------
  4587. * Data Api implementation
  4588. * ------------------------------------------------------------------------
  4589. */
  4590. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4591. var _this11 = this;
  4592. var target;
  4593. var selector = Util.getSelectorFromElement(this);
  4594. if (selector) {
  4595. target = document.querySelector(selector);
  4596. }
  4597. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4598. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4599. event.preventDefault();
  4600. }
  4601. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4602. if (showEvent.isDefaultPrevented()) {
  4603. // Only register focus restorer if modal will actually get shown
  4604. return;
  4605. }
  4606. $target.one(Event$5.HIDDEN, function () {
  4607. if ($(_this11).is(':visible')) {
  4608. _this11.focus();
  4609. }
  4610. });
  4611. });
  4612. Modal._jQueryInterface.call($(target), config, this);
  4613. });
  4614. /**
  4615. * ------------------------------------------------------------------------
  4616. * jQuery
  4617. * ------------------------------------------------------------------------
  4618. */
  4619. $.fn[NAME$5] = Modal._jQueryInterface;
  4620. $.fn[NAME$5].Constructor = Modal;
  4621. $.fn[NAME$5].noConflict = function () {
  4622. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4623. return Modal._jQueryInterface;
  4624. };
  4625. /**
  4626. * --------------------------------------------------------------------------
  4627. * Bootstrap (v4.4.1): tools/sanitizer.js
  4628. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4629. * --------------------------------------------------------------------------
  4630. */
  4631. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4632. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4633. var DefaultWhitelist = {
  4634. // Global attributes allowed on any supplied element below.
  4635. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4636. a: ['target', 'href', 'title', 'rel'],
  4637. area: [],
  4638. b: [],
  4639. br: [],
  4640. col: [],
  4641. code: [],
  4642. div: [],
  4643. em: [],
  4644. hr: [],
  4645. h1: [],
  4646. h2: [],
  4647. h3: [],
  4648. h4: [],
  4649. h5: [],
  4650. h6: [],
  4651. i: [],
  4652. img: ['src', 'alt', 'title', 'width', 'height'],
  4653. li: [],
  4654. ol: [],
  4655. p: [],
  4656. pre: [],
  4657. s: [],
  4658. small: [],
  4659. span: [],
  4660. sub: [],
  4661. sup: [],
  4662. strong: [],
  4663. u: [],
  4664. ul: []
  4665. };
  4666. /**
  4667. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4668. *
  4669. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4670. */
  4671. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4672. /**
  4673. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4674. *
  4675. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4676. */
  4677. 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;
  4678. function allowedAttribute(attr, allowedAttributeList) {
  4679. var attrName = attr.nodeName.toLowerCase();
  4680. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4681. if (uriAttrs.indexOf(attrName) !== -1) {
  4682. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4683. }
  4684. return true;
  4685. }
  4686. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4687. return attrRegex instanceof RegExp;
  4688. }); // Check if a regular expression validates the attribute.
  4689. for (var i = 0, l = regExp.length; i < l; i++) {
  4690. if (attrName.match(regExp[i])) {
  4691. return true;
  4692. }
  4693. }
  4694. return false;
  4695. }
  4696. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4697. if (unsafeHtml.length === 0) {
  4698. return unsafeHtml;
  4699. }
  4700. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4701. return sanitizeFn(unsafeHtml);
  4702. }
  4703. var domParser = new window.DOMParser();
  4704. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4705. var whitelistKeys = Object.keys(whiteList);
  4706. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4707. var _loop = function _loop(i, len) {
  4708. var el = elements[i];
  4709. var elName = el.nodeName.toLowerCase();
  4710. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4711. el.parentNode.removeChild(el);
  4712. return "continue";
  4713. }
  4714. var attributeList = [].slice.call(el.attributes);
  4715. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4716. attributeList.forEach(function (attr) {
  4717. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4718. el.removeAttribute(attr.nodeName);
  4719. }
  4720. });
  4721. };
  4722. for (var i = 0, len = elements.length; i < len; i++) {
  4723. var _ret = _loop(i);
  4724. if (_ret === "continue") continue;
  4725. }
  4726. return createdDocument.body.innerHTML;
  4727. }
  4728. /**
  4729. * ------------------------------------------------------------------------
  4730. * Constants
  4731. * ------------------------------------------------------------------------
  4732. */
  4733. var NAME$6 = 'tooltip';
  4734. var VERSION$6 = '4.4.1';
  4735. var DATA_KEY$6 = 'bs.tooltip';
  4736. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4737. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4738. var CLASS_PREFIX = 'bs-tooltip';
  4739. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4740. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4741. var DefaultType$4 = {
  4742. animation: 'boolean',
  4743. template: 'string',
  4744. title: '(string|element|function)',
  4745. trigger: 'string',
  4746. delay: '(number|object)',
  4747. html: 'boolean',
  4748. selector: '(string|boolean)',
  4749. placement: '(string|function)',
  4750. offset: '(number|string|function)',
  4751. container: '(string|element|boolean)',
  4752. fallbackPlacement: '(string|array)',
  4753. boundary: '(string|element)',
  4754. sanitize: 'boolean',
  4755. sanitizeFn: '(null|function)',
  4756. whiteList: 'object',
  4757. popperConfig: '(null|object)'
  4758. };
  4759. var AttachmentMap$1 = {
  4760. AUTO: 'auto',
  4761. TOP: 'top',
  4762. RIGHT: 'right',
  4763. BOTTOM: 'bottom',
  4764. LEFT: 'left'
  4765. };
  4766. var Default$4 = {
  4767. animation: true,
  4768. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4769. trigger: 'hover focus',
  4770. title: '',
  4771. delay: 0,
  4772. html: false,
  4773. selector: false,
  4774. placement: 'top',
  4775. offset: 0,
  4776. container: false,
  4777. fallbackPlacement: 'flip',
  4778. boundary: 'scrollParent',
  4779. sanitize: true,
  4780. sanitizeFn: null,
  4781. whiteList: DefaultWhitelist,
  4782. popperConfig: null
  4783. };
  4784. var HoverState = {
  4785. SHOW: 'show',
  4786. OUT: 'out'
  4787. };
  4788. var Event$6 = {
  4789. HIDE: "hide" + EVENT_KEY$6,
  4790. HIDDEN: "hidden" + EVENT_KEY$6,
  4791. SHOW: "show" + EVENT_KEY$6,
  4792. SHOWN: "shown" + EVENT_KEY$6,
  4793. INSERTED: "inserted" + EVENT_KEY$6,
  4794. CLICK: "click" + EVENT_KEY$6,
  4795. FOCUSIN: "focusin" + EVENT_KEY$6,
  4796. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4797. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4798. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4799. };
  4800. var ClassName$6 = {
  4801. FADE: 'fade',
  4802. SHOW: 'show'
  4803. };
  4804. var Selector$6 = {
  4805. TOOLTIP: '.tooltip',
  4806. TOOLTIP_INNER: '.tooltip-inner',
  4807. ARROW: '.arrow'
  4808. };
  4809. var Trigger = {
  4810. HOVER: 'hover',
  4811. FOCUS: 'focus',
  4812. CLICK: 'click',
  4813. MANUAL: 'manual'
  4814. };
  4815. /**
  4816. * ------------------------------------------------------------------------
  4817. * Class Definition
  4818. * ------------------------------------------------------------------------
  4819. */
  4820. var Tooltip =
  4821. /*#__PURE__*/
  4822. function () {
  4823. function Tooltip(element, config) {
  4824. if (typeof Popper === 'undefined') {
  4825. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4826. } // private
  4827. this._isEnabled = true;
  4828. this._timeout = 0;
  4829. this._hoverState = '';
  4830. this._activeTrigger = {};
  4831. this._popper = null; // Protected
  4832. this.element = element;
  4833. this.config = this._getConfig(config);
  4834. this.tip = null;
  4835. this._setListeners();
  4836. } // Getters
  4837. var _proto = Tooltip.prototype;
  4838. // Public
  4839. _proto.enable = function enable() {
  4840. this._isEnabled = true;
  4841. };
  4842. _proto.disable = function disable() {
  4843. this._isEnabled = false;
  4844. };
  4845. _proto.toggleEnabled = function toggleEnabled() {
  4846. this._isEnabled = !this._isEnabled;
  4847. };
  4848. _proto.toggle = function toggle(event) {
  4849. if (!this._isEnabled) {
  4850. return;
  4851. }
  4852. if (event) {
  4853. var dataKey = this.constructor.DATA_KEY;
  4854. var context = $(event.currentTarget).data(dataKey);
  4855. if (!context) {
  4856. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4857. $(event.currentTarget).data(dataKey, context);
  4858. }
  4859. context._activeTrigger.click = !context._activeTrigger.click;
  4860. if (context._isWithActiveTrigger()) {
  4861. context._enter(null, context);
  4862. } else {
  4863. context._leave(null, context);
  4864. }
  4865. } else {
  4866. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4867. this._leave(null, this);
  4868. return;
  4869. }
  4870. this._enter(null, this);
  4871. }
  4872. };
  4873. _proto.dispose = function dispose() {
  4874. clearTimeout(this._timeout);
  4875. $.removeData(this.element, this.constructor.DATA_KEY);
  4876. $(this.element).off(this.constructor.EVENT_KEY);
  4877. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4878. if (this.tip) {
  4879. $(this.tip).remove();
  4880. }
  4881. this._isEnabled = null;
  4882. this._timeout = null;
  4883. this._hoverState = null;
  4884. this._activeTrigger = null;
  4885. if (this._popper) {
  4886. this._popper.destroy();
  4887. }
  4888. this._popper = null;
  4889. this.element = null;
  4890. this.config = null;
  4891. this.tip = null;
  4892. };
  4893. _proto.show = function show() {
  4894. var _this = this;
  4895. if ($(this.element).css('display') === 'none') {
  4896. throw new Error('Please use show on visible elements');
  4897. }
  4898. var showEvent = $.Event(this.constructor.Event.SHOW);
  4899. if (this.isWithContent() && this._isEnabled) {
  4900. $(this.element).trigger(showEvent);
  4901. var shadowRoot = Util.findShadowRoot(this.element);
  4902. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4903. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4904. return;
  4905. }
  4906. var tip = this.getTipElement();
  4907. var tipId = Util.getUID(this.constructor.NAME);
  4908. tip.setAttribute('id', tipId);
  4909. this.element.setAttribute('aria-describedby', tipId);
  4910. this.setContent();
  4911. if (this.config.animation) {
  4912. $(tip).addClass(ClassName$6.FADE);
  4913. }
  4914. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4915. var attachment = this._getAttachment(placement);
  4916. this.addAttachmentClass(attachment);
  4917. var container = this._getContainer();
  4918. $(tip).data(this.constructor.DATA_KEY, this);
  4919. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4920. $(tip).appendTo(container);
  4921. }
  4922. $(this.element).trigger(this.constructor.Event.INSERTED);
  4923. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4924. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4925. // empty mouseover listeners to the body's immediate children;
  4926. // only needed because of broken event delegation on iOS
  4927. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4928. if ('ontouchstart' in document.documentElement) {
  4929. $(document.body).children().on('mouseover', null, $.noop);
  4930. }
  4931. var complete = function complete() {
  4932. if (_this.config.animation) {
  4933. _this._fixTransition();
  4934. }
  4935. var prevHoverState = _this._hoverState;
  4936. _this._hoverState = null;
  4937. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4938. if (prevHoverState === HoverState.OUT) {
  4939. _this._leave(null, _this);
  4940. }
  4941. };
  4942. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4943. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4944. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4945. } else {
  4946. complete();
  4947. }
  4948. }
  4949. };
  4950. _proto.hide = function hide(callback) {
  4951. var _this2 = this;
  4952. var tip = this.getTipElement();
  4953. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4954. var complete = function complete() {
  4955. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4956. tip.parentNode.removeChild(tip);
  4957. }
  4958. _this2._cleanTipClass();
  4959. _this2.element.removeAttribute('aria-describedby');
  4960. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4961. if (_this2._popper !== null) {
  4962. _this2._popper.destroy();
  4963. }
  4964. if (callback) {
  4965. callback();
  4966. }
  4967. };
  4968. $(this.element).trigger(hideEvent);
  4969. if (hideEvent.isDefaultPrevented()) {
  4970. return;
  4971. }
  4972. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4973. // empty mouseover listeners we added for iOS support
  4974. if ('ontouchstart' in document.documentElement) {
  4975. $(document.body).children().off('mouseover', null, $.noop);
  4976. }
  4977. this._activeTrigger[Trigger.CLICK] = false;
  4978. this._activeTrigger[Trigger.FOCUS] = false;
  4979. this._activeTrigger[Trigger.HOVER] = false;
  4980. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4981. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4982. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4983. } else {
  4984. complete();
  4985. }
  4986. this._hoverState = '';
  4987. };
  4988. _proto.update = function update() {
  4989. if (this._popper !== null) {
  4990. this._popper.scheduleUpdate();
  4991. }
  4992. } // Protected
  4993. ;
  4994. _proto.isWithContent = function isWithContent() {
  4995. return Boolean(this.getTitle());
  4996. };
  4997. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  4998. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  4999. };
  5000. _proto.getTipElement = function getTipElement() {
  5001. this.tip = this.tip || $(this.config.template)[0];
  5002. return this.tip;
  5003. };
  5004. _proto.setContent = function setContent() {
  5005. var tip = this.getTipElement();
  5006. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5007. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5008. };
  5009. _proto.setElementContent = function setElementContent($element, content) {
  5010. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5011. // Content is a DOM node or a jQuery
  5012. if (this.config.html) {
  5013. if (!$(content).parent().is($element)) {
  5014. $element.empty().append(content);
  5015. }
  5016. } else {
  5017. $element.text($(content).text());
  5018. }
  5019. return;
  5020. }
  5021. if (this.config.html) {
  5022. if (this.config.sanitize) {
  5023. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5024. }
  5025. $element.html(content);
  5026. } else {
  5027. $element.text(content);
  5028. }
  5029. };
  5030. _proto.getTitle = function getTitle() {
  5031. var title = this.element.getAttribute('data-original-title');
  5032. if (!title) {
  5033. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5034. }
  5035. return title;
  5036. } // Private
  5037. ;
  5038. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5039. var _this3 = this;
  5040. var defaultBsConfig = {
  5041. placement: attachment,
  5042. modifiers: {
  5043. offset: this._getOffset(),
  5044. flip: {
  5045. behavior: this.config.fallbackPlacement
  5046. },
  5047. arrow: {
  5048. element: Selector$6.ARROW
  5049. },
  5050. preventOverflow: {
  5051. boundariesElement: this.config.boundary
  5052. }
  5053. },
  5054. onCreate: function onCreate(data) {
  5055. if (data.originalPlacement !== data.placement) {
  5056. _this3._handlePopperPlacementChange(data);
  5057. }
  5058. },
  5059. onUpdate: function onUpdate(data) {
  5060. return _this3._handlePopperPlacementChange(data);
  5061. }
  5062. };
  5063. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5064. };
  5065. _proto._getOffset = function _getOffset() {
  5066. var _this4 = this;
  5067. var offset = {};
  5068. if (typeof this.config.offset === 'function') {
  5069. offset.fn = function (data) {
  5070. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5071. return data;
  5072. };
  5073. } else {
  5074. offset.offset = this.config.offset;
  5075. }
  5076. return offset;
  5077. };
  5078. _proto._getContainer = function _getContainer() {
  5079. if (this.config.container === false) {
  5080. return document.body;
  5081. }
  5082. if (Util.isElement(this.config.container)) {
  5083. return $(this.config.container);
  5084. }
  5085. return $(document).find(this.config.container);
  5086. };
  5087. _proto._getAttachment = function _getAttachment(placement) {
  5088. return AttachmentMap$1[placement.toUpperCase()];
  5089. };
  5090. _proto._setListeners = function _setListeners() {
  5091. var _this5 = this;
  5092. var triggers = this.config.trigger.split(' ');
  5093. triggers.forEach(function (trigger) {
  5094. if (trigger === 'click') {
  5095. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5096. return _this5.toggle(event);
  5097. });
  5098. } else if (trigger !== Trigger.MANUAL) {
  5099. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5100. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5101. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5102. return _this5._enter(event);
  5103. }).on(eventOut, _this5.config.selector, function (event) {
  5104. return _this5._leave(event);
  5105. });
  5106. }
  5107. });
  5108. this._hideModalHandler = function () {
  5109. if (_this5.element) {
  5110. _this5.hide();
  5111. }
  5112. };
  5113. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5114. if (this.config.selector) {
  5115. this.config = _objectSpread2({}, this.config, {
  5116. trigger: 'manual',
  5117. selector: ''
  5118. });
  5119. } else {
  5120. this._fixTitle();
  5121. }
  5122. };
  5123. _proto._fixTitle = function _fixTitle() {
  5124. var titleType = typeof this.element.getAttribute('data-original-title');
  5125. if (this.element.getAttribute('title') || titleType !== 'string') {
  5126. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5127. this.element.setAttribute('title', '');
  5128. }
  5129. };
  5130. _proto._enter = function _enter(event, context) {
  5131. var dataKey = this.constructor.DATA_KEY;
  5132. context = context || $(event.currentTarget).data(dataKey);
  5133. if (!context) {
  5134. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5135. $(event.currentTarget).data(dataKey, context);
  5136. }
  5137. if (event) {
  5138. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5139. }
  5140. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5141. context._hoverState = HoverState.SHOW;
  5142. return;
  5143. }
  5144. clearTimeout(context._timeout);
  5145. context._hoverState = HoverState.SHOW;
  5146. if (!context.config.delay || !context.config.delay.show) {
  5147. context.show();
  5148. return;
  5149. }
  5150. context._timeout = setTimeout(function () {
  5151. if (context._hoverState === HoverState.SHOW) {
  5152. context.show();
  5153. }
  5154. }, context.config.delay.show);
  5155. };
  5156. _proto._leave = function _leave(event, context) {
  5157. var dataKey = this.constructor.DATA_KEY;
  5158. context = context || $(event.currentTarget).data(dataKey);
  5159. if (!context) {
  5160. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5161. $(event.currentTarget).data(dataKey, context);
  5162. }
  5163. if (event) {
  5164. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5165. }
  5166. if (context._isWithActiveTrigger()) {
  5167. return;
  5168. }
  5169. clearTimeout(context._timeout);
  5170. context._hoverState = HoverState.OUT;
  5171. if (!context.config.delay || !context.config.delay.hide) {
  5172. context.hide();
  5173. return;
  5174. }
  5175. context._timeout = setTimeout(function () {
  5176. if (context._hoverState === HoverState.OUT) {
  5177. context.hide();
  5178. }
  5179. }, context.config.delay.hide);
  5180. };
  5181. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5182. for (var trigger in this._activeTrigger) {
  5183. if (this._activeTrigger[trigger]) {
  5184. return true;
  5185. }
  5186. }
  5187. return false;
  5188. };
  5189. _proto._getConfig = function _getConfig(config) {
  5190. var dataAttributes = $(this.element).data();
  5191. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5192. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5193. delete dataAttributes[dataAttr];
  5194. }
  5195. });
  5196. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5197. if (typeof config.delay === 'number') {
  5198. config.delay = {
  5199. show: config.delay,
  5200. hide: config.delay
  5201. };
  5202. }
  5203. if (typeof config.title === 'number') {
  5204. config.title = config.title.toString();
  5205. }
  5206. if (typeof config.content === 'number') {
  5207. config.content = config.content.toString();
  5208. }
  5209. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5210. if (config.sanitize) {
  5211. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5212. }
  5213. return config;
  5214. };
  5215. _proto._getDelegateConfig = function _getDelegateConfig() {
  5216. var config = {};
  5217. if (this.config) {
  5218. for (var key in this.config) {
  5219. if (this.constructor.Default[key] !== this.config[key]) {
  5220. config[key] = this.config[key];
  5221. }
  5222. }
  5223. }
  5224. return config;
  5225. };
  5226. _proto._cleanTipClass = function _cleanTipClass() {
  5227. var $tip = $(this.getTipElement());
  5228. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5229. if (tabClass !== null && tabClass.length) {
  5230. $tip.removeClass(tabClass.join(''));
  5231. }
  5232. };
  5233. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5234. var popperInstance = popperData.instance;
  5235. this.tip = popperInstance.popper;
  5236. this._cleanTipClass();
  5237. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5238. };
  5239. _proto._fixTransition = function _fixTransition() {
  5240. var tip = this.getTipElement();
  5241. var initConfigAnimation = this.config.animation;
  5242. if (tip.getAttribute('x-placement') !== null) {
  5243. return;
  5244. }
  5245. $(tip).removeClass(ClassName$6.FADE);
  5246. this.config.animation = false;
  5247. this.hide();
  5248. this.show();
  5249. this.config.animation = initConfigAnimation;
  5250. } // Static
  5251. ;
  5252. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5253. return this.each(function () {
  5254. var data = $(this).data(DATA_KEY$6);
  5255. var _config = typeof config === 'object' && config;
  5256. if (!data && /dispose|hide/.test(config)) {
  5257. return;
  5258. }
  5259. if (!data) {
  5260. data = new Tooltip(this, _config);
  5261. $(this).data(DATA_KEY$6, data);
  5262. }
  5263. if (typeof config === 'string') {
  5264. if (typeof data[config] === 'undefined') {
  5265. throw new TypeError("No method named \"" + config + "\"");
  5266. }
  5267. data[config]();
  5268. }
  5269. });
  5270. };
  5271. _createClass(Tooltip, null, [{
  5272. key: "VERSION",
  5273. get: function get() {
  5274. return VERSION$6;
  5275. }
  5276. }, {
  5277. key: "Default",
  5278. get: function get() {
  5279. return Default$4;
  5280. }
  5281. }, {
  5282. key: "NAME",
  5283. get: function get() {
  5284. return NAME$6;
  5285. }
  5286. }, {
  5287. key: "DATA_KEY",
  5288. get: function get() {
  5289. return DATA_KEY$6;
  5290. }
  5291. }, {
  5292. key: "Event",
  5293. get: function get() {
  5294. return Event$6;
  5295. }
  5296. }, {
  5297. key: "EVENT_KEY",
  5298. get: function get() {
  5299. return EVENT_KEY$6;
  5300. }
  5301. }, {
  5302. key: "DefaultType",
  5303. get: function get() {
  5304. return DefaultType$4;
  5305. }
  5306. }]);
  5307. return Tooltip;
  5308. }();
  5309. /**
  5310. * ------------------------------------------------------------------------
  5311. * jQuery
  5312. * ------------------------------------------------------------------------
  5313. */
  5314. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5315. $.fn[NAME$6].Constructor = Tooltip;
  5316. $.fn[NAME$6].noConflict = function () {
  5317. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5318. return Tooltip._jQueryInterface;
  5319. };
  5320. /**
  5321. * ------------------------------------------------------------------------
  5322. * Constants
  5323. * ------------------------------------------------------------------------
  5324. */
  5325. var NAME$7 = 'popover';
  5326. var VERSION$7 = '4.4.1';
  5327. var DATA_KEY$7 = 'bs.popover';
  5328. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5329. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5330. var CLASS_PREFIX$1 = 'bs-popover';
  5331. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5332. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5333. placement: 'right',
  5334. trigger: 'click',
  5335. content: '',
  5336. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5337. });
  5338. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5339. content: '(string|element|function)'
  5340. });
  5341. var ClassName$7 = {
  5342. FADE: 'fade',
  5343. SHOW: 'show'
  5344. };
  5345. var Selector$7 = {
  5346. TITLE: '.popover-header',
  5347. CONTENT: '.popover-body'
  5348. };
  5349. var Event$7 = {
  5350. HIDE: "hide" + EVENT_KEY$7,
  5351. HIDDEN: "hidden" + EVENT_KEY$7,
  5352. SHOW: "show" + EVENT_KEY$7,
  5353. SHOWN: "shown" + EVENT_KEY$7,
  5354. INSERTED: "inserted" + EVENT_KEY$7,
  5355. CLICK: "click" + EVENT_KEY$7,
  5356. FOCUSIN: "focusin" + EVENT_KEY$7,
  5357. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5358. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5359. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5360. };
  5361. /**
  5362. * ------------------------------------------------------------------------
  5363. * Class Definition
  5364. * ------------------------------------------------------------------------
  5365. */
  5366. var Popover =
  5367. /*#__PURE__*/
  5368. function (_Tooltip) {
  5369. _inheritsLoose(Popover, _Tooltip);
  5370. function Popover() {
  5371. return _Tooltip.apply(this, arguments) || this;
  5372. }
  5373. var _proto = Popover.prototype;
  5374. // Overrides
  5375. _proto.isWithContent = function isWithContent() {
  5376. return this.getTitle() || this._getContent();
  5377. };
  5378. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5379. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5380. };
  5381. _proto.getTipElement = function getTipElement() {
  5382. this.tip = this.tip || $(this.config.template)[0];
  5383. return this.tip;
  5384. };
  5385. _proto.setContent = function setContent() {
  5386. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5387. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5388. var content = this._getContent();
  5389. if (typeof content === 'function') {
  5390. content = content.call(this.element);
  5391. }
  5392. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5393. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5394. } // Private
  5395. ;
  5396. _proto._getContent = function _getContent() {
  5397. return this.element.getAttribute('data-content') || this.config.content;
  5398. };
  5399. _proto._cleanTipClass = function _cleanTipClass() {
  5400. var $tip = $(this.getTipElement());
  5401. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5402. if (tabClass !== null && tabClass.length > 0) {
  5403. $tip.removeClass(tabClass.join(''));
  5404. }
  5405. } // Static
  5406. ;
  5407. Popover._jQueryInterface = function _jQueryInterface(config) {
  5408. return this.each(function () {
  5409. var data = $(this).data(DATA_KEY$7);
  5410. var _config = typeof config === 'object' ? config : null;
  5411. if (!data && /dispose|hide/.test(config)) {
  5412. return;
  5413. }
  5414. if (!data) {
  5415. data = new Popover(this, _config);
  5416. $(this).data(DATA_KEY$7, data);
  5417. }
  5418. if (typeof config === 'string') {
  5419. if (typeof data[config] === 'undefined') {
  5420. throw new TypeError("No method named \"" + config + "\"");
  5421. }
  5422. data[config]();
  5423. }
  5424. });
  5425. };
  5426. _createClass(Popover, null, [{
  5427. key: "VERSION",
  5428. // Getters
  5429. get: function get() {
  5430. return VERSION$7;
  5431. }
  5432. }, {
  5433. key: "Default",
  5434. get: function get() {
  5435. return Default$5;
  5436. }
  5437. }, {
  5438. key: "NAME",
  5439. get: function get() {
  5440. return NAME$7;
  5441. }
  5442. }, {
  5443. key: "DATA_KEY",
  5444. get: function get() {
  5445. return DATA_KEY$7;
  5446. }
  5447. }, {
  5448. key: "Event",
  5449. get: function get() {
  5450. return Event$7;
  5451. }
  5452. }, {
  5453. key: "EVENT_KEY",
  5454. get: function get() {
  5455. return EVENT_KEY$7;
  5456. }
  5457. }, {
  5458. key: "DefaultType",
  5459. get: function get() {
  5460. return DefaultType$5;
  5461. }
  5462. }]);
  5463. return Popover;
  5464. }(Tooltip);
  5465. /**
  5466. * ------------------------------------------------------------------------
  5467. * jQuery
  5468. * ------------------------------------------------------------------------
  5469. */
  5470. $.fn[NAME$7] = Popover._jQueryInterface;
  5471. $.fn[NAME$7].Constructor = Popover;
  5472. $.fn[NAME$7].noConflict = function () {
  5473. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5474. return Popover._jQueryInterface;
  5475. };
  5476. /**
  5477. * ------------------------------------------------------------------------
  5478. * Constants
  5479. * ------------------------------------------------------------------------
  5480. */
  5481. var NAME$8 = 'scrollspy';
  5482. var VERSION$8 = '4.4.1';
  5483. var DATA_KEY$8 = 'bs.scrollspy';
  5484. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5485. var DATA_API_KEY$6 = '.data-api';
  5486. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5487. var Default$6 = {
  5488. offset: 10,
  5489. method: 'auto',
  5490. target: ''
  5491. };
  5492. var DefaultType$6 = {
  5493. offset: 'number',
  5494. method: 'string',
  5495. target: '(string|element)'
  5496. };
  5497. var Event$8 = {
  5498. ACTIVATE: "activate" + EVENT_KEY$8,
  5499. SCROLL: "scroll" + EVENT_KEY$8,
  5500. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5501. };
  5502. var ClassName$8 = {
  5503. DROPDOWN_ITEM: 'dropdown-item',
  5504. DROPDOWN_MENU: 'dropdown-menu',
  5505. ACTIVE: 'active'
  5506. };
  5507. var Selector$8 = {
  5508. DATA_SPY: '[data-spy="scroll"]',
  5509. ACTIVE: '.active',
  5510. NAV_LIST_GROUP: '.nav, .list-group',
  5511. NAV_LINKS: '.nav-link',
  5512. NAV_ITEMS: '.nav-item',
  5513. LIST_ITEMS: '.list-group-item',
  5514. DROPDOWN: '.dropdown',
  5515. DROPDOWN_ITEMS: '.dropdown-item',
  5516. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5517. };
  5518. var OffsetMethod = {
  5519. OFFSET: 'offset',
  5520. POSITION: 'position'
  5521. };
  5522. /**
  5523. * ------------------------------------------------------------------------
  5524. * Class Definition
  5525. * ------------------------------------------------------------------------
  5526. */
  5527. var ScrollSpy =
  5528. /*#__PURE__*/
  5529. function () {
  5530. function ScrollSpy(element, config) {
  5531. var _this = this;
  5532. this._element = element;
  5533. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5534. this._config = this._getConfig(config);
  5535. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5536. this._offsets = [];
  5537. this._targets = [];
  5538. this._activeTarget = null;
  5539. this._scrollHeight = 0;
  5540. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5541. return _this._process(event);
  5542. });
  5543. this.refresh();
  5544. this._process();
  5545. } // Getters
  5546. var _proto = ScrollSpy.prototype;
  5547. // Public
  5548. _proto.refresh = function refresh() {
  5549. var _this2 = this;
  5550. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5551. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5552. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5553. this._offsets = [];
  5554. this._targets = [];
  5555. this._scrollHeight = this._getScrollHeight();
  5556. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5557. targets.map(function (element) {
  5558. var target;
  5559. var targetSelector = Util.getSelectorFromElement(element);
  5560. if (targetSelector) {
  5561. target = document.querySelector(targetSelector);
  5562. }
  5563. if (target) {
  5564. var targetBCR = target.getBoundingClientRect();
  5565. if (targetBCR.width || targetBCR.height) {
  5566. // TODO (fat): remove sketch reliance on jQuery position/offset
  5567. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5568. }
  5569. }
  5570. return null;
  5571. }).filter(function (item) {
  5572. return item;
  5573. }).sort(function (a, b) {
  5574. return a[0] - b[0];
  5575. }).forEach(function (item) {
  5576. _this2._offsets.push(item[0]);
  5577. _this2._targets.push(item[1]);
  5578. });
  5579. };
  5580. _proto.dispose = function dispose() {
  5581. $.removeData(this._element, DATA_KEY$8);
  5582. $(this._scrollElement).off(EVENT_KEY$8);
  5583. this._element = null;
  5584. this._scrollElement = null;
  5585. this._config = null;
  5586. this._selector = null;
  5587. this._offsets = null;
  5588. this._targets = null;
  5589. this._activeTarget = null;
  5590. this._scrollHeight = null;
  5591. } // Private
  5592. ;
  5593. _proto._getConfig = function _getConfig(config) {
  5594. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5595. if (typeof config.target !== 'string') {
  5596. var id = $(config.target).attr('id');
  5597. if (!id) {
  5598. id = Util.getUID(NAME$8);
  5599. $(config.target).attr('id', id);
  5600. }
  5601. config.target = "#" + id;
  5602. }
  5603. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5604. return config;
  5605. };
  5606. _proto._getScrollTop = function _getScrollTop() {
  5607. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5608. };
  5609. _proto._getScrollHeight = function _getScrollHeight() {
  5610. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5611. };
  5612. _proto._getOffsetHeight = function _getOffsetHeight() {
  5613. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5614. };
  5615. _proto._process = function _process() {
  5616. var scrollTop = this._getScrollTop() + this._config.offset;
  5617. var scrollHeight = this._getScrollHeight();
  5618. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5619. if (this._scrollHeight !== scrollHeight) {
  5620. this.refresh();
  5621. }
  5622. if (scrollTop >= maxScroll) {
  5623. var target = this._targets[this._targets.length - 1];
  5624. if (this._activeTarget !== target) {
  5625. this._activate(target);
  5626. }
  5627. return;
  5628. }
  5629. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5630. this._activeTarget = null;
  5631. this._clear();
  5632. return;
  5633. }
  5634. var offsetLength = this._offsets.length;
  5635. for (var i = offsetLength; i--;) {
  5636. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5637. if (isActiveTarget) {
  5638. this._activate(this._targets[i]);
  5639. }
  5640. }
  5641. };
  5642. _proto._activate = function _activate(target) {
  5643. this._activeTarget = target;
  5644. this._clear();
  5645. var queries = this._selector.split(',').map(function (selector) {
  5646. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5647. });
  5648. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5649. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5650. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5651. $link.addClass(ClassName$8.ACTIVE);
  5652. } else {
  5653. // Set triggered link as active
  5654. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5655. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5656. $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
  5657. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5658. }
  5659. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5660. relatedTarget: target
  5661. });
  5662. };
  5663. _proto._clear = function _clear() {
  5664. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5665. return node.classList.contains(ClassName$8.ACTIVE);
  5666. }).forEach(function (node) {
  5667. return node.classList.remove(ClassName$8.ACTIVE);
  5668. });
  5669. } // Static
  5670. ;
  5671. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5672. return this.each(function () {
  5673. var data = $(this).data(DATA_KEY$8);
  5674. var _config = typeof config === 'object' && config;
  5675. if (!data) {
  5676. data = new ScrollSpy(this, _config);
  5677. $(this).data(DATA_KEY$8, data);
  5678. }
  5679. if (typeof config === 'string') {
  5680. if (typeof data[config] === 'undefined') {
  5681. throw new TypeError("No method named \"" + config + "\"");
  5682. }
  5683. data[config]();
  5684. }
  5685. });
  5686. };
  5687. _createClass(ScrollSpy, null, [{
  5688. key: "VERSION",
  5689. get: function get() {
  5690. return VERSION$8;
  5691. }
  5692. }, {
  5693. key: "Default",
  5694. get: function get() {
  5695. return Default$6;
  5696. }
  5697. }]);
  5698. return ScrollSpy;
  5699. }();
  5700. /**
  5701. * ------------------------------------------------------------------------
  5702. * Data Api implementation
  5703. * ------------------------------------------------------------------------
  5704. */
  5705. $(window).on(Event$8.LOAD_DATA_API, function () {
  5706. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5707. var scrollSpysLength = scrollSpys.length;
  5708. for (var i = scrollSpysLength; i--;) {
  5709. var $spy = $(scrollSpys[i]);
  5710. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5711. }
  5712. });
  5713. /**
  5714. * ------------------------------------------------------------------------
  5715. * jQuery
  5716. * ------------------------------------------------------------------------
  5717. */
  5718. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5719. $.fn[NAME$8].Constructor = ScrollSpy;
  5720. $.fn[NAME$8].noConflict = function () {
  5721. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5722. return ScrollSpy._jQueryInterface;
  5723. };
  5724. /**
  5725. * ------------------------------------------------------------------------
  5726. * Constants
  5727. * ------------------------------------------------------------------------
  5728. */
  5729. var NAME$9 = 'tab';
  5730. var VERSION$9 = '4.4.1';
  5731. var DATA_KEY$9 = 'bs.tab';
  5732. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5733. var DATA_API_KEY$7 = '.data-api';
  5734. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5735. var Event$9 = {
  5736. HIDE: "hide" + EVENT_KEY$9,
  5737. HIDDEN: "hidden" + EVENT_KEY$9,
  5738. SHOW: "show" + EVENT_KEY$9,
  5739. SHOWN: "shown" + EVENT_KEY$9,
  5740. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5741. };
  5742. var ClassName$9 = {
  5743. DROPDOWN_MENU: 'dropdown-menu',
  5744. ACTIVE: 'active',
  5745. DISABLED: 'disabled',
  5746. FADE: 'fade',
  5747. SHOW: 'show'
  5748. };
  5749. var Selector$9 = {
  5750. DROPDOWN: '.dropdown',
  5751. NAV_LIST_GROUP: '.nav, .list-group',
  5752. ACTIVE: '.active',
  5753. ACTIVE_UL: '> li > .active',
  5754. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5755. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5756. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5757. };
  5758. /**
  5759. * ------------------------------------------------------------------------
  5760. * Class Definition
  5761. * ------------------------------------------------------------------------
  5762. */
  5763. var Tab =
  5764. /*#__PURE__*/
  5765. function () {
  5766. function Tab(element) {
  5767. this._element = element;
  5768. } // Getters
  5769. var _proto = Tab.prototype;
  5770. // Public
  5771. _proto.show = function show() {
  5772. var _this = this;
  5773. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5774. return;
  5775. }
  5776. var target;
  5777. var previous;
  5778. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5779. var selector = Util.getSelectorFromElement(this._element);
  5780. if (listElement) {
  5781. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5782. previous = $.makeArray($(listElement).find(itemSelector));
  5783. previous = previous[previous.length - 1];
  5784. }
  5785. var hideEvent = $.Event(Event$9.HIDE, {
  5786. relatedTarget: this._element
  5787. });
  5788. var showEvent = $.Event(Event$9.SHOW, {
  5789. relatedTarget: previous
  5790. });
  5791. if (previous) {
  5792. $(previous).trigger(hideEvent);
  5793. }
  5794. $(this._element).trigger(showEvent);
  5795. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5796. return;
  5797. }
  5798. if (selector) {
  5799. target = document.querySelector(selector);
  5800. }
  5801. this._activate(this._element, listElement);
  5802. var complete = function complete() {
  5803. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5804. relatedTarget: _this._element
  5805. });
  5806. var shownEvent = $.Event(Event$9.SHOWN, {
  5807. relatedTarget: previous
  5808. });
  5809. $(previous).trigger(hiddenEvent);
  5810. $(_this._element).trigger(shownEvent);
  5811. };
  5812. if (target) {
  5813. this._activate(target, target.parentNode, complete);
  5814. } else {
  5815. complete();
  5816. }
  5817. };
  5818. _proto.dispose = function dispose() {
  5819. $.removeData(this._element, DATA_KEY$9);
  5820. this._element = null;
  5821. } // Private
  5822. ;
  5823. _proto._activate = function _activate(element, container, callback) {
  5824. var _this2 = this;
  5825. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5826. var active = activeElements[0];
  5827. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5828. var complete = function complete() {
  5829. return _this2._transitionComplete(element, active, callback);
  5830. };
  5831. if (active && isTransitioning) {
  5832. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5833. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5834. } else {
  5835. complete();
  5836. }
  5837. };
  5838. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5839. if (active) {
  5840. $(active).removeClass(ClassName$9.ACTIVE);
  5841. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5842. if (dropdownChild) {
  5843. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5844. }
  5845. if (active.getAttribute('role') === 'tab') {
  5846. active.setAttribute('aria-selected', false);
  5847. }
  5848. }
  5849. $(element).addClass(ClassName$9.ACTIVE);
  5850. if (element.getAttribute('role') === 'tab') {
  5851. element.setAttribute('aria-selected', true);
  5852. }
  5853. Util.reflow(element);
  5854. if (element.classList.contains(ClassName$9.FADE)) {
  5855. element.classList.add(ClassName$9.SHOW);
  5856. }
  5857. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5858. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5859. if (dropdownElement) {
  5860. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5861. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5862. }
  5863. element.setAttribute('aria-expanded', true);
  5864. }
  5865. if (callback) {
  5866. callback();
  5867. }
  5868. } // Static
  5869. ;
  5870. Tab._jQueryInterface = function _jQueryInterface(config) {
  5871. return this.each(function () {
  5872. var $this = $(this);
  5873. var data = $this.data(DATA_KEY$9);
  5874. if (!data) {
  5875. data = new Tab(this);
  5876. $this.data(DATA_KEY$9, data);
  5877. }
  5878. if (typeof config === 'string') {
  5879. if (typeof data[config] === 'undefined') {
  5880. throw new TypeError("No method named \"" + config + "\"");
  5881. }
  5882. data[config]();
  5883. }
  5884. });
  5885. };
  5886. _createClass(Tab, null, [{
  5887. key: "VERSION",
  5888. get: function get() {
  5889. return VERSION$9;
  5890. }
  5891. }]);
  5892. return Tab;
  5893. }();
  5894. /**
  5895. * ------------------------------------------------------------------------
  5896. * Data Api implementation
  5897. * ------------------------------------------------------------------------
  5898. */
  5899. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5900. event.preventDefault();
  5901. Tab._jQueryInterface.call($(this), 'show');
  5902. });
  5903. /**
  5904. * ------------------------------------------------------------------------
  5905. * jQuery
  5906. * ------------------------------------------------------------------------
  5907. */
  5908. $.fn[NAME$9] = Tab._jQueryInterface;
  5909. $.fn[NAME$9].Constructor = Tab;
  5910. $.fn[NAME$9].noConflict = function () {
  5911. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5912. return Tab._jQueryInterface;
  5913. };
  5914. /**
  5915. * ------------------------------------------------------------------------
  5916. * Constants
  5917. * ------------------------------------------------------------------------
  5918. */
  5919. var NAME$a = 'toast';
  5920. var VERSION$a = '4.4.1';
  5921. var DATA_KEY$a = 'bs.toast';
  5922. var EVENT_KEY$a = "." + DATA_KEY$a;
  5923. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5924. var Event$a = {
  5925. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5926. HIDE: "hide" + EVENT_KEY$a,
  5927. HIDDEN: "hidden" + EVENT_KEY$a,
  5928. SHOW: "show" + EVENT_KEY$a,
  5929. SHOWN: "shown" + EVENT_KEY$a
  5930. };
  5931. var ClassName$a = {
  5932. FADE: 'fade',
  5933. HIDE: 'hide',
  5934. SHOW: 'show',
  5935. SHOWING: 'showing'
  5936. };
  5937. var DefaultType$7 = {
  5938. animation: 'boolean',
  5939. autohide: 'boolean',
  5940. delay: 'number'
  5941. };
  5942. var Default$7 = {
  5943. animation: true,
  5944. autohide: true,
  5945. delay: 500
  5946. };
  5947. var Selector$a = {
  5948. DATA_DISMISS: '[data-dismiss="toast"]'
  5949. };
  5950. /**
  5951. * ------------------------------------------------------------------------
  5952. * Class Definition
  5953. * ------------------------------------------------------------------------
  5954. */
  5955. var Toast =
  5956. /*#__PURE__*/
  5957. function () {
  5958. function Toast(element, config) {
  5959. this._element = element;
  5960. this._config = this._getConfig(config);
  5961. this._timeout = null;
  5962. this._setListeners();
  5963. } // Getters
  5964. var _proto = Toast.prototype;
  5965. // Public
  5966. _proto.show = function show() {
  5967. var _this = this;
  5968. var showEvent = $.Event(Event$a.SHOW);
  5969. $(this._element).trigger(showEvent);
  5970. if (showEvent.isDefaultPrevented()) {
  5971. return;
  5972. }
  5973. if (this._config.animation) {
  5974. this._element.classList.add(ClassName$a.FADE);
  5975. }
  5976. var complete = function complete() {
  5977. _this._element.classList.remove(ClassName$a.SHOWING);
  5978. _this._element.classList.add(ClassName$a.SHOW);
  5979. $(_this._element).trigger(Event$a.SHOWN);
  5980. if (_this._config.autohide) {
  5981. _this._timeout = setTimeout(function () {
  5982. _this.hide();
  5983. }, _this._config.delay);
  5984. }
  5985. };
  5986. this._element.classList.remove(ClassName$a.HIDE);
  5987. Util.reflow(this._element);
  5988. this._element.classList.add(ClassName$a.SHOWING);
  5989. if (this._config.animation) {
  5990. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  5991. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5992. } else {
  5993. complete();
  5994. }
  5995. };
  5996. _proto.hide = function hide() {
  5997. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  5998. return;
  5999. }
  6000. var hideEvent = $.Event(Event$a.HIDE);
  6001. $(this._element).trigger(hideEvent);
  6002. if (hideEvent.isDefaultPrevented()) {
  6003. return;
  6004. }
  6005. this._close();
  6006. };
  6007. _proto.dispose = function dispose() {
  6008. clearTimeout(this._timeout);
  6009. this._timeout = null;
  6010. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6011. this._element.classList.remove(ClassName$a.SHOW);
  6012. }
  6013. $(this._element).off(Event$a.CLICK_DISMISS);
  6014. $.removeData(this._element, DATA_KEY$a);
  6015. this._element = null;
  6016. this._config = null;
  6017. } // Private
  6018. ;
  6019. _proto._getConfig = function _getConfig(config) {
  6020. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6021. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6022. return config;
  6023. };
  6024. _proto._setListeners = function _setListeners() {
  6025. var _this2 = this;
  6026. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6027. return _this2.hide();
  6028. });
  6029. };
  6030. _proto._close = function _close() {
  6031. var _this3 = this;
  6032. var complete = function complete() {
  6033. _this3._element.classList.add(ClassName$a.HIDE);
  6034. $(_this3._element).trigger(Event$a.HIDDEN);
  6035. };
  6036. this._element.classList.remove(ClassName$a.SHOW);
  6037. if (this._config.animation) {
  6038. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6039. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6040. } else {
  6041. complete();
  6042. }
  6043. } // Static
  6044. ;
  6045. Toast._jQueryInterface = function _jQueryInterface(config) {
  6046. return this.each(function () {
  6047. var $element = $(this);
  6048. var data = $element.data(DATA_KEY$a);
  6049. var _config = typeof config === 'object' && config;
  6050. if (!data) {
  6051. data = new Toast(this, _config);
  6052. $element.data(DATA_KEY$a, data);
  6053. }
  6054. if (typeof config === 'string') {
  6055. if (typeof data[config] === 'undefined') {
  6056. throw new TypeError("No method named \"" + config + "\"");
  6057. }
  6058. data[config](this);
  6059. }
  6060. });
  6061. };
  6062. _createClass(Toast, null, [{
  6063. key: "VERSION",
  6064. get: function get() {
  6065. return VERSION$a;
  6066. }
  6067. }, {
  6068. key: "DefaultType",
  6069. get: function get() {
  6070. return DefaultType$7;
  6071. }
  6072. }, {
  6073. key: "Default",
  6074. get: function get() {
  6075. return Default$7;
  6076. }
  6077. }]);
  6078. return Toast;
  6079. }();
  6080. /**
  6081. * ------------------------------------------------------------------------
  6082. * jQuery
  6083. * ------------------------------------------------------------------------
  6084. */
  6085. $.fn[NAME$a] = Toast._jQueryInterface;
  6086. $.fn[NAME$a].Constructor = Toast;
  6087. $.fn[NAME$a].noConflict = function () {
  6088. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6089. return Toast._jQueryInterface;
  6090. };
  6091. exports.Alert = Alert;
  6092. exports.Button = Button;
  6093. exports.Carousel = Carousel;
  6094. exports.Collapse = Collapse;
  6095. exports.Dropdown = Dropdown;
  6096. exports.Modal = Modal;
  6097. exports.Popover = Popover;
  6098. exports.Scrollspy = ScrollSpy;
  6099. exports.Tab = Tab;
  6100. exports.Toast = Toast;
  6101. exports.Tooltip = Tooltip;
  6102. exports.Util = Util;
  6103. Object.defineProperty(exports, '__esModule', { value: true });
  6104. })));
  6105. //# sourceMappingURL=bootstrap.js.map
  6106. /***/ }),
  6107. /***/ "./node_modules/buffer/index.js":
  6108. /*!**************************************!*\
  6109. !*** ./node_modules/buffer/index.js ***!
  6110. \**************************************/
  6111. /*! no static exports found */
  6112. /***/ (function(module, exports, __webpack_require__) {
  6113. "use strict";
  6114. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6115. * The buffer module from node.js, for the browser.
  6116. *
  6117. * @author Feross Aboukhadijeh <http://feross.org>
  6118. * @license MIT
  6119. */
  6120. /* eslint-disable no-proto */
  6121. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6122. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6123. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6124. exports.Buffer = Buffer
  6125. exports.SlowBuffer = SlowBuffer
  6126. exports.INSPECT_MAX_BYTES = 50
  6127. /**
  6128. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6129. * === true Use Uint8Array implementation (fastest)
  6130. * === false Use Object implementation (most compatible, even IE6)
  6131. *
  6132. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6133. * Opera 11.6+, iOS 4.2+.
  6134. *
  6135. * Due to various browser bugs, sometimes the Object implementation will be used even
  6136. * when the browser supports typed arrays.
  6137. *
  6138. * Note:
  6139. *
  6140. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6141. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6142. *
  6143. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6144. *
  6145. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6146. * incorrect length in some situations.
  6147. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6148. * get the Object implementation, which is slower but behaves correctly.
  6149. */
  6150. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6151. ? global.TYPED_ARRAY_SUPPORT
  6152. : typedArraySupport()
  6153. /*
  6154. * Export kMaxLength after typed array support is determined.
  6155. */
  6156. exports.kMaxLength = kMaxLength()
  6157. function typedArraySupport () {
  6158. try {
  6159. var arr = new Uint8Array(1)
  6160. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6161. return arr.foo() === 42 && // typed array instances can be augmented
  6162. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6163. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6164. } catch (e) {
  6165. return false
  6166. }
  6167. }
  6168. function kMaxLength () {
  6169. return Buffer.TYPED_ARRAY_SUPPORT
  6170. ? 0x7fffffff
  6171. : 0x3fffffff
  6172. }
  6173. function createBuffer (that, length) {
  6174. if (kMaxLength() < length) {
  6175. throw new RangeError('Invalid typed array length')
  6176. }
  6177. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6178. // Return an augmented `Uint8Array` instance, for best performance
  6179. that = new Uint8Array(length)
  6180. that.__proto__ = Buffer.prototype
  6181. } else {
  6182. // Fallback: Return an object instance of the Buffer class
  6183. if (that === null) {
  6184. that = new Buffer(length)
  6185. }
  6186. that.length = length
  6187. }
  6188. return that
  6189. }
  6190. /**
  6191. * The Buffer constructor returns instances of `Uint8Array` that have their
  6192. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6193. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6194. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6195. * returns a single octet.
  6196. *
  6197. * The `Uint8Array` prototype remains unmodified.
  6198. */
  6199. function Buffer (arg, encodingOrOffset, length) {
  6200. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6201. return new Buffer(arg, encodingOrOffset, length)
  6202. }
  6203. // Common case.
  6204. if (typeof arg === 'number') {
  6205. if (typeof encodingOrOffset === 'string') {
  6206. throw new Error(
  6207. 'If encoding is specified then the first argument must be a string'
  6208. )
  6209. }
  6210. return allocUnsafe(this, arg)
  6211. }
  6212. return from(this, arg, encodingOrOffset, length)
  6213. }
  6214. Buffer.poolSize = 8192 // not used by this implementation
  6215. // TODO: Legacy, not needed anymore. Remove in next major version.
  6216. Buffer._augment = function (arr) {
  6217. arr.__proto__ = Buffer.prototype
  6218. return arr
  6219. }
  6220. function from (that, value, encodingOrOffset, length) {
  6221. if (typeof value === 'number') {
  6222. throw new TypeError('"value" argument must not be a number')
  6223. }
  6224. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6225. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6226. }
  6227. if (typeof value === 'string') {
  6228. return fromString(that, value, encodingOrOffset)
  6229. }
  6230. return fromObject(that, value)
  6231. }
  6232. /**
  6233. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6234. * if value is a number.
  6235. * Buffer.from(str[, encoding])
  6236. * Buffer.from(array)
  6237. * Buffer.from(buffer)
  6238. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6239. **/
  6240. Buffer.from = function (value, encodingOrOffset, length) {
  6241. return from(null, value, encodingOrOffset, length)
  6242. }
  6243. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6244. Buffer.prototype.__proto__ = Uint8Array.prototype
  6245. Buffer.__proto__ = Uint8Array
  6246. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6247. Buffer[Symbol.species] === Buffer) {
  6248. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6249. Object.defineProperty(Buffer, Symbol.species, {
  6250. value: null,
  6251. configurable: true
  6252. })
  6253. }
  6254. }
  6255. function assertSize (size) {
  6256. if (typeof size !== 'number') {
  6257. throw new TypeError('"size" argument must be a number')
  6258. } else if (size < 0) {
  6259. throw new RangeError('"size" argument must not be negative')
  6260. }
  6261. }
  6262. function alloc (that, size, fill, encoding) {
  6263. assertSize(size)
  6264. if (size <= 0) {
  6265. return createBuffer(that, size)
  6266. }
  6267. if (fill !== undefined) {
  6268. // Only pay attention to encoding if it's a string. This
  6269. // prevents accidentally sending in a number that would
  6270. // be interpretted as a start offset.
  6271. return typeof encoding === 'string'
  6272. ? createBuffer(that, size).fill(fill, encoding)
  6273. : createBuffer(that, size).fill(fill)
  6274. }
  6275. return createBuffer(that, size)
  6276. }
  6277. /**
  6278. * Creates a new filled Buffer instance.
  6279. * alloc(size[, fill[, encoding]])
  6280. **/
  6281. Buffer.alloc = function (size, fill, encoding) {
  6282. return alloc(null, size, fill, encoding)
  6283. }
  6284. function allocUnsafe (that, size) {
  6285. assertSize(size)
  6286. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6287. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6288. for (var i = 0; i < size; ++i) {
  6289. that[i] = 0
  6290. }
  6291. }
  6292. return that
  6293. }
  6294. /**
  6295. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6296. * */
  6297. Buffer.allocUnsafe = function (size) {
  6298. return allocUnsafe(null, size)
  6299. }
  6300. /**
  6301. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6302. */
  6303. Buffer.allocUnsafeSlow = function (size) {
  6304. return allocUnsafe(null, size)
  6305. }
  6306. function fromString (that, string, encoding) {
  6307. if (typeof encoding !== 'string' || encoding === '') {
  6308. encoding = 'utf8'
  6309. }
  6310. if (!Buffer.isEncoding(encoding)) {
  6311. throw new TypeError('"encoding" must be a valid string encoding')
  6312. }
  6313. var length = byteLength(string, encoding) | 0
  6314. that = createBuffer(that, length)
  6315. var actual = that.write(string, encoding)
  6316. if (actual !== length) {
  6317. // Writing a hex string, for example, that contains invalid characters will
  6318. // cause everything after the first invalid character to be ignored. (e.g.
  6319. // 'abxxcd' will be treated as 'ab')
  6320. that = that.slice(0, actual)
  6321. }
  6322. return that
  6323. }
  6324. function fromArrayLike (that, array) {
  6325. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6326. that = createBuffer(that, length)
  6327. for (var i = 0; i < length; i += 1) {
  6328. that[i] = array[i] & 255
  6329. }
  6330. return that
  6331. }
  6332. function fromArrayBuffer (that, array, byteOffset, length) {
  6333. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6334. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6335. throw new RangeError('\'offset\' is out of bounds')
  6336. }
  6337. if (array.byteLength < byteOffset + (length || 0)) {
  6338. throw new RangeError('\'length\' is out of bounds')
  6339. }
  6340. if (byteOffset === undefined && length === undefined) {
  6341. array = new Uint8Array(array)
  6342. } else if (length === undefined) {
  6343. array = new Uint8Array(array, byteOffset)
  6344. } else {
  6345. array = new Uint8Array(array, byteOffset, length)
  6346. }
  6347. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6348. // Return an augmented `Uint8Array` instance, for best performance
  6349. that = array
  6350. that.__proto__ = Buffer.prototype
  6351. } else {
  6352. // Fallback: Return an object instance of the Buffer class
  6353. that = fromArrayLike(that, array)
  6354. }
  6355. return that
  6356. }
  6357. function fromObject (that, obj) {
  6358. if (Buffer.isBuffer(obj)) {
  6359. var len = checked(obj.length) | 0
  6360. that = createBuffer(that, len)
  6361. if (that.length === 0) {
  6362. return that
  6363. }
  6364. obj.copy(that, 0, 0, len)
  6365. return that
  6366. }
  6367. if (obj) {
  6368. if ((typeof ArrayBuffer !== 'undefined' &&
  6369. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6370. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6371. return createBuffer(that, 0)
  6372. }
  6373. return fromArrayLike(that, obj)
  6374. }
  6375. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6376. return fromArrayLike(that, obj.data)
  6377. }
  6378. }
  6379. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6380. }
  6381. function checked (length) {
  6382. // Note: cannot use `length < kMaxLength()` here because that fails when
  6383. // length is NaN (which is otherwise coerced to zero.)
  6384. if (length >= kMaxLength()) {
  6385. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6386. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6387. }
  6388. return length | 0
  6389. }
  6390. function SlowBuffer (length) {
  6391. if (+length != length) { // eslint-disable-line eqeqeq
  6392. length = 0
  6393. }
  6394. return Buffer.alloc(+length)
  6395. }
  6396. Buffer.isBuffer = function isBuffer (b) {
  6397. return !!(b != null && b._isBuffer)
  6398. }
  6399. Buffer.compare = function compare (a, b) {
  6400. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6401. throw new TypeError('Arguments must be Buffers')
  6402. }
  6403. if (a === b) return 0
  6404. var x = a.length
  6405. var y = b.length
  6406. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6407. if (a[i] !== b[i]) {
  6408. x = a[i]
  6409. y = b[i]
  6410. break
  6411. }
  6412. }
  6413. if (x < y) return -1
  6414. if (y < x) return 1
  6415. return 0
  6416. }
  6417. Buffer.isEncoding = function isEncoding (encoding) {
  6418. switch (String(encoding).toLowerCase()) {
  6419. case 'hex':
  6420. case 'utf8':
  6421. case 'utf-8':
  6422. case 'ascii':
  6423. case 'latin1':
  6424. case 'binary':
  6425. case 'base64':
  6426. case 'ucs2':
  6427. case 'ucs-2':
  6428. case 'utf16le':
  6429. case 'utf-16le':
  6430. return true
  6431. default:
  6432. return false
  6433. }
  6434. }
  6435. Buffer.concat = function concat (list, length) {
  6436. if (!isArray(list)) {
  6437. throw new TypeError('"list" argument must be an Array of Buffers')
  6438. }
  6439. if (list.length === 0) {
  6440. return Buffer.alloc(0)
  6441. }
  6442. var i
  6443. if (length === undefined) {
  6444. length = 0
  6445. for (i = 0; i < list.length; ++i) {
  6446. length += list[i].length
  6447. }
  6448. }
  6449. var buffer = Buffer.allocUnsafe(length)
  6450. var pos = 0
  6451. for (i = 0; i < list.length; ++i) {
  6452. var buf = list[i]
  6453. if (!Buffer.isBuffer(buf)) {
  6454. throw new TypeError('"list" argument must be an Array of Buffers')
  6455. }
  6456. buf.copy(buffer, pos)
  6457. pos += buf.length
  6458. }
  6459. return buffer
  6460. }
  6461. function byteLength (string, encoding) {
  6462. if (Buffer.isBuffer(string)) {
  6463. return string.length
  6464. }
  6465. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6466. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6467. return string.byteLength
  6468. }
  6469. if (typeof string !== 'string') {
  6470. string = '' + string
  6471. }
  6472. var len = string.length
  6473. if (len === 0) return 0
  6474. // Use a for loop to avoid recursion
  6475. var loweredCase = false
  6476. for (;;) {
  6477. switch (encoding) {
  6478. case 'ascii':
  6479. case 'latin1':
  6480. case 'binary':
  6481. return len
  6482. case 'utf8':
  6483. case 'utf-8':
  6484. case undefined:
  6485. return utf8ToBytes(string).length
  6486. case 'ucs2':
  6487. case 'ucs-2':
  6488. case 'utf16le':
  6489. case 'utf-16le':
  6490. return len * 2
  6491. case 'hex':
  6492. return len >>> 1
  6493. case 'base64':
  6494. return base64ToBytes(string).length
  6495. default:
  6496. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6497. encoding = ('' + encoding).toLowerCase()
  6498. loweredCase = true
  6499. }
  6500. }
  6501. }
  6502. Buffer.byteLength = byteLength
  6503. function slowToString (encoding, start, end) {
  6504. var loweredCase = false
  6505. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6506. // property of a typed array.
  6507. // This behaves neither like String nor Uint8Array in that we set start/end
  6508. // to their upper/lower bounds if the value passed is out of range.
  6509. // undefined is handled specially as per ECMA-262 6th Edition,
  6510. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6511. if (start === undefined || start < 0) {
  6512. start = 0
  6513. }
  6514. // Return early if start > this.length. Done here to prevent potential uint32
  6515. // coercion fail below.
  6516. if (start > this.length) {
  6517. return ''
  6518. }
  6519. if (end === undefined || end > this.length) {
  6520. end = this.length
  6521. }
  6522. if (end <= 0) {
  6523. return ''
  6524. }
  6525. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6526. end >>>= 0
  6527. start >>>= 0
  6528. if (end <= start) {
  6529. return ''
  6530. }
  6531. if (!encoding) encoding = 'utf8'
  6532. while (true) {
  6533. switch (encoding) {
  6534. case 'hex':
  6535. return hexSlice(this, start, end)
  6536. case 'utf8':
  6537. case 'utf-8':
  6538. return utf8Slice(this, start, end)
  6539. case 'ascii':
  6540. return asciiSlice(this, start, end)
  6541. case 'latin1':
  6542. case 'binary':
  6543. return latin1Slice(this, start, end)
  6544. case 'base64':
  6545. return base64Slice(this, start, end)
  6546. case 'ucs2':
  6547. case 'ucs-2':
  6548. case 'utf16le':
  6549. case 'utf-16le':
  6550. return utf16leSlice(this, start, end)
  6551. default:
  6552. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6553. encoding = (encoding + '').toLowerCase()
  6554. loweredCase = true
  6555. }
  6556. }
  6557. }
  6558. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6559. // Buffer instances.
  6560. Buffer.prototype._isBuffer = true
  6561. function swap (b, n, m) {
  6562. var i = b[n]
  6563. b[n] = b[m]
  6564. b[m] = i
  6565. }
  6566. Buffer.prototype.swap16 = function swap16 () {
  6567. var len = this.length
  6568. if (len % 2 !== 0) {
  6569. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6570. }
  6571. for (var i = 0; i < len; i += 2) {
  6572. swap(this, i, i + 1)
  6573. }
  6574. return this
  6575. }
  6576. Buffer.prototype.swap32 = function swap32 () {
  6577. var len = this.length
  6578. if (len % 4 !== 0) {
  6579. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6580. }
  6581. for (var i = 0; i < len; i += 4) {
  6582. swap(this, i, i + 3)
  6583. swap(this, i + 1, i + 2)
  6584. }
  6585. return this
  6586. }
  6587. Buffer.prototype.swap64 = function swap64 () {
  6588. var len = this.length
  6589. if (len % 8 !== 0) {
  6590. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6591. }
  6592. for (var i = 0; i < len; i += 8) {
  6593. swap(this, i, i + 7)
  6594. swap(this, i + 1, i + 6)
  6595. swap(this, i + 2, i + 5)
  6596. swap(this, i + 3, i + 4)
  6597. }
  6598. return this
  6599. }
  6600. Buffer.prototype.toString = function toString () {
  6601. var length = this.length | 0
  6602. if (length === 0) return ''
  6603. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6604. return slowToString.apply(this, arguments)
  6605. }
  6606. Buffer.prototype.equals = function equals (b) {
  6607. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6608. if (this === b) return true
  6609. return Buffer.compare(this, b) === 0
  6610. }
  6611. Buffer.prototype.inspect = function inspect () {
  6612. var str = ''
  6613. var max = exports.INSPECT_MAX_BYTES
  6614. if (this.length > 0) {
  6615. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6616. if (this.length > max) str += ' ... '
  6617. }
  6618. return '<Buffer ' + str + '>'
  6619. }
  6620. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6621. if (!Buffer.isBuffer(target)) {
  6622. throw new TypeError('Argument must be a Buffer')
  6623. }
  6624. if (start === undefined) {
  6625. start = 0
  6626. }
  6627. if (end === undefined) {
  6628. end = target ? target.length : 0
  6629. }
  6630. if (thisStart === undefined) {
  6631. thisStart = 0
  6632. }
  6633. if (thisEnd === undefined) {
  6634. thisEnd = this.length
  6635. }
  6636. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6637. throw new RangeError('out of range index')
  6638. }
  6639. if (thisStart >= thisEnd && start >= end) {
  6640. return 0
  6641. }
  6642. if (thisStart >= thisEnd) {
  6643. return -1
  6644. }
  6645. if (start >= end) {
  6646. return 1
  6647. }
  6648. start >>>= 0
  6649. end >>>= 0
  6650. thisStart >>>= 0
  6651. thisEnd >>>= 0
  6652. if (this === target) return 0
  6653. var x = thisEnd - thisStart
  6654. var y = end - start
  6655. var len = Math.min(x, y)
  6656. var thisCopy = this.slice(thisStart, thisEnd)
  6657. var targetCopy = target.slice(start, end)
  6658. for (var i = 0; i < len; ++i) {
  6659. if (thisCopy[i] !== targetCopy[i]) {
  6660. x = thisCopy[i]
  6661. y = targetCopy[i]
  6662. break
  6663. }
  6664. }
  6665. if (x < y) return -1
  6666. if (y < x) return 1
  6667. return 0
  6668. }
  6669. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6670. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6671. //
  6672. // Arguments:
  6673. // - buffer - a Buffer to search
  6674. // - val - a string, Buffer, or number
  6675. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6676. // - encoding - an optional encoding, relevant is val is a string
  6677. // - dir - true for indexOf, false for lastIndexOf
  6678. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6679. // Empty buffer means no match
  6680. if (buffer.length === 0) return -1
  6681. // Normalize byteOffset
  6682. if (typeof byteOffset === 'string') {
  6683. encoding = byteOffset
  6684. byteOffset = 0
  6685. } else if (byteOffset > 0x7fffffff) {
  6686. byteOffset = 0x7fffffff
  6687. } else if (byteOffset < -0x80000000) {
  6688. byteOffset = -0x80000000
  6689. }
  6690. byteOffset = +byteOffset // Coerce to Number.
  6691. if (isNaN(byteOffset)) {
  6692. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6693. byteOffset = dir ? 0 : (buffer.length - 1)
  6694. }
  6695. // Normalize byteOffset: negative offsets start from the end of the buffer
  6696. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6697. if (byteOffset >= buffer.length) {
  6698. if (dir) return -1
  6699. else byteOffset = buffer.length - 1
  6700. } else if (byteOffset < 0) {
  6701. if (dir) byteOffset = 0
  6702. else return -1
  6703. }
  6704. // Normalize val
  6705. if (typeof val === 'string') {
  6706. val = Buffer.from(val, encoding)
  6707. }
  6708. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6709. if (Buffer.isBuffer(val)) {
  6710. // Special case: looking for empty string/buffer always fails
  6711. if (val.length === 0) {
  6712. return -1
  6713. }
  6714. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6715. } else if (typeof val === 'number') {
  6716. val = val & 0xFF // Search for a byte value [0-255]
  6717. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6718. typeof Uint8Array.prototype.indexOf === 'function') {
  6719. if (dir) {
  6720. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6721. } else {
  6722. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6723. }
  6724. }
  6725. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6726. }
  6727. throw new TypeError('val must be string, number or Buffer')
  6728. }
  6729. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6730. var indexSize = 1
  6731. var arrLength = arr.length
  6732. var valLength = val.length
  6733. if (encoding !== undefined) {
  6734. encoding = String(encoding).toLowerCase()
  6735. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6736. encoding === 'utf16le' || encoding === 'utf-16le') {
  6737. if (arr.length < 2 || val.length < 2) {
  6738. return -1
  6739. }
  6740. indexSize = 2
  6741. arrLength /= 2
  6742. valLength /= 2
  6743. byteOffset /= 2
  6744. }
  6745. }
  6746. function read (buf, i) {
  6747. if (indexSize === 1) {
  6748. return buf[i]
  6749. } else {
  6750. return buf.readUInt16BE(i * indexSize)
  6751. }
  6752. }
  6753. var i
  6754. if (dir) {
  6755. var foundIndex = -1
  6756. for (i = byteOffset; i < arrLength; i++) {
  6757. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6758. if (foundIndex === -1) foundIndex = i
  6759. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6760. } else {
  6761. if (foundIndex !== -1) i -= i - foundIndex
  6762. foundIndex = -1
  6763. }
  6764. }
  6765. } else {
  6766. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6767. for (i = byteOffset; i >= 0; i--) {
  6768. var found = true
  6769. for (var j = 0; j < valLength; j++) {
  6770. if (read(arr, i + j) !== read(val, j)) {
  6771. found = false
  6772. break
  6773. }
  6774. }
  6775. if (found) return i
  6776. }
  6777. }
  6778. return -1
  6779. }
  6780. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6781. return this.indexOf(val, byteOffset, encoding) !== -1
  6782. }
  6783. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6784. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6785. }
  6786. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6787. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6788. }
  6789. function hexWrite (buf, string, offset, length) {
  6790. offset = Number(offset) || 0
  6791. var remaining = buf.length - offset
  6792. if (!length) {
  6793. length = remaining
  6794. } else {
  6795. length = Number(length)
  6796. if (length > remaining) {
  6797. length = remaining
  6798. }
  6799. }
  6800. // must be an even number of digits
  6801. var strLen = string.length
  6802. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6803. if (length > strLen / 2) {
  6804. length = strLen / 2
  6805. }
  6806. for (var i = 0; i < length; ++i) {
  6807. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6808. if (isNaN(parsed)) return i
  6809. buf[offset + i] = parsed
  6810. }
  6811. return i
  6812. }
  6813. function utf8Write (buf, string, offset, length) {
  6814. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6815. }
  6816. function asciiWrite (buf, string, offset, length) {
  6817. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6818. }
  6819. function latin1Write (buf, string, offset, length) {
  6820. return asciiWrite(buf, string, offset, length)
  6821. }
  6822. function base64Write (buf, string, offset, length) {
  6823. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6824. }
  6825. function ucs2Write (buf, string, offset, length) {
  6826. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6827. }
  6828. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6829. // Buffer#write(string)
  6830. if (offset === undefined) {
  6831. encoding = 'utf8'
  6832. length = this.length
  6833. offset = 0
  6834. // Buffer#write(string, encoding)
  6835. } else if (length === undefined && typeof offset === 'string') {
  6836. encoding = offset
  6837. length = this.length
  6838. offset = 0
  6839. // Buffer#write(string, offset[, length][, encoding])
  6840. } else if (isFinite(offset)) {
  6841. offset = offset | 0
  6842. if (isFinite(length)) {
  6843. length = length | 0
  6844. if (encoding === undefined) encoding = 'utf8'
  6845. } else {
  6846. encoding = length
  6847. length = undefined
  6848. }
  6849. // legacy write(string, encoding, offset, length) - remove in v0.13
  6850. } else {
  6851. throw new Error(
  6852. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6853. )
  6854. }
  6855. var remaining = this.length - offset
  6856. if (length === undefined || length > remaining) length = remaining
  6857. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6858. throw new RangeError('Attempt to write outside buffer bounds')
  6859. }
  6860. if (!encoding) encoding = 'utf8'
  6861. var loweredCase = false
  6862. for (;;) {
  6863. switch (encoding) {
  6864. case 'hex':
  6865. return hexWrite(this, string, offset, length)
  6866. case 'utf8':
  6867. case 'utf-8':
  6868. return utf8Write(this, string, offset, length)
  6869. case 'ascii':
  6870. return asciiWrite(this, string, offset, length)
  6871. case 'latin1':
  6872. case 'binary':
  6873. return latin1Write(this, string, offset, length)
  6874. case 'base64':
  6875. // Warning: maxLength not taken into account in base64Write
  6876. return base64Write(this, string, offset, length)
  6877. case 'ucs2':
  6878. case 'ucs-2':
  6879. case 'utf16le':
  6880. case 'utf-16le':
  6881. return ucs2Write(this, string, offset, length)
  6882. default:
  6883. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6884. encoding = ('' + encoding).toLowerCase()
  6885. loweredCase = true
  6886. }
  6887. }
  6888. }
  6889. Buffer.prototype.toJSON = function toJSON () {
  6890. return {
  6891. type: 'Buffer',
  6892. data: Array.prototype.slice.call(this._arr || this, 0)
  6893. }
  6894. }
  6895. function base64Slice (buf, start, end) {
  6896. if (start === 0 && end === buf.length) {
  6897. return base64.fromByteArray(buf)
  6898. } else {
  6899. return base64.fromByteArray(buf.slice(start, end))
  6900. }
  6901. }
  6902. function utf8Slice (buf, start, end) {
  6903. end = Math.min(buf.length, end)
  6904. var res = []
  6905. var i = start
  6906. while (i < end) {
  6907. var firstByte = buf[i]
  6908. var codePoint = null
  6909. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6910. : (firstByte > 0xDF) ? 3
  6911. : (firstByte > 0xBF) ? 2
  6912. : 1
  6913. if (i + bytesPerSequence <= end) {
  6914. var secondByte, thirdByte, fourthByte, tempCodePoint
  6915. switch (bytesPerSequence) {
  6916. case 1:
  6917. if (firstByte < 0x80) {
  6918. codePoint = firstByte
  6919. }
  6920. break
  6921. case 2:
  6922. secondByte = buf[i + 1]
  6923. if ((secondByte & 0xC0) === 0x80) {
  6924. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6925. if (tempCodePoint > 0x7F) {
  6926. codePoint = tempCodePoint
  6927. }
  6928. }
  6929. break
  6930. case 3:
  6931. secondByte = buf[i + 1]
  6932. thirdByte = buf[i + 2]
  6933. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6934. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6935. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6936. codePoint = tempCodePoint
  6937. }
  6938. }
  6939. break
  6940. case 4:
  6941. secondByte = buf[i + 1]
  6942. thirdByte = buf[i + 2]
  6943. fourthByte = buf[i + 3]
  6944. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6945. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6946. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6947. codePoint = tempCodePoint
  6948. }
  6949. }
  6950. }
  6951. }
  6952. if (codePoint === null) {
  6953. // we did not generate a valid codePoint so insert a
  6954. // replacement char (U+FFFD) and advance only 1 byte
  6955. codePoint = 0xFFFD
  6956. bytesPerSequence = 1
  6957. } else if (codePoint > 0xFFFF) {
  6958. // encode to utf16 (surrogate pair dance)
  6959. codePoint -= 0x10000
  6960. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6961. codePoint = 0xDC00 | codePoint & 0x3FF
  6962. }
  6963. res.push(codePoint)
  6964. i += bytesPerSequence
  6965. }
  6966. return decodeCodePointsArray(res)
  6967. }
  6968. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6969. // the lowest limit is Chrome, with 0x10000 args.
  6970. // We go 1 magnitude less, for safety
  6971. var MAX_ARGUMENTS_LENGTH = 0x1000
  6972. function decodeCodePointsArray (codePoints) {
  6973. var len = codePoints.length
  6974. if (len <= MAX_ARGUMENTS_LENGTH) {
  6975. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6976. }
  6977. // Decode in chunks to avoid "call stack size exceeded".
  6978. var res = ''
  6979. var i = 0
  6980. while (i < len) {
  6981. res += String.fromCharCode.apply(
  6982. String,
  6983. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  6984. )
  6985. }
  6986. return res
  6987. }
  6988. function asciiSlice (buf, start, end) {
  6989. var ret = ''
  6990. end = Math.min(buf.length, end)
  6991. for (var i = start; i < end; ++i) {
  6992. ret += String.fromCharCode(buf[i] & 0x7F)
  6993. }
  6994. return ret
  6995. }
  6996. function latin1Slice (buf, start, end) {
  6997. var ret = ''
  6998. end = Math.min(buf.length, end)
  6999. for (var i = start; i < end; ++i) {
  7000. ret += String.fromCharCode(buf[i])
  7001. }
  7002. return ret
  7003. }
  7004. function hexSlice (buf, start, end) {
  7005. var len = buf.length
  7006. if (!start || start < 0) start = 0
  7007. if (!end || end < 0 || end > len) end = len
  7008. var out = ''
  7009. for (var i = start; i < end; ++i) {
  7010. out += toHex(buf[i])
  7011. }
  7012. return out
  7013. }
  7014. function utf16leSlice (buf, start, end) {
  7015. var bytes = buf.slice(start, end)
  7016. var res = ''
  7017. for (var i = 0; i < bytes.length; i += 2) {
  7018. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7019. }
  7020. return res
  7021. }
  7022. Buffer.prototype.slice = function slice (start, end) {
  7023. var len = this.length
  7024. start = ~~start
  7025. end = end === undefined ? len : ~~end
  7026. if (start < 0) {
  7027. start += len
  7028. if (start < 0) start = 0
  7029. } else if (start > len) {
  7030. start = len
  7031. }
  7032. if (end < 0) {
  7033. end += len
  7034. if (end < 0) end = 0
  7035. } else if (end > len) {
  7036. end = len
  7037. }
  7038. if (end < start) end = start
  7039. var newBuf
  7040. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7041. newBuf = this.subarray(start, end)
  7042. newBuf.__proto__ = Buffer.prototype
  7043. } else {
  7044. var sliceLen = end - start
  7045. newBuf = new Buffer(sliceLen, undefined)
  7046. for (var i = 0; i < sliceLen; ++i) {
  7047. newBuf[i] = this[i + start]
  7048. }
  7049. }
  7050. return newBuf
  7051. }
  7052. /*
  7053. * Need to make sure that buffer isn't trying to write out of bounds.
  7054. */
  7055. function checkOffset (offset, ext, length) {
  7056. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7057. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7058. }
  7059. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7060. offset = offset | 0
  7061. byteLength = byteLength | 0
  7062. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7063. var val = this[offset]
  7064. var mul = 1
  7065. var i = 0
  7066. while (++i < byteLength && (mul *= 0x100)) {
  7067. val += this[offset + i] * mul
  7068. }
  7069. return val
  7070. }
  7071. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7072. offset = offset | 0
  7073. byteLength = byteLength | 0
  7074. if (!noAssert) {
  7075. checkOffset(offset, byteLength, this.length)
  7076. }
  7077. var val = this[offset + --byteLength]
  7078. var mul = 1
  7079. while (byteLength > 0 && (mul *= 0x100)) {
  7080. val += this[offset + --byteLength] * mul
  7081. }
  7082. return val
  7083. }
  7084. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7085. if (!noAssert) checkOffset(offset, 1, this.length)
  7086. return this[offset]
  7087. }
  7088. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7089. if (!noAssert) checkOffset(offset, 2, this.length)
  7090. return this[offset] | (this[offset + 1] << 8)
  7091. }
  7092. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7093. if (!noAssert) checkOffset(offset, 2, this.length)
  7094. return (this[offset] << 8) | this[offset + 1]
  7095. }
  7096. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7097. if (!noAssert) checkOffset(offset, 4, this.length)
  7098. return ((this[offset]) |
  7099. (this[offset + 1] << 8) |
  7100. (this[offset + 2] << 16)) +
  7101. (this[offset + 3] * 0x1000000)
  7102. }
  7103. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7104. if (!noAssert) checkOffset(offset, 4, this.length)
  7105. return (this[offset] * 0x1000000) +
  7106. ((this[offset + 1] << 16) |
  7107. (this[offset + 2] << 8) |
  7108. this[offset + 3])
  7109. }
  7110. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7111. offset = offset | 0
  7112. byteLength = byteLength | 0
  7113. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7114. var val = this[offset]
  7115. var mul = 1
  7116. var i = 0
  7117. while (++i < byteLength && (mul *= 0x100)) {
  7118. val += this[offset + i] * mul
  7119. }
  7120. mul *= 0x80
  7121. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7122. return val
  7123. }
  7124. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7125. offset = offset | 0
  7126. byteLength = byteLength | 0
  7127. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7128. var i = byteLength
  7129. var mul = 1
  7130. var val = this[offset + --i]
  7131. while (i > 0 && (mul *= 0x100)) {
  7132. val += this[offset + --i] * mul
  7133. }
  7134. mul *= 0x80
  7135. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7136. return val
  7137. }
  7138. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7139. if (!noAssert) checkOffset(offset, 1, this.length)
  7140. if (!(this[offset] & 0x80)) return (this[offset])
  7141. return ((0xff - this[offset] + 1) * -1)
  7142. }
  7143. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7144. if (!noAssert) checkOffset(offset, 2, this.length)
  7145. var val = this[offset] | (this[offset + 1] << 8)
  7146. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7147. }
  7148. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7149. if (!noAssert) checkOffset(offset, 2, this.length)
  7150. var val = this[offset + 1] | (this[offset] << 8)
  7151. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7152. }
  7153. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7154. if (!noAssert) checkOffset(offset, 4, this.length)
  7155. return (this[offset]) |
  7156. (this[offset + 1] << 8) |
  7157. (this[offset + 2] << 16) |
  7158. (this[offset + 3] << 24)
  7159. }
  7160. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7161. if (!noAssert) checkOffset(offset, 4, this.length)
  7162. return (this[offset] << 24) |
  7163. (this[offset + 1] << 16) |
  7164. (this[offset + 2] << 8) |
  7165. (this[offset + 3])
  7166. }
  7167. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7168. if (!noAssert) checkOffset(offset, 4, this.length)
  7169. return ieee754.read(this, offset, true, 23, 4)
  7170. }
  7171. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7172. if (!noAssert) checkOffset(offset, 4, this.length)
  7173. return ieee754.read(this, offset, false, 23, 4)
  7174. }
  7175. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7176. if (!noAssert) checkOffset(offset, 8, this.length)
  7177. return ieee754.read(this, offset, true, 52, 8)
  7178. }
  7179. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7180. if (!noAssert) checkOffset(offset, 8, this.length)
  7181. return ieee754.read(this, offset, false, 52, 8)
  7182. }
  7183. function checkInt (buf, value, offset, ext, max, min) {
  7184. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7185. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7186. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7187. }
  7188. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7189. value = +value
  7190. offset = offset | 0
  7191. byteLength = byteLength | 0
  7192. if (!noAssert) {
  7193. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7194. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7195. }
  7196. var mul = 1
  7197. var i = 0
  7198. this[offset] = value & 0xFF
  7199. while (++i < byteLength && (mul *= 0x100)) {
  7200. this[offset + i] = (value / mul) & 0xFF
  7201. }
  7202. return offset + byteLength
  7203. }
  7204. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7205. value = +value
  7206. offset = offset | 0
  7207. byteLength = byteLength | 0
  7208. if (!noAssert) {
  7209. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7210. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7211. }
  7212. var i = byteLength - 1
  7213. var mul = 1
  7214. this[offset + i] = value & 0xFF
  7215. while (--i >= 0 && (mul *= 0x100)) {
  7216. this[offset + i] = (value / mul) & 0xFF
  7217. }
  7218. return offset + byteLength
  7219. }
  7220. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7221. value = +value
  7222. offset = offset | 0
  7223. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7224. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7225. this[offset] = (value & 0xff)
  7226. return offset + 1
  7227. }
  7228. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7229. if (value < 0) value = 0xffff + value + 1
  7230. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7231. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7232. (littleEndian ? i : 1 - i) * 8
  7233. }
  7234. }
  7235. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7236. value = +value
  7237. offset = offset | 0
  7238. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7239. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7240. this[offset] = (value & 0xff)
  7241. this[offset + 1] = (value >>> 8)
  7242. } else {
  7243. objectWriteUInt16(this, value, offset, true)
  7244. }
  7245. return offset + 2
  7246. }
  7247. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7248. value = +value
  7249. offset = offset | 0
  7250. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7251. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7252. this[offset] = (value >>> 8)
  7253. this[offset + 1] = (value & 0xff)
  7254. } else {
  7255. objectWriteUInt16(this, value, offset, false)
  7256. }
  7257. return offset + 2
  7258. }
  7259. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7260. if (value < 0) value = 0xffffffff + value + 1
  7261. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7262. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7263. }
  7264. }
  7265. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7266. value = +value
  7267. offset = offset | 0
  7268. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7269. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7270. this[offset + 3] = (value >>> 24)
  7271. this[offset + 2] = (value >>> 16)
  7272. this[offset + 1] = (value >>> 8)
  7273. this[offset] = (value & 0xff)
  7274. } else {
  7275. objectWriteUInt32(this, value, offset, true)
  7276. }
  7277. return offset + 4
  7278. }
  7279. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7280. value = +value
  7281. offset = offset | 0
  7282. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7283. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7284. this[offset] = (value >>> 24)
  7285. this[offset + 1] = (value >>> 16)
  7286. this[offset + 2] = (value >>> 8)
  7287. this[offset + 3] = (value & 0xff)
  7288. } else {
  7289. objectWriteUInt32(this, value, offset, false)
  7290. }
  7291. return offset + 4
  7292. }
  7293. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7294. value = +value
  7295. offset = offset | 0
  7296. if (!noAssert) {
  7297. var limit = Math.pow(2, 8 * byteLength - 1)
  7298. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7299. }
  7300. var i = 0
  7301. var mul = 1
  7302. var sub = 0
  7303. this[offset] = value & 0xFF
  7304. while (++i < byteLength && (mul *= 0x100)) {
  7305. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7306. sub = 1
  7307. }
  7308. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7309. }
  7310. return offset + byteLength
  7311. }
  7312. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7313. value = +value
  7314. offset = offset | 0
  7315. if (!noAssert) {
  7316. var limit = Math.pow(2, 8 * byteLength - 1)
  7317. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7318. }
  7319. var i = byteLength - 1
  7320. var mul = 1
  7321. var sub = 0
  7322. this[offset + i] = value & 0xFF
  7323. while (--i >= 0 && (mul *= 0x100)) {
  7324. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7325. sub = 1
  7326. }
  7327. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7328. }
  7329. return offset + byteLength
  7330. }
  7331. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7332. value = +value
  7333. offset = offset | 0
  7334. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7335. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7336. if (value < 0) value = 0xff + value + 1
  7337. this[offset] = (value & 0xff)
  7338. return offset + 1
  7339. }
  7340. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7341. value = +value
  7342. offset = offset | 0
  7343. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7344. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7345. this[offset] = (value & 0xff)
  7346. this[offset + 1] = (value >>> 8)
  7347. } else {
  7348. objectWriteUInt16(this, value, offset, true)
  7349. }
  7350. return offset + 2
  7351. }
  7352. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7353. value = +value
  7354. offset = offset | 0
  7355. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7356. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7357. this[offset] = (value >>> 8)
  7358. this[offset + 1] = (value & 0xff)
  7359. } else {
  7360. objectWriteUInt16(this, value, offset, false)
  7361. }
  7362. return offset + 2
  7363. }
  7364. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7365. value = +value
  7366. offset = offset | 0
  7367. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7368. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7369. this[offset] = (value & 0xff)
  7370. this[offset + 1] = (value >>> 8)
  7371. this[offset + 2] = (value >>> 16)
  7372. this[offset + 3] = (value >>> 24)
  7373. } else {
  7374. objectWriteUInt32(this, value, offset, true)
  7375. }
  7376. return offset + 4
  7377. }
  7378. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7379. value = +value
  7380. offset = offset | 0
  7381. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7382. if (value < 0) value = 0xffffffff + value + 1
  7383. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7384. this[offset] = (value >>> 24)
  7385. this[offset + 1] = (value >>> 16)
  7386. this[offset + 2] = (value >>> 8)
  7387. this[offset + 3] = (value & 0xff)
  7388. } else {
  7389. objectWriteUInt32(this, value, offset, false)
  7390. }
  7391. return offset + 4
  7392. }
  7393. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7394. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7395. if (offset < 0) throw new RangeError('Index out of range')
  7396. }
  7397. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7398. if (!noAssert) {
  7399. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7400. }
  7401. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7402. return offset + 4
  7403. }
  7404. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7405. return writeFloat(this, value, offset, true, noAssert)
  7406. }
  7407. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7408. return writeFloat(this, value, offset, false, noAssert)
  7409. }
  7410. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7411. if (!noAssert) {
  7412. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7413. }
  7414. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7415. return offset + 8
  7416. }
  7417. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7418. return writeDouble(this, value, offset, true, noAssert)
  7419. }
  7420. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7421. return writeDouble(this, value, offset, false, noAssert)
  7422. }
  7423. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7424. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7425. if (!start) start = 0
  7426. if (!end && end !== 0) end = this.length
  7427. if (targetStart >= target.length) targetStart = target.length
  7428. if (!targetStart) targetStart = 0
  7429. if (end > 0 && end < start) end = start
  7430. // Copy 0 bytes; we're done
  7431. if (end === start) return 0
  7432. if (target.length === 0 || this.length === 0) return 0
  7433. // Fatal error conditions
  7434. if (targetStart < 0) {
  7435. throw new RangeError('targetStart out of bounds')
  7436. }
  7437. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7438. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7439. // Are we oob?
  7440. if (end > this.length) end = this.length
  7441. if (target.length - targetStart < end - start) {
  7442. end = target.length - targetStart + start
  7443. }
  7444. var len = end - start
  7445. var i
  7446. if (this === target && start < targetStart && targetStart < end) {
  7447. // descending copy from end
  7448. for (i = len - 1; i >= 0; --i) {
  7449. target[i + targetStart] = this[i + start]
  7450. }
  7451. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7452. // ascending copy from start
  7453. for (i = 0; i < len; ++i) {
  7454. target[i + targetStart] = this[i + start]
  7455. }
  7456. } else {
  7457. Uint8Array.prototype.set.call(
  7458. target,
  7459. this.subarray(start, start + len),
  7460. targetStart
  7461. )
  7462. }
  7463. return len
  7464. }
  7465. // Usage:
  7466. // buffer.fill(number[, offset[, end]])
  7467. // buffer.fill(buffer[, offset[, end]])
  7468. // buffer.fill(string[, offset[, end]][, encoding])
  7469. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7470. // Handle string cases:
  7471. if (typeof val === 'string') {
  7472. if (typeof start === 'string') {
  7473. encoding = start
  7474. start = 0
  7475. end = this.length
  7476. } else if (typeof end === 'string') {
  7477. encoding = end
  7478. end = this.length
  7479. }
  7480. if (val.length === 1) {
  7481. var code = val.charCodeAt(0)
  7482. if (code < 256) {
  7483. val = code
  7484. }
  7485. }
  7486. if (encoding !== undefined && typeof encoding !== 'string') {
  7487. throw new TypeError('encoding must be a string')
  7488. }
  7489. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7490. throw new TypeError('Unknown encoding: ' + encoding)
  7491. }
  7492. } else if (typeof val === 'number') {
  7493. val = val & 255
  7494. }
  7495. // Invalid ranges are not set to a default, so can range check early.
  7496. if (start < 0 || this.length < start || this.length < end) {
  7497. throw new RangeError('Out of range index')
  7498. }
  7499. if (end <= start) {
  7500. return this
  7501. }
  7502. start = start >>> 0
  7503. end = end === undefined ? this.length : end >>> 0
  7504. if (!val) val = 0
  7505. var i
  7506. if (typeof val === 'number') {
  7507. for (i = start; i < end; ++i) {
  7508. this[i] = val
  7509. }
  7510. } else {
  7511. var bytes = Buffer.isBuffer(val)
  7512. ? val
  7513. : utf8ToBytes(new Buffer(val, encoding).toString())
  7514. var len = bytes.length
  7515. for (i = 0; i < end - start; ++i) {
  7516. this[i + start] = bytes[i % len]
  7517. }
  7518. }
  7519. return this
  7520. }
  7521. // HELPER FUNCTIONS
  7522. // ================
  7523. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7524. function base64clean (str) {
  7525. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7526. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7527. // Node converts strings with length < 2 to ''
  7528. if (str.length < 2) return ''
  7529. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7530. while (str.length % 4 !== 0) {
  7531. str = str + '='
  7532. }
  7533. return str
  7534. }
  7535. function stringtrim (str) {
  7536. if (str.trim) return str.trim()
  7537. return str.replace(/^\s+|\s+$/g, '')
  7538. }
  7539. function toHex (n) {
  7540. if (n < 16) return '0' + n.toString(16)
  7541. return n.toString(16)
  7542. }
  7543. function utf8ToBytes (string, units) {
  7544. units = units || Infinity
  7545. var codePoint
  7546. var length = string.length
  7547. var leadSurrogate = null
  7548. var bytes = []
  7549. for (var i = 0; i < length; ++i) {
  7550. codePoint = string.charCodeAt(i)
  7551. // is surrogate component
  7552. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7553. // last char was a lead
  7554. if (!leadSurrogate) {
  7555. // no lead yet
  7556. if (codePoint > 0xDBFF) {
  7557. // unexpected trail
  7558. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7559. continue
  7560. } else if (i + 1 === length) {
  7561. // unpaired lead
  7562. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7563. continue
  7564. }
  7565. // valid lead
  7566. leadSurrogate = codePoint
  7567. continue
  7568. }
  7569. // 2 leads in a row
  7570. if (codePoint < 0xDC00) {
  7571. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7572. leadSurrogate = codePoint
  7573. continue
  7574. }
  7575. // valid surrogate pair
  7576. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7577. } else if (leadSurrogate) {
  7578. // valid bmp char, but last char was a lead
  7579. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7580. }
  7581. leadSurrogate = null
  7582. // encode utf8
  7583. if (codePoint < 0x80) {
  7584. if ((units -= 1) < 0) break
  7585. bytes.push(codePoint)
  7586. } else if (codePoint < 0x800) {
  7587. if ((units -= 2) < 0) break
  7588. bytes.push(
  7589. codePoint >> 0x6 | 0xC0,
  7590. codePoint & 0x3F | 0x80
  7591. )
  7592. } else if (codePoint < 0x10000) {
  7593. if ((units -= 3) < 0) break
  7594. bytes.push(
  7595. codePoint >> 0xC | 0xE0,
  7596. codePoint >> 0x6 & 0x3F | 0x80,
  7597. codePoint & 0x3F | 0x80
  7598. )
  7599. } else if (codePoint < 0x110000) {
  7600. if ((units -= 4) < 0) break
  7601. bytes.push(
  7602. codePoint >> 0x12 | 0xF0,
  7603. codePoint >> 0xC & 0x3F | 0x80,
  7604. codePoint >> 0x6 & 0x3F | 0x80,
  7605. codePoint & 0x3F | 0x80
  7606. )
  7607. } else {
  7608. throw new Error('Invalid code point')
  7609. }
  7610. }
  7611. return bytes
  7612. }
  7613. function asciiToBytes (str) {
  7614. var byteArray = []
  7615. for (var i = 0; i < str.length; ++i) {
  7616. // Node's code seems to be doing this and not & 0x7F..
  7617. byteArray.push(str.charCodeAt(i) & 0xFF)
  7618. }
  7619. return byteArray
  7620. }
  7621. function utf16leToBytes (str, units) {
  7622. var c, hi, lo
  7623. var byteArray = []
  7624. for (var i = 0; i < str.length; ++i) {
  7625. if ((units -= 2) < 0) break
  7626. c = str.charCodeAt(i)
  7627. hi = c >> 8
  7628. lo = c % 256
  7629. byteArray.push(lo)
  7630. byteArray.push(hi)
  7631. }
  7632. return byteArray
  7633. }
  7634. function base64ToBytes (str) {
  7635. return base64.toByteArray(base64clean(str))
  7636. }
  7637. function blitBuffer (src, dst, offset, length) {
  7638. for (var i = 0; i < length; ++i) {
  7639. if ((i + offset >= dst.length) || (i >= src.length)) break
  7640. dst[i + offset] = src[i]
  7641. }
  7642. return i
  7643. }
  7644. function isnan (val) {
  7645. return val !== val // eslint-disable-line no-self-compare
  7646. }
  7647. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7648. /***/ }),
  7649. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7650. /*!**************************************************!*\
  7651. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7652. \**************************************************/
  7653. /*! no static exports found */
  7654. /***/ (function(module, exports, __webpack_require__) {
  7655. /*!
  7656. * clipboard.js v2.0.4
  7657. * https://zenorocha.github.io/clipboard.js
  7658. *
  7659. * Licensed MIT © Zeno Rocha
  7660. */
  7661. (function webpackUniversalModuleDefinition(root, factory) {
  7662. if(true)
  7663. module.exports = factory();
  7664. else {}
  7665. })(this, function() {
  7666. return /******/ (function(modules) { // webpackBootstrap
  7667. /******/ // The module cache
  7668. /******/ var installedModules = {};
  7669. /******/
  7670. /******/ // The require function
  7671. /******/ function __webpack_require__(moduleId) {
  7672. /******/
  7673. /******/ // Check if module is in cache
  7674. /******/ if(installedModules[moduleId]) {
  7675. /******/ return installedModules[moduleId].exports;
  7676. /******/ }
  7677. /******/ // Create a new module (and put it into the cache)
  7678. /******/ var module = installedModules[moduleId] = {
  7679. /******/ i: moduleId,
  7680. /******/ l: false,
  7681. /******/ exports: {}
  7682. /******/ };
  7683. /******/
  7684. /******/ // Execute the module function
  7685. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7686. /******/
  7687. /******/ // Flag the module as loaded
  7688. /******/ module.l = true;
  7689. /******/
  7690. /******/ // Return the exports of the module
  7691. /******/ return module.exports;
  7692. /******/ }
  7693. /******/
  7694. /******/
  7695. /******/ // expose the modules object (__webpack_modules__)
  7696. /******/ __webpack_require__.m = modules;
  7697. /******/
  7698. /******/ // expose the module cache
  7699. /******/ __webpack_require__.c = installedModules;
  7700. /******/
  7701. /******/ // define getter function for harmony exports
  7702. /******/ __webpack_require__.d = function(exports, name, getter) {
  7703. /******/ if(!__webpack_require__.o(exports, name)) {
  7704. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7705. /******/ }
  7706. /******/ };
  7707. /******/
  7708. /******/ // define __esModule on exports
  7709. /******/ __webpack_require__.r = function(exports) {
  7710. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7711. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7712. /******/ }
  7713. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7714. /******/ };
  7715. /******/
  7716. /******/ // create a fake namespace object
  7717. /******/ // mode & 1: value is a module id, require it
  7718. /******/ // mode & 2: merge all properties of value into the ns
  7719. /******/ // mode & 4: return value when already ns object
  7720. /******/ // mode & 8|1: behave like require
  7721. /******/ __webpack_require__.t = function(value, mode) {
  7722. /******/ if(mode & 1) value = __webpack_require__(value);
  7723. /******/ if(mode & 8) return value;
  7724. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7725. /******/ var ns = Object.create(null);
  7726. /******/ __webpack_require__.r(ns);
  7727. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7728. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7729. /******/ return ns;
  7730. /******/ };
  7731. /******/
  7732. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7733. /******/ __webpack_require__.n = function(module) {
  7734. /******/ var getter = module && module.__esModule ?
  7735. /******/ function getDefault() { return module['default']; } :
  7736. /******/ function getModuleExports() { return module; };
  7737. /******/ __webpack_require__.d(getter, 'a', getter);
  7738. /******/ return getter;
  7739. /******/ };
  7740. /******/
  7741. /******/ // Object.prototype.hasOwnProperty.call
  7742. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7743. /******/
  7744. /******/ // __webpack_public_path__
  7745. /******/ __webpack_require__.p = "";
  7746. /******/
  7747. /******/
  7748. /******/ // Load entry module and return exports
  7749. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7750. /******/ })
  7751. /************************************************************************/
  7752. /******/ ([
  7753. /* 0 */
  7754. /***/ (function(module, exports, __webpack_require__) {
  7755. "use strict";
  7756. 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; };
  7757. 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; }; }();
  7758. var _clipboardAction = __webpack_require__(1);
  7759. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7760. var _tinyEmitter = __webpack_require__(3);
  7761. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7762. var _goodListener = __webpack_require__(4);
  7763. var _goodListener2 = _interopRequireDefault(_goodListener);
  7764. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7765. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7766. 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; }
  7767. 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; }
  7768. /**
  7769. * Base class which takes one or more elements, adds event listeners to them,
  7770. * and instantiates a new `ClipboardAction` on each click.
  7771. */
  7772. var Clipboard = function (_Emitter) {
  7773. _inherits(Clipboard, _Emitter);
  7774. /**
  7775. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7776. * @param {Object} options
  7777. */
  7778. function Clipboard(trigger, options) {
  7779. _classCallCheck(this, Clipboard);
  7780. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7781. _this.resolveOptions(options);
  7782. _this.listenClick(trigger);
  7783. return _this;
  7784. }
  7785. /**
  7786. * Defines if attributes would be resolved using internal setter functions
  7787. * or custom functions that were passed in the constructor.
  7788. * @param {Object} options
  7789. */
  7790. _createClass(Clipboard, [{
  7791. key: 'resolveOptions',
  7792. value: function resolveOptions() {
  7793. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7794. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7795. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7796. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7797. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7798. }
  7799. /**
  7800. * Adds a click event listener to the passed trigger.
  7801. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7802. */
  7803. }, {
  7804. key: 'listenClick',
  7805. value: function listenClick(trigger) {
  7806. var _this2 = this;
  7807. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7808. return _this2.onClick(e);
  7809. });
  7810. }
  7811. /**
  7812. * Defines a new `ClipboardAction` on each click event.
  7813. * @param {Event} e
  7814. */
  7815. }, {
  7816. key: 'onClick',
  7817. value: function onClick(e) {
  7818. var trigger = e.delegateTarget || e.currentTarget;
  7819. if (this.clipboardAction) {
  7820. this.clipboardAction = null;
  7821. }
  7822. this.clipboardAction = new _clipboardAction2.default({
  7823. action: this.action(trigger),
  7824. target: this.target(trigger),
  7825. text: this.text(trigger),
  7826. container: this.container,
  7827. trigger: trigger,
  7828. emitter: this
  7829. });
  7830. }
  7831. /**
  7832. * Default `action` lookup function.
  7833. * @param {Element} trigger
  7834. */
  7835. }, {
  7836. key: 'defaultAction',
  7837. value: function defaultAction(trigger) {
  7838. return getAttributeValue('action', trigger);
  7839. }
  7840. /**
  7841. * Default `target` lookup function.
  7842. * @param {Element} trigger
  7843. */
  7844. }, {
  7845. key: 'defaultTarget',
  7846. value: function defaultTarget(trigger) {
  7847. var selector = getAttributeValue('target', trigger);
  7848. if (selector) {
  7849. return document.querySelector(selector);
  7850. }
  7851. }
  7852. /**
  7853. * Returns the support of the given action, or all actions if no action is
  7854. * given.
  7855. * @param {String} [action]
  7856. */
  7857. }, {
  7858. key: 'defaultText',
  7859. /**
  7860. * Default `text` lookup function.
  7861. * @param {Element} trigger
  7862. */
  7863. value: function defaultText(trigger) {
  7864. return getAttributeValue('text', trigger);
  7865. }
  7866. /**
  7867. * Destroy lifecycle.
  7868. */
  7869. }, {
  7870. key: 'destroy',
  7871. value: function destroy() {
  7872. this.listener.destroy();
  7873. if (this.clipboardAction) {
  7874. this.clipboardAction.destroy();
  7875. this.clipboardAction = null;
  7876. }
  7877. }
  7878. }], [{
  7879. key: 'isSupported',
  7880. value: function isSupported() {
  7881. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7882. var actions = typeof action === 'string' ? [action] : action;
  7883. var support = !!document.queryCommandSupported;
  7884. actions.forEach(function (action) {
  7885. support = support && !!document.queryCommandSupported(action);
  7886. });
  7887. return support;
  7888. }
  7889. }]);
  7890. return Clipboard;
  7891. }(_tinyEmitter2.default);
  7892. /**
  7893. * Helper function to retrieve attribute value.
  7894. * @param {String} suffix
  7895. * @param {Element} element
  7896. */
  7897. function getAttributeValue(suffix, element) {
  7898. var attribute = 'data-clipboard-' + suffix;
  7899. if (!element.hasAttribute(attribute)) {
  7900. return;
  7901. }
  7902. return element.getAttribute(attribute);
  7903. }
  7904. module.exports = Clipboard;
  7905. /***/ }),
  7906. /* 1 */
  7907. /***/ (function(module, exports, __webpack_require__) {
  7908. "use strict";
  7909. 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; };
  7910. 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; }; }();
  7911. var _select = __webpack_require__(2);
  7912. var _select2 = _interopRequireDefault(_select);
  7913. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7914. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7915. /**
  7916. * Inner class which performs selection from either `text` or `target`
  7917. * properties and then executes copy or cut operations.
  7918. */
  7919. var ClipboardAction = function () {
  7920. /**
  7921. * @param {Object} options
  7922. */
  7923. function ClipboardAction(options) {
  7924. _classCallCheck(this, ClipboardAction);
  7925. this.resolveOptions(options);
  7926. this.initSelection();
  7927. }
  7928. /**
  7929. * Defines base properties passed from constructor.
  7930. * @param {Object} options
  7931. */
  7932. _createClass(ClipboardAction, [{
  7933. key: 'resolveOptions',
  7934. value: function resolveOptions() {
  7935. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7936. this.action = options.action;
  7937. this.container = options.container;
  7938. this.emitter = options.emitter;
  7939. this.target = options.target;
  7940. this.text = options.text;
  7941. this.trigger = options.trigger;
  7942. this.selectedText = '';
  7943. }
  7944. /**
  7945. * Decides which selection strategy is going to be applied based
  7946. * on the existence of `text` and `target` properties.
  7947. */
  7948. }, {
  7949. key: 'initSelection',
  7950. value: function initSelection() {
  7951. if (this.text) {
  7952. this.selectFake();
  7953. } else if (this.target) {
  7954. this.selectTarget();
  7955. }
  7956. }
  7957. /**
  7958. * Creates a fake textarea element, sets its value from `text` property,
  7959. * and makes a selection on it.
  7960. */
  7961. }, {
  7962. key: 'selectFake',
  7963. value: function selectFake() {
  7964. var _this = this;
  7965. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7966. this.removeFake();
  7967. this.fakeHandlerCallback = function () {
  7968. return _this.removeFake();
  7969. };
  7970. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7971. this.fakeElem = document.createElement('textarea');
  7972. // Prevent zooming on iOS
  7973. this.fakeElem.style.fontSize = '12pt';
  7974. // Reset box model
  7975. this.fakeElem.style.border = '0';
  7976. this.fakeElem.style.padding = '0';
  7977. this.fakeElem.style.margin = '0';
  7978. // Move element out of screen horizontally
  7979. this.fakeElem.style.position = 'absolute';
  7980. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  7981. // Move element to the same position vertically
  7982. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  7983. this.fakeElem.style.top = yPosition + 'px';
  7984. this.fakeElem.setAttribute('readonly', '');
  7985. this.fakeElem.value = this.text;
  7986. this.container.appendChild(this.fakeElem);
  7987. this.selectedText = (0, _select2.default)(this.fakeElem);
  7988. this.copyText();
  7989. }
  7990. /**
  7991. * Only removes the fake element after another click event, that way
  7992. * a user can hit `Ctrl+C` to copy because selection still exists.
  7993. */
  7994. }, {
  7995. key: 'removeFake',
  7996. value: function removeFake() {
  7997. if (this.fakeHandler) {
  7998. this.container.removeEventListener('click', this.fakeHandlerCallback);
  7999. this.fakeHandler = null;
  8000. this.fakeHandlerCallback = null;
  8001. }
  8002. if (this.fakeElem) {
  8003. this.container.removeChild(this.fakeElem);
  8004. this.fakeElem = null;
  8005. }
  8006. }
  8007. /**
  8008. * Selects the content from element passed on `target` property.
  8009. */
  8010. }, {
  8011. key: 'selectTarget',
  8012. value: function selectTarget() {
  8013. this.selectedText = (0, _select2.default)(this.target);
  8014. this.copyText();
  8015. }
  8016. /**
  8017. * Executes the copy operation based on the current selection.
  8018. */
  8019. }, {
  8020. key: 'copyText',
  8021. value: function copyText() {
  8022. var succeeded = void 0;
  8023. try {
  8024. succeeded = document.execCommand(this.action);
  8025. } catch (err) {
  8026. succeeded = false;
  8027. }
  8028. this.handleResult(succeeded);
  8029. }
  8030. /**
  8031. * Fires an event based on the copy operation result.
  8032. * @param {Boolean} succeeded
  8033. */
  8034. }, {
  8035. key: 'handleResult',
  8036. value: function handleResult(succeeded) {
  8037. this.emitter.emit(succeeded ? 'success' : 'error', {
  8038. action: this.action,
  8039. text: this.selectedText,
  8040. trigger: this.trigger,
  8041. clearSelection: this.clearSelection.bind(this)
  8042. });
  8043. }
  8044. /**
  8045. * Moves focus away from `target` and back to the trigger, removes current selection.
  8046. */
  8047. }, {
  8048. key: 'clearSelection',
  8049. value: function clearSelection() {
  8050. if (this.trigger) {
  8051. this.trigger.focus();
  8052. }
  8053. window.getSelection().removeAllRanges();
  8054. }
  8055. /**
  8056. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8057. * @param {String} action
  8058. */
  8059. }, {
  8060. key: 'destroy',
  8061. /**
  8062. * Destroy lifecycle.
  8063. */
  8064. value: function destroy() {
  8065. this.removeFake();
  8066. }
  8067. }, {
  8068. key: 'action',
  8069. set: function set() {
  8070. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8071. this._action = action;
  8072. if (this._action !== 'copy' && this._action !== 'cut') {
  8073. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8074. }
  8075. }
  8076. /**
  8077. * Gets the `action` property.
  8078. * @return {String}
  8079. */
  8080. ,
  8081. get: function get() {
  8082. return this._action;
  8083. }
  8084. /**
  8085. * Sets the `target` property using an element
  8086. * that will be have its content copied.
  8087. * @param {Element} target
  8088. */
  8089. }, {
  8090. key: 'target',
  8091. set: function set(target) {
  8092. if (target !== undefined) {
  8093. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8094. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8095. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8096. }
  8097. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8098. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8099. }
  8100. this._target = target;
  8101. } else {
  8102. throw new Error('Invalid "target" value, use a valid Element');
  8103. }
  8104. }
  8105. }
  8106. /**
  8107. * Gets the `target` property.
  8108. * @return {String|HTMLElement}
  8109. */
  8110. ,
  8111. get: function get() {
  8112. return this._target;
  8113. }
  8114. }]);
  8115. return ClipboardAction;
  8116. }();
  8117. module.exports = ClipboardAction;
  8118. /***/ }),
  8119. /* 2 */
  8120. /***/ (function(module, exports) {
  8121. function select(element) {
  8122. var selectedText;
  8123. if (element.nodeName === 'SELECT') {
  8124. element.focus();
  8125. selectedText = element.value;
  8126. }
  8127. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8128. var isReadOnly = element.hasAttribute('readonly');
  8129. if (!isReadOnly) {
  8130. element.setAttribute('readonly', '');
  8131. }
  8132. element.select();
  8133. element.setSelectionRange(0, element.value.length);
  8134. if (!isReadOnly) {
  8135. element.removeAttribute('readonly');
  8136. }
  8137. selectedText = element.value;
  8138. }
  8139. else {
  8140. if (element.hasAttribute('contenteditable')) {
  8141. element.focus();
  8142. }
  8143. var selection = window.getSelection();
  8144. var range = document.createRange();
  8145. range.selectNodeContents(element);
  8146. selection.removeAllRanges();
  8147. selection.addRange(range);
  8148. selectedText = selection.toString();
  8149. }
  8150. return selectedText;
  8151. }
  8152. module.exports = select;
  8153. /***/ }),
  8154. /* 3 */
  8155. /***/ (function(module, exports) {
  8156. function E () {
  8157. // Keep this empty so it's easier to inherit from
  8158. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8159. }
  8160. E.prototype = {
  8161. on: function (name, callback, ctx) {
  8162. var e = this.e || (this.e = {});
  8163. (e[name] || (e[name] = [])).push({
  8164. fn: callback,
  8165. ctx: ctx
  8166. });
  8167. return this;
  8168. },
  8169. once: function (name, callback, ctx) {
  8170. var self = this;
  8171. function listener () {
  8172. self.off(name, listener);
  8173. callback.apply(ctx, arguments);
  8174. };
  8175. listener._ = callback
  8176. return this.on(name, listener, ctx);
  8177. },
  8178. emit: function (name) {
  8179. var data = [].slice.call(arguments, 1);
  8180. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8181. var i = 0;
  8182. var len = evtArr.length;
  8183. for (i; i < len; i++) {
  8184. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8185. }
  8186. return this;
  8187. },
  8188. off: function (name, callback) {
  8189. var e = this.e || (this.e = {});
  8190. var evts = e[name];
  8191. var liveEvents = [];
  8192. if (evts && callback) {
  8193. for (var i = 0, len = evts.length; i < len; i++) {
  8194. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8195. liveEvents.push(evts[i]);
  8196. }
  8197. }
  8198. // Remove event from queue to prevent memory leak
  8199. // Suggested by https://github.com/lazd
  8200. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8201. (liveEvents.length)
  8202. ? e[name] = liveEvents
  8203. : delete e[name];
  8204. return this;
  8205. }
  8206. };
  8207. module.exports = E;
  8208. /***/ }),
  8209. /* 4 */
  8210. /***/ (function(module, exports, __webpack_require__) {
  8211. var is = __webpack_require__(5);
  8212. var delegate = __webpack_require__(6);
  8213. /**
  8214. * Validates all params and calls the right
  8215. * listener function based on its target type.
  8216. *
  8217. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8218. * @param {String} type
  8219. * @param {Function} callback
  8220. * @return {Object}
  8221. */
  8222. function listen(target, type, callback) {
  8223. if (!target && !type && !callback) {
  8224. throw new Error('Missing required arguments');
  8225. }
  8226. if (!is.string(type)) {
  8227. throw new TypeError('Second argument must be a String');
  8228. }
  8229. if (!is.fn(callback)) {
  8230. throw new TypeError('Third argument must be a Function');
  8231. }
  8232. if (is.node(target)) {
  8233. return listenNode(target, type, callback);
  8234. }
  8235. else if (is.nodeList(target)) {
  8236. return listenNodeList(target, type, callback);
  8237. }
  8238. else if (is.string(target)) {
  8239. return listenSelector(target, type, callback);
  8240. }
  8241. else {
  8242. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8243. }
  8244. }
  8245. /**
  8246. * Adds an event listener to a HTML element
  8247. * and returns a remove listener function.
  8248. *
  8249. * @param {HTMLElement} node
  8250. * @param {String} type
  8251. * @param {Function} callback
  8252. * @return {Object}
  8253. */
  8254. function listenNode(node, type, callback) {
  8255. node.addEventListener(type, callback);
  8256. return {
  8257. destroy: function() {
  8258. node.removeEventListener(type, callback);
  8259. }
  8260. }
  8261. }
  8262. /**
  8263. * Add an event listener to a list of HTML elements
  8264. * and returns a remove listener function.
  8265. *
  8266. * @param {NodeList|HTMLCollection} nodeList
  8267. * @param {String} type
  8268. * @param {Function} callback
  8269. * @return {Object}
  8270. */
  8271. function listenNodeList(nodeList, type, callback) {
  8272. Array.prototype.forEach.call(nodeList, function(node) {
  8273. node.addEventListener(type, callback);
  8274. });
  8275. return {
  8276. destroy: function() {
  8277. Array.prototype.forEach.call(nodeList, function(node) {
  8278. node.removeEventListener(type, callback);
  8279. });
  8280. }
  8281. }
  8282. }
  8283. /**
  8284. * Add an event listener to a selector
  8285. * and returns a remove listener function.
  8286. *
  8287. * @param {String} selector
  8288. * @param {String} type
  8289. * @param {Function} callback
  8290. * @return {Object}
  8291. */
  8292. function listenSelector(selector, type, callback) {
  8293. return delegate(document.body, selector, type, callback);
  8294. }
  8295. module.exports = listen;
  8296. /***/ }),
  8297. /* 5 */
  8298. /***/ (function(module, exports) {
  8299. /**
  8300. * Check if argument is a HTML element.
  8301. *
  8302. * @param {Object} value
  8303. * @return {Boolean}
  8304. */
  8305. exports.node = function(value) {
  8306. return value !== undefined
  8307. && value instanceof HTMLElement
  8308. && value.nodeType === 1;
  8309. };
  8310. /**
  8311. * Check if argument is a list of HTML elements.
  8312. *
  8313. * @param {Object} value
  8314. * @return {Boolean}
  8315. */
  8316. exports.nodeList = function(value) {
  8317. var type = Object.prototype.toString.call(value);
  8318. return value !== undefined
  8319. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8320. && ('length' in value)
  8321. && (value.length === 0 || exports.node(value[0]));
  8322. };
  8323. /**
  8324. * Check if argument is a string.
  8325. *
  8326. * @param {Object} value
  8327. * @return {Boolean}
  8328. */
  8329. exports.string = function(value) {
  8330. return typeof value === 'string'
  8331. || value instanceof String;
  8332. };
  8333. /**
  8334. * Check if argument is a function.
  8335. *
  8336. * @param {Object} value
  8337. * @return {Boolean}
  8338. */
  8339. exports.fn = function(value) {
  8340. var type = Object.prototype.toString.call(value);
  8341. return type === '[object Function]';
  8342. };
  8343. /***/ }),
  8344. /* 6 */
  8345. /***/ (function(module, exports, __webpack_require__) {
  8346. var closest = __webpack_require__(7);
  8347. /**
  8348. * Delegates event to a selector.
  8349. *
  8350. * @param {Element} element
  8351. * @param {String} selector
  8352. * @param {String} type
  8353. * @param {Function} callback
  8354. * @param {Boolean} useCapture
  8355. * @return {Object}
  8356. */
  8357. function _delegate(element, selector, type, callback, useCapture) {
  8358. var listenerFn = listener.apply(this, arguments);
  8359. element.addEventListener(type, listenerFn, useCapture);
  8360. return {
  8361. destroy: function() {
  8362. element.removeEventListener(type, listenerFn, useCapture);
  8363. }
  8364. }
  8365. }
  8366. /**
  8367. * Delegates event to a selector.
  8368. *
  8369. * @param {Element|String|Array} [elements]
  8370. * @param {String} selector
  8371. * @param {String} type
  8372. * @param {Function} callback
  8373. * @param {Boolean} useCapture
  8374. * @return {Object}
  8375. */
  8376. function delegate(elements, selector, type, callback, useCapture) {
  8377. // Handle the regular Element usage
  8378. if (typeof elements.addEventListener === 'function') {
  8379. return _delegate.apply(null, arguments);
  8380. }
  8381. // Handle Element-less usage, it defaults to global delegation
  8382. if (typeof type === 'function') {
  8383. // Use `document` as the first parameter, then apply arguments
  8384. // This is a short way to .unshift `arguments` without running into deoptimizations
  8385. return _delegate.bind(null, document).apply(null, arguments);
  8386. }
  8387. // Handle Selector-based usage
  8388. if (typeof elements === 'string') {
  8389. elements = document.querySelectorAll(elements);
  8390. }
  8391. // Handle Array-like based usage
  8392. return Array.prototype.map.call(elements, function (element) {
  8393. return _delegate(element, selector, type, callback, useCapture);
  8394. });
  8395. }
  8396. /**
  8397. * Finds closest match and invokes callback.
  8398. *
  8399. * @param {Element} element
  8400. * @param {String} selector
  8401. * @param {String} type
  8402. * @param {Function} callback
  8403. * @return {Function}
  8404. */
  8405. function listener(element, selector, type, callback) {
  8406. return function(e) {
  8407. e.delegateTarget = closest(e.target, selector);
  8408. if (e.delegateTarget) {
  8409. callback.call(element, e);
  8410. }
  8411. }
  8412. }
  8413. module.exports = delegate;
  8414. /***/ }),
  8415. /* 7 */
  8416. /***/ (function(module, exports) {
  8417. var DOCUMENT_NODE_TYPE = 9;
  8418. /**
  8419. * A polyfill for Element.matches()
  8420. */
  8421. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8422. var proto = Element.prototype;
  8423. proto.matches = proto.matchesSelector ||
  8424. proto.mozMatchesSelector ||
  8425. proto.msMatchesSelector ||
  8426. proto.oMatchesSelector ||
  8427. proto.webkitMatchesSelector;
  8428. }
  8429. /**
  8430. * Finds the closest parent that matches a selector.
  8431. *
  8432. * @param {Element} element
  8433. * @param {String} selector
  8434. * @return {Function}
  8435. */
  8436. function closest (element, selector) {
  8437. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8438. if (typeof element.matches === 'function' &&
  8439. element.matches(selector)) {
  8440. return element;
  8441. }
  8442. element = element.parentNode;
  8443. }
  8444. }
  8445. module.exports = closest;
  8446. /***/ })
  8447. /******/ ]);
  8448. });
  8449. /***/ }),
  8450. /***/ "./node_modules/ieee754/index.js":
  8451. /*!***************************************!*\
  8452. !*** ./node_modules/ieee754/index.js ***!
  8453. \***************************************/
  8454. /*! no static exports found */
  8455. /***/ (function(module, exports) {
  8456. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8457. var e, m
  8458. var eLen = (nBytes * 8) - mLen - 1
  8459. var eMax = (1 << eLen) - 1
  8460. var eBias = eMax >> 1
  8461. var nBits = -7
  8462. var i = isLE ? (nBytes - 1) : 0
  8463. var d = isLE ? -1 : 1
  8464. var s = buffer[offset + i]
  8465. i += d
  8466. e = s & ((1 << (-nBits)) - 1)
  8467. s >>= (-nBits)
  8468. nBits += eLen
  8469. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8470. m = e & ((1 << (-nBits)) - 1)
  8471. e >>= (-nBits)
  8472. nBits += mLen
  8473. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8474. if (e === 0) {
  8475. e = 1 - eBias
  8476. } else if (e === eMax) {
  8477. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8478. } else {
  8479. m = m + Math.pow(2, mLen)
  8480. e = e - eBias
  8481. }
  8482. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8483. }
  8484. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8485. var e, m, c
  8486. var eLen = (nBytes * 8) - mLen - 1
  8487. var eMax = (1 << eLen) - 1
  8488. var eBias = eMax >> 1
  8489. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8490. var i = isLE ? 0 : (nBytes - 1)
  8491. var d = isLE ? 1 : -1
  8492. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8493. value = Math.abs(value)
  8494. if (isNaN(value) || value === Infinity) {
  8495. m = isNaN(value) ? 1 : 0
  8496. e = eMax
  8497. } else {
  8498. e = Math.floor(Math.log(value) / Math.LN2)
  8499. if (value * (c = Math.pow(2, -e)) < 1) {
  8500. e--
  8501. c *= 2
  8502. }
  8503. if (e + eBias >= 1) {
  8504. value += rt / c
  8505. } else {
  8506. value += rt * Math.pow(2, 1 - eBias)
  8507. }
  8508. if (value * c >= 2) {
  8509. e++
  8510. c /= 2
  8511. }
  8512. if (e + eBias >= eMax) {
  8513. m = 0
  8514. e = eMax
  8515. } else if (e + eBias >= 1) {
  8516. m = ((value * c) - 1) * Math.pow(2, mLen)
  8517. e = e + eBias
  8518. } else {
  8519. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8520. e = 0
  8521. }
  8522. }
  8523. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8524. e = (e << mLen) | m
  8525. eLen += mLen
  8526. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8527. buffer[offset + i - d] |= s * 128
  8528. }
  8529. /***/ }),
  8530. /***/ "./node_modules/isarray/index.js":
  8531. /*!***************************************!*\
  8532. !*** ./node_modules/isarray/index.js ***!
  8533. \***************************************/
  8534. /*! no static exports found */
  8535. /***/ (function(module, exports) {
  8536. var toString = {}.toString;
  8537. module.exports = Array.isArray || function (arr) {
  8538. return toString.call(arr) == '[object Array]';
  8539. };
  8540. /***/ }),
  8541. /***/ "./node_modules/jquery/dist/jquery.js":
  8542. /*!********************************************!*\
  8543. !*** ./node_modules/jquery/dist/jquery.js ***!
  8544. \********************************************/
  8545. /*! no static exports found */
  8546. /***/ (function(module, exports, __webpack_require__) {
  8547. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8548. * jQuery JavaScript Library v3.4.1
  8549. * https://jquery.com/
  8550. *
  8551. * Includes Sizzle.js
  8552. * https://sizzlejs.com/
  8553. *
  8554. * Copyright JS Foundation and other contributors
  8555. * Released under the MIT license
  8556. * https://jquery.org/license
  8557. *
  8558. * Date: 2019-05-01T21:04Z
  8559. */
  8560. ( function( global, factory ) {
  8561. "use strict";
  8562. if ( true && typeof module.exports === "object" ) {
  8563. // For CommonJS and CommonJS-like environments where a proper `window`
  8564. // is present, execute the factory and get jQuery.
  8565. // For environments that do not have a `window` with a `document`
  8566. // (such as Node.js), expose a factory as module.exports.
  8567. // This accentuates the need for the creation of a real `window`.
  8568. // e.g. var jQuery = require("jquery")(window);
  8569. // See ticket #14549 for more info.
  8570. module.exports = global.document ?
  8571. factory( global, true ) :
  8572. function( w ) {
  8573. if ( !w.document ) {
  8574. throw new Error( "jQuery requires a window with a document" );
  8575. }
  8576. return factory( w );
  8577. };
  8578. } else {
  8579. factory( global );
  8580. }
  8581. // Pass this if window is not defined yet
  8582. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8583. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8584. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8585. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8586. // enough that all such attempts are guarded in a try block.
  8587. "use strict";
  8588. var arr = [];
  8589. var document = window.document;
  8590. var getProto = Object.getPrototypeOf;
  8591. var slice = arr.slice;
  8592. var concat = arr.concat;
  8593. var push = arr.push;
  8594. var indexOf = arr.indexOf;
  8595. var class2type = {};
  8596. var toString = class2type.toString;
  8597. var hasOwn = class2type.hasOwnProperty;
  8598. var fnToString = hasOwn.toString;
  8599. var ObjectFunctionString = fnToString.call( Object );
  8600. var support = {};
  8601. var isFunction = function isFunction( obj ) {
  8602. // Support: Chrome <=57, Firefox <=52
  8603. // In some browsers, typeof returns "function" for HTML <object> elements
  8604. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8605. // We don't want to classify *any* DOM node as a function.
  8606. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8607. };
  8608. var isWindow = function isWindow( obj ) {
  8609. return obj != null && obj === obj.window;
  8610. };
  8611. var preservedScriptAttributes = {
  8612. type: true,
  8613. src: true,
  8614. nonce: true,
  8615. noModule: true
  8616. };
  8617. function DOMEval( code, node, doc ) {
  8618. doc = doc || document;
  8619. var i, val,
  8620. script = doc.createElement( "script" );
  8621. script.text = code;
  8622. if ( node ) {
  8623. for ( i in preservedScriptAttributes ) {
  8624. // Support: Firefox 64+, Edge 18+
  8625. // Some browsers don't support the "nonce" property on scripts.
  8626. // On the other hand, just using `getAttribute` is not enough as
  8627. // the `nonce` attribute is reset to an empty string whenever it
  8628. // becomes browsing-context connected.
  8629. // See https://github.com/whatwg/html/issues/2369
  8630. // See https://html.spec.whatwg.org/#nonce-attributes
  8631. // The `node.getAttribute` check was added for the sake of
  8632. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8633. // via an object.
  8634. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8635. if ( val ) {
  8636. script.setAttribute( i, val );
  8637. }
  8638. }
  8639. }
  8640. doc.head.appendChild( script ).parentNode.removeChild( script );
  8641. }
  8642. function toType( obj ) {
  8643. if ( obj == null ) {
  8644. return obj + "";
  8645. }
  8646. // Support: Android <=2.3 only (functionish RegExp)
  8647. return typeof obj === "object" || typeof obj === "function" ?
  8648. class2type[ toString.call( obj ) ] || "object" :
  8649. typeof obj;
  8650. }
  8651. /* global Symbol */
  8652. // Defining this global in .eslintrc.json would create a danger of using the global
  8653. // unguarded in another place, it seems safer to define global only for this module
  8654. var
  8655. version = "3.4.1",
  8656. // Define a local copy of jQuery
  8657. jQuery = function( selector, context ) {
  8658. // The jQuery object is actually just the init constructor 'enhanced'
  8659. // Need init if jQuery is called (just allow error to be thrown if not included)
  8660. return new jQuery.fn.init( selector, context );
  8661. },
  8662. // Support: Android <=4.0 only
  8663. // Make sure we trim BOM and NBSP
  8664. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8665. jQuery.fn = jQuery.prototype = {
  8666. // The current version of jQuery being used
  8667. jquery: version,
  8668. constructor: jQuery,
  8669. // The default length of a jQuery object is 0
  8670. length: 0,
  8671. toArray: function() {
  8672. return slice.call( this );
  8673. },
  8674. // Get the Nth element in the matched element set OR
  8675. // Get the whole matched element set as a clean array
  8676. get: function( num ) {
  8677. // Return all the elements in a clean array
  8678. if ( num == null ) {
  8679. return slice.call( this );
  8680. }
  8681. // Return just the one element from the set
  8682. return num < 0 ? this[ num + this.length ] : this[ num ];
  8683. },
  8684. // Take an array of elements and push it onto the stack
  8685. // (returning the new matched element set)
  8686. pushStack: function( elems ) {
  8687. // Build a new jQuery matched element set
  8688. var ret = jQuery.merge( this.constructor(), elems );
  8689. // Add the old object onto the stack (as a reference)
  8690. ret.prevObject = this;
  8691. // Return the newly-formed element set
  8692. return ret;
  8693. },
  8694. // Execute a callback for every element in the matched set.
  8695. each: function( callback ) {
  8696. return jQuery.each( this, callback );
  8697. },
  8698. map: function( callback ) {
  8699. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8700. return callback.call( elem, i, elem );
  8701. } ) );
  8702. },
  8703. slice: function() {
  8704. return this.pushStack( slice.apply( this, arguments ) );
  8705. },
  8706. first: function() {
  8707. return this.eq( 0 );
  8708. },
  8709. last: function() {
  8710. return this.eq( -1 );
  8711. },
  8712. eq: function( i ) {
  8713. var len = this.length,
  8714. j = +i + ( i < 0 ? len : 0 );
  8715. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8716. },
  8717. end: function() {
  8718. return this.prevObject || this.constructor();
  8719. },
  8720. // For internal use only.
  8721. // Behaves like an Array's method, not like a jQuery method.
  8722. push: push,
  8723. sort: arr.sort,
  8724. splice: arr.splice
  8725. };
  8726. jQuery.extend = jQuery.fn.extend = function() {
  8727. var options, name, src, copy, copyIsArray, clone,
  8728. target = arguments[ 0 ] || {},
  8729. i = 1,
  8730. length = arguments.length,
  8731. deep = false;
  8732. // Handle a deep copy situation
  8733. if ( typeof target === "boolean" ) {
  8734. deep = target;
  8735. // Skip the boolean and the target
  8736. target = arguments[ i ] || {};
  8737. i++;
  8738. }
  8739. // Handle case when target is a string or something (possible in deep copy)
  8740. if ( typeof target !== "object" && !isFunction( target ) ) {
  8741. target = {};
  8742. }
  8743. // Extend jQuery itself if only one argument is passed
  8744. if ( i === length ) {
  8745. target = this;
  8746. i--;
  8747. }
  8748. for ( ; i < length; i++ ) {
  8749. // Only deal with non-null/undefined values
  8750. if ( ( options = arguments[ i ] ) != null ) {
  8751. // Extend the base object
  8752. for ( name in options ) {
  8753. copy = options[ name ];
  8754. // Prevent Object.prototype pollution
  8755. // Prevent never-ending loop
  8756. if ( name === "__proto__" || target === copy ) {
  8757. continue;
  8758. }
  8759. // Recurse if we're merging plain objects or arrays
  8760. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8761. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8762. src = target[ name ];
  8763. // Ensure proper type for the source value
  8764. if ( copyIsArray && !Array.isArray( src ) ) {
  8765. clone = [];
  8766. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8767. clone = {};
  8768. } else {
  8769. clone = src;
  8770. }
  8771. copyIsArray = false;
  8772. // Never move original objects, clone them
  8773. target[ name ] = jQuery.extend( deep, clone, copy );
  8774. // Don't bring in undefined values
  8775. } else if ( copy !== undefined ) {
  8776. target[ name ] = copy;
  8777. }
  8778. }
  8779. }
  8780. }
  8781. // Return the modified object
  8782. return target;
  8783. };
  8784. jQuery.extend( {
  8785. // Unique for each copy of jQuery on the page
  8786. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8787. // Assume jQuery is ready without the ready module
  8788. isReady: true,
  8789. error: function( msg ) {
  8790. throw new Error( msg );
  8791. },
  8792. noop: function() {},
  8793. isPlainObject: function( obj ) {
  8794. var proto, Ctor;
  8795. // Detect obvious negatives
  8796. // Use toString instead of jQuery.type to catch host objects
  8797. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8798. return false;
  8799. }
  8800. proto = getProto( obj );
  8801. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8802. if ( !proto ) {
  8803. return true;
  8804. }
  8805. // Objects with prototype are plain iff they were constructed by a global Object function
  8806. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8807. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8808. },
  8809. isEmptyObject: function( obj ) {
  8810. var name;
  8811. for ( name in obj ) {
  8812. return false;
  8813. }
  8814. return true;
  8815. },
  8816. // Evaluates a script in a global context
  8817. globalEval: function( code, options ) {
  8818. DOMEval( code, { nonce: options && options.nonce } );
  8819. },
  8820. each: function( obj, callback ) {
  8821. var length, i = 0;
  8822. if ( isArrayLike( obj ) ) {
  8823. length = obj.length;
  8824. for ( ; i < length; i++ ) {
  8825. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8826. break;
  8827. }
  8828. }
  8829. } else {
  8830. for ( i in obj ) {
  8831. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8832. break;
  8833. }
  8834. }
  8835. }
  8836. return obj;
  8837. },
  8838. // Support: Android <=4.0 only
  8839. trim: function( text ) {
  8840. return text == null ?
  8841. "" :
  8842. ( text + "" ).replace( rtrim, "" );
  8843. },
  8844. // results is for internal usage only
  8845. makeArray: function( arr, results ) {
  8846. var ret = results || [];
  8847. if ( arr != null ) {
  8848. if ( isArrayLike( Object( arr ) ) ) {
  8849. jQuery.merge( ret,
  8850. typeof arr === "string" ?
  8851. [ arr ] : arr
  8852. );
  8853. } else {
  8854. push.call( ret, arr );
  8855. }
  8856. }
  8857. return ret;
  8858. },
  8859. inArray: function( elem, arr, i ) {
  8860. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8861. },
  8862. // Support: Android <=4.0 only, PhantomJS 1 only
  8863. // push.apply(_, arraylike) throws on ancient WebKit
  8864. merge: function( first, second ) {
  8865. var len = +second.length,
  8866. j = 0,
  8867. i = first.length;
  8868. for ( ; j < len; j++ ) {
  8869. first[ i++ ] = second[ j ];
  8870. }
  8871. first.length = i;
  8872. return first;
  8873. },
  8874. grep: function( elems, callback, invert ) {
  8875. var callbackInverse,
  8876. matches = [],
  8877. i = 0,
  8878. length = elems.length,
  8879. callbackExpect = !invert;
  8880. // Go through the array, only saving the items
  8881. // that pass the validator function
  8882. for ( ; i < length; i++ ) {
  8883. callbackInverse = !callback( elems[ i ], i );
  8884. if ( callbackInverse !== callbackExpect ) {
  8885. matches.push( elems[ i ] );
  8886. }
  8887. }
  8888. return matches;
  8889. },
  8890. // arg is for internal usage only
  8891. map: function( elems, callback, arg ) {
  8892. var length, value,
  8893. i = 0,
  8894. ret = [];
  8895. // Go through the array, translating each of the items to their new values
  8896. if ( isArrayLike( elems ) ) {
  8897. length = elems.length;
  8898. for ( ; i < length; i++ ) {
  8899. value = callback( elems[ i ], i, arg );
  8900. if ( value != null ) {
  8901. ret.push( value );
  8902. }
  8903. }
  8904. // Go through every key on the object,
  8905. } else {
  8906. for ( i in elems ) {
  8907. value = callback( elems[ i ], i, arg );
  8908. if ( value != null ) {
  8909. ret.push( value );
  8910. }
  8911. }
  8912. }
  8913. // Flatten any nested arrays
  8914. return concat.apply( [], ret );
  8915. },
  8916. // A global GUID counter for objects
  8917. guid: 1,
  8918. // jQuery.support is not used in Core but other projects attach their
  8919. // properties to it so it needs to exist.
  8920. support: support
  8921. } );
  8922. if ( typeof Symbol === "function" ) {
  8923. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8924. }
  8925. // Populate the class2type map
  8926. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8927. function( i, name ) {
  8928. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8929. } );
  8930. function isArrayLike( obj ) {
  8931. // Support: real iOS 8.2 only (not reproducible in simulator)
  8932. // `in` check used to prevent JIT error (gh-2145)
  8933. // hasOwn isn't used here due to false negatives
  8934. // regarding Nodelist length in IE
  8935. var length = !!obj && "length" in obj && obj.length,
  8936. type = toType( obj );
  8937. if ( isFunction( obj ) || isWindow( obj ) ) {
  8938. return false;
  8939. }
  8940. return type === "array" || length === 0 ||
  8941. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8942. }
  8943. var Sizzle =
  8944. /*!
  8945. * Sizzle CSS Selector Engine v2.3.4
  8946. * https://sizzlejs.com/
  8947. *
  8948. * Copyright JS Foundation and other contributors
  8949. * Released under the MIT license
  8950. * https://js.foundation/
  8951. *
  8952. * Date: 2019-04-08
  8953. */
  8954. (function( window ) {
  8955. var i,
  8956. support,
  8957. Expr,
  8958. getText,
  8959. isXML,
  8960. tokenize,
  8961. compile,
  8962. select,
  8963. outermostContext,
  8964. sortInput,
  8965. hasDuplicate,
  8966. // Local document vars
  8967. setDocument,
  8968. document,
  8969. docElem,
  8970. documentIsHTML,
  8971. rbuggyQSA,
  8972. rbuggyMatches,
  8973. matches,
  8974. contains,
  8975. // Instance-specific data
  8976. expando = "sizzle" + 1 * new Date(),
  8977. preferredDoc = window.document,
  8978. dirruns = 0,
  8979. done = 0,
  8980. classCache = createCache(),
  8981. tokenCache = createCache(),
  8982. compilerCache = createCache(),
  8983. nonnativeSelectorCache = createCache(),
  8984. sortOrder = function( a, b ) {
  8985. if ( a === b ) {
  8986. hasDuplicate = true;
  8987. }
  8988. return 0;
  8989. },
  8990. // Instance methods
  8991. hasOwn = ({}).hasOwnProperty,
  8992. arr = [],
  8993. pop = arr.pop,
  8994. push_native = arr.push,
  8995. push = arr.push,
  8996. slice = arr.slice,
  8997. // Use a stripped-down indexOf as it's faster than native
  8998. // https://jsperf.com/thor-indexof-vs-for/5
  8999. indexOf = function( list, elem ) {
  9000. var i = 0,
  9001. len = list.length;
  9002. for ( ; i < len; i++ ) {
  9003. if ( list[i] === elem ) {
  9004. return i;
  9005. }
  9006. }
  9007. return -1;
  9008. },
  9009. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9010. // Regular expressions
  9011. // http://www.w3.org/TR/css3-selectors/#whitespace
  9012. whitespace = "[\\x20\\t\\r\\n\\f]",
  9013. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9014. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9015. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9016. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9017. // Operator (capture 2)
  9018. "*([*^$|!~]?=)" + whitespace +
  9019. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9020. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9021. "*\\]",
  9022. pseudos = ":(" + identifier + ")(?:\\((" +
  9023. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9024. // 1. quoted (capture 3; capture 4 or capture 5)
  9025. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9026. // 2. simple (capture 6)
  9027. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9028. // 3. anything else (capture 2)
  9029. ".*" +
  9030. ")\\)|)",
  9031. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9032. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9033. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9034. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9035. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9036. rdescend = new RegExp( whitespace + "|>" ),
  9037. rpseudo = new RegExp( pseudos ),
  9038. ridentifier = new RegExp( "^" + identifier + "$" ),
  9039. matchExpr = {
  9040. "ID": new RegExp( "^#(" + identifier + ")" ),
  9041. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9042. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9043. "ATTR": new RegExp( "^" + attributes ),
  9044. "PSEUDO": new RegExp( "^" + pseudos ),
  9045. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9046. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9047. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9048. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9049. // For use in libraries implementing .is()
  9050. // We use this for POS matching in `select`
  9051. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9052. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9053. },
  9054. rhtml = /HTML$/i,
  9055. rinputs = /^(?:input|select|textarea|button)$/i,
  9056. rheader = /^h\d$/i,
  9057. rnative = /^[^{]+\{\s*\[native \w/,
  9058. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9059. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9060. rsibling = /[+~]/,
  9061. // CSS escapes
  9062. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9063. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9064. funescape = function( _, escaped, escapedWhitespace ) {
  9065. var high = "0x" + escaped - 0x10000;
  9066. // NaN means non-codepoint
  9067. // Support: Firefox<24
  9068. // Workaround erroneous numeric interpretation of +"0x"
  9069. return high !== high || escapedWhitespace ?
  9070. escaped :
  9071. high < 0 ?
  9072. // BMP codepoint
  9073. String.fromCharCode( high + 0x10000 ) :
  9074. // Supplemental Plane codepoint (surrogate pair)
  9075. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9076. },
  9077. // CSS string/identifier serialization
  9078. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9079. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9080. fcssescape = function( ch, asCodePoint ) {
  9081. if ( asCodePoint ) {
  9082. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9083. if ( ch === "\0" ) {
  9084. return "\uFFFD";
  9085. }
  9086. // Control characters and (dependent upon position) numbers get escaped as code points
  9087. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9088. }
  9089. // Other potentially-special ASCII characters get backslash-escaped
  9090. return "\\" + ch;
  9091. },
  9092. // Used for iframes
  9093. // See setDocument()
  9094. // Removing the function wrapper causes a "Permission Denied"
  9095. // error in IE
  9096. unloadHandler = function() {
  9097. setDocument();
  9098. },
  9099. inDisabledFieldset = addCombinator(
  9100. function( elem ) {
  9101. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9102. },
  9103. { dir: "parentNode", next: "legend" }
  9104. );
  9105. // Optimize for push.apply( _, NodeList )
  9106. try {
  9107. push.apply(
  9108. (arr = slice.call( preferredDoc.childNodes )),
  9109. preferredDoc.childNodes
  9110. );
  9111. // Support: Android<4.0
  9112. // Detect silently failing push.apply
  9113. arr[ preferredDoc.childNodes.length ].nodeType;
  9114. } catch ( e ) {
  9115. push = { apply: arr.length ?
  9116. // Leverage slice if possible
  9117. function( target, els ) {
  9118. push_native.apply( target, slice.call(els) );
  9119. } :
  9120. // Support: IE<9
  9121. // Otherwise append directly
  9122. function( target, els ) {
  9123. var j = target.length,
  9124. i = 0;
  9125. // Can't trust NodeList.length
  9126. while ( (target[j++] = els[i++]) ) {}
  9127. target.length = j - 1;
  9128. }
  9129. };
  9130. }
  9131. function Sizzle( selector, context, results, seed ) {
  9132. var m, i, elem, nid, match, groups, newSelector,
  9133. newContext = context && context.ownerDocument,
  9134. // nodeType defaults to 9, since context defaults to document
  9135. nodeType = context ? context.nodeType : 9;
  9136. results = results || [];
  9137. // Return early from calls with invalid selector or context
  9138. if ( typeof selector !== "string" || !selector ||
  9139. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9140. return results;
  9141. }
  9142. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9143. if ( !seed ) {
  9144. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9145. setDocument( context );
  9146. }
  9147. context = context || document;
  9148. if ( documentIsHTML ) {
  9149. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9150. // (excepting DocumentFragment context, where the methods don't exist)
  9151. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9152. // ID selector
  9153. if ( (m = match[1]) ) {
  9154. // Document context
  9155. if ( nodeType === 9 ) {
  9156. if ( (elem = context.getElementById( m )) ) {
  9157. // Support: IE, Opera, Webkit
  9158. // TODO: identify versions
  9159. // getElementById can match elements by name instead of ID
  9160. if ( elem.id === m ) {
  9161. results.push( elem );
  9162. return results;
  9163. }
  9164. } else {
  9165. return results;
  9166. }
  9167. // Element context
  9168. } else {
  9169. // Support: IE, Opera, Webkit
  9170. // TODO: identify versions
  9171. // getElementById can match elements by name instead of ID
  9172. if ( newContext && (elem = newContext.getElementById( m )) &&
  9173. contains( context, elem ) &&
  9174. elem.id === m ) {
  9175. results.push( elem );
  9176. return results;
  9177. }
  9178. }
  9179. // Type selector
  9180. } else if ( match[2] ) {
  9181. push.apply( results, context.getElementsByTagName( selector ) );
  9182. return results;
  9183. // Class selector
  9184. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9185. context.getElementsByClassName ) {
  9186. push.apply( results, context.getElementsByClassName( m ) );
  9187. return results;
  9188. }
  9189. }
  9190. // Take advantage of querySelectorAll
  9191. if ( support.qsa &&
  9192. !nonnativeSelectorCache[ selector + " " ] &&
  9193. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9194. // Support: IE 8 only
  9195. // Exclude object elements
  9196. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9197. newSelector = selector;
  9198. newContext = context;
  9199. // qSA considers elements outside a scoping root when evaluating child or
  9200. // descendant combinators, which is not what we want.
  9201. // In such cases, we work around the behavior by prefixing every selector in the
  9202. // list with an ID selector referencing the scope context.
  9203. // Thanks to Andrew Dupont for this technique.
  9204. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9205. // Capture the context ID, setting it first if necessary
  9206. if ( (nid = context.getAttribute( "id" )) ) {
  9207. nid = nid.replace( rcssescape, fcssescape );
  9208. } else {
  9209. context.setAttribute( "id", (nid = expando) );
  9210. }
  9211. // Prefix every selector in the list
  9212. groups = tokenize( selector );
  9213. i = groups.length;
  9214. while ( i-- ) {
  9215. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9216. }
  9217. newSelector = groups.join( "," );
  9218. // Expand context for sibling selectors
  9219. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9220. context;
  9221. }
  9222. try {
  9223. push.apply( results,
  9224. newContext.querySelectorAll( newSelector )
  9225. );
  9226. return results;
  9227. } catch ( qsaError ) {
  9228. nonnativeSelectorCache( selector, true );
  9229. } finally {
  9230. if ( nid === expando ) {
  9231. context.removeAttribute( "id" );
  9232. }
  9233. }
  9234. }
  9235. }
  9236. }
  9237. // All others
  9238. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9239. }
  9240. /**
  9241. * Create key-value caches of limited size
  9242. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9243. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9244. * deleting the oldest entry
  9245. */
  9246. function createCache() {
  9247. var keys = [];
  9248. function cache( key, value ) {
  9249. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9250. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9251. // Only keep the most recent entries
  9252. delete cache[ keys.shift() ];
  9253. }
  9254. return (cache[ key + " " ] = value);
  9255. }
  9256. return cache;
  9257. }
  9258. /**
  9259. * Mark a function for special use by Sizzle
  9260. * @param {Function} fn The function to mark
  9261. */
  9262. function markFunction( fn ) {
  9263. fn[ expando ] = true;
  9264. return fn;
  9265. }
  9266. /**
  9267. * Support testing using an element
  9268. * @param {Function} fn Passed the created element and returns a boolean result
  9269. */
  9270. function assert( fn ) {
  9271. var el = document.createElement("fieldset");
  9272. try {
  9273. return !!fn( el );
  9274. } catch (e) {
  9275. return false;
  9276. } finally {
  9277. // Remove from its parent by default
  9278. if ( el.parentNode ) {
  9279. el.parentNode.removeChild( el );
  9280. }
  9281. // release memory in IE
  9282. el = null;
  9283. }
  9284. }
  9285. /**
  9286. * Adds the same handler for all of the specified attrs
  9287. * @param {String} attrs Pipe-separated list of attributes
  9288. * @param {Function} handler The method that will be applied
  9289. */
  9290. function addHandle( attrs, handler ) {
  9291. var arr = attrs.split("|"),
  9292. i = arr.length;
  9293. while ( i-- ) {
  9294. Expr.attrHandle[ arr[i] ] = handler;
  9295. }
  9296. }
  9297. /**
  9298. * Checks document order of two siblings
  9299. * @param {Element} a
  9300. * @param {Element} b
  9301. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9302. */
  9303. function siblingCheck( a, b ) {
  9304. var cur = b && a,
  9305. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9306. a.sourceIndex - b.sourceIndex;
  9307. // Use IE sourceIndex if available on both nodes
  9308. if ( diff ) {
  9309. return diff;
  9310. }
  9311. // Check if b follows a
  9312. if ( cur ) {
  9313. while ( (cur = cur.nextSibling) ) {
  9314. if ( cur === b ) {
  9315. return -1;
  9316. }
  9317. }
  9318. }
  9319. return a ? 1 : -1;
  9320. }
  9321. /**
  9322. * Returns a function to use in pseudos for input types
  9323. * @param {String} type
  9324. */
  9325. function createInputPseudo( type ) {
  9326. return function( elem ) {
  9327. var name = elem.nodeName.toLowerCase();
  9328. return name === "input" && elem.type === type;
  9329. };
  9330. }
  9331. /**
  9332. * Returns a function to use in pseudos for buttons
  9333. * @param {String} type
  9334. */
  9335. function createButtonPseudo( type ) {
  9336. return function( elem ) {
  9337. var name = elem.nodeName.toLowerCase();
  9338. return (name === "input" || name === "button") && elem.type === type;
  9339. };
  9340. }
  9341. /**
  9342. * Returns a function to use in pseudos for :enabled/:disabled
  9343. * @param {Boolean} disabled true for :disabled; false for :enabled
  9344. */
  9345. function createDisabledPseudo( disabled ) {
  9346. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9347. return function( elem ) {
  9348. // Only certain elements can match :enabled or :disabled
  9349. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9350. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9351. if ( "form" in elem ) {
  9352. // Check for inherited disabledness on relevant non-disabled elements:
  9353. // * listed form-associated elements in a disabled fieldset
  9354. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9355. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9356. // * option elements in a disabled optgroup
  9357. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9358. // All such elements have a "form" property.
  9359. if ( elem.parentNode && elem.disabled === false ) {
  9360. // Option elements defer to a parent optgroup if present
  9361. if ( "label" in elem ) {
  9362. if ( "label" in elem.parentNode ) {
  9363. return elem.parentNode.disabled === disabled;
  9364. } else {
  9365. return elem.disabled === disabled;
  9366. }
  9367. }
  9368. // Support: IE 6 - 11
  9369. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9370. return elem.isDisabled === disabled ||
  9371. // Where there is no isDisabled, check manually
  9372. /* jshint -W018 */
  9373. elem.isDisabled !== !disabled &&
  9374. inDisabledFieldset( elem ) === disabled;
  9375. }
  9376. return elem.disabled === disabled;
  9377. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9378. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9379. // even exist on them, let alone have a boolean value.
  9380. } else if ( "label" in elem ) {
  9381. return elem.disabled === disabled;
  9382. }
  9383. // Remaining elements are neither :enabled nor :disabled
  9384. return false;
  9385. };
  9386. }
  9387. /**
  9388. * Returns a function to use in pseudos for positionals
  9389. * @param {Function} fn
  9390. */
  9391. function createPositionalPseudo( fn ) {
  9392. return markFunction(function( argument ) {
  9393. argument = +argument;
  9394. return markFunction(function( seed, matches ) {
  9395. var j,
  9396. matchIndexes = fn( [], seed.length, argument ),
  9397. i = matchIndexes.length;
  9398. // Match elements found at the specified indexes
  9399. while ( i-- ) {
  9400. if ( seed[ (j = matchIndexes[i]) ] ) {
  9401. seed[j] = !(matches[j] = seed[j]);
  9402. }
  9403. }
  9404. });
  9405. });
  9406. }
  9407. /**
  9408. * Checks a node for validity as a Sizzle context
  9409. * @param {Element|Object=} context
  9410. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9411. */
  9412. function testContext( context ) {
  9413. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9414. }
  9415. // Expose support vars for convenience
  9416. support = Sizzle.support = {};
  9417. /**
  9418. * Detects XML nodes
  9419. * @param {Element|Object} elem An element or a document
  9420. * @returns {Boolean} True iff elem is a non-HTML XML node
  9421. */
  9422. isXML = Sizzle.isXML = function( elem ) {
  9423. var namespace = elem.namespaceURI,
  9424. docElem = (elem.ownerDocument || elem).documentElement;
  9425. // Support: IE <=8
  9426. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9427. // https://bugs.jquery.com/ticket/4833
  9428. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9429. };
  9430. /**
  9431. * Sets document-related variables once based on the current document
  9432. * @param {Element|Object} [doc] An element or document object to use to set the document
  9433. * @returns {Object} Returns the current document
  9434. */
  9435. setDocument = Sizzle.setDocument = function( node ) {
  9436. var hasCompare, subWindow,
  9437. doc = node ? node.ownerDocument || node : preferredDoc;
  9438. // Return early if doc is invalid or already selected
  9439. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9440. return document;
  9441. }
  9442. // Update global variables
  9443. document = doc;
  9444. docElem = document.documentElement;
  9445. documentIsHTML = !isXML( document );
  9446. // Support: IE 9-11, Edge
  9447. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9448. if ( preferredDoc !== document &&
  9449. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9450. // Support: IE 11, Edge
  9451. if ( subWindow.addEventListener ) {
  9452. subWindow.addEventListener( "unload", unloadHandler, false );
  9453. // Support: IE 9 - 10 only
  9454. } else if ( subWindow.attachEvent ) {
  9455. subWindow.attachEvent( "onunload", unloadHandler );
  9456. }
  9457. }
  9458. /* Attributes
  9459. ---------------------------------------------------------------------- */
  9460. // Support: IE<8
  9461. // Verify that getAttribute really returns attributes and not properties
  9462. // (excepting IE8 booleans)
  9463. support.attributes = assert(function( el ) {
  9464. el.className = "i";
  9465. return !el.getAttribute("className");
  9466. });
  9467. /* getElement(s)By*
  9468. ---------------------------------------------------------------------- */
  9469. // Check if getElementsByTagName("*") returns only elements
  9470. support.getElementsByTagName = assert(function( el ) {
  9471. el.appendChild( document.createComment("") );
  9472. return !el.getElementsByTagName("*").length;
  9473. });
  9474. // Support: IE<9
  9475. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9476. // Support: IE<10
  9477. // Check if getElementById returns elements by name
  9478. // The broken getElementById methods don't pick up programmatically-set names,
  9479. // so use a roundabout getElementsByName test
  9480. support.getById = assert(function( el ) {
  9481. docElem.appendChild( el ).id = expando;
  9482. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9483. });
  9484. // ID filter and find
  9485. if ( support.getById ) {
  9486. Expr.filter["ID"] = function( id ) {
  9487. var attrId = id.replace( runescape, funescape );
  9488. return function( elem ) {
  9489. return elem.getAttribute("id") === attrId;
  9490. };
  9491. };
  9492. Expr.find["ID"] = function( id, context ) {
  9493. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9494. var elem = context.getElementById( id );
  9495. return elem ? [ elem ] : [];
  9496. }
  9497. };
  9498. } else {
  9499. Expr.filter["ID"] = function( id ) {
  9500. var attrId = id.replace( runescape, funescape );
  9501. return function( elem ) {
  9502. var node = typeof elem.getAttributeNode !== "undefined" &&
  9503. elem.getAttributeNode("id");
  9504. return node && node.value === attrId;
  9505. };
  9506. };
  9507. // Support: IE 6 - 7 only
  9508. // getElementById is not reliable as a find shortcut
  9509. Expr.find["ID"] = function( id, context ) {
  9510. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9511. var node, i, elems,
  9512. elem = context.getElementById( id );
  9513. if ( elem ) {
  9514. // Verify the id attribute
  9515. node = elem.getAttributeNode("id");
  9516. if ( node && node.value === id ) {
  9517. return [ elem ];
  9518. }
  9519. // Fall back on getElementsByName
  9520. elems = context.getElementsByName( id );
  9521. i = 0;
  9522. while ( (elem = elems[i++]) ) {
  9523. node = elem.getAttributeNode("id");
  9524. if ( node && node.value === id ) {
  9525. return [ elem ];
  9526. }
  9527. }
  9528. }
  9529. return [];
  9530. }
  9531. };
  9532. }
  9533. // Tag
  9534. Expr.find["TAG"] = support.getElementsByTagName ?
  9535. function( tag, context ) {
  9536. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9537. return context.getElementsByTagName( tag );
  9538. // DocumentFragment nodes don't have gEBTN
  9539. } else if ( support.qsa ) {
  9540. return context.querySelectorAll( tag );
  9541. }
  9542. } :
  9543. function( tag, context ) {
  9544. var elem,
  9545. tmp = [],
  9546. i = 0,
  9547. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9548. results = context.getElementsByTagName( tag );
  9549. // Filter out possible comments
  9550. if ( tag === "*" ) {
  9551. while ( (elem = results[i++]) ) {
  9552. if ( elem.nodeType === 1 ) {
  9553. tmp.push( elem );
  9554. }
  9555. }
  9556. return tmp;
  9557. }
  9558. return results;
  9559. };
  9560. // Class
  9561. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9562. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9563. return context.getElementsByClassName( className );
  9564. }
  9565. };
  9566. /* QSA/matchesSelector
  9567. ---------------------------------------------------------------------- */
  9568. // QSA and matchesSelector support
  9569. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9570. rbuggyMatches = [];
  9571. // qSa(:focus) reports false when true (Chrome 21)
  9572. // We allow this because of a bug in IE8/9 that throws an error
  9573. // whenever `document.activeElement` is accessed on an iframe
  9574. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9575. // See https://bugs.jquery.com/ticket/13378
  9576. rbuggyQSA = [];
  9577. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9578. // Build QSA regex
  9579. // Regex strategy adopted from Diego Perini
  9580. assert(function( el ) {
  9581. // Select is set to empty string on purpose
  9582. // This is to test IE's treatment of not explicitly
  9583. // setting a boolean content attribute,
  9584. // since its presence should be enough
  9585. // https://bugs.jquery.com/ticket/12359
  9586. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9587. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9588. "<option selected=''></option></select>";
  9589. // Support: IE8, Opera 11-12.16
  9590. // Nothing should be selected when empty strings follow ^= or $= or *=
  9591. // The test attribute must be unknown in Opera but "safe" for WinRT
  9592. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9593. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9594. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9595. }
  9596. // Support: IE8
  9597. // Boolean attributes and "value" are not treated correctly
  9598. if ( !el.querySelectorAll("[selected]").length ) {
  9599. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9600. }
  9601. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9602. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9603. rbuggyQSA.push("~=");
  9604. }
  9605. // Webkit/Opera - :checked should return selected option elements
  9606. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9607. // IE8 throws error here and will not see later tests
  9608. if ( !el.querySelectorAll(":checked").length ) {
  9609. rbuggyQSA.push(":checked");
  9610. }
  9611. // Support: Safari 8+, iOS 8+
  9612. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9613. // In-page `selector#id sibling-combinator selector` fails
  9614. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9615. rbuggyQSA.push(".#.+[+~]");
  9616. }
  9617. });
  9618. assert(function( el ) {
  9619. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9620. "<select disabled='disabled'><option/></select>";
  9621. // Support: Windows 8 Native Apps
  9622. // The type and name attributes are restricted during .innerHTML assignment
  9623. var input = document.createElement("input");
  9624. input.setAttribute( "type", "hidden" );
  9625. el.appendChild( input ).setAttribute( "name", "D" );
  9626. // Support: IE8
  9627. // Enforce case-sensitivity of name attribute
  9628. if ( el.querySelectorAll("[name=d]").length ) {
  9629. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9630. }
  9631. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9632. // IE8 throws error here and will not see later tests
  9633. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9634. rbuggyQSA.push( ":enabled", ":disabled" );
  9635. }
  9636. // Support: IE9-11+
  9637. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9638. docElem.appendChild( el ).disabled = true;
  9639. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9640. rbuggyQSA.push( ":enabled", ":disabled" );
  9641. }
  9642. // Opera 10-11 does not throw on post-comma invalid pseudos
  9643. el.querySelectorAll("*,:x");
  9644. rbuggyQSA.push(",.*:");
  9645. });
  9646. }
  9647. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9648. docElem.webkitMatchesSelector ||
  9649. docElem.mozMatchesSelector ||
  9650. docElem.oMatchesSelector ||
  9651. docElem.msMatchesSelector) )) ) {
  9652. assert(function( el ) {
  9653. // Check to see if it's possible to do matchesSelector
  9654. // on a disconnected node (IE 9)
  9655. support.disconnectedMatch = matches.call( el, "*" );
  9656. // This should fail with an exception
  9657. // Gecko does not error, returns false instead
  9658. matches.call( el, "[s!='']:x" );
  9659. rbuggyMatches.push( "!=", pseudos );
  9660. });
  9661. }
  9662. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9663. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9664. /* Contains
  9665. ---------------------------------------------------------------------- */
  9666. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9667. // Element contains another
  9668. // Purposefully self-exclusive
  9669. // As in, an element does not contain itself
  9670. contains = hasCompare || rnative.test( docElem.contains ) ?
  9671. function( a, b ) {
  9672. var adown = a.nodeType === 9 ? a.documentElement : a,
  9673. bup = b && b.parentNode;
  9674. return a === bup || !!( bup && bup.nodeType === 1 && (
  9675. adown.contains ?
  9676. adown.contains( bup ) :
  9677. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9678. ));
  9679. } :
  9680. function( a, b ) {
  9681. if ( b ) {
  9682. while ( (b = b.parentNode) ) {
  9683. if ( b === a ) {
  9684. return true;
  9685. }
  9686. }
  9687. }
  9688. return false;
  9689. };
  9690. /* Sorting
  9691. ---------------------------------------------------------------------- */
  9692. // Document order sorting
  9693. sortOrder = hasCompare ?
  9694. function( a, b ) {
  9695. // Flag for duplicate removal
  9696. if ( a === b ) {
  9697. hasDuplicate = true;
  9698. return 0;
  9699. }
  9700. // Sort on method existence if only one input has compareDocumentPosition
  9701. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9702. if ( compare ) {
  9703. return compare;
  9704. }
  9705. // Calculate position if both inputs belong to the same document
  9706. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9707. a.compareDocumentPosition( b ) :
  9708. // Otherwise we know they are disconnected
  9709. 1;
  9710. // Disconnected nodes
  9711. if ( compare & 1 ||
  9712. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9713. // Choose the first element that is related to our preferred document
  9714. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9715. return -1;
  9716. }
  9717. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9718. return 1;
  9719. }
  9720. // Maintain original order
  9721. return sortInput ?
  9722. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9723. 0;
  9724. }
  9725. return compare & 4 ? -1 : 1;
  9726. } :
  9727. function( a, b ) {
  9728. // Exit early if the nodes are identical
  9729. if ( a === b ) {
  9730. hasDuplicate = true;
  9731. return 0;
  9732. }
  9733. var cur,
  9734. i = 0,
  9735. aup = a.parentNode,
  9736. bup = b.parentNode,
  9737. ap = [ a ],
  9738. bp = [ b ];
  9739. // Parentless nodes are either documents or disconnected
  9740. if ( !aup || !bup ) {
  9741. return a === document ? -1 :
  9742. b === document ? 1 :
  9743. aup ? -1 :
  9744. bup ? 1 :
  9745. sortInput ?
  9746. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9747. 0;
  9748. // If the nodes are siblings, we can do a quick check
  9749. } else if ( aup === bup ) {
  9750. return siblingCheck( a, b );
  9751. }
  9752. // Otherwise we need full lists of their ancestors for comparison
  9753. cur = a;
  9754. while ( (cur = cur.parentNode) ) {
  9755. ap.unshift( cur );
  9756. }
  9757. cur = b;
  9758. while ( (cur = cur.parentNode) ) {
  9759. bp.unshift( cur );
  9760. }
  9761. // Walk down the tree looking for a discrepancy
  9762. while ( ap[i] === bp[i] ) {
  9763. i++;
  9764. }
  9765. return i ?
  9766. // Do a sibling check if the nodes have a common ancestor
  9767. siblingCheck( ap[i], bp[i] ) :
  9768. // Otherwise nodes in our document sort first
  9769. ap[i] === preferredDoc ? -1 :
  9770. bp[i] === preferredDoc ? 1 :
  9771. 0;
  9772. };
  9773. return document;
  9774. };
  9775. Sizzle.matches = function( expr, elements ) {
  9776. return Sizzle( expr, null, null, elements );
  9777. };
  9778. Sizzle.matchesSelector = function( elem, expr ) {
  9779. // Set document vars if needed
  9780. if ( ( elem.ownerDocument || elem ) !== document ) {
  9781. setDocument( elem );
  9782. }
  9783. if ( support.matchesSelector && documentIsHTML &&
  9784. !nonnativeSelectorCache[ expr + " " ] &&
  9785. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9786. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9787. try {
  9788. var ret = matches.call( elem, expr );
  9789. // IE 9's matchesSelector returns false on disconnected nodes
  9790. if ( ret || support.disconnectedMatch ||
  9791. // As well, disconnected nodes are said to be in a document
  9792. // fragment in IE 9
  9793. elem.document && elem.document.nodeType !== 11 ) {
  9794. return ret;
  9795. }
  9796. } catch (e) {
  9797. nonnativeSelectorCache( expr, true );
  9798. }
  9799. }
  9800. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9801. };
  9802. Sizzle.contains = function( context, elem ) {
  9803. // Set document vars if needed
  9804. if ( ( context.ownerDocument || context ) !== document ) {
  9805. setDocument( context );
  9806. }
  9807. return contains( context, elem );
  9808. };
  9809. Sizzle.attr = function( elem, name ) {
  9810. // Set document vars if needed
  9811. if ( ( elem.ownerDocument || elem ) !== document ) {
  9812. setDocument( elem );
  9813. }
  9814. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9815. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9816. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9817. fn( elem, name, !documentIsHTML ) :
  9818. undefined;
  9819. return val !== undefined ?
  9820. val :
  9821. support.attributes || !documentIsHTML ?
  9822. elem.getAttribute( name ) :
  9823. (val = elem.getAttributeNode(name)) && val.specified ?
  9824. val.value :
  9825. null;
  9826. };
  9827. Sizzle.escape = function( sel ) {
  9828. return (sel + "").replace( rcssescape, fcssescape );
  9829. };
  9830. Sizzle.error = function( msg ) {
  9831. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9832. };
  9833. /**
  9834. * Document sorting and removing duplicates
  9835. * @param {ArrayLike} results
  9836. */
  9837. Sizzle.uniqueSort = function( results ) {
  9838. var elem,
  9839. duplicates = [],
  9840. j = 0,
  9841. i = 0;
  9842. // Unless we *know* we can detect duplicates, assume their presence
  9843. hasDuplicate = !support.detectDuplicates;
  9844. sortInput = !support.sortStable && results.slice( 0 );
  9845. results.sort( sortOrder );
  9846. if ( hasDuplicate ) {
  9847. while ( (elem = results[i++]) ) {
  9848. if ( elem === results[ i ] ) {
  9849. j = duplicates.push( i );
  9850. }
  9851. }
  9852. while ( j-- ) {
  9853. results.splice( duplicates[ j ], 1 );
  9854. }
  9855. }
  9856. // Clear input after sorting to release objects
  9857. // See https://github.com/jquery/sizzle/pull/225
  9858. sortInput = null;
  9859. return results;
  9860. };
  9861. /**
  9862. * Utility function for retrieving the text value of an array of DOM nodes
  9863. * @param {Array|Element} elem
  9864. */
  9865. getText = Sizzle.getText = function( elem ) {
  9866. var node,
  9867. ret = "",
  9868. i = 0,
  9869. nodeType = elem.nodeType;
  9870. if ( !nodeType ) {
  9871. // If no nodeType, this is expected to be an array
  9872. while ( (node = elem[i++]) ) {
  9873. // Do not traverse comment nodes
  9874. ret += getText( node );
  9875. }
  9876. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9877. // Use textContent for elements
  9878. // innerText usage removed for consistency of new lines (jQuery #11153)
  9879. if ( typeof elem.textContent === "string" ) {
  9880. return elem.textContent;
  9881. } else {
  9882. // Traverse its children
  9883. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9884. ret += getText( elem );
  9885. }
  9886. }
  9887. } else if ( nodeType === 3 || nodeType === 4 ) {
  9888. return elem.nodeValue;
  9889. }
  9890. // Do not include comment or processing instruction nodes
  9891. return ret;
  9892. };
  9893. Expr = Sizzle.selectors = {
  9894. // Can be adjusted by the user
  9895. cacheLength: 50,
  9896. createPseudo: markFunction,
  9897. match: matchExpr,
  9898. attrHandle: {},
  9899. find: {},
  9900. relative: {
  9901. ">": { dir: "parentNode", first: true },
  9902. " ": { dir: "parentNode" },
  9903. "+": { dir: "previousSibling", first: true },
  9904. "~": { dir: "previousSibling" }
  9905. },
  9906. preFilter: {
  9907. "ATTR": function( match ) {
  9908. match[1] = match[1].replace( runescape, funescape );
  9909. // Move the given value to match[3] whether quoted or unquoted
  9910. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9911. if ( match[2] === "~=" ) {
  9912. match[3] = " " + match[3] + " ";
  9913. }
  9914. return match.slice( 0, 4 );
  9915. },
  9916. "CHILD": function( match ) {
  9917. /* matches from matchExpr["CHILD"]
  9918. 1 type (only|nth|...)
  9919. 2 what (child|of-type)
  9920. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9921. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9922. 5 sign of xn-component
  9923. 6 x of xn-component
  9924. 7 sign of y-component
  9925. 8 y of y-component
  9926. */
  9927. match[1] = match[1].toLowerCase();
  9928. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9929. // nth-* requires argument
  9930. if ( !match[3] ) {
  9931. Sizzle.error( match[0] );
  9932. }
  9933. // numeric x and y parameters for Expr.filter.CHILD
  9934. // remember that false/true cast respectively to 0/1
  9935. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9936. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9937. // other types prohibit arguments
  9938. } else if ( match[3] ) {
  9939. Sizzle.error( match[0] );
  9940. }
  9941. return match;
  9942. },
  9943. "PSEUDO": function( match ) {
  9944. var excess,
  9945. unquoted = !match[6] && match[2];
  9946. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9947. return null;
  9948. }
  9949. // Accept quoted arguments as-is
  9950. if ( match[3] ) {
  9951. match[2] = match[4] || match[5] || "";
  9952. // Strip excess characters from unquoted arguments
  9953. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9954. // Get excess from tokenize (recursively)
  9955. (excess = tokenize( unquoted, true )) &&
  9956. // advance to the next closing parenthesis
  9957. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9958. // excess is a negative index
  9959. match[0] = match[0].slice( 0, excess );
  9960. match[2] = unquoted.slice( 0, excess );
  9961. }
  9962. // Return only captures needed by the pseudo filter method (type and argument)
  9963. return match.slice( 0, 3 );
  9964. }
  9965. },
  9966. filter: {
  9967. "TAG": function( nodeNameSelector ) {
  9968. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9969. return nodeNameSelector === "*" ?
  9970. function() { return true; } :
  9971. function( elem ) {
  9972. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  9973. };
  9974. },
  9975. "CLASS": function( className ) {
  9976. var pattern = classCache[ className + " " ];
  9977. return pattern ||
  9978. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  9979. classCache( className, function( elem ) {
  9980. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  9981. });
  9982. },
  9983. "ATTR": function( name, operator, check ) {
  9984. return function( elem ) {
  9985. var result = Sizzle.attr( elem, name );
  9986. if ( result == null ) {
  9987. return operator === "!=";
  9988. }
  9989. if ( !operator ) {
  9990. return true;
  9991. }
  9992. result += "";
  9993. return operator === "=" ? result === check :
  9994. operator === "!=" ? result !== check :
  9995. operator === "^=" ? check && result.indexOf( check ) === 0 :
  9996. operator === "*=" ? check && result.indexOf( check ) > -1 :
  9997. operator === "$=" ? check && result.slice( -check.length ) === check :
  9998. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  9999. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10000. false;
  10001. };
  10002. },
  10003. "CHILD": function( type, what, argument, first, last ) {
  10004. var simple = type.slice( 0, 3 ) !== "nth",
  10005. forward = type.slice( -4 ) !== "last",
  10006. ofType = what === "of-type";
  10007. return first === 1 && last === 0 ?
  10008. // Shortcut for :nth-*(n)
  10009. function( elem ) {
  10010. return !!elem.parentNode;
  10011. } :
  10012. function( elem, context, xml ) {
  10013. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10014. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10015. parent = elem.parentNode,
  10016. name = ofType && elem.nodeName.toLowerCase(),
  10017. useCache = !xml && !ofType,
  10018. diff = false;
  10019. if ( parent ) {
  10020. // :(first|last|only)-(child|of-type)
  10021. if ( simple ) {
  10022. while ( dir ) {
  10023. node = elem;
  10024. while ( (node = node[ dir ]) ) {
  10025. if ( ofType ?
  10026. node.nodeName.toLowerCase() === name :
  10027. node.nodeType === 1 ) {
  10028. return false;
  10029. }
  10030. }
  10031. // Reverse direction for :only-* (if we haven't yet done so)
  10032. start = dir = type === "only" && !start && "nextSibling";
  10033. }
  10034. return true;
  10035. }
  10036. start = [ forward ? parent.firstChild : parent.lastChild ];
  10037. // non-xml :nth-child(...) stores cache data on `parent`
  10038. if ( forward && useCache ) {
  10039. // Seek `elem` from a previously-cached index
  10040. // ...in a gzip-friendly way
  10041. node = parent;
  10042. outerCache = node[ expando ] || (node[ expando ] = {});
  10043. // Support: IE <9 only
  10044. // Defend against cloned attroperties (jQuery gh-1709)
  10045. uniqueCache = outerCache[ node.uniqueID ] ||
  10046. (outerCache[ node.uniqueID ] = {});
  10047. cache = uniqueCache[ type ] || [];
  10048. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10049. diff = nodeIndex && cache[ 2 ];
  10050. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10051. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10052. // Fallback to seeking `elem` from the start
  10053. (diff = nodeIndex = 0) || start.pop()) ) {
  10054. // When found, cache indexes on `parent` and break
  10055. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10056. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10057. break;
  10058. }
  10059. }
  10060. } else {
  10061. // Use previously-cached element index if available
  10062. if ( useCache ) {
  10063. // ...in a gzip-friendly way
  10064. node = elem;
  10065. outerCache = node[ expando ] || (node[ expando ] = {});
  10066. // Support: IE <9 only
  10067. // Defend against cloned attroperties (jQuery gh-1709)
  10068. uniqueCache = outerCache[ node.uniqueID ] ||
  10069. (outerCache[ node.uniqueID ] = {});
  10070. cache = uniqueCache[ type ] || [];
  10071. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10072. diff = nodeIndex;
  10073. }
  10074. // xml :nth-child(...)
  10075. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10076. if ( diff === false ) {
  10077. // Use the same loop as above to seek `elem` from the start
  10078. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10079. (diff = nodeIndex = 0) || start.pop()) ) {
  10080. if ( ( ofType ?
  10081. node.nodeName.toLowerCase() === name :
  10082. node.nodeType === 1 ) &&
  10083. ++diff ) {
  10084. // Cache the index of each encountered element
  10085. if ( useCache ) {
  10086. outerCache = node[ expando ] || (node[ expando ] = {});
  10087. // Support: IE <9 only
  10088. // Defend against cloned attroperties (jQuery gh-1709)
  10089. uniqueCache = outerCache[ node.uniqueID ] ||
  10090. (outerCache[ node.uniqueID ] = {});
  10091. uniqueCache[ type ] = [ dirruns, diff ];
  10092. }
  10093. if ( node === elem ) {
  10094. break;
  10095. }
  10096. }
  10097. }
  10098. }
  10099. }
  10100. // Incorporate the offset, then check against cycle size
  10101. diff -= last;
  10102. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10103. }
  10104. };
  10105. },
  10106. "PSEUDO": function( pseudo, argument ) {
  10107. // pseudo-class names are case-insensitive
  10108. // http://www.w3.org/TR/selectors/#pseudo-classes
  10109. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10110. // Remember that setFilters inherits from pseudos
  10111. var args,
  10112. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10113. Sizzle.error( "unsupported pseudo: " + pseudo );
  10114. // The user may use createPseudo to indicate that
  10115. // arguments are needed to create the filter function
  10116. // just as Sizzle does
  10117. if ( fn[ expando ] ) {
  10118. return fn( argument );
  10119. }
  10120. // But maintain support for old signatures
  10121. if ( fn.length > 1 ) {
  10122. args = [ pseudo, pseudo, "", argument ];
  10123. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10124. markFunction(function( seed, matches ) {
  10125. var idx,
  10126. matched = fn( seed, argument ),
  10127. i = matched.length;
  10128. while ( i-- ) {
  10129. idx = indexOf( seed, matched[i] );
  10130. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10131. }
  10132. }) :
  10133. function( elem ) {
  10134. return fn( elem, 0, args );
  10135. };
  10136. }
  10137. return fn;
  10138. }
  10139. },
  10140. pseudos: {
  10141. // Potentially complex pseudos
  10142. "not": markFunction(function( selector ) {
  10143. // Trim the selector passed to compile
  10144. // to avoid treating leading and trailing
  10145. // spaces as combinators
  10146. var input = [],
  10147. results = [],
  10148. matcher = compile( selector.replace( rtrim, "$1" ) );
  10149. return matcher[ expando ] ?
  10150. markFunction(function( seed, matches, context, xml ) {
  10151. var elem,
  10152. unmatched = matcher( seed, null, xml, [] ),
  10153. i = seed.length;
  10154. // Match elements unmatched by `matcher`
  10155. while ( i-- ) {
  10156. if ( (elem = unmatched[i]) ) {
  10157. seed[i] = !(matches[i] = elem);
  10158. }
  10159. }
  10160. }) :
  10161. function( elem, context, xml ) {
  10162. input[0] = elem;
  10163. matcher( input, null, xml, results );
  10164. // Don't keep the element (issue #299)
  10165. input[0] = null;
  10166. return !results.pop();
  10167. };
  10168. }),
  10169. "has": markFunction(function( selector ) {
  10170. return function( elem ) {
  10171. return Sizzle( selector, elem ).length > 0;
  10172. };
  10173. }),
  10174. "contains": markFunction(function( text ) {
  10175. text = text.replace( runescape, funescape );
  10176. return function( elem ) {
  10177. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10178. };
  10179. }),
  10180. // "Whether an element is represented by a :lang() selector
  10181. // is based solely on the element's language value
  10182. // being equal to the identifier C,
  10183. // or beginning with the identifier C immediately followed by "-".
  10184. // The matching of C against the element's language value is performed case-insensitively.
  10185. // The identifier C does not have to be a valid language name."
  10186. // http://www.w3.org/TR/selectors/#lang-pseudo
  10187. "lang": markFunction( function( lang ) {
  10188. // lang value must be a valid identifier
  10189. if ( !ridentifier.test(lang || "") ) {
  10190. Sizzle.error( "unsupported lang: " + lang );
  10191. }
  10192. lang = lang.replace( runescape, funescape ).toLowerCase();
  10193. return function( elem ) {
  10194. var elemLang;
  10195. do {
  10196. if ( (elemLang = documentIsHTML ?
  10197. elem.lang :
  10198. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10199. elemLang = elemLang.toLowerCase();
  10200. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10201. }
  10202. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10203. return false;
  10204. };
  10205. }),
  10206. // Miscellaneous
  10207. "target": function( elem ) {
  10208. var hash = window.location && window.location.hash;
  10209. return hash && hash.slice( 1 ) === elem.id;
  10210. },
  10211. "root": function( elem ) {
  10212. return elem === docElem;
  10213. },
  10214. "focus": function( elem ) {
  10215. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10216. },
  10217. // Boolean properties
  10218. "enabled": createDisabledPseudo( false ),
  10219. "disabled": createDisabledPseudo( true ),
  10220. "checked": function( elem ) {
  10221. // In CSS3, :checked should return both checked and selected elements
  10222. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10223. var nodeName = elem.nodeName.toLowerCase();
  10224. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10225. },
  10226. "selected": function( elem ) {
  10227. // Accessing this property makes selected-by-default
  10228. // options in Safari work properly
  10229. if ( elem.parentNode ) {
  10230. elem.parentNode.selectedIndex;
  10231. }
  10232. return elem.selected === true;
  10233. },
  10234. // Contents
  10235. "empty": function( elem ) {
  10236. // http://www.w3.org/TR/selectors/#empty-pseudo
  10237. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10238. // but not by others (comment: 8; processing instruction: 7; etc.)
  10239. // nodeType < 6 works because attributes (2) do not appear as children
  10240. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10241. if ( elem.nodeType < 6 ) {
  10242. return false;
  10243. }
  10244. }
  10245. return true;
  10246. },
  10247. "parent": function( elem ) {
  10248. return !Expr.pseudos["empty"]( elem );
  10249. },
  10250. // Element/input types
  10251. "header": function( elem ) {
  10252. return rheader.test( elem.nodeName );
  10253. },
  10254. "input": function( elem ) {
  10255. return rinputs.test( elem.nodeName );
  10256. },
  10257. "button": function( elem ) {
  10258. var name = elem.nodeName.toLowerCase();
  10259. return name === "input" && elem.type === "button" || name === "button";
  10260. },
  10261. "text": function( elem ) {
  10262. var attr;
  10263. return elem.nodeName.toLowerCase() === "input" &&
  10264. elem.type === "text" &&
  10265. // Support: IE<8
  10266. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10267. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10268. },
  10269. // Position-in-collection
  10270. "first": createPositionalPseudo(function() {
  10271. return [ 0 ];
  10272. }),
  10273. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10274. return [ length - 1 ];
  10275. }),
  10276. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10277. return [ argument < 0 ? argument + length : argument ];
  10278. }),
  10279. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10280. var i = 0;
  10281. for ( ; i < length; i += 2 ) {
  10282. matchIndexes.push( i );
  10283. }
  10284. return matchIndexes;
  10285. }),
  10286. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10287. var i = 1;
  10288. for ( ; i < length; i += 2 ) {
  10289. matchIndexes.push( i );
  10290. }
  10291. return matchIndexes;
  10292. }),
  10293. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10294. var i = argument < 0 ?
  10295. argument + length :
  10296. argument > length ?
  10297. length :
  10298. argument;
  10299. for ( ; --i >= 0; ) {
  10300. matchIndexes.push( i );
  10301. }
  10302. return matchIndexes;
  10303. }),
  10304. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10305. var i = argument < 0 ? argument + length : argument;
  10306. for ( ; ++i < length; ) {
  10307. matchIndexes.push( i );
  10308. }
  10309. return matchIndexes;
  10310. })
  10311. }
  10312. };
  10313. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10314. // Add button/input type pseudos
  10315. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10316. Expr.pseudos[ i ] = createInputPseudo( i );
  10317. }
  10318. for ( i in { submit: true, reset: true } ) {
  10319. Expr.pseudos[ i ] = createButtonPseudo( i );
  10320. }
  10321. // Easy API for creating new setFilters
  10322. function setFilters() {}
  10323. setFilters.prototype = Expr.filters = Expr.pseudos;
  10324. Expr.setFilters = new setFilters();
  10325. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10326. var matched, match, tokens, type,
  10327. soFar, groups, preFilters,
  10328. cached = tokenCache[ selector + " " ];
  10329. if ( cached ) {
  10330. return parseOnly ? 0 : cached.slice( 0 );
  10331. }
  10332. soFar = selector;
  10333. groups = [];
  10334. preFilters = Expr.preFilter;
  10335. while ( soFar ) {
  10336. // Comma and first run
  10337. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10338. if ( match ) {
  10339. // Don't consume trailing commas as valid
  10340. soFar = soFar.slice( match[0].length ) || soFar;
  10341. }
  10342. groups.push( (tokens = []) );
  10343. }
  10344. matched = false;
  10345. // Combinators
  10346. if ( (match = rcombinators.exec( soFar )) ) {
  10347. matched = match.shift();
  10348. tokens.push({
  10349. value: matched,
  10350. // Cast descendant combinators to space
  10351. type: match[0].replace( rtrim, " " )
  10352. });
  10353. soFar = soFar.slice( matched.length );
  10354. }
  10355. // Filters
  10356. for ( type in Expr.filter ) {
  10357. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10358. (match = preFilters[ type ]( match ))) ) {
  10359. matched = match.shift();
  10360. tokens.push({
  10361. value: matched,
  10362. type: type,
  10363. matches: match
  10364. });
  10365. soFar = soFar.slice( matched.length );
  10366. }
  10367. }
  10368. if ( !matched ) {
  10369. break;
  10370. }
  10371. }
  10372. // Return the length of the invalid excess
  10373. // if we're just parsing
  10374. // Otherwise, throw an error or return tokens
  10375. return parseOnly ?
  10376. soFar.length :
  10377. soFar ?
  10378. Sizzle.error( selector ) :
  10379. // Cache the tokens
  10380. tokenCache( selector, groups ).slice( 0 );
  10381. };
  10382. function toSelector( tokens ) {
  10383. var i = 0,
  10384. len = tokens.length,
  10385. selector = "";
  10386. for ( ; i < len; i++ ) {
  10387. selector += tokens[i].value;
  10388. }
  10389. return selector;
  10390. }
  10391. function addCombinator( matcher, combinator, base ) {
  10392. var dir = combinator.dir,
  10393. skip = combinator.next,
  10394. key = skip || dir,
  10395. checkNonElements = base && key === "parentNode",
  10396. doneName = done++;
  10397. return combinator.first ?
  10398. // Check against closest ancestor/preceding element
  10399. function( elem, context, xml ) {
  10400. while ( (elem = elem[ dir ]) ) {
  10401. if ( elem.nodeType === 1 || checkNonElements ) {
  10402. return matcher( elem, context, xml );
  10403. }
  10404. }
  10405. return false;
  10406. } :
  10407. // Check against all ancestor/preceding elements
  10408. function( elem, context, xml ) {
  10409. var oldCache, uniqueCache, outerCache,
  10410. newCache = [ dirruns, doneName ];
  10411. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10412. if ( xml ) {
  10413. while ( (elem = elem[ dir ]) ) {
  10414. if ( elem.nodeType === 1 || checkNonElements ) {
  10415. if ( matcher( elem, context, xml ) ) {
  10416. return true;
  10417. }
  10418. }
  10419. }
  10420. } else {
  10421. while ( (elem = elem[ dir ]) ) {
  10422. if ( elem.nodeType === 1 || checkNonElements ) {
  10423. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10424. // Support: IE <9 only
  10425. // Defend against cloned attroperties (jQuery gh-1709)
  10426. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10427. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10428. elem = elem[ dir ] || elem;
  10429. } else if ( (oldCache = uniqueCache[ key ]) &&
  10430. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10431. // Assign to newCache so results back-propagate to previous elements
  10432. return (newCache[ 2 ] = oldCache[ 2 ]);
  10433. } else {
  10434. // Reuse newcache so results back-propagate to previous elements
  10435. uniqueCache[ key ] = newCache;
  10436. // A match means we're done; a fail means we have to keep checking
  10437. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10438. return true;
  10439. }
  10440. }
  10441. }
  10442. }
  10443. }
  10444. return false;
  10445. };
  10446. }
  10447. function elementMatcher( matchers ) {
  10448. return matchers.length > 1 ?
  10449. function( elem, context, xml ) {
  10450. var i = matchers.length;
  10451. while ( i-- ) {
  10452. if ( !matchers[i]( elem, context, xml ) ) {
  10453. return false;
  10454. }
  10455. }
  10456. return true;
  10457. } :
  10458. matchers[0];
  10459. }
  10460. function multipleContexts( selector, contexts, results ) {
  10461. var i = 0,
  10462. len = contexts.length;
  10463. for ( ; i < len; i++ ) {
  10464. Sizzle( selector, contexts[i], results );
  10465. }
  10466. return results;
  10467. }
  10468. function condense( unmatched, map, filter, context, xml ) {
  10469. var elem,
  10470. newUnmatched = [],
  10471. i = 0,
  10472. len = unmatched.length,
  10473. mapped = map != null;
  10474. for ( ; i < len; i++ ) {
  10475. if ( (elem = unmatched[i]) ) {
  10476. if ( !filter || filter( elem, context, xml ) ) {
  10477. newUnmatched.push( elem );
  10478. if ( mapped ) {
  10479. map.push( i );
  10480. }
  10481. }
  10482. }
  10483. }
  10484. return newUnmatched;
  10485. }
  10486. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10487. if ( postFilter && !postFilter[ expando ] ) {
  10488. postFilter = setMatcher( postFilter );
  10489. }
  10490. if ( postFinder && !postFinder[ expando ] ) {
  10491. postFinder = setMatcher( postFinder, postSelector );
  10492. }
  10493. return markFunction(function( seed, results, context, xml ) {
  10494. var temp, i, elem,
  10495. preMap = [],
  10496. postMap = [],
  10497. preexisting = results.length,
  10498. // Get initial elements from seed or context
  10499. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10500. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10501. matcherIn = preFilter && ( seed || !selector ) ?
  10502. condense( elems, preMap, preFilter, context, xml ) :
  10503. elems,
  10504. matcherOut = matcher ?
  10505. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10506. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10507. // ...intermediate processing is necessary
  10508. [] :
  10509. // ...otherwise use results directly
  10510. results :
  10511. matcherIn;
  10512. // Find primary matches
  10513. if ( matcher ) {
  10514. matcher( matcherIn, matcherOut, context, xml );
  10515. }
  10516. // Apply postFilter
  10517. if ( postFilter ) {
  10518. temp = condense( matcherOut, postMap );
  10519. postFilter( temp, [], context, xml );
  10520. // Un-match failing elements by moving them back to matcherIn
  10521. i = temp.length;
  10522. while ( i-- ) {
  10523. if ( (elem = temp[i]) ) {
  10524. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10525. }
  10526. }
  10527. }
  10528. if ( seed ) {
  10529. if ( postFinder || preFilter ) {
  10530. if ( postFinder ) {
  10531. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10532. temp = [];
  10533. i = matcherOut.length;
  10534. while ( i-- ) {
  10535. if ( (elem = matcherOut[i]) ) {
  10536. // Restore matcherIn since elem is not yet a final match
  10537. temp.push( (matcherIn[i] = elem) );
  10538. }
  10539. }
  10540. postFinder( null, (matcherOut = []), temp, xml );
  10541. }
  10542. // Move matched elements from seed to results to keep them synchronized
  10543. i = matcherOut.length;
  10544. while ( i-- ) {
  10545. if ( (elem = matcherOut[i]) &&
  10546. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10547. seed[temp] = !(results[temp] = elem);
  10548. }
  10549. }
  10550. }
  10551. // Add elements to results, through postFinder if defined
  10552. } else {
  10553. matcherOut = condense(
  10554. matcherOut === results ?
  10555. matcherOut.splice( preexisting, matcherOut.length ) :
  10556. matcherOut
  10557. );
  10558. if ( postFinder ) {
  10559. postFinder( null, results, matcherOut, xml );
  10560. } else {
  10561. push.apply( results, matcherOut );
  10562. }
  10563. }
  10564. });
  10565. }
  10566. function matcherFromTokens( tokens ) {
  10567. var checkContext, matcher, j,
  10568. len = tokens.length,
  10569. leadingRelative = Expr.relative[ tokens[0].type ],
  10570. implicitRelative = leadingRelative || Expr.relative[" "],
  10571. i = leadingRelative ? 1 : 0,
  10572. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10573. matchContext = addCombinator( function( elem ) {
  10574. return elem === checkContext;
  10575. }, implicitRelative, true ),
  10576. matchAnyContext = addCombinator( function( elem ) {
  10577. return indexOf( checkContext, elem ) > -1;
  10578. }, implicitRelative, true ),
  10579. matchers = [ function( elem, context, xml ) {
  10580. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10581. (checkContext = context).nodeType ?
  10582. matchContext( elem, context, xml ) :
  10583. matchAnyContext( elem, context, xml ) );
  10584. // Avoid hanging onto element (issue #299)
  10585. checkContext = null;
  10586. return ret;
  10587. } ];
  10588. for ( ; i < len; i++ ) {
  10589. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10590. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10591. } else {
  10592. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10593. // Return special upon seeing a positional matcher
  10594. if ( matcher[ expando ] ) {
  10595. // Find the next relative operator (if any) for proper handling
  10596. j = ++i;
  10597. for ( ; j < len; j++ ) {
  10598. if ( Expr.relative[ tokens[j].type ] ) {
  10599. break;
  10600. }
  10601. }
  10602. return setMatcher(
  10603. i > 1 && elementMatcher( matchers ),
  10604. i > 1 && toSelector(
  10605. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10606. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10607. ).replace( rtrim, "$1" ),
  10608. matcher,
  10609. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10610. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10611. j < len && toSelector( tokens )
  10612. );
  10613. }
  10614. matchers.push( matcher );
  10615. }
  10616. }
  10617. return elementMatcher( matchers );
  10618. }
  10619. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10620. var bySet = setMatchers.length > 0,
  10621. byElement = elementMatchers.length > 0,
  10622. superMatcher = function( seed, context, xml, results, outermost ) {
  10623. var elem, j, matcher,
  10624. matchedCount = 0,
  10625. i = "0",
  10626. unmatched = seed && [],
  10627. setMatched = [],
  10628. contextBackup = outermostContext,
  10629. // We must always have either seed elements or outermost context
  10630. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10631. // Use integer dirruns iff this is the outermost matcher
  10632. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10633. len = elems.length;
  10634. if ( outermost ) {
  10635. outermostContext = context === document || context || outermost;
  10636. }
  10637. // Add elements passing elementMatchers directly to results
  10638. // Support: IE<9, Safari
  10639. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10640. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10641. if ( byElement && elem ) {
  10642. j = 0;
  10643. if ( !context && elem.ownerDocument !== document ) {
  10644. setDocument( elem );
  10645. xml = !documentIsHTML;
  10646. }
  10647. while ( (matcher = elementMatchers[j++]) ) {
  10648. if ( matcher( elem, context || document, xml) ) {
  10649. results.push( elem );
  10650. break;
  10651. }
  10652. }
  10653. if ( outermost ) {
  10654. dirruns = dirrunsUnique;
  10655. }
  10656. }
  10657. // Track unmatched elements for set filters
  10658. if ( bySet ) {
  10659. // They will have gone through all possible matchers
  10660. if ( (elem = !matcher && elem) ) {
  10661. matchedCount--;
  10662. }
  10663. // Lengthen the array for every element, matched or not
  10664. if ( seed ) {
  10665. unmatched.push( elem );
  10666. }
  10667. }
  10668. }
  10669. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10670. // makes the latter nonnegative.
  10671. matchedCount += i;
  10672. // Apply set filters to unmatched elements
  10673. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10674. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10675. // no element matchers and no seed.
  10676. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10677. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10678. // numerically zero.
  10679. if ( bySet && i !== matchedCount ) {
  10680. j = 0;
  10681. while ( (matcher = setMatchers[j++]) ) {
  10682. matcher( unmatched, setMatched, context, xml );
  10683. }
  10684. if ( seed ) {
  10685. // Reintegrate element matches to eliminate the need for sorting
  10686. if ( matchedCount > 0 ) {
  10687. while ( i-- ) {
  10688. if ( !(unmatched[i] || setMatched[i]) ) {
  10689. setMatched[i] = pop.call( results );
  10690. }
  10691. }
  10692. }
  10693. // Discard index placeholder values to get only actual matches
  10694. setMatched = condense( setMatched );
  10695. }
  10696. // Add matches to results
  10697. push.apply( results, setMatched );
  10698. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10699. if ( outermost && !seed && setMatched.length > 0 &&
  10700. ( matchedCount + setMatchers.length ) > 1 ) {
  10701. Sizzle.uniqueSort( results );
  10702. }
  10703. }
  10704. // Override manipulation of globals by nested matchers
  10705. if ( outermost ) {
  10706. dirruns = dirrunsUnique;
  10707. outermostContext = contextBackup;
  10708. }
  10709. return unmatched;
  10710. };
  10711. return bySet ?
  10712. markFunction( superMatcher ) :
  10713. superMatcher;
  10714. }
  10715. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10716. var i,
  10717. setMatchers = [],
  10718. elementMatchers = [],
  10719. cached = compilerCache[ selector + " " ];
  10720. if ( !cached ) {
  10721. // Generate a function of recursive functions that can be used to check each element
  10722. if ( !match ) {
  10723. match = tokenize( selector );
  10724. }
  10725. i = match.length;
  10726. while ( i-- ) {
  10727. cached = matcherFromTokens( match[i] );
  10728. if ( cached[ expando ] ) {
  10729. setMatchers.push( cached );
  10730. } else {
  10731. elementMatchers.push( cached );
  10732. }
  10733. }
  10734. // Cache the compiled function
  10735. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10736. // Save selector and tokenization
  10737. cached.selector = selector;
  10738. }
  10739. return cached;
  10740. };
  10741. /**
  10742. * A low-level selection function that works with Sizzle's compiled
  10743. * selector functions
  10744. * @param {String|Function} selector A selector or a pre-compiled
  10745. * selector function built with Sizzle.compile
  10746. * @param {Element} context
  10747. * @param {Array} [results]
  10748. * @param {Array} [seed] A set of elements to match against
  10749. */
  10750. select = Sizzle.select = function( selector, context, results, seed ) {
  10751. var i, tokens, token, type, find,
  10752. compiled = typeof selector === "function" && selector,
  10753. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10754. results = results || [];
  10755. // Try to minimize operations if there is only one selector in the list and no seed
  10756. // (the latter of which guarantees us context)
  10757. if ( match.length === 1 ) {
  10758. // Reduce context if the leading compound selector is an ID
  10759. tokens = match[0] = match[0].slice( 0 );
  10760. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10761. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10762. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10763. if ( !context ) {
  10764. return results;
  10765. // Precompiled matchers will still verify ancestry, so step up a level
  10766. } else if ( compiled ) {
  10767. context = context.parentNode;
  10768. }
  10769. selector = selector.slice( tokens.shift().value.length );
  10770. }
  10771. // Fetch a seed set for right-to-left matching
  10772. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10773. while ( i-- ) {
  10774. token = tokens[i];
  10775. // Abort if we hit a combinator
  10776. if ( Expr.relative[ (type = token.type) ] ) {
  10777. break;
  10778. }
  10779. if ( (find = Expr.find[ type ]) ) {
  10780. // Search, expanding context for leading sibling combinators
  10781. if ( (seed = find(
  10782. token.matches[0].replace( runescape, funescape ),
  10783. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10784. )) ) {
  10785. // If seed is empty or no tokens remain, we can return early
  10786. tokens.splice( i, 1 );
  10787. selector = seed.length && toSelector( tokens );
  10788. if ( !selector ) {
  10789. push.apply( results, seed );
  10790. return results;
  10791. }
  10792. break;
  10793. }
  10794. }
  10795. }
  10796. }
  10797. // Compile and execute a filtering function if one is not provided
  10798. // Provide `match` to avoid retokenization if we modified the selector above
  10799. ( compiled || compile( selector, match ) )(
  10800. seed,
  10801. context,
  10802. !documentIsHTML,
  10803. results,
  10804. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10805. );
  10806. return results;
  10807. };
  10808. // One-time assignments
  10809. // Sort stability
  10810. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10811. // Support: Chrome 14-35+
  10812. // Always assume duplicates if they aren't passed to the comparison function
  10813. support.detectDuplicates = !!hasDuplicate;
  10814. // Initialize against the default document
  10815. setDocument();
  10816. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10817. // Detached nodes confoundingly follow *each other*
  10818. support.sortDetached = assert(function( el ) {
  10819. // Should return 1, but returns 4 (following)
  10820. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10821. });
  10822. // Support: IE<8
  10823. // Prevent attribute/property "interpolation"
  10824. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10825. if ( !assert(function( el ) {
  10826. el.innerHTML = "<a href='#'></a>";
  10827. return el.firstChild.getAttribute("href") === "#" ;
  10828. }) ) {
  10829. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10830. if ( !isXML ) {
  10831. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10832. }
  10833. });
  10834. }
  10835. // Support: IE<9
  10836. // Use defaultValue in place of getAttribute("value")
  10837. if ( !support.attributes || !assert(function( el ) {
  10838. el.innerHTML = "<input/>";
  10839. el.firstChild.setAttribute( "value", "" );
  10840. return el.firstChild.getAttribute( "value" ) === "";
  10841. }) ) {
  10842. addHandle( "value", function( elem, name, isXML ) {
  10843. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10844. return elem.defaultValue;
  10845. }
  10846. });
  10847. }
  10848. // Support: IE<9
  10849. // Use getAttributeNode to fetch booleans when getAttribute lies
  10850. if ( !assert(function( el ) {
  10851. return el.getAttribute("disabled") == null;
  10852. }) ) {
  10853. addHandle( booleans, function( elem, name, isXML ) {
  10854. var val;
  10855. if ( !isXML ) {
  10856. return elem[ name ] === true ? name.toLowerCase() :
  10857. (val = elem.getAttributeNode( name )) && val.specified ?
  10858. val.value :
  10859. null;
  10860. }
  10861. });
  10862. }
  10863. return Sizzle;
  10864. })( window );
  10865. jQuery.find = Sizzle;
  10866. jQuery.expr = Sizzle.selectors;
  10867. // Deprecated
  10868. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10869. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10870. jQuery.text = Sizzle.getText;
  10871. jQuery.isXMLDoc = Sizzle.isXML;
  10872. jQuery.contains = Sizzle.contains;
  10873. jQuery.escapeSelector = Sizzle.escape;
  10874. var dir = function( elem, dir, until ) {
  10875. var matched = [],
  10876. truncate = until !== undefined;
  10877. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10878. if ( elem.nodeType === 1 ) {
  10879. if ( truncate && jQuery( elem ).is( until ) ) {
  10880. break;
  10881. }
  10882. matched.push( elem );
  10883. }
  10884. }
  10885. return matched;
  10886. };
  10887. var siblings = function( n, elem ) {
  10888. var matched = [];
  10889. for ( ; n; n = n.nextSibling ) {
  10890. if ( n.nodeType === 1 && n !== elem ) {
  10891. matched.push( n );
  10892. }
  10893. }
  10894. return matched;
  10895. };
  10896. var rneedsContext = jQuery.expr.match.needsContext;
  10897. function nodeName( elem, name ) {
  10898. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10899. };
  10900. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10901. // Implement the identical functionality for filter and not
  10902. function winnow( elements, qualifier, not ) {
  10903. if ( isFunction( qualifier ) ) {
  10904. return jQuery.grep( elements, function( elem, i ) {
  10905. return !!qualifier.call( elem, i, elem ) !== not;
  10906. } );
  10907. }
  10908. // Single element
  10909. if ( qualifier.nodeType ) {
  10910. return jQuery.grep( elements, function( elem ) {
  10911. return ( elem === qualifier ) !== not;
  10912. } );
  10913. }
  10914. // Arraylike of elements (jQuery, arguments, Array)
  10915. if ( typeof qualifier !== "string" ) {
  10916. return jQuery.grep( elements, function( elem ) {
  10917. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10918. } );
  10919. }
  10920. // Filtered directly for both simple and complex selectors
  10921. return jQuery.filter( qualifier, elements, not );
  10922. }
  10923. jQuery.filter = function( expr, elems, not ) {
  10924. var elem = elems[ 0 ];
  10925. if ( not ) {
  10926. expr = ":not(" + expr + ")";
  10927. }
  10928. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10929. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10930. }
  10931. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10932. return elem.nodeType === 1;
  10933. } ) );
  10934. };
  10935. jQuery.fn.extend( {
  10936. find: function( selector ) {
  10937. var i, ret,
  10938. len = this.length,
  10939. self = this;
  10940. if ( typeof selector !== "string" ) {
  10941. return this.pushStack( jQuery( selector ).filter( function() {
  10942. for ( i = 0; i < len; i++ ) {
  10943. if ( jQuery.contains( self[ i ], this ) ) {
  10944. return true;
  10945. }
  10946. }
  10947. } ) );
  10948. }
  10949. ret = this.pushStack( [] );
  10950. for ( i = 0; i < len; i++ ) {
  10951. jQuery.find( selector, self[ i ], ret );
  10952. }
  10953. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10954. },
  10955. filter: function( selector ) {
  10956. return this.pushStack( winnow( this, selector || [], false ) );
  10957. },
  10958. not: function( selector ) {
  10959. return this.pushStack( winnow( this, selector || [], true ) );
  10960. },
  10961. is: function( selector ) {
  10962. return !!winnow(
  10963. this,
  10964. // If this is a positional/relative selector, check membership in the returned set
  10965. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10966. typeof selector === "string" && rneedsContext.test( selector ) ?
  10967. jQuery( selector ) :
  10968. selector || [],
  10969. false
  10970. ).length;
  10971. }
  10972. } );
  10973. // Initialize a jQuery object
  10974. // A central reference to the root jQuery(document)
  10975. var rootjQuery,
  10976. // A simple way to check for HTML strings
  10977. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  10978. // Strict HTML recognition (#11290: must start with <)
  10979. // Shortcut simple #id case for speed
  10980. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  10981. init = jQuery.fn.init = function( selector, context, root ) {
  10982. var match, elem;
  10983. // HANDLE: $(""), $(null), $(undefined), $(false)
  10984. if ( !selector ) {
  10985. return this;
  10986. }
  10987. // Method init() accepts an alternate rootjQuery
  10988. // so migrate can support jQuery.sub (gh-2101)
  10989. root = root || rootjQuery;
  10990. // Handle HTML strings
  10991. if ( typeof selector === "string" ) {
  10992. if ( selector[ 0 ] === "<" &&
  10993. selector[ selector.length - 1 ] === ">" &&
  10994. selector.length >= 3 ) {
  10995. // Assume that strings that start and end with <> are HTML and skip the regex check
  10996. match = [ null, selector, null ];
  10997. } else {
  10998. match = rquickExpr.exec( selector );
  10999. }
  11000. // Match html or make sure no context is specified for #id
  11001. if ( match && ( match[ 1 ] || !context ) ) {
  11002. // HANDLE: $(html) -> $(array)
  11003. if ( match[ 1 ] ) {
  11004. context = context instanceof jQuery ? context[ 0 ] : context;
  11005. // Option to run scripts is true for back-compat
  11006. // Intentionally let the error be thrown if parseHTML is not present
  11007. jQuery.merge( this, jQuery.parseHTML(
  11008. match[ 1 ],
  11009. context && context.nodeType ? context.ownerDocument || context : document,
  11010. true
  11011. ) );
  11012. // HANDLE: $(html, props)
  11013. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11014. for ( match in context ) {
  11015. // Properties of context are called as methods if possible
  11016. if ( isFunction( this[ match ] ) ) {
  11017. this[ match ]( context[ match ] );
  11018. // ...and otherwise set as attributes
  11019. } else {
  11020. this.attr( match, context[ match ] );
  11021. }
  11022. }
  11023. }
  11024. return this;
  11025. // HANDLE: $(#id)
  11026. } else {
  11027. elem = document.getElementById( match[ 2 ] );
  11028. if ( elem ) {
  11029. // Inject the element directly into the jQuery object
  11030. this[ 0 ] = elem;
  11031. this.length = 1;
  11032. }
  11033. return this;
  11034. }
  11035. // HANDLE: $(expr, $(...))
  11036. } else if ( !context || context.jquery ) {
  11037. return ( context || root ).find( selector );
  11038. // HANDLE: $(expr, context)
  11039. // (which is just equivalent to: $(context).find(expr)
  11040. } else {
  11041. return this.constructor( context ).find( selector );
  11042. }
  11043. // HANDLE: $(DOMElement)
  11044. } else if ( selector.nodeType ) {
  11045. this[ 0 ] = selector;
  11046. this.length = 1;
  11047. return this;
  11048. // HANDLE: $(function)
  11049. // Shortcut for document ready
  11050. } else if ( isFunction( selector ) ) {
  11051. return root.ready !== undefined ?
  11052. root.ready( selector ) :
  11053. // Execute immediately if ready is not present
  11054. selector( jQuery );
  11055. }
  11056. return jQuery.makeArray( selector, this );
  11057. };
  11058. // Give the init function the jQuery prototype for later instantiation
  11059. init.prototype = jQuery.fn;
  11060. // Initialize central reference
  11061. rootjQuery = jQuery( document );
  11062. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11063. // Methods guaranteed to produce a unique set when starting from a unique set
  11064. guaranteedUnique = {
  11065. children: true,
  11066. contents: true,
  11067. next: true,
  11068. prev: true
  11069. };
  11070. jQuery.fn.extend( {
  11071. has: function( target ) {
  11072. var targets = jQuery( target, this ),
  11073. l = targets.length;
  11074. return this.filter( function() {
  11075. var i = 0;
  11076. for ( ; i < l; i++ ) {
  11077. if ( jQuery.contains( this, targets[ i ] ) ) {
  11078. return true;
  11079. }
  11080. }
  11081. } );
  11082. },
  11083. closest: function( selectors, context ) {
  11084. var cur,
  11085. i = 0,
  11086. l = this.length,
  11087. matched = [],
  11088. targets = typeof selectors !== "string" && jQuery( selectors );
  11089. // Positional selectors never match, since there's no _selection_ context
  11090. if ( !rneedsContext.test( selectors ) ) {
  11091. for ( ; i < l; i++ ) {
  11092. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11093. // Always skip document fragments
  11094. if ( cur.nodeType < 11 && ( targets ?
  11095. targets.index( cur ) > -1 :
  11096. // Don't pass non-elements to Sizzle
  11097. cur.nodeType === 1 &&
  11098. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11099. matched.push( cur );
  11100. break;
  11101. }
  11102. }
  11103. }
  11104. }
  11105. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11106. },
  11107. // Determine the position of an element within the set
  11108. index: function( elem ) {
  11109. // No argument, return index in parent
  11110. if ( !elem ) {
  11111. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11112. }
  11113. // Index in selector
  11114. if ( typeof elem === "string" ) {
  11115. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11116. }
  11117. // Locate the position of the desired element
  11118. return indexOf.call( this,
  11119. // If it receives a jQuery object, the first element is used
  11120. elem.jquery ? elem[ 0 ] : elem
  11121. );
  11122. },
  11123. add: function( selector, context ) {
  11124. return this.pushStack(
  11125. jQuery.uniqueSort(
  11126. jQuery.merge( this.get(), jQuery( selector, context ) )
  11127. )
  11128. );
  11129. },
  11130. addBack: function( selector ) {
  11131. return this.add( selector == null ?
  11132. this.prevObject : this.prevObject.filter( selector )
  11133. );
  11134. }
  11135. } );
  11136. function sibling( cur, dir ) {
  11137. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11138. return cur;
  11139. }
  11140. jQuery.each( {
  11141. parent: function( elem ) {
  11142. var parent = elem.parentNode;
  11143. return parent && parent.nodeType !== 11 ? parent : null;
  11144. },
  11145. parents: function( elem ) {
  11146. return dir( elem, "parentNode" );
  11147. },
  11148. parentsUntil: function( elem, i, until ) {
  11149. return dir( elem, "parentNode", until );
  11150. },
  11151. next: function( elem ) {
  11152. return sibling( elem, "nextSibling" );
  11153. },
  11154. prev: function( elem ) {
  11155. return sibling( elem, "previousSibling" );
  11156. },
  11157. nextAll: function( elem ) {
  11158. return dir( elem, "nextSibling" );
  11159. },
  11160. prevAll: function( elem ) {
  11161. return dir( elem, "previousSibling" );
  11162. },
  11163. nextUntil: function( elem, i, until ) {
  11164. return dir( elem, "nextSibling", until );
  11165. },
  11166. prevUntil: function( elem, i, until ) {
  11167. return dir( elem, "previousSibling", until );
  11168. },
  11169. siblings: function( elem ) {
  11170. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11171. },
  11172. children: function( elem ) {
  11173. return siblings( elem.firstChild );
  11174. },
  11175. contents: function( elem ) {
  11176. if ( typeof elem.contentDocument !== "undefined" ) {
  11177. return elem.contentDocument;
  11178. }
  11179. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11180. // Treat the template element as a regular one in browsers that
  11181. // don't support it.
  11182. if ( nodeName( elem, "template" ) ) {
  11183. elem = elem.content || elem;
  11184. }
  11185. return jQuery.merge( [], elem.childNodes );
  11186. }
  11187. }, function( name, fn ) {
  11188. jQuery.fn[ name ] = function( until, selector ) {
  11189. var matched = jQuery.map( this, fn, until );
  11190. if ( name.slice( -5 ) !== "Until" ) {
  11191. selector = until;
  11192. }
  11193. if ( selector && typeof selector === "string" ) {
  11194. matched = jQuery.filter( selector, matched );
  11195. }
  11196. if ( this.length > 1 ) {
  11197. // Remove duplicates
  11198. if ( !guaranteedUnique[ name ] ) {
  11199. jQuery.uniqueSort( matched );
  11200. }
  11201. // Reverse order for parents* and prev-derivatives
  11202. if ( rparentsprev.test( name ) ) {
  11203. matched.reverse();
  11204. }
  11205. }
  11206. return this.pushStack( matched );
  11207. };
  11208. } );
  11209. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11210. // Convert String-formatted options into Object-formatted ones
  11211. function createOptions( options ) {
  11212. var object = {};
  11213. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11214. object[ flag ] = true;
  11215. } );
  11216. return object;
  11217. }
  11218. /*
  11219. * Create a callback list using the following parameters:
  11220. *
  11221. * options: an optional list of space-separated options that will change how
  11222. * the callback list behaves or a more traditional option object
  11223. *
  11224. * By default a callback list will act like an event callback list and can be
  11225. * "fired" multiple times.
  11226. *
  11227. * Possible options:
  11228. *
  11229. * once: will ensure the callback list can only be fired once (like a Deferred)
  11230. *
  11231. * memory: will keep track of previous values and will call any callback added
  11232. * after the list has been fired right away with the latest "memorized"
  11233. * values (like a Deferred)
  11234. *
  11235. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11236. *
  11237. * stopOnFalse: interrupt callings when a callback returns false
  11238. *
  11239. */
  11240. jQuery.Callbacks = function( options ) {
  11241. // Convert options from String-formatted to Object-formatted if needed
  11242. // (we check in cache first)
  11243. options = typeof options === "string" ?
  11244. createOptions( options ) :
  11245. jQuery.extend( {}, options );
  11246. var // Flag to know if list is currently firing
  11247. firing,
  11248. // Last fire value for non-forgettable lists
  11249. memory,
  11250. // Flag to know if list was already fired
  11251. fired,
  11252. // Flag to prevent firing
  11253. locked,
  11254. // Actual callback list
  11255. list = [],
  11256. // Queue of execution data for repeatable lists
  11257. queue = [],
  11258. // Index of currently firing callback (modified by add/remove as needed)
  11259. firingIndex = -1,
  11260. // Fire callbacks
  11261. fire = function() {
  11262. // Enforce single-firing
  11263. locked = locked || options.once;
  11264. // Execute callbacks for all pending executions,
  11265. // respecting firingIndex overrides and runtime changes
  11266. fired = firing = true;
  11267. for ( ; queue.length; firingIndex = -1 ) {
  11268. memory = queue.shift();
  11269. while ( ++firingIndex < list.length ) {
  11270. // Run callback and check for early termination
  11271. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11272. options.stopOnFalse ) {
  11273. // Jump to end and forget the data so .add doesn't re-fire
  11274. firingIndex = list.length;
  11275. memory = false;
  11276. }
  11277. }
  11278. }
  11279. // Forget the data if we're done with it
  11280. if ( !options.memory ) {
  11281. memory = false;
  11282. }
  11283. firing = false;
  11284. // Clean up if we're done firing for good
  11285. if ( locked ) {
  11286. // Keep an empty list if we have data for future add calls
  11287. if ( memory ) {
  11288. list = [];
  11289. // Otherwise, this object is spent
  11290. } else {
  11291. list = "";
  11292. }
  11293. }
  11294. },
  11295. // Actual Callbacks object
  11296. self = {
  11297. // Add a callback or a collection of callbacks to the list
  11298. add: function() {
  11299. if ( list ) {
  11300. // If we have memory from a past run, we should fire after adding
  11301. if ( memory && !firing ) {
  11302. firingIndex = list.length - 1;
  11303. queue.push( memory );
  11304. }
  11305. ( function add( args ) {
  11306. jQuery.each( args, function( _, arg ) {
  11307. if ( isFunction( arg ) ) {
  11308. if ( !options.unique || !self.has( arg ) ) {
  11309. list.push( arg );
  11310. }
  11311. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11312. // Inspect recursively
  11313. add( arg );
  11314. }
  11315. } );
  11316. } )( arguments );
  11317. if ( memory && !firing ) {
  11318. fire();
  11319. }
  11320. }
  11321. return this;
  11322. },
  11323. // Remove a callback from the list
  11324. remove: function() {
  11325. jQuery.each( arguments, function( _, arg ) {
  11326. var index;
  11327. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11328. list.splice( index, 1 );
  11329. // Handle firing indexes
  11330. if ( index <= firingIndex ) {
  11331. firingIndex--;
  11332. }
  11333. }
  11334. } );
  11335. return this;
  11336. },
  11337. // Check if a given callback is in the list.
  11338. // If no argument is given, return whether or not list has callbacks attached.
  11339. has: function( fn ) {
  11340. return fn ?
  11341. jQuery.inArray( fn, list ) > -1 :
  11342. list.length > 0;
  11343. },
  11344. // Remove all callbacks from the list
  11345. empty: function() {
  11346. if ( list ) {
  11347. list = [];
  11348. }
  11349. return this;
  11350. },
  11351. // Disable .fire and .add
  11352. // Abort any current/pending executions
  11353. // Clear all callbacks and values
  11354. disable: function() {
  11355. locked = queue = [];
  11356. list = memory = "";
  11357. return this;
  11358. },
  11359. disabled: function() {
  11360. return !list;
  11361. },
  11362. // Disable .fire
  11363. // Also disable .add unless we have memory (since it would have no effect)
  11364. // Abort any pending executions
  11365. lock: function() {
  11366. locked = queue = [];
  11367. if ( !memory && !firing ) {
  11368. list = memory = "";
  11369. }
  11370. return this;
  11371. },
  11372. locked: function() {
  11373. return !!locked;
  11374. },
  11375. // Call all callbacks with the given context and arguments
  11376. fireWith: function( context, args ) {
  11377. if ( !locked ) {
  11378. args = args || [];
  11379. args = [ context, args.slice ? args.slice() : args ];
  11380. queue.push( args );
  11381. if ( !firing ) {
  11382. fire();
  11383. }
  11384. }
  11385. return this;
  11386. },
  11387. // Call all the callbacks with the given arguments
  11388. fire: function() {
  11389. self.fireWith( this, arguments );
  11390. return this;
  11391. },
  11392. // To know if the callbacks have already been called at least once
  11393. fired: function() {
  11394. return !!fired;
  11395. }
  11396. };
  11397. return self;
  11398. };
  11399. function Identity( v ) {
  11400. return v;
  11401. }
  11402. function Thrower( ex ) {
  11403. throw ex;
  11404. }
  11405. function adoptValue( value, resolve, reject, noValue ) {
  11406. var method;
  11407. try {
  11408. // Check for promise aspect first to privilege synchronous behavior
  11409. if ( value && isFunction( ( method = value.promise ) ) ) {
  11410. method.call( value ).done( resolve ).fail( reject );
  11411. // Other thenables
  11412. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11413. method.call( value, resolve, reject );
  11414. // Other non-thenables
  11415. } else {
  11416. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11417. // * false: [ value ].slice( 0 ) => resolve( value )
  11418. // * true: [ value ].slice( 1 ) => resolve()
  11419. resolve.apply( undefined, [ value ].slice( noValue ) );
  11420. }
  11421. // For Promises/A+, convert exceptions into rejections
  11422. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11423. // Deferred#then to conditionally suppress rejection.
  11424. } catch ( value ) {
  11425. // Support: Android 4.0 only
  11426. // Strict mode functions invoked without .call/.apply get global-object context
  11427. reject.apply( undefined, [ value ] );
  11428. }
  11429. }
  11430. jQuery.extend( {
  11431. Deferred: function( func ) {
  11432. var tuples = [
  11433. // action, add listener, callbacks,
  11434. // ... .then handlers, argument index, [final state]
  11435. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11436. jQuery.Callbacks( "memory" ), 2 ],
  11437. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11438. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11439. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11440. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11441. ],
  11442. state = "pending",
  11443. promise = {
  11444. state: function() {
  11445. return state;
  11446. },
  11447. always: function() {
  11448. deferred.done( arguments ).fail( arguments );
  11449. return this;
  11450. },
  11451. "catch": function( fn ) {
  11452. return promise.then( null, fn );
  11453. },
  11454. // Keep pipe for back-compat
  11455. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11456. var fns = arguments;
  11457. return jQuery.Deferred( function( newDefer ) {
  11458. jQuery.each( tuples, function( i, tuple ) {
  11459. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11460. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11461. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11462. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11463. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11464. deferred[ tuple[ 1 ] ]( function() {
  11465. var returned = fn && fn.apply( this, arguments );
  11466. if ( returned && isFunction( returned.promise ) ) {
  11467. returned.promise()
  11468. .progress( newDefer.notify )
  11469. .done( newDefer.resolve )
  11470. .fail( newDefer.reject );
  11471. } else {
  11472. newDefer[ tuple[ 0 ] + "With" ](
  11473. this,
  11474. fn ? [ returned ] : arguments
  11475. );
  11476. }
  11477. } );
  11478. } );
  11479. fns = null;
  11480. } ).promise();
  11481. },
  11482. then: function( onFulfilled, onRejected, onProgress ) {
  11483. var maxDepth = 0;
  11484. function resolve( depth, deferred, handler, special ) {
  11485. return function() {
  11486. var that = this,
  11487. args = arguments,
  11488. mightThrow = function() {
  11489. var returned, then;
  11490. // Support: Promises/A+ section 2.3.3.3.3
  11491. // https://promisesaplus.com/#point-59
  11492. // Ignore double-resolution attempts
  11493. if ( depth < maxDepth ) {
  11494. return;
  11495. }
  11496. returned = handler.apply( that, args );
  11497. // Support: Promises/A+ section 2.3.1
  11498. // https://promisesaplus.com/#point-48
  11499. if ( returned === deferred.promise() ) {
  11500. throw new TypeError( "Thenable self-resolution" );
  11501. }
  11502. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11503. // https://promisesaplus.com/#point-54
  11504. // https://promisesaplus.com/#point-75
  11505. // Retrieve `then` only once
  11506. then = returned &&
  11507. // Support: Promises/A+ section 2.3.4
  11508. // https://promisesaplus.com/#point-64
  11509. // Only check objects and functions for thenability
  11510. ( typeof returned === "object" ||
  11511. typeof returned === "function" ) &&
  11512. returned.then;
  11513. // Handle a returned thenable
  11514. if ( isFunction( then ) ) {
  11515. // Special processors (notify) just wait for resolution
  11516. if ( special ) {
  11517. then.call(
  11518. returned,
  11519. resolve( maxDepth, deferred, Identity, special ),
  11520. resolve( maxDepth, deferred, Thrower, special )
  11521. );
  11522. // Normal processors (resolve) also hook into progress
  11523. } else {
  11524. // ...and disregard older resolution values
  11525. maxDepth++;
  11526. then.call(
  11527. returned,
  11528. resolve( maxDepth, deferred, Identity, special ),
  11529. resolve( maxDepth, deferred, Thrower, special ),
  11530. resolve( maxDepth, deferred, Identity,
  11531. deferred.notifyWith )
  11532. );
  11533. }
  11534. // Handle all other returned values
  11535. } else {
  11536. // Only substitute handlers pass on context
  11537. // and multiple values (non-spec behavior)
  11538. if ( handler !== Identity ) {
  11539. that = undefined;
  11540. args = [ returned ];
  11541. }
  11542. // Process the value(s)
  11543. // Default process is resolve
  11544. ( special || deferred.resolveWith )( that, args );
  11545. }
  11546. },
  11547. // Only normal processors (resolve) catch and reject exceptions
  11548. process = special ?
  11549. mightThrow :
  11550. function() {
  11551. try {
  11552. mightThrow();
  11553. } catch ( e ) {
  11554. if ( jQuery.Deferred.exceptionHook ) {
  11555. jQuery.Deferred.exceptionHook( e,
  11556. process.stackTrace );
  11557. }
  11558. // Support: Promises/A+ section 2.3.3.3.4.1
  11559. // https://promisesaplus.com/#point-61
  11560. // Ignore post-resolution exceptions
  11561. if ( depth + 1 >= maxDepth ) {
  11562. // Only substitute handlers pass on context
  11563. // and multiple values (non-spec behavior)
  11564. if ( handler !== Thrower ) {
  11565. that = undefined;
  11566. args = [ e ];
  11567. }
  11568. deferred.rejectWith( that, args );
  11569. }
  11570. }
  11571. };
  11572. // Support: Promises/A+ section 2.3.3.3.1
  11573. // https://promisesaplus.com/#point-57
  11574. // Re-resolve promises immediately to dodge false rejection from
  11575. // subsequent errors
  11576. if ( depth ) {
  11577. process();
  11578. } else {
  11579. // Call an optional hook to record the stack, in case of exception
  11580. // since it's otherwise lost when execution goes async
  11581. if ( jQuery.Deferred.getStackHook ) {
  11582. process.stackTrace = jQuery.Deferred.getStackHook();
  11583. }
  11584. window.setTimeout( process );
  11585. }
  11586. };
  11587. }
  11588. return jQuery.Deferred( function( newDefer ) {
  11589. // progress_handlers.add( ... )
  11590. tuples[ 0 ][ 3 ].add(
  11591. resolve(
  11592. 0,
  11593. newDefer,
  11594. isFunction( onProgress ) ?
  11595. onProgress :
  11596. Identity,
  11597. newDefer.notifyWith
  11598. )
  11599. );
  11600. // fulfilled_handlers.add( ... )
  11601. tuples[ 1 ][ 3 ].add(
  11602. resolve(
  11603. 0,
  11604. newDefer,
  11605. isFunction( onFulfilled ) ?
  11606. onFulfilled :
  11607. Identity
  11608. )
  11609. );
  11610. // rejected_handlers.add( ... )
  11611. tuples[ 2 ][ 3 ].add(
  11612. resolve(
  11613. 0,
  11614. newDefer,
  11615. isFunction( onRejected ) ?
  11616. onRejected :
  11617. Thrower
  11618. )
  11619. );
  11620. } ).promise();
  11621. },
  11622. // Get a promise for this deferred
  11623. // If obj is provided, the promise aspect is added to the object
  11624. promise: function( obj ) {
  11625. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11626. }
  11627. },
  11628. deferred = {};
  11629. // Add list-specific methods
  11630. jQuery.each( tuples, function( i, tuple ) {
  11631. var list = tuple[ 2 ],
  11632. stateString = tuple[ 5 ];
  11633. // promise.progress = list.add
  11634. // promise.done = list.add
  11635. // promise.fail = list.add
  11636. promise[ tuple[ 1 ] ] = list.add;
  11637. // Handle state
  11638. if ( stateString ) {
  11639. list.add(
  11640. function() {
  11641. // state = "resolved" (i.e., fulfilled)
  11642. // state = "rejected"
  11643. state = stateString;
  11644. },
  11645. // rejected_callbacks.disable
  11646. // fulfilled_callbacks.disable
  11647. tuples[ 3 - i ][ 2 ].disable,
  11648. // rejected_handlers.disable
  11649. // fulfilled_handlers.disable
  11650. tuples[ 3 - i ][ 3 ].disable,
  11651. // progress_callbacks.lock
  11652. tuples[ 0 ][ 2 ].lock,
  11653. // progress_handlers.lock
  11654. tuples[ 0 ][ 3 ].lock
  11655. );
  11656. }
  11657. // progress_handlers.fire
  11658. // fulfilled_handlers.fire
  11659. // rejected_handlers.fire
  11660. list.add( tuple[ 3 ].fire );
  11661. // deferred.notify = function() { deferred.notifyWith(...) }
  11662. // deferred.resolve = function() { deferred.resolveWith(...) }
  11663. // deferred.reject = function() { deferred.rejectWith(...) }
  11664. deferred[ tuple[ 0 ] ] = function() {
  11665. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11666. return this;
  11667. };
  11668. // deferred.notifyWith = list.fireWith
  11669. // deferred.resolveWith = list.fireWith
  11670. // deferred.rejectWith = list.fireWith
  11671. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11672. } );
  11673. // Make the deferred a promise
  11674. promise.promise( deferred );
  11675. // Call given func if any
  11676. if ( func ) {
  11677. func.call( deferred, deferred );
  11678. }
  11679. // All done!
  11680. return deferred;
  11681. },
  11682. // Deferred helper
  11683. when: function( singleValue ) {
  11684. var
  11685. // count of uncompleted subordinates
  11686. remaining = arguments.length,
  11687. // count of unprocessed arguments
  11688. i = remaining,
  11689. // subordinate fulfillment data
  11690. resolveContexts = Array( i ),
  11691. resolveValues = slice.call( arguments ),
  11692. // the master Deferred
  11693. master = jQuery.Deferred(),
  11694. // subordinate callback factory
  11695. updateFunc = function( i ) {
  11696. return function( value ) {
  11697. resolveContexts[ i ] = this;
  11698. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11699. if ( !( --remaining ) ) {
  11700. master.resolveWith( resolveContexts, resolveValues );
  11701. }
  11702. };
  11703. };
  11704. // Single- and empty arguments are adopted like Promise.resolve
  11705. if ( remaining <= 1 ) {
  11706. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11707. !remaining );
  11708. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11709. if ( master.state() === "pending" ||
  11710. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11711. return master.then();
  11712. }
  11713. }
  11714. // Multiple arguments are aggregated like Promise.all array elements
  11715. while ( i-- ) {
  11716. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11717. }
  11718. return master.promise();
  11719. }
  11720. } );
  11721. // These usually indicate a programmer mistake during development,
  11722. // warn about them ASAP rather than swallowing them by default.
  11723. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11724. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11725. // Support: IE 8 - 9 only
  11726. // Console exists when dev tools are open, which can happen at any time
  11727. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11728. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11729. }
  11730. };
  11731. jQuery.readyException = function( error ) {
  11732. window.setTimeout( function() {
  11733. throw error;
  11734. } );
  11735. };
  11736. // The deferred used on DOM ready
  11737. var readyList = jQuery.Deferred();
  11738. jQuery.fn.ready = function( fn ) {
  11739. readyList
  11740. .then( fn )
  11741. // Wrap jQuery.readyException in a function so that the lookup
  11742. // happens at the time of error handling instead of callback
  11743. // registration.
  11744. .catch( function( error ) {
  11745. jQuery.readyException( error );
  11746. } );
  11747. return this;
  11748. };
  11749. jQuery.extend( {
  11750. // Is the DOM ready to be used? Set to true once it occurs.
  11751. isReady: false,
  11752. // A counter to track how many items to wait for before
  11753. // the ready event fires. See #6781
  11754. readyWait: 1,
  11755. // Handle when the DOM is ready
  11756. ready: function( wait ) {
  11757. // Abort if there are pending holds or we're already ready
  11758. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11759. return;
  11760. }
  11761. // Remember that the DOM is ready
  11762. jQuery.isReady = true;
  11763. // If a normal DOM Ready event fired, decrement, and wait if need be
  11764. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11765. return;
  11766. }
  11767. // If there are functions bound, to execute
  11768. readyList.resolveWith( document, [ jQuery ] );
  11769. }
  11770. } );
  11771. jQuery.ready.then = readyList.then;
  11772. // The ready event handler and self cleanup method
  11773. function completed() {
  11774. document.removeEventListener( "DOMContentLoaded", completed );
  11775. window.removeEventListener( "load", completed );
  11776. jQuery.ready();
  11777. }
  11778. // Catch cases where $(document).ready() is called
  11779. // after the browser event has already occurred.
  11780. // Support: IE <=9 - 10 only
  11781. // Older IE sometimes signals "interactive" too soon
  11782. if ( document.readyState === "complete" ||
  11783. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11784. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11785. window.setTimeout( jQuery.ready );
  11786. } else {
  11787. // Use the handy event callback
  11788. document.addEventListener( "DOMContentLoaded", completed );
  11789. // A fallback to window.onload, that will always work
  11790. window.addEventListener( "load", completed );
  11791. }
  11792. // Multifunctional method to get and set values of a collection
  11793. // The value/s can optionally be executed if it's a function
  11794. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11795. var i = 0,
  11796. len = elems.length,
  11797. bulk = key == null;
  11798. // Sets many values
  11799. if ( toType( key ) === "object" ) {
  11800. chainable = true;
  11801. for ( i in key ) {
  11802. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11803. }
  11804. // Sets one value
  11805. } else if ( value !== undefined ) {
  11806. chainable = true;
  11807. if ( !isFunction( value ) ) {
  11808. raw = true;
  11809. }
  11810. if ( bulk ) {
  11811. // Bulk operations run against the entire set
  11812. if ( raw ) {
  11813. fn.call( elems, value );
  11814. fn = null;
  11815. // ...except when executing function values
  11816. } else {
  11817. bulk = fn;
  11818. fn = function( elem, key, value ) {
  11819. return bulk.call( jQuery( elem ), value );
  11820. };
  11821. }
  11822. }
  11823. if ( fn ) {
  11824. for ( ; i < len; i++ ) {
  11825. fn(
  11826. elems[ i ], key, raw ?
  11827. value :
  11828. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11829. );
  11830. }
  11831. }
  11832. }
  11833. if ( chainable ) {
  11834. return elems;
  11835. }
  11836. // Gets
  11837. if ( bulk ) {
  11838. return fn.call( elems );
  11839. }
  11840. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11841. };
  11842. // Matches dashed string for camelizing
  11843. var rmsPrefix = /^-ms-/,
  11844. rdashAlpha = /-([a-z])/g;
  11845. // Used by camelCase as callback to replace()
  11846. function fcamelCase( all, letter ) {
  11847. return letter.toUpperCase();
  11848. }
  11849. // Convert dashed to camelCase; used by the css and data modules
  11850. // Support: IE <=9 - 11, Edge 12 - 15
  11851. // Microsoft forgot to hump their vendor prefix (#9572)
  11852. function camelCase( string ) {
  11853. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11854. }
  11855. var acceptData = function( owner ) {
  11856. // Accepts only:
  11857. // - Node
  11858. // - Node.ELEMENT_NODE
  11859. // - Node.DOCUMENT_NODE
  11860. // - Object
  11861. // - Any
  11862. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11863. };
  11864. function Data() {
  11865. this.expando = jQuery.expando + Data.uid++;
  11866. }
  11867. Data.uid = 1;
  11868. Data.prototype = {
  11869. cache: function( owner ) {
  11870. // Check if the owner object already has a cache
  11871. var value = owner[ this.expando ];
  11872. // If not, create one
  11873. if ( !value ) {
  11874. value = {};
  11875. // We can accept data for non-element nodes in modern browsers,
  11876. // but we should not, see #8335.
  11877. // Always return an empty object.
  11878. if ( acceptData( owner ) ) {
  11879. // If it is a node unlikely to be stringify-ed or looped over
  11880. // use plain assignment
  11881. if ( owner.nodeType ) {
  11882. owner[ this.expando ] = value;
  11883. // Otherwise secure it in a non-enumerable property
  11884. // configurable must be true to allow the property to be
  11885. // deleted when data is removed
  11886. } else {
  11887. Object.defineProperty( owner, this.expando, {
  11888. value: value,
  11889. configurable: true
  11890. } );
  11891. }
  11892. }
  11893. }
  11894. return value;
  11895. },
  11896. set: function( owner, data, value ) {
  11897. var prop,
  11898. cache = this.cache( owner );
  11899. // Handle: [ owner, key, value ] args
  11900. // Always use camelCase key (gh-2257)
  11901. if ( typeof data === "string" ) {
  11902. cache[ camelCase( data ) ] = value;
  11903. // Handle: [ owner, { properties } ] args
  11904. } else {
  11905. // Copy the properties one-by-one to the cache object
  11906. for ( prop in data ) {
  11907. cache[ camelCase( prop ) ] = data[ prop ];
  11908. }
  11909. }
  11910. return cache;
  11911. },
  11912. get: function( owner, key ) {
  11913. return key === undefined ?
  11914. this.cache( owner ) :
  11915. // Always use camelCase key (gh-2257)
  11916. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11917. },
  11918. access: function( owner, key, value ) {
  11919. // In cases where either:
  11920. //
  11921. // 1. No key was specified
  11922. // 2. A string key was specified, but no value provided
  11923. //
  11924. // Take the "read" path and allow the get method to determine
  11925. // which value to return, respectively either:
  11926. //
  11927. // 1. The entire cache object
  11928. // 2. The data stored at the key
  11929. //
  11930. if ( key === undefined ||
  11931. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11932. return this.get( owner, key );
  11933. }
  11934. // When the key is not a string, or both a key and value
  11935. // are specified, set or extend (existing objects) with either:
  11936. //
  11937. // 1. An object of properties
  11938. // 2. A key and value
  11939. //
  11940. this.set( owner, key, value );
  11941. // Since the "set" path can have two possible entry points
  11942. // return the expected data based on which path was taken[*]
  11943. return value !== undefined ? value : key;
  11944. },
  11945. remove: function( owner, key ) {
  11946. var i,
  11947. cache = owner[ this.expando ];
  11948. if ( cache === undefined ) {
  11949. return;
  11950. }
  11951. if ( key !== undefined ) {
  11952. // Support array or space separated string of keys
  11953. if ( Array.isArray( key ) ) {
  11954. // If key is an array of keys...
  11955. // We always set camelCase keys, so remove that.
  11956. key = key.map( camelCase );
  11957. } else {
  11958. key = camelCase( key );
  11959. // If a key with the spaces exists, use it.
  11960. // Otherwise, create an array by matching non-whitespace
  11961. key = key in cache ?
  11962. [ key ] :
  11963. ( key.match( rnothtmlwhite ) || [] );
  11964. }
  11965. i = key.length;
  11966. while ( i-- ) {
  11967. delete cache[ key[ i ] ];
  11968. }
  11969. }
  11970. // Remove the expando if there's no more data
  11971. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  11972. // Support: Chrome <=35 - 45
  11973. // Webkit & Blink performance suffers when deleting properties
  11974. // from DOM nodes, so set to undefined instead
  11975. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  11976. if ( owner.nodeType ) {
  11977. owner[ this.expando ] = undefined;
  11978. } else {
  11979. delete owner[ this.expando ];
  11980. }
  11981. }
  11982. },
  11983. hasData: function( owner ) {
  11984. var cache = owner[ this.expando ];
  11985. return cache !== undefined && !jQuery.isEmptyObject( cache );
  11986. }
  11987. };
  11988. var dataPriv = new Data();
  11989. var dataUser = new Data();
  11990. // Implementation Summary
  11991. //
  11992. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  11993. // 2. Improve the module's maintainability by reducing the storage
  11994. // paths to a single mechanism.
  11995. // 3. Use the same single mechanism to support "private" and "user" data.
  11996. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  11997. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  11998. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  11999. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12000. rmultiDash = /[A-Z]/g;
  12001. function getData( data ) {
  12002. if ( data === "true" ) {
  12003. return true;
  12004. }
  12005. if ( data === "false" ) {
  12006. return false;
  12007. }
  12008. if ( data === "null" ) {
  12009. return null;
  12010. }
  12011. // Only convert to a number if it doesn't change the string
  12012. if ( data === +data + "" ) {
  12013. return +data;
  12014. }
  12015. if ( rbrace.test( data ) ) {
  12016. return JSON.parse( data );
  12017. }
  12018. return data;
  12019. }
  12020. function dataAttr( elem, key, data ) {
  12021. var name;
  12022. // If nothing was found internally, try to fetch any
  12023. // data from the HTML5 data-* attribute
  12024. if ( data === undefined && elem.nodeType === 1 ) {
  12025. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12026. data = elem.getAttribute( name );
  12027. if ( typeof data === "string" ) {
  12028. try {
  12029. data = getData( data );
  12030. } catch ( e ) {}
  12031. // Make sure we set the data so it isn't changed later
  12032. dataUser.set( elem, key, data );
  12033. } else {
  12034. data = undefined;
  12035. }
  12036. }
  12037. return data;
  12038. }
  12039. jQuery.extend( {
  12040. hasData: function( elem ) {
  12041. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12042. },
  12043. data: function( elem, name, data ) {
  12044. return dataUser.access( elem, name, data );
  12045. },
  12046. removeData: function( elem, name ) {
  12047. dataUser.remove( elem, name );
  12048. },
  12049. // TODO: Now that all calls to _data and _removeData have been replaced
  12050. // with direct calls to dataPriv methods, these can be deprecated.
  12051. _data: function( elem, name, data ) {
  12052. return dataPriv.access( elem, name, data );
  12053. },
  12054. _removeData: function( elem, name ) {
  12055. dataPriv.remove( elem, name );
  12056. }
  12057. } );
  12058. jQuery.fn.extend( {
  12059. data: function( key, value ) {
  12060. var i, name, data,
  12061. elem = this[ 0 ],
  12062. attrs = elem && elem.attributes;
  12063. // Gets all values
  12064. if ( key === undefined ) {
  12065. if ( this.length ) {
  12066. data = dataUser.get( elem );
  12067. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12068. i = attrs.length;
  12069. while ( i-- ) {
  12070. // Support: IE 11 only
  12071. // The attrs elements can be null (#14894)
  12072. if ( attrs[ i ] ) {
  12073. name = attrs[ i ].name;
  12074. if ( name.indexOf( "data-" ) === 0 ) {
  12075. name = camelCase( name.slice( 5 ) );
  12076. dataAttr( elem, name, data[ name ] );
  12077. }
  12078. }
  12079. }
  12080. dataPriv.set( elem, "hasDataAttrs", true );
  12081. }
  12082. }
  12083. return data;
  12084. }
  12085. // Sets multiple values
  12086. if ( typeof key === "object" ) {
  12087. return this.each( function() {
  12088. dataUser.set( this, key );
  12089. } );
  12090. }
  12091. return access( this, function( value ) {
  12092. var data;
  12093. // The calling jQuery object (element matches) is not empty
  12094. // (and therefore has an element appears at this[ 0 ]) and the
  12095. // `value` parameter was not undefined. An empty jQuery object
  12096. // will result in `undefined` for elem = this[ 0 ] which will
  12097. // throw an exception if an attempt to read a data cache is made.
  12098. if ( elem && value === undefined ) {
  12099. // Attempt to get data from the cache
  12100. // The key will always be camelCased in Data
  12101. data = dataUser.get( elem, key );
  12102. if ( data !== undefined ) {
  12103. return data;
  12104. }
  12105. // Attempt to "discover" the data in
  12106. // HTML5 custom data-* attrs
  12107. data = dataAttr( elem, key );
  12108. if ( data !== undefined ) {
  12109. return data;
  12110. }
  12111. // We tried really hard, but the data doesn't exist.
  12112. return;
  12113. }
  12114. // Set the data...
  12115. this.each( function() {
  12116. // We always store the camelCased key
  12117. dataUser.set( this, key, value );
  12118. } );
  12119. }, null, value, arguments.length > 1, null, true );
  12120. },
  12121. removeData: function( key ) {
  12122. return this.each( function() {
  12123. dataUser.remove( this, key );
  12124. } );
  12125. }
  12126. } );
  12127. jQuery.extend( {
  12128. queue: function( elem, type, data ) {
  12129. var queue;
  12130. if ( elem ) {
  12131. type = ( type || "fx" ) + "queue";
  12132. queue = dataPriv.get( elem, type );
  12133. // Speed up dequeue by getting out quickly if this is just a lookup
  12134. if ( data ) {
  12135. if ( !queue || Array.isArray( data ) ) {
  12136. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12137. } else {
  12138. queue.push( data );
  12139. }
  12140. }
  12141. return queue || [];
  12142. }
  12143. },
  12144. dequeue: function( elem, type ) {
  12145. type = type || "fx";
  12146. var queue = jQuery.queue( elem, type ),
  12147. startLength = queue.length,
  12148. fn = queue.shift(),
  12149. hooks = jQuery._queueHooks( elem, type ),
  12150. next = function() {
  12151. jQuery.dequeue( elem, type );
  12152. };
  12153. // If the fx queue is dequeued, always remove the progress sentinel
  12154. if ( fn === "inprogress" ) {
  12155. fn = queue.shift();
  12156. startLength--;
  12157. }
  12158. if ( fn ) {
  12159. // Add a progress sentinel to prevent the fx queue from being
  12160. // automatically dequeued
  12161. if ( type === "fx" ) {
  12162. queue.unshift( "inprogress" );
  12163. }
  12164. // Clear up the last queue stop function
  12165. delete hooks.stop;
  12166. fn.call( elem, next, hooks );
  12167. }
  12168. if ( !startLength && hooks ) {
  12169. hooks.empty.fire();
  12170. }
  12171. },
  12172. // Not public - generate a queueHooks object, or return the current one
  12173. _queueHooks: function( elem, type ) {
  12174. var key = type + "queueHooks";
  12175. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12176. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12177. dataPriv.remove( elem, [ type + "queue", key ] );
  12178. } )
  12179. } );
  12180. }
  12181. } );
  12182. jQuery.fn.extend( {
  12183. queue: function( type, data ) {
  12184. var setter = 2;
  12185. if ( typeof type !== "string" ) {
  12186. data = type;
  12187. type = "fx";
  12188. setter--;
  12189. }
  12190. if ( arguments.length < setter ) {
  12191. return jQuery.queue( this[ 0 ], type );
  12192. }
  12193. return data === undefined ?
  12194. this :
  12195. this.each( function() {
  12196. var queue = jQuery.queue( this, type, data );
  12197. // Ensure a hooks for this queue
  12198. jQuery._queueHooks( this, type );
  12199. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12200. jQuery.dequeue( this, type );
  12201. }
  12202. } );
  12203. },
  12204. dequeue: function( type ) {
  12205. return this.each( function() {
  12206. jQuery.dequeue( this, type );
  12207. } );
  12208. },
  12209. clearQueue: function( type ) {
  12210. return this.queue( type || "fx", [] );
  12211. },
  12212. // Get a promise resolved when queues of a certain type
  12213. // are emptied (fx is the type by default)
  12214. promise: function( type, obj ) {
  12215. var tmp,
  12216. count = 1,
  12217. defer = jQuery.Deferred(),
  12218. elements = this,
  12219. i = this.length,
  12220. resolve = function() {
  12221. if ( !( --count ) ) {
  12222. defer.resolveWith( elements, [ elements ] );
  12223. }
  12224. };
  12225. if ( typeof type !== "string" ) {
  12226. obj = type;
  12227. type = undefined;
  12228. }
  12229. type = type || "fx";
  12230. while ( i-- ) {
  12231. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12232. if ( tmp && tmp.empty ) {
  12233. count++;
  12234. tmp.empty.add( resolve );
  12235. }
  12236. }
  12237. resolve();
  12238. return defer.promise( obj );
  12239. }
  12240. } );
  12241. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12242. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12243. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12244. var documentElement = document.documentElement;
  12245. var isAttached = function( elem ) {
  12246. return jQuery.contains( elem.ownerDocument, elem );
  12247. },
  12248. composed = { composed: true };
  12249. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12250. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12251. // Support: iOS 10.0-10.2 only
  12252. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12253. // leading to errors. We need to check for `getRootNode`.
  12254. if ( documentElement.getRootNode ) {
  12255. isAttached = function( elem ) {
  12256. return jQuery.contains( elem.ownerDocument, elem ) ||
  12257. elem.getRootNode( composed ) === elem.ownerDocument;
  12258. };
  12259. }
  12260. var isHiddenWithinTree = function( elem, el ) {
  12261. // isHiddenWithinTree might be called from jQuery#filter function;
  12262. // in that case, element will be second argument
  12263. elem = el || elem;
  12264. // Inline style trumps all
  12265. return elem.style.display === "none" ||
  12266. elem.style.display === "" &&
  12267. // Otherwise, check computed style
  12268. // Support: Firefox <=43 - 45
  12269. // Disconnected elements can have computed display: none, so first confirm that elem is
  12270. // in the document.
  12271. isAttached( elem ) &&
  12272. jQuery.css( elem, "display" ) === "none";
  12273. };
  12274. var swap = function( elem, options, callback, args ) {
  12275. var ret, name,
  12276. old = {};
  12277. // Remember the old values, and insert the new ones
  12278. for ( name in options ) {
  12279. old[ name ] = elem.style[ name ];
  12280. elem.style[ name ] = options[ name ];
  12281. }
  12282. ret = callback.apply( elem, args || [] );
  12283. // Revert the old values
  12284. for ( name in options ) {
  12285. elem.style[ name ] = old[ name ];
  12286. }
  12287. return ret;
  12288. };
  12289. function adjustCSS( elem, prop, valueParts, tween ) {
  12290. var adjusted, scale,
  12291. maxIterations = 20,
  12292. currentValue = tween ?
  12293. function() {
  12294. return tween.cur();
  12295. } :
  12296. function() {
  12297. return jQuery.css( elem, prop, "" );
  12298. },
  12299. initial = currentValue(),
  12300. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12301. // Starting value computation is required for potential unit mismatches
  12302. initialInUnit = elem.nodeType &&
  12303. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12304. rcssNum.exec( jQuery.css( elem, prop ) );
  12305. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12306. // Support: Firefox <=54
  12307. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12308. initial = initial / 2;
  12309. // Trust units reported by jQuery.css
  12310. unit = unit || initialInUnit[ 3 ];
  12311. // Iteratively approximate from a nonzero starting point
  12312. initialInUnit = +initial || 1;
  12313. while ( maxIterations-- ) {
  12314. // Evaluate and update our best guess (doubling guesses that zero out).
  12315. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12316. jQuery.style( elem, prop, initialInUnit + unit );
  12317. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12318. maxIterations = 0;
  12319. }
  12320. initialInUnit = initialInUnit / scale;
  12321. }
  12322. initialInUnit = initialInUnit * 2;
  12323. jQuery.style( elem, prop, initialInUnit + unit );
  12324. // Make sure we update the tween properties later on
  12325. valueParts = valueParts || [];
  12326. }
  12327. if ( valueParts ) {
  12328. initialInUnit = +initialInUnit || +initial || 0;
  12329. // Apply relative offset (+=/-=) if specified
  12330. adjusted = valueParts[ 1 ] ?
  12331. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12332. +valueParts[ 2 ];
  12333. if ( tween ) {
  12334. tween.unit = unit;
  12335. tween.start = initialInUnit;
  12336. tween.end = adjusted;
  12337. }
  12338. }
  12339. return adjusted;
  12340. }
  12341. var defaultDisplayMap = {};
  12342. function getDefaultDisplay( elem ) {
  12343. var temp,
  12344. doc = elem.ownerDocument,
  12345. nodeName = elem.nodeName,
  12346. display = defaultDisplayMap[ nodeName ];
  12347. if ( display ) {
  12348. return display;
  12349. }
  12350. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12351. display = jQuery.css( temp, "display" );
  12352. temp.parentNode.removeChild( temp );
  12353. if ( display === "none" ) {
  12354. display = "block";
  12355. }
  12356. defaultDisplayMap[ nodeName ] = display;
  12357. return display;
  12358. }
  12359. function showHide( elements, show ) {
  12360. var display, elem,
  12361. values = [],
  12362. index = 0,
  12363. length = elements.length;
  12364. // Determine new display value for elements that need to change
  12365. for ( ; index < length; index++ ) {
  12366. elem = elements[ index ];
  12367. if ( !elem.style ) {
  12368. continue;
  12369. }
  12370. display = elem.style.display;
  12371. if ( show ) {
  12372. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12373. // check is required in this first loop unless we have a nonempty display value (either
  12374. // inline or about-to-be-restored)
  12375. if ( display === "none" ) {
  12376. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12377. if ( !values[ index ] ) {
  12378. elem.style.display = "";
  12379. }
  12380. }
  12381. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12382. values[ index ] = getDefaultDisplay( elem );
  12383. }
  12384. } else {
  12385. if ( display !== "none" ) {
  12386. values[ index ] = "none";
  12387. // Remember what we're overwriting
  12388. dataPriv.set( elem, "display", display );
  12389. }
  12390. }
  12391. }
  12392. // Set the display of the elements in a second loop to avoid constant reflow
  12393. for ( index = 0; index < length; index++ ) {
  12394. if ( values[ index ] != null ) {
  12395. elements[ index ].style.display = values[ index ];
  12396. }
  12397. }
  12398. return elements;
  12399. }
  12400. jQuery.fn.extend( {
  12401. show: function() {
  12402. return showHide( this, true );
  12403. },
  12404. hide: function() {
  12405. return showHide( this );
  12406. },
  12407. toggle: function( state ) {
  12408. if ( typeof state === "boolean" ) {
  12409. return state ? this.show() : this.hide();
  12410. }
  12411. return this.each( function() {
  12412. if ( isHiddenWithinTree( this ) ) {
  12413. jQuery( this ).show();
  12414. } else {
  12415. jQuery( this ).hide();
  12416. }
  12417. } );
  12418. }
  12419. } );
  12420. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12421. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12422. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12423. // We have to close these tags to support XHTML (#13200)
  12424. var wrapMap = {
  12425. // Support: IE <=9 only
  12426. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12427. // XHTML parsers do not magically insert elements in the
  12428. // same way that tag soup parsers do. So we cannot shorten
  12429. // this by omitting <tbody> or other required elements.
  12430. thead: [ 1, "<table>", "</table>" ],
  12431. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12432. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12433. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12434. _default: [ 0, "", "" ]
  12435. };
  12436. // Support: IE <=9 only
  12437. wrapMap.optgroup = wrapMap.option;
  12438. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12439. wrapMap.th = wrapMap.td;
  12440. function getAll( context, tag ) {
  12441. // Support: IE <=9 - 11 only
  12442. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12443. var ret;
  12444. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12445. ret = context.getElementsByTagName( tag || "*" );
  12446. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12447. ret = context.querySelectorAll( tag || "*" );
  12448. } else {
  12449. ret = [];
  12450. }
  12451. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12452. return jQuery.merge( [ context ], ret );
  12453. }
  12454. return ret;
  12455. }
  12456. // Mark scripts as having already been evaluated
  12457. function setGlobalEval( elems, refElements ) {
  12458. var i = 0,
  12459. l = elems.length;
  12460. for ( ; i < l; i++ ) {
  12461. dataPriv.set(
  12462. elems[ i ],
  12463. "globalEval",
  12464. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12465. );
  12466. }
  12467. }
  12468. var rhtml = /<|&#?\w+;/;
  12469. function buildFragment( elems, context, scripts, selection, ignored ) {
  12470. var elem, tmp, tag, wrap, attached, j,
  12471. fragment = context.createDocumentFragment(),
  12472. nodes = [],
  12473. i = 0,
  12474. l = elems.length;
  12475. for ( ; i < l; i++ ) {
  12476. elem = elems[ i ];
  12477. if ( elem || elem === 0 ) {
  12478. // Add nodes directly
  12479. if ( toType( elem ) === "object" ) {
  12480. // Support: Android <=4.0 only, PhantomJS 1 only
  12481. // push.apply(_, arraylike) throws on ancient WebKit
  12482. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12483. // Convert non-html into a text node
  12484. } else if ( !rhtml.test( elem ) ) {
  12485. nodes.push( context.createTextNode( elem ) );
  12486. // Convert html into DOM nodes
  12487. } else {
  12488. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12489. // Deserialize a standard representation
  12490. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12491. wrap = wrapMap[ tag ] || wrapMap._default;
  12492. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12493. // Descend through wrappers to the right content
  12494. j = wrap[ 0 ];
  12495. while ( j-- ) {
  12496. tmp = tmp.lastChild;
  12497. }
  12498. // Support: Android <=4.0 only, PhantomJS 1 only
  12499. // push.apply(_, arraylike) throws on ancient WebKit
  12500. jQuery.merge( nodes, tmp.childNodes );
  12501. // Remember the top-level container
  12502. tmp = fragment.firstChild;
  12503. // Ensure the created nodes are orphaned (#12392)
  12504. tmp.textContent = "";
  12505. }
  12506. }
  12507. }
  12508. // Remove wrapper from fragment
  12509. fragment.textContent = "";
  12510. i = 0;
  12511. while ( ( elem = nodes[ i++ ] ) ) {
  12512. // Skip elements already in the context collection (trac-4087)
  12513. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12514. if ( ignored ) {
  12515. ignored.push( elem );
  12516. }
  12517. continue;
  12518. }
  12519. attached = isAttached( elem );
  12520. // Append to fragment
  12521. tmp = getAll( fragment.appendChild( elem ), "script" );
  12522. // Preserve script evaluation history
  12523. if ( attached ) {
  12524. setGlobalEval( tmp );
  12525. }
  12526. // Capture executables
  12527. if ( scripts ) {
  12528. j = 0;
  12529. while ( ( elem = tmp[ j++ ] ) ) {
  12530. if ( rscriptType.test( elem.type || "" ) ) {
  12531. scripts.push( elem );
  12532. }
  12533. }
  12534. }
  12535. }
  12536. return fragment;
  12537. }
  12538. ( function() {
  12539. var fragment = document.createDocumentFragment(),
  12540. div = fragment.appendChild( document.createElement( "div" ) ),
  12541. input = document.createElement( "input" );
  12542. // Support: Android 4.0 - 4.3 only
  12543. // Check state lost if the name is set (#11217)
  12544. // Support: Windows Web Apps (WWA)
  12545. // `name` and `type` must use .setAttribute for WWA (#14901)
  12546. input.setAttribute( "type", "radio" );
  12547. input.setAttribute( "checked", "checked" );
  12548. input.setAttribute( "name", "t" );
  12549. div.appendChild( input );
  12550. // Support: Android <=4.1 only
  12551. // Older WebKit doesn't clone checked state correctly in fragments
  12552. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12553. // Support: IE <=11 only
  12554. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12555. div.innerHTML = "<textarea>x</textarea>";
  12556. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12557. } )();
  12558. var
  12559. rkeyEvent = /^key/,
  12560. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12561. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12562. function returnTrue() {
  12563. return true;
  12564. }
  12565. function returnFalse() {
  12566. return false;
  12567. }
  12568. // Support: IE <=9 - 11+
  12569. // focus() and blur() are asynchronous, except when they are no-op.
  12570. // So expect focus to be synchronous when the element is already active,
  12571. // and blur to be synchronous when the element is not already active.
  12572. // (focus and blur are always synchronous in other supported browsers,
  12573. // this just defines when we can count on it).
  12574. function expectSync( elem, type ) {
  12575. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12576. }
  12577. // Support: IE <=9 only
  12578. // Accessing document.activeElement can throw unexpectedly
  12579. // https://bugs.jquery.com/ticket/13393
  12580. function safeActiveElement() {
  12581. try {
  12582. return document.activeElement;
  12583. } catch ( err ) { }
  12584. }
  12585. function on( elem, types, selector, data, fn, one ) {
  12586. var origFn, type;
  12587. // Types can be a map of types/handlers
  12588. if ( typeof types === "object" ) {
  12589. // ( types-Object, selector, data )
  12590. if ( typeof selector !== "string" ) {
  12591. // ( types-Object, data )
  12592. data = data || selector;
  12593. selector = undefined;
  12594. }
  12595. for ( type in types ) {
  12596. on( elem, type, selector, data, types[ type ], one );
  12597. }
  12598. return elem;
  12599. }
  12600. if ( data == null && fn == null ) {
  12601. // ( types, fn )
  12602. fn = selector;
  12603. data = selector = undefined;
  12604. } else if ( fn == null ) {
  12605. if ( typeof selector === "string" ) {
  12606. // ( types, selector, fn )
  12607. fn = data;
  12608. data = undefined;
  12609. } else {
  12610. // ( types, data, fn )
  12611. fn = data;
  12612. data = selector;
  12613. selector = undefined;
  12614. }
  12615. }
  12616. if ( fn === false ) {
  12617. fn = returnFalse;
  12618. } else if ( !fn ) {
  12619. return elem;
  12620. }
  12621. if ( one === 1 ) {
  12622. origFn = fn;
  12623. fn = function( event ) {
  12624. // Can use an empty set, since event contains the info
  12625. jQuery().off( event );
  12626. return origFn.apply( this, arguments );
  12627. };
  12628. // Use same guid so caller can remove using origFn
  12629. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12630. }
  12631. return elem.each( function() {
  12632. jQuery.event.add( this, types, fn, data, selector );
  12633. } );
  12634. }
  12635. /*
  12636. * Helper functions for managing events -- not part of the public interface.
  12637. * Props to Dean Edwards' addEvent library for many of the ideas.
  12638. */
  12639. jQuery.event = {
  12640. global: {},
  12641. add: function( elem, types, handler, data, selector ) {
  12642. var handleObjIn, eventHandle, tmp,
  12643. events, t, handleObj,
  12644. special, handlers, type, namespaces, origType,
  12645. elemData = dataPriv.get( elem );
  12646. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12647. if ( !elemData ) {
  12648. return;
  12649. }
  12650. // Caller can pass in an object of custom data in lieu of the handler
  12651. if ( handler.handler ) {
  12652. handleObjIn = handler;
  12653. handler = handleObjIn.handler;
  12654. selector = handleObjIn.selector;
  12655. }
  12656. // Ensure that invalid selectors throw exceptions at attach time
  12657. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12658. if ( selector ) {
  12659. jQuery.find.matchesSelector( documentElement, selector );
  12660. }
  12661. // Make sure that the handler has a unique ID, used to find/remove it later
  12662. if ( !handler.guid ) {
  12663. handler.guid = jQuery.guid++;
  12664. }
  12665. // Init the element's event structure and main handler, if this is the first
  12666. if ( !( events = elemData.events ) ) {
  12667. events = elemData.events = {};
  12668. }
  12669. if ( !( eventHandle = elemData.handle ) ) {
  12670. eventHandle = elemData.handle = function( e ) {
  12671. // Discard the second event of a jQuery.event.trigger() and
  12672. // when an event is called after a page has unloaded
  12673. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12674. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12675. };
  12676. }
  12677. // Handle multiple events separated by a space
  12678. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12679. t = types.length;
  12680. while ( t-- ) {
  12681. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12682. type = origType = tmp[ 1 ];
  12683. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12684. // There *must* be a type, no attaching namespace-only handlers
  12685. if ( !type ) {
  12686. continue;
  12687. }
  12688. // If event changes its type, use the special event handlers for the changed type
  12689. special = jQuery.event.special[ type ] || {};
  12690. // If selector defined, determine special event api type, otherwise given type
  12691. type = ( selector ? special.delegateType : special.bindType ) || type;
  12692. // Update special based on newly reset type
  12693. special = jQuery.event.special[ type ] || {};
  12694. // handleObj is passed to all event handlers
  12695. handleObj = jQuery.extend( {
  12696. type: type,
  12697. origType: origType,
  12698. data: data,
  12699. handler: handler,
  12700. guid: handler.guid,
  12701. selector: selector,
  12702. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12703. namespace: namespaces.join( "." )
  12704. }, handleObjIn );
  12705. // Init the event handler queue if we're the first
  12706. if ( !( handlers = events[ type ] ) ) {
  12707. handlers = events[ type ] = [];
  12708. handlers.delegateCount = 0;
  12709. // Only use addEventListener if the special events handler returns false
  12710. if ( !special.setup ||
  12711. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12712. if ( elem.addEventListener ) {
  12713. elem.addEventListener( type, eventHandle );
  12714. }
  12715. }
  12716. }
  12717. if ( special.add ) {
  12718. special.add.call( elem, handleObj );
  12719. if ( !handleObj.handler.guid ) {
  12720. handleObj.handler.guid = handler.guid;
  12721. }
  12722. }
  12723. // Add to the element's handler list, delegates in front
  12724. if ( selector ) {
  12725. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12726. } else {
  12727. handlers.push( handleObj );
  12728. }
  12729. // Keep track of which events have ever been used, for event optimization
  12730. jQuery.event.global[ type ] = true;
  12731. }
  12732. },
  12733. // Detach an event or set of events from an element
  12734. remove: function( elem, types, handler, selector, mappedTypes ) {
  12735. var j, origCount, tmp,
  12736. events, t, handleObj,
  12737. special, handlers, type, namespaces, origType,
  12738. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12739. if ( !elemData || !( events = elemData.events ) ) {
  12740. return;
  12741. }
  12742. // Once for each type.namespace in types; type may be omitted
  12743. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12744. t = types.length;
  12745. while ( t-- ) {
  12746. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12747. type = origType = tmp[ 1 ];
  12748. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12749. // Unbind all events (on this namespace, if provided) for the element
  12750. if ( !type ) {
  12751. for ( type in events ) {
  12752. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12753. }
  12754. continue;
  12755. }
  12756. special = jQuery.event.special[ type ] || {};
  12757. type = ( selector ? special.delegateType : special.bindType ) || type;
  12758. handlers = events[ type ] || [];
  12759. tmp = tmp[ 2 ] &&
  12760. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12761. // Remove matching events
  12762. origCount = j = handlers.length;
  12763. while ( j-- ) {
  12764. handleObj = handlers[ j ];
  12765. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12766. ( !handler || handler.guid === handleObj.guid ) &&
  12767. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12768. ( !selector || selector === handleObj.selector ||
  12769. selector === "**" && handleObj.selector ) ) {
  12770. handlers.splice( j, 1 );
  12771. if ( handleObj.selector ) {
  12772. handlers.delegateCount--;
  12773. }
  12774. if ( special.remove ) {
  12775. special.remove.call( elem, handleObj );
  12776. }
  12777. }
  12778. }
  12779. // Remove generic event handler if we removed something and no more handlers exist
  12780. // (avoids potential for endless recursion during removal of special event handlers)
  12781. if ( origCount && !handlers.length ) {
  12782. if ( !special.teardown ||
  12783. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12784. jQuery.removeEvent( elem, type, elemData.handle );
  12785. }
  12786. delete events[ type ];
  12787. }
  12788. }
  12789. // Remove data and the expando if it's no longer used
  12790. if ( jQuery.isEmptyObject( events ) ) {
  12791. dataPriv.remove( elem, "handle events" );
  12792. }
  12793. },
  12794. dispatch: function( nativeEvent ) {
  12795. // Make a writable jQuery.Event from the native event object
  12796. var event = jQuery.event.fix( nativeEvent );
  12797. var i, j, ret, matched, handleObj, handlerQueue,
  12798. args = new Array( arguments.length ),
  12799. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12800. special = jQuery.event.special[ event.type ] || {};
  12801. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12802. args[ 0 ] = event;
  12803. for ( i = 1; i < arguments.length; i++ ) {
  12804. args[ i ] = arguments[ i ];
  12805. }
  12806. event.delegateTarget = this;
  12807. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12808. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12809. return;
  12810. }
  12811. // Determine handlers
  12812. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12813. // Run delegates first; they may want to stop propagation beneath us
  12814. i = 0;
  12815. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12816. event.currentTarget = matched.elem;
  12817. j = 0;
  12818. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12819. !event.isImmediatePropagationStopped() ) {
  12820. // If the event is namespaced, then each handler is only invoked if it is
  12821. // specially universal or its namespaces are a superset of the event's.
  12822. if ( !event.rnamespace || handleObj.namespace === false ||
  12823. event.rnamespace.test( handleObj.namespace ) ) {
  12824. event.handleObj = handleObj;
  12825. event.data = handleObj.data;
  12826. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12827. handleObj.handler ).apply( matched.elem, args );
  12828. if ( ret !== undefined ) {
  12829. if ( ( event.result = ret ) === false ) {
  12830. event.preventDefault();
  12831. event.stopPropagation();
  12832. }
  12833. }
  12834. }
  12835. }
  12836. }
  12837. // Call the postDispatch hook for the mapped type
  12838. if ( special.postDispatch ) {
  12839. special.postDispatch.call( this, event );
  12840. }
  12841. return event.result;
  12842. },
  12843. handlers: function( event, handlers ) {
  12844. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12845. handlerQueue = [],
  12846. delegateCount = handlers.delegateCount,
  12847. cur = event.target;
  12848. // Find delegate handlers
  12849. if ( delegateCount &&
  12850. // Support: IE <=9
  12851. // Black-hole SVG <use> instance trees (trac-13180)
  12852. cur.nodeType &&
  12853. // Support: Firefox <=42
  12854. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12855. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12856. // Support: IE 11 only
  12857. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12858. !( event.type === "click" && event.button >= 1 ) ) {
  12859. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12860. // Don't check non-elements (#13208)
  12861. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12862. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12863. matchedHandlers = [];
  12864. matchedSelectors = {};
  12865. for ( i = 0; i < delegateCount; i++ ) {
  12866. handleObj = handlers[ i ];
  12867. // Don't conflict with Object.prototype properties (#13203)
  12868. sel = handleObj.selector + " ";
  12869. if ( matchedSelectors[ sel ] === undefined ) {
  12870. matchedSelectors[ sel ] = handleObj.needsContext ?
  12871. jQuery( sel, this ).index( cur ) > -1 :
  12872. jQuery.find( sel, this, null, [ cur ] ).length;
  12873. }
  12874. if ( matchedSelectors[ sel ] ) {
  12875. matchedHandlers.push( handleObj );
  12876. }
  12877. }
  12878. if ( matchedHandlers.length ) {
  12879. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12880. }
  12881. }
  12882. }
  12883. }
  12884. // Add the remaining (directly-bound) handlers
  12885. cur = this;
  12886. if ( delegateCount < handlers.length ) {
  12887. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12888. }
  12889. return handlerQueue;
  12890. },
  12891. addProp: function( name, hook ) {
  12892. Object.defineProperty( jQuery.Event.prototype, name, {
  12893. enumerable: true,
  12894. configurable: true,
  12895. get: isFunction( hook ) ?
  12896. function() {
  12897. if ( this.originalEvent ) {
  12898. return hook( this.originalEvent );
  12899. }
  12900. } :
  12901. function() {
  12902. if ( this.originalEvent ) {
  12903. return this.originalEvent[ name ];
  12904. }
  12905. },
  12906. set: function( value ) {
  12907. Object.defineProperty( this, name, {
  12908. enumerable: true,
  12909. configurable: true,
  12910. writable: true,
  12911. value: value
  12912. } );
  12913. }
  12914. } );
  12915. },
  12916. fix: function( originalEvent ) {
  12917. return originalEvent[ jQuery.expando ] ?
  12918. originalEvent :
  12919. new jQuery.Event( originalEvent );
  12920. },
  12921. special: {
  12922. load: {
  12923. // Prevent triggered image.load events from bubbling to window.load
  12924. noBubble: true
  12925. },
  12926. click: {
  12927. // Utilize native event to ensure correct state for checkable inputs
  12928. setup: function( data ) {
  12929. // For mutual compressibility with _default, replace `this` access with a local var.
  12930. // `|| data` is dead code meant only to preserve the variable through minification.
  12931. var el = this || data;
  12932. // Claim the first handler
  12933. if ( rcheckableType.test( el.type ) &&
  12934. el.click && nodeName( el, "input" ) ) {
  12935. // dataPriv.set( el, "click", ... )
  12936. leverageNative( el, "click", returnTrue );
  12937. }
  12938. // Return false to allow normal processing in the caller
  12939. return false;
  12940. },
  12941. trigger: function( data ) {
  12942. // For mutual compressibility with _default, replace `this` access with a local var.
  12943. // `|| data` is dead code meant only to preserve the variable through minification.
  12944. var el = this || data;
  12945. // Force setup before triggering a click
  12946. if ( rcheckableType.test( el.type ) &&
  12947. el.click && nodeName( el, "input" ) ) {
  12948. leverageNative( el, "click" );
  12949. }
  12950. // Return non-false to allow normal event-path propagation
  12951. return true;
  12952. },
  12953. // For cross-browser consistency, suppress native .click() on links
  12954. // Also prevent it if we're currently inside a leveraged native-event stack
  12955. _default: function( event ) {
  12956. var target = event.target;
  12957. return rcheckableType.test( target.type ) &&
  12958. target.click && nodeName( target, "input" ) &&
  12959. dataPriv.get( target, "click" ) ||
  12960. nodeName( target, "a" );
  12961. }
  12962. },
  12963. beforeunload: {
  12964. postDispatch: function( event ) {
  12965. // Support: Firefox 20+
  12966. // Firefox doesn't alert if the returnValue field is not set.
  12967. if ( event.result !== undefined && event.originalEvent ) {
  12968. event.originalEvent.returnValue = event.result;
  12969. }
  12970. }
  12971. }
  12972. }
  12973. };
  12974. // Ensure the presence of an event listener that handles manually-triggered
  12975. // synthetic events by interrupting progress until reinvoked in response to
  12976. // *native* events that it fires directly, ensuring that state changes have
  12977. // already occurred before other listeners are invoked.
  12978. function leverageNative( el, type, expectSync ) {
  12979. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  12980. if ( !expectSync ) {
  12981. if ( dataPriv.get( el, type ) === undefined ) {
  12982. jQuery.event.add( el, type, returnTrue );
  12983. }
  12984. return;
  12985. }
  12986. // Register the controller as a special universal handler for all event namespaces
  12987. dataPriv.set( el, type, false );
  12988. jQuery.event.add( el, type, {
  12989. namespace: false,
  12990. handler: function( event ) {
  12991. var notAsync, result,
  12992. saved = dataPriv.get( this, type );
  12993. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  12994. // Interrupt processing of the outer synthetic .trigger()ed event
  12995. // Saved data should be false in such cases, but might be a leftover capture object
  12996. // from an async native handler (gh-4350)
  12997. if ( !saved.length ) {
  12998. // Store arguments for use when handling the inner native event
  12999. // There will always be at least one argument (an event object), so this array
  13000. // will not be confused with a leftover capture object.
  13001. saved = slice.call( arguments );
  13002. dataPriv.set( this, type, saved );
  13003. // Trigger the native event and capture its result
  13004. // Support: IE <=9 - 11+
  13005. // focus() and blur() are asynchronous
  13006. notAsync = expectSync( this, type );
  13007. this[ type ]();
  13008. result = dataPriv.get( this, type );
  13009. if ( saved !== result || notAsync ) {
  13010. dataPriv.set( this, type, false );
  13011. } else {
  13012. result = {};
  13013. }
  13014. if ( saved !== result ) {
  13015. // Cancel the outer synthetic event
  13016. event.stopImmediatePropagation();
  13017. event.preventDefault();
  13018. return result.value;
  13019. }
  13020. // If this is an inner synthetic event for an event with a bubbling surrogate
  13021. // (focus or blur), assume that the surrogate already propagated from triggering the
  13022. // native event and prevent that from happening again here.
  13023. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13024. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13025. // less bad than duplication.
  13026. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13027. event.stopPropagation();
  13028. }
  13029. // If this is a native event triggered above, everything is now in order
  13030. // Fire an inner synthetic event with the original arguments
  13031. } else if ( saved.length ) {
  13032. // ...and capture the result
  13033. dataPriv.set( this, type, {
  13034. value: jQuery.event.trigger(
  13035. // Support: IE <=9 - 11+
  13036. // Extend with the prototype to reset the above stopImmediatePropagation()
  13037. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13038. saved.slice( 1 ),
  13039. this
  13040. )
  13041. } );
  13042. // Abort handling of the native event
  13043. event.stopImmediatePropagation();
  13044. }
  13045. }
  13046. } );
  13047. }
  13048. jQuery.removeEvent = function( elem, type, handle ) {
  13049. // This "if" is needed for plain objects
  13050. if ( elem.removeEventListener ) {
  13051. elem.removeEventListener( type, handle );
  13052. }
  13053. };
  13054. jQuery.Event = function( src, props ) {
  13055. // Allow instantiation without the 'new' keyword
  13056. if ( !( this instanceof jQuery.Event ) ) {
  13057. return new jQuery.Event( src, props );
  13058. }
  13059. // Event object
  13060. if ( src && src.type ) {
  13061. this.originalEvent = src;
  13062. this.type = src.type;
  13063. // Events bubbling up the document may have been marked as prevented
  13064. // by a handler lower down the tree; reflect the correct value.
  13065. this.isDefaultPrevented = src.defaultPrevented ||
  13066. src.defaultPrevented === undefined &&
  13067. // Support: Android <=2.3 only
  13068. src.returnValue === false ?
  13069. returnTrue :
  13070. returnFalse;
  13071. // Create target properties
  13072. // Support: Safari <=6 - 7 only
  13073. // Target should not be a text node (#504, #13143)
  13074. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13075. src.target.parentNode :
  13076. src.target;
  13077. this.currentTarget = src.currentTarget;
  13078. this.relatedTarget = src.relatedTarget;
  13079. // Event type
  13080. } else {
  13081. this.type = src;
  13082. }
  13083. // Put explicitly provided properties onto the event object
  13084. if ( props ) {
  13085. jQuery.extend( this, props );
  13086. }
  13087. // Create a timestamp if incoming event doesn't have one
  13088. this.timeStamp = src && src.timeStamp || Date.now();
  13089. // Mark it as fixed
  13090. this[ jQuery.expando ] = true;
  13091. };
  13092. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13093. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13094. jQuery.Event.prototype = {
  13095. constructor: jQuery.Event,
  13096. isDefaultPrevented: returnFalse,
  13097. isPropagationStopped: returnFalse,
  13098. isImmediatePropagationStopped: returnFalse,
  13099. isSimulated: false,
  13100. preventDefault: function() {
  13101. var e = this.originalEvent;
  13102. this.isDefaultPrevented = returnTrue;
  13103. if ( e && !this.isSimulated ) {
  13104. e.preventDefault();
  13105. }
  13106. },
  13107. stopPropagation: function() {
  13108. var e = this.originalEvent;
  13109. this.isPropagationStopped = returnTrue;
  13110. if ( e && !this.isSimulated ) {
  13111. e.stopPropagation();
  13112. }
  13113. },
  13114. stopImmediatePropagation: function() {
  13115. var e = this.originalEvent;
  13116. this.isImmediatePropagationStopped = returnTrue;
  13117. if ( e && !this.isSimulated ) {
  13118. e.stopImmediatePropagation();
  13119. }
  13120. this.stopPropagation();
  13121. }
  13122. };
  13123. // Includes all common event props including KeyEvent and MouseEvent specific props
  13124. jQuery.each( {
  13125. altKey: true,
  13126. bubbles: true,
  13127. cancelable: true,
  13128. changedTouches: true,
  13129. ctrlKey: true,
  13130. detail: true,
  13131. eventPhase: true,
  13132. metaKey: true,
  13133. pageX: true,
  13134. pageY: true,
  13135. shiftKey: true,
  13136. view: true,
  13137. "char": true,
  13138. code: true,
  13139. charCode: true,
  13140. key: true,
  13141. keyCode: true,
  13142. button: true,
  13143. buttons: true,
  13144. clientX: true,
  13145. clientY: true,
  13146. offsetX: true,
  13147. offsetY: true,
  13148. pointerId: true,
  13149. pointerType: true,
  13150. screenX: true,
  13151. screenY: true,
  13152. targetTouches: true,
  13153. toElement: true,
  13154. touches: true,
  13155. which: function( event ) {
  13156. var button = event.button;
  13157. // Add which for key events
  13158. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13159. return event.charCode != null ? event.charCode : event.keyCode;
  13160. }
  13161. // Add which for click: 1 === left; 2 === middle; 3 === right
  13162. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13163. if ( button & 1 ) {
  13164. return 1;
  13165. }
  13166. if ( button & 2 ) {
  13167. return 3;
  13168. }
  13169. if ( button & 4 ) {
  13170. return 2;
  13171. }
  13172. return 0;
  13173. }
  13174. return event.which;
  13175. }
  13176. }, jQuery.event.addProp );
  13177. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13178. jQuery.event.special[ type ] = {
  13179. // Utilize native event if possible so blur/focus sequence is correct
  13180. setup: function() {
  13181. // Claim the first handler
  13182. // dataPriv.set( this, "focus", ... )
  13183. // dataPriv.set( this, "blur", ... )
  13184. leverageNative( this, type, expectSync );
  13185. // Return false to allow normal processing in the caller
  13186. return false;
  13187. },
  13188. trigger: function() {
  13189. // Force setup before trigger
  13190. leverageNative( this, type );
  13191. // Return non-false to allow normal event-path propagation
  13192. return true;
  13193. },
  13194. delegateType: delegateType
  13195. };
  13196. } );
  13197. // Create mouseenter/leave events using mouseover/out and event-time checks
  13198. // so that event delegation works in jQuery.
  13199. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13200. //
  13201. // Support: Safari 7 only
  13202. // Safari sends mouseenter too often; see:
  13203. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13204. // for the description of the bug (it existed in older Chrome versions as well).
  13205. jQuery.each( {
  13206. mouseenter: "mouseover",
  13207. mouseleave: "mouseout",
  13208. pointerenter: "pointerover",
  13209. pointerleave: "pointerout"
  13210. }, function( orig, fix ) {
  13211. jQuery.event.special[ orig ] = {
  13212. delegateType: fix,
  13213. bindType: fix,
  13214. handle: function( event ) {
  13215. var ret,
  13216. target = this,
  13217. related = event.relatedTarget,
  13218. handleObj = event.handleObj;
  13219. // For mouseenter/leave call the handler if related is outside the target.
  13220. // NB: No relatedTarget if the mouse left/entered the browser window
  13221. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13222. event.type = handleObj.origType;
  13223. ret = handleObj.handler.apply( this, arguments );
  13224. event.type = fix;
  13225. }
  13226. return ret;
  13227. }
  13228. };
  13229. } );
  13230. jQuery.fn.extend( {
  13231. on: function( types, selector, data, fn ) {
  13232. return on( this, types, selector, data, fn );
  13233. },
  13234. one: function( types, selector, data, fn ) {
  13235. return on( this, types, selector, data, fn, 1 );
  13236. },
  13237. off: function( types, selector, fn ) {
  13238. var handleObj, type;
  13239. if ( types && types.preventDefault && types.handleObj ) {
  13240. // ( event ) dispatched jQuery.Event
  13241. handleObj = types.handleObj;
  13242. jQuery( types.delegateTarget ).off(
  13243. handleObj.namespace ?
  13244. handleObj.origType + "." + handleObj.namespace :
  13245. handleObj.origType,
  13246. handleObj.selector,
  13247. handleObj.handler
  13248. );
  13249. return this;
  13250. }
  13251. if ( typeof types === "object" ) {
  13252. // ( types-object [, selector] )
  13253. for ( type in types ) {
  13254. this.off( type, selector, types[ type ] );
  13255. }
  13256. return this;
  13257. }
  13258. if ( selector === false || typeof selector === "function" ) {
  13259. // ( types [, fn] )
  13260. fn = selector;
  13261. selector = undefined;
  13262. }
  13263. if ( fn === false ) {
  13264. fn = returnFalse;
  13265. }
  13266. return this.each( function() {
  13267. jQuery.event.remove( this, types, fn, selector );
  13268. } );
  13269. }
  13270. } );
  13271. var
  13272. /* eslint-disable max-len */
  13273. // See https://github.com/eslint/eslint/issues/3229
  13274. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13275. /* eslint-enable */
  13276. // Support: IE <=10 - 11, Edge 12 - 13 only
  13277. // In IE/Edge using regex groups here causes severe slowdowns.
  13278. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13279. rnoInnerhtml = /<script|<style|<link/i,
  13280. // checked="checked" or checked
  13281. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13282. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13283. // Prefer a tbody over its parent table for containing new rows
  13284. function manipulationTarget( elem, content ) {
  13285. if ( nodeName( elem, "table" ) &&
  13286. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13287. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13288. }
  13289. return elem;
  13290. }
  13291. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13292. function disableScript( elem ) {
  13293. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13294. return elem;
  13295. }
  13296. function restoreScript( elem ) {
  13297. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13298. elem.type = elem.type.slice( 5 );
  13299. } else {
  13300. elem.removeAttribute( "type" );
  13301. }
  13302. return elem;
  13303. }
  13304. function cloneCopyEvent( src, dest ) {
  13305. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13306. if ( dest.nodeType !== 1 ) {
  13307. return;
  13308. }
  13309. // 1. Copy private data: events, handlers, etc.
  13310. if ( dataPriv.hasData( src ) ) {
  13311. pdataOld = dataPriv.access( src );
  13312. pdataCur = dataPriv.set( dest, pdataOld );
  13313. events = pdataOld.events;
  13314. if ( events ) {
  13315. delete pdataCur.handle;
  13316. pdataCur.events = {};
  13317. for ( type in events ) {
  13318. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13319. jQuery.event.add( dest, type, events[ type ][ i ] );
  13320. }
  13321. }
  13322. }
  13323. }
  13324. // 2. Copy user data
  13325. if ( dataUser.hasData( src ) ) {
  13326. udataOld = dataUser.access( src );
  13327. udataCur = jQuery.extend( {}, udataOld );
  13328. dataUser.set( dest, udataCur );
  13329. }
  13330. }
  13331. // Fix IE bugs, see support tests
  13332. function fixInput( src, dest ) {
  13333. var nodeName = dest.nodeName.toLowerCase();
  13334. // Fails to persist the checked state of a cloned checkbox or radio button.
  13335. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13336. dest.checked = src.checked;
  13337. // Fails to return the selected option to the default selected state when cloning options
  13338. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13339. dest.defaultValue = src.defaultValue;
  13340. }
  13341. }
  13342. function domManip( collection, args, callback, ignored ) {
  13343. // Flatten any nested arrays
  13344. args = concat.apply( [], args );
  13345. var fragment, first, scripts, hasScripts, node, doc,
  13346. i = 0,
  13347. l = collection.length,
  13348. iNoClone = l - 1,
  13349. value = args[ 0 ],
  13350. valueIsFunction = isFunction( value );
  13351. // We can't cloneNode fragments that contain checked, in WebKit
  13352. if ( valueIsFunction ||
  13353. ( l > 1 && typeof value === "string" &&
  13354. !support.checkClone && rchecked.test( value ) ) ) {
  13355. return collection.each( function( index ) {
  13356. var self = collection.eq( index );
  13357. if ( valueIsFunction ) {
  13358. args[ 0 ] = value.call( this, index, self.html() );
  13359. }
  13360. domManip( self, args, callback, ignored );
  13361. } );
  13362. }
  13363. if ( l ) {
  13364. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13365. first = fragment.firstChild;
  13366. if ( fragment.childNodes.length === 1 ) {
  13367. fragment = first;
  13368. }
  13369. // Require either new content or an interest in ignored elements to invoke the callback
  13370. if ( first || ignored ) {
  13371. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13372. hasScripts = scripts.length;
  13373. // Use the original fragment for the last item
  13374. // instead of the first because it can end up
  13375. // being emptied incorrectly in certain situations (#8070).
  13376. for ( ; i < l; i++ ) {
  13377. node = fragment;
  13378. if ( i !== iNoClone ) {
  13379. node = jQuery.clone( node, true, true );
  13380. // Keep references to cloned scripts for later restoration
  13381. if ( hasScripts ) {
  13382. // Support: Android <=4.0 only, PhantomJS 1 only
  13383. // push.apply(_, arraylike) throws on ancient WebKit
  13384. jQuery.merge( scripts, getAll( node, "script" ) );
  13385. }
  13386. }
  13387. callback.call( collection[ i ], node, i );
  13388. }
  13389. if ( hasScripts ) {
  13390. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13391. // Reenable scripts
  13392. jQuery.map( scripts, restoreScript );
  13393. // Evaluate executable scripts on first document insertion
  13394. for ( i = 0; i < hasScripts; i++ ) {
  13395. node = scripts[ i ];
  13396. if ( rscriptType.test( node.type || "" ) &&
  13397. !dataPriv.access( node, "globalEval" ) &&
  13398. jQuery.contains( doc, node ) ) {
  13399. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13400. // Optional AJAX dependency, but won't run scripts if not present
  13401. if ( jQuery._evalUrl && !node.noModule ) {
  13402. jQuery._evalUrl( node.src, {
  13403. nonce: node.nonce || node.getAttribute( "nonce" )
  13404. } );
  13405. }
  13406. } else {
  13407. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13408. }
  13409. }
  13410. }
  13411. }
  13412. }
  13413. }
  13414. return collection;
  13415. }
  13416. function remove( elem, selector, keepData ) {
  13417. var node,
  13418. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13419. i = 0;
  13420. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13421. if ( !keepData && node.nodeType === 1 ) {
  13422. jQuery.cleanData( getAll( node ) );
  13423. }
  13424. if ( node.parentNode ) {
  13425. if ( keepData && isAttached( node ) ) {
  13426. setGlobalEval( getAll( node, "script" ) );
  13427. }
  13428. node.parentNode.removeChild( node );
  13429. }
  13430. }
  13431. return elem;
  13432. }
  13433. jQuery.extend( {
  13434. htmlPrefilter: function( html ) {
  13435. return html.replace( rxhtmlTag, "<$1></$2>" );
  13436. },
  13437. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13438. var i, l, srcElements, destElements,
  13439. clone = elem.cloneNode( true ),
  13440. inPage = isAttached( elem );
  13441. // Fix IE cloning issues
  13442. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13443. !jQuery.isXMLDoc( elem ) ) {
  13444. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13445. destElements = getAll( clone );
  13446. srcElements = getAll( elem );
  13447. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13448. fixInput( srcElements[ i ], destElements[ i ] );
  13449. }
  13450. }
  13451. // Copy the events from the original to the clone
  13452. if ( dataAndEvents ) {
  13453. if ( deepDataAndEvents ) {
  13454. srcElements = srcElements || getAll( elem );
  13455. destElements = destElements || getAll( clone );
  13456. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13457. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13458. }
  13459. } else {
  13460. cloneCopyEvent( elem, clone );
  13461. }
  13462. }
  13463. // Preserve script evaluation history
  13464. destElements = getAll( clone, "script" );
  13465. if ( destElements.length > 0 ) {
  13466. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13467. }
  13468. // Return the cloned set
  13469. return clone;
  13470. },
  13471. cleanData: function( elems ) {
  13472. var data, elem, type,
  13473. special = jQuery.event.special,
  13474. i = 0;
  13475. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13476. if ( acceptData( elem ) ) {
  13477. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13478. if ( data.events ) {
  13479. for ( type in data.events ) {
  13480. if ( special[ type ] ) {
  13481. jQuery.event.remove( elem, type );
  13482. // This is a shortcut to avoid jQuery.event.remove's overhead
  13483. } else {
  13484. jQuery.removeEvent( elem, type, data.handle );
  13485. }
  13486. }
  13487. }
  13488. // Support: Chrome <=35 - 45+
  13489. // Assign undefined instead of using delete, see Data#remove
  13490. elem[ dataPriv.expando ] = undefined;
  13491. }
  13492. if ( elem[ dataUser.expando ] ) {
  13493. // Support: Chrome <=35 - 45+
  13494. // Assign undefined instead of using delete, see Data#remove
  13495. elem[ dataUser.expando ] = undefined;
  13496. }
  13497. }
  13498. }
  13499. }
  13500. } );
  13501. jQuery.fn.extend( {
  13502. detach: function( selector ) {
  13503. return remove( this, selector, true );
  13504. },
  13505. remove: function( selector ) {
  13506. return remove( this, selector );
  13507. },
  13508. text: function( value ) {
  13509. return access( this, function( value ) {
  13510. return value === undefined ?
  13511. jQuery.text( this ) :
  13512. this.empty().each( function() {
  13513. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13514. this.textContent = value;
  13515. }
  13516. } );
  13517. }, null, value, arguments.length );
  13518. },
  13519. append: function() {
  13520. return domManip( this, arguments, function( elem ) {
  13521. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13522. var target = manipulationTarget( this, elem );
  13523. target.appendChild( elem );
  13524. }
  13525. } );
  13526. },
  13527. prepend: function() {
  13528. return domManip( this, arguments, function( elem ) {
  13529. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13530. var target = manipulationTarget( this, elem );
  13531. target.insertBefore( elem, target.firstChild );
  13532. }
  13533. } );
  13534. },
  13535. before: function() {
  13536. return domManip( this, arguments, function( elem ) {
  13537. if ( this.parentNode ) {
  13538. this.parentNode.insertBefore( elem, this );
  13539. }
  13540. } );
  13541. },
  13542. after: function() {
  13543. return domManip( this, arguments, function( elem ) {
  13544. if ( this.parentNode ) {
  13545. this.parentNode.insertBefore( elem, this.nextSibling );
  13546. }
  13547. } );
  13548. },
  13549. empty: function() {
  13550. var elem,
  13551. i = 0;
  13552. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13553. if ( elem.nodeType === 1 ) {
  13554. // Prevent memory leaks
  13555. jQuery.cleanData( getAll( elem, false ) );
  13556. // Remove any remaining nodes
  13557. elem.textContent = "";
  13558. }
  13559. }
  13560. return this;
  13561. },
  13562. clone: function( dataAndEvents, deepDataAndEvents ) {
  13563. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13564. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13565. return this.map( function() {
  13566. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13567. } );
  13568. },
  13569. html: function( value ) {
  13570. return access( this, function( value ) {
  13571. var elem = this[ 0 ] || {},
  13572. i = 0,
  13573. l = this.length;
  13574. if ( value === undefined && elem.nodeType === 1 ) {
  13575. return elem.innerHTML;
  13576. }
  13577. // See if we can take a shortcut and just use innerHTML
  13578. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13579. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13580. value = jQuery.htmlPrefilter( value );
  13581. try {
  13582. for ( ; i < l; i++ ) {
  13583. elem = this[ i ] || {};
  13584. // Remove element nodes and prevent memory leaks
  13585. if ( elem.nodeType === 1 ) {
  13586. jQuery.cleanData( getAll( elem, false ) );
  13587. elem.innerHTML = value;
  13588. }
  13589. }
  13590. elem = 0;
  13591. // If using innerHTML throws an exception, use the fallback method
  13592. } catch ( e ) {}
  13593. }
  13594. if ( elem ) {
  13595. this.empty().append( value );
  13596. }
  13597. }, null, value, arguments.length );
  13598. },
  13599. replaceWith: function() {
  13600. var ignored = [];
  13601. // Make the changes, replacing each non-ignored context element with the new content
  13602. return domManip( this, arguments, function( elem ) {
  13603. var parent = this.parentNode;
  13604. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13605. jQuery.cleanData( getAll( this ) );
  13606. if ( parent ) {
  13607. parent.replaceChild( elem, this );
  13608. }
  13609. }
  13610. // Force callback invocation
  13611. }, ignored );
  13612. }
  13613. } );
  13614. jQuery.each( {
  13615. appendTo: "append",
  13616. prependTo: "prepend",
  13617. insertBefore: "before",
  13618. insertAfter: "after",
  13619. replaceAll: "replaceWith"
  13620. }, function( name, original ) {
  13621. jQuery.fn[ name ] = function( selector ) {
  13622. var elems,
  13623. ret = [],
  13624. insert = jQuery( selector ),
  13625. last = insert.length - 1,
  13626. i = 0;
  13627. for ( ; i <= last; i++ ) {
  13628. elems = i === last ? this : this.clone( true );
  13629. jQuery( insert[ i ] )[ original ]( elems );
  13630. // Support: Android <=4.0 only, PhantomJS 1 only
  13631. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13632. push.apply( ret, elems.get() );
  13633. }
  13634. return this.pushStack( ret );
  13635. };
  13636. } );
  13637. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13638. var getStyles = function( elem ) {
  13639. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13640. // IE throws on elements created in popups
  13641. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13642. var view = elem.ownerDocument.defaultView;
  13643. if ( !view || !view.opener ) {
  13644. view = window;
  13645. }
  13646. return view.getComputedStyle( elem );
  13647. };
  13648. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13649. ( function() {
  13650. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13651. // so they're executed at the same time to save the second computation.
  13652. function computeStyleTests() {
  13653. // This is a singleton, we need to execute it only once
  13654. if ( !div ) {
  13655. return;
  13656. }
  13657. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13658. "margin-top:1px;padding:0;border:0";
  13659. div.style.cssText =
  13660. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13661. "margin:auto;border:1px;padding:1px;" +
  13662. "width:60%;top:1%";
  13663. documentElement.appendChild( container ).appendChild( div );
  13664. var divStyle = window.getComputedStyle( div );
  13665. pixelPositionVal = divStyle.top !== "1%";
  13666. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13667. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13668. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13669. // Some styles come back with percentage values, even though they shouldn't
  13670. div.style.right = "60%";
  13671. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13672. // Support: IE 9 - 11 only
  13673. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13674. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13675. // Support: IE 9 only
  13676. // Detect overflow:scroll screwiness (gh-3699)
  13677. // Support: Chrome <=64
  13678. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13679. div.style.position = "absolute";
  13680. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13681. documentElement.removeChild( container );
  13682. // Nullify the div so it wouldn't be stored in the memory and
  13683. // it will also be a sign that checks already performed
  13684. div = null;
  13685. }
  13686. function roundPixelMeasures( measure ) {
  13687. return Math.round( parseFloat( measure ) );
  13688. }
  13689. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13690. reliableMarginLeftVal,
  13691. container = document.createElement( "div" ),
  13692. div = document.createElement( "div" );
  13693. // Finish early in limited (non-browser) environments
  13694. if ( !div.style ) {
  13695. return;
  13696. }
  13697. // Support: IE <=9 - 11 only
  13698. // Style of cloned element affects source element cloned (#8908)
  13699. div.style.backgroundClip = "content-box";
  13700. div.cloneNode( true ).style.backgroundClip = "";
  13701. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13702. jQuery.extend( support, {
  13703. boxSizingReliable: function() {
  13704. computeStyleTests();
  13705. return boxSizingReliableVal;
  13706. },
  13707. pixelBoxStyles: function() {
  13708. computeStyleTests();
  13709. return pixelBoxStylesVal;
  13710. },
  13711. pixelPosition: function() {
  13712. computeStyleTests();
  13713. return pixelPositionVal;
  13714. },
  13715. reliableMarginLeft: function() {
  13716. computeStyleTests();
  13717. return reliableMarginLeftVal;
  13718. },
  13719. scrollboxSize: function() {
  13720. computeStyleTests();
  13721. return scrollboxSizeVal;
  13722. }
  13723. } );
  13724. } )();
  13725. function curCSS( elem, name, computed ) {
  13726. var width, minWidth, maxWidth, ret,
  13727. // Support: Firefox 51+
  13728. // Retrieving style before computed somehow
  13729. // fixes an issue with getting wrong values
  13730. // on detached elements
  13731. style = elem.style;
  13732. computed = computed || getStyles( elem );
  13733. // getPropertyValue is needed for:
  13734. // .css('filter') (IE 9 only, #12537)
  13735. // .css('--customProperty) (#3144)
  13736. if ( computed ) {
  13737. ret = computed.getPropertyValue( name ) || computed[ name ];
  13738. if ( ret === "" && !isAttached( elem ) ) {
  13739. ret = jQuery.style( elem, name );
  13740. }
  13741. // A tribute to the "awesome hack by Dean Edwards"
  13742. // Android Browser returns percentage for some values,
  13743. // but width seems to be reliably pixels.
  13744. // This is against the CSSOM draft spec:
  13745. // https://drafts.csswg.org/cssom/#resolved-values
  13746. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13747. // Remember the original values
  13748. width = style.width;
  13749. minWidth = style.minWidth;
  13750. maxWidth = style.maxWidth;
  13751. // Put in the new values to get a computed value out
  13752. style.minWidth = style.maxWidth = style.width = ret;
  13753. ret = computed.width;
  13754. // Revert the changed values
  13755. style.width = width;
  13756. style.minWidth = minWidth;
  13757. style.maxWidth = maxWidth;
  13758. }
  13759. }
  13760. return ret !== undefined ?
  13761. // Support: IE <=9 - 11 only
  13762. // IE returns zIndex value as an integer.
  13763. ret + "" :
  13764. ret;
  13765. }
  13766. function addGetHookIf( conditionFn, hookFn ) {
  13767. // Define the hook, we'll check on the first run if it's really needed.
  13768. return {
  13769. get: function() {
  13770. if ( conditionFn() ) {
  13771. // Hook not needed (or it's not possible to use it due
  13772. // to missing dependency), remove it.
  13773. delete this.get;
  13774. return;
  13775. }
  13776. // Hook needed; redefine it so that the support test is not executed again.
  13777. return ( this.get = hookFn ).apply( this, arguments );
  13778. }
  13779. };
  13780. }
  13781. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13782. emptyStyle = document.createElement( "div" ).style,
  13783. vendorProps = {};
  13784. // Return a vendor-prefixed property or undefined
  13785. function vendorPropName( name ) {
  13786. // Check for vendor prefixed names
  13787. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13788. i = cssPrefixes.length;
  13789. while ( i-- ) {
  13790. name = cssPrefixes[ i ] + capName;
  13791. if ( name in emptyStyle ) {
  13792. return name;
  13793. }
  13794. }
  13795. }
  13796. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13797. function finalPropName( name ) {
  13798. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13799. if ( final ) {
  13800. return final;
  13801. }
  13802. if ( name in emptyStyle ) {
  13803. return name;
  13804. }
  13805. return vendorProps[ name ] = vendorPropName( name ) || name;
  13806. }
  13807. var
  13808. // Swappable if display is none or starts with table
  13809. // except "table", "table-cell", or "table-caption"
  13810. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13811. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13812. rcustomProp = /^--/,
  13813. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13814. cssNormalTransform = {
  13815. letterSpacing: "0",
  13816. fontWeight: "400"
  13817. };
  13818. function setPositiveNumber( elem, value, subtract ) {
  13819. // Any relative (+/-) values have already been
  13820. // normalized at this point
  13821. var matches = rcssNum.exec( value );
  13822. return matches ?
  13823. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13824. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13825. value;
  13826. }
  13827. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13828. var i = dimension === "width" ? 1 : 0,
  13829. extra = 0,
  13830. delta = 0;
  13831. // Adjustment may not be necessary
  13832. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13833. return 0;
  13834. }
  13835. for ( ; i < 4; i += 2 ) {
  13836. // Both box models exclude margin
  13837. if ( box === "margin" ) {
  13838. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13839. }
  13840. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13841. if ( !isBorderBox ) {
  13842. // Add padding
  13843. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13844. // For "border" or "margin", add border
  13845. if ( box !== "padding" ) {
  13846. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13847. // But still keep track of it otherwise
  13848. } else {
  13849. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13850. }
  13851. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13852. // "padding" or "margin"
  13853. } else {
  13854. // For "content", subtract padding
  13855. if ( box === "content" ) {
  13856. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13857. }
  13858. // For "content" or "padding", subtract border
  13859. if ( box !== "margin" ) {
  13860. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13861. }
  13862. }
  13863. }
  13864. // Account for positive content-box scroll gutter when requested by providing computedVal
  13865. if ( !isBorderBox && computedVal >= 0 ) {
  13866. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13867. // Assuming integer scroll gutter, subtract the rest and round down
  13868. delta += Math.max( 0, Math.ceil(
  13869. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13870. computedVal -
  13871. delta -
  13872. extra -
  13873. 0.5
  13874. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13875. // Use an explicit zero to avoid NaN (gh-3964)
  13876. ) ) || 0;
  13877. }
  13878. return delta;
  13879. }
  13880. function getWidthOrHeight( elem, dimension, extra ) {
  13881. // Start with computed style
  13882. var styles = getStyles( elem ),
  13883. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13884. // Fake content-box until we know it's needed to know the true value.
  13885. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13886. isBorderBox = boxSizingNeeded &&
  13887. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13888. valueIsBorderBox = isBorderBox,
  13889. val = curCSS( elem, dimension, styles ),
  13890. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13891. // Support: Firefox <=54
  13892. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13893. if ( rnumnonpx.test( val ) ) {
  13894. if ( !extra ) {
  13895. return val;
  13896. }
  13897. val = "auto";
  13898. }
  13899. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13900. // This happens for inline elements with no explicit setting (gh-3571)
  13901. // Support: Android <=4.1 - 4.3 only
  13902. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13903. // Support: IE 9-11 only
  13904. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13905. // We use getClientRects() to check for hidden/disconnected.
  13906. // In those cases, the computed value can be trusted to be border-box
  13907. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13908. val === "auto" ||
  13909. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13910. elem.getClientRects().length ) {
  13911. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13912. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13913. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13914. // retrieved value as a content box dimension.
  13915. valueIsBorderBox = offsetProp in elem;
  13916. if ( valueIsBorderBox ) {
  13917. val = elem[ offsetProp ];
  13918. }
  13919. }
  13920. // Normalize "" and auto
  13921. val = parseFloat( val ) || 0;
  13922. // Adjust for the element's box model
  13923. return ( val +
  13924. boxModelAdjustment(
  13925. elem,
  13926. dimension,
  13927. extra || ( isBorderBox ? "border" : "content" ),
  13928. valueIsBorderBox,
  13929. styles,
  13930. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13931. val
  13932. )
  13933. ) + "px";
  13934. }
  13935. jQuery.extend( {
  13936. // Add in style property hooks for overriding the default
  13937. // behavior of getting and setting a style property
  13938. cssHooks: {
  13939. opacity: {
  13940. get: function( elem, computed ) {
  13941. if ( computed ) {
  13942. // We should always get a number back from opacity
  13943. var ret = curCSS( elem, "opacity" );
  13944. return ret === "" ? "1" : ret;
  13945. }
  13946. }
  13947. }
  13948. },
  13949. // Don't automatically add "px" to these possibly-unitless properties
  13950. cssNumber: {
  13951. "animationIterationCount": true,
  13952. "columnCount": true,
  13953. "fillOpacity": true,
  13954. "flexGrow": true,
  13955. "flexShrink": true,
  13956. "fontWeight": true,
  13957. "gridArea": true,
  13958. "gridColumn": true,
  13959. "gridColumnEnd": true,
  13960. "gridColumnStart": true,
  13961. "gridRow": true,
  13962. "gridRowEnd": true,
  13963. "gridRowStart": true,
  13964. "lineHeight": true,
  13965. "opacity": true,
  13966. "order": true,
  13967. "orphans": true,
  13968. "widows": true,
  13969. "zIndex": true,
  13970. "zoom": true
  13971. },
  13972. // Add in properties whose names you wish to fix before
  13973. // setting or getting the value
  13974. cssProps: {},
  13975. // Get and set the style property on a DOM Node
  13976. style: function( elem, name, value, extra ) {
  13977. // Don't set styles on text and comment nodes
  13978. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  13979. return;
  13980. }
  13981. // Make sure that we're working with the right name
  13982. var ret, type, hooks,
  13983. origName = camelCase( name ),
  13984. isCustomProp = rcustomProp.test( name ),
  13985. style = elem.style;
  13986. // Make sure that we're working with the right name. We don't
  13987. // want to query the value if it is a CSS custom property
  13988. // since they are user-defined.
  13989. if ( !isCustomProp ) {
  13990. name = finalPropName( origName );
  13991. }
  13992. // Gets hook for the prefixed version, then unprefixed version
  13993. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  13994. // Check if we're setting a value
  13995. if ( value !== undefined ) {
  13996. type = typeof value;
  13997. // Convert "+=" or "-=" to relative numbers (#7345)
  13998. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  13999. value = adjustCSS( elem, name, ret );
  14000. // Fixes bug #9237
  14001. type = "number";
  14002. }
  14003. // Make sure that null and NaN values aren't set (#7116)
  14004. if ( value == null || value !== value ) {
  14005. return;
  14006. }
  14007. // If a number was passed in, add the unit (except for certain CSS properties)
  14008. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14009. // "px" to a few hardcoded values.
  14010. if ( type === "number" && !isCustomProp ) {
  14011. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14012. }
  14013. // background-* props affect original clone's values
  14014. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14015. style[ name ] = "inherit";
  14016. }
  14017. // If a hook was provided, use that value, otherwise just set the specified value
  14018. if ( !hooks || !( "set" in hooks ) ||
  14019. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14020. if ( isCustomProp ) {
  14021. style.setProperty( name, value );
  14022. } else {
  14023. style[ name ] = value;
  14024. }
  14025. }
  14026. } else {
  14027. // If a hook was provided get the non-computed value from there
  14028. if ( hooks && "get" in hooks &&
  14029. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14030. return ret;
  14031. }
  14032. // Otherwise just get the value from the style object
  14033. return style[ name ];
  14034. }
  14035. },
  14036. css: function( elem, name, extra, styles ) {
  14037. var val, num, hooks,
  14038. origName = camelCase( name ),
  14039. isCustomProp = rcustomProp.test( name );
  14040. // Make sure that we're working with the right name. We don't
  14041. // want to modify the value if it is a CSS custom property
  14042. // since they are user-defined.
  14043. if ( !isCustomProp ) {
  14044. name = finalPropName( origName );
  14045. }
  14046. // Try prefixed name followed by the unprefixed name
  14047. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14048. // If a hook was provided get the computed value from there
  14049. if ( hooks && "get" in hooks ) {
  14050. val = hooks.get( elem, true, extra );
  14051. }
  14052. // Otherwise, if a way to get the computed value exists, use that
  14053. if ( val === undefined ) {
  14054. val = curCSS( elem, name, styles );
  14055. }
  14056. // Convert "normal" to computed value
  14057. if ( val === "normal" && name in cssNormalTransform ) {
  14058. val = cssNormalTransform[ name ];
  14059. }
  14060. // Make numeric if forced or a qualifier was provided and val looks numeric
  14061. if ( extra === "" || extra ) {
  14062. num = parseFloat( val );
  14063. return extra === true || isFinite( num ) ? num || 0 : val;
  14064. }
  14065. return val;
  14066. }
  14067. } );
  14068. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14069. jQuery.cssHooks[ dimension ] = {
  14070. get: function( elem, computed, extra ) {
  14071. if ( computed ) {
  14072. // Certain elements can have dimension info if we invisibly show them
  14073. // but it must have a current display style that would benefit
  14074. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14075. // Support: Safari 8+
  14076. // Table columns in Safari have non-zero offsetWidth & zero
  14077. // getBoundingClientRect().width unless display is changed.
  14078. // Support: IE <=11 only
  14079. // Running getBoundingClientRect on a disconnected node
  14080. // in IE throws an error.
  14081. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14082. swap( elem, cssShow, function() {
  14083. return getWidthOrHeight( elem, dimension, extra );
  14084. } ) :
  14085. getWidthOrHeight( elem, dimension, extra );
  14086. }
  14087. },
  14088. set: function( elem, value, extra ) {
  14089. var matches,
  14090. styles = getStyles( elem ),
  14091. // Only read styles.position if the test has a chance to fail
  14092. // to avoid forcing a reflow.
  14093. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14094. styles.position === "absolute",
  14095. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14096. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14097. isBorderBox = boxSizingNeeded &&
  14098. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14099. subtract = extra ?
  14100. boxModelAdjustment(
  14101. elem,
  14102. dimension,
  14103. extra,
  14104. isBorderBox,
  14105. styles
  14106. ) :
  14107. 0;
  14108. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14109. // faking a content-box to get border and padding (gh-3699)
  14110. if ( isBorderBox && scrollboxSizeBuggy ) {
  14111. subtract -= Math.ceil(
  14112. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14113. parseFloat( styles[ dimension ] ) -
  14114. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14115. 0.5
  14116. );
  14117. }
  14118. // Convert to pixels if value adjustment is needed
  14119. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14120. ( matches[ 3 ] || "px" ) !== "px" ) {
  14121. elem.style[ dimension ] = value;
  14122. value = jQuery.css( elem, dimension );
  14123. }
  14124. return setPositiveNumber( elem, value, subtract );
  14125. }
  14126. };
  14127. } );
  14128. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14129. function( elem, computed ) {
  14130. if ( computed ) {
  14131. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14132. elem.getBoundingClientRect().left -
  14133. swap( elem, { marginLeft: 0 }, function() {
  14134. return elem.getBoundingClientRect().left;
  14135. } )
  14136. ) + "px";
  14137. }
  14138. }
  14139. );
  14140. // These hooks are used by animate to expand properties
  14141. jQuery.each( {
  14142. margin: "",
  14143. padding: "",
  14144. border: "Width"
  14145. }, function( prefix, suffix ) {
  14146. jQuery.cssHooks[ prefix + suffix ] = {
  14147. expand: function( value ) {
  14148. var i = 0,
  14149. expanded = {},
  14150. // Assumes a single number if not a string
  14151. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14152. for ( ; i < 4; i++ ) {
  14153. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14154. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14155. }
  14156. return expanded;
  14157. }
  14158. };
  14159. if ( prefix !== "margin" ) {
  14160. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14161. }
  14162. } );
  14163. jQuery.fn.extend( {
  14164. css: function( name, value ) {
  14165. return access( this, function( elem, name, value ) {
  14166. var styles, len,
  14167. map = {},
  14168. i = 0;
  14169. if ( Array.isArray( name ) ) {
  14170. styles = getStyles( elem );
  14171. len = name.length;
  14172. for ( ; i < len; i++ ) {
  14173. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14174. }
  14175. return map;
  14176. }
  14177. return value !== undefined ?
  14178. jQuery.style( elem, name, value ) :
  14179. jQuery.css( elem, name );
  14180. }, name, value, arguments.length > 1 );
  14181. }
  14182. } );
  14183. function Tween( elem, options, prop, end, easing ) {
  14184. return new Tween.prototype.init( elem, options, prop, end, easing );
  14185. }
  14186. jQuery.Tween = Tween;
  14187. Tween.prototype = {
  14188. constructor: Tween,
  14189. init: function( elem, options, prop, end, easing, unit ) {
  14190. this.elem = elem;
  14191. this.prop = prop;
  14192. this.easing = easing || jQuery.easing._default;
  14193. this.options = options;
  14194. this.start = this.now = this.cur();
  14195. this.end = end;
  14196. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14197. },
  14198. cur: function() {
  14199. var hooks = Tween.propHooks[ this.prop ];
  14200. return hooks && hooks.get ?
  14201. hooks.get( this ) :
  14202. Tween.propHooks._default.get( this );
  14203. },
  14204. run: function( percent ) {
  14205. var eased,
  14206. hooks = Tween.propHooks[ this.prop ];
  14207. if ( this.options.duration ) {
  14208. this.pos = eased = jQuery.easing[ this.easing ](
  14209. percent, this.options.duration * percent, 0, 1, this.options.duration
  14210. );
  14211. } else {
  14212. this.pos = eased = percent;
  14213. }
  14214. this.now = ( this.end - this.start ) * eased + this.start;
  14215. if ( this.options.step ) {
  14216. this.options.step.call( this.elem, this.now, this );
  14217. }
  14218. if ( hooks && hooks.set ) {
  14219. hooks.set( this );
  14220. } else {
  14221. Tween.propHooks._default.set( this );
  14222. }
  14223. return this;
  14224. }
  14225. };
  14226. Tween.prototype.init.prototype = Tween.prototype;
  14227. Tween.propHooks = {
  14228. _default: {
  14229. get: function( tween ) {
  14230. var result;
  14231. // Use a property on the element directly when it is not a DOM element,
  14232. // or when there is no matching style property that exists.
  14233. if ( tween.elem.nodeType !== 1 ||
  14234. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14235. return tween.elem[ tween.prop ];
  14236. }
  14237. // Passing an empty string as a 3rd parameter to .css will automatically
  14238. // attempt a parseFloat and fallback to a string if the parse fails.
  14239. // Simple values such as "10px" are parsed to Float;
  14240. // complex values such as "rotate(1rad)" are returned as-is.
  14241. result = jQuery.css( tween.elem, tween.prop, "" );
  14242. // Empty strings, null, undefined and "auto" are converted to 0.
  14243. return !result || result === "auto" ? 0 : result;
  14244. },
  14245. set: function( tween ) {
  14246. // Use step hook for back compat.
  14247. // Use cssHook if its there.
  14248. // Use .style if available and use plain properties where available.
  14249. if ( jQuery.fx.step[ tween.prop ] ) {
  14250. jQuery.fx.step[ tween.prop ]( tween );
  14251. } else if ( tween.elem.nodeType === 1 && (
  14252. jQuery.cssHooks[ tween.prop ] ||
  14253. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14254. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14255. } else {
  14256. tween.elem[ tween.prop ] = tween.now;
  14257. }
  14258. }
  14259. }
  14260. };
  14261. // Support: IE <=9 only
  14262. // Panic based approach to setting things on disconnected nodes
  14263. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14264. set: function( tween ) {
  14265. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14266. tween.elem[ tween.prop ] = tween.now;
  14267. }
  14268. }
  14269. };
  14270. jQuery.easing = {
  14271. linear: function( p ) {
  14272. return p;
  14273. },
  14274. swing: function( p ) {
  14275. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14276. },
  14277. _default: "swing"
  14278. };
  14279. jQuery.fx = Tween.prototype.init;
  14280. // Back compat <1.8 extension point
  14281. jQuery.fx.step = {};
  14282. var
  14283. fxNow, inProgress,
  14284. rfxtypes = /^(?:toggle|show|hide)$/,
  14285. rrun = /queueHooks$/;
  14286. function schedule() {
  14287. if ( inProgress ) {
  14288. if ( document.hidden === false && window.requestAnimationFrame ) {
  14289. window.requestAnimationFrame( schedule );
  14290. } else {
  14291. window.setTimeout( schedule, jQuery.fx.interval );
  14292. }
  14293. jQuery.fx.tick();
  14294. }
  14295. }
  14296. // Animations created synchronously will run synchronously
  14297. function createFxNow() {
  14298. window.setTimeout( function() {
  14299. fxNow = undefined;
  14300. } );
  14301. return ( fxNow = Date.now() );
  14302. }
  14303. // Generate parameters to create a standard animation
  14304. function genFx( type, includeWidth ) {
  14305. var which,
  14306. i = 0,
  14307. attrs = { height: type };
  14308. // If we include width, step value is 1 to do all cssExpand values,
  14309. // otherwise step value is 2 to skip over Left and Right
  14310. includeWidth = includeWidth ? 1 : 0;
  14311. for ( ; i < 4; i += 2 - includeWidth ) {
  14312. which = cssExpand[ i ];
  14313. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14314. }
  14315. if ( includeWidth ) {
  14316. attrs.opacity = attrs.width = type;
  14317. }
  14318. return attrs;
  14319. }
  14320. function createTween( value, prop, animation ) {
  14321. var tween,
  14322. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14323. index = 0,
  14324. length = collection.length;
  14325. for ( ; index < length; index++ ) {
  14326. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14327. // We're done with this property
  14328. return tween;
  14329. }
  14330. }
  14331. }
  14332. function defaultPrefilter( elem, props, opts ) {
  14333. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14334. isBox = "width" in props || "height" in props,
  14335. anim = this,
  14336. orig = {},
  14337. style = elem.style,
  14338. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14339. dataShow = dataPriv.get( elem, "fxshow" );
  14340. // Queue-skipping animations hijack the fx hooks
  14341. if ( !opts.queue ) {
  14342. hooks = jQuery._queueHooks( elem, "fx" );
  14343. if ( hooks.unqueued == null ) {
  14344. hooks.unqueued = 0;
  14345. oldfire = hooks.empty.fire;
  14346. hooks.empty.fire = function() {
  14347. if ( !hooks.unqueued ) {
  14348. oldfire();
  14349. }
  14350. };
  14351. }
  14352. hooks.unqueued++;
  14353. anim.always( function() {
  14354. // Ensure the complete handler is called before this completes
  14355. anim.always( function() {
  14356. hooks.unqueued--;
  14357. if ( !jQuery.queue( elem, "fx" ).length ) {
  14358. hooks.empty.fire();
  14359. }
  14360. } );
  14361. } );
  14362. }
  14363. // Detect show/hide animations
  14364. for ( prop in props ) {
  14365. value = props[ prop ];
  14366. if ( rfxtypes.test( value ) ) {
  14367. delete props[ prop ];
  14368. toggle = toggle || value === "toggle";
  14369. if ( value === ( hidden ? "hide" : "show" ) ) {
  14370. // Pretend to be hidden if this is a "show" and
  14371. // there is still data from a stopped show/hide
  14372. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14373. hidden = true;
  14374. // Ignore all other no-op show/hide data
  14375. } else {
  14376. continue;
  14377. }
  14378. }
  14379. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14380. }
  14381. }
  14382. // Bail out if this is a no-op like .hide().hide()
  14383. propTween = !jQuery.isEmptyObject( props );
  14384. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14385. return;
  14386. }
  14387. // Restrict "overflow" and "display" styles during box animations
  14388. if ( isBox && elem.nodeType === 1 ) {
  14389. // Support: IE <=9 - 11, Edge 12 - 15
  14390. // Record all 3 overflow attributes because IE does not infer the shorthand
  14391. // from identically-valued overflowX and overflowY and Edge just mirrors
  14392. // the overflowX value there.
  14393. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14394. // Identify a display type, preferring old show/hide data over the CSS cascade
  14395. restoreDisplay = dataShow && dataShow.display;
  14396. if ( restoreDisplay == null ) {
  14397. restoreDisplay = dataPriv.get( elem, "display" );
  14398. }
  14399. display = jQuery.css( elem, "display" );
  14400. if ( display === "none" ) {
  14401. if ( restoreDisplay ) {
  14402. display = restoreDisplay;
  14403. } else {
  14404. // Get nonempty value(s) by temporarily forcing visibility
  14405. showHide( [ elem ], true );
  14406. restoreDisplay = elem.style.display || restoreDisplay;
  14407. display = jQuery.css( elem, "display" );
  14408. showHide( [ elem ] );
  14409. }
  14410. }
  14411. // Animate inline elements as inline-block
  14412. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14413. if ( jQuery.css( elem, "float" ) === "none" ) {
  14414. // Restore the original display value at the end of pure show/hide animations
  14415. if ( !propTween ) {
  14416. anim.done( function() {
  14417. style.display = restoreDisplay;
  14418. } );
  14419. if ( restoreDisplay == null ) {
  14420. display = style.display;
  14421. restoreDisplay = display === "none" ? "" : display;
  14422. }
  14423. }
  14424. style.display = "inline-block";
  14425. }
  14426. }
  14427. }
  14428. if ( opts.overflow ) {
  14429. style.overflow = "hidden";
  14430. anim.always( function() {
  14431. style.overflow = opts.overflow[ 0 ];
  14432. style.overflowX = opts.overflow[ 1 ];
  14433. style.overflowY = opts.overflow[ 2 ];
  14434. } );
  14435. }
  14436. // Implement show/hide animations
  14437. propTween = false;
  14438. for ( prop in orig ) {
  14439. // General show/hide setup for this element animation
  14440. if ( !propTween ) {
  14441. if ( dataShow ) {
  14442. if ( "hidden" in dataShow ) {
  14443. hidden = dataShow.hidden;
  14444. }
  14445. } else {
  14446. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14447. }
  14448. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14449. if ( toggle ) {
  14450. dataShow.hidden = !hidden;
  14451. }
  14452. // Show elements before animating them
  14453. if ( hidden ) {
  14454. showHide( [ elem ], true );
  14455. }
  14456. /* eslint-disable no-loop-func */
  14457. anim.done( function() {
  14458. /* eslint-enable no-loop-func */
  14459. // The final step of a "hide" animation is actually hiding the element
  14460. if ( !hidden ) {
  14461. showHide( [ elem ] );
  14462. }
  14463. dataPriv.remove( elem, "fxshow" );
  14464. for ( prop in orig ) {
  14465. jQuery.style( elem, prop, orig[ prop ] );
  14466. }
  14467. } );
  14468. }
  14469. // Per-property setup
  14470. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14471. if ( !( prop in dataShow ) ) {
  14472. dataShow[ prop ] = propTween.start;
  14473. if ( hidden ) {
  14474. propTween.end = propTween.start;
  14475. propTween.start = 0;
  14476. }
  14477. }
  14478. }
  14479. }
  14480. function propFilter( props, specialEasing ) {
  14481. var index, name, easing, value, hooks;
  14482. // camelCase, specialEasing and expand cssHook pass
  14483. for ( index in props ) {
  14484. name = camelCase( index );
  14485. easing = specialEasing[ name ];
  14486. value = props[ index ];
  14487. if ( Array.isArray( value ) ) {
  14488. easing = value[ 1 ];
  14489. value = props[ index ] = value[ 0 ];
  14490. }
  14491. if ( index !== name ) {
  14492. props[ name ] = value;
  14493. delete props[ index ];
  14494. }
  14495. hooks = jQuery.cssHooks[ name ];
  14496. if ( hooks && "expand" in hooks ) {
  14497. value = hooks.expand( value );
  14498. delete props[ name ];
  14499. // Not quite $.extend, this won't overwrite existing keys.
  14500. // Reusing 'index' because we have the correct "name"
  14501. for ( index in value ) {
  14502. if ( !( index in props ) ) {
  14503. props[ index ] = value[ index ];
  14504. specialEasing[ index ] = easing;
  14505. }
  14506. }
  14507. } else {
  14508. specialEasing[ name ] = easing;
  14509. }
  14510. }
  14511. }
  14512. function Animation( elem, properties, options ) {
  14513. var result,
  14514. stopped,
  14515. index = 0,
  14516. length = Animation.prefilters.length,
  14517. deferred = jQuery.Deferred().always( function() {
  14518. // Don't match elem in the :animated selector
  14519. delete tick.elem;
  14520. } ),
  14521. tick = function() {
  14522. if ( stopped ) {
  14523. return false;
  14524. }
  14525. var currentTime = fxNow || createFxNow(),
  14526. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14527. // Support: Android 2.3 only
  14528. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14529. temp = remaining / animation.duration || 0,
  14530. percent = 1 - temp,
  14531. index = 0,
  14532. length = animation.tweens.length;
  14533. for ( ; index < length; index++ ) {
  14534. animation.tweens[ index ].run( percent );
  14535. }
  14536. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14537. // If there's more to do, yield
  14538. if ( percent < 1 && length ) {
  14539. return remaining;
  14540. }
  14541. // If this was an empty animation, synthesize a final progress notification
  14542. if ( !length ) {
  14543. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14544. }
  14545. // Resolve the animation and report its conclusion
  14546. deferred.resolveWith( elem, [ animation ] );
  14547. return false;
  14548. },
  14549. animation = deferred.promise( {
  14550. elem: elem,
  14551. props: jQuery.extend( {}, properties ),
  14552. opts: jQuery.extend( true, {
  14553. specialEasing: {},
  14554. easing: jQuery.easing._default
  14555. }, options ),
  14556. originalProperties: properties,
  14557. originalOptions: options,
  14558. startTime: fxNow || createFxNow(),
  14559. duration: options.duration,
  14560. tweens: [],
  14561. createTween: function( prop, end ) {
  14562. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14563. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14564. animation.tweens.push( tween );
  14565. return tween;
  14566. },
  14567. stop: function( gotoEnd ) {
  14568. var index = 0,
  14569. // If we are going to the end, we want to run all the tweens
  14570. // otherwise we skip this part
  14571. length = gotoEnd ? animation.tweens.length : 0;
  14572. if ( stopped ) {
  14573. return this;
  14574. }
  14575. stopped = true;
  14576. for ( ; index < length; index++ ) {
  14577. animation.tweens[ index ].run( 1 );
  14578. }
  14579. // Resolve when we played the last frame; otherwise, reject
  14580. if ( gotoEnd ) {
  14581. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14582. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14583. } else {
  14584. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14585. }
  14586. return this;
  14587. }
  14588. } ),
  14589. props = animation.props;
  14590. propFilter( props, animation.opts.specialEasing );
  14591. for ( ; index < length; index++ ) {
  14592. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14593. if ( result ) {
  14594. if ( isFunction( result.stop ) ) {
  14595. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14596. result.stop.bind( result );
  14597. }
  14598. return result;
  14599. }
  14600. }
  14601. jQuery.map( props, createTween, animation );
  14602. if ( isFunction( animation.opts.start ) ) {
  14603. animation.opts.start.call( elem, animation );
  14604. }
  14605. // Attach callbacks from options
  14606. animation
  14607. .progress( animation.opts.progress )
  14608. .done( animation.opts.done, animation.opts.complete )
  14609. .fail( animation.opts.fail )
  14610. .always( animation.opts.always );
  14611. jQuery.fx.timer(
  14612. jQuery.extend( tick, {
  14613. elem: elem,
  14614. anim: animation,
  14615. queue: animation.opts.queue
  14616. } )
  14617. );
  14618. return animation;
  14619. }
  14620. jQuery.Animation = jQuery.extend( Animation, {
  14621. tweeners: {
  14622. "*": [ function( prop, value ) {
  14623. var tween = this.createTween( prop, value );
  14624. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14625. return tween;
  14626. } ]
  14627. },
  14628. tweener: function( props, callback ) {
  14629. if ( isFunction( props ) ) {
  14630. callback = props;
  14631. props = [ "*" ];
  14632. } else {
  14633. props = props.match( rnothtmlwhite );
  14634. }
  14635. var prop,
  14636. index = 0,
  14637. length = props.length;
  14638. for ( ; index < length; index++ ) {
  14639. prop = props[ index ];
  14640. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14641. Animation.tweeners[ prop ].unshift( callback );
  14642. }
  14643. },
  14644. prefilters: [ defaultPrefilter ],
  14645. prefilter: function( callback, prepend ) {
  14646. if ( prepend ) {
  14647. Animation.prefilters.unshift( callback );
  14648. } else {
  14649. Animation.prefilters.push( callback );
  14650. }
  14651. }
  14652. } );
  14653. jQuery.speed = function( speed, easing, fn ) {
  14654. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14655. complete: fn || !fn && easing ||
  14656. isFunction( speed ) && speed,
  14657. duration: speed,
  14658. easing: fn && easing || easing && !isFunction( easing ) && easing
  14659. };
  14660. // Go to the end state if fx are off
  14661. if ( jQuery.fx.off ) {
  14662. opt.duration = 0;
  14663. } else {
  14664. if ( typeof opt.duration !== "number" ) {
  14665. if ( opt.duration in jQuery.fx.speeds ) {
  14666. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14667. } else {
  14668. opt.duration = jQuery.fx.speeds._default;
  14669. }
  14670. }
  14671. }
  14672. // Normalize opt.queue - true/undefined/null -> "fx"
  14673. if ( opt.queue == null || opt.queue === true ) {
  14674. opt.queue = "fx";
  14675. }
  14676. // Queueing
  14677. opt.old = opt.complete;
  14678. opt.complete = function() {
  14679. if ( isFunction( opt.old ) ) {
  14680. opt.old.call( this );
  14681. }
  14682. if ( opt.queue ) {
  14683. jQuery.dequeue( this, opt.queue );
  14684. }
  14685. };
  14686. return opt;
  14687. };
  14688. jQuery.fn.extend( {
  14689. fadeTo: function( speed, to, easing, callback ) {
  14690. // Show any hidden elements after setting opacity to 0
  14691. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14692. // Animate to the value specified
  14693. .end().animate( { opacity: to }, speed, easing, callback );
  14694. },
  14695. animate: function( prop, speed, easing, callback ) {
  14696. var empty = jQuery.isEmptyObject( prop ),
  14697. optall = jQuery.speed( speed, easing, callback ),
  14698. doAnimation = function() {
  14699. // Operate on a copy of prop so per-property easing won't be lost
  14700. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14701. // Empty animations, or finishing resolves immediately
  14702. if ( empty || dataPriv.get( this, "finish" ) ) {
  14703. anim.stop( true );
  14704. }
  14705. };
  14706. doAnimation.finish = doAnimation;
  14707. return empty || optall.queue === false ?
  14708. this.each( doAnimation ) :
  14709. this.queue( optall.queue, doAnimation );
  14710. },
  14711. stop: function( type, clearQueue, gotoEnd ) {
  14712. var stopQueue = function( hooks ) {
  14713. var stop = hooks.stop;
  14714. delete hooks.stop;
  14715. stop( gotoEnd );
  14716. };
  14717. if ( typeof type !== "string" ) {
  14718. gotoEnd = clearQueue;
  14719. clearQueue = type;
  14720. type = undefined;
  14721. }
  14722. if ( clearQueue && type !== false ) {
  14723. this.queue( type || "fx", [] );
  14724. }
  14725. return this.each( function() {
  14726. var dequeue = true,
  14727. index = type != null && type + "queueHooks",
  14728. timers = jQuery.timers,
  14729. data = dataPriv.get( this );
  14730. if ( index ) {
  14731. if ( data[ index ] && data[ index ].stop ) {
  14732. stopQueue( data[ index ] );
  14733. }
  14734. } else {
  14735. for ( index in data ) {
  14736. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14737. stopQueue( data[ index ] );
  14738. }
  14739. }
  14740. }
  14741. for ( index = timers.length; index--; ) {
  14742. if ( timers[ index ].elem === this &&
  14743. ( type == null || timers[ index ].queue === type ) ) {
  14744. timers[ index ].anim.stop( gotoEnd );
  14745. dequeue = false;
  14746. timers.splice( index, 1 );
  14747. }
  14748. }
  14749. // Start the next in the queue if the last step wasn't forced.
  14750. // Timers currently will call their complete callbacks, which
  14751. // will dequeue but only if they were gotoEnd.
  14752. if ( dequeue || !gotoEnd ) {
  14753. jQuery.dequeue( this, type );
  14754. }
  14755. } );
  14756. },
  14757. finish: function( type ) {
  14758. if ( type !== false ) {
  14759. type = type || "fx";
  14760. }
  14761. return this.each( function() {
  14762. var index,
  14763. data = dataPriv.get( this ),
  14764. queue = data[ type + "queue" ],
  14765. hooks = data[ type + "queueHooks" ],
  14766. timers = jQuery.timers,
  14767. length = queue ? queue.length : 0;
  14768. // Enable finishing flag on private data
  14769. data.finish = true;
  14770. // Empty the queue first
  14771. jQuery.queue( this, type, [] );
  14772. if ( hooks && hooks.stop ) {
  14773. hooks.stop.call( this, true );
  14774. }
  14775. // Look for any active animations, and finish them
  14776. for ( index = timers.length; index--; ) {
  14777. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14778. timers[ index ].anim.stop( true );
  14779. timers.splice( index, 1 );
  14780. }
  14781. }
  14782. // Look for any animations in the old queue and finish them
  14783. for ( index = 0; index < length; index++ ) {
  14784. if ( queue[ index ] && queue[ index ].finish ) {
  14785. queue[ index ].finish.call( this );
  14786. }
  14787. }
  14788. // Turn off finishing flag
  14789. delete data.finish;
  14790. } );
  14791. }
  14792. } );
  14793. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14794. var cssFn = jQuery.fn[ name ];
  14795. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14796. return speed == null || typeof speed === "boolean" ?
  14797. cssFn.apply( this, arguments ) :
  14798. this.animate( genFx( name, true ), speed, easing, callback );
  14799. };
  14800. } );
  14801. // Generate shortcuts for custom animations
  14802. jQuery.each( {
  14803. slideDown: genFx( "show" ),
  14804. slideUp: genFx( "hide" ),
  14805. slideToggle: genFx( "toggle" ),
  14806. fadeIn: { opacity: "show" },
  14807. fadeOut: { opacity: "hide" },
  14808. fadeToggle: { opacity: "toggle" }
  14809. }, function( name, props ) {
  14810. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14811. return this.animate( props, speed, easing, callback );
  14812. };
  14813. } );
  14814. jQuery.timers = [];
  14815. jQuery.fx.tick = function() {
  14816. var timer,
  14817. i = 0,
  14818. timers = jQuery.timers;
  14819. fxNow = Date.now();
  14820. for ( ; i < timers.length; i++ ) {
  14821. timer = timers[ i ];
  14822. // Run the timer and safely remove it when done (allowing for external removal)
  14823. if ( !timer() && timers[ i ] === timer ) {
  14824. timers.splice( i--, 1 );
  14825. }
  14826. }
  14827. if ( !timers.length ) {
  14828. jQuery.fx.stop();
  14829. }
  14830. fxNow = undefined;
  14831. };
  14832. jQuery.fx.timer = function( timer ) {
  14833. jQuery.timers.push( timer );
  14834. jQuery.fx.start();
  14835. };
  14836. jQuery.fx.interval = 13;
  14837. jQuery.fx.start = function() {
  14838. if ( inProgress ) {
  14839. return;
  14840. }
  14841. inProgress = true;
  14842. schedule();
  14843. };
  14844. jQuery.fx.stop = function() {
  14845. inProgress = null;
  14846. };
  14847. jQuery.fx.speeds = {
  14848. slow: 600,
  14849. fast: 200,
  14850. // Default speed
  14851. _default: 400
  14852. };
  14853. // Based off of the plugin by Clint Helfers, with permission.
  14854. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14855. jQuery.fn.delay = function( time, type ) {
  14856. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14857. type = type || "fx";
  14858. return this.queue( type, function( next, hooks ) {
  14859. var timeout = window.setTimeout( next, time );
  14860. hooks.stop = function() {
  14861. window.clearTimeout( timeout );
  14862. };
  14863. } );
  14864. };
  14865. ( function() {
  14866. var input = document.createElement( "input" ),
  14867. select = document.createElement( "select" ),
  14868. opt = select.appendChild( document.createElement( "option" ) );
  14869. input.type = "checkbox";
  14870. // Support: Android <=4.3 only
  14871. // Default value for a checkbox should be "on"
  14872. support.checkOn = input.value !== "";
  14873. // Support: IE <=11 only
  14874. // Must access selectedIndex to make default options select
  14875. support.optSelected = opt.selected;
  14876. // Support: IE <=11 only
  14877. // An input loses its value after becoming a radio
  14878. input = document.createElement( "input" );
  14879. input.value = "t";
  14880. input.type = "radio";
  14881. support.radioValue = input.value === "t";
  14882. } )();
  14883. var boolHook,
  14884. attrHandle = jQuery.expr.attrHandle;
  14885. jQuery.fn.extend( {
  14886. attr: function( name, value ) {
  14887. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14888. },
  14889. removeAttr: function( name ) {
  14890. return this.each( function() {
  14891. jQuery.removeAttr( this, name );
  14892. } );
  14893. }
  14894. } );
  14895. jQuery.extend( {
  14896. attr: function( elem, name, value ) {
  14897. var ret, hooks,
  14898. nType = elem.nodeType;
  14899. // Don't get/set attributes on text, comment and attribute nodes
  14900. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14901. return;
  14902. }
  14903. // Fallback to prop when attributes are not supported
  14904. if ( typeof elem.getAttribute === "undefined" ) {
  14905. return jQuery.prop( elem, name, value );
  14906. }
  14907. // Attribute hooks are determined by the lowercase version
  14908. // Grab necessary hook if one is defined
  14909. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14910. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14911. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14912. }
  14913. if ( value !== undefined ) {
  14914. if ( value === null ) {
  14915. jQuery.removeAttr( elem, name );
  14916. return;
  14917. }
  14918. if ( hooks && "set" in hooks &&
  14919. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14920. return ret;
  14921. }
  14922. elem.setAttribute( name, value + "" );
  14923. return value;
  14924. }
  14925. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14926. return ret;
  14927. }
  14928. ret = jQuery.find.attr( elem, name );
  14929. // Non-existent attributes return null, we normalize to undefined
  14930. return ret == null ? undefined : ret;
  14931. },
  14932. attrHooks: {
  14933. type: {
  14934. set: function( elem, value ) {
  14935. if ( !support.radioValue && value === "radio" &&
  14936. nodeName( elem, "input" ) ) {
  14937. var val = elem.value;
  14938. elem.setAttribute( "type", value );
  14939. if ( val ) {
  14940. elem.value = val;
  14941. }
  14942. return value;
  14943. }
  14944. }
  14945. }
  14946. },
  14947. removeAttr: function( elem, value ) {
  14948. var name,
  14949. i = 0,
  14950. // Attribute names can contain non-HTML whitespace characters
  14951. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14952. attrNames = value && value.match( rnothtmlwhite );
  14953. if ( attrNames && elem.nodeType === 1 ) {
  14954. while ( ( name = attrNames[ i++ ] ) ) {
  14955. elem.removeAttribute( name );
  14956. }
  14957. }
  14958. }
  14959. } );
  14960. // Hooks for boolean attributes
  14961. boolHook = {
  14962. set: function( elem, value, name ) {
  14963. if ( value === false ) {
  14964. // Remove boolean attributes when set to false
  14965. jQuery.removeAttr( elem, name );
  14966. } else {
  14967. elem.setAttribute( name, name );
  14968. }
  14969. return name;
  14970. }
  14971. };
  14972. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  14973. var getter = attrHandle[ name ] || jQuery.find.attr;
  14974. attrHandle[ name ] = function( elem, name, isXML ) {
  14975. var ret, handle,
  14976. lowercaseName = name.toLowerCase();
  14977. if ( !isXML ) {
  14978. // Avoid an infinite loop by temporarily removing this function from the getter
  14979. handle = attrHandle[ lowercaseName ];
  14980. attrHandle[ lowercaseName ] = ret;
  14981. ret = getter( elem, name, isXML ) != null ?
  14982. lowercaseName :
  14983. null;
  14984. attrHandle[ lowercaseName ] = handle;
  14985. }
  14986. return ret;
  14987. };
  14988. } );
  14989. var rfocusable = /^(?:input|select|textarea|button)$/i,
  14990. rclickable = /^(?:a|area)$/i;
  14991. jQuery.fn.extend( {
  14992. prop: function( name, value ) {
  14993. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  14994. },
  14995. removeProp: function( name ) {
  14996. return this.each( function() {
  14997. delete this[ jQuery.propFix[ name ] || name ];
  14998. } );
  14999. }
  15000. } );
  15001. jQuery.extend( {
  15002. prop: function( elem, name, value ) {
  15003. var ret, hooks,
  15004. nType = elem.nodeType;
  15005. // Don't get/set properties on text, comment and attribute nodes
  15006. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15007. return;
  15008. }
  15009. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15010. // Fix name and attach hooks
  15011. name = jQuery.propFix[ name ] || name;
  15012. hooks = jQuery.propHooks[ name ];
  15013. }
  15014. if ( value !== undefined ) {
  15015. if ( hooks && "set" in hooks &&
  15016. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15017. return ret;
  15018. }
  15019. return ( elem[ name ] = value );
  15020. }
  15021. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15022. return ret;
  15023. }
  15024. return elem[ name ];
  15025. },
  15026. propHooks: {
  15027. tabIndex: {
  15028. get: function( elem ) {
  15029. // Support: IE <=9 - 11 only
  15030. // elem.tabIndex doesn't always return the
  15031. // correct value when it hasn't been explicitly set
  15032. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15033. // Use proper attribute retrieval(#12072)
  15034. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15035. if ( tabindex ) {
  15036. return parseInt( tabindex, 10 );
  15037. }
  15038. if (
  15039. rfocusable.test( elem.nodeName ) ||
  15040. rclickable.test( elem.nodeName ) &&
  15041. elem.href
  15042. ) {
  15043. return 0;
  15044. }
  15045. return -1;
  15046. }
  15047. }
  15048. },
  15049. propFix: {
  15050. "for": "htmlFor",
  15051. "class": "className"
  15052. }
  15053. } );
  15054. // Support: IE <=11 only
  15055. // Accessing the selectedIndex property
  15056. // forces the browser to respect setting selected
  15057. // on the option
  15058. // The getter ensures a default option is selected
  15059. // when in an optgroup
  15060. // eslint rule "no-unused-expressions" is disabled for this code
  15061. // since it considers such accessions noop
  15062. if ( !support.optSelected ) {
  15063. jQuery.propHooks.selected = {
  15064. get: function( elem ) {
  15065. /* eslint no-unused-expressions: "off" */
  15066. var parent = elem.parentNode;
  15067. if ( parent && parent.parentNode ) {
  15068. parent.parentNode.selectedIndex;
  15069. }
  15070. return null;
  15071. },
  15072. set: function( elem ) {
  15073. /* eslint no-unused-expressions: "off" */
  15074. var parent = elem.parentNode;
  15075. if ( parent ) {
  15076. parent.selectedIndex;
  15077. if ( parent.parentNode ) {
  15078. parent.parentNode.selectedIndex;
  15079. }
  15080. }
  15081. }
  15082. };
  15083. }
  15084. jQuery.each( [
  15085. "tabIndex",
  15086. "readOnly",
  15087. "maxLength",
  15088. "cellSpacing",
  15089. "cellPadding",
  15090. "rowSpan",
  15091. "colSpan",
  15092. "useMap",
  15093. "frameBorder",
  15094. "contentEditable"
  15095. ], function() {
  15096. jQuery.propFix[ this.toLowerCase() ] = this;
  15097. } );
  15098. // Strip and collapse whitespace according to HTML spec
  15099. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15100. function stripAndCollapse( value ) {
  15101. var tokens = value.match( rnothtmlwhite ) || [];
  15102. return tokens.join( " " );
  15103. }
  15104. function getClass( elem ) {
  15105. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15106. }
  15107. function classesToArray( value ) {
  15108. if ( Array.isArray( value ) ) {
  15109. return value;
  15110. }
  15111. if ( typeof value === "string" ) {
  15112. return value.match( rnothtmlwhite ) || [];
  15113. }
  15114. return [];
  15115. }
  15116. jQuery.fn.extend( {
  15117. addClass: function( value ) {
  15118. var classes, elem, cur, curValue, clazz, j, finalValue,
  15119. i = 0;
  15120. if ( isFunction( value ) ) {
  15121. return this.each( function( j ) {
  15122. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15123. } );
  15124. }
  15125. classes = classesToArray( value );
  15126. if ( classes.length ) {
  15127. while ( ( elem = this[ i++ ] ) ) {
  15128. curValue = getClass( elem );
  15129. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15130. if ( cur ) {
  15131. j = 0;
  15132. while ( ( clazz = classes[ j++ ] ) ) {
  15133. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15134. cur += clazz + " ";
  15135. }
  15136. }
  15137. // Only assign if different to avoid unneeded rendering.
  15138. finalValue = stripAndCollapse( cur );
  15139. if ( curValue !== finalValue ) {
  15140. elem.setAttribute( "class", finalValue );
  15141. }
  15142. }
  15143. }
  15144. }
  15145. return this;
  15146. },
  15147. removeClass: function( value ) {
  15148. var classes, elem, cur, curValue, clazz, j, finalValue,
  15149. i = 0;
  15150. if ( isFunction( value ) ) {
  15151. return this.each( function( j ) {
  15152. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15153. } );
  15154. }
  15155. if ( !arguments.length ) {
  15156. return this.attr( "class", "" );
  15157. }
  15158. classes = classesToArray( value );
  15159. if ( classes.length ) {
  15160. while ( ( elem = this[ i++ ] ) ) {
  15161. curValue = getClass( elem );
  15162. // This expression is here for better compressibility (see addClass)
  15163. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15164. if ( cur ) {
  15165. j = 0;
  15166. while ( ( clazz = classes[ j++ ] ) ) {
  15167. // Remove *all* instances
  15168. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15169. cur = cur.replace( " " + clazz + " ", " " );
  15170. }
  15171. }
  15172. // Only assign if different to avoid unneeded rendering.
  15173. finalValue = stripAndCollapse( cur );
  15174. if ( curValue !== finalValue ) {
  15175. elem.setAttribute( "class", finalValue );
  15176. }
  15177. }
  15178. }
  15179. }
  15180. return this;
  15181. },
  15182. toggleClass: function( value, stateVal ) {
  15183. var type = typeof value,
  15184. isValidValue = type === "string" || Array.isArray( value );
  15185. if ( typeof stateVal === "boolean" && isValidValue ) {
  15186. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15187. }
  15188. if ( isFunction( value ) ) {
  15189. return this.each( function( i ) {
  15190. jQuery( this ).toggleClass(
  15191. value.call( this, i, getClass( this ), stateVal ),
  15192. stateVal
  15193. );
  15194. } );
  15195. }
  15196. return this.each( function() {
  15197. var className, i, self, classNames;
  15198. if ( isValidValue ) {
  15199. // Toggle individual class names
  15200. i = 0;
  15201. self = jQuery( this );
  15202. classNames = classesToArray( value );
  15203. while ( ( className = classNames[ i++ ] ) ) {
  15204. // Check each className given, space separated list
  15205. if ( self.hasClass( className ) ) {
  15206. self.removeClass( className );
  15207. } else {
  15208. self.addClass( className );
  15209. }
  15210. }
  15211. // Toggle whole class name
  15212. } else if ( value === undefined || type === "boolean" ) {
  15213. className = getClass( this );
  15214. if ( className ) {
  15215. // Store className if set
  15216. dataPriv.set( this, "__className__", className );
  15217. }
  15218. // If the element has a class name or if we're passed `false`,
  15219. // then remove the whole classname (if there was one, the above saved it).
  15220. // Otherwise bring back whatever was previously saved (if anything),
  15221. // falling back to the empty string if nothing was stored.
  15222. if ( this.setAttribute ) {
  15223. this.setAttribute( "class",
  15224. className || value === false ?
  15225. "" :
  15226. dataPriv.get( this, "__className__" ) || ""
  15227. );
  15228. }
  15229. }
  15230. } );
  15231. },
  15232. hasClass: function( selector ) {
  15233. var className, elem,
  15234. i = 0;
  15235. className = " " + selector + " ";
  15236. while ( ( elem = this[ i++ ] ) ) {
  15237. if ( elem.nodeType === 1 &&
  15238. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15239. return true;
  15240. }
  15241. }
  15242. return false;
  15243. }
  15244. } );
  15245. var rreturn = /\r/g;
  15246. jQuery.fn.extend( {
  15247. val: function( value ) {
  15248. var hooks, ret, valueIsFunction,
  15249. elem = this[ 0 ];
  15250. if ( !arguments.length ) {
  15251. if ( elem ) {
  15252. hooks = jQuery.valHooks[ elem.type ] ||
  15253. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15254. if ( hooks &&
  15255. "get" in hooks &&
  15256. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15257. ) {
  15258. return ret;
  15259. }
  15260. ret = elem.value;
  15261. // Handle most common string cases
  15262. if ( typeof ret === "string" ) {
  15263. return ret.replace( rreturn, "" );
  15264. }
  15265. // Handle cases where value is null/undef or number
  15266. return ret == null ? "" : ret;
  15267. }
  15268. return;
  15269. }
  15270. valueIsFunction = isFunction( value );
  15271. return this.each( function( i ) {
  15272. var val;
  15273. if ( this.nodeType !== 1 ) {
  15274. return;
  15275. }
  15276. if ( valueIsFunction ) {
  15277. val = value.call( this, i, jQuery( this ).val() );
  15278. } else {
  15279. val = value;
  15280. }
  15281. // Treat null/undefined as ""; convert numbers to string
  15282. if ( val == null ) {
  15283. val = "";
  15284. } else if ( typeof val === "number" ) {
  15285. val += "";
  15286. } else if ( Array.isArray( val ) ) {
  15287. val = jQuery.map( val, function( value ) {
  15288. return value == null ? "" : value + "";
  15289. } );
  15290. }
  15291. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15292. // If set returns undefined, fall back to normal setting
  15293. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15294. this.value = val;
  15295. }
  15296. } );
  15297. }
  15298. } );
  15299. jQuery.extend( {
  15300. valHooks: {
  15301. option: {
  15302. get: function( elem ) {
  15303. var val = jQuery.find.attr( elem, "value" );
  15304. return val != null ?
  15305. val :
  15306. // Support: IE <=10 - 11 only
  15307. // option.text throws exceptions (#14686, #14858)
  15308. // Strip and collapse whitespace
  15309. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15310. stripAndCollapse( jQuery.text( elem ) );
  15311. }
  15312. },
  15313. select: {
  15314. get: function( elem ) {
  15315. var value, option, i,
  15316. options = elem.options,
  15317. index = elem.selectedIndex,
  15318. one = elem.type === "select-one",
  15319. values = one ? null : [],
  15320. max = one ? index + 1 : options.length;
  15321. if ( index < 0 ) {
  15322. i = max;
  15323. } else {
  15324. i = one ? index : 0;
  15325. }
  15326. // Loop through all the selected options
  15327. for ( ; i < max; i++ ) {
  15328. option = options[ i ];
  15329. // Support: IE <=9 only
  15330. // IE8-9 doesn't update selected after form reset (#2551)
  15331. if ( ( option.selected || i === index ) &&
  15332. // Don't return options that are disabled or in a disabled optgroup
  15333. !option.disabled &&
  15334. ( !option.parentNode.disabled ||
  15335. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15336. // Get the specific value for the option
  15337. value = jQuery( option ).val();
  15338. // We don't need an array for one selects
  15339. if ( one ) {
  15340. return value;
  15341. }
  15342. // Multi-Selects return an array
  15343. values.push( value );
  15344. }
  15345. }
  15346. return values;
  15347. },
  15348. set: function( elem, value ) {
  15349. var optionSet, option,
  15350. options = elem.options,
  15351. values = jQuery.makeArray( value ),
  15352. i = options.length;
  15353. while ( i-- ) {
  15354. option = options[ i ];
  15355. /* eslint-disable no-cond-assign */
  15356. if ( option.selected =
  15357. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15358. ) {
  15359. optionSet = true;
  15360. }
  15361. /* eslint-enable no-cond-assign */
  15362. }
  15363. // Force browsers to behave consistently when non-matching value is set
  15364. if ( !optionSet ) {
  15365. elem.selectedIndex = -1;
  15366. }
  15367. return values;
  15368. }
  15369. }
  15370. }
  15371. } );
  15372. // Radios and checkboxes getter/setter
  15373. jQuery.each( [ "radio", "checkbox" ], function() {
  15374. jQuery.valHooks[ this ] = {
  15375. set: function( elem, value ) {
  15376. if ( Array.isArray( value ) ) {
  15377. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15378. }
  15379. }
  15380. };
  15381. if ( !support.checkOn ) {
  15382. jQuery.valHooks[ this ].get = function( elem ) {
  15383. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15384. };
  15385. }
  15386. } );
  15387. // Return jQuery for attributes-only inclusion
  15388. support.focusin = "onfocusin" in window;
  15389. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15390. stopPropagationCallback = function( e ) {
  15391. e.stopPropagation();
  15392. };
  15393. jQuery.extend( jQuery.event, {
  15394. trigger: function( event, data, elem, onlyHandlers ) {
  15395. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15396. eventPath = [ elem || document ],
  15397. type = hasOwn.call( event, "type" ) ? event.type : event,
  15398. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15399. cur = lastElement = tmp = elem = elem || document;
  15400. // Don't do events on text and comment nodes
  15401. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15402. return;
  15403. }
  15404. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15405. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15406. return;
  15407. }
  15408. if ( type.indexOf( "." ) > -1 ) {
  15409. // Namespaced trigger; create a regexp to match event type in handle()
  15410. namespaces = type.split( "." );
  15411. type = namespaces.shift();
  15412. namespaces.sort();
  15413. }
  15414. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15415. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15416. event = event[ jQuery.expando ] ?
  15417. event :
  15418. new jQuery.Event( type, typeof event === "object" && event );
  15419. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15420. event.isTrigger = onlyHandlers ? 2 : 3;
  15421. event.namespace = namespaces.join( "." );
  15422. event.rnamespace = event.namespace ?
  15423. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15424. null;
  15425. // Clean up the event in case it is being reused
  15426. event.result = undefined;
  15427. if ( !event.target ) {
  15428. event.target = elem;
  15429. }
  15430. // Clone any incoming data and prepend the event, creating the handler arg list
  15431. data = data == null ?
  15432. [ event ] :
  15433. jQuery.makeArray( data, [ event ] );
  15434. // Allow special events to draw outside the lines
  15435. special = jQuery.event.special[ type ] || {};
  15436. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15437. return;
  15438. }
  15439. // Determine event propagation path in advance, per W3C events spec (#9951)
  15440. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15441. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15442. bubbleType = special.delegateType || type;
  15443. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15444. cur = cur.parentNode;
  15445. }
  15446. for ( ; cur; cur = cur.parentNode ) {
  15447. eventPath.push( cur );
  15448. tmp = cur;
  15449. }
  15450. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15451. if ( tmp === ( elem.ownerDocument || document ) ) {
  15452. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15453. }
  15454. }
  15455. // Fire handlers on the event path
  15456. i = 0;
  15457. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15458. lastElement = cur;
  15459. event.type = i > 1 ?
  15460. bubbleType :
  15461. special.bindType || type;
  15462. // jQuery handler
  15463. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15464. dataPriv.get( cur, "handle" );
  15465. if ( handle ) {
  15466. handle.apply( cur, data );
  15467. }
  15468. // Native handler
  15469. handle = ontype && cur[ ontype ];
  15470. if ( handle && handle.apply && acceptData( cur ) ) {
  15471. event.result = handle.apply( cur, data );
  15472. if ( event.result === false ) {
  15473. event.preventDefault();
  15474. }
  15475. }
  15476. }
  15477. event.type = type;
  15478. // If nobody prevented the default action, do it now
  15479. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15480. if ( ( !special._default ||
  15481. special._default.apply( eventPath.pop(), data ) === false ) &&
  15482. acceptData( elem ) ) {
  15483. // Call a native DOM method on the target with the same name as the event.
  15484. // Don't do default actions on window, that's where global variables be (#6170)
  15485. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15486. // Don't re-trigger an onFOO event when we call its FOO() method
  15487. tmp = elem[ ontype ];
  15488. if ( tmp ) {
  15489. elem[ ontype ] = null;
  15490. }
  15491. // Prevent re-triggering of the same event, since we already bubbled it above
  15492. jQuery.event.triggered = type;
  15493. if ( event.isPropagationStopped() ) {
  15494. lastElement.addEventListener( type, stopPropagationCallback );
  15495. }
  15496. elem[ type ]();
  15497. if ( event.isPropagationStopped() ) {
  15498. lastElement.removeEventListener( type, stopPropagationCallback );
  15499. }
  15500. jQuery.event.triggered = undefined;
  15501. if ( tmp ) {
  15502. elem[ ontype ] = tmp;
  15503. }
  15504. }
  15505. }
  15506. }
  15507. return event.result;
  15508. },
  15509. // Piggyback on a donor event to simulate a different one
  15510. // Used only for `focus(in | out)` events
  15511. simulate: function( type, elem, event ) {
  15512. var e = jQuery.extend(
  15513. new jQuery.Event(),
  15514. event,
  15515. {
  15516. type: type,
  15517. isSimulated: true
  15518. }
  15519. );
  15520. jQuery.event.trigger( e, null, elem );
  15521. }
  15522. } );
  15523. jQuery.fn.extend( {
  15524. trigger: function( type, data ) {
  15525. return this.each( function() {
  15526. jQuery.event.trigger( type, data, this );
  15527. } );
  15528. },
  15529. triggerHandler: function( type, data ) {
  15530. var elem = this[ 0 ];
  15531. if ( elem ) {
  15532. return jQuery.event.trigger( type, data, elem, true );
  15533. }
  15534. }
  15535. } );
  15536. // Support: Firefox <=44
  15537. // Firefox doesn't have focus(in | out) events
  15538. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15539. //
  15540. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15541. // focus(in | out) events fire after focus & blur events,
  15542. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15543. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15544. if ( !support.focusin ) {
  15545. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15546. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15547. var handler = function( event ) {
  15548. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15549. };
  15550. jQuery.event.special[ fix ] = {
  15551. setup: function() {
  15552. var doc = this.ownerDocument || this,
  15553. attaches = dataPriv.access( doc, fix );
  15554. if ( !attaches ) {
  15555. doc.addEventListener( orig, handler, true );
  15556. }
  15557. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15558. },
  15559. teardown: function() {
  15560. var doc = this.ownerDocument || this,
  15561. attaches = dataPriv.access( doc, fix ) - 1;
  15562. if ( !attaches ) {
  15563. doc.removeEventListener( orig, handler, true );
  15564. dataPriv.remove( doc, fix );
  15565. } else {
  15566. dataPriv.access( doc, fix, attaches );
  15567. }
  15568. }
  15569. };
  15570. } );
  15571. }
  15572. var location = window.location;
  15573. var nonce = Date.now();
  15574. var rquery = ( /\?/ );
  15575. // Cross-browser xml parsing
  15576. jQuery.parseXML = function( data ) {
  15577. var xml;
  15578. if ( !data || typeof data !== "string" ) {
  15579. return null;
  15580. }
  15581. // Support: IE 9 - 11 only
  15582. // IE throws on parseFromString with invalid input.
  15583. try {
  15584. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15585. } catch ( e ) {
  15586. xml = undefined;
  15587. }
  15588. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15589. jQuery.error( "Invalid XML: " + data );
  15590. }
  15591. return xml;
  15592. };
  15593. var
  15594. rbracket = /\[\]$/,
  15595. rCRLF = /\r?\n/g,
  15596. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15597. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15598. function buildParams( prefix, obj, traditional, add ) {
  15599. var name;
  15600. if ( Array.isArray( obj ) ) {
  15601. // Serialize array item.
  15602. jQuery.each( obj, function( i, v ) {
  15603. if ( traditional || rbracket.test( prefix ) ) {
  15604. // Treat each array item as a scalar.
  15605. add( prefix, v );
  15606. } else {
  15607. // Item is non-scalar (array or object), encode its numeric index.
  15608. buildParams(
  15609. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15610. v,
  15611. traditional,
  15612. add
  15613. );
  15614. }
  15615. } );
  15616. } else if ( !traditional && toType( obj ) === "object" ) {
  15617. // Serialize object item.
  15618. for ( name in obj ) {
  15619. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15620. }
  15621. } else {
  15622. // Serialize scalar item.
  15623. add( prefix, obj );
  15624. }
  15625. }
  15626. // Serialize an array of form elements or a set of
  15627. // key/values into a query string
  15628. jQuery.param = function( a, traditional ) {
  15629. var prefix,
  15630. s = [],
  15631. add = function( key, valueOrFunction ) {
  15632. // If value is a function, invoke it and use its return value
  15633. var value = isFunction( valueOrFunction ) ?
  15634. valueOrFunction() :
  15635. valueOrFunction;
  15636. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15637. encodeURIComponent( value == null ? "" : value );
  15638. };
  15639. if ( a == null ) {
  15640. return "";
  15641. }
  15642. // If an array was passed in, assume that it is an array of form elements.
  15643. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15644. // Serialize the form elements
  15645. jQuery.each( a, function() {
  15646. add( this.name, this.value );
  15647. } );
  15648. } else {
  15649. // If traditional, encode the "old" way (the way 1.3.2 or older
  15650. // did it), otherwise encode params recursively.
  15651. for ( prefix in a ) {
  15652. buildParams( prefix, a[ prefix ], traditional, add );
  15653. }
  15654. }
  15655. // Return the resulting serialization
  15656. return s.join( "&" );
  15657. };
  15658. jQuery.fn.extend( {
  15659. serialize: function() {
  15660. return jQuery.param( this.serializeArray() );
  15661. },
  15662. serializeArray: function() {
  15663. return this.map( function() {
  15664. // Can add propHook for "elements" to filter or add form elements
  15665. var elements = jQuery.prop( this, "elements" );
  15666. return elements ? jQuery.makeArray( elements ) : this;
  15667. } )
  15668. .filter( function() {
  15669. var type = this.type;
  15670. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15671. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15672. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15673. ( this.checked || !rcheckableType.test( type ) );
  15674. } )
  15675. .map( function( i, elem ) {
  15676. var val = jQuery( this ).val();
  15677. if ( val == null ) {
  15678. return null;
  15679. }
  15680. if ( Array.isArray( val ) ) {
  15681. return jQuery.map( val, function( val ) {
  15682. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15683. } );
  15684. }
  15685. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15686. } ).get();
  15687. }
  15688. } );
  15689. var
  15690. r20 = /%20/g,
  15691. rhash = /#.*$/,
  15692. rantiCache = /([?&])_=[^&]*/,
  15693. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15694. // #7653, #8125, #8152: local protocol detection
  15695. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15696. rnoContent = /^(?:GET|HEAD)$/,
  15697. rprotocol = /^\/\//,
  15698. /* Prefilters
  15699. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15700. * 2) These are called:
  15701. * - BEFORE asking for a transport
  15702. * - AFTER param serialization (s.data is a string if s.processData is true)
  15703. * 3) key is the dataType
  15704. * 4) the catchall symbol "*" can be used
  15705. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15706. */
  15707. prefilters = {},
  15708. /* Transports bindings
  15709. * 1) key is the dataType
  15710. * 2) the catchall symbol "*" can be used
  15711. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15712. */
  15713. transports = {},
  15714. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15715. allTypes = "*/".concat( "*" ),
  15716. // Anchor tag for parsing the document origin
  15717. originAnchor = document.createElement( "a" );
  15718. originAnchor.href = location.href;
  15719. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15720. function addToPrefiltersOrTransports( structure ) {
  15721. // dataTypeExpression is optional and defaults to "*"
  15722. return function( dataTypeExpression, func ) {
  15723. if ( typeof dataTypeExpression !== "string" ) {
  15724. func = dataTypeExpression;
  15725. dataTypeExpression = "*";
  15726. }
  15727. var dataType,
  15728. i = 0,
  15729. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15730. if ( isFunction( func ) ) {
  15731. // For each dataType in the dataTypeExpression
  15732. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15733. // Prepend if requested
  15734. if ( dataType[ 0 ] === "+" ) {
  15735. dataType = dataType.slice( 1 ) || "*";
  15736. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15737. // Otherwise append
  15738. } else {
  15739. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15740. }
  15741. }
  15742. }
  15743. };
  15744. }
  15745. // Base inspection function for prefilters and transports
  15746. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15747. var inspected = {},
  15748. seekingTransport = ( structure === transports );
  15749. function inspect( dataType ) {
  15750. var selected;
  15751. inspected[ dataType ] = true;
  15752. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15753. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15754. if ( typeof dataTypeOrTransport === "string" &&
  15755. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15756. options.dataTypes.unshift( dataTypeOrTransport );
  15757. inspect( dataTypeOrTransport );
  15758. return false;
  15759. } else if ( seekingTransport ) {
  15760. return !( selected = dataTypeOrTransport );
  15761. }
  15762. } );
  15763. return selected;
  15764. }
  15765. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15766. }
  15767. // A special extend for ajax options
  15768. // that takes "flat" options (not to be deep extended)
  15769. // Fixes #9887
  15770. function ajaxExtend( target, src ) {
  15771. var key, deep,
  15772. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15773. for ( key in src ) {
  15774. if ( src[ key ] !== undefined ) {
  15775. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15776. }
  15777. }
  15778. if ( deep ) {
  15779. jQuery.extend( true, target, deep );
  15780. }
  15781. return target;
  15782. }
  15783. /* Handles responses to an ajax request:
  15784. * - finds the right dataType (mediates between content-type and expected dataType)
  15785. * - returns the corresponding response
  15786. */
  15787. function ajaxHandleResponses( s, jqXHR, responses ) {
  15788. var ct, type, finalDataType, firstDataType,
  15789. contents = s.contents,
  15790. dataTypes = s.dataTypes;
  15791. // Remove auto dataType and get content-type in the process
  15792. while ( dataTypes[ 0 ] === "*" ) {
  15793. dataTypes.shift();
  15794. if ( ct === undefined ) {
  15795. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15796. }
  15797. }
  15798. // Check if we're dealing with a known content-type
  15799. if ( ct ) {
  15800. for ( type in contents ) {
  15801. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15802. dataTypes.unshift( type );
  15803. break;
  15804. }
  15805. }
  15806. }
  15807. // Check to see if we have a response for the expected dataType
  15808. if ( dataTypes[ 0 ] in responses ) {
  15809. finalDataType = dataTypes[ 0 ];
  15810. } else {
  15811. // Try convertible dataTypes
  15812. for ( type in responses ) {
  15813. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15814. finalDataType = type;
  15815. break;
  15816. }
  15817. if ( !firstDataType ) {
  15818. firstDataType = type;
  15819. }
  15820. }
  15821. // Or just use first one
  15822. finalDataType = finalDataType || firstDataType;
  15823. }
  15824. // If we found a dataType
  15825. // We add the dataType to the list if needed
  15826. // and return the corresponding response
  15827. if ( finalDataType ) {
  15828. if ( finalDataType !== dataTypes[ 0 ] ) {
  15829. dataTypes.unshift( finalDataType );
  15830. }
  15831. return responses[ finalDataType ];
  15832. }
  15833. }
  15834. /* Chain conversions given the request and the original response
  15835. * Also sets the responseXXX fields on the jqXHR instance
  15836. */
  15837. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15838. var conv2, current, conv, tmp, prev,
  15839. converters = {},
  15840. // Work with a copy of dataTypes in case we need to modify it for conversion
  15841. dataTypes = s.dataTypes.slice();
  15842. // Create converters map with lowercased keys
  15843. if ( dataTypes[ 1 ] ) {
  15844. for ( conv in s.converters ) {
  15845. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15846. }
  15847. }
  15848. current = dataTypes.shift();
  15849. // Convert to each sequential dataType
  15850. while ( current ) {
  15851. if ( s.responseFields[ current ] ) {
  15852. jqXHR[ s.responseFields[ current ] ] = response;
  15853. }
  15854. // Apply the dataFilter if provided
  15855. if ( !prev && isSuccess && s.dataFilter ) {
  15856. response = s.dataFilter( response, s.dataType );
  15857. }
  15858. prev = current;
  15859. current = dataTypes.shift();
  15860. if ( current ) {
  15861. // There's only work to do if current dataType is non-auto
  15862. if ( current === "*" ) {
  15863. current = prev;
  15864. // Convert response if prev dataType is non-auto and differs from current
  15865. } else if ( prev !== "*" && prev !== current ) {
  15866. // Seek a direct converter
  15867. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15868. // If none found, seek a pair
  15869. if ( !conv ) {
  15870. for ( conv2 in converters ) {
  15871. // If conv2 outputs current
  15872. tmp = conv2.split( " " );
  15873. if ( tmp[ 1 ] === current ) {
  15874. // If prev can be converted to accepted input
  15875. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15876. converters[ "* " + tmp[ 0 ] ];
  15877. if ( conv ) {
  15878. // Condense equivalence converters
  15879. if ( conv === true ) {
  15880. conv = converters[ conv2 ];
  15881. // Otherwise, insert the intermediate dataType
  15882. } else if ( converters[ conv2 ] !== true ) {
  15883. current = tmp[ 0 ];
  15884. dataTypes.unshift( tmp[ 1 ] );
  15885. }
  15886. break;
  15887. }
  15888. }
  15889. }
  15890. }
  15891. // Apply converter (if not an equivalence)
  15892. if ( conv !== true ) {
  15893. // Unless errors are allowed to bubble, catch and return them
  15894. if ( conv && s.throws ) {
  15895. response = conv( response );
  15896. } else {
  15897. try {
  15898. response = conv( response );
  15899. } catch ( e ) {
  15900. return {
  15901. state: "parsererror",
  15902. error: conv ? e : "No conversion from " + prev + " to " + current
  15903. };
  15904. }
  15905. }
  15906. }
  15907. }
  15908. }
  15909. }
  15910. return { state: "success", data: response };
  15911. }
  15912. jQuery.extend( {
  15913. // Counter for holding the number of active queries
  15914. active: 0,
  15915. // Last-Modified header cache for next request
  15916. lastModified: {},
  15917. etag: {},
  15918. ajaxSettings: {
  15919. url: location.href,
  15920. type: "GET",
  15921. isLocal: rlocalProtocol.test( location.protocol ),
  15922. global: true,
  15923. processData: true,
  15924. async: true,
  15925. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15926. /*
  15927. timeout: 0,
  15928. data: null,
  15929. dataType: null,
  15930. username: null,
  15931. password: null,
  15932. cache: null,
  15933. throws: false,
  15934. traditional: false,
  15935. headers: {},
  15936. */
  15937. accepts: {
  15938. "*": allTypes,
  15939. text: "text/plain",
  15940. html: "text/html",
  15941. xml: "application/xml, text/xml",
  15942. json: "application/json, text/javascript"
  15943. },
  15944. contents: {
  15945. xml: /\bxml\b/,
  15946. html: /\bhtml/,
  15947. json: /\bjson\b/
  15948. },
  15949. responseFields: {
  15950. xml: "responseXML",
  15951. text: "responseText",
  15952. json: "responseJSON"
  15953. },
  15954. // Data converters
  15955. // Keys separate source (or catchall "*") and destination types with a single space
  15956. converters: {
  15957. // Convert anything to text
  15958. "* text": String,
  15959. // Text to html (true = no transformation)
  15960. "text html": true,
  15961. // Evaluate text as a json expression
  15962. "text json": JSON.parse,
  15963. // Parse text as xml
  15964. "text xml": jQuery.parseXML
  15965. },
  15966. // For options that shouldn't be deep extended:
  15967. // you can add your own custom options here if
  15968. // and when you create one that shouldn't be
  15969. // deep extended (see ajaxExtend)
  15970. flatOptions: {
  15971. url: true,
  15972. context: true
  15973. }
  15974. },
  15975. // Creates a full fledged settings object into target
  15976. // with both ajaxSettings and settings fields.
  15977. // If target is omitted, writes into ajaxSettings.
  15978. ajaxSetup: function( target, settings ) {
  15979. return settings ?
  15980. // Building a settings object
  15981. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  15982. // Extending ajaxSettings
  15983. ajaxExtend( jQuery.ajaxSettings, target );
  15984. },
  15985. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  15986. ajaxTransport: addToPrefiltersOrTransports( transports ),
  15987. // Main method
  15988. ajax: function( url, options ) {
  15989. // If url is an object, simulate pre-1.5 signature
  15990. if ( typeof url === "object" ) {
  15991. options = url;
  15992. url = undefined;
  15993. }
  15994. // Force options to be an object
  15995. options = options || {};
  15996. var transport,
  15997. // URL without anti-cache param
  15998. cacheURL,
  15999. // Response headers
  16000. responseHeadersString,
  16001. responseHeaders,
  16002. // timeout handle
  16003. timeoutTimer,
  16004. // Url cleanup var
  16005. urlAnchor,
  16006. // Request state (becomes false upon send and true upon completion)
  16007. completed,
  16008. // To know if global events are to be dispatched
  16009. fireGlobals,
  16010. // Loop variable
  16011. i,
  16012. // uncached part of the url
  16013. uncached,
  16014. // Create the final options object
  16015. s = jQuery.ajaxSetup( {}, options ),
  16016. // Callbacks context
  16017. callbackContext = s.context || s,
  16018. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16019. globalEventContext = s.context &&
  16020. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16021. jQuery( callbackContext ) :
  16022. jQuery.event,
  16023. // Deferreds
  16024. deferred = jQuery.Deferred(),
  16025. completeDeferred = jQuery.Callbacks( "once memory" ),
  16026. // Status-dependent callbacks
  16027. statusCode = s.statusCode || {},
  16028. // Headers (they are sent all at once)
  16029. requestHeaders = {},
  16030. requestHeadersNames = {},
  16031. // Default abort message
  16032. strAbort = "canceled",
  16033. // Fake xhr
  16034. jqXHR = {
  16035. readyState: 0,
  16036. // Builds headers hashtable if needed
  16037. getResponseHeader: function( key ) {
  16038. var match;
  16039. if ( completed ) {
  16040. if ( !responseHeaders ) {
  16041. responseHeaders = {};
  16042. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16043. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16044. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16045. .concat( match[ 2 ] );
  16046. }
  16047. }
  16048. match = responseHeaders[ key.toLowerCase() + " " ];
  16049. }
  16050. return match == null ? null : match.join( ", " );
  16051. },
  16052. // Raw string
  16053. getAllResponseHeaders: function() {
  16054. return completed ? responseHeadersString : null;
  16055. },
  16056. // Caches the header
  16057. setRequestHeader: function( name, value ) {
  16058. if ( completed == null ) {
  16059. name = requestHeadersNames[ name.toLowerCase() ] =
  16060. requestHeadersNames[ name.toLowerCase() ] || name;
  16061. requestHeaders[ name ] = value;
  16062. }
  16063. return this;
  16064. },
  16065. // Overrides response content-type header
  16066. overrideMimeType: function( type ) {
  16067. if ( completed == null ) {
  16068. s.mimeType = type;
  16069. }
  16070. return this;
  16071. },
  16072. // Status-dependent callbacks
  16073. statusCode: function( map ) {
  16074. var code;
  16075. if ( map ) {
  16076. if ( completed ) {
  16077. // Execute the appropriate callbacks
  16078. jqXHR.always( map[ jqXHR.status ] );
  16079. } else {
  16080. // Lazy-add the new callbacks in a way that preserves old ones
  16081. for ( code in map ) {
  16082. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16083. }
  16084. }
  16085. }
  16086. return this;
  16087. },
  16088. // Cancel the request
  16089. abort: function( statusText ) {
  16090. var finalText = statusText || strAbort;
  16091. if ( transport ) {
  16092. transport.abort( finalText );
  16093. }
  16094. done( 0, finalText );
  16095. return this;
  16096. }
  16097. };
  16098. // Attach deferreds
  16099. deferred.promise( jqXHR );
  16100. // Add protocol if not provided (prefilters might expect it)
  16101. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16102. // We also use the url parameter if available
  16103. s.url = ( ( url || s.url || location.href ) + "" )
  16104. .replace( rprotocol, location.protocol + "//" );
  16105. // Alias method option to type as per ticket #12004
  16106. s.type = options.method || options.type || s.method || s.type;
  16107. // Extract dataTypes list
  16108. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16109. // A cross-domain request is in order when the origin doesn't match the current origin.
  16110. if ( s.crossDomain == null ) {
  16111. urlAnchor = document.createElement( "a" );
  16112. // Support: IE <=8 - 11, Edge 12 - 15
  16113. // IE throws exception on accessing the href property if url is malformed,
  16114. // e.g. http://example.com:80x/
  16115. try {
  16116. urlAnchor.href = s.url;
  16117. // Support: IE <=8 - 11 only
  16118. // Anchor's host property isn't correctly set when s.url is relative
  16119. urlAnchor.href = urlAnchor.href;
  16120. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16121. urlAnchor.protocol + "//" + urlAnchor.host;
  16122. } catch ( e ) {
  16123. // If there is an error parsing the URL, assume it is crossDomain,
  16124. // it can be rejected by the transport if it is invalid
  16125. s.crossDomain = true;
  16126. }
  16127. }
  16128. // Convert data if not already a string
  16129. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16130. s.data = jQuery.param( s.data, s.traditional );
  16131. }
  16132. // Apply prefilters
  16133. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16134. // If request was aborted inside a prefilter, stop there
  16135. if ( completed ) {
  16136. return jqXHR;
  16137. }
  16138. // We can fire global events as of now if asked to
  16139. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16140. fireGlobals = jQuery.event && s.global;
  16141. // Watch for a new set of requests
  16142. if ( fireGlobals && jQuery.active++ === 0 ) {
  16143. jQuery.event.trigger( "ajaxStart" );
  16144. }
  16145. // Uppercase the type
  16146. s.type = s.type.toUpperCase();
  16147. // Determine if request has content
  16148. s.hasContent = !rnoContent.test( s.type );
  16149. // Save the URL in case we're toying with the If-Modified-Since
  16150. // and/or If-None-Match header later on
  16151. // Remove hash to simplify url manipulation
  16152. cacheURL = s.url.replace( rhash, "" );
  16153. // More options handling for requests with no content
  16154. if ( !s.hasContent ) {
  16155. // Remember the hash so we can put it back
  16156. uncached = s.url.slice( cacheURL.length );
  16157. // If data is available and should be processed, append data to url
  16158. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16159. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16160. // #9682: remove data so that it's not used in an eventual retry
  16161. delete s.data;
  16162. }
  16163. // Add or update anti-cache param if needed
  16164. if ( s.cache === false ) {
  16165. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16166. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16167. }
  16168. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16169. s.url = cacheURL + uncached;
  16170. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16171. } else if ( s.data && s.processData &&
  16172. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16173. s.data = s.data.replace( r20, "+" );
  16174. }
  16175. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16176. if ( s.ifModified ) {
  16177. if ( jQuery.lastModified[ cacheURL ] ) {
  16178. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16179. }
  16180. if ( jQuery.etag[ cacheURL ] ) {
  16181. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16182. }
  16183. }
  16184. // Set the correct header, if data is being sent
  16185. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16186. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16187. }
  16188. // Set the Accepts header for the server, depending on the dataType
  16189. jqXHR.setRequestHeader(
  16190. "Accept",
  16191. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16192. s.accepts[ s.dataTypes[ 0 ] ] +
  16193. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16194. s.accepts[ "*" ]
  16195. );
  16196. // Check for headers option
  16197. for ( i in s.headers ) {
  16198. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16199. }
  16200. // Allow custom headers/mimetypes and early abort
  16201. if ( s.beforeSend &&
  16202. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16203. // Abort if not done already and return
  16204. return jqXHR.abort();
  16205. }
  16206. // Aborting is no longer a cancellation
  16207. strAbort = "abort";
  16208. // Install callbacks on deferreds
  16209. completeDeferred.add( s.complete );
  16210. jqXHR.done( s.success );
  16211. jqXHR.fail( s.error );
  16212. // Get transport
  16213. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16214. // If no transport, we auto-abort
  16215. if ( !transport ) {
  16216. done( -1, "No Transport" );
  16217. } else {
  16218. jqXHR.readyState = 1;
  16219. // Send global event
  16220. if ( fireGlobals ) {
  16221. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16222. }
  16223. // If request was aborted inside ajaxSend, stop there
  16224. if ( completed ) {
  16225. return jqXHR;
  16226. }
  16227. // Timeout
  16228. if ( s.async && s.timeout > 0 ) {
  16229. timeoutTimer = window.setTimeout( function() {
  16230. jqXHR.abort( "timeout" );
  16231. }, s.timeout );
  16232. }
  16233. try {
  16234. completed = false;
  16235. transport.send( requestHeaders, done );
  16236. } catch ( e ) {
  16237. // Rethrow post-completion exceptions
  16238. if ( completed ) {
  16239. throw e;
  16240. }
  16241. // Propagate others as results
  16242. done( -1, e );
  16243. }
  16244. }
  16245. // Callback for when everything is done
  16246. function done( status, nativeStatusText, responses, headers ) {
  16247. var isSuccess, success, error, response, modified,
  16248. statusText = nativeStatusText;
  16249. // Ignore repeat invocations
  16250. if ( completed ) {
  16251. return;
  16252. }
  16253. completed = true;
  16254. // Clear timeout if it exists
  16255. if ( timeoutTimer ) {
  16256. window.clearTimeout( timeoutTimer );
  16257. }
  16258. // Dereference transport for early garbage collection
  16259. // (no matter how long the jqXHR object will be used)
  16260. transport = undefined;
  16261. // Cache response headers
  16262. responseHeadersString = headers || "";
  16263. // Set readyState
  16264. jqXHR.readyState = status > 0 ? 4 : 0;
  16265. // Determine if successful
  16266. isSuccess = status >= 200 && status < 300 || status === 304;
  16267. // Get response data
  16268. if ( responses ) {
  16269. response = ajaxHandleResponses( s, jqXHR, responses );
  16270. }
  16271. // Convert no matter what (that way responseXXX fields are always set)
  16272. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16273. // If successful, handle type chaining
  16274. if ( isSuccess ) {
  16275. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16276. if ( s.ifModified ) {
  16277. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16278. if ( modified ) {
  16279. jQuery.lastModified[ cacheURL ] = modified;
  16280. }
  16281. modified = jqXHR.getResponseHeader( "etag" );
  16282. if ( modified ) {
  16283. jQuery.etag[ cacheURL ] = modified;
  16284. }
  16285. }
  16286. // if no content
  16287. if ( status === 204 || s.type === "HEAD" ) {
  16288. statusText = "nocontent";
  16289. // if not modified
  16290. } else if ( status === 304 ) {
  16291. statusText = "notmodified";
  16292. // If we have data, let's convert it
  16293. } else {
  16294. statusText = response.state;
  16295. success = response.data;
  16296. error = response.error;
  16297. isSuccess = !error;
  16298. }
  16299. } else {
  16300. // Extract error from statusText and normalize for non-aborts
  16301. error = statusText;
  16302. if ( status || !statusText ) {
  16303. statusText = "error";
  16304. if ( status < 0 ) {
  16305. status = 0;
  16306. }
  16307. }
  16308. }
  16309. // Set data for the fake xhr object
  16310. jqXHR.status = status;
  16311. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16312. // Success/Error
  16313. if ( isSuccess ) {
  16314. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16315. } else {
  16316. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16317. }
  16318. // Status-dependent callbacks
  16319. jqXHR.statusCode( statusCode );
  16320. statusCode = undefined;
  16321. if ( fireGlobals ) {
  16322. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16323. [ jqXHR, s, isSuccess ? success : error ] );
  16324. }
  16325. // Complete
  16326. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16327. if ( fireGlobals ) {
  16328. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16329. // Handle the global AJAX counter
  16330. if ( !( --jQuery.active ) ) {
  16331. jQuery.event.trigger( "ajaxStop" );
  16332. }
  16333. }
  16334. }
  16335. return jqXHR;
  16336. },
  16337. getJSON: function( url, data, callback ) {
  16338. return jQuery.get( url, data, callback, "json" );
  16339. },
  16340. getScript: function( url, callback ) {
  16341. return jQuery.get( url, undefined, callback, "script" );
  16342. }
  16343. } );
  16344. jQuery.each( [ "get", "post" ], function( i, method ) {
  16345. jQuery[ method ] = function( url, data, callback, type ) {
  16346. // Shift arguments if data argument was omitted
  16347. if ( isFunction( data ) ) {
  16348. type = type || callback;
  16349. callback = data;
  16350. data = undefined;
  16351. }
  16352. // The url can be an options object (which then must have .url)
  16353. return jQuery.ajax( jQuery.extend( {
  16354. url: url,
  16355. type: method,
  16356. dataType: type,
  16357. data: data,
  16358. success: callback
  16359. }, jQuery.isPlainObject( url ) && url ) );
  16360. };
  16361. } );
  16362. jQuery._evalUrl = function( url, options ) {
  16363. return jQuery.ajax( {
  16364. url: url,
  16365. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16366. type: "GET",
  16367. dataType: "script",
  16368. cache: true,
  16369. async: false,
  16370. global: false,
  16371. // Only evaluate the response if it is successful (gh-4126)
  16372. // dataFilter is not invoked for failure responses, so using it instead
  16373. // of the default converter is kludgy but it works.
  16374. converters: {
  16375. "text script": function() {}
  16376. },
  16377. dataFilter: function( response ) {
  16378. jQuery.globalEval( response, options );
  16379. }
  16380. } );
  16381. };
  16382. jQuery.fn.extend( {
  16383. wrapAll: function( html ) {
  16384. var wrap;
  16385. if ( this[ 0 ] ) {
  16386. if ( isFunction( html ) ) {
  16387. html = html.call( this[ 0 ] );
  16388. }
  16389. // The elements to wrap the target around
  16390. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16391. if ( this[ 0 ].parentNode ) {
  16392. wrap.insertBefore( this[ 0 ] );
  16393. }
  16394. wrap.map( function() {
  16395. var elem = this;
  16396. while ( elem.firstElementChild ) {
  16397. elem = elem.firstElementChild;
  16398. }
  16399. return elem;
  16400. } ).append( this );
  16401. }
  16402. return this;
  16403. },
  16404. wrapInner: function( html ) {
  16405. if ( isFunction( html ) ) {
  16406. return this.each( function( i ) {
  16407. jQuery( this ).wrapInner( html.call( this, i ) );
  16408. } );
  16409. }
  16410. return this.each( function() {
  16411. var self = jQuery( this ),
  16412. contents = self.contents();
  16413. if ( contents.length ) {
  16414. contents.wrapAll( html );
  16415. } else {
  16416. self.append( html );
  16417. }
  16418. } );
  16419. },
  16420. wrap: function( html ) {
  16421. var htmlIsFunction = isFunction( html );
  16422. return this.each( function( i ) {
  16423. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16424. } );
  16425. },
  16426. unwrap: function( selector ) {
  16427. this.parent( selector ).not( "body" ).each( function() {
  16428. jQuery( this ).replaceWith( this.childNodes );
  16429. } );
  16430. return this;
  16431. }
  16432. } );
  16433. jQuery.expr.pseudos.hidden = function( elem ) {
  16434. return !jQuery.expr.pseudos.visible( elem );
  16435. };
  16436. jQuery.expr.pseudos.visible = function( elem ) {
  16437. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16438. };
  16439. jQuery.ajaxSettings.xhr = function() {
  16440. try {
  16441. return new window.XMLHttpRequest();
  16442. } catch ( e ) {}
  16443. };
  16444. var xhrSuccessStatus = {
  16445. // File protocol always yields status code 0, assume 200
  16446. 0: 200,
  16447. // Support: IE <=9 only
  16448. // #1450: sometimes IE returns 1223 when it should be 204
  16449. 1223: 204
  16450. },
  16451. xhrSupported = jQuery.ajaxSettings.xhr();
  16452. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16453. support.ajax = xhrSupported = !!xhrSupported;
  16454. jQuery.ajaxTransport( function( options ) {
  16455. var callback, errorCallback;
  16456. // Cross domain only allowed if supported through XMLHttpRequest
  16457. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16458. return {
  16459. send: function( headers, complete ) {
  16460. var i,
  16461. xhr = options.xhr();
  16462. xhr.open(
  16463. options.type,
  16464. options.url,
  16465. options.async,
  16466. options.username,
  16467. options.password
  16468. );
  16469. // Apply custom fields if provided
  16470. if ( options.xhrFields ) {
  16471. for ( i in options.xhrFields ) {
  16472. xhr[ i ] = options.xhrFields[ i ];
  16473. }
  16474. }
  16475. // Override mime type if needed
  16476. if ( options.mimeType && xhr.overrideMimeType ) {
  16477. xhr.overrideMimeType( options.mimeType );
  16478. }
  16479. // X-Requested-With header
  16480. // For cross-domain requests, seeing as conditions for a preflight are
  16481. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16482. // (it can always be set on a per-request basis or even using ajaxSetup)
  16483. // For same-domain requests, won't change header if already provided.
  16484. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16485. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16486. }
  16487. // Set headers
  16488. for ( i in headers ) {
  16489. xhr.setRequestHeader( i, headers[ i ] );
  16490. }
  16491. // Callback
  16492. callback = function( type ) {
  16493. return function() {
  16494. if ( callback ) {
  16495. callback = errorCallback = xhr.onload =
  16496. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16497. xhr.onreadystatechange = null;
  16498. if ( type === "abort" ) {
  16499. xhr.abort();
  16500. } else if ( type === "error" ) {
  16501. // Support: IE <=9 only
  16502. // On a manual native abort, IE9 throws
  16503. // errors on any property access that is not readyState
  16504. if ( typeof xhr.status !== "number" ) {
  16505. complete( 0, "error" );
  16506. } else {
  16507. complete(
  16508. // File: protocol always yields status 0; see #8605, #14207
  16509. xhr.status,
  16510. xhr.statusText
  16511. );
  16512. }
  16513. } else {
  16514. complete(
  16515. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16516. xhr.statusText,
  16517. // Support: IE <=9 only
  16518. // IE9 has no XHR2 but throws on binary (trac-11426)
  16519. // For XHR2 non-text, let the caller handle it (gh-2498)
  16520. ( xhr.responseType || "text" ) !== "text" ||
  16521. typeof xhr.responseText !== "string" ?
  16522. { binary: xhr.response } :
  16523. { text: xhr.responseText },
  16524. xhr.getAllResponseHeaders()
  16525. );
  16526. }
  16527. }
  16528. };
  16529. };
  16530. // Listen to events
  16531. xhr.onload = callback();
  16532. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16533. // Support: IE 9 only
  16534. // Use onreadystatechange to replace onabort
  16535. // to handle uncaught aborts
  16536. if ( xhr.onabort !== undefined ) {
  16537. xhr.onabort = errorCallback;
  16538. } else {
  16539. xhr.onreadystatechange = function() {
  16540. // Check readyState before timeout as it changes
  16541. if ( xhr.readyState === 4 ) {
  16542. // Allow onerror to be called first,
  16543. // but that will not handle a native abort
  16544. // Also, save errorCallback to a variable
  16545. // as xhr.onerror cannot be accessed
  16546. window.setTimeout( function() {
  16547. if ( callback ) {
  16548. errorCallback();
  16549. }
  16550. } );
  16551. }
  16552. };
  16553. }
  16554. // Create the abort callback
  16555. callback = callback( "abort" );
  16556. try {
  16557. // Do send the request (this may raise an exception)
  16558. xhr.send( options.hasContent && options.data || null );
  16559. } catch ( e ) {
  16560. // #14683: Only rethrow if this hasn't been notified as an error yet
  16561. if ( callback ) {
  16562. throw e;
  16563. }
  16564. }
  16565. },
  16566. abort: function() {
  16567. if ( callback ) {
  16568. callback();
  16569. }
  16570. }
  16571. };
  16572. }
  16573. } );
  16574. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16575. jQuery.ajaxPrefilter( function( s ) {
  16576. if ( s.crossDomain ) {
  16577. s.contents.script = false;
  16578. }
  16579. } );
  16580. // Install script dataType
  16581. jQuery.ajaxSetup( {
  16582. accepts: {
  16583. script: "text/javascript, application/javascript, " +
  16584. "application/ecmascript, application/x-ecmascript"
  16585. },
  16586. contents: {
  16587. script: /\b(?:java|ecma)script\b/
  16588. },
  16589. converters: {
  16590. "text script": function( text ) {
  16591. jQuery.globalEval( text );
  16592. return text;
  16593. }
  16594. }
  16595. } );
  16596. // Handle cache's special case and crossDomain
  16597. jQuery.ajaxPrefilter( "script", function( s ) {
  16598. if ( s.cache === undefined ) {
  16599. s.cache = false;
  16600. }
  16601. if ( s.crossDomain ) {
  16602. s.type = "GET";
  16603. }
  16604. } );
  16605. // Bind script tag hack transport
  16606. jQuery.ajaxTransport( "script", function( s ) {
  16607. // This transport only deals with cross domain or forced-by-attrs requests
  16608. if ( s.crossDomain || s.scriptAttrs ) {
  16609. var script, callback;
  16610. return {
  16611. send: function( _, complete ) {
  16612. script = jQuery( "<script>" )
  16613. .attr( s.scriptAttrs || {} )
  16614. .prop( { charset: s.scriptCharset, src: s.url } )
  16615. .on( "load error", callback = function( evt ) {
  16616. script.remove();
  16617. callback = null;
  16618. if ( evt ) {
  16619. complete( evt.type === "error" ? 404 : 200, evt.type );
  16620. }
  16621. } );
  16622. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16623. document.head.appendChild( script[ 0 ] );
  16624. },
  16625. abort: function() {
  16626. if ( callback ) {
  16627. callback();
  16628. }
  16629. }
  16630. };
  16631. }
  16632. } );
  16633. var oldCallbacks = [],
  16634. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16635. // Default jsonp settings
  16636. jQuery.ajaxSetup( {
  16637. jsonp: "callback",
  16638. jsonpCallback: function() {
  16639. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16640. this[ callback ] = true;
  16641. return callback;
  16642. }
  16643. } );
  16644. // Detect, normalize options and install callbacks for jsonp requests
  16645. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16646. var callbackName, overwritten, responseContainer,
  16647. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16648. "url" :
  16649. typeof s.data === "string" &&
  16650. ( s.contentType || "" )
  16651. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16652. rjsonp.test( s.data ) && "data"
  16653. );
  16654. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16655. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16656. // Get callback name, remembering preexisting value associated with it
  16657. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16658. s.jsonpCallback() :
  16659. s.jsonpCallback;
  16660. // Insert callback into url or form data
  16661. if ( jsonProp ) {
  16662. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16663. } else if ( s.jsonp !== false ) {
  16664. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16665. }
  16666. // Use data converter to retrieve json after script execution
  16667. s.converters[ "script json" ] = function() {
  16668. if ( !responseContainer ) {
  16669. jQuery.error( callbackName + " was not called" );
  16670. }
  16671. return responseContainer[ 0 ];
  16672. };
  16673. // Force json dataType
  16674. s.dataTypes[ 0 ] = "json";
  16675. // Install callback
  16676. overwritten = window[ callbackName ];
  16677. window[ callbackName ] = function() {
  16678. responseContainer = arguments;
  16679. };
  16680. // Clean-up function (fires after converters)
  16681. jqXHR.always( function() {
  16682. // If previous value didn't exist - remove it
  16683. if ( overwritten === undefined ) {
  16684. jQuery( window ).removeProp( callbackName );
  16685. // Otherwise restore preexisting value
  16686. } else {
  16687. window[ callbackName ] = overwritten;
  16688. }
  16689. // Save back as free
  16690. if ( s[ callbackName ] ) {
  16691. // Make sure that re-using the options doesn't screw things around
  16692. s.jsonpCallback = originalSettings.jsonpCallback;
  16693. // Save the callback name for future use
  16694. oldCallbacks.push( callbackName );
  16695. }
  16696. // Call if it was a function and we have a response
  16697. if ( responseContainer && isFunction( overwritten ) ) {
  16698. overwritten( responseContainer[ 0 ] );
  16699. }
  16700. responseContainer = overwritten = undefined;
  16701. } );
  16702. // Delegate to script
  16703. return "script";
  16704. }
  16705. } );
  16706. // Support: Safari 8 only
  16707. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16708. // collapse sibling forms: the second one becomes a child of the first one.
  16709. // Because of that, this security measure has to be disabled in Safari 8.
  16710. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16711. support.createHTMLDocument = ( function() {
  16712. var body = document.implementation.createHTMLDocument( "" ).body;
  16713. body.innerHTML = "<form></form><form></form>";
  16714. return body.childNodes.length === 2;
  16715. } )();
  16716. // Argument "data" should be string of html
  16717. // context (optional): If specified, the fragment will be created in this context,
  16718. // defaults to document
  16719. // keepScripts (optional): If true, will include scripts passed in the html string
  16720. jQuery.parseHTML = function( data, context, keepScripts ) {
  16721. if ( typeof data !== "string" ) {
  16722. return [];
  16723. }
  16724. if ( typeof context === "boolean" ) {
  16725. keepScripts = context;
  16726. context = false;
  16727. }
  16728. var base, parsed, scripts;
  16729. if ( !context ) {
  16730. // Stop scripts or inline event handlers from being executed immediately
  16731. // by using document.implementation
  16732. if ( support.createHTMLDocument ) {
  16733. context = document.implementation.createHTMLDocument( "" );
  16734. // Set the base href for the created document
  16735. // so any parsed elements with URLs
  16736. // are based on the document's URL (gh-2965)
  16737. base = context.createElement( "base" );
  16738. base.href = document.location.href;
  16739. context.head.appendChild( base );
  16740. } else {
  16741. context = document;
  16742. }
  16743. }
  16744. parsed = rsingleTag.exec( data );
  16745. scripts = !keepScripts && [];
  16746. // Single tag
  16747. if ( parsed ) {
  16748. return [ context.createElement( parsed[ 1 ] ) ];
  16749. }
  16750. parsed = buildFragment( [ data ], context, scripts );
  16751. if ( scripts && scripts.length ) {
  16752. jQuery( scripts ).remove();
  16753. }
  16754. return jQuery.merge( [], parsed.childNodes );
  16755. };
  16756. /**
  16757. * Load a url into a page
  16758. */
  16759. jQuery.fn.load = function( url, params, callback ) {
  16760. var selector, type, response,
  16761. self = this,
  16762. off = url.indexOf( " " );
  16763. if ( off > -1 ) {
  16764. selector = stripAndCollapse( url.slice( off ) );
  16765. url = url.slice( 0, off );
  16766. }
  16767. // If it's a function
  16768. if ( isFunction( params ) ) {
  16769. // We assume that it's the callback
  16770. callback = params;
  16771. params = undefined;
  16772. // Otherwise, build a param string
  16773. } else if ( params && typeof params === "object" ) {
  16774. type = "POST";
  16775. }
  16776. // If we have elements to modify, make the request
  16777. if ( self.length > 0 ) {
  16778. jQuery.ajax( {
  16779. url: url,
  16780. // If "type" variable is undefined, then "GET" method will be used.
  16781. // Make value of this field explicit since
  16782. // user can override it through ajaxSetup method
  16783. type: type || "GET",
  16784. dataType: "html",
  16785. data: params
  16786. } ).done( function( responseText ) {
  16787. // Save response for use in complete callback
  16788. response = arguments;
  16789. self.html( selector ?
  16790. // If a selector was specified, locate the right elements in a dummy div
  16791. // Exclude scripts to avoid IE 'Permission Denied' errors
  16792. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16793. // Otherwise use the full result
  16794. responseText );
  16795. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16796. // but they are ignored because response was set above.
  16797. // If it fails, this function gets "jqXHR", "status", "error"
  16798. } ).always( callback && function( jqXHR, status ) {
  16799. self.each( function() {
  16800. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16801. } );
  16802. } );
  16803. }
  16804. return this;
  16805. };
  16806. // Attach a bunch of functions for handling common AJAX events
  16807. jQuery.each( [
  16808. "ajaxStart",
  16809. "ajaxStop",
  16810. "ajaxComplete",
  16811. "ajaxError",
  16812. "ajaxSuccess",
  16813. "ajaxSend"
  16814. ], function( i, type ) {
  16815. jQuery.fn[ type ] = function( fn ) {
  16816. return this.on( type, fn );
  16817. };
  16818. } );
  16819. jQuery.expr.pseudos.animated = function( elem ) {
  16820. return jQuery.grep( jQuery.timers, function( fn ) {
  16821. return elem === fn.elem;
  16822. } ).length;
  16823. };
  16824. jQuery.offset = {
  16825. setOffset: function( elem, options, i ) {
  16826. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16827. position = jQuery.css( elem, "position" ),
  16828. curElem = jQuery( elem ),
  16829. props = {};
  16830. // Set position first, in-case top/left are set even on static elem
  16831. if ( position === "static" ) {
  16832. elem.style.position = "relative";
  16833. }
  16834. curOffset = curElem.offset();
  16835. curCSSTop = jQuery.css( elem, "top" );
  16836. curCSSLeft = jQuery.css( elem, "left" );
  16837. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16838. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16839. // Need to be able to calculate position if either
  16840. // top or left is auto and position is either absolute or fixed
  16841. if ( calculatePosition ) {
  16842. curPosition = curElem.position();
  16843. curTop = curPosition.top;
  16844. curLeft = curPosition.left;
  16845. } else {
  16846. curTop = parseFloat( curCSSTop ) || 0;
  16847. curLeft = parseFloat( curCSSLeft ) || 0;
  16848. }
  16849. if ( isFunction( options ) ) {
  16850. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16851. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16852. }
  16853. if ( options.top != null ) {
  16854. props.top = ( options.top - curOffset.top ) + curTop;
  16855. }
  16856. if ( options.left != null ) {
  16857. props.left = ( options.left - curOffset.left ) + curLeft;
  16858. }
  16859. if ( "using" in options ) {
  16860. options.using.call( elem, props );
  16861. } else {
  16862. curElem.css( props );
  16863. }
  16864. }
  16865. };
  16866. jQuery.fn.extend( {
  16867. // offset() relates an element's border box to the document origin
  16868. offset: function( options ) {
  16869. // Preserve chaining for setter
  16870. if ( arguments.length ) {
  16871. return options === undefined ?
  16872. this :
  16873. this.each( function( i ) {
  16874. jQuery.offset.setOffset( this, options, i );
  16875. } );
  16876. }
  16877. var rect, win,
  16878. elem = this[ 0 ];
  16879. if ( !elem ) {
  16880. return;
  16881. }
  16882. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16883. // Support: IE <=11 only
  16884. // Running getBoundingClientRect on a
  16885. // disconnected node in IE throws an error
  16886. if ( !elem.getClientRects().length ) {
  16887. return { top: 0, left: 0 };
  16888. }
  16889. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16890. rect = elem.getBoundingClientRect();
  16891. win = elem.ownerDocument.defaultView;
  16892. return {
  16893. top: rect.top + win.pageYOffset,
  16894. left: rect.left + win.pageXOffset
  16895. };
  16896. },
  16897. // position() relates an element's margin box to its offset parent's padding box
  16898. // This corresponds to the behavior of CSS absolute positioning
  16899. position: function() {
  16900. if ( !this[ 0 ] ) {
  16901. return;
  16902. }
  16903. var offsetParent, offset, doc,
  16904. elem = this[ 0 ],
  16905. parentOffset = { top: 0, left: 0 };
  16906. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16907. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16908. // Assume position:fixed implies availability of getBoundingClientRect
  16909. offset = elem.getBoundingClientRect();
  16910. } else {
  16911. offset = this.offset();
  16912. // Account for the *real* offset parent, which can be the document or its root element
  16913. // when a statically positioned element is identified
  16914. doc = elem.ownerDocument;
  16915. offsetParent = elem.offsetParent || doc.documentElement;
  16916. while ( offsetParent &&
  16917. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16918. jQuery.css( offsetParent, "position" ) === "static" ) {
  16919. offsetParent = offsetParent.parentNode;
  16920. }
  16921. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16922. // Incorporate borders into its offset, since they are outside its content origin
  16923. parentOffset = jQuery( offsetParent ).offset();
  16924. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16925. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16926. }
  16927. }
  16928. // Subtract parent offsets and element margins
  16929. return {
  16930. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16931. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16932. };
  16933. },
  16934. // This method will return documentElement in the following cases:
  16935. // 1) For the element inside the iframe without offsetParent, this method will return
  16936. // documentElement of the parent window
  16937. // 2) For the hidden or detached element
  16938. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16939. //
  16940. // but those exceptions were never presented as a real life use-cases
  16941. // and might be considered as more preferable results.
  16942. //
  16943. // This logic, however, is not guaranteed and can change at any point in the future
  16944. offsetParent: function() {
  16945. return this.map( function() {
  16946. var offsetParent = this.offsetParent;
  16947. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16948. offsetParent = offsetParent.offsetParent;
  16949. }
  16950. return offsetParent || documentElement;
  16951. } );
  16952. }
  16953. } );
  16954. // Create scrollLeft and scrollTop methods
  16955. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16956. var top = "pageYOffset" === prop;
  16957. jQuery.fn[ method ] = function( val ) {
  16958. return access( this, function( elem, method, val ) {
  16959. // Coalesce documents and windows
  16960. var win;
  16961. if ( isWindow( elem ) ) {
  16962. win = elem;
  16963. } else if ( elem.nodeType === 9 ) {
  16964. win = elem.defaultView;
  16965. }
  16966. if ( val === undefined ) {
  16967. return win ? win[ prop ] : elem[ method ];
  16968. }
  16969. if ( win ) {
  16970. win.scrollTo(
  16971. !top ? val : win.pageXOffset,
  16972. top ? val : win.pageYOffset
  16973. );
  16974. } else {
  16975. elem[ method ] = val;
  16976. }
  16977. }, method, val, arguments.length );
  16978. };
  16979. } );
  16980. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  16981. // Add the top/left cssHooks using jQuery.fn.position
  16982. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  16983. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  16984. // getComputedStyle returns percent when specified for top/left/bottom/right;
  16985. // rather than make the css module depend on the offset module, just check for it here
  16986. jQuery.each( [ "top", "left" ], function( i, prop ) {
  16987. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  16988. function( elem, computed ) {
  16989. if ( computed ) {
  16990. computed = curCSS( elem, prop );
  16991. // If curCSS returns percentage, fallback to offset
  16992. return rnumnonpx.test( computed ) ?
  16993. jQuery( elem ).position()[ prop ] + "px" :
  16994. computed;
  16995. }
  16996. }
  16997. );
  16998. } );
  16999. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17000. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17001. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17002. function( defaultExtra, funcName ) {
  17003. // Margin is only for outerHeight, outerWidth
  17004. jQuery.fn[ funcName ] = function( margin, value ) {
  17005. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17006. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17007. return access( this, function( elem, type, value ) {
  17008. var doc;
  17009. if ( isWindow( elem ) ) {
  17010. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17011. return funcName.indexOf( "outer" ) === 0 ?
  17012. elem[ "inner" + name ] :
  17013. elem.document.documentElement[ "client" + name ];
  17014. }
  17015. // Get document width or height
  17016. if ( elem.nodeType === 9 ) {
  17017. doc = elem.documentElement;
  17018. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17019. // whichever is greatest
  17020. return Math.max(
  17021. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17022. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17023. doc[ "client" + name ]
  17024. );
  17025. }
  17026. return value === undefined ?
  17027. // Get width or height on the element, requesting but not forcing parseFloat
  17028. jQuery.css( elem, type, extra ) :
  17029. // Set width or height on the element
  17030. jQuery.style( elem, type, value, extra );
  17031. }, type, chainable ? margin : undefined, chainable );
  17032. };
  17033. } );
  17034. } );
  17035. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17036. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17037. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17038. function( i, name ) {
  17039. // Handle event binding
  17040. jQuery.fn[ name ] = function( data, fn ) {
  17041. return arguments.length > 0 ?
  17042. this.on( name, null, data, fn ) :
  17043. this.trigger( name );
  17044. };
  17045. } );
  17046. jQuery.fn.extend( {
  17047. hover: function( fnOver, fnOut ) {
  17048. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17049. }
  17050. } );
  17051. jQuery.fn.extend( {
  17052. bind: function( types, data, fn ) {
  17053. return this.on( types, null, data, fn );
  17054. },
  17055. unbind: function( types, fn ) {
  17056. return this.off( types, null, fn );
  17057. },
  17058. delegate: function( selector, types, data, fn ) {
  17059. return this.on( types, selector, data, fn );
  17060. },
  17061. undelegate: function( selector, types, fn ) {
  17062. // ( namespace ) or ( selector, types [, fn] )
  17063. return arguments.length === 1 ?
  17064. this.off( selector, "**" ) :
  17065. this.off( types, selector || "**", fn );
  17066. }
  17067. } );
  17068. // Bind a function to a context, optionally partially applying any
  17069. // arguments.
  17070. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17071. // However, it is not slated for removal any time soon
  17072. jQuery.proxy = function( fn, context ) {
  17073. var tmp, args, proxy;
  17074. if ( typeof context === "string" ) {
  17075. tmp = fn[ context ];
  17076. context = fn;
  17077. fn = tmp;
  17078. }
  17079. // Quick check to determine if target is callable, in the spec
  17080. // this throws a TypeError, but we will just return undefined.
  17081. if ( !isFunction( fn ) ) {
  17082. return undefined;
  17083. }
  17084. // Simulated bind
  17085. args = slice.call( arguments, 2 );
  17086. proxy = function() {
  17087. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17088. };
  17089. // Set the guid of unique handler to the same of original handler, so it can be removed
  17090. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17091. return proxy;
  17092. };
  17093. jQuery.holdReady = function( hold ) {
  17094. if ( hold ) {
  17095. jQuery.readyWait++;
  17096. } else {
  17097. jQuery.ready( true );
  17098. }
  17099. };
  17100. jQuery.isArray = Array.isArray;
  17101. jQuery.parseJSON = JSON.parse;
  17102. jQuery.nodeName = nodeName;
  17103. jQuery.isFunction = isFunction;
  17104. jQuery.isWindow = isWindow;
  17105. jQuery.camelCase = camelCase;
  17106. jQuery.type = toType;
  17107. jQuery.now = Date.now;
  17108. jQuery.isNumeric = function( obj ) {
  17109. // As of jQuery 3.0, isNumeric is limited to
  17110. // strings and numbers (primitives or objects)
  17111. // that can be coerced to finite numbers (gh-2662)
  17112. var type = jQuery.type( obj );
  17113. return ( type === "number" || type === "string" ) &&
  17114. // parseFloat NaNs numeric-cast false positives ("")
  17115. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17116. // subtraction forces infinities to NaN
  17117. !isNaN( obj - parseFloat( obj ) );
  17118. };
  17119. // Register as a named AMD module, since jQuery can be concatenated with other
  17120. // files that may use define, but not via a proper concatenation script that
  17121. // understands anonymous AMD modules. A named AMD is safest and most robust
  17122. // way to register. Lowercase jquery is used because AMD module names are
  17123. // derived from file names, and jQuery is normally delivered in a lowercase
  17124. // file name. Do this after creating the global so that if an AMD module wants
  17125. // to call noConflict to hide this version of jQuery, it will work.
  17126. // Note that for maximum portability, libraries that are not jQuery should
  17127. // declare themselves as anonymous modules, and avoid setting a global if an
  17128. // AMD loader is present. jQuery is a special case. For more information, see
  17129. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17130. if ( true ) {
  17131. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17132. return jQuery;
  17133. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17134. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17135. }
  17136. var
  17137. // Map over jQuery in case of overwrite
  17138. _jQuery = window.jQuery,
  17139. // Map over the $ in case of overwrite
  17140. _$ = window.$;
  17141. jQuery.noConflict = function( deep ) {
  17142. if ( window.$ === jQuery ) {
  17143. window.$ = _$;
  17144. }
  17145. if ( deep && window.jQuery === jQuery ) {
  17146. window.jQuery = _jQuery;
  17147. }
  17148. return jQuery;
  17149. };
  17150. // Expose jQuery and $ identifiers, even in AMD
  17151. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17152. // and CommonJS for browser emulators (#13566)
  17153. if ( !noGlobal ) {
  17154. window.jQuery = window.$ = jQuery;
  17155. }
  17156. return jQuery;
  17157. } );
  17158. /***/ }),
  17159. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17160. /*!************************************************!*\
  17161. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17162. \************************************************/
  17163. /*! exports provided: default */
  17164. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17165. "use strict";
  17166. __webpack_require__.r(__webpack_exports__);
  17167. var classCallCheck = function (instance, Constructor) {
  17168. if (!(instance instanceof Constructor)) {
  17169. throw new TypeError("Cannot call a class as a function");
  17170. }
  17171. };
  17172. var createClass = function () {
  17173. function defineProperties(target, props) {
  17174. for (var i = 0; i < props.length; i++) {
  17175. var descriptor = props[i];
  17176. descriptor.enumerable = descriptor.enumerable || false;
  17177. descriptor.configurable = true;
  17178. if ("value" in descriptor) descriptor.writable = true;
  17179. Object.defineProperty(target, descriptor.key, descriptor);
  17180. }
  17181. }
  17182. return function (Constructor, protoProps, staticProps) {
  17183. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17184. if (staticProps) defineProperties(Constructor, staticProps);
  17185. return Constructor;
  17186. };
  17187. }();
  17188. var _extends = Object.assign || function (target) {
  17189. for (var i = 1; i < arguments.length; i++) {
  17190. var source = arguments[i];
  17191. for (var key in source) {
  17192. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17193. target[key] = source[key];
  17194. }
  17195. }
  17196. }
  17197. return target;
  17198. };
  17199. var inherits = function (subClass, superClass) {
  17200. if (typeof superClass !== "function" && superClass !== null) {
  17201. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17202. }
  17203. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17204. constructor: {
  17205. value: subClass,
  17206. enumerable: false,
  17207. writable: true,
  17208. configurable: true
  17209. }
  17210. });
  17211. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17212. };
  17213. var possibleConstructorReturn = function (self, call) {
  17214. if (!self) {
  17215. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17216. }
  17217. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17218. };
  17219. var Connector = function () {
  17220. /**
  17221. * Create a new class instance.
  17222. */
  17223. function Connector(options) {
  17224. classCallCheck(this, Connector);
  17225. /**
  17226. * Default connector options.
  17227. */
  17228. this._defaultOptions = {
  17229. auth: {
  17230. headers: {}
  17231. },
  17232. authEndpoint: '/broadcasting/auth',
  17233. broadcaster: 'pusher',
  17234. csrfToken: null,
  17235. host: null,
  17236. key: null,
  17237. namespace: 'App.Events'
  17238. };
  17239. this.setOptions(options);
  17240. this.connect();
  17241. }
  17242. /**
  17243. * Merge the custom options with the defaults.
  17244. */
  17245. createClass(Connector, [{
  17246. key: 'setOptions',
  17247. value: function setOptions(options) {
  17248. this.options = _extends(this._defaultOptions, options);
  17249. if (this.csrfToken()) {
  17250. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17251. }
  17252. return options;
  17253. }
  17254. /**
  17255. * Extract the CSRF token from the page.
  17256. */
  17257. }, {
  17258. key: 'csrfToken',
  17259. value: function csrfToken() {
  17260. var selector = void 0;
  17261. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17262. return window['Laravel'].csrfToken;
  17263. } else if (this.options.csrfToken) {
  17264. return this.options.csrfToken;
  17265. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17266. return selector.getAttribute('content');
  17267. }
  17268. return null;
  17269. }
  17270. }]);
  17271. return Connector;
  17272. }();
  17273. /**
  17274. * This class represents a basic channel.
  17275. */
  17276. var Channel = function () {
  17277. function Channel() {
  17278. classCallCheck(this, Channel);
  17279. }
  17280. createClass(Channel, [{
  17281. key: 'listenForWhisper',
  17282. /**
  17283. * Listen for a whisper event on the channel instance.
  17284. */
  17285. value: function listenForWhisper(event, callback) {
  17286. return this.listen('.client-' + event, callback);
  17287. }
  17288. /**
  17289. * Listen for an event on the channel instance.
  17290. */
  17291. }, {
  17292. key: 'notification',
  17293. value: function notification(callback) {
  17294. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17295. }
  17296. /**
  17297. * Stop listening for a whispser event on the channel instance.
  17298. */
  17299. }, {
  17300. key: 'stopListeningForWhisper',
  17301. value: function stopListeningForWhisper(event) {
  17302. return this.stopListening('.client-' + event);
  17303. }
  17304. }]);
  17305. return Channel;
  17306. }();
  17307. /**
  17308. * Event name formatter
  17309. */
  17310. var EventFormatter = function () {
  17311. /**
  17312. * Create a new class instance.
  17313. */
  17314. function EventFormatter(namespace) {
  17315. classCallCheck(this, EventFormatter);
  17316. this.setNamespace(namespace);
  17317. }
  17318. /**
  17319. * Format the given event name.
  17320. */
  17321. createClass(EventFormatter, [{
  17322. key: 'format',
  17323. value: function format(event) {
  17324. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17325. return event.substr(1);
  17326. } else if (this.namespace) {
  17327. event = this.namespace + '.' + event;
  17328. }
  17329. return event.replace(/\./g, '\\');
  17330. }
  17331. /**
  17332. * Set the event namespace.
  17333. */
  17334. }, {
  17335. key: 'setNamespace',
  17336. value: function setNamespace(value) {
  17337. this.namespace = value;
  17338. }
  17339. }]);
  17340. return EventFormatter;
  17341. }();
  17342. /**
  17343. * This class represents a Pusher channel.
  17344. */
  17345. var PusherChannel = function (_Channel) {
  17346. inherits(PusherChannel, _Channel);
  17347. /**
  17348. * Create a new class instance.
  17349. */
  17350. function PusherChannel(pusher, name, options) {
  17351. classCallCheck(this, PusherChannel);
  17352. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17353. _this.name = name;
  17354. _this.pusher = pusher;
  17355. _this.options = options;
  17356. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17357. _this.subscribe();
  17358. return _this;
  17359. }
  17360. /**
  17361. * Subscribe to a Pusher channel.
  17362. */
  17363. createClass(PusherChannel, [{
  17364. key: 'subscribe',
  17365. value: function subscribe() {
  17366. this.subscription = this.pusher.subscribe(this.name);
  17367. }
  17368. /**
  17369. * Unsubscribe from a Pusher channel.
  17370. */
  17371. }, {
  17372. key: 'unsubscribe',
  17373. value: function unsubscribe() {
  17374. this.pusher.unsubscribe(this.name);
  17375. }
  17376. /**
  17377. * Listen for an event on the channel instance.
  17378. */
  17379. }, {
  17380. key: 'listen',
  17381. value: function listen(event, callback) {
  17382. this.on(this.eventFormatter.format(event), callback);
  17383. return this;
  17384. }
  17385. /**
  17386. * Stop listening for an event on the channel instance.
  17387. */
  17388. }, {
  17389. key: 'stopListening',
  17390. value: function stopListening(event) {
  17391. this.subscription.unbind(this.eventFormatter.format(event));
  17392. return this;
  17393. }
  17394. /**
  17395. * Bind a channel to an event.
  17396. */
  17397. }, {
  17398. key: 'on',
  17399. value: function on(event, callback) {
  17400. this.subscription.bind(event, callback);
  17401. return this;
  17402. }
  17403. }]);
  17404. return PusherChannel;
  17405. }(Channel);
  17406. /**
  17407. * This class represents a Pusher private channel.
  17408. */
  17409. var PusherPrivateChannel = function (_PusherChannel) {
  17410. inherits(PusherPrivateChannel, _PusherChannel);
  17411. function PusherPrivateChannel() {
  17412. classCallCheck(this, PusherPrivateChannel);
  17413. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17414. }
  17415. createClass(PusherPrivateChannel, [{
  17416. key: 'whisper',
  17417. /**
  17418. * Trigger client event on the channel.
  17419. */
  17420. value: function whisper(eventName, data) {
  17421. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17422. return this;
  17423. }
  17424. }]);
  17425. return PusherPrivateChannel;
  17426. }(PusherChannel);
  17427. /**
  17428. * This class represents a Pusher presence channel.
  17429. */
  17430. var PusherPresenceChannel = function (_PusherChannel) {
  17431. inherits(PusherPresenceChannel, _PusherChannel);
  17432. function PusherPresenceChannel() {
  17433. classCallCheck(this, PusherPresenceChannel);
  17434. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17435. }
  17436. createClass(PusherPresenceChannel, [{
  17437. key: 'here',
  17438. /**
  17439. * Register a callback to be called anytime the member list changes.
  17440. */
  17441. value: function here(callback) {
  17442. this.on('pusher:subscription_succeeded', function (data) {
  17443. callback(Object.keys(data.members).map(function (k) {
  17444. return data.members[k];
  17445. }));
  17446. });
  17447. return this;
  17448. }
  17449. /**
  17450. * Listen for someone joining the channel.
  17451. */
  17452. }, {
  17453. key: 'joining',
  17454. value: function joining(callback) {
  17455. this.on('pusher:member_added', function (member) {
  17456. callback(member.info);
  17457. });
  17458. return this;
  17459. }
  17460. /**
  17461. * Listen for someone leaving the channel.
  17462. */
  17463. }, {
  17464. key: 'leaving',
  17465. value: function leaving(callback) {
  17466. this.on('pusher:member_removed', function (member) {
  17467. callback(member.info);
  17468. });
  17469. return this;
  17470. }
  17471. /**
  17472. * Trigger client event on the channel.
  17473. */
  17474. }, {
  17475. key: 'whisper',
  17476. value: function whisper(eventName, data) {
  17477. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17478. return this;
  17479. }
  17480. }]);
  17481. return PusherPresenceChannel;
  17482. }(PusherChannel);
  17483. /**
  17484. * This class represents a Socket.io channel.
  17485. */
  17486. var SocketIoChannel = function (_Channel) {
  17487. inherits(SocketIoChannel, _Channel);
  17488. /**
  17489. * Create a new class instance.
  17490. */
  17491. function SocketIoChannel(socket, name, options) {
  17492. classCallCheck(this, SocketIoChannel);
  17493. /**
  17494. * The event callbacks applied to the channel.
  17495. */
  17496. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17497. _this.events = {};
  17498. _this.name = name;
  17499. _this.socket = socket;
  17500. _this.options = options;
  17501. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17502. _this.subscribe();
  17503. _this.configureReconnector();
  17504. return _this;
  17505. }
  17506. /**
  17507. * Subscribe to a Socket.io channel.
  17508. */
  17509. createClass(SocketIoChannel, [{
  17510. key: 'subscribe',
  17511. value: function subscribe() {
  17512. this.socket.emit('subscribe', {
  17513. channel: this.name,
  17514. auth: this.options.auth || {}
  17515. });
  17516. }
  17517. /**
  17518. * Unsubscribe from channel and ubind event callbacks.
  17519. */
  17520. }, {
  17521. key: 'unsubscribe',
  17522. value: function unsubscribe() {
  17523. this.unbind();
  17524. this.socket.emit('unsubscribe', {
  17525. channel: this.name,
  17526. auth: this.options.auth || {}
  17527. });
  17528. }
  17529. /**
  17530. * Listen for an event on the channel instance.
  17531. */
  17532. }, {
  17533. key: 'listen',
  17534. value: function listen(event, callback) {
  17535. this.on(this.eventFormatter.format(event), callback);
  17536. return this;
  17537. }
  17538. /**
  17539. * Stop listening for an event on the channel instance.
  17540. */
  17541. }, {
  17542. key: 'stopListening',
  17543. value: function stopListening(event) {
  17544. var name = this.eventFormatter.format(event);
  17545. this.socket.removeListener(name);
  17546. delete this.events[name];
  17547. return this;
  17548. }
  17549. /**
  17550. * Bind the channel's socket to an event and store the callback.
  17551. */
  17552. }, {
  17553. key: 'on',
  17554. value: function on(event, callback) {
  17555. var _this2 = this;
  17556. var listener = function listener(channel, data) {
  17557. if (_this2.name == channel) {
  17558. callback(data);
  17559. }
  17560. };
  17561. this.socket.on(event, listener);
  17562. this.bind(event, listener);
  17563. }
  17564. /**
  17565. * Attach a 'reconnect' listener and bind the event.
  17566. */
  17567. }, {
  17568. key: 'configureReconnector',
  17569. value: function configureReconnector() {
  17570. var _this3 = this;
  17571. var listener = function listener() {
  17572. _this3.subscribe();
  17573. };
  17574. this.socket.on('reconnect', listener);
  17575. this.bind('reconnect', listener);
  17576. }
  17577. /**
  17578. * Bind the channel's socket to an event and store the callback.
  17579. */
  17580. }, {
  17581. key: 'bind',
  17582. value: function bind(event, callback) {
  17583. this.events[event] = this.events[event] || [];
  17584. this.events[event].push(callback);
  17585. }
  17586. /**
  17587. * Unbind the channel's socket from all stored event callbacks.
  17588. */
  17589. }, {
  17590. key: 'unbind',
  17591. value: function unbind() {
  17592. var _this4 = this;
  17593. Object.keys(this.events).forEach(function (event) {
  17594. _this4.events[event].forEach(function (callback) {
  17595. _this4.socket.removeListener(event, callback);
  17596. });
  17597. delete _this4.events[event];
  17598. });
  17599. }
  17600. }]);
  17601. return SocketIoChannel;
  17602. }(Channel);
  17603. /**
  17604. * This class represents a Socket.io presence channel.
  17605. */
  17606. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17607. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17608. function SocketIoPrivateChannel() {
  17609. classCallCheck(this, SocketIoPrivateChannel);
  17610. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17611. }
  17612. createClass(SocketIoPrivateChannel, [{
  17613. key: 'whisper',
  17614. /**
  17615. * Trigger client event on the channel.
  17616. */
  17617. value: function whisper(eventName, data) {
  17618. this.socket.emit('client event', {
  17619. channel: this.name,
  17620. event: 'client-' + eventName,
  17621. data: data
  17622. });
  17623. return this;
  17624. }
  17625. }]);
  17626. return SocketIoPrivateChannel;
  17627. }(SocketIoChannel);
  17628. /**
  17629. * This class represents a Socket.io presence channel.
  17630. */
  17631. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17632. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17633. function SocketIoPresenceChannel() {
  17634. classCallCheck(this, SocketIoPresenceChannel);
  17635. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17636. }
  17637. createClass(SocketIoPresenceChannel, [{
  17638. key: 'here',
  17639. /**
  17640. * Register a callback to be called anytime the member list changes.
  17641. */
  17642. value: function here(callback) {
  17643. this.on('presence:subscribed', function (members) {
  17644. callback(members.map(function (m) {
  17645. return m.user_info;
  17646. }));
  17647. });
  17648. return this;
  17649. }
  17650. /**
  17651. * Listen for someone joining the channel.
  17652. */
  17653. }, {
  17654. key: 'joining',
  17655. value: function joining(callback) {
  17656. this.on('presence:joining', function (member) {
  17657. return callback(member.user_info);
  17658. });
  17659. return this;
  17660. }
  17661. /**
  17662. * Listen for someone leaving the channel.
  17663. */
  17664. }, {
  17665. key: 'leaving',
  17666. value: function leaving(callback) {
  17667. this.on('presence:leaving', function (member) {
  17668. return callback(member.user_info);
  17669. });
  17670. return this;
  17671. }
  17672. }]);
  17673. return SocketIoPresenceChannel;
  17674. }(SocketIoPrivateChannel);
  17675. /**
  17676. * This class represents a null channel.
  17677. */
  17678. var NullChannel = function (_Channel) {
  17679. inherits(NullChannel, _Channel);
  17680. function NullChannel() {
  17681. classCallCheck(this, NullChannel);
  17682. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17683. }
  17684. createClass(NullChannel, [{
  17685. key: 'subscribe',
  17686. /**
  17687. * Subscribe to a channel.
  17688. */
  17689. value: function subscribe() {}
  17690. //
  17691. /**
  17692. * Unsubscribe from a channel.
  17693. */
  17694. }, {
  17695. key: 'unsubscribe',
  17696. value: function unsubscribe() {}
  17697. //
  17698. /**
  17699. * Listen for an event on the channel instance.
  17700. */
  17701. }, {
  17702. key: 'listen',
  17703. value: function listen(event, callback) {
  17704. return this;
  17705. }
  17706. /**
  17707. * Stop listening for an event on the channel instance.
  17708. */
  17709. }, {
  17710. key: 'stopListening',
  17711. value: function stopListening(event) {
  17712. return this;
  17713. }
  17714. /**
  17715. * Bind a channel to an event.
  17716. */
  17717. }, {
  17718. key: 'on',
  17719. value: function on(event, callback) {
  17720. return this;
  17721. }
  17722. }]);
  17723. return NullChannel;
  17724. }(Channel);
  17725. /**
  17726. * This class represents a null private channel.
  17727. */
  17728. var NullPrivateChannel = function (_NullChannel) {
  17729. inherits(NullPrivateChannel, _NullChannel);
  17730. function NullPrivateChannel() {
  17731. classCallCheck(this, NullPrivateChannel);
  17732. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17733. }
  17734. createClass(NullPrivateChannel, [{
  17735. key: 'whisper',
  17736. /**
  17737. * Trigger client event on the channel.
  17738. */
  17739. value: function whisper(eventName, data) {
  17740. return this;
  17741. }
  17742. }]);
  17743. return NullPrivateChannel;
  17744. }(NullChannel);
  17745. /**
  17746. * This class represents a null presence channel.
  17747. */
  17748. var NullPresenceChannel = function (_NullChannel) {
  17749. inherits(NullPresenceChannel, _NullChannel);
  17750. function NullPresenceChannel() {
  17751. classCallCheck(this, NullPresenceChannel);
  17752. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17753. }
  17754. createClass(NullPresenceChannel, [{
  17755. key: 'here',
  17756. /**
  17757. * Register a callback to be called anytime the member list changes.
  17758. */
  17759. value: function here(callback) {
  17760. return this;
  17761. }
  17762. /**
  17763. * Listen for someone joining the channel.
  17764. */
  17765. }, {
  17766. key: 'joining',
  17767. value: function joining(callback) {
  17768. return this;
  17769. }
  17770. /**
  17771. * Listen for someone leaving the channel.
  17772. */
  17773. }, {
  17774. key: 'leaving',
  17775. value: function leaving(callback) {
  17776. return this;
  17777. }
  17778. /**
  17779. * Trigger client event on the channel.
  17780. */
  17781. }, {
  17782. key: 'whisper',
  17783. value: function whisper(eventName, data) {
  17784. return this;
  17785. }
  17786. }]);
  17787. return NullPresenceChannel;
  17788. }(NullChannel);
  17789. /**
  17790. * This class creates a connector to Pusher.
  17791. */
  17792. var PusherConnector = function (_Connector) {
  17793. inherits(PusherConnector, _Connector);
  17794. function PusherConnector() {
  17795. classCallCheck(this, PusherConnector);
  17796. /**
  17797. * All of the subscribed channel names.
  17798. */
  17799. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17800. _this.channels = {};
  17801. return _this;
  17802. }
  17803. /**
  17804. * Create a fresh Pusher connection.
  17805. */
  17806. createClass(PusherConnector, [{
  17807. key: 'connect',
  17808. value: function connect() {
  17809. if (typeof this.options.client !== 'undefined') {
  17810. this.pusher = this.options.client;
  17811. } else {
  17812. this.pusher = new Pusher(this.options.key, this.options);
  17813. }
  17814. }
  17815. /**
  17816. * Listen for an event on a channel instance.
  17817. */
  17818. }, {
  17819. key: 'listen',
  17820. value: function listen(name, event, callback) {
  17821. return this.channel(name).listen(event, callback);
  17822. }
  17823. /**
  17824. * Get a channel instance by name.
  17825. */
  17826. }, {
  17827. key: 'channel',
  17828. value: function channel(name) {
  17829. if (!this.channels[name]) {
  17830. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17831. }
  17832. return this.channels[name];
  17833. }
  17834. /**
  17835. * Get a private channel instance by name.
  17836. */
  17837. }, {
  17838. key: 'privateChannel',
  17839. value: function privateChannel(name) {
  17840. if (!this.channels['private-' + name]) {
  17841. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17842. }
  17843. return this.channels['private-' + name];
  17844. }
  17845. /**
  17846. * Get a presence channel instance by name.
  17847. */
  17848. }, {
  17849. key: 'presenceChannel',
  17850. value: function presenceChannel(name) {
  17851. if (!this.channels['presence-' + name]) {
  17852. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17853. }
  17854. return this.channels['presence-' + name];
  17855. }
  17856. /**
  17857. * Leave the given channel, as well as its private and presence variants.
  17858. */
  17859. }, {
  17860. key: 'leave',
  17861. value: function leave(name) {
  17862. var _this2 = this;
  17863. var channels = [name, 'private-' + name, 'presence-' + name];
  17864. channels.forEach(function (name, index) {
  17865. _this2.leaveChannel(name);
  17866. });
  17867. }
  17868. /**
  17869. * Leave the given channel.
  17870. */
  17871. }, {
  17872. key: 'leaveChannel',
  17873. value: function leaveChannel(name) {
  17874. if (this.channels[name]) {
  17875. this.channels[name].unsubscribe();
  17876. delete this.channels[name];
  17877. }
  17878. }
  17879. /**
  17880. * Get the socket ID for the connection.
  17881. */
  17882. }, {
  17883. key: 'socketId',
  17884. value: function socketId() {
  17885. return this.pusher.connection.socket_id;
  17886. }
  17887. /**
  17888. * Disconnect Pusher connection.
  17889. */
  17890. }, {
  17891. key: 'disconnect',
  17892. value: function disconnect() {
  17893. this.pusher.disconnect();
  17894. }
  17895. }]);
  17896. return PusherConnector;
  17897. }(Connector);
  17898. /**
  17899. * This class creates a connnector to a Socket.io server.
  17900. */
  17901. var SocketIoConnector = function (_Connector) {
  17902. inherits(SocketIoConnector, _Connector);
  17903. function SocketIoConnector() {
  17904. classCallCheck(this, SocketIoConnector);
  17905. /**
  17906. * All of the subscribed channel names.
  17907. */
  17908. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17909. _this.channels = {};
  17910. return _this;
  17911. }
  17912. /**
  17913. * Create a fresh Socket.io connection.
  17914. */
  17915. createClass(SocketIoConnector, [{
  17916. key: 'connect',
  17917. value: function connect() {
  17918. var io = this.getSocketIO();
  17919. this.socket = io(this.options.host, this.options);
  17920. return this.socket;
  17921. }
  17922. /**
  17923. * Get socket.io module from global scope or options.
  17924. */
  17925. }, {
  17926. key: 'getSocketIO',
  17927. value: function getSocketIO() {
  17928. if (typeof this.options.client !== 'undefined') {
  17929. return this.options.client;
  17930. }
  17931. if (typeof io !== 'undefined') {
  17932. return io;
  17933. }
  17934. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17935. }
  17936. /**
  17937. * Listen for an event on a channel instance.
  17938. */
  17939. }, {
  17940. key: 'listen',
  17941. value: function listen(name, event, callback) {
  17942. return this.channel(name).listen(event, callback);
  17943. }
  17944. /**
  17945. * Get a channel instance by name.
  17946. */
  17947. }, {
  17948. key: 'channel',
  17949. value: function channel(name) {
  17950. if (!this.channels[name]) {
  17951. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17952. }
  17953. return this.channels[name];
  17954. }
  17955. /**
  17956. * Get a private channel instance by name.
  17957. */
  17958. }, {
  17959. key: 'privateChannel',
  17960. value: function privateChannel(name) {
  17961. if (!this.channels['private-' + name]) {
  17962. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17963. }
  17964. return this.channels['private-' + name];
  17965. }
  17966. /**
  17967. * Get a presence channel instance by name.
  17968. */
  17969. }, {
  17970. key: 'presenceChannel',
  17971. value: function presenceChannel(name) {
  17972. if (!this.channels['presence-' + name]) {
  17973. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  17974. }
  17975. return this.channels['presence-' + name];
  17976. }
  17977. /**
  17978. * Leave the given channel, as well as its private and presence variants.
  17979. */
  17980. }, {
  17981. key: 'leave',
  17982. value: function leave(name) {
  17983. var _this2 = this;
  17984. var channels = [name, 'private-' + name, 'presence-' + name];
  17985. channels.forEach(function (name) {
  17986. _this2.leaveChannel(name);
  17987. });
  17988. }
  17989. /**
  17990. * Leave the given channel.
  17991. */
  17992. }, {
  17993. key: 'leaveChannel',
  17994. value: function leaveChannel(name) {
  17995. if (this.channels[name]) {
  17996. this.channels[name].unsubscribe();
  17997. delete this.channels[name];
  17998. }
  17999. }
  18000. /**
  18001. * Get the socket ID for the connection.
  18002. */
  18003. }, {
  18004. key: 'socketId',
  18005. value: function socketId() {
  18006. return this.socket.id;
  18007. }
  18008. /**
  18009. * Disconnect Socketio connection.
  18010. */
  18011. }, {
  18012. key: 'disconnect',
  18013. value: function disconnect() {
  18014. this.socket.disconnect();
  18015. }
  18016. }]);
  18017. return SocketIoConnector;
  18018. }(Connector);
  18019. /**
  18020. * This class creates a null connector.
  18021. */
  18022. var NullConnector = function (_Connector) {
  18023. inherits(NullConnector, _Connector);
  18024. function NullConnector() {
  18025. classCallCheck(this, NullConnector);
  18026. /**
  18027. * All of the subscribed channel names.
  18028. */
  18029. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18030. _this.channels = {};
  18031. return _this;
  18032. }
  18033. /**
  18034. * Create a fresh connection.
  18035. */
  18036. createClass(NullConnector, [{
  18037. key: 'connect',
  18038. value: function connect() {}
  18039. //
  18040. /**
  18041. * Listen for an event on a channel instance.
  18042. */
  18043. }, {
  18044. key: 'listen',
  18045. value: function listen(name, event, callback) {
  18046. return new NullChannel();
  18047. }
  18048. /**
  18049. * Get a channel instance by name.
  18050. */
  18051. }, {
  18052. key: 'channel',
  18053. value: function channel(name) {
  18054. return new NullChannel();
  18055. }
  18056. /**
  18057. * Get a private channel instance by name.
  18058. */
  18059. }, {
  18060. key: 'privateChannel',
  18061. value: function privateChannel(name) {
  18062. return new NullPrivateChannel();
  18063. }
  18064. /**
  18065. * Get a presence channel instance by name.
  18066. */
  18067. }, {
  18068. key: 'presenceChannel',
  18069. value: function presenceChannel(name) {
  18070. return new NullPresenceChannel();
  18071. }
  18072. /**
  18073. * Leave the given channel, as well as its private and presence variants.
  18074. */
  18075. }, {
  18076. key: 'leave',
  18077. value: function leave(name) {}
  18078. //
  18079. /**
  18080. * Leave the given channel.
  18081. */
  18082. }, {
  18083. key: 'leaveChannel',
  18084. value: function leaveChannel(name) {}
  18085. //
  18086. /**
  18087. * Get the socket ID for the connection.
  18088. */
  18089. }, {
  18090. key: 'socketId',
  18091. value: function socketId() {
  18092. return 'fake-socket-id';
  18093. }
  18094. /**
  18095. * Disconnect the connection.
  18096. */
  18097. }, {
  18098. key: 'disconnect',
  18099. value: function disconnect() {
  18100. //
  18101. }
  18102. }]);
  18103. return NullConnector;
  18104. }(Connector);
  18105. /**
  18106. * This class is the primary API for interacting with broadcasting.
  18107. */
  18108. var Echo = function () {
  18109. /**
  18110. * Create a new class instance.
  18111. */
  18112. function Echo(options) {
  18113. classCallCheck(this, Echo);
  18114. this.options = options;
  18115. this.connect();
  18116. if (!this.options.withoutInterceptors) {
  18117. this.registerInterceptors();
  18118. }
  18119. }
  18120. /**
  18121. * Get a channel instance by name.
  18122. */
  18123. createClass(Echo, [{
  18124. key: 'channel',
  18125. value: function channel(_channel) {
  18126. return this.connector.channel(_channel);
  18127. }
  18128. /**
  18129. * Create a new connection.
  18130. */
  18131. }, {
  18132. key: 'connect',
  18133. value: function connect() {
  18134. if (this.options.broadcaster == 'pusher') {
  18135. this.connector = new PusherConnector(this.options);
  18136. } else if (this.options.broadcaster == 'socket.io') {
  18137. this.connector = new SocketIoConnector(this.options);
  18138. } else if (this.options.broadcaster == 'null') {
  18139. this.connector = new NullConnector(this.options);
  18140. } else if (typeof this.options.broadcaster == 'function') {
  18141. this.connector = new this.options.broadcaster(this.options);
  18142. }
  18143. }
  18144. /**
  18145. * Disconnect from the Echo server.
  18146. */
  18147. }, {
  18148. key: 'disconnect',
  18149. value: function disconnect() {
  18150. this.connector.disconnect();
  18151. }
  18152. /**
  18153. * Get a presence channel instance by name.
  18154. */
  18155. }, {
  18156. key: 'join',
  18157. value: function join(channel) {
  18158. return this.connector.presenceChannel(channel);
  18159. }
  18160. /**
  18161. * Leave the given channel, as well as its private and presence variants.
  18162. */
  18163. }, {
  18164. key: 'leave',
  18165. value: function leave(channel) {
  18166. this.connector.leave(channel);
  18167. }
  18168. /**
  18169. * Leave the given channel.
  18170. */
  18171. }, {
  18172. key: 'leaveChannel',
  18173. value: function leaveChannel(channel) {
  18174. this.connector.leaveChannel(channel);
  18175. }
  18176. /**
  18177. * Listen for an event on a channel instance.
  18178. */
  18179. }, {
  18180. key: 'listen',
  18181. value: function listen(channel, event, callback) {
  18182. return this.connector.listen(channel, event, callback);
  18183. }
  18184. /**
  18185. * Get a private channel instance by name.
  18186. */
  18187. }, {
  18188. key: 'private',
  18189. value: function _private(channel) {
  18190. return this.connector.privateChannel(channel);
  18191. }
  18192. /**
  18193. * Get the Socket ID for the connection.
  18194. */
  18195. }, {
  18196. key: 'socketId',
  18197. value: function socketId() {
  18198. return this.connector.socketId();
  18199. }
  18200. /**
  18201. * Register 3rd party request interceptiors. These are used to automatically
  18202. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18203. */
  18204. }, {
  18205. key: 'registerInterceptors',
  18206. value: function registerInterceptors() {
  18207. if (typeof Vue === 'function' && Vue.http) {
  18208. this.registerVueRequestInterceptor();
  18209. }
  18210. if (typeof axios === 'function') {
  18211. this.registerAxiosRequestInterceptor();
  18212. }
  18213. if (typeof jQuery === 'function') {
  18214. this.registerjQueryAjaxSetup();
  18215. }
  18216. }
  18217. /**
  18218. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18219. */
  18220. }, {
  18221. key: 'registerVueRequestInterceptor',
  18222. value: function registerVueRequestInterceptor() {
  18223. var _this = this;
  18224. Vue.http.interceptors.push(function (request, next) {
  18225. if (_this.socketId()) {
  18226. request.headers.set('X-Socket-ID', _this.socketId());
  18227. }
  18228. next();
  18229. });
  18230. }
  18231. /**
  18232. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18233. */
  18234. }, {
  18235. key: 'registerAxiosRequestInterceptor',
  18236. value: function registerAxiosRequestInterceptor() {
  18237. var _this2 = this;
  18238. axios.interceptors.request.use(function (config) {
  18239. if (_this2.socketId()) {
  18240. config.headers['X-Socket-Id'] = _this2.socketId();
  18241. }
  18242. return config;
  18243. });
  18244. }
  18245. /**
  18246. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18247. */
  18248. }, {
  18249. key: 'registerjQueryAjaxSetup',
  18250. value: function registerjQueryAjaxSetup() {
  18251. var _this3 = this;
  18252. if (typeof jQuery.ajax != 'undefined') {
  18253. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18254. if (_this3.socketId()) {
  18255. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18256. }
  18257. });
  18258. }
  18259. }
  18260. }]);
  18261. return Echo;
  18262. }();
  18263. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18264. /***/ }),
  18265. /***/ "./node_modules/lodash/lodash.js":
  18266. /*!***************************************!*\
  18267. !*** ./node_modules/lodash/lodash.js ***!
  18268. \***************************************/
  18269. /*! no static exports found */
  18270. /***/ (function(module, exports, __webpack_require__) {
  18271. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18272. * @license
  18273. * Lodash <https://lodash.com/>
  18274. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18275. * Released under MIT license <https://lodash.com/license>
  18276. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18277. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18278. */
  18279. ;(function() {
  18280. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18281. var undefined;
  18282. /** Used as the semantic version number. */
  18283. var VERSION = '4.17.15';
  18284. /** Used as the size to enable large array optimizations. */
  18285. var LARGE_ARRAY_SIZE = 200;
  18286. /** Error message constants. */
  18287. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18288. FUNC_ERROR_TEXT = 'Expected a function';
  18289. /** Used to stand-in for `undefined` hash values. */
  18290. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18291. /** Used as the maximum memoize cache size. */
  18292. var MAX_MEMOIZE_SIZE = 500;
  18293. /** Used as the internal argument placeholder. */
  18294. var PLACEHOLDER = '__lodash_placeholder__';
  18295. /** Used to compose bitmasks for cloning. */
  18296. var CLONE_DEEP_FLAG = 1,
  18297. CLONE_FLAT_FLAG = 2,
  18298. CLONE_SYMBOLS_FLAG = 4;
  18299. /** Used to compose bitmasks for value comparisons. */
  18300. var COMPARE_PARTIAL_FLAG = 1,
  18301. COMPARE_UNORDERED_FLAG = 2;
  18302. /** Used to compose bitmasks for function metadata. */
  18303. var WRAP_BIND_FLAG = 1,
  18304. WRAP_BIND_KEY_FLAG = 2,
  18305. WRAP_CURRY_BOUND_FLAG = 4,
  18306. WRAP_CURRY_FLAG = 8,
  18307. WRAP_CURRY_RIGHT_FLAG = 16,
  18308. WRAP_PARTIAL_FLAG = 32,
  18309. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18310. WRAP_ARY_FLAG = 128,
  18311. WRAP_REARG_FLAG = 256,
  18312. WRAP_FLIP_FLAG = 512;
  18313. /** Used as default options for `_.truncate`. */
  18314. var DEFAULT_TRUNC_LENGTH = 30,
  18315. DEFAULT_TRUNC_OMISSION = '...';
  18316. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18317. var HOT_COUNT = 800,
  18318. HOT_SPAN = 16;
  18319. /** Used to indicate the type of lazy iteratees. */
  18320. var LAZY_FILTER_FLAG = 1,
  18321. LAZY_MAP_FLAG = 2,
  18322. LAZY_WHILE_FLAG = 3;
  18323. /** Used as references for various `Number` constants. */
  18324. var INFINITY = 1 / 0,
  18325. MAX_SAFE_INTEGER = 9007199254740991,
  18326. MAX_INTEGER = 1.7976931348623157e+308,
  18327. NAN = 0 / 0;
  18328. /** Used as references for the maximum length and index of an array. */
  18329. var MAX_ARRAY_LENGTH = 4294967295,
  18330. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18331. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18332. /** Used to associate wrap methods with their bit flags. */
  18333. var wrapFlags = [
  18334. ['ary', WRAP_ARY_FLAG],
  18335. ['bind', WRAP_BIND_FLAG],
  18336. ['bindKey', WRAP_BIND_KEY_FLAG],
  18337. ['curry', WRAP_CURRY_FLAG],
  18338. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18339. ['flip', WRAP_FLIP_FLAG],
  18340. ['partial', WRAP_PARTIAL_FLAG],
  18341. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18342. ['rearg', WRAP_REARG_FLAG]
  18343. ];
  18344. /** `Object#toString` result references. */
  18345. var argsTag = '[object Arguments]',
  18346. arrayTag = '[object Array]',
  18347. asyncTag = '[object AsyncFunction]',
  18348. boolTag = '[object Boolean]',
  18349. dateTag = '[object Date]',
  18350. domExcTag = '[object DOMException]',
  18351. errorTag = '[object Error]',
  18352. funcTag = '[object Function]',
  18353. genTag = '[object GeneratorFunction]',
  18354. mapTag = '[object Map]',
  18355. numberTag = '[object Number]',
  18356. nullTag = '[object Null]',
  18357. objectTag = '[object Object]',
  18358. promiseTag = '[object Promise]',
  18359. proxyTag = '[object Proxy]',
  18360. regexpTag = '[object RegExp]',
  18361. setTag = '[object Set]',
  18362. stringTag = '[object String]',
  18363. symbolTag = '[object Symbol]',
  18364. undefinedTag = '[object Undefined]',
  18365. weakMapTag = '[object WeakMap]',
  18366. weakSetTag = '[object WeakSet]';
  18367. var arrayBufferTag = '[object ArrayBuffer]',
  18368. dataViewTag = '[object DataView]',
  18369. float32Tag = '[object Float32Array]',
  18370. float64Tag = '[object Float64Array]',
  18371. int8Tag = '[object Int8Array]',
  18372. int16Tag = '[object Int16Array]',
  18373. int32Tag = '[object Int32Array]',
  18374. uint8Tag = '[object Uint8Array]',
  18375. uint8ClampedTag = '[object Uint8ClampedArray]',
  18376. uint16Tag = '[object Uint16Array]',
  18377. uint32Tag = '[object Uint32Array]';
  18378. /** Used to match empty string literals in compiled template source. */
  18379. var reEmptyStringLeading = /\b__p \+= '';/g,
  18380. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18381. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18382. /** Used to match HTML entities and HTML characters. */
  18383. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18384. reUnescapedHtml = /[&<>"']/g,
  18385. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18386. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18387. /** Used to match template delimiters. */
  18388. var reEscape = /<%-([\s\S]+?)%>/g,
  18389. reEvaluate = /<%([\s\S]+?)%>/g,
  18390. reInterpolate = /<%=([\s\S]+?)%>/g;
  18391. /** Used to match property names within property paths. */
  18392. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18393. reIsPlainProp = /^\w*$/,
  18394. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18395. /**
  18396. * Used to match `RegExp`
  18397. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18398. */
  18399. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18400. reHasRegExpChar = RegExp(reRegExpChar.source);
  18401. /** Used to match leading and trailing whitespace. */
  18402. var reTrim = /^\s+|\s+$/g,
  18403. reTrimStart = /^\s+/,
  18404. reTrimEnd = /\s+$/;
  18405. /** Used to match wrap detail comments. */
  18406. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18407. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18408. reSplitDetails = /,? & /;
  18409. /** Used to match words composed of alphanumeric characters. */
  18410. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18411. /** Used to match backslashes in property paths. */
  18412. var reEscapeChar = /\\(\\)?/g;
  18413. /**
  18414. * Used to match
  18415. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18416. */
  18417. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18418. /** Used to match `RegExp` flags from their coerced string values. */
  18419. var reFlags = /\w*$/;
  18420. /** Used to detect bad signed hexadecimal string values. */
  18421. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18422. /** Used to detect binary string values. */
  18423. var reIsBinary = /^0b[01]+$/i;
  18424. /** Used to detect host constructors (Safari). */
  18425. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18426. /** Used to detect octal string values. */
  18427. var reIsOctal = /^0o[0-7]+$/i;
  18428. /** Used to detect unsigned integer values. */
  18429. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18430. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18431. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18432. /** Used to ensure capturing order of template delimiters. */
  18433. var reNoMatch = /($^)/;
  18434. /** Used to match unescaped characters in compiled string literals. */
  18435. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18436. /** Used to compose unicode character classes. */
  18437. var rsAstralRange = '\\ud800-\\udfff',
  18438. rsComboMarksRange = '\\u0300-\\u036f',
  18439. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18440. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18441. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18442. rsDingbatRange = '\\u2700-\\u27bf',
  18443. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18444. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18445. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18446. rsPunctuationRange = '\\u2000-\\u206f',
  18447. 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',
  18448. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18449. rsVarRange = '\\ufe0e\\ufe0f',
  18450. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18451. /** Used to compose unicode capture groups. */
  18452. var rsApos = "['\u2019]",
  18453. rsAstral = '[' + rsAstralRange + ']',
  18454. rsBreak = '[' + rsBreakRange + ']',
  18455. rsCombo = '[' + rsComboRange + ']',
  18456. rsDigits = '\\d+',
  18457. rsDingbat = '[' + rsDingbatRange + ']',
  18458. rsLower = '[' + rsLowerRange + ']',
  18459. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18460. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18461. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18462. rsNonAstral = '[^' + rsAstralRange + ']',
  18463. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18464. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18465. rsUpper = '[' + rsUpperRange + ']',
  18466. rsZWJ = '\\u200d';
  18467. /** Used to compose unicode regexes. */
  18468. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18469. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18470. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18471. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18472. reOptMod = rsModifier + '?',
  18473. rsOptVar = '[' + rsVarRange + ']?',
  18474. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18475. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18476. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18477. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18478. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18479. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18480. /** Used to match apostrophes. */
  18481. var reApos = RegExp(rsApos, 'g');
  18482. /**
  18483. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18484. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18485. */
  18486. var reComboMark = RegExp(rsCombo, 'g');
  18487. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18488. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18489. /** Used to match complex or compound words. */
  18490. var reUnicodeWord = RegExp([
  18491. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18492. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18493. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18494. rsUpper + '+' + rsOptContrUpper,
  18495. rsOrdUpper,
  18496. rsOrdLower,
  18497. rsDigits,
  18498. rsEmoji
  18499. ].join('|'), 'g');
  18500. /** 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/). */
  18501. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18502. /** Used to detect strings that need a more robust regexp to match words. */
  18503. 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 ]/;
  18504. /** Used to assign default `context` object properties. */
  18505. var contextProps = [
  18506. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18507. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18508. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18509. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18510. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18511. ];
  18512. /** Used to make template sourceURLs easier to identify. */
  18513. var templateCounter = -1;
  18514. /** Used to identify `toStringTag` values of typed arrays. */
  18515. var typedArrayTags = {};
  18516. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18517. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18518. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18519. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18520. typedArrayTags[uint32Tag] = true;
  18521. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18522. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18523. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18524. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18525. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18526. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18527. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18528. typedArrayTags[weakMapTag] = false;
  18529. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18530. var cloneableTags = {};
  18531. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18532. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18533. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18534. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18535. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18536. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18537. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18538. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18539. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18540. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18541. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18542. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18543. cloneableTags[weakMapTag] = false;
  18544. /** Used to map Latin Unicode letters to basic Latin letters. */
  18545. var deburredLetters = {
  18546. // Latin-1 Supplement block.
  18547. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18548. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18549. '\xc7': 'C', '\xe7': 'c',
  18550. '\xd0': 'D', '\xf0': 'd',
  18551. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18552. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18553. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18554. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18555. '\xd1': 'N', '\xf1': 'n',
  18556. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18557. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18558. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18559. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18560. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18561. '\xc6': 'Ae', '\xe6': 'ae',
  18562. '\xde': 'Th', '\xfe': 'th',
  18563. '\xdf': 'ss',
  18564. // Latin Extended-A block.
  18565. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18566. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18567. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18568. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18569. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18570. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18571. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18572. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18573. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18574. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18575. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18576. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18577. '\u0134': 'J', '\u0135': 'j',
  18578. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18579. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18580. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18581. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18582. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18583. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18584. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18585. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18586. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18587. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18588. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18589. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18590. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18591. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18592. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18593. '\u0174': 'W', '\u0175': 'w',
  18594. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18595. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18596. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18597. '\u0132': 'IJ', '\u0133': 'ij',
  18598. '\u0152': 'Oe', '\u0153': 'oe',
  18599. '\u0149': "'n", '\u017f': 's'
  18600. };
  18601. /** Used to map characters to HTML entities. */
  18602. var htmlEscapes = {
  18603. '&': '&amp;',
  18604. '<': '&lt;',
  18605. '>': '&gt;',
  18606. '"': '&quot;',
  18607. "'": '&#39;'
  18608. };
  18609. /** Used to map HTML entities to characters. */
  18610. var htmlUnescapes = {
  18611. '&amp;': '&',
  18612. '&lt;': '<',
  18613. '&gt;': '>',
  18614. '&quot;': '"',
  18615. '&#39;': "'"
  18616. };
  18617. /** Used to escape characters for inclusion in compiled string literals. */
  18618. var stringEscapes = {
  18619. '\\': '\\',
  18620. "'": "'",
  18621. '\n': 'n',
  18622. '\r': 'r',
  18623. '\u2028': 'u2028',
  18624. '\u2029': 'u2029'
  18625. };
  18626. /** Built-in method references without a dependency on `root`. */
  18627. var freeParseFloat = parseFloat,
  18628. freeParseInt = parseInt;
  18629. /** Detect free variable `global` from Node.js. */
  18630. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18631. /** Detect free variable `self`. */
  18632. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18633. /** Used as a reference to the global object. */
  18634. var root = freeGlobal || freeSelf || Function('return this')();
  18635. /** Detect free variable `exports`. */
  18636. var freeExports = true && exports && !exports.nodeType && exports;
  18637. /** Detect free variable `module`. */
  18638. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18639. /** Detect the popular CommonJS extension `module.exports`. */
  18640. var moduleExports = freeModule && freeModule.exports === freeExports;
  18641. /** Detect free variable `process` from Node.js. */
  18642. var freeProcess = moduleExports && freeGlobal.process;
  18643. /** Used to access faster Node.js helpers. */
  18644. var nodeUtil = (function() {
  18645. try {
  18646. // Use `util.types` for Node.js 10+.
  18647. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18648. if (types) {
  18649. return types;
  18650. }
  18651. // Legacy `process.binding('util')` for Node.js < 10.
  18652. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18653. } catch (e) {}
  18654. }());
  18655. /* Node.js helper references. */
  18656. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18657. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18658. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18659. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18660. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18661. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18662. /*--------------------------------------------------------------------------*/
  18663. /**
  18664. * A faster alternative to `Function#apply`, this function invokes `func`
  18665. * with the `this` binding of `thisArg` and the arguments of `args`.
  18666. *
  18667. * @private
  18668. * @param {Function} func The function to invoke.
  18669. * @param {*} thisArg The `this` binding of `func`.
  18670. * @param {Array} args The arguments to invoke `func` with.
  18671. * @returns {*} Returns the result of `func`.
  18672. */
  18673. function apply(func, thisArg, args) {
  18674. switch (args.length) {
  18675. case 0: return func.call(thisArg);
  18676. case 1: return func.call(thisArg, args[0]);
  18677. case 2: return func.call(thisArg, args[0], args[1]);
  18678. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18679. }
  18680. return func.apply(thisArg, args);
  18681. }
  18682. /**
  18683. * A specialized version of `baseAggregator` for arrays.
  18684. *
  18685. * @private
  18686. * @param {Array} [array] The array to iterate over.
  18687. * @param {Function} setter The function to set `accumulator` values.
  18688. * @param {Function} iteratee The iteratee to transform keys.
  18689. * @param {Object} accumulator The initial aggregated object.
  18690. * @returns {Function} Returns `accumulator`.
  18691. */
  18692. function arrayAggregator(array, setter, iteratee, accumulator) {
  18693. var index = -1,
  18694. length = array == null ? 0 : array.length;
  18695. while (++index < length) {
  18696. var value = array[index];
  18697. setter(accumulator, value, iteratee(value), array);
  18698. }
  18699. return accumulator;
  18700. }
  18701. /**
  18702. * A specialized version of `_.forEach` for arrays without support for
  18703. * iteratee shorthands.
  18704. *
  18705. * @private
  18706. * @param {Array} [array] The array to iterate over.
  18707. * @param {Function} iteratee The function invoked per iteration.
  18708. * @returns {Array} Returns `array`.
  18709. */
  18710. function arrayEach(array, iteratee) {
  18711. var index = -1,
  18712. length = array == null ? 0 : array.length;
  18713. while (++index < length) {
  18714. if (iteratee(array[index], index, array) === false) {
  18715. break;
  18716. }
  18717. }
  18718. return array;
  18719. }
  18720. /**
  18721. * A specialized version of `_.forEachRight` for arrays without support for
  18722. * iteratee shorthands.
  18723. *
  18724. * @private
  18725. * @param {Array} [array] The array to iterate over.
  18726. * @param {Function} iteratee The function invoked per iteration.
  18727. * @returns {Array} Returns `array`.
  18728. */
  18729. function arrayEachRight(array, iteratee) {
  18730. var length = array == null ? 0 : array.length;
  18731. while (length--) {
  18732. if (iteratee(array[length], length, array) === false) {
  18733. break;
  18734. }
  18735. }
  18736. return array;
  18737. }
  18738. /**
  18739. * A specialized version of `_.every` for arrays without support for
  18740. * iteratee shorthands.
  18741. *
  18742. * @private
  18743. * @param {Array} [array] The array to iterate over.
  18744. * @param {Function} predicate The function invoked per iteration.
  18745. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18746. * else `false`.
  18747. */
  18748. function arrayEvery(array, predicate) {
  18749. var index = -1,
  18750. length = array == null ? 0 : array.length;
  18751. while (++index < length) {
  18752. if (!predicate(array[index], index, array)) {
  18753. return false;
  18754. }
  18755. }
  18756. return true;
  18757. }
  18758. /**
  18759. * A specialized version of `_.filter` for arrays without support for
  18760. * iteratee shorthands.
  18761. *
  18762. * @private
  18763. * @param {Array} [array] The array to iterate over.
  18764. * @param {Function} predicate The function invoked per iteration.
  18765. * @returns {Array} Returns the new filtered array.
  18766. */
  18767. function arrayFilter(array, predicate) {
  18768. var index = -1,
  18769. length = array == null ? 0 : array.length,
  18770. resIndex = 0,
  18771. result = [];
  18772. while (++index < length) {
  18773. var value = array[index];
  18774. if (predicate(value, index, array)) {
  18775. result[resIndex++] = value;
  18776. }
  18777. }
  18778. return result;
  18779. }
  18780. /**
  18781. * A specialized version of `_.includes` for arrays without support for
  18782. * specifying an index to search from.
  18783. *
  18784. * @private
  18785. * @param {Array} [array] The array to inspect.
  18786. * @param {*} target The value to search for.
  18787. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18788. */
  18789. function arrayIncludes(array, value) {
  18790. var length = array == null ? 0 : array.length;
  18791. return !!length && baseIndexOf(array, value, 0) > -1;
  18792. }
  18793. /**
  18794. * This function is like `arrayIncludes` except that it accepts a comparator.
  18795. *
  18796. * @private
  18797. * @param {Array} [array] The array to inspect.
  18798. * @param {*} target The value to search for.
  18799. * @param {Function} comparator The comparator invoked per element.
  18800. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18801. */
  18802. function arrayIncludesWith(array, value, comparator) {
  18803. var index = -1,
  18804. length = array == null ? 0 : array.length;
  18805. while (++index < length) {
  18806. if (comparator(value, array[index])) {
  18807. return true;
  18808. }
  18809. }
  18810. return false;
  18811. }
  18812. /**
  18813. * A specialized version of `_.map` for arrays without support for iteratee
  18814. * shorthands.
  18815. *
  18816. * @private
  18817. * @param {Array} [array] The array to iterate over.
  18818. * @param {Function} iteratee The function invoked per iteration.
  18819. * @returns {Array} Returns the new mapped array.
  18820. */
  18821. function arrayMap(array, iteratee) {
  18822. var index = -1,
  18823. length = array == null ? 0 : array.length,
  18824. result = Array(length);
  18825. while (++index < length) {
  18826. result[index] = iteratee(array[index], index, array);
  18827. }
  18828. return result;
  18829. }
  18830. /**
  18831. * Appends the elements of `values` to `array`.
  18832. *
  18833. * @private
  18834. * @param {Array} array The array to modify.
  18835. * @param {Array} values The values to append.
  18836. * @returns {Array} Returns `array`.
  18837. */
  18838. function arrayPush(array, values) {
  18839. var index = -1,
  18840. length = values.length,
  18841. offset = array.length;
  18842. while (++index < length) {
  18843. array[offset + index] = values[index];
  18844. }
  18845. return array;
  18846. }
  18847. /**
  18848. * A specialized version of `_.reduce` for arrays without support for
  18849. * iteratee shorthands.
  18850. *
  18851. * @private
  18852. * @param {Array} [array] The array to iterate over.
  18853. * @param {Function} iteratee The function invoked per iteration.
  18854. * @param {*} [accumulator] The initial value.
  18855. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18856. * the initial value.
  18857. * @returns {*} Returns the accumulated value.
  18858. */
  18859. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18860. var index = -1,
  18861. length = array == null ? 0 : array.length;
  18862. if (initAccum && length) {
  18863. accumulator = array[++index];
  18864. }
  18865. while (++index < length) {
  18866. accumulator = iteratee(accumulator, array[index], index, array);
  18867. }
  18868. return accumulator;
  18869. }
  18870. /**
  18871. * A specialized version of `_.reduceRight` for arrays without support for
  18872. * iteratee shorthands.
  18873. *
  18874. * @private
  18875. * @param {Array} [array] The array to iterate over.
  18876. * @param {Function} iteratee The function invoked per iteration.
  18877. * @param {*} [accumulator] The initial value.
  18878. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18879. * the initial value.
  18880. * @returns {*} Returns the accumulated value.
  18881. */
  18882. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18883. var length = array == null ? 0 : array.length;
  18884. if (initAccum && length) {
  18885. accumulator = array[--length];
  18886. }
  18887. while (length--) {
  18888. accumulator = iteratee(accumulator, array[length], length, array);
  18889. }
  18890. return accumulator;
  18891. }
  18892. /**
  18893. * A specialized version of `_.some` for arrays without support for iteratee
  18894. * shorthands.
  18895. *
  18896. * @private
  18897. * @param {Array} [array] The array to iterate over.
  18898. * @param {Function} predicate The function invoked per iteration.
  18899. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18900. * else `false`.
  18901. */
  18902. function arraySome(array, predicate) {
  18903. var index = -1,
  18904. length = array == null ? 0 : array.length;
  18905. while (++index < length) {
  18906. if (predicate(array[index], index, array)) {
  18907. return true;
  18908. }
  18909. }
  18910. return false;
  18911. }
  18912. /**
  18913. * Gets the size of an ASCII `string`.
  18914. *
  18915. * @private
  18916. * @param {string} string The string inspect.
  18917. * @returns {number} Returns the string size.
  18918. */
  18919. var asciiSize = baseProperty('length');
  18920. /**
  18921. * Converts an ASCII `string` to an array.
  18922. *
  18923. * @private
  18924. * @param {string} string The string to convert.
  18925. * @returns {Array} Returns the converted array.
  18926. */
  18927. function asciiToArray(string) {
  18928. return string.split('');
  18929. }
  18930. /**
  18931. * Splits an ASCII `string` into an array of its words.
  18932. *
  18933. * @private
  18934. * @param {string} The string to inspect.
  18935. * @returns {Array} Returns the words of `string`.
  18936. */
  18937. function asciiWords(string) {
  18938. return string.match(reAsciiWord) || [];
  18939. }
  18940. /**
  18941. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18942. * without support for iteratee shorthands, which iterates over `collection`
  18943. * using `eachFunc`.
  18944. *
  18945. * @private
  18946. * @param {Array|Object} collection The collection to inspect.
  18947. * @param {Function} predicate The function invoked per iteration.
  18948. * @param {Function} eachFunc The function to iterate over `collection`.
  18949. * @returns {*} Returns the found element or its key, else `undefined`.
  18950. */
  18951. function baseFindKey(collection, predicate, eachFunc) {
  18952. var result;
  18953. eachFunc(collection, function(value, key, collection) {
  18954. if (predicate(value, key, collection)) {
  18955. result = key;
  18956. return false;
  18957. }
  18958. });
  18959. return result;
  18960. }
  18961. /**
  18962. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18963. * support for iteratee shorthands.
  18964. *
  18965. * @private
  18966. * @param {Array} array The array to inspect.
  18967. * @param {Function} predicate The function invoked per iteration.
  18968. * @param {number} fromIndex The index to search from.
  18969. * @param {boolean} [fromRight] Specify iterating from right to left.
  18970. * @returns {number} Returns the index of the matched value, else `-1`.
  18971. */
  18972. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  18973. var length = array.length,
  18974. index = fromIndex + (fromRight ? 1 : -1);
  18975. while ((fromRight ? index-- : ++index < length)) {
  18976. if (predicate(array[index], index, array)) {
  18977. return index;
  18978. }
  18979. }
  18980. return -1;
  18981. }
  18982. /**
  18983. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  18984. *
  18985. * @private
  18986. * @param {Array} array The array to inspect.
  18987. * @param {*} value The value to search for.
  18988. * @param {number} fromIndex The index to search from.
  18989. * @returns {number} Returns the index of the matched value, else `-1`.
  18990. */
  18991. function baseIndexOf(array, value, fromIndex) {
  18992. return value === value
  18993. ? strictIndexOf(array, value, fromIndex)
  18994. : baseFindIndex(array, baseIsNaN, fromIndex);
  18995. }
  18996. /**
  18997. * This function is like `baseIndexOf` except that it accepts a comparator.
  18998. *
  18999. * @private
  19000. * @param {Array} array The array to inspect.
  19001. * @param {*} value The value to search for.
  19002. * @param {number} fromIndex The index to search from.
  19003. * @param {Function} comparator The comparator invoked per element.
  19004. * @returns {number} Returns the index of the matched value, else `-1`.
  19005. */
  19006. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19007. var index = fromIndex - 1,
  19008. length = array.length;
  19009. while (++index < length) {
  19010. if (comparator(array[index], value)) {
  19011. return index;
  19012. }
  19013. }
  19014. return -1;
  19015. }
  19016. /**
  19017. * The base implementation of `_.isNaN` without support for number objects.
  19018. *
  19019. * @private
  19020. * @param {*} value The value to check.
  19021. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19022. */
  19023. function baseIsNaN(value) {
  19024. return value !== value;
  19025. }
  19026. /**
  19027. * The base implementation of `_.mean` and `_.meanBy` without support for
  19028. * iteratee shorthands.
  19029. *
  19030. * @private
  19031. * @param {Array} array The array to iterate over.
  19032. * @param {Function} iteratee The function invoked per iteration.
  19033. * @returns {number} Returns the mean.
  19034. */
  19035. function baseMean(array, iteratee) {
  19036. var length = array == null ? 0 : array.length;
  19037. return length ? (baseSum(array, iteratee) / length) : NAN;
  19038. }
  19039. /**
  19040. * The base implementation of `_.property` without support for deep paths.
  19041. *
  19042. * @private
  19043. * @param {string} key The key of the property to get.
  19044. * @returns {Function} Returns the new accessor function.
  19045. */
  19046. function baseProperty(key) {
  19047. return function(object) {
  19048. return object == null ? undefined : object[key];
  19049. };
  19050. }
  19051. /**
  19052. * The base implementation of `_.propertyOf` without support for deep paths.
  19053. *
  19054. * @private
  19055. * @param {Object} object The object to query.
  19056. * @returns {Function} Returns the new accessor function.
  19057. */
  19058. function basePropertyOf(object) {
  19059. return function(key) {
  19060. return object == null ? undefined : object[key];
  19061. };
  19062. }
  19063. /**
  19064. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19065. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19066. *
  19067. * @private
  19068. * @param {Array|Object} collection The collection to iterate over.
  19069. * @param {Function} iteratee The function invoked per iteration.
  19070. * @param {*} accumulator The initial value.
  19071. * @param {boolean} initAccum Specify using the first or last element of
  19072. * `collection` as the initial value.
  19073. * @param {Function} eachFunc The function to iterate over `collection`.
  19074. * @returns {*} Returns the accumulated value.
  19075. */
  19076. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19077. eachFunc(collection, function(value, index, collection) {
  19078. accumulator = initAccum
  19079. ? (initAccum = false, value)
  19080. : iteratee(accumulator, value, index, collection);
  19081. });
  19082. return accumulator;
  19083. }
  19084. /**
  19085. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19086. * sort order of `array` and replaces criteria objects with their corresponding
  19087. * values.
  19088. *
  19089. * @private
  19090. * @param {Array} array The array to sort.
  19091. * @param {Function} comparer The function to define sort order.
  19092. * @returns {Array} Returns `array`.
  19093. */
  19094. function baseSortBy(array, comparer) {
  19095. var length = array.length;
  19096. array.sort(comparer);
  19097. while (length--) {
  19098. array[length] = array[length].value;
  19099. }
  19100. return array;
  19101. }
  19102. /**
  19103. * The base implementation of `_.sum` and `_.sumBy` without support for
  19104. * iteratee shorthands.
  19105. *
  19106. * @private
  19107. * @param {Array} array The array to iterate over.
  19108. * @param {Function} iteratee The function invoked per iteration.
  19109. * @returns {number} Returns the sum.
  19110. */
  19111. function baseSum(array, iteratee) {
  19112. var result,
  19113. index = -1,
  19114. length = array.length;
  19115. while (++index < length) {
  19116. var current = iteratee(array[index]);
  19117. if (current !== undefined) {
  19118. result = result === undefined ? current : (result + current);
  19119. }
  19120. }
  19121. return result;
  19122. }
  19123. /**
  19124. * The base implementation of `_.times` without support for iteratee shorthands
  19125. * or max array length checks.
  19126. *
  19127. * @private
  19128. * @param {number} n The number of times to invoke `iteratee`.
  19129. * @param {Function} iteratee The function invoked per iteration.
  19130. * @returns {Array} Returns the array of results.
  19131. */
  19132. function baseTimes(n, iteratee) {
  19133. var index = -1,
  19134. result = Array(n);
  19135. while (++index < n) {
  19136. result[index] = iteratee(index);
  19137. }
  19138. return result;
  19139. }
  19140. /**
  19141. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19142. * of key-value pairs for `object` corresponding to the property names of `props`.
  19143. *
  19144. * @private
  19145. * @param {Object} object The object to query.
  19146. * @param {Array} props The property names to get values for.
  19147. * @returns {Object} Returns the key-value pairs.
  19148. */
  19149. function baseToPairs(object, props) {
  19150. return arrayMap(props, function(key) {
  19151. return [key, object[key]];
  19152. });
  19153. }
  19154. /**
  19155. * The base implementation of `_.unary` without support for storing metadata.
  19156. *
  19157. * @private
  19158. * @param {Function} func The function to cap arguments for.
  19159. * @returns {Function} Returns the new capped function.
  19160. */
  19161. function baseUnary(func) {
  19162. return function(value) {
  19163. return func(value);
  19164. };
  19165. }
  19166. /**
  19167. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19168. * array of `object` property values corresponding to the property names
  19169. * of `props`.
  19170. *
  19171. * @private
  19172. * @param {Object} object The object to query.
  19173. * @param {Array} props The property names to get values for.
  19174. * @returns {Object} Returns the array of property values.
  19175. */
  19176. function baseValues(object, props) {
  19177. return arrayMap(props, function(key) {
  19178. return object[key];
  19179. });
  19180. }
  19181. /**
  19182. * Checks if a `cache` value for `key` exists.
  19183. *
  19184. * @private
  19185. * @param {Object} cache The cache to query.
  19186. * @param {string} key The key of the entry to check.
  19187. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19188. */
  19189. function cacheHas(cache, key) {
  19190. return cache.has(key);
  19191. }
  19192. /**
  19193. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19194. * that is not found in the character symbols.
  19195. *
  19196. * @private
  19197. * @param {Array} strSymbols The string symbols to inspect.
  19198. * @param {Array} chrSymbols The character symbols to find.
  19199. * @returns {number} Returns the index of the first unmatched string symbol.
  19200. */
  19201. function charsStartIndex(strSymbols, chrSymbols) {
  19202. var index = -1,
  19203. length = strSymbols.length;
  19204. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19205. return index;
  19206. }
  19207. /**
  19208. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19209. * that is not found in the character symbols.
  19210. *
  19211. * @private
  19212. * @param {Array} strSymbols The string symbols to inspect.
  19213. * @param {Array} chrSymbols The character symbols to find.
  19214. * @returns {number} Returns the index of the last unmatched string symbol.
  19215. */
  19216. function charsEndIndex(strSymbols, chrSymbols) {
  19217. var index = strSymbols.length;
  19218. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19219. return index;
  19220. }
  19221. /**
  19222. * Gets the number of `placeholder` occurrences in `array`.
  19223. *
  19224. * @private
  19225. * @param {Array} array The array to inspect.
  19226. * @param {*} placeholder The placeholder to search for.
  19227. * @returns {number} Returns the placeholder count.
  19228. */
  19229. function countHolders(array, placeholder) {
  19230. var length = array.length,
  19231. result = 0;
  19232. while (length--) {
  19233. if (array[length] === placeholder) {
  19234. ++result;
  19235. }
  19236. }
  19237. return result;
  19238. }
  19239. /**
  19240. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19241. * letters to basic Latin letters.
  19242. *
  19243. * @private
  19244. * @param {string} letter The matched letter to deburr.
  19245. * @returns {string} Returns the deburred letter.
  19246. */
  19247. var deburrLetter = basePropertyOf(deburredLetters);
  19248. /**
  19249. * Used by `_.escape` to convert characters to HTML entities.
  19250. *
  19251. * @private
  19252. * @param {string} chr The matched character to escape.
  19253. * @returns {string} Returns the escaped character.
  19254. */
  19255. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19256. /**
  19257. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19258. *
  19259. * @private
  19260. * @param {string} chr The matched character to escape.
  19261. * @returns {string} Returns the escaped character.
  19262. */
  19263. function escapeStringChar(chr) {
  19264. return '\\' + stringEscapes[chr];
  19265. }
  19266. /**
  19267. * Gets the value at `key` of `object`.
  19268. *
  19269. * @private
  19270. * @param {Object} [object] The object to query.
  19271. * @param {string} key The key of the property to get.
  19272. * @returns {*} Returns the property value.
  19273. */
  19274. function getValue(object, key) {
  19275. return object == null ? undefined : object[key];
  19276. }
  19277. /**
  19278. * Checks if `string` contains Unicode symbols.
  19279. *
  19280. * @private
  19281. * @param {string} string The string to inspect.
  19282. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19283. */
  19284. function hasUnicode(string) {
  19285. return reHasUnicode.test(string);
  19286. }
  19287. /**
  19288. * Checks if `string` contains a word composed of Unicode symbols.
  19289. *
  19290. * @private
  19291. * @param {string} string The string to inspect.
  19292. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19293. */
  19294. function hasUnicodeWord(string) {
  19295. return reHasUnicodeWord.test(string);
  19296. }
  19297. /**
  19298. * Converts `iterator` to an array.
  19299. *
  19300. * @private
  19301. * @param {Object} iterator The iterator to convert.
  19302. * @returns {Array} Returns the converted array.
  19303. */
  19304. function iteratorToArray(iterator) {
  19305. var data,
  19306. result = [];
  19307. while (!(data = iterator.next()).done) {
  19308. result.push(data.value);
  19309. }
  19310. return result;
  19311. }
  19312. /**
  19313. * Converts `map` to its key-value pairs.
  19314. *
  19315. * @private
  19316. * @param {Object} map The map to convert.
  19317. * @returns {Array} Returns the key-value pairs.
  19318. */
  19319. function mapToArray(map) {
  19320. var index = -1,
  19321. result = Array(map.size);
  19322. map.forEach(function(value, key) {
  19323. result[++index] = [key, value];
  19324. });
  19325. return result;
  19326. }
  19327. /**
  19328. * Creates a unary function that invokes `func` with its argument transformed.
  19329. *
  19330. * @private
  19331. * @param {Function} func The function to wrap.
  19332. * @param {Function} transform The argument transform.
  19333. * @returns {Function} Returns the new function.
  19334. */
  19335. function overArg(func, transform) {
  19336. return function(arg) {
  19337. return func(transform(arg));
  19338. };
  19339. }
  19340. /**
  19341. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19342. * and returns an array of their indexes.
  19343. *
  19344. * @private
  19345. * @param {Array} array The array to modify.
  19346. * @param {*} placeholder The placeholder to replace.
  19347. * @returns {Array} Returns the new array of placeholder indexes.
  19348. */
  19349. function replaceHolders(array, placeholder) {
  19350. var index = -1,
  19351. length = array.length,
  19352. resIndex = 0,
  19353. result = [];
  19354. while (++index < length) {
  19355. var value = array[index];
  19356. if (value === placeholder || value === PLACEHOLDER) {
  19357. array[index] = PLACEHOLDER;
  19358. result[resIndex++] = index;
  19359. }
  19360. }
  19361. return result;
  19362. }
  19363. /**
  19364. * Converts `set` to an array of its values.
  19365. *
  19366. * @private
  19367. * @param {Object} set The set to convert.
  19368. * @returns {Array} Returns the values.
  19369. */
  19370. function setToArray(set) {
  19371. var index = -1,
  19372. result = Array(set.size);
  19373. set.forEach(function(value) {
  19374. result[++index] = value;
  19375. });
  19376. return result;
  19377. }
  19378. /**
  19379. * Converts `set` to its value-value pairs.
  19380. *
  19381. * @private
  19382. * @param {Object} set The set to convert.
  19383. * @returns {Array} Returns the value-value pairs.
  19384. */
  19385. function setToPairs(set) {
  19386. var index = -1,
  19387. result = Array(set.size);
  19388. set.forEach(function(value) {
  19389. result[++index] = [value, value];
  19390. });
  19391. return result;
  19392. }
  19393. /**
  19394. * A specialized version of `_.indexOf` which performs strict equality
  19395. * comparisons of values, i.e. `===`.
  19396. *
  19397. * @private
  19398. * @param {Array} array The array to inspect.
  19399. * @param {*} value The value to search for.
  19400. * @param {number} fromIndex The index to search from.
  19401. * @returns {number} Returns the index of the matched value, else `-1`.
  19402. */
  19403. function strictIndexOf(array, value, fromIndex) {
  19404. var index = fromIndex - 1,
  19405. length = array.length;
  19406. while (++index < length) {
  19407. if (array[index] === value) {
  19408. return index;
  19409. }
  19410. }
  19411. return -1;
  19412. }
  19413. /**
  19414. * A specialized version of `_.lastIndexOf` which performs strict equality
  19415. * comparisons of values, i.e. `===`.
  19416. *
  19417. * @private
  19418. * @param {Array} array The array to inspect.
  19419. * @param {*} value The value to search for.
  19420. * @param {number} fromIndex The index to search from.
  19421. * @returns {number} Returns the index of the matched value, else `-1`.
  19422. */
  19423. function strictLastIndexOf(array, value, fromIndex) {
  19424. var index = fromIndex + 1;
  19425. while (index--) {
  19426. if (array[index] === value) {
  19427. return index;
  19428. }
  19429. }
  19430. return index;
  19431. }
  19432. /**
  19433. * Gets the number of symbols in `string`.
  19434. *
  19435. * @private
  19436. * @param {string} string The string to inspect.
  19437. * @returns {number} Returns the string size.
  19438. */
  19439. function stringSize(string) {
  19440. return hasUnicode(string)
  19441. ? unicodeSize(string)
  19442. : asciiSize(string);
  19443. }
  19444. /**
  19445. * Converts `string` to an array.
  19446. *
  19447. * @private
  19448. * @param {string} string The string to convert.
  19449. * @returns {Array} Returns the converted array.
  19450. */
  19451. function stringToArray(string) {
  19452. return hasUnicode(string)
  19453. ? unicodeToArray(string)
  19454. : asciiToArray(string);
  19455. }
  19456. /**
  19457. * Used by `_.unescape` to convert HTML entities to characters.
  19458. *
  19459. * @private
  19460. * @param {string} chr The matched character to unescape.
  19461. * @returns {string} Returns the unescaped character.
  19462. */
  19463. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19464. /**
  19465. * Gets the size of a Unicode `string`.
  19466. *
  19467. * @private
  19468. * @param {string} string The string inspect.
  19469. * @returns {number} Returns the string size.
  19470. */
  19471. function unicodeSize(string) {
  19472. var result = reUnicode.lastIndex = 0;
  19473. while (reUnicode.test(string)) {
  19474. ++result;
  19475. }
  19476. return result;
  19477. }
  19478. /**
  19479. * Converts a Unicode `string` to an array.
  19480. *
  19481. * @private
  19482. * @param {string} string The string to convert.
  19483. * @returns {Array} Returns the converted array.
  19484. */
  19485. function unicodeToArray(string) {
  19486. return string.match(reUnicode) || [];
  19487. }
  19488. /**
  19489. * Splits a Unicode `string` into an array of its words.
  19490. *
  19491. * @private
  19492. * @param {string} The string to inspect.
  19493. * @returns {Array} Returns the words of `string`.
  19494. */
  19495. function unicodeWords(string) {
  19496. return string.match(reUnicodeWord) || [];
  19497. }
  19498. /*--------------------------------------------------------------------------*/
  19499. /**
  19500. * Create a new pristine `lodash` function using the `context` object.
  19501. *
  19502. * @static
  19503. * @memberOf _
  19504. * @since 1.1.0
  19505. * @category Util
  19506. * @param {Object} [context=root] The context object.
  19507. * @returns {Function} Returns a new `lodash` function.
  19508. * @example
  19509. *
  19510. * _.mixin({ 'foo': _.constant('foo') });
  19511. *
  19512. * var lodash = _.runInContext();
  19513. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19514. *
  19515. * _.isFunction(_.foo);
  19516. * // => true
  19517. * _.isFunction(_.bar);
  19518. * // => false
  19519. *
  19520. * lodash.isFunction(lodash.foo);
  19521. * // => false
  19522. * lodash.isFunction(lodash.bar);
  19523. * // => true
  19524. *
  19525. * // Create a suped-up `defer` in Node.js.
  19526. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19527. */
  19528. var runInContext = (function runInContext(context) {
  19529. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19530. /** Built-in constructor references. */
  19531. var Array = context.Array,
  19532. Date = context.Date,
  19533. Error = context.Error,
  19534. Function = context.Function,
  19535. Math = context.Math,
  19536. Object = context.Object,
  19537. RegExp = context.RegExp,
  19538. String = context.String,
  19539. TypeError = context.TypeError;
  19540. /** Used for built-in method references. */
  19541. var arrayProto = Array.prototype,
  19542. funcProto = Function.prototype,
  19543. objectProto = Object.prototype;
  19544. /** Used to detect overreaching core-js shims. */
  19545. var coreJsData = context['__core-js_shared__'];
  19546. /** Used to resolve the decompiled source of functions. */
  19547. var funcToString = funcProto.toString;
  19548. /** Used to check objects for own properties. */
  19549. var hasOwnProperty = objectProto.hasOwnProperty;
  19550. /** Used to generate unique IDs. */
  19551. var idCounter = 0;
  19552. /** Used to detect methods masquerading as native. */
  19553. var maskSrcKey = (function() {
  19554. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19555. return uid ? ('Symbol(src)_1.' + uid) : '';
  19556. }());
  19557. /**
  19558. * Used to resolve the
  19559. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19560. * of values.
  19561. */
  19562. var nativeObjectToString = objectProto.toString;
  19563. /** Used to infer the `Object` constructor. */
  19564. var objectCtorString = funcToString.call(Object);
  19565. /** Used to restore the original `_` reference in `_.noConflict`. */
  19566. var oldDash = root._;
  19567. /** Used to detect if a method is native. */
  19568. var reIsNative = RegExp('^' +
  19569. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19570. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19571. );
  19572. /** Built-in value references. */
  19573. var Buffer = moduleExports ? context.Buffer : undefined,
  19574. Symbol = context.Symbol,
  19575. Uint8Array = context.Uint8Array,
  19576. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19577. getPrototype = overArg(Object.getPrototypeOf, Object),
  19578. objectCreate = Object.create,
  19579. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19580. splice = arrayProto.splice,
  19581. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19582. symIterator = Symbol ? Symbol.iterator : undefined,
  19583. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19584. var defineProperty = (function() {
  19585. try {
  19586. var func = getNative(Object, 'defineProperty');
  19587. func({}, '', {});
  19588. return func;
  19589. } catch (e) {}
  19590. }());
  19591. /** Mocked built-ins. */
  19592. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19593. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19594. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19595. /* Built-in method references for those with the same name as other `lodash` methods. */
  19596. var nativeCeil = Math.ceil,
  19597. nativeFloor = Math.floor,
  19598. nativeGetSymbols = Object.getOwnPropertySymbols,
  19599. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19600. nativeIsFinite = context.isFinite,
  19601. nativeJoin = arrayProto.join,
  19602. nativeKeys = overArg(Object.keys, Object),
  19603. nativeMax = Math.max,
  19604. nativeMin = Math.min,
  19605. nativeNow = Date.now,
  19606. nativeParseInt = context.parseInt,
  19607. nativeRandom = Math.random,
  19608. nativeReverse = arrayProto.reverse;
  19609. /* Built-in method references that are verified to be native. */
  19610. var DataView = getNative(context, 'DataView'),
  19611. Map = getNative(context, 'Map'),
  19612. Promise = getNative(context, 'Promise'),
  19613. Set = getNative(context, 'Set'),
  19614. WeakMap = getNative(context, 'WeakMap'),
  19615. nativeCreate = getNative(Object, 'create');
  19616. /** Used to store function metadata. */
  19617. var metaMap = WeakMap && new WeakMap;
  19618. /** Used to lookup unminified function names. */
  19619. var realNames = {};
  19620. /** Used to detect maps, sets, and weakmaps. */
  19621. var dataViewCtorString = toSource(DataView),
  19622. mapCtorString = toSource(Map),
  19623. promiseCtorString = toSource(Promise),
  19624. setCtorString = toSource(Set),
  19625. weakMapCtorString = toSource(WeakMap);
  19626. /** Used to convert symbols to primitives and strings. */
  19627. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19628. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19629. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19630. /*------------------------------------------------------------------------*/
  19631. /**
  19632. * Creates a `lodash` object which wraps `value` to enable implicit method
  19633. * chain sequences. Methods that operate on and return arrays, collections,
  19634. * and functions can be chained together. Methods that retrieve a single value
  19635. * or may return a primitive value will automatically end the chain sequence
  19636. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19637. * with `_#value`.
  19638. *
  19639. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19640. * enabled using `_.chain`.
  19641. *
  19642. * The execution of chained methods is lazy, that is, it's deferred until
  19643. * `_#value` is implicitly or explicitly called.
  19644. *
  19645. * Lazy evaluation allows several methods to support shortcut fusion.
  19646. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19647. * the creation of intermediate arrays and can greatly reduce the number of
  19648. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19649. * fusion if the section is applied to an array and iteratees accept only
  19650. * one argument. The heuristic for whether a section qualifies for shortcut
  19651. * fusion is subject to change.
  19652. *
  19653. * Chaining is supported in custom builds as long as the `_#value` method is
  19654. * directly or indirectly included in the build.
  19655. *
  19656. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19657. *
  19658. * The wrapper `Array` methods are:
  19659. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19660. *
  19661. * The wrapper `String` methods are:
  19662. * `replace` and `split`
  19663. *
  19664. * The wrapper methods that support shortcut fusion are:
  19665. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19666. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19667. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19668. *
  19669. * The chainable wrapper methods are:
  19670. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19671. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19672. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19673. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19674. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19675. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19676. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19677. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19678. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19679. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19680. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19681. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19682. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19683. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19684. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19685. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19686. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19687. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19688. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19689. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19690. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19691. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19692. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19693. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19694. *
  19695. * The wrapper methods that are **not** chainable by default are:
  19696. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19697. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19698. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19699. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19700. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19701. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19702. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19703. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19704. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19705. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19706. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19707. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19708. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19709. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19710. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19711. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19712. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19713. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19714. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19715. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19716. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19717. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19718. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19719. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19720. * `upperFirst`, `value`, and `words`
  19721. *
  19722. * @name _
  19723. * @constructor
  19724. * @category Seq
  19725. * @param {*} value The value to wrap in a `lodash` instance.
  19726. * @returns {Object} Returns the new `lodash` wrapper instance.
  19727. * @example
  19728. *
  19729. * function square(n) {
  19730. * return n * n;
  19731. * }
  19732. *
  19733. * var wrapped = _([1, 2, 3]);
  19734. *
  19735. * // Returns an unwrapped value.
  19736. * wrapped.reduce(_.add);
  19737. * // => 6
  19738. *
  19739. * // Returns a wrapped value.
  19740. * var squares = wrapped.map(square);
  19741. *
  19742. * _.isArray(squares);
  19743. * // => false
  19744. *
  19745. * _.isArray(squares.value());
  19746. * // => true
  19747. */
  19748. function lodash(value) {
  19749. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19750. if (value instanceof LodashWrapper) {
  19751. return value;
  19752. }
  19753. if (hasOwnProperty.call(value, '__wrapped__')) {
  19754. return wrapperClone(value);
  19755. }
  19756. }
  19757. return new LodashWrapper(value);
  19758. }
  19759. /**
  19760. * The base implementation of `_.create` without support for assigning
  19761. * properties to the created object.
  19762. *
  19763. * @private
  19764. * @param {Object} proto The object to inherit from.
  19765. * @returns {Object} Returns the new object.
  19766. */
  19767. var baseCreate = (function() {
  19768. function object() {}
  19769. return function(proto) {
  19770. if (!isObject(proto)) {
  19771. return {};
  19772. }
  19773. if (objectCreate) {
  19774. return objectCreate(proto);
  19775. }
  19776. object.prototype = proto;
  19777. var result = new object;
  19778. object.prototype = undefined;
  19779. return result;
  19780. };
  19781. }());
  19782. /**
  19783. * The function whose prototype chain sequence wrappers inherit from.
  19784. *
  19785. * @private
  19786. */
  19787. function baseLodash() {
  19788. // No operation performed.
  19789. }
  19790. /**
  19791. * The base constructor for creating `lodash` wrapper objects.
  19792. *
  19793. * @private
  19794. * @param {*} value The value to wrap.
  19795. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19796. */
  19797. function LodashWrapper(value, chainAll) {
  19798. this.__wrapped__ = value;
  19799. this.__actions__ = [];
  19800. this.__chain__ = !!chainAll;
  19801. this.__index__ = 0;
  19802. this.__values__ = undefined;
  19803. }
  19804. /**
  19805. * By default, the template delimiters used by lodash are like those in
  19806. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19807. * following template settings to use alternative delimiters.
  19808. *
  19809. * @static
  19810. * @memberOf _
  19811. * @type {Object}
  19812. */
  19813. lodash.templateSettings = {
  19814. /**
  19815. * Used to detect `data` property values to be HTML-escaped.
  19816. *
  19817. * @memberOf _.templateSettings
  19818. * @type {RegExp}
  19819. */
  19820. 'escape': reEscape,
  19821. /**
  19822. * Used to detect code to be evaluated.
  19823. *
  19824. * @memberOf _.templateSettings
  19825. * @type {RegExp}
  19826. */
  19827. 'evaluate': reEvaluate,
  19828. /**
  19829. * Used to detect `data` property values to inject.
  19830. *
  19831. * @memberOf _.templateSettings
  19832. * @type {RegExp}
  19833. */
  19834. 'interpolate': reInterpolate,
  19835. /**
  19836. * Used to reference the data object in the template text.
  19837. *
  19838. * @memberOf _.templateSettings
  19839. * @type {string}
  19840. */
  19841. 'variable': '',
  19842. /**
  19843. * Used to import variables into the compiled template.
  19844. *
  19845. * @memberOf _.templateSettings
  19846. * @type {Object}
  19847. */
  19848. 'imports': {
  19849. /**
  19850. * A reference to the `lodash` function.
  19851. *
  19852. * @memberOf _.templateSettings.imports
  19853. * @type {Function}
  19854. */
  19855. '_': lodash
  19856. }
  19857. };
  19858. // Ensure wrappers are instances of `baseLodash`.
  19859. lodash.prototype = baseLodash.prototype;
  19860. lodash.prototype.constructor = lodash;
  19861. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19862. LodashWrapper.prototype.constructor = LodashWrapper;
  19863. /*------------------------------------------------------------------------*/
  19864. /**
  19865. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19866. *
  19867. * @private
  19868. * @constructor
  19869. * @param {*} value The value to wrap.
  19870. */
  19871. function LazyWrapper(value) {
  19872. this.__wrapped__ = value;
  19873. this.__actions__ = [];
  19874. this.__dir__ = 1;
  19875. this.__filtered__ = false;
  19876. this.__iteratees__ = [];
  19877. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19878. this.__views__ = [];
  19879. }
  19880. /**
  19881. * Creates a clone of the lazy wrapper object.
  19882. *
  19883. * @private
  19884. * @name clone
  19885. * @memberOf LazyWrapper
  19886. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19887. */
  19888. function lazyClone() {
  19889. var result = new LazyWrapper(this.__wrapped__);
  19890. result.__actions__ = copyArray(this.__actions__);
  19891. result.__dir__ = this.__dir__;
  19892. result.__filtered__ = this.__filtered__;
  19893. result.__iteratees__ = copyArray(this.__iteratees__);
  19894. result.__takeCount__ = this.__takeCount__;
  19895. result.__views__ = copyArray(this.__views__);
  19896. return result;
  19897. }
  19898. /**
  19899. * Reverses the direction of lazy iteration.
  19900. *
  19901. * @private
  19902. * @name reverse
  19903. * @memberOf LazyWrapper
  19904. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19905. */
  19906. function lazyReverse() {
  19907. if (this.__filtered__) {
  19908. var result = new LazyWrapper(this);
  19909. result.__dir__ = -1;
  19910. result.__filtered__ = true;
  19911. } else {
  19912. result = this.clone();
  19913. result.__dir__ *= -1;
  19914. }
  19915. return result;
  19916. }
  19917. /**
  19918. * Extracts the unwrapped value from its lazy wrapper.
  19919. *
  19920. * @private
  19921. * @name value
  19922. * @memberOf LazyWrapper
  19923. * @returns {*} Returns the unwrapped value.
  19924. */
  19925. function lazyValue() {
  19926. var array = this.__wrapped__.value(),
  19927. dir = this.__dir__,
  19928. isArr = isArray(array),
  19929. isRight = dir < 0,
  19930. arrLength = isArr ? array.length : 0,
  19931. view = getView(0, arrLength, this.__views__),
  19932. start = view.start,
  19933. end = view.end,
  19934. length = end - start,
  19935. index = isRight ? end : (start - 1),
  19936. iteratees = this.__iteratees__,
  19937. iterLength = iteratees.length,
  19938. resIndex = 0,
  19939. takeCount = nativeMin(length, this.__takeCount__);
  19940. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19941. return baseWrapperValue(array, this.__actions__);
  19942. }
  19943. var result = [];
  19944. outer:
  19945. while (length-- && resIndex < takeCount) {
  19946. index += dir;
  19947. var iterIndex = -1,
  19948. value = array[index];
  19949. while (++iterIndex < iterLength) {
  19950. var data = iteratees[iterIndex],
  19951. iteratee = data.iteratee,
  19952. type = data.type,
  19953. computed = iteratee(value);
  19954. if (type == LAZY_MAP_FLAG) {
  19955. value = computed;
  19956. } else if (!computed) {
  19957. if (type == LAZY_FILTER_FLAG) {
  19958. continue outer;
  19959. } else {
  19960. break outer;
  19961. }
  19962. }
  19963. }
  19964. result[resIndex++] = value;
  19965. }
  19966. return result;
  19967. }
  19968. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19969. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  19970. LazyWrapper.prototype.constructor = LazyWrapper;
  19971. /*------------------------------------------------------------------------*/
  19972. /**
  19973. * Creates a hash object.
  19974. *
  19975. * @private
  19976. * @constructor
  19977. * @param {Array} [entries] The key-value pairs to cache.
  19978. */
  19979. function Hash(entries) {
  19980. var index = -1,
  19981. length = entries == null ? 0 : entries.length;
  19982. this.clear();
  19983. while (++index < length) {
  19984. var entry = entries[index];
  19985. this.set(entry[0], entry[1]);
  19986. }
  19987. }
  19988. /**
  19989. * Removes all key-value entries from the hash.
  19990. *
  19991. * @private
  19992. * @name clear
  19993. * @memberOf Hash
  19994. */
  19995. function hashClear() {
  19996. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  19997. this.size = 0;
  19998. }
  19999. /**
  20000. * Removes `key` and its value from the hash.
  20001. *
  20002. * @private
  20003. * @name delete
  20004. * @memberOf Hash
  20005. * @param {Object} hash The hash to modify.
  20006. * @param {string} key The key of the value to remove.
  20007. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20008. */
  20009. function hashDelete(key) {
  20010. var result = this.has(key) && delete this.__data__[key];
  20011. this.size -= result ? 1 : 0;
  20012. return result;
  20013. }
  20014. /**
  20015. * Gets the hash value for `key`.
  20016. *
  20017. * @private
  20018. * @name get
  20019. * @memberOf Hash
  20020. * @param {string} key The key of the value to get.
  20021. * @returns {*} Returns the entry value.
  20022. */
  20023. function hashGet(key) {
  20024. var data = this.__data__;
  20025. if (nativeCreate) {
  20026. var result = data[key];
  20027. return result === HASH_UNDEFINED ? undefined : result;
  20028. }
  20029. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20030. }
  20031. /**
  20032. * Checks if a hash value for `key` exists.
  20033. *
  20034. * @private
  20035. * @name has
  20036. * @memberOf Hash
  20037. * @param {string} key The key of the entry to check.
  20038. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20039. */
  20040. function hashHas(key) {
  20041. var data = this.__data__;
  20042. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20043. }
  20044. /**
  20045. * Sets the hash `key` to `value`.
  20046. *
  20047. * @private
  20048. * @name set
  20049. * @memberOf Hash
  20050. * @param {string} key The key of the value to set.
  20051. * @param {*} value The value to set.
  20052. * @returns {Object} Returns the hash instance.
  20053. */
  20054. function hashSet(key, value) {
  20055. var data = this.__data__;
  20056. this.size += this.has(key) ? 0 : 1;
  20057. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20058. return this;
  20059. }
  20060. // Add methods to `Hash`.
  20061. Hash.prototype.clear = hashClear;
  20062. Hash.prototype['delete'] = hashDelete;
  20063. Hash.prototype.get = hashGet;
  20064. Hash.prototype.has = hashHas;
  20065. Hash.prototype.set = hashSet;
  20066. /*------------------------------------------------------------------------*/
  20067. /**
  20068. * Creates an list cache object.
  20069. *
  20070. * @private
  20071. * @constructor
  20072. * @param {Array} [entries] The key-value pairs to cache.
  20073. */
  20074. function ListCache(entries) {
  20075. var index = -1,
  20076. length = entries == null ? 0 : entries.length;
  20077. this.clear();
  20078. while (++index < length) {
  20079. var entry = entries[index];
  20080. this.set(entry[0], entry[1]);
  20081. }
  20082. }
  20083. /**
  20084. * Removes all key-value entries from the list cache.
  20085. *
  20086. * @private
  20087. * @name clear
  20088. * @memberOf ListCache
  20089. */
  20090. function listCacheClear() {
  20091. this.__data__ = [];
  20092. this.size = 0;
  20093. }
  20094. /**
  20095. * Removes `key` and its value from the list cache.
  20096. *
  20097. * @private
  20098. * @name delete
  20099. * @memberOf ListCache
  20100. * @param {string} key The key of the value to remove.
  20101. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20102. */
  20103. function listCacheDelete(key) {
  20104. var data = this.__data__,
  20105. index = assocIndexOf(data, key);
  20106. if (index < 0) {
  20107. return false;
  20108. }
  20109. var lastIndex = data.length - 1;
  20110. if (index == lastIndex) {
  20111. data.pop();
  20112. } else {
  20113. splice.call(data, index, 1);
  20114. }
  20115. --this.size;
  20116. return true;
  20117. }
  20118. /**
  20119. * Gets the list cache value for `key`.
  20120. *
  20121. * @private
  20122. * @name get
  20123. * @memberOf ListCache
  20124. * @param {string} key The key of the value to get.
  20125. * @returns {*} Returns the entry value.
  20126. */
  20127. function listCacheGet(key) {
  20128. var data = this.__data__,
  20129. index = assocIndexOf(data, key);
  20130. return index < 0 ? undefined : data[index][1];
  20131. }
  20132. /**
  20133. * Checks if a list cache value for `key` exists.
  20134. *
  20135. * @private
  20136. * @name has
  20137. * @memberOf ListCache
  20138. * @param {string} key The key of the entry to check.
  20139. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20140. */
  20141. function listCacheHas(key) {
  20142. return assocIndexOf(this.__data__, key) > -1;
  20143. }
  20144. /**
  20145. * Sets the list cache `key` to `value`.
  20146. *
  20147. * @private
  20148. * @name set
  20149. * @memberOf ListCache
  20150. * @param {string} key The key of the value to set.
  20151. * @param {*} value The value to set.
  20152. * @returns {Object} Returns the list cache instance.
  20153. */
  20154. function listCacheSet(key, value) {
  20155. var data = this.__data__,
  20156. index = assocIndexOf(data, key);
  20157. if (index < 0) {
  20158. ++this.size;
  20159. data.push([key, value]);
  20160. } else {
  20161. data[index][1] = value;
  20162. }
  20163. return this;
  20164. }
  20165. // Add methods to `ListCache`.
  20166. ListCache.prototype.clear = listCacheClear;
  20167. ListCache.prototype['delete'] = listCacheDelete;
  20168. ListCache.prototype.get = listCacheGet;
  20169. ListCache.prototype.has = listCacheHas;
  20170. ListCache.prototype.set = listCacheSet;
  20171. /*------------------------------------------------------------------------*/
  20172. /**
  20173. * Creates a map cache object to store key-value pairs.
  20174. *
  20175. * @private
  20176. * @constructor
  20177. * @param {Array} [entries] The key-value pairs to cache.
  20178. */
  20179. function MapCache(entries) {
  20180. var index = -1,
  20181. length = entries == null ? 0 : entries.length;
  20182. this.clear();
  20183. while (++index < length) {
  20184. var entry = entries[index];
  20185. this.set(entry[0], entry[1]);
  20186. }
  20187. }
  20188. /**
  20189. * Removes all key-value entries from the map.
  20190. *
  20191. * @private
  20192. * @name clear
  20193. * @memberOf MapCache
  20194. */
  20195. function mapCacheClear() {
  20196. this.size = 0;
  20197. this.__data__ = {
  20198. 'hash': new Hash,
  20199. 'map': new (Map || ListCache),
  20200. 'string': new Hash
  20201. };
  20202. }
  20203. /**
  20204. * Removes `key` and its value from the map.
  20205. *
  20206. * @private
  20207. * @name delete
  20208. * @memberOf MapCache
  20209. * @param {string} key The key of the value to remove.
  20210. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20211. */
  20212. function mapCacheDelete(key) {
  20213. var result = getMapData(this, key)['delete'](key);
  20214. this.size -= result ? 1 : 0;
  20215. return result;
  20216. }
  20217. /**
  20218. * Gets the map value for `key`.
  20219. *
  20220. * @private
  20221. * @name get
  20222. * @memberOf MapCache
  20223. * @param {string} key The key of the value to get.
  20224. * @returns {*} Returns the entry value.
  20225. */
  20226. function mapCacheGet(key) {
  20227. return getMapData(this, key).get(key);
  20228. }
  20229. /**
  20230. * Checks if a map value for `key` exists.
  20231. *
  20232. * @private
  20233. * @name has
  20234. * @memberOf MapCache
  20235. * @param {string} key The key of the entry to check.
  20236. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20237. */
  20238. function mapCacheHas(key) {
  20239. return getMapData(this, key).has(key);
  20240. }
  20241. /**
  20242. * Sets the map `key` to `value`.
  20243. *
  20244. * @private
  20245. * @name set
  20246. * @memberOf MapCache
  20247. * @param {string} key The key of the value to set.
  20248. * @param {*} value The value to set.
  20249. * @returns {Object} Returns the map cache instance.
  20250. */
  20251. function mapCacheSet(key, value) {
  20252. var data = getMapData(this, key),
  20253. size = data.size;
  20254. data.set(key, value);
  20255. this.size += data.size == size ? 0 : 1;
  20256. return this;
  20257. }
  20258. // Add methods to `MapCache`.
  20259. MapCache.prototype.clear = mapCacheClear;
  20260. MapCache.prototype['delete'] = mapCacheDelete;
  20261. MapCache.prototype.get = mapCacheGet;
  20262. MapCache.prototype.has = mapCacheHas;
  20263. MapCache.prototype.set = mapCacheSet;
  20264. /*------------------------------------------------------------------------*/
  20265. /**
  20266. *
  20267. * Creates an array cache object to store unique values.
  20268. *
  20269. * @private
  20270. * @constructor
  20271. * @param {Array} [values] The values to cache.
  20272. */
  20273. function SetCache(values) {
  20274. var index = -1,
  20275. length = values == null ? 0 : values.length;
  20276. this.__data__ = new MapCache;
  20277. while (++index < length) {
  20278. this.add(values[index]);
  20279. }
  20280. }
  20281. /**
  20282. * Adds `value` to the array cache.
  20283. *
  20284. * @private
  20285. * @name add
  20286. * @memberOf SetCache
  20287. * @alias push
  20288. * @param {*} value The value to cache.
  20289. * @returns {Object} Returns the cache instance.
  20290. */
  20291. function setCacheAdd(value) {
  20292. this.__data__.set(value, HASH_UNDEFINED);
  20293. return this;
  20294. }
  20295. /**
  20296. * Checks if `value` is in the array cache.
  20297. *
  20298. * @private
  20299. * @name has
  20300. * @memberOf SetCache
  20301. * @param {*} value The value to search for.
  20302. * @returns {number} Returns `true` if `value` is found, else `false`.
  20303. */
  20304. function setCacheHas(value) {
  20305. return this.__data__.has(value);
  20306. }
  20307. // Add methods to `SetCache`.
  20308. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20309. SetCache.prototype.has = setCacheHas;
  20310. /*------------------------------------------------------------------------*/
  20311. /**
  20312. * Creates a stack cache object to store key-value pairs.
  20313. *
  20314. * @private
  20315. * @constructor
  20316. * @param {Array} [entries] The key-value pairs to cache.
  20317. */
  20318. function Stack(entries) {
  20319. var data = this.__data__ = new ListCache(entries);
  20320. this.size = data.size;
  20321. }
  20322. /**
  20323. * Removes all key-value entries from the stack.
  20324. *
  20325. * @private
  20326. * @name clear
  20327. * @memberOf Stack
  20328. */
  20329. function stackClear() {
  20330. this.__data__ = new ListCache;
  20331. this.size = 0;
  20332. }
  20333. /**
  20334. * Removes `key` and its value from the stack.
  20335. *
  20336. * @private
  20337. * @name delete
  20338. * @memberOf Stack
  20339. * @param {string} key The key of the value to remove.
  20340. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20341. */
  20342. function stackDelete(key) {
  20343. var data = this.__data__,
  20344. result = data['delete'](key);
  20345. this.size = data.size;
  20346. return result;
  20347. }
  20348. /**
  20349. * Gets the stack value for `key`.
  20350. *
  20351. * @private
  20352. * @name get
  20353. * @memberOf Stack
  20354. * @param {string} key The key of the value to get.
  20355. * @returns {*} Returns the entry value.
  20356. */
  20357. function stackGet(key) {
  20358. return this.__data__.get(key);
  20359. }
  20360. /**
  20361. * Checks if a stack value for `key` exists.
  20362. *
  20363. * @private
  20364. * @name has
  20365. * @memberOf Stack
  20366. * @param {string} key The key of the entry to check.
  20367. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20368. */
  20369. function stackHas(key) {
  20370. return this.__data__.has(key);
  20371. }
  20372. /**
  20373. * Sets the stack `key` to `value`.
  20374. *
  20375. * @private
  20376. * @name set
  20377. * @memberOf Stack
  20378. * @param {string} key The key of the value to set.
  20379. * @param {*} value The value to set.
  20380. * @returns {Object} Returns the stack cache instance.
  20381. */
  20382. function stackSet(key, value) {
  20383. var data = this.__data__;
  20384. if (data instanceof ListCache) {
  20385. var pairs = data.__data__;
  20386. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20387. pairs.push([key, value]);
  20388. this.size = ++data.size;
  20389. return this;
  20390. }
  20391. data = this.__data__ = new MapCache(pairs);
  20392. }
  20393. data.set(key, value);
  20394. this.size = data.size;
  20395. return this;
  20396. }
  20397. // Add methods to `Stack`.
  20398. Stack.prototype.clear = stackClear;
  20399. Stack.prototype['delete'] = stackDelete;
  20400. Stack.prototype.get = stackGet;
  20401. Stack.prototype.has = stackHas;
  20402. Stack.prototype.set = stackSet;
  20403. /*------------------------------------------------------------------------*/
  20404. /**
  20405. * Creates an array of the enumerable property names of the array-like `value`.
  20406. *
  20407. * @private
  20408. * @param {*} value The value to query.
  20409. * @param {boolean} inherited Specify returning inherited property names.
  20410. * @returns {Array} Returns the array of property names.
  20411. */
  20412. function arrayLikeKeys(value, inherited) {
  20413. var isArr = isArray(value),
  20414. isArg = !isArr && isArguments(value),
  20415. isBuff = !isArr && !isArg && isBuffer(value),
  20416. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20417. skipIndexes = isArr || isArg || isBuff || isType,
  20418. result = skipIndexes ? baseTimes(value.length, String) : [],
  20419. length = result.length;
  20420. for (var key in value) {
  20421. if ((inherited || hasOwnProperty.call(value, key)) &&
  20422. !(skipIndexes && (
  20423. // Safari 9 has enumerable `arguments.length` in strict mode.
  20424. key == 'length' ||
  20425. // Node.js 0.10 has enumerable non-index properties on buffers.
  20426. (isBuff && (key == 'offset' || key == 'parent')) ||
  20427. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20428. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20429. // Skip index properties.
  20430. isIndex(key, length)
  20431. ))) {
  20432. result.push(key);
  20433. }
  20434. }
  20435. return result;
  20436. }
  20437. /**
  20438. * A specialized version of `_.sample` for arrays.
  20439. *
  20440. * @private
  20441. * @param {Array} array The array to sample.
  20442. * @returns {*} Returns the random element.
  20443. */
  20444. function arraySample(array) {
  20445. var length = array.length;
  20446. return length ? array[baseRandom(0, length - 1)] : undefined;
  20447. }
  20448. /**
  20449. * A specialized version of `_.sampleSize` for arrays.
  20450. *
  20451. * @private
  20452. * @param {Array} array The array to sample.
  20453. * @param {number} n The number of elements to sample.
  20454. * @returns {Array} Returns the random elements.
  20455. */
  20456. function arraySampleSize(array, n) {
  20457. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20458. }
  20459. /**
  20460. * A specialized version of `_.shuffle` for arrays.
  20461. *
  20462. * @private
  20463. * @param {Array} array The array to shuffle.
  20464. * @returns {Array} Returns the new shuffled array.
  20465. */
  20466. function arrayShuffle(array) {
  20467. return shuffleSelf(copyArray(array));
  20468. }
  20469. /**
  20470. * This function is like `assignValue` except that it doesn't assign
  20471. * `undefined` values.
  20472. *
  20473. * @private
  20474. * @param {Object} object The object to modify.
  20475. * @param {string} key The key of the property to assign.
  20476. * @param {*} value The value to assign.
  20477. */
  20478. function assignMergeValue(object, key, value) {
  20479. if ((value !== undefined && !eq(object[key], value)) ||
  20480. (value === undefined && !(key in object))) {
  20481. baseAssignValue(object, key, value);
  20482. }
  20483. }
  20484. /**
  20485. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20486. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20487. * for equality comparisons.
  20488. *
  20489. * @private
  20490. * @param {Object} object The object to modify.
  20491. * @param {string} key The key of the property to assign.
  20492. * @param {*} value The value to assign.
  20493. */
  20494. function assignValue(object, key, value) {
  20495. var objValue = object[key];
  20496. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20497. (value === undefined && !(key in object))) {
  20498. baseAssignValue(object, key, value);
  20499. }
  20500. }
  20501. /**
  20502. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20503. *
  20504. * @private
  20505. * @param {Array} array The array to inspect.
  20506. * @param {*} key The key to search for.
  20507. * @returns {number} Returns the index of the matched value, else `-1`.
  20508. */
  20509. function assocIndexOf(array, key) {
  20510. var length = array.length;
  20511. while (length--) {
  20512. if (eq(array[length][0], key)) {
  20513. return length;
  20514. }
  20515. }
  20516. return -1;
  20517. }
  20518. /**
  20519. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20520. * by `iteratee` and values set by `setter`.
  20521. *
  20522. * @private
  20523. * @param {Array|Object} collection The collection to iterate over.
  20524. * @param {Function} setter The function to set `accumulator` values.
  20525. * @param {Function} iteratee The iteratee to transform keys.
  20526. * @param {Object} accumulator The initial aggregated object.
  20527. * @returns {Function} Returns `accumulator`.
  20528. */
  20529. function baseAggregator(collection, setter, iteratee, accumulator) {
  20530. baseEach(collection, function(value, key, collection) {
  20531. setter(accumulator, value, iteratee(value), collection);
  20532. });
  20533. return accumulator;
  20534. }
  20535. /**
  20536. * The base implementation of `_.assign` without support for multiple sources
  20537. * or `customizer` functions.
  20538. *
  20539. * @private
  20540. * @param {Object} object The destination object.
  20541. * @param {Object} source The source object.
  20542. * @returns {Object} Returns `object`.
  20543. */
  20544. function baseAssign(object, source) {
  20545. return object && copyObject(source, keys(source), object);
  20546. }
  20547. /**
  20548. * The base implementation of `_.assignIn` without support for multiple sources
  20549. * or `customizer` functions.
  20550. *
  20551. * @private
  20552. * @param {Object} object The destination object.
  20553. * @param {Object} source The source object.
  20554. * @returns {Object} Returns `object`.
  20555. */
  20556. function baseAssignIn(object, source) {
  20557. return object && copyObject(source, keysIn(source), object);
  20558. }
  20559. /**
  20560. * The base implementation of `assignValue` and `assignMergeValue` without
  20561. * value checks.
  20562. *
  20563. * @private
  20564. * @param {Object} object The object to modify.
  20565. * @param {string} key The key of the property to assign.
  20566. * @param {*} value The value to assign.
  20567. */
  20568. function baseAssignValue(object, key, value) {
  20569. if (key == '__proto__' && defineProperty) {
  20570. defineProperty(object, key, {
  20571. 'configurable': true,
  20572. 'enumerable': true,
  20573. 'value': value,
  20574. 'writable': true
  20575. });
  20576. } else {
  20577. object[key] = value;
  20578. }
  20579. }
  20580. /**
  20581. * The base implementation of `_.at` without support for individual paths.
  20582. *
  20583. * @private
  20584. * @param {Object} object The object to iterate over.
  20585. * @param {string[]} paths The property paths to pick.
  20586. * @returns {Array} Returns the picked elements.
  20587. */
  20588. function baseAt(object, paths) {
  20589. var index = -1,
  20590. length = paths.length,
  20591. result = Array(length),
  20592. skip = object == null;
  20593. while (++index < length) {
  20594. result[index] = skip ? undefined : get(object, paths[index]);
  20595. }
  20596. return result;
  20597. }
  20598. /**
  20599. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20600. *
  20601. * @private
  20602. * @param {number} number The number to clamp.
  20603. * @param {number} [lower] The lower bound.
  20604. * @param {number} upper The upper bound.
  20605. * @returns {number} Returns the clamped number.
  20606. */
  20607. function baseClamp(number, lower, upper) {
  20608. if (number === number) {
  20609. if (upper !== undefined) {
  20610. number = number <= upper ? number : upper;
  20611. }
  20612. if (lower !== undefined) {
  20613. number = number >= lower ? number : lower;
  20614. }
  20615. }
  20616. return number;
  20617. }
  20618. /**
  20619. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20620. * traversed objects.
  20621. *
  20622. * @private
  20623. * @param {*} value The value to clone.
  20624. * @param {boolean} bitmask The bitmask flags.
  20625. * 1 - Deep clone
  20626. * 2 - Flatten inherited properties
  20627. * 4 - Clone symbols
  20628. * @param {Function} [customizer] The function to customize cloning.
  20629. * @param {string} [key] The key of `value`.
  20630. * @param {Object} [object] The parent object of `value`.
  20631. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20632. * @returns {*} Returns the cloned value.
  20633. */
  20634. function baseClone(value, bitmask, customizer, key, object, stack) {
  20635. var result,
  20636. isDeep = bitmask & CLONE_DEEP_FLAG,
  20637. isFlat = bitmask & CLONE_FLAT_FLAG,
  20638. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20639. if (customizer) {
  20640. result = object ? customizer(value, key, object, stack) : customizer(value);
  20641. }
  20642. if (result !== undefined) {
  20643. return result;
  20644. }
  20645. if (!isObject(value)) {
  20646. return value;
  20647. }
  20648. var isArr = isArray(value);
  20649. if (isArr) {
  20650. result = initCloneArray(value);
  20651. if (!isDeep) {
  20652. return copyArray(value, result);
  20653. }
  20654. } else {
  20655. var tag = getTag(value),
  20656. isFunc = tag == funcTag || tag == genTag;
  20657. if (isBuffer(value)) {
  20658. return cloneBuffer(value, isDeep);
  20659. }
  20660. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20661. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20662. if (!isDeep) {
  20663. return isFlat
  20664. ? copySymbolsIn(value, baseAssignIn(result, value))
  20665. : copySymbols(value, baseAssign(result, value));
  20666. }
  20667. } else {
  20668. if (!cloneableTags[tag]) {
  20669. return object ? value : {};
  20670. }
  20671. result = initCloneByTag(value, tag, isDeep);
  20672. }
  20673. }
  20674. // Check for circular references and return its corresponding clone.
  20675. stack || (stack = new Stack);
  20676. var stacked = stack.get(value);
  20677. if (stacked) {
  20678. return stacked;
  20679. }
  20680. stack.set(value, result);
  20681. if (isSet(value)) {
  20682. value.forEach(function(subValue) {
  20683. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20684. });
  20685. } else if (isMap(value)) {
  20686. value.forEach(function(subValue, key) {
  20687. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20688. });
  20689. }
  20690. var keysFunc = isFull
  20691. ? (isFlat ? getAllKeysIn : getAllKeys)
  20692. : (isFlat ? keysIn : keys);
  20693. var props = isArr ? undefined : keysFunc(value);
  20694. arrayEach(props || value, function(subValue, key) {
  20695. if (props) {
  20696. key = subValue;
  20697. subValue = value[key];
  20698. }
  20699. // Recursively populate clone (susceptible to call stack limits).
  20700. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20701. });
  20702. return result;
  20703. }
  20704. /**
  20705. * The base implementation of `_.conforms` which doesn't clone `source`.
  20706. *
  20707. * @private
  20708. * @param {Object} source The object of property predicates to conform to.
  20709. * @returns {Function} Returns the new spec function.
  20710. */
  20711. function baseConforms(source) {
  20712. var props = keys(source);
  20713. return function(object) {
  20714. return baseConformsTo(object, source, props);
  20715. };
  20716. }
  20717. /**
  20718. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20719. *
  20720. * @private
  20721. * @param {Object} object The object to inspect.
  20722. * @param {Object} source The object of property predicates to conform to.
  20723. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20724. */
  20725. function baseConformsTo(object, source, props) {
  20726. var length = props.length;
  20727. if (object == null) {
  20728. return !length;
  20729. }
  20730. object = Object(object);
  20731. while (length--) {
  20732. var key = props[length],
  20733. predicate = source[key],
  20734. value = object[key];
  20735. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20736. return false;
  20737. }
  20738. }
  20739. return true;
  20740. }
  20741. /**
  20742. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20743. * to provide to `func`.
  20744. *
  20745. * @private
  20746. * @param {Function} func The function to delay.
  20747. * @param {number} wait The number of milliseconds to delay invocation.
  20748. * @param {Array} args The arguments to provide to `func`.
  20749. * @returns {number|Object} Returns the timer id or timeout object.
  20750. */
  20751. function baseDelay(func, wait, args) {
  20752. if (typeof func != 'function') {
  20753. throw new TypeError(FUNC_ERROR_TEXT);
  20754. }
  20755. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20756. }
  20757. /**
  20758. * The base implementation of methods like `_.difference` without support
  20759. * for excluding multiple arrays or iteratee shorthands.
  20760. *
  20761. * @private
  20762. * @param {Array} array The array to inspect.
  20763. * @param {Array} values The values to exclude.
  20764. * @param {Function} [iteratee] The iteratee invoked per element.
  20765. * @param {Function} [comparator] The comparator invoked per element.
  20766. * @returns {Array} Returns the new array of filtered values.
  20767. */
  20768. function baseDifference(array, values, iteratee, comparator) {
  20769. var index = -1,
  20770. includes = arrayIncludes,
  20771. isCommon = true,
  20772. length = array.length,
  20773. result = [],
  20774. valuesLength = values.length;
  20775. if (!length) {
  20776. return result;
  20777. }
  20778. if (iteratee) {
  20779. values = arrayMap(values, baseUnary(iteratee));
  20780. }
  20781. if (comparator) {
  20782. includes = arrayIncludesWith;
  20783. isCommon = false;
  20784. }
  20785. else if (values.length >= LARGE_ARRAY_SIZE) {
  20786. includes = cacheHas;
  20787. isCommon = false;
  20788. values = new SetCache(values);
  20789. }
  20790. outer:
  20791. while (++index < length) {
  20792. var value = array[index],
  20793. computed = iteratee == null ? value : iteratee(value);
  20794. value = (comparator || value !== 0) ? value : 0;
  20795. if (isCommon && computed === computed) {
  20796. var valuesIndex = valuesLength;
  20797. while (valuesIndex--) {
  20798. if (values[valuesIndex] === computed) {
  20799. continue outer;
  20800. }
  20801. }
  20802. result.push(value);
  20803. }
  20804. else if (!includes(values, computed, comparator)) {
  20805. result.push(value);
  20806. }
  20807. }
  20808. return result;
  20809. }
  20810. /**
  20811. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20812. *
  20813. * @private
  20814. * @param {Array|Object} collection The collection to iterate over.
  20815. * @param {Function} iteratee The function invoked per iteration.
  20816. * @returns {Array|Object} Returns `collection`.
  20817. */
  20818. var baseEach = createBaseEach(baseForOwn);
  20819. /**
  20820. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20821. *
  20822. * @private
  20823. * @param {Array|Object} collection The collection to iterate over.
  20824. * @param {Function} iteratee The function invoked per iteration.
  20825. * @returns {Array|Object} Returns `collection`.
  20826. */
  20827. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20828. /**
  20829. * The base implementation of `_.every` without support for iteratee shorthands.
  20830. *
  20831. * @private
  20832. * @param {Array|Object} collection The collection to iterate over.
  20833. * @param {Function} predicate The function invoked per iteration.
  20834. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20835. * else `false`
  20836. */
  20837. function baseEvery(collection, predicate) {
  20838. var result = true;
  20839. baseEach(collection, function(value, index, collection) {
  20840. result = !!predicate(value, index, collection);
  20841. return result;
  20842. });
  20843. return result;
  20844. }
  20845. /**
  20846. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20847. * `comparator` to determine the extremum value.
  20848. *
  20849. * @private
  20850. * @param {Array} array The array to iterate over.
  20851. * @param {Function} iteratee The iteratee invoked per iteration.
  20852. * @param {Function} comparator The comparator used to compare values.
  20853. * @returns {*} Returns the extremum value.
  20854. */
  20855. function baseExtremum(array, iteratee, comparator) {
  20856. var index = -1,
  20857. length = array.length;
  20858. while (++index < length) {
  20859. var value = array[index],
  20860. current = iteratee(value);
  20861. if (current != null && (computed === undefined
  20862. ? (current === current && !isSymbol(current))
  20863. : comparator(current, computed)
  20864. )) {
  20865. var computed = current,
  20866. result = value;
  20867. }
  20868. }
  20869. return result;
  20870. }
  20871. /**
  20872. * The base implementation of `_.fill` without an iteratee call guard.
  20873. *
  20874. * @private
  20875. * @param {Array} array The array to fill.
  20876. * @param {*} value The value to fill `array` with.
  20877. * @param {number} [start=0] The start position.
  20878. * @param {number} [end=array.length] The end position.
  20879. * @returns {Array} Returns `array`.
  20880. */
  20881. function baseFill(array, value, start, end) {
  20882. var length = array.length;
  20883. start = toInteger(start);
  20884. if (start < 0) {
  20885. start = -start > length ? 0 : (length + start);
  20886. }
  20887. end = (end === undefined || end > length) ? length : toInteger(end);
  20888. if (end < 0) {
  20889. end += length;
  20890. }
  20891. end = start > end ? 0 : toLength(end);
  20892. while (start < end) {
  20893. array[start++] = value;
  20894. }
  20895. return array;
  20896. }
  20897. /**
  20898. * The base implementation of `_.filter` without support for iteratee shorthands.
  20899. *
  20900. * @private
  20901. * @param {Array|Object} collection The collection to iterate over.
  20902. * @param {Function} predicate The function invoked per iteration.
  20903. * @returns {Array} Returns the new filtered array.
  20904. */
  20905. function baseFilter(collection, predicate) {
  20906. var result = [];
  20907. baseEach(collection, function(value, index, collection) {
  20908. if (predicate(value, index, collection)) {
  20909. result.push(value);
  20910. }
  20911. });
  20912. return result;
  20913. }
  20914. /**
  20915. * The base implementation of `_.flatten` with support for restricting flattening.
  20916. *
  20917. * @private
  20918. * @param {Array} array The array to flatten.
  20919. * @param {number} depth The maximum recursion depth.
  20920. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20921. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20922. * @param {Array} [result=[]] The initial result value.
  20923. * @returns {Array} Returns the new flattened array.
  20924. */
  20925. function baseFlatten(array, depth, predicate, isStrict, result) {
  20926. var index = -1,
  20927. length = array.length;
  20928. predicate || (predicate = isFlattenable);
  20929. result || (result = []);
  20930. while (++index < length) {
  20931. var value = array[index];
  20932. if (depth > 0 && predicate(value)) {
  20933. if (depth > 1) {
  20934. // Recursively flatten arrays (susceptible to call stack limits).
  20935. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20936. } else {
  20937. arrayPush(result, value);
  20938. }
  20939. } else if (!isStrict) {
  20940. result[result.length] = value;
  20941. }
  20942. }
  20943. return result;
  20944. }
  20945. /**
  20946. * The base implementation of `baseForOwn` which iterates over `object`
  20947. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20948. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20949. *
  20950. * @private
  20951. * @param {Object} object The object to iterate over.
  20952. * @param {Function} iteratee The function invoked per iteration.
  20953. * @param {Function} keysFunc The function to get the keys of `object`.
  20954. * @returns {Object} Returns `object`.
  20955. */
  20956. var baseFor = createBaseFor();
  20957. /**
  20958. * This function is like `baseFor` except that it iterates over properties
  20959. * in the opposite order.
  20960. *
  20961. * @private
  20962. * @param {Object} object The object to iterate over.
  20963. * @param {Function} iteratee The function invoked per iteration.
  20964. * @param {Function} keysFunc The function to get the keys of `object`.
  20965. * @returns {Object} Returns `object`.
  20966. */
  20967. var baseForRight = createBaseFor(true);
  20968. /**
  20969. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  20970. *
  20971. * @private
  20972. * @param {Object} object The object to iterate over.
  20973. * @param {Function} iteratee The function invoked per iteration.
  20974. * @returns {Object} Returns `object`.
  20975. */
  20976. function baseForOwn(object, iteratee) {
  20977. return object && baseFor(object, iteratee, keys);
  20978. }
  20979. /**
  20980. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  20981. *
  20982. * @private
  20983. * @param {Object} object The object to iterate over.
  20984. * @param {Function} iteratee The function invoked per iteration.
  20985. * @returns {Object} Returns `object`.
  20986. */
  20987. function baseForOwnRight(object, iteratee) {
  20988. return object && baseForRight(object, iteratee, keys);
  20989. }
  20990. /**
  20991. * The base implementation of `_.functions` which creates an array of
  20992. * `object` function property names filtered from `props`.
  20993. *
  20994. * @private
  20995. * @param {Object} object The object to inspect.
  20996. * @param {Array} props The property names to filter.
  20997. * @returns {Array} Returns the function names.
  20998. */
  20999. function baseFunctions(object, props) {
  21000. return arrayFilter(props, function(key) {
  21001. return isFunction(object[key]);
  21002. });
  21003. }
  21004. /**
  21005. * The base implementation of `_.get` without support for default values.
  21006. *
  21007. * @private
  21008. * @param {Object} object The object to query.
  21009. * @param {Array|string} path The path of the property to get.
  21010. * @returns {*} Returns the resolved value.
  21011. */
  21012. function baseGet(object, path) {
  21013. path = castPath(path, object);
  21014. var index = 0,
  21015. length = path.length;
  21016. while (object != null && index < length) {
  21017. object = object[toKey(path[index++])];
  21018. }
  21019. return (index && index == length) ? object : undefined;
  21020. }
  21021. /**
  21022. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21023. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21024. * symbols of `object`.
  21025. *
  21026. * @private
  21027. * @param {Object} object The object to query.
  21028. * @param {Function} keysFunc The function to get the keys of `object`.
  21029. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21030. * @returns {Array} Returns the array of property names and symbols.
  21031. */
  21032. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21033. var result = keysFunc(object);
  21034. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21035. }
  21036. /**
  21037. * The base implementation of `getTag` without fallbacks for buggy environments.
  21038. *
  21039. * @private
  21040. * @param {*} value The value to query.
  21041. * @returns {string} Returns the `toStringTag`.
  21042. */
  21043. function baseGetTag(value) {
  21044. if (value == null) {
  21045. return value === undefined ? undefinedTag : nullTag;
  21046. }
  21047. return (symToStringTag && symToStringTag in Object(value))
  21048. ? getRawTag(value)
  21049. : objectToString(value);
  21050. }
  21051. /**
  21052. * The base implementation of `_.gt` which doesn't coerce arguments.
  21053. *
  21054. * @private
  21055. * @param {*} value The value to compare.
  21056. * @param {*} other The other value to compare.
  21057. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21058. * else `false`.
  21059. */
  21060. function baseGt(value, other) {
  21061. return value > other;
  21062. }
  21063. /**
  21064. * The base implementation of `_.has` without support for deep paths.
  21065. *
  21066. * @private
  21067. * @param {Object} [object] The object to query.
  21068. * @param {Array|string} key The key to check.
  21069. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21070. */
  21071. function baseHas(object, key) {
  21072. return object != null && hasOwnProperty.call(object, key);
  21073. }
  21074. /**
  21075. * The base implementation of `_.hasIn` without support for deep paths.
  21076. *
  21077. * @private
  21078. * @param {Object} [object] The object to query.
  21079. * @param {Array|string} key The key to check.
  21080. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21081. */
  21082. function baseHasIn(object, key) {
  21083. return object != null && key in Object(object);
  21084. }
  21085. /**
  21086. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21087. *
  21088. * @private
  21089. * @param {number} number The number to check.
  21090. * @param {number} start The start of the range.
  21091. * @param {number} end The end of the range.
  21092. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21093. */
  21094. function baseInRange(number, start, end) {
  21095. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21096. }
  21097. /**
  21098. * The base implementation of methods like `_.intersection`, without support
  21099. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21100. *
  21101. * @private
  21102. * @param {Array} arrays The arrays to inspect.
  21103. * @param {Function} [iteratee] The iteratee invoked per element.
  21104. * @param {Function} [comparator] The comparator invoked per element.
  21105. * @returns {Array} Returns the new array of shared values.
  21106. */
  21107. function baseIntersection(arrays, iteratee, comparator) {
  21108. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21109. length = arrays[0].length,
  21110. othLength = arrays.length,
  21111. othIndex = othLength,
  21112. caches = Array(othLength),
  21113. maxLength = Infinity,
  21114. result = [];
  21115. while (othIndex--) {
  21116. var array = arrays[othIndex];
  21117. if (othIndex && iteratee) {
  21118. array = arrayMap(array, baseUnary(iteratee));
  21119. }
  21120. maxLength = nativeMin(array.length, maxLength);
  21121. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21122. ? new SetCache(othIndex && array)
  21123. : undefined;
  21124. }
  21125. array = arrays[0];
  21126. var index = -1,
  21127. seen = caches[0];
  21128. outer:
  21129. while (++index < length && result.length < maxLength) {
  21130. var value = array[index],
  21131. computed = iteratee ? iteratee(value) : value;
  21132. value = (comparator || value !== 0) ? value : 0;
  21133. if (!(seen
  21134. ? cacheHas(seen, computed)
  21135. : includes(result, computed, comparator)
  21136. )) {
  21137. othIndex = othLength;
  21138. while (--othIndex) {
  21139. var cache = caches[othIndex];
  21140. if (!(cache
  21141. ? cacheHas(cache, computed)
  21142. : includes(arrays[othIndex], computed, comparator))
  21143. ) {
  21144. continue outer;
  21145. }
  21146. }
  21147. if (seen) {
  21148. seen.push(computed);
  21149. }
  21150. result.push(value);
  21151. }
  21152. }
  21153. return result;
  21154. }
  21155. /**
  21156. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21157. * `object` with values transformed by `iteratee` and set by `setter`.
  21158. *
  21159. * @private
  21160. * @param {Object} object The object to iterate over.
  21161. * @param {Function} setter The function to set `accumulator` values.
  21162. * @param {Function} iteratee The iteratee to transform values.
  21163. * @param {Object} accumulator The initial inverted object.
  21164. * @returns {Function} Returns `accumulator`.
  21165. */
  21166. function baseInverter(object, setter, iteratee, accumulator) {
  21167. baseForOwn(object, function(value, key, object) {
  21168. setter(accumulator, iteratee(value), key, object);
  21169. });
  21170. return accumulator;
  21171. }
  21172. /**
  21173. * The base implementation of `_.invoke` without support for individual
  21174. * method arguments.
  21175. *
  21176. * @private
  21177. * @param {Object} object The object to query.
  21178. * @param {Array|string} path The path of the method to invoke.
  21179. * @param {Array} args The arguments to invoke the method with.
  21180. * @returns {*} Returns the result of the invoked method.
  21181. */
  21182. function baseInvoke(object, path, args) {
  21183. path = castPath(path, object);
  21184. object = parent(object, path);
  21185. var func = object == null ? object : object[toKey(last(path))];
  21186. return func == null ? undefined : apply(func, object, args);
  21187. }
  21188. /**
  21189. * The base implementation of `_.isArguments`.
  21190. *
  21191. * @private
  21192. * @param {*} value The value to check.
  21193. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21194. */
  21195. function baseIsArguments(value) {
  21196. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21197. }
  21198. /**
  21199. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21200. *
  21201. * @private
  21202. * @param {*} value The value to check.
  21203. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21204. */
  21205. function baseIsArrayBuffer(value) {
  21206. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21207. }
  21208. /**
  21209. * The base implementation of `_.isDate` without Node.js optimizations.
  21210. *
  21211. * @private
  21212. * @param {*} value The value to check.
  21213. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21214. */
  21215. function baseIsDate(value) {
  21216. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21217. }
  21218. /**
  21219. * The base implementation of `_.isEqual` which supports partial comparisons
  21220. * and tracks traversed objects.
  21221. *
  21222. * @private
  21223. * @param {*} value The value to compare.
  21224. * @param {*} other The other value to compare.
  21225. * @param {boolean} bitmask The bitmask flags.
  21226. * 1 - Unordered comparison
  21227. * 2 - Partial comparison
  21228. * @param {Function} [customizer] The function to customize comparisons.
  21229. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21230. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21231. */
  21232. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21233. if (value === other) {
  21234. return true;
  21235. }
  21236. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21237. return value !== value && other !== other;
  21238. }
  21239. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21240. }
  21241. /**
  21242. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21243. * deep comparisons and tracks traversed objects enabling objects with circular
  21244. * references to be compared.
  21245. *
  21246. * @private
  21247. * @param {Object} object The object to compare.
  21248. * @param {Object} other The other object to compare.
  21249. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21250. * @param {Function} customizer The function to customize comparisons.
  21251. * @param {Function} equalFunc The function to determine equivalents of values.
  21252. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21253. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21254. */
  21255. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21256. var objIsArr = isArray(object),
  21257. othIsArr = isArray(other),
  21258. objTag = objIsArr ? arrayTag : getTag(object),
  21259. othTag = othIsArr ? arrayTag : getTag(other);
  21260. objTag = objTag == argsTag ? objectTag : objTag;
  21261. othTag = othTag == argsTag ? objectTag : othTag;
  21262. var objIsObj = objTag == objectTag,
  21263. othIsObj = othTag == objectTag,
  21264. isSameTag = objTag == othTag;
  21265. if (isSameTag && isBuffer(object)) {
  21266. if (!isBuffer(other)) {
  21267. return false;
  21268. }
  21269. objIsArr = true;
  21270. objIsObj = false;
  21271. }
  21272. if (isSameTag && !objIsObj) {
  21273. stack || (stack = new Stack);
  21274. return (objIsArr || isTypedArray(object))
  21275. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21276. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21277. }
  21278. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21279. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21280. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21281. if (objIsWrapped || othIsWrapped) {
  21282. var objUnwrapped = objIsWrapped ? object.value() : object,
  21283. othUnwrapped = othIsWrapped ? other.value() : other;
  21284. stack || (stack = new Stack);
  21285. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21286. }
  21287. }
  21288. if (!isSameTag) {
  21289. return false;
  21290. }
  21291. stack || (stack = new Stack);
  21292. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21293. }
  21294. /**
  21295. * The base implementation of `_.isMap` without Node.js optimizations.
  21296. *
  21297. * @private
  21298. * @param {*} value The value to check.
  21299. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21300. */
  21301. function baseIsMap(value) {
  21302. return isObjectLike(value) && getTag(value) == mapTag;
  21303. }
  21304. /**
  21305. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21306. *
  21307. * @private
  21308. * @param {Object} object The object to inspect.
  21309. * @param {Object} source The object of property values to match.
  21310. * @param {Array} matchData The property names, values, and compare flags to match.
  21311. * @param {Function} [customizer] The function to customize comparisons.
  21312. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21313. */
  21314. function baseIsMatch(object, source, matchData, customizer) {
  21315. var index = matchData.length,
  21316. length = index,
  21317. noCustomizer = !customizer;
  21318. if (object == null) {
  21319. return !length;
  21320. }
  21321. object = Object(object);
  21322. while (index--) {
  21323. var data = matchData[index];
  21324. if ((noCustomizer && data[2])
  21325. ? data[1] !== object[data[0]]
  21326. : !(data[0] in object)
  21327. ) {
  21328. return false;
  21329. }
  21330. }
  21331. while (++index < length) {
  21332. data = matchData[index];
  21333. var key = data[0],
  21334. objValue = object[key],
  21335. srcValue = data[1];
  21336. if (noCustomizer && data[2]) {
  21337. if (objValue === undefined && !(key in object)) {
  21338. return false;
  21339. }
  21340. } else {
  21341. var stack = new Stack;
  21342. if (customizer) {
  21343. var result = customizer(objValue, srcValue, key, object, source, stack);
  21344. }
  21345. if (!(result === undefined
  21346. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21347. : result
  21348. )) {
  21349. return false;
  21350. }
  21351. }
  21352. }
  21353. return true;
  21354. }
  21355. /**
  21356. * The base implementation of `_.isNative` without bad shim checks.
  21357. *
  21358. * @private
  21359. * @param {*} value The value to check.
  21360. * @returns {boolean} Returns `true` if `value` is a native function,
  21361. * else `false`.
  21362. */
  21363. function baseIsNative(value) {
  21364. if (!isObject(value) || isMasked(value)) {
  21365. return false;
  21366. }
  21367. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21368. return pattern.test(toSource(value));
  21369. }
  21370. /**
  21371. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21372. *
  21373. * @private
  21374. * @param {*} value The value to check.
  21375. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21376. */
  21377. function baseIsRegExp(value) {
  21378. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21379. }
  21380. /**
  21381. * The base implementation of `_.isSet` without Node.js optimizations.
  21382. *
  21383. * @private
  21384. * @param {*} value The value to check.
  21385. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21386. */
  21387. function baseIsSet(value) {
  21388. return isObjectLike(value) && getTag(value) == setTag;
  21389. }
  21390. /**
  21391. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21392. *
  21393. * @private
  21394. * @param {*} value The value to check.
  21395. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21396. */
  21397. function baseIsTypedArray(value) {
  21398. return isObjectLike(value) &&
  21399. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21400. }
  21401. /**
  21402. * The base implementation of `_.iteratee`.
  21403. *
  21404. * @private
  21405. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21406. * @returns {Function} Returns the iteratee.
  21407. */
  21408. function baseIteratee(value) {
  21409. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21410. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21411. if (typeof value == 'function') {
  21412. return value;
  21413. }
  21414. if (value == null) {
  21415. return identity;
  21416. }
  21417. if (typeof value == 'object') {
  21418. return isArray(value)
  21419. ? baseMatchesProperty(value[0], value[1])
  21420. : baseMatches(value);
  21421. }
  21422. return property(value);
  21423. }
  21424. /**
  21425. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21426. *
  21427. * @private
  21428. * @param {Object} object The object to query.
  21429. * @returns {Array} Returns the array of property names.
  21430. */
  21431. function baseKeys(object) {
  21432. if (!isPrototype(object)) {
  21433. return nativeKeys(object);
  21434. }
  21435. var result = [];
  21436. for (var key in Object(object)) {
  21437. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21438. result.push(key);
  21439. }
  21440. }
  21441. return result;
  21442. }
  21443. /**
  21444. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21445. *
  21446. * @private
  21447. * @param {Object} object The object to query.
  21448. * @returns {Array} Returns the array of property names.
  21449. */
  21450. function baseKeysIn(object) {
  21451. if (!isObject(object)) {
  21452. return nativeKeysIn(object);
  21453. }
  21454. var isProto = isPrototype(object),
  21455. result = [];
  21456. for (var key in object) {
  21457. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21458. result.push(key);
  21459. }
  21460. }
  21461. return result;
  21462. }
  21463. /**
  21464. * The base implementation of `_.lt` which doesn't coerce arguments.
  21465. *
  21466. * @private
  21467. * @param {*} value The value to compare.
  21468. * @param {*} other The other value to compare.
  21469. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21470. * else `false`.
  21471. */
  21472. function baseLt(value, other) {
  21473. return value < other;
  21474. }
  21475. /**
  21476. * The base implementation of `_.map` without support for iteratee shorthands.
  21477. *
  21478. * @private
  21479. * @param {Array|Object} collection The collection to iterate over.
  21480. * @param {Function} iteratee The function invoked per iteration.
  21481. * @returns {Array} Returns the new mapped array.
  21482. */
  21483. function baseMap(collection, iteratee) {
  21484. var index = -1,
  21485. result = isArrayLike(collection) ? Array(collection.length) : [];
  21486. baseEach(collection, function(value, key, collection) {
  21487. result[++index] = iteratee(value, key, collection);
  21488. });
  21489. return result;
  21490. }
  21491. /**
  21492. * The base implementation of `_.matches` which doesn't clone `source`.
  21493. *
  21494. * @private
  21495. * @param {Object} source The object of property values to match.
  21496. * @returns {Function} Returns the new spec function.
  21497. */
  21498. function baseMatches(source) {
  21499. var matchData = getMatchData(source);
  21500. if (matchData.length == 1 && matchData[0][2]) {
  21501. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21502. }
  21503. return function(object) {
  21504. return object === source || baseIsMatch(object, source, matchData);
  21505. };
  21506. }
  21507. /**
  21508. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21509. *
  21510. * @private
  21511. * @param {string} path The path of the property to get.
  21512. * @param {*} srcValue The value to match.
  21513. * @returns {Function} Returns the new spec function.
  21514. */
  21515. function baseMatchesProperty(path, srcValue) {
  21516. if (isKey(path) && isStrictComparable(srcValue)) {
  21517. return matchesStrictComparable(toKey(path), srcValue);
  21518. }
  21519. return function(object) {
  21520. var objValue = get(object, path);
  21521. return (objValue === undefined && objValue === srcValue)
  21522. ? hasIn(object, path)
  21523. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21524. };
  21525. }
  21526. /**
  21527. * The base implementation of `_.merge` without support for multiple sources.
  21528. *
  21529. * @private
  21530. * @param {Object} object The destination object.
  21531. * @param {Object} source The source object.
  21532. * @param {number} srcIndex The index of `source`.
  21533. * @param {Function} [customizer] The function to customize merged values.
  21534. * @param {Object} [stack] Tracks traversed source values and their merged
  21535. * counterparts.
  21536. */
  21537. function baseMerge(object, source, srcIndex, customizer, stack) {
  21538. if (object === source) {
  21539. return;
  21540. }
  21541. baseFor(source, function(srcValue, key) {
  21542. stack || (stack = new Stack);
  21543. if (isObject(srcValue)) {
  21544. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21545. }
  21546. else {
  21547. var newValue = customizer
  21548. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21549. : undefined;
  21550. if (newValue === undefined) {
  21551. newValue = srcValue;
  21552. }
  21553. assignMergeValue(object, key, newValue);
  21554. }
  21555. }, keysIn);
  21556. }
  21557. /**
  21558. * A specialized version of `baseMerge` for arrays and objects which performs
  21559. * deep merges and tracks traversed objects enabling objects with circular
  21560. * references to be merged.
  21561. *
  21562. * @private
  21563. * @param {Object} object The destination object.
  21564. * @param {Object} source The source object.
  21565. * @param {string} key The key of the value to merge.
  21566. * @param {number} srcIndex The index of `source`.
  21567. * @param {Function} mergeFunc The function to merge values.
  21568. * @param {Function} [customizer] The function to customize assigned values.
  21569. * @param {Object} [stack] Tracks traversed source values and their merged
  21570. * counterparts.
  21571. */
  21572. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21573. var objValue = safeGet(object, key),
  21574. srcValue = safeGet(source, key),
  21575. stacked = stack.get(srcValue);
  21576. if (stacked) {
  21577. assignMergeValue(object, key, stacked);
  21578. return;
  21579. }
  21580. var newValue = customizer
  21581. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21582. : undefined;
  21583. var isCommon = newValue === undefined;
  21584. if (isCommon) {
  21585. var isArr = isArray(srcValue),
  21586. isBuff = !isArr && isBuffer(srcValue),
  21587. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21588. newValue = srcValue;
  21589. if (isArr || isBuff || isTyped) {
  21590. if (isArray(objValue)) {
  21591. newValue = objValue;
  21592. }
  21593. else if (isArrayLikeObject(objValue)) {
  21594. newValue = copyArray(objValue);
  21595. }
  21596. else if (isBuff) {
  21597. isCommon = false;
  21598. newValue = cloneBuffer(srcValue, true);
  21599. }
  21600. else if (isTyped) {
  21601. isCommon = false;
  21602. newValue = cloneTypedArray(srcValue, true);
  21603. }
  21604. else {
  21605. newValue = [];
  21606. }
  21607. }
  21608. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21609. newValue = objValue;
  21610. if (isArguments(objValue)) {
  21611. newValue = toPlainObject(objValue);
  21612. }
  21613. else if (!isObject(objValue) || isFunction(objValue)) {
  21614. newValue = initCloneObject(srcValue);
  21615. }
  21616. }
  21617. else {
  21618. isCommon = false;
  21619. }
  21620. }
  21621. if (isCommon) {
  21622. // Recursively merge objects and arrays (susceptible to call stack limits).
  21623. stack.set(srcValue, newValue);
  21624. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21625. stack['delete'](srcValue);
  21626. }
  21627. assignMergeValue(object, key, newValue);
  21628. }
  21629. /**
  21630. * The base implementation of `_.nth` which doesn't coerce arguments.
  21631. *
  21632. * @private
  21633. * @param {Array} array The array to query.
  21634. * @param {number} n The index of the element to return.
  21635. * @returns {*} Returns the nth element of `array`.
  21636. */
  21637. function baseNth(array, n) {
  21638. var length = array.length;
  21639. if (!length) {
  21640. return;
  21641. }
  21642. n += n < 0 ? length : 0;
  21643. return isIndex(n, length) ? array[n] : undefined;
  21644. }
  21645. /**
  21646. * The base implementation of `_.orderBy` without param guards.
  21647. *
  21648. * @private
  21649. * @param {Array|Object} collection The collection to iterate over.
  21650. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21651. * @param {string[]} orders The sort orders of `iteratees`.
  21652. * @returns {Array} Returns the new sorted array.
  21653. */
  21654. function baseOrderBy(collection, iteratees, orders) {
  21655. var index = -1;
  21656. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21657. var result = baseMap(collection, function(value, key, collection) {
  21658. var criteria = arrayMap(iteratees, function(iteratee) {
  21659. return iteratee(value);
  21660. });
  21661. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21662. });
  21663. return baseSortBy(result, function(object, other) {
  21664. return compareMultiple(object, other, orders);
  21665. });
  21666. }
  21667. /**
  21668. * The base implementation of `_.pick` without support for individual
  21669. * property identifiers.
  21670. *
  21671. * @private
  21672. * @param {Object} object The source object.
  21673. * @param {string[]} paths The property paths to pick.
  21674. * @returns {Object} Returns the new object.
  21675. */
  21676. function basePick(object, paths) {
  21677. return basePickBy(object, paths, function(value, path) {
  21678. return hasIn(object, path);
  21679. });
  21680. }
  21681. /**
  21682. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21683. *
  21684. * @private
  21685. * @param {Object} object The source object.
  21686. * @param {string[]} paths The property paths to pick.
  21687. * @param {Function} predicate The function invoked per property.
  21688. * @returns {Object} Returns the new object.
  21689. */
  21690. function basePickBy(object, paths, predicate) {
  21691. var index = -1,
  21692. length = paths.length,
  21693. result = {};
  21694. while (++index < length) {
  21695. var path = paths[index],
  21696. value = baseGet(object, path);
  21697. if (predicate(value, path)) {
  21698. baseSet(result, castPath(path, object), value);
  21699. }
  21700. }
  21701. return result;
  21702. }
  21703. /**
  21704. * A specialized version of `baseProperty` which supports deep paths.
  21705. *
  21706. * @private
  21707. * @param {Array|string} path The path of the property to get.
  21708. * @returns {Function} Returns the new accessor function.
  21709. */
  21710. function basePropertyDeep(path) {
  21711. return function(object) {
  21712. return baseGet(object, path);
  21713. };
  21714. }
  21715. /**
  21716. * The base implementation of `_.pullAllBy` without support for iteratee
  21717. * shorthands.
  21718. *
  21719. * @private
  21720. * @param {Array} array The array to modify.
  21721. * @param {Array} values The values to remove.
  21722. * @param {Function} [iteratee] The iteratee invoked per element.
  21723. * @param {Function} [comparator] The comparator invoked per element.
  21724. * @returns {Array} Returns `array`.
  21725. */
  21726. function basePullAll(array, values, iteratee, comparator) {
  21727. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21728. index = -1,
  21729. length = values.length,
  21730. seen = array;
  21731. if (array === values) {
  21732. values = copyArray(values);
  21733. }
  21734. if (iteratee) {
  21735. seen = arrayMap(array, baseUnary(iteratee));
  21736. }
  21737. while (++index < length) {
  21738. var fromIndex = 0,
  21739. value = values[index],
  21740. computed = iteratee ? iteratee(value) : value;
  21741. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21742. if (seen !== array) {
  21743. splice.call(seen, fromIndex, 1);
  21744. }
  21745. splice.call(array, fromIndex, 1);
  21746. }
  21747. }
  21748. return array;
  21749. }
  21750. /**
  21751. * The base implementation of `_.pullAt` without support for individual
  21752. * indexes or capturing the removed elements.
  21753. *
  21754. * @private
  21755. * @param {Array} array The array to modify.
  21756. * @param {number[]} indexes The indexes of elements to remove.
  21757. * @returns {Array} Returns `array`.
  21758. */
  21759. function basePullAt(array, indexes) {
  21760. var length = array ? indexes.length : 0,
  21761. lastIndex = length - 1;
  21762. while (length--) {
  21763. var index = indexes[length];
  21764. if (length == lastIndex || index !== previous) {
  21765. var previous = index;
  21766. if (isIndex(index)) {
  21767. splice.call(array, index, 1);
  21768. } else {
  21769. baseUnset(array, index);
  21770. }
  21771. }
  21772. }
  21773. return array;
  21774. }
  21775. /**
  21776. * The base implementation of `_.random` without support for returning
  21777. * floating-point numbers.
  21778. *
  21779. * @private
  21780. * @param {number} lower The lower bound.
  21781. * @param {number} upper The upper bound.
  21782. * @returns {number} Returns the random number.
  21783. */
  21784. function baseRandom(lower, upper) {
  21785. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21786. }
  21787. /**
  21788. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21789. * coerce arguments.
  21790. *
  21791. * @private
  21792. * @param {number} start The start of the range.
  21793. * @param {number} end The end of the range.
  21794. * @param {number} step The value to increment or decrement by.
  21795. * @param {boolean} [fromRight] Specify iterating from right to left.
  21796. * @returns {Array} Returns the range of numbers.
  21797. */
  21798. function baseRange(start, end, step, fromRight) {
  21799. var index = -1,
  21800. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21801. result = Array(length);
  21802. while (length--) {
  21803. result[fromRight ? length : ++index] = start;
  21804. start += step;
  21805. }
  21806. return result;
  21807. }
  21808. /**
  21809. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21810. *
  21811. * @private
  21812. * @param {string} string The string to repeat.
  21813. * @param {number} n The number of times to repeat the string.
  21814. * @returns {string} Returns the repeated string.
  21815. */
  21816. function baseRepeat(string, n) {
  21817. var result = '';
  21818. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21819. return result;
  21820. }
  21821. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21822. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21823. do {
  21824. if (n % 2) {
  21825. result += string;
  21826. }
  21827. n = nativeFloor(n / 2);
  21828. if (n) {
  21829. string += string;
  21830. }
  21831. } while (n);
  21832. return result;
  21833. }
  21834. /**
  21835. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21836. *
  21837. * @private
  21838. * @param {Function} func The function to apply a rest parameter to.
  21839. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21840. * @returns {Function} Returns the new function.
  21841. */
  21842. function baseRest(func, start) {
  21843. return setToString(overRest(func, start, identity), func + '');
  21844. }
  21845. /**
  21846. * The base implementation of `_.sample`.
  21847. *
  21848. * @private
  21849. * @param {Array|Object} collection The collection to sample.
  21850. * @returns {*} Returns the random element.
  21851. */
  21852. function baseSample(collection) {
  21853. return arraySample(values(collection));
  21854. }
  21855. /**
  21856. * The base implementation of `_.sampleSize` without param guards.
  21857. *
  21858. * @private
  21859. * @param {Array|Object} collection The collection to sample.
  21860. * @param {number} n The number of elements to sample.
  21861. * @returns {Array} Returns the random elements.
  21862. */
  21863. function baseSampleSize(collection, n) {
  21864. var array = values(collection);
  21865. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21866. }
  21867. /**
  21868. * The base implementation of `_.set`.
  21869. *
  21870. * @private
  21871. * @param {Object} object The object to modify.
  21872. * @param {Array|string} path The path of the property to set.
  21873. * @param {*} value The value to set.
  21874. * @param {Function} [customizer] The function to customize path creation.
  21875. * @returns {Object} Returns `object`.
  21876. */
  21877. function baseSet(object, path, value, customizer) {
  21878. if (!isObject(object)) {
  21879. return object;
  21880. }
  21881. path = castPath(path, object);
  21882. var index = -1,
  21883. length = path.length,
  21884. lastIndex = length - 1,
  21885. nested = object;
  21886. while (nested != null && ++index < length) {
  21887. var key = toKey(path[index]),
  21888. newValue = value;
  21889. if (index != lastIndex) {
  21890. var objValue = nested[key];
  21891. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21892. if (newValue === undefined) {
  21893. newValue = isObject(objValue)
  21894. ? objValue
  21895. : (isIndex(path[index + 1]) ? [] : {});
  21896. }
  21897. }
  21898. assignValue(nested, key, newValue);
  21899. nested = nested[key];
  21900. }
  21901. return object;
  21902. }
  21903. /**
  21904. * The base implementation of `setData` without support for hot loop shorting.
  21905. *
  21906. * @private
  21907. * @param {Function} func The function to associate metadata with.
  21908. * @param {*} data The metadata.
  21909. * @returns {Function} Returns `func`.
  21910. */
  21911. var baseSetData = !metaMap ? identity : function(func, data) {
  21912. metaMap.set(func, data);
  21913. return func;
  21914. };
  21915. /**
  21916. * The base implementation of `setToString` without support for hot loop shorting.
  21917. *
  21918. * @private
  21919. * @param {Function} func The function to modify.
  21920. * @param {Function} string The `toString` result.
  21921. * @returns {Function} Returns `func`.
  21922. */
  21923. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21924. return defineProperty(func, 'toString', {
  21925. 'configurable': true,
  21926. 'enumerable': false,
  21927. 'value': constant(string),
  21928. 'writable': true
  21929. });
  21930. };
  21931. /**
  21932. * The base implementation of `_.shuffle`.
  21933. *
  21934. * @private
  21935. * @param {Array|Object} collection The collection to shuffle.
  21936. * @returns {Array} Returns the new shuffled array.
  21937. */
  21938. function baseShuffle(collection) {
  21939. return shuffleSelf(values(collection));
  21940. }
  21941. /**
  21942. * The base implementation of `_.slice` without an iteratee call guard.
  21943. *
  21944. * @private
  21945. * @param {Array} array The array to slice.
  21946. * @param {number} [start=0] The start position.
  21947. * @param {number} [end=array.length] The end position.
  21948. * @returns {Array} Returns the slice of `array`.
  21949. */
  21950. function baseSlice(array, start, end) {
  21951. var index = -1,
  21952. length = array.length;
  21953. if (start < 0) {
  21954. start = -start > length ? 0 : (length + start);
  21955. }
  21956. end = end > length ? length : end;
  21957. if (end < 0) {
  21958. end += length;
  21959. }
  21960. length = start > end ? 0 : ((end - start) >>> 0);
  21961. start >>>= 0;
  21962. var result = Array(length);
  21963. while (++index < length) {
  21964. result[index] = array[index + start];
  21965. }
  21966. return result;
  21967. }
  21968. /**
  21969. * The base implementation of `_.some` without support for iteratee shorthands.
  21970. *
  21971. * @private
  21972. * @param {Array|Object} collection The collection to iterate over.
  21973. * @param {Function} predicate The function invoked per iteration.
  21974. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21975. * else `false`.
  21976. */
  21977. function baseSome(collection, predicate) {
  21978. var result;
  21979. baseEach(collection, function(value, index, collection) {
  21980. result = predicate(value, index, collection);
  21981. return !result;
  21982. });
  21983. return !!result;
  21984. }
  21985. /**
  21986. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  21987. * performs a binary search of `array` to determine the index at which `value`
  21988. * should be inserted into `array` in order to maintain its sort order.
  21989. *
  21990. * @private
  21991. * @param {Array} array The sorted array to inspect.
  21992. * @param {*} value The value to evaluate.
  21993. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  21994. * @returns {number} Returns the index at which `value` should be inserted
  21995. * into `array`.
  21996. */
  21997. function baseSortedIndex(array, value, retHighest) {
  21998. var low = 0,
  21999. high = array == null ? low : array.length;
  22000. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22001. while (low < high) {
  22002. var mid = (low + high) >>> 1,
  22003. computed = array[mid];
  22004. if (computed !== null && !isSymbol(computed) &&
  22005. (retHighest ? (computed <= value) : (computed < value))) {
  22006. low = mid + 1;
  22007. } else {
  22008. high = mid;
  22009. }
  22010. }
  22011. return high;
  22012. }
  22013. return baseSortedIndexBy(array, value, identity, retHighest);
  22014. }
  22015. /**
  22016. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22017. * which invokes `iteratee` for `value` and each element of `array` to compute
  22018. * their sort ranking. The iteratee is invoked with one argument; (value).
  22019. *
  22020. * @private
  22021. * @param {Array} array The sorted array to inspect.
  22022. * @param {*} value The value to evaluate.
  22023. * @param {Function} iteratee The iteratee invoked per element.
  22024. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22025. * @returns {number} Returns the index at which `value` should be inserted
  22026. * into `array`.
  22027. */
  22028. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22029. value = iteratee(value);
  22030. var low = 0,
  22031. high = array == null ? 0 : array.length,
  22032. valIsNaN = value !== value,
  22033. valIsNull = value === null,
  22034. valIsSymbol = isSymbol(value),
  22035. valIsUndefined = value === undefined;
  22036. while (low < high) {
  22037. var mid = nativeFloor((low + high) / 2),
  22038. computed = iteratee(array[mid]),
  22039. othIsDefined = computed !== undefined,
  22040. othIsNull = computed === null,
  22041. othIsReflexive = computed === computed,
  22042. othIsSymbol = isSymbol(computed);
  22043. if (valIsNaN) {
  22044. var setLow = retHighest || othIsReflexive;
  22045. } else if (valIsUndefined) {
  22046. setLow = othIsReflexive && (retHighest || othIsDefined);
  22047. } else if (valIsNull) {
  22048. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22049. } else if (valIsSymbol) {
  22050. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22051. } else if (othIsNull || othIsSymbol) {
  22052. setLow = false;
  22053. } else {
  22054. setLow = retHighest ? (computed <= value) : (computed < value);
  22055. }
  22056. if (setLow) {
  22057. low = mid + 1;
  22058. } else {
  22059. high = mid;
  22060. }
  22061. }
  22062. return nativeMin(high, MAX_ARRAY_INDEX);
  22063. }
  22064. /**
  22065. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22066. * support for iteratee shorthands.
  22067. *
  22068. * @private
  22069. * @param {Array} array The array to inspect.
  22070. * @param {Function} [iteratee] The iteratee invoked per element.
  22071. * @returns {Array} Returns the new duplicate free array.
  22072. */
  22073. function baseSortedUniq(array, iteratee) {
  22074. var index = -1,
  22075. length = array.length,
  22076. resIndex = 0,
  22077. result = [];
  22078. while (++index < length) {
  22079. var value = array[index],
  22080. computed = iteratee ? iteratee(value) : value;
  22081. if (!index || !eq(computed, seen)) {
  22082. var seen = computed;
  22083. result[resIndex++] = value === 0 ? 0 : value;
  22084. }
  22085. }
  22086. return result;
  22087. }
  22088. /**
  22089. * The base implementation of `_.toNumber` which doesn't ensure correct
  22090. * conversions of binary, hexadecimal, or octal string values.
  22091. *
  22092. * @private
  22093. * @param {*} value The value to process.
  22094. * @returns {number} Returns the number.
  22095. */
  22096. function baseToNumber(value) {
  22097. if (typeof value == 'number') {
  22098. return value;
  22099. }
  22100. if (isSymbol(value)) {
  22101. return NAN;
  22102. }
  22103. return +value;
  22104. }
  22105. /**
  22106. * The base implementation of `_.toString` which doesn't convert nullish
  22107. * values to empty strings.
  22108. *
  22109. * @private
  22110. * @param {*} value The value to process.
  22111. * @returns {string} Returns the string.
  22112. */
  22113. function baseToString(value) {
  22114. // Exit early for strings to avoid a performance hit in some environments.
  22115. if (typeof value == 'string') {
  22116. return value;
  22117. }
  22118. if (isArray(value)) {
  22119. // Recursively convert values (susceptible to call stack limits).
  22120. return arrayMap(value, baseToString) + '';
  22121. }
  22122. if (isSymbol(value)) {
  22123. return symbolToString ? symbolToString.call(value) : '';
  22124. }
  22125. var result = (value + '');
  22126. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22127. }
  22128. /**
  22129. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22130. *
  22131. * @private
  22132. * @param {Array} array The array to inspect.
  22133. * @param {Function} [iteratee] The iteratee invoked per element.
  22134. * @param {Function} [comparator] The comparator invoked per element.
  22135. * @returns {Array} Returns the new duplicate free array.
  22136. */
  22137. function baseUniq(array, iteratee, comparator) {
  22138. var index = -1,
  22139. includes = arrayIncludes,
  22140. length = array.length,
  22141. isCommon = true,
  22142. result = [],
  22143. seen = result;
  22144. if (comparator) {
  22145. isCommon = false;
  22146. includes = arrayIncludesWith;
  22147. }
  22148. else if (length >= LARGE_ARRAY_SIZE) {
  22149. var set = iteratee ? null : createSet(array);
  22150. if (set) {
  22151. return setToArray(set);
  22152. }
  22153. isCommon = false;
  22154. includes = cacheHas;
  22155. seen = new SetCache;
  22156. }
  22157. else {
  22158. seen = iteratee ? [] : result;
  22159. }
  22160. outer:
  22161. while (++index < length) {
  22162. var value = array[index],
  22163. computed = iteratee ? iteratee(value) : value;
  22164. value = (comparator || value !== 0) ? value : 0;
  22165. if (isCommon && computed === computed) {
  22166. var seenIndex = seen.length;
  22167. while (seenIndex--) {
  22168. if (seen[seenIndex] === computed) {
  22169. continue outer;
  22170. }
  22171. }
  22172. if (iteratee) {
  22173. seen.push(computed);
  22174. }
  22175. result.push(value);
  22176. }
  22177. else if (!includes(seen, computed, comparator)) {
  22178. if (seen !== result) {
  22179. seen.push(computed);
  22180. }
  22181. result.push(value);
  22182. }
  22183. }
  22184. return result;
  22185. }
  22186. /**
  22187. * The base implementation of `_.unset`.
  22188. *
  22189. * @private
  22190. * @param {Object} object The object to modify.
  22191. * @param {Array|string} path The property path to unset.
  22192. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22193. */
  22194. function baseUnset(object, path) {
  22195. path = castPath(path, object);
  22196. object = parent(object, path);
  22197. return object == null || delete object[toKey(last(path))];
  22198. }
  22199. /**
  22200. * The base implementation of `_.update`.
  22201. *
  22202. * @private
  22203. * @param {Object} object The object to modify.
  22204. * @param {Array|string} path The path of the property to update.
  22205. * @param {Function} updater The function to produce the updated value.
  22206. * @param {Function} [customizer] The function to customize path creation.
  22207. * @returns {Object} Returns `object`.
  22208. */
  22209. function baseUpdate(object, path, updater, customizer) {
  22210. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22211. }
  22212. /**
  22213. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22214. * without support for iteratee shorthands.
  22215. *
  22216. * @private
  22217. * @param {Array} array The array to query.
  22218. * @param {Function} predicate The function invoked per iteration.
  22219. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22220. * @param {boolean} [fromRight] Specify iterating from right to left.
  22221. * @returns {Array} Returns the slice of `array`.
  22222. */
  22223. function baseWhile(array, predicate, isDrop, fromRight) {
  22224. var length = array.length,
  22225. index = fromRight ? length : -1;
  22226. while ((fromRight ? index-- : ++index < length) &&
  22227. predicate(array[index], index, array)) {}
  22228. return isDrop
  22229. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22230. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22231. }
  22232. /**
  22233. * The base implementation of `wrapperValue` which returns the result of
  22234. * performing a sequence of actions on the unwrapped `value`, where each
  22235. * successive action is supplied the return value of the previous.
  22236. *
  22237. * @private
  22238. * @param {*} value The unwrapped value.
  22239. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22240. * @returns {*} Returns the resolved value.
  22241. */
  22242. function baseWrapperValue(value, actions) {
  22243. var result = value;
  22244. if (result instanceof LazyWrapper) {
  22245. result = result.value();
  22246. }
  22247. return arrayReduce(actions, function(result, action) {
  22248. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22249. }, result);
  22250. }
  22251. /**
  22252. * The base implementation of methods like `_.xor`, without support for
  22253. * iteratee shorthands, that accepts an array of arrays to inspect.
  22254. *
  22255. * @private
  22256. * @param {Array} arrays The arrays to inspect.
  22257. * @param {Function} [iteratee] The iteratee invoked per element.
  22258. * @param {Function} [comparator] The comparator invoked per element.
  22259. * @returns {Array} Returns the new array of values.
  22260. */
  22261. function baseXor(arrays, iteratee, comparator) {
  22262. var length = arrays.length;
  22263. if (length < 2) {
  22264. return length ? baseUniq(arrays[0]) : [];
  22265. }
  22266. var index = -1,
  22267. result = Array(length);
  22268. while (++index < length) {
  22269. var array = arrays[index],
  22270. othIndex = -1;
  22271. while (++othIndex < length) {
  22272. if (othIndex != index) {
  22273. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22274. }
  22275. }
  22276. }
  22277. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22278. }
  22279. /**
  22280. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22281. *
  22282. * @private
  22283. * @param {Array} props The property identifiers.
  22284. * @param {Array} values The property values.
  22285. * @param {Function} assignFunc The function to assign values.
  22286. * @returns {Object} Returns the new object.
  22287. */
  22288. function baseZipObject(props, values, assignFunc) {
  22289. var index = -1,
  22290. length = props.length,
  22291. valsLength = values.length,
  22292. result = {};
  22293. while (++index < length) {
  22294. var value = index < valsLength ? values[index] : undefined;
  22295. assignFunc(result, props[index], value);
  22296. }
  22297. return result;
  22298. }
  22299. /**
  22300. * Casts `value` to an empty array if it's not an array like object.
  22301. *
  22302. * @private
  22303. * @param {*} value The value to inspect.
  22304. * @returns {Array|Object} Returns the cast array-like object.
  22305. */
  22306. function castArrayLikeObject(value) {
  22307. return isArrayLikeObject(value) ? value : [];
  22308. }
  22309. /**
  22310. * Casts `value` to `identity` if it's not a function.
  22311. *
  22312. * @private
  22313. * @param {*} value The value to inspect.
  22314. * @returns {Function} Returns cast function.
  22315. */
  22316. function castFunction(value) {
  22317. return typeof value == 'function' ? value : identity;
  22318. }
  22319. /**
  22320. * Casts `value` to a path array if it's not one.
  22321. *
  22322. * @private
  22323. * @param {*} value The value to inspect.
  22324. * @param {Object} [object] The object to query keys on.
  22325. * @returns {Array} Returns the cast property path array.
  22326. */
  22327. function castPath(value, object) {
  22328. if (isArray(value)) {
  22329. return value;
  22330. }
  22331. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22332. }
  22333. /**
  22334. * A `baseRest` alias which can be replaced with `identity` by module
  22335. * replacement plugins.
  22336. *
  22337. * @private
  22338. * @type {Function}
  22339. * @param {Function} func The function to apply a rest parameter to.
  22340. * @returns {Function} Returns the new function.
  22341. */
  22342. var castRest = baseRest;
  22343. /**
  22344. * Casts `array` to a slice if it's needed.
  22345. *
  22346. * @private
  22347. * @param {Array} array The array to inspect.
  22348. * @param {number} start The start position.
  22349. * @param {number} [end=array.length] The end position.
  22350. * @returns {Array} Returns the cast slice.
  22351. */
  22352. function castSlice(array, start, end) {
  22353. var length = array.length;
  22354. end = end === undefined ? length : end;
  22355. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22356. }
  22357. /**
  22358. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22359. *
  22360. * @private
  22361. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22362. */
  22363. var clearTimeout = ctxClearTimeout || function(id) {
  22364. return root.clearTimeout(id);
  22365. };
  22366. /**
  22367. * Creates a clone of `buffer`.
  22368. *
  22369. * @private
  22370. * @param {Buffer} buffer The buffer to clone.
  22371. * @param {boolean} [isDeep] Specify a deep clone.
  22372. * @returns {Buffer} Returns the cloned buffer.
  22373. */
  22374. function cloneBuffer(buffer, isDeep) {
  22375. if (isDeep) {
  22376. return buffer.slice();
  22377. }
  22378. var length = buffer.length,
  22379. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22380. buffer.copy(result);
  22381. return result;
  22382. }
  22383. /**
  22384. * Creates a clone of `arrayBuffer`.
  22385. *
  22386. * @private
  22387. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22388. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22389. */
  22390. function cloneArrayBuffer(arrayBuffer) {
  22391. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22392. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22393. return result;
  22394. }
  22395. /**
  22396. * Creates a clone of `dataView`.
  22397. *
  22398. * @private
  22399. * @param {Object} dataView The data view to clone.
  22400. * @param {boolean} [isDeep] Specify a deep clone.
  22401. * @returns {Object} Returns the cloned data view.
  22402. */
  22403. function cloneDataView(dataView, isDeep) {
  22404. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22405. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22406. }
  22407. /**
  22408. * Creates a clone of `regexp`.
  22409. *
  22410. * @private
  22411. * @param {Object} regexp The regexp to clone.
  22412. * @returns {Object} Returns the cloned regexp.
  22413. */
  22414. function cloneRegExp(regexp) {
  22415. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22416. result.lastIndex = regexp.lastIndex;
  22417. return result;
  22418. }
  22419. /**
  22420. * Creates a clone of the `symbol` object.
  22421. *
  22422. * @private
  22423. * @param {Object} symbol The symbol object to clone.
  22424. * @returns {Object} Returns the cloned symbol object.
  22425. */
  22426. function cloneSymbol(symbol) {
  22427. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22428. }
  22429. /**
  22430. * Creates a clone of `typedArray`.
  22431. *
  22432. * @private
  22433. * @param {Object} typedArray The typed array to clone.
  22434. * @param {boolean} [isDeep] Specify a deep clone.
  22435. * @returns {Object} Returns the cloned typed array.
  22436. */
  22437. function cloneTypedArray(typedArray, isDeep) {
  22438. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22439. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22440. }
  22441. /**
  22442. * Compares values to sort them in ascending order.
  22443. *
  22444. * @private
  22445. * @param {*} value The value to compare.
  22446. * @param {*} other The other value to compare.
  22447. * @returns {number} Returns the sort order indicator for `value`.
  22448. */
  22449. function compareAscending(value, other) {
  22450. if (value !== other) {
  22451. var valIsDefined = value !== undefined,
  22452. valIsNull = value === null,
  22453. valIsReflexive = value === value,
  22454. valIsSymbol = isSymbol(value);
  22455. var othIsDefined = other !== undefined,
  22456. othIsNull = other === null,
  22457. othIsReflexive = other === other,
  22458. othIsSymbol = isSymbol(other);
  22459. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22460. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22461. (valIsNull && othIsDefined && othIsReflexive) ||
  22462. (!valIsDefined && othIsReflexive) ||
  22463. !valIsReflexive) {
  22464. return 1;
  22465. }
  22466. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22467. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22468. (othIsNull && valIsDefined && valIsReflexive) ||
  22469. (!othIsDefined && valIsReflexive) ||
  22470. !othIsReflexive) {
  22471. return -1;
  22472. }
  22473. }
  22474. return 0;
  22475. }
  22476. /**
  22477. * Used by `_.orderBy` to compare multiple properties of a value to another
  22478. * and stable sort them.
  22479. *
  22480. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22481. * specify an order of "desc" for descending or "asc" for ascending sort order
  22482. * of corresponding values.
  22483. *
  22484. * @private
  22485. * @param {Object} object The object to compare.
  22486. * @param {Object} other The other object to compare.
  22487. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22488. * @returns {number} Returns the sort order indicator for `object`.
  22489. */
  22490. function compareMultiple(object, other, orders) {
  22491. var index = -1,
  22492. objCriteria = object.criteria,
  22493. othCriteria = other.criteria,
  22494. length = objCriteria.length,
  22495. ordersLength = orders.length;
  22496. while (++index < length) {
  22497. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22498. if (result) {
  22499. if (index >= ordersLength) {
  22500. return result;
  22501. }
  22502. var order = orders[index];
  22503. return result * (order == 'desc' ? -1 : 1);
  22504. }
  22505. }
  22506. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22507. // that causes it, under certain circumstances, to provide the same value for
  22508. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22509. // for more details.
  22510. //
  22511. // This also ensures a stable sort in V8 and other engines.
  22512. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22513. return object.index - other.index;
  22514. }
  22515. /**
  22516. * Creates an array that is the composition of partially applied arguments,
  22517. * placeholders, and provided arguments into a single array of arguments.
  22518. *
  22519. * @private
  22520. * @param {Array} args The provided arguments.
  22521. * @param {Array} partials The arguments to prepend to those provided.
  22522. * @param {Array} holders The `partials` placeholder indexes.
  22523. * @params {boolean} [isCurried] Specify composing for a curried function.
  22524. * @returns {Array} Returns the new array of composed arguments.
  22525. */
  22526. function composeArgs(args, partials, holders, isCurried) {
  22527. var argsIndex = -1,
  22528. argsLength = args.length,
  22529. holdersLength = holders.length,
  22530. leftIndex = -1,
  22531. leftLength = partials.length,
  22532. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22533. result = Array(leftLength + rangeLength),
  22534. isUncurried = !isCurried;
  22535. while (++leftIndex < leftLength) {
  22536. result[leftIndex] = partials[leftIndex];
  22537. }
  22538. while (++argsIndex < holdersLength) {
  22539. if (isUncurried || argsIndex < argsLength) {
  22540. result[holders[argsIndex]] = args[argsIndex];
  22541. }
  22542. }
  22543. while (rangeLength--) {
  22544. result[leftIndex++] = args[argsIndex++];
  22545. }
  22546. return result;
  22547. }
  22548. /**
  22549. * This function is like `composeArgs` except that the arguments composition
  22550. * is tailored for `_.partialRight`.
  22551. *
  22552. * @private
  22553. * @param {Array} args The provided arguments.
  22554. * @param {Array} partials The arguments to append to those provided.
  22555. * @param {Array} holders The `partials` placeholder indexes.
  22556. * @params {boolean} [isCurried] Specify composing for a curried function.
  22557. * @returns {Array} Returns the new array of composed arguments.
  22558. */
  22559. function composeArgsRight(args, partials, holders, isCurried) {
  22560. var argsIndex = -1,
  22561. argsLength = args.length,
  22562. holdersIndex = -1,
  22563. holdersLength = holders.length,
  22564. rightIndex = -1,
  22565. rightLength = partials.length,
  22566. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22567. result = Array(rangeLength + rightLength),
  22568. isUncurried = !isCurried;
  22569. while (++argsIndex < rangeLength) {
  22570. result[argsIndex] = args[argsIndex];
  22571. }
  22572. var offset = argsIndex;
  22573. while (++rightIndex < rightLength) {
  22574. result[offset + rightIndex] = partials[rightIndex];
  22575. }
  22576. while (++holdersIndex < holdersLength) {
  22577. if (isUncurried || argsIndex < argsLength) {
  22578. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22579. }
  22580. }
  22581. return result;
  22582. }
  22583. /**
  22584. * Copies the values of `source` to `array`.
  22585. *
  22586. * @private
  22587. * @param {Array} source The array to copy values from.
  22588. * @param {Array} [array=[]] The array to copy values to.
  22589. * @returns {Array} Returns `array`.
  22590. */
  22591. function copyArray(source, array) {
  22592. var index = -1,
  22593. length = source.length;
  22594. array || (array = Array(length));
  22595. while (++index < length) {
  22596. array[index] = source[index];
  22597. }
  22598. return array;
  22599. }
  22600. /**
  22601. * Copies properties of `source` to `object`.
  22602. *
  22603. * @private
  22604. * @param {Object} source The object to copy properties from.
  22605. * @param {Array} props The property identifiers to copy.
  22606. * @param {Object} [object={}] The object to copy properties to.
  22607. * @param {Function} [customizer] The function to customize copied values.
  22608. * @returns {Object} Returns `object`.
  22609. */
  22610. function copyObject(source, props, object, customizer) {
  22611. var isNew = !object;
  22612. object || (object = {});
  22613. var index = -1,
  22614. length = props.length;
  22615. while (++index < length) {
  22616. var key = props[index];
  22617. var newValue = customizer
  22618. ? customizer(object[key], source[key], key, object, source)
  22619. : undefined;
  22620. if (newValue === undefined) {
  22621. newValue = source[key];
  22622. }
  22623. if (isNew) {
  22624. baseAssignValue(object, key, newValue);
  22625. } else {
  22626. assignValue(object, key, newValue);
  22627. }
  22628. }
  22629. return object;
  22630. }
  22631. /**
  22632. * Copies own symbols of `source` to `object`.
  22633. *
  22634. * @private
  22635. * @param {Object} source The object to copy symbols from.
  22636. * @param {Object} [object={}] The object to copy symbols to.
  22637. * @returns {Object} Returns `object`.
  22638. */
  22639. function copySymbols(source, object) {
  22640. return copyObject(source, getSymbols(source), object);
  22641. }
  22642. /**
  22643. * Copies own and inherited symbols of `source` to `object`.
  22644. *
  22645. * @private
  22646. * @param {Object} source The object to copy symbols from.
  22647. * @param {Object} [object={}] The object to copy symbols to.
  22648. * @returns {Object} Returns `object`.
  22649. */
  22650. function copySymbolsIn(source, object) {
  22651. return copyObject(source, getSymbolsIn(source), object);
  22652. }
  22653. /**
  22654. * Creates a function like `_.groupBy`.
  22655. *
  22656. * @private
  22657. * @param {Function} setter The function to set accumulator values.
  22658. * @param {Function} [initializer] The accumulator object initializer.
  22659. * @returns {Function} Returns the new aggregator function.
  22660. */
  22661. function createAggregator(setter, initializer) {
  22662. return function(collection, iteratee) {
  22663. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22664. accumulator = initializer ? initializer() : {};
  22665. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22666. };
  22667. }
  22668. /**
  22669. * Creates a function like `_.assign`.
  22670. *
  22671. * @private
  22672. * @param {Function} assigner The function to assign values.
  22673. * @returns {Function} Returns the new assigner function.
  22674. */
  22675. function createAssigner(assigner) {
  22676. return baseRest(function(object, sources) {
  22677. var index = -1,
  22678. length = sources.length,
  22679. customizer = length > 1 ? sources[length - 1] : undefined,
  22680. guard = length > 2 ? sources[2] : undefined;
  22681. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22682. ? (length--, customizer)
  22683. : undefined;
  22684. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22685. customizer = length < 3 ? undefined : customizer;
  22686. length = 1;
  22687. }
  22688. object = Object(object);
  22689. while (++index < length) {
  22690. var source = sources[index];
  22691. if (source) {
  22692. assigner(object, source, index, customizer);
  22693. }
  22694. }
  22695. return object;
  22696. });
  22697. }
  22698. /**
  22699. * Creates a `baseEach` or `baseEachRight` function.
  22700. *
  22701. * @private
  22702. * @param {Function} eachFunc The function to iterate over a collection.
  22703. * @param {boolean} [fromRight] Specify iterating from right to left.
  22704. * @returns {Function} Returns the new base function.
  22705. */
  22706. function createBaseEach(eachFunc, fromRight) {
  22707. return function(collection, iteratee) {
  22708. if (collection == null) {
  22709. return collection;
  22710. }
  22711. if (!isArrayLike(collection)) {
  22712. return eachFunc(collection, iteratee);
  22713. }
  22714. var length = collection.length,
  22715. index = fromRight ? length : -1,
  22716. iterable = Object(collection);
  22717. while ((fromRight ? index-- : ++index < length)) {
  22718. if (iteratee(iterable[index], index, iterable) === false) {
  22719. break;
  22720. }
  22721. }
  22722. return collection;
  22723. };
  22724. }
  22725. /**
  22726. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22727. *
  22728. * @private
  22729. * @param {boolean} [fromRight] Specify iterating from right to left.
  22730. * @returns {Function} Returns the new base function.
  22731. */
  22732. function createBaseFor(fromRight) {
  22733. return function(object, iteratee, keysFunc) {
  22734. var index = -1,
  22735. iterable = Object(object),
  22736. props = keysFunc(object),
  22737. length = props.length;
  22738. while (length--) {
  22739. var key = props[fromRight ? length : ++index];
  22740. if (iteratee(iterable[key], key, iterable) === false) {
  22741. break;
  22742. }
  22743. }
  22744. return object;
  22745. };
  22746. }
  22747. /**
  22748. * Creates a function that wraps `func` to invoke it with the optional `this`
  22749. * binding of `thisArg`.
  22750. *
  22751. * @private
  22752. * @param {Function} func The function to wrap.
  22753. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22754. * @param {*} [thisArg] The `this` binding of `func`.
  22755. * @returns {Function} Returns the new wrapped function.
  22756. */
  22757. function createBind(func, bitmask, thisArg) {
  22758. var isBind = bitmask & WRAP_BIND_FLAG,
  22759. Ctor = createCtor(func);
  22760. function wrapper() {
  22761. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22762. return fn.apply(isBind ? thisArg : this, arguments);
  22763. }
  22764. return wrapper;
  22765. }
  22766. /**
  22767. * Creates a function like `_.lowerFirst`.
  22768. *
  22769. * @private
  22770. * @param {string} methodName The name of the `String` case method to use.
  22771. * @returns {Function} Returns the new case function.
  22772. */
  22773. function createCaseFirst(methodName) {
  22774. return function(string) {
  22775. string = toString(string);
  22776. var strSymbols = hasUnicode(string)
  22777. ? stringToArray(string)
  22778. : undefined;
  22779. var chr = strSymbols
  22780. ? strSymbols[0]
  22781. : string.charAt(0);
  22782. var trailing = strSymbols
  22783. ? castSlice(strSymbols, 1).join('')
  22784. : string.slice(1);
  22785. return chr[methodName]() + trailing;
  22786. };
  22787. }
  22788. /**
  22789. * Creates a function like `_.camelCase`.
  22790. *
  22791. * @private
  22792. * @param {Function} callback The function to combine each word.
  22793. * @returns {Function} Returns the new compounder function.
  22794. */
  22795. function createCompounder(callback) {
  22796. return function(string) {
  22797. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22798. };
  22799. }
  22800. /**
  22801. * Creates a function that produces an instance of `Ctor` regardless of
  22802. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22803. *
  22804. * @private
  22805. * @param {Function} Ctor The constructor to wrap.
  22806. * @returns {Function} Returns the new wrapped function.
  22807. */
  22808. function createCtor(Ctor) {
  22809. return function() {
  22810. // Use a `switch` statement to work with class constructors. See
  22811. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22812. // for more details.
  22813. var args = arguments;
  22814. switch (args.length) {
  22815. case 0: return new Ctor;
  22816. case 1: return new Ctor(args[0]);
  22817. case 2: return new Ctor(args[0], args[1]);
  22818. case 3: return new Ctor(args[0], args[1], args[2]);
  22819. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22820. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22821. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22822. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22823. }
  22824. var thisBinding = baseCreate(Ctor.prototype),
  22825. result = Ctor.apply(thisBinding, args);
  22826. // Mimic the constructor's `return` behavior.
  22827. // See https://es5.github.io/#x13.2.2 for more details.
  22828. return isObject(result) ? result : thisBinding;
  22829. };
  22830. }
  22831. /**
  22832. * Creates a function that wraps `func` to enable currying.
  22833. *
  22834. * @private
  22835. * @param {Function} func The function to wrap.
  22836. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22837. * @param {number} arity The arity of `func`.
  22838. * @returns {Function} Returns the new wrapped function.
  22839. */
  22840. function createCurry(func, bitmask, arity) {
  22841. var Ctor = createCtor(func);
  22842. function wrapper() {
  22843. var length = arguments.length,
  22844. args = Array(length),
  22845. index = length,
  22846. placeholder = getHolder(wrapper);
  22847. while (index--) {
  22848. args[index] = arguments[index];
  22849. }
  22850. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22851. ? []
  22852. : replaceHolders(args, placeholder);
  22853. length -= holders.length;
  22854. if (length < arity) {
  22855. return createRecurry(
  22856. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22857. args, holders, undefined, undefined, arity - length);
  22858. }
  22859. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22860. return apply(fn, this, args);
  22861. }
  22862. return wrapper;
  22863. }
  22864. /**
  22865. * Creates a `_.find` or `_.findLast` function.
  22866. *
  22867. * @private
  22868. * @param {Function} findIndexFunc The function to find the collection index.
  22869. * @returns {Function} Returns the new find function.
  22870. */
  22871. function createFind(findIndexFunc) {
  22872. return function(collection, predicate, fromIndex) {
  22873. var iterable = Object(collection);
  22874. if (!isArrayLike(collection)) {
  22875. var iteratee = getIteratee(predicate, 3);
  22876. collection = keys(collection);
  22877. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22878. }
  22879. var index = findIndexFunc(collection, predicate, fromIndex);
  22880. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22881. };
  22882. }
  22883. /**
  22884. * Creates a `_.flow` or `_.flowRight` function.
  22885. *
  22886. * @private
  22887. * @param {boolean} [fromRight] Specify iterating from right to left.
  22888. * @returns {Function} Returns the new flow function.
  22889. */
  22890. function createFlow(fromRight) {
  22891. return flatRest(function(funcs) {
  22892. var length = funcs.length,
  22893. index = length,
  22894. prereq = LodashWrapper.prototype.thru;
  22895. if (fromRight) {
  22896. funcs.reverse();
  22897. }
  22898. while (index--) {
  22899. var func = funcs[index];
  22900. if (typeof func != 'function') {
  22901. throw new TypeError(FUNC_ERROR_TEXT);
  22902. }
  22903. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22904. var wrapper = new LodashWrapper([], true);
  22905. }
  22906. }
  22907. index = wrapper ? index : length;
  22908. while (++index < length) {
  22909. func = funcs[index];
  22910. var funcName = getFuncName(func),
  22911. data = funcName == 'wrapper' ? getData(func) : undefined;
  22912. if (data && isLaziable(data[0]) &&
  22913. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22914. !data[4].length && data[9] == 1
  22915. ) {
  22916. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22917. } else {
  22918. wrapper = (func.length == 1 && isLaziable(func))
  22919. ? wrapper[funcName]()
  22920. : wrapper.thru(func);
  22921. }
  22922. }
  22923. return function() {
  22924. var args = arguments,
  22925. value = args[0];
  22926. if (wrapper && args.length == 1 && isArray(value)) {
  22927. return wrapper.plant(value).value();
  22928. }
  22929. var index = 0,
  22930. result = length ? funcs[index].apply(this, args) : value;
  22931. while (++index < length) {
  22932. result = funcs[index].call(this, result);
  22933. }
  22934. return result;
  22935. };
  22936. });
  22937. }
  22938. /**
  22939. * Creates a function that wraps `func` to invoke it with optional `this`
  22940. * binding of `thisArg`, partial application, and currying.
  22941. *
  22942. * @private
  22943. * @param {Function|string} func The function or method name to wrap.
  22944. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22945. * @param {*} [thisArg] The `this` binding of `func`.
  22946. * @param {Array} [partials] The arguments to prepend to those provided to
  22947. * the new function.
  22948. * @param {Array} [holders] The `partials` placeholder indexes.
  22949. * @param {Array} [partialsRight] The arguments to append to those provided
  22950. * to the new function.
  22951. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22952. * @param {Array} [argPos] The argument positions of the new function.
  22953. * @param {number} [ary] The arity cap of `func`.
  22954. * @param {number} [arity] The arity of `func`.
  22955. * @returns {Function} Returns the new wrapped function.
  22956. */
  22957. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22958. var isAry = bitmask & WRAP_ARY_FLAG,
  22959. isBind = bitmask & WRAP_BIND_FLAG,
  22960. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22961. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22962. isFlip = bitmask & WRAP_FLIP_FLAG,
  22963. Ctor = isBindKey ? undefined : createCtor(func);
  22964. function wrapper() {
  22965. var length = arguments.length,
  22966. args = Array(length),
  22967. index = length;
  22968. while (index--) {
  22969. args[index] = arguments[index];
  22970. }
  22971. if (isCurried) {
  22972. var placeholder = getHolder(wrapper),
  22973. holdersCount = countHolders(args, placeholder);
  22974. }
  22975. if (partials) {
  22976. args = composeArgs(args, partials, holders, isCurried);
  22977. }
  22978. if (partialsRight) {
  22979. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  22980. }
  22981. length -= holdersCount;
  22982. if (isCurried && length < arity) {
  22983. var newHolders = replaceHolders(args, placeholder);
  22984. return createRecurry(
  22985. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  22986. args, newHolders, argPos, ary, arity - length
  22987. );
  22988. }
  22989. var thisBinding = isBind ? thisArg : this,
  22990. fn = isBindKey ? thisBinding[func] : func;
  22991. length = args.length;
  22992. if (argPos) {
  22993. args = reorder(args, argPos);
  22994. } else if (isFlip && length > 1) {
  22995. args.reverse();
  22996. }
  22997. if (isAry && ary < length) {
  22998. args.length = ary;
  22999. }
  23000. if (this && this !== root && this instanceof wrapper) {
  23001. fn = Ctor || createCtor(fn);
  23002. }
  23003. return fn.apply(thisBinding, args);
  23004. }
  23005. return wrapper;
  23006. }
  23007. /**
  23008. * Creates a function like `_.invertBy`.
  23009. *
  23010. * @private
  23011. * @param {Function} setter The function to set accumulator values.
  23012. * @param {Function} toIteratee The function to resolve iteratees.
  23013. * @returns {Function} Returns the new inverter function.
  23014. */
  23015. function createInverter(setter, toIteratee) {
  23016. return function(object, iteratee) {
  23017. return baseInverter(object, setter, toIteratee(iteratee), {});
  23018. };
  23019. }
  23020. /**
  23021. * Creates a function that performs a mathematical operation on two values.
  23022. *
  23023. * @private
  23024. * @param {Function} operator The function to perform the operation.
  23025. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23026. * @returns {Function} Returns the new mathematical operation function.
  23027. */
  23028. function createMathOperation(operator, defaultValue) {
  23029. return function(value, other) {
  23030. var result;
  23031. if (value === undefined && other === undefined) {
  23032. return defaultValue;
  23033. }
  23034. if (value !== undefined) {
  23035. result = value;
  23036. }
  23037. if (other !== undefined) {
  23038. if (result === undefined) {
  23039. return other;
  23040. }
  23041. if (typeof value == 'string' || typeof other == 'string') {
  23042. value = baseToString(value);
  23043. other = baseToString(other);
  23044. } else {
  23045. value = baseToNumber(value);
  23046. other = baseToNumber(other);
  23047. }
  23048. result = operator(value, other);
  23049. }
  23050. return result;
  23051. };
  23052. }
  23053. /**
  23054. * Creates a function like `_.over`.
  23055. *
  23056. * @private
  23057. * @param {Function} arrayFunc The function to iterate over iteratees.
  23058. * @returns {Function} Returns the new over function.
  23059. */
  23060. function createOver(arrayFunc) {
  23061. return flatRest(function(iteratees) {
  23062. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23063. return baseRest(function(args) {
  23064. var thisArg = this;
  23065. return arrayFunc(iteratees, function(iteratee) {
  23066. return apply(iteratee, thisArg, args);
  23067. });
  23068. });
  23069. });
  23070. }
  23071. /**
  23072. * Creates the padding for `string` based on `length`. The `chars` string
  23073. * is truncated if the number of characters exceeds `length`.
  23074. *
  23075. * @private
  23076. * @param {number} length The padding length.
  23077. * @param {string} [chars=' '] The string used as padding.
  23078. * @returns {string} Returns the padding for `string`.
  23079. */
  23080. function createPadding(length, chars) {
  23081. chars = chars === undefined ? ' ' : baseToString(chars);
  23082. var charsLength = chars.length;
  23083. if (charsLength < 2) {
  23084. return charsLength ? baseRepeat(chars, length) : chars;
  23085. }
  23086. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23087. return hasUnicode(chars)
  23088. ? castSlice(stringToArray(result), 0, length).join('')
  23089. : result.slice(0, length);
  23090. }
  23091. /**
  23092. * Creates a function that wraps `func` to invoke it with the `this` binding
  23093. * of `thisArg` and `partials` prepended to the arguments it receives.
  23094. *
  23095. * @private
  23096. * @param {Function} func The function to wrap.
  23097. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23098. * @param {*} thisArg The `this` binding of `func`.
  23099. * @param {Array} partials The arguments to prepend to those provided to
  23100. * the new function.
  23101. * @returns {Function} Returns the new wrapped function.
  23102. */
  23103. function createPartial(func, bitmask, thisArg, partials) {
  23104. var isBind = bitmask & WRAP_BIND_FLAG,
  23105. Ctor = createCtor(func);
  23106. function wrapper() {
  23107. var argsIndex = -1,
  23108. argsLength = arguments.length,
  23109. leftIndex = -1,
  23110. leftLength = partials.length,
  23111. args = Array(leftLength + argsLength),
  23112. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23113. while (++leftIndex < leftLength) {
  23114. args[leftIndex] = partials[leftIndex];
  23115. }
  23116. while (argsLength--) {
  23117. args[leftIndex++] = arguments[++argsIndex];
  23118. }
  23119. return apply(fn, isBind ? thisArg : this, args);
  23120. }
  23121. return wrapper;
  23122. }
  23123. /**
  23124. * Creates a `_.range` or `_.rangeRight` function.
  23125. *
  23126. * @private
  23127. * @param {boolean} [fromRight] Specify iterating from right to left.
  23128. * @returns {Function} Returns the new range function.
  23129. */
  23130. function createRange(fromRight) {
  23131. return function(start, end, step) {
  23132. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23133. end = step = undefined;
  23134. }
  23135. // Ensure the sign of `-0` is preserved.
  23136. start = toFinite(start);
  23137. if (end === undefined) {
  23138. end = start;
  23139. start = 0;
  23140. } else {
  23141. end = toFinite(end);
  23142. }
  23143. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23144. return baseRange(start, end, step, fromRight);
  23145. };
  23146. }
  23147. /**
  23148. * Creates a function that performs a relational operation on two values.
  23149. *
  23150. * @private
  23151. * @param {Function} operator The function to perform the operation.
  23152. * @returns {Function} Returns the new relational operation function.
  23153. */
  23154. function createRelationalOperation(operator) {
  23155. return function(value, other) {
  23156. if (!(typeof value == 'string' && typeof other == 'string')) {
  23157. value = toNumber(value);
  23158. other = toNumber(other);
  23159. }
  23160. return operator(value, other);
  23161. };
  23162. }
  23163. /**
  23164. * Creates a function that wraps `func` to continue currying.
  23165. *
  23166. * @private
  23167. * @param {Function} func The function to wrap.
  23168. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23169. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23170. * @param {*} placeholder The placeholder value.
  23171. * @param {*} [thisArg] The `this` binding of `func`.
  23172. * @param {Array} [partials] The arguments to prepend to those provided to
  23173. * the new function.
  23174. * @param {Array} [holders] The `partials` placeholder indexes.
  23175. * @param {Array} [argPos] The argument positions of the new function.
  23176. * @param {number} [ary] The arity cap of `func`.
  23177. * @param {number} [arity] The arity of `func`.
  23178. * @returns {Function} Returns the new wrapped function.
  23179. */
  23180. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23181. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23182. newHolders = isCurry ? holders : undefined,
  23183. newHoldersRight = isCurry ? undefined : holders,
  23184. newPartials = isCurry ? partials : undefined,
  23185. newPartialsRight = isCurry ? undefined : partials;
  23186. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23187. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23188. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23189. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23190. }
  23191. var newData = [
  23192. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23193. newHoldersRight, argPos, ary, arity
  23194. ];
  23195. var result = wrapFunc.apply(undefined, newData);
  23196. if (isLaziable(func)) {
  23197. setData(result, newData);
  23198. }
  23199. result.placeholder = placeholder;
  23200. return setWrapToString(result, func, bitmask);
  23201. }
  23202. /**
  23203. * Creates a function like `_.round`.
  23204. *
  23205. * @private
  23206. * @param {string} methodName The name of the `Math` method to use when rounding.
  23207. * @returns {Function} Returns the new round function.
  23208. */
  23209. function createRound(methodName) {
  23210. var func = Math[methodName];
  23211. return function(number, precision) {
  23212. number = toNumber(number);
  23213. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23214. if (precision && nativeIsFinite(number)) {
  23215. // Shift with exponential notation to avoid floating-point issues.
  23216. // See [MDN](https://mdn.io/round#Examples) for more details.
  23217. var pair = (toString(number) + 'e').split('e'),
  23218. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23219. pair = (toString(value) + 'e').split('e');
  23220. return +(pair[0] + 'e' + (+pair[1] - precision));
  23221. }
  23222. return func(number);
  23223. };
  23224. }
  23225. /**
  23226. * Creates a set object of `values`.
  23227. *
  23228. * @private
  23229. * @param {Array} values The values to add to the set.
  23230. * @returns {Object} Returns the new set.
  23231. */
  23232. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23233. return new Set(values);
  23234. };
  23235. /**
  23236. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23237. *
  23238. * @private
  23239. * @param {Function} keysFunc The function to get the keys of a given object.
  23240. * @returns {Function} Returns the new pairs function.
  23241. */
  23242. function createToPairs(keysFunc) {
  23243. return function(object) {
  23244. var tag = getTag(object);
  23245. if (tag == mapTag) {
  23246. return mapToArray(object);
  23247. }
  23248. if (tag == setTag) {
  23249. return setToPairs(object);
  23250. }
  23251. return baseToPairs(object, keysFunc(object));
  23252. };
  23253. }
  23254. /**
  23255. * Creates a function that either curries or invokes `func` with optional
  23256. * `this` binding and partially applied arguments.
  23257. *
  23258. * @private
  23259. * @param {Function|string} func The function or method name to wrap.
  23260. * @param {number} bitmask The bitmask flags.
  23261. * 1 - `_.bind`
  23262. * 2 - `_.bindKey`
  23263. * 4 - `_.curry` or `_.curryRight` of a bound function
  23264. * 8 - `_.curry`
  23265. * 16 - `_.curryRight`
  23266. * 32 - `_.partial`
  23267. * 64 - `_.partialRight`
  23268. * 128 - `_.rearg`
  23269. * 256 - `_.ary`
  23270. * 512 - `_.flip`
  23271. * @param {*} [thisArg] The `this` binding of `func`.
  23272. * @param {Array} [partials] The arguments to be partially applied.
  23273. * @param {Array} [holders] The `partials` placeholder indexes.
  23274. * @param {Array} [argPos] The argument positions of the new function.
  23275. * @param {number} [ary] The arity cap of `func`.
  23276. * @param {number} [arity] The arity of `func`.
  23277. * @returns {Function} Returns the new wrapped function.
  23278. */
  23279. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23280. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23281. if (!isBindKey && typeof func != 'function') {
  23282. throw new TypeError(FUNC_ERROR_TEXT);
  23283. }
  23284. var length = partials ? partials.length : 0;
  23285. if (!length) {
  23286. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23287. partials = holders = undefined;
  23288. }
  23289. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23290. arity = arity === undefined ? arity : toInteger(arity);
  23291. length -= holders ? holders.length : 0;
  23292. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23293. var partialsRight = partials,
  23294. holdersRight = holders;
  23295. partials = holders = undefined;
  23296. }
  23297. var data = isBindKey ? undefined : getData(func);
  23298. var newData = [
  23299. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23300. argPos, ary, arity
  23301. ];
  23302. if (data) {
  23303. mergeData(newData, data);
  23304. }
  23305. func = newData[0];
  23306. bitmask = newData[1];
  23307. thisArg = newData[2];
  23308. partials = newData[3];
  23309. holders = newData[4];
  23310. arity = newData[9] = newData[9] === undefined
  23311. ? (isBindKey ? 0 : func.length)
  23312. : nativeMax(newData[9] - length, 0);
  23313. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23314. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23315. }
  23316. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23317. var result = createBind(func, bitmask, thisArg);
  23318. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23319. result = createCurry(func, bitmask, arity);
  23320. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23321. result = createPartial(func, bitmask, thisArg, partials);
  23322. } else {
  23323. result = createHybrid.apply(undefined, newData);
  23324. }
  23325. var setter = data ? baseSetData : setData;
  23326. return setWrapToString(setter(result, newData), func, bitmask);
  23327. }
  23328. /**
  23329. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23330. * of source objects to the destination object for all destination properties
  23331. * that resolve to `undefined`.
  23332. *
  23333. * @private
  23334. * @param {*} objValue The destination value.
  23335. * @param {*} srcValue The source value.
  23336. * @param {string} key The key of the property to assign.
  23337. * @param {Object} object The parent object of `objValue`.
  23338. * @returns {*} Returns the value to assign.
  23339. */
  23340. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23341. if (objValue === undefined ||
  23342. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23343. return srcValue;
  23344. }
  23345. return objValue;
  23346. }
  23347. /**
  23348. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23349. * objects into destination objects that are passed thru.
  23350. *
  23351. * @private
  23352. * @param {*} objValue The destination value.
  23353. * @param {*} srcValue The source value.
  23354. * @param {string} key The key of the property to merge.
  23355. * @param {Object} object The parent object of `objValue`.
  23356. * @param {Object} source The parent object of `srcValue`.
  23357. * @param {Object} [stack] Tracks traversed source values and their merged
  23358. * counterparts.
  23359. * @returns {*} Returns the value to assign.
  23360. */
  23361. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23362. if (isObject(objValue) && isObject(srcValue)) {
  23363. // Recursively merge objects and arrays (susceptible to call stack limits).
  23364. stack.set(srcValue, objValue);
  23365. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23366. stack['delete'](srcValue);
  23367. }
  23368. return objValue;
  23369. }
  23370. /**
  23371. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23372. * objects.
  23373. *
  23374. * @private
  23375. * @param {*} value The value to inspect.
  23376. * @param {string} key The key of the property to inspect.
  23377. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23378. */
  23379. function customOmitClone(value) {
  23380. return isPlainObject(value) ? undefined : value;
  23381. }
  23382. /**
  23383. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23384. * partial deep comparisons.
  23385. *
  23386. * @private
  23387. * @param {Array} array The array to compare.
  23388. * @param {Array} other The other array to compare.
  23389. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23390. * @param {Function} customizer The function to customize comparisons.
  23391. * @param {Function} equalFunc The function to determine equivalents of values.
  23392. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23393. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23394. */
  23395. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23396. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23397. arrLength = array.length,
  23398. othLength = other.length;
  23399. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23400. return false;
  23401. }
  23402. // Assume cyclic values are equal.
  23403. var stacked = stack.get(array);
  23404. if (stacked && stack.get(other)) {
  23405. return stacked == other;
  23406. }
  23407. var index = -1,
  23408. result = true,
  23409. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23410. stack.set(array, other);
  23411. stack.set(other, array);
  23412. // Ignore non-index properties.
  23413. while (++index < arrLength) {
  23414. var arrValue = array[index],
  23415. othValue = other[index];
  23416. if (customizer) {
  23417. var compared = isPartial
  23418. ? customizer(othValue, arrValue, index, other, array, stack)
  23419. : customizer(arrValue, othValue, index, array, other, stack);
  23420. }
  23421. if (compared !== undefined) {
  23422. if (compared) {
  23423. continue;
  23424. }
  23425. result = false;
  23426. break;
  23427. }
  23428. // Recursively compare arrays (susceptible to call stack limits).
  23429. if (seen) {
  23430. if (!arraySome(other, function(othValue, othIndex) {
  23431. if (!cacheHas(seen, othIndex) &&
  23432. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23433. return seen.push(othIndex);
  23434. }
  23435. })) {
  23436. result = false;
  23437. break;
  23438. }
  23439. } else if (!(
  23440. arrValue === othValue ||
  23441. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23442. )) {
  23443. result = false;
  23444. break;
  23445. }
  23446. }
  23447. stack['delete'](array);
  23448. stack['delete'](other);
  23449. return result;
  23450. }
  23451. /**
  23452. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23453. * the same `toStringTag`.
  23454. *
  23455. * **Note:** This function only supports comparing values with tags of
  23456. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23457. *
  23458. * @private
  23459. * @param {Object} object The object to compare.
  23460. * @param {Object} other The other object to compare.
  23461. * @param {string} tag The `toStringTag` of the objects to compare.
  23462. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23463. * @param {Function} customizer The function to customize comparisons.
  23464. * @param {Function} equalFunc The function to determine equivalents of values.
  23465. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23466. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23467. */
  23468. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23469. switch (tag) {
  23470. case dataViewTag:
  23471. if ((object.byteLength != other.byteLength) ||
  23472. (object.byteOffset != other.byteOffset)) {
  23473. return false;
  23474. }
  23475. object = object.buffer;
  23476. other = other.buffer;
  23477. case arrayBufferTag:
  23478. if ((object.byteLength != other.byteLength) ||
  23479. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23480. return false;
  23481. }
  23482. return true;
  23483. case boolTag:
  23484. case dateTag:
  23485. case numberTag:
  23486. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23487. // Invalid dates are coerced to `NaN`.
  23488. return eq(+object, +other);
  23489. case errorTag:
  23490. return object.name == other.name && object.message == other.message;
  23491. case regexpTag:
  23492. case stringTag:
  23493. // Coerce regexes to strings and treat strings, primitives and objects,
  23494. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23495. // for more details.
  23496. return object == (other + '');
  23497. case mapTag:
  23498. var convert = mapToArray;
  23499. case setTag:
  23500. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23501. convert || (convert = setToArray);
  23502. if (object.size != other.size && !isPartial) {
  23503. return false;
  23504. }
  23505. // Assume cyclic values are equal.
  23506. var stacked = stack.get(object);
  23507. if (stacked) {
  23508. return stacked == other;
  23509. }
  23510. bitmask |= COMPARE_UNORDERED_FLAG;
  23511. // Recursively compare objects (susceptible to call stack limits).
  23512. stack.set(object, other);
  23513. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23514. stack['delete'](object);
  23515. return result;
  23516. case symbolTag:
  23517. if (symbolValueOf) {
  23518. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23519. }
  23520. }
  23521. return false;
  23522. }
  23523. /**
  23524. * A specialized version of `baseIsEqualDeep` for objects with support for
  23525. * partial deep comparisons.
  23526. *
  23527. * @private
  23528. * @param {Object} object The object to compare.
  23529. * @param {Object} other The other object to compare.
  23530. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23531. * @param {Function} customizer The function to customize comparisons.
  23532. * @param {Function} equalFunc The function to determine equivalents of values.
  23533. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23534. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23535. */
  23536. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23537. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23538. objProps = getAllKeys(object),
  23539. objLength = objProps.length,
  23540. othProps = getAllKeys(other),
  23541. othLength = othProps.length;
  23542. if (objLength != othLength && !isPartial) {
  23543. return false;
  23544. }
  23545. var index = objLength;
  23546. while (index--) {
  23547. var key = objProps[index];
  23548. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23549. return false;
  23550. }
  23551. }
  23552. // Assume cyclic values are equal.
  23553. var stacked = stack.get(object);
  23554. if (stacked && stack.get(other)) {
  23555. return stacked == other;
  23556. }
  23557. var result = true;
  23558. stack.set(object, other);
  23559. stack.set(other, object);
  23560. var skipCtor = isPartial;
  23561. while (++index < objLength) {
  23562. key = objProps[index];
  23563. var objValue = object[key],
  23564. othValue = other[key];
  23565. if (customizer) {
  23566. var compared = isPartial
  23567. ? customizer(othValue, objValue, key, other, object, stack)
  23568. : customizer(objValue, othValue, key, object, other, stack);
  23569. }
  23570. // Recursively compare objects (susceptible to call stack limits).
  23571. if (!(compared === undefined
  23572. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23573. : compared
  23574. )) {
  23575. result = false;
  23576. break;
  23577. }
  23578. skipCtor || (skipCtor = key == 'constructor');
  23579. }
  23580. if (result && !skipCtor) {
  23581. var objCtor = object.constructor,
  23582. othCtor = other.constructor;
  23583. // Non `Object` object instances with different constructors are not equal.
  23584. if (objCtor != othCtor &&
  23585. ('constructor' in object && 'constructor' in other) &&
  23586. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23587. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23588. result = false;
  23589. }
  23590. }
  23591. stack['delete'](object);
  23592. stack['delete'](other);
  23593. return result;
  23594. }
  23595. /**
  23596. * A specialized version of `baseRest` which flattens the rest array.
  23597. *
  23598. * @private
  23599. * @param {Function} func The function to apply a rest parameter to.
  23600. * @returns {Function} Returns the new function.
  23601. */
  23602. function flatRest(func) {
  23603. return setToString(overRest(func, undefined, flatten), func + '');
  23604. }
  23605. /**
  23606. * Creates an array of own enumerable property names and symbols of `object`.
  23607. *
  23608. * @private
  23609. * @param {Object} object The object to query.
  23610. * @returns {Array} Returns the array of property names and symbols.
  23611. */
  23612. function getAllKeys(object) {
  23613. return baseGetAllKeys(object, keys, getSymbols);
  23614. }
  23615. /**
  23616. * Creates an array of own and inherited enumerable property names and
  23617. * symbols of `object`.
  23618. *
  23619. * @private
  23620. * @param {Object} object The object to query.
  23621. * @returns {Array} Returns the array of property names and symbols.
  23622. */
  23623. function getAllKeysIn(object) {
  23624. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23625. }
  23626. /**
  23627. * Gets metadata for `func`.
  23628. *
  23629. * @private
  23630. * @param {Function} func The function to query.
  23631. * @returns {*} Returns the metadata for `func`.
  23632. */
  23633. var getData = !metaMap ? noop : function(func) {
  23634. return metaMap.get(func);
  23635. };
  23636. /**
  23637. * Gets the name of `func`.
  23638. *
  23639. * @private
  23640. * @param {Function} func The function to query.
  23641. * @returns {string} Returns the function name.
  23642. */
  23643. function getFuncName(func) {
  23644. var result = (func.name + ''),
  23645. array = realNames[result],
  23646. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23647. while (length--) {
  23648. var data = array[length],
  23649. otherFunc = data.func;
  23650. if (otherFunc == null || otherFunc == func) {
  23651. return data.name;
  23652. }
  23653. }
  23654. return result;
  23655. }
  23656. /**
  23657. * Gets the argument placeholder value for `func`.
  23658. *
  23659. * @private
  23660. * @param {Function} func The function to inspect.
  23661. * @returns {*} Returns the placeholder value.
  23662. */
  23663. function getHolder(func) {
  23664. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23665. return object.placeholder;
  23666. }
  23667. /**
  23668. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23669. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23670. * If arguments are provided, the chosen function is invoked with them and
  23671. * its result is returned.
  23672. *
  23673. * @private
  23674. * @param {*} [value] The value to convert to an iteratee.
  23675. * @param {number} [arity] The arity of the created iteratee.
  23676. * @returns {Function} Returns the chosen function or its result.
  23677. */
  23678. function getIteratee() {
  23679. var result = lodash.iteratee || iteratee;
  23680. result = result === iteratee ? baseIteratee : result;
  23681. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23682. }
  23683. /**
  23684. * Gets the data for `map`.
  23685. *
  23686. * @private
  23687. * @param {Object} map The map to query.
  23688. * @param {string} key The reference key.
  23689. * @returns {*} Returns the map data.
  23690. */
  23691. function getMapData(map, key) {
  23692. var data = map.__data__;
  23693. return isKeyable(key)
  23694. ? data[typeof key == 'string' ? 'string' : 'hash']
  23695. : data.map;
  23696. }
  23697. /**
  23698. * Gets the property names, values, and compare flags of `object`.
  23699. *
  23700. * @private
  23701. * @param {Object} object The object to query.
  23702. * @returns {Array} Returns the match data of `object`.
  23703. */
  23704. function getMatchData(object) {
  23705. var result = keys(object),
  23706. length = result.length;
  23707. while (length--) {
  23708. var key = result[length],
  23709. value = object[key];
  23710. result[length] = [key, value, isStrictComparable(value)];
  23711. }
  23712. return result;
  23713. }
  23714. /**
  23715. * Gets the native function at `key` of `object`.
  23716. *
  23717. * @private
  23718. * @param {Object} object The object to query.
  23719. * @param {string} key The key of the method to get.
  23720. * @returns {*} Returns the function if it's native, else `undefined`.
  23721. */
  23722. function getNative(object, key) {
  23723. var value = getValue(object, key);
  23724. return baseIsNative(value) ? value : undefined;
  23725. }
  23726. /**
  23727. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23728. *
  23729. * @private
  23730. * @param {*} value The value to query.
  23731. * @returns {string} Returns the raw `toStringTag`.
  23732. */
  23733. function getRawTag(value) {
  23734. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23735. tag = value[symToStringTag];
  23736. try {
  23737. value[symToStringTag] = undefined;
  23738. var unmasked = true;
  23739. } catch (e) {}
  23740. var result = nativeObjectToString.call(value);
  23741. if (unmasked) {
  23742. if (isOwn) {
  23743. value[symToStringTag] = tag;
  23744. } else {
  23745. delete value[symToStringTag];
  23746. }
  23747. }
  23748. return result;
  23749. }
  23750. /**
  23751. * Creates an array of the own enumerable symbols of `object`.
  23752. *
  23753. * @private
  23754. * @param {Object} object The object to query.
  23755. * @returns {Array} Returns the array of symbols.
  23756. */
  23757. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23758. if (object == null) {
  23759. return [];
  23760. }
  23761. object = Object(object);
  23762. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23763. return propertyIsEnumerable.call(object, symbol);
  23764. });
  23765. };
  23766. /**
  23767. * Creates an array of the own and inherited enumerable symbols of `object`.
  23768. *
  23769. * @private
  23770. * @param {Object} object The object to query.
  23771. * @returns {Array} Returns the array of symbols.
  23772. */
  23773. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23774. var result = [];
  23775. while (object) {
  23776. arrayPush(result, getSymbols(object));
  23777. object = getPrototype(object);
  23778. }
  23779. return result;
  23780. };
  23781. /**
  23782. * Gets the `toStringTag` of `value`.
  23783. *
  23784. * @private
  23785. * @param {*} value The value to query.
  23786. * @returns {string} Returns the `toStringTag`.
  23787. */
  23788. var getTag = baseGetTag;
  23789. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23790. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23791. (Map && getTag(new Map) != mapTag) ||
  23792. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23793. (Set && getTag(new Set) != setTag) ||
  23794. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23795. getTag = function(value) {
  23796. var result = baseGetTag(value),
  23797. Ctor = result == objectTag ? value.constructor : undefined,
  23798. ctorString = Ctor ? toSource(Ctor) : '';
  23799. if (ctorString) {
  23800. switch (ctorString) {
  23801. case dataViewCtorString: return dataViewTag;
  23802. case mapCtorString: return mapTag;
  23803. case promiseCtorString: return promiseTag;
  23804. case setCtorString: return setTag;
  23805. case weakMapCtorString: return weakMapTag;
  23806. }
  23807. }
  23808. return result;
  23809. };
  23810. }
  23811. /**
  23812. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23813. *
  23814. * @private
  23815. * @param {number} start The start of the view.
  23816. * @param {number} end The end of the view.
  23817. * @param {Array} transforms The transformations to apply to the view.
  23818. * @returns {Object} Returns an object containing the `start` and `end`
  23819. * positions of the view.
  23820. */
  23821. function getView(start, end, transforms) {
  23822. var index = -1,
  23823. length = transforms.length;
  23824. while (++index < length) {
  23825. var data = transforms[index],
  23826. size = data.size;
  23827. switch (data.type) {
  23828. case 'drop': start += size; break;
  23829. case 'dropRight': end -= size; break;
  23830. case 'take': end = nativeMin(end, start + size); break;
  23831. case 'takeRight': start = nativeMax(start, end - size); break;
  23832. }
  23833. }
  23834. return { 'start': start, 'end': end };
  23835. }
  23836. /**
  23837. * Extracts wrapper details from the `source` body comment.
  23838. *
  23839. * @private
  23840. * @param {string} source The source to inspect.
  23841. * @returns {Array} Returns the wrapper details.
  23842. */
  23843. function getWrapDetails(source) {
  23844. var match = source.match(reWrapDetails);
  23845. return match ? match[1].split(reSplitDetails) : [];
  23846. }
  23847. /**
  23848. * Checks if `path` exists on `object`.
  23849. *
  23850. * @private
  23851. * @param {Object} object The object to query.
  23852. * @param {Array|string} path The path to check.
  23853. * @param {Function} hasFunc The function to check properties.
  23854. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23855. */
  23856. function hasPath(object, path, hasFunc) {
  23857. path = castPath(path, object);
  23858. var index = -1,
  23859. length = path.length,
  23860. result = false;
  23861. while (++index < length) {
  23862. var key = toKey(path[index]);
  23863. if (!(result = object != null && hasFunc(object, key))) {
  23864. break;
  23865. }
  23866. object = object[key];
  23867. }
  23868. if (result || ++index != length) {
  23869. return result;
  23870. }
  23871. length = object == null ? 0 : object.length;
  23872. return !!length && isLength(length) && isIndex(key, length) &&
  23873. (isArray(object) || isArguments(object));
  23874. }
  23875. /**
  23876. * Initializes an array clone.
  23877. *
  23878. * @private
  23879. * @param {Array} array The array to clone.
  23880. * @returns {Array} Returns the initialized clone.
  23881. */
  23882. function initCloneArray(array) {
  23883. var length = array.length,
  23884. result = new array.constructor(length);
  23885. // Add properties assigned by `RegExp#exec`.
  23886. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23887. result.index = array.index;
  23888. result.input = array.input;
  23889. }
  23890. return result;
  23891. }
  23892. /**
  23893. * Initializes an object clone.
  23894. *
  23895. * @private
  23896. * @param {Object} object The object to clone.
  23897. * @returns {Object} Returns the initialized clone.
  23898. */
  23899. function initCloneObject(object) {
  23900. return (typeof object.constructor == 'function' && !isPrototype(object))
  23901. ? baseCreate(getPrototype(object))
  23902. : {};
  23903. }
  23904. /**
  23905. * Initializes an object clone based on its `toStringTag`.
  23906. *
  23907. * **Note:** This function only supports cloning values with tags of
  23908. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23909. *
  23910. * @private
  23911. * @param {Object} object The object to clone.
  23912. * @param {string} tag The `toStringTag` of the object to clone.
  23913. * @param {boolean} [isDeep] Specify a deep clone.
  23914. * @returns {Object} Returns the initialized clone.
  23915. */
  23916. function initCloneByTag(object, tag, isDeep) {
  23917. var Ctor = object.constructor;
  23918. switch (tag) {
  23919. case arrayBufferTag:
  23920. return cloneArrayBuffer(object);
  23921. case boolTag:
  23922. case dateTag:
  23923. return new Ctor(+object);
  23924. case dataViewTag:
  23925. return cloneDataView(object, isDeep);
  23926. case float32Tag: case float64Tag:
  23927. case int8Tag: case int16Tag: case int32Tag:
  23928. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23929. return cloneTypedArray(object, isDeep);
  23930. case mapTag:
  23931. return new Ctor;
  23932. case numberTag:
  23933. case stringTag:
  23934. return new Ctor(object);
  23935. case regexpTag:
  23936. return cloneRegExp(object);
  23937. case setTag:
  23938. return new Ctor;
  23939. case symbolTag:
  23940. return cloneSymbol(object);
  23941. }
  23942. }
  23943. /**
  23944. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23945. *
  23946. * @private
  23947. * @param {string} source The source to modify.
  23948. * @returns {Array} details The details to insert.
  23949. * @returns {string} Returns the modified source.
  23950. */
  23951. function insertWrapDetails(source, details) {
  23952. var length = details.length;
  23953. if (!length) {
  23954. return source;
  23955. }
  23956. var lastIndex = length - 1;
  23957. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23958. details = details.join(length > 2 ? ', ' : ' ');
  23959. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23960. }
  23961. /**
  23962. * Checks if `value` is a flattenable `arguments` object or array.
  23963. *
  23964. * @private
  23965. * @param {*} value The value to check.
  23966. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23967. */
  23968. function isFlattenable(value) {
  23969. return isArray(value) || isArguments(value) ||
  23970. !!(spreadableSymbol && value && value[spreadableSymbol]);
  23971. }
  23972. /**
  23973. * Checks if `value` is a valid array-like index.
  23974. *
  23975. * @private
  23976. * @param {*} value The value to check.
  23977. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  23978. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  23979. */
  23980. function isIndex(value, length) {
  23981. var type = typeof value;
  23982. length = length == null ? MAX_SAFE_INTEGER : length;
  23983. return !!length &&
  23984. (type == 'number' ||
  23985. (type != 'symbol' && reIsUint.test(value))) &&
  23986. (value > -1 && value % 1 == 0 && value < length);
  23987. }
  23988. /**
  23989. * Checks if the given arguments are from an iteratee call.
  23990. *
  23991. * @private
  23992. * @param {*} value The potential iteratee value argument.
  23993. * @param {*} index The potential iteratee index or key argument.
  23994. * @param {*} object The potential iteratee object argument.
  23995. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  23996. * else `false`.
  23997. */
  23998. function isIterateeCall(value, index, object) {
  23999. if (!isObject(object)) {
  24000. return false;
  24001. }
  24002. var type = typeof index;
  24003. if (type == 'number'
  24004. ? (isArrayLike(object) && isIndex(index, object.length))
  24005. : (type == 'string' && index in object)
  24006. ) {
  24007. return eq(object[index], value);
  24008. }
  24009. return false;
  24010. }
  24011. /**
  24012. * Checks if `value` is a property name and not a property path.
  24013. *
  24014. * @private
  24015. * @param {*} value The value to check.
  24016. * @param {Object} [object] The object to query keys on.
  24017. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24018. */
  24019. function isKey(value, object) {
  24020. if (isArray(value)) {
  24021. return false;
  24022. }
  24023. var type = typeof value;
  24024. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24025. value == null || isSymbol(value)) {
  24026. return true;
  24027. }
  24028. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24029. (object != null && value in Object(object));
  24030. }
  24031. /**
  24032. * Checks if `value` is suitable for use as unique object key.
  24033. *
  24034. * @private
  24035. * @param {*} value The value to check.
  24036. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24037. */
  24038. function isKeyable(value) {
  24039. var type = typeof value;
  24040. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24041. ? (value !== '__proto__')
  24042. : (value === null);
  24043. }
  24044. /**
  24045. * Checks if `func` has a lazy counterpart.
  24046. *
  24047. * @private
  24048. * @param {Function} func The function to check.
  24049. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24050. * else `false`.
  24051. */
  24052. function isLaziable(func) {
  24053. var funcName = getFuncName(func),
  24054. other = lodash[funcName];
  24055. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24056. return false;
  24057. }
  24058. if (func === other) {
  24059. return true;
  24060. }
  24061. var data = getData(other);
  24062. return !!data && func === data[0];
  24063. }
  24064. /**
  24065. * Checks if `func` has its source masked.
  24066. *
  24067. * @private
  24068. * @param {Function} func The function to check.
  24069. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24070. */
  24071. function isMasked(func) {
  24072. return !!maskSrcKey && (maskSrcKey in func);
  24073. }
  24074. /**
  24075. * Checks if `func` is capable of being masked.
  24076. *
  24077. * @private
  24078. * @param {*} value The value to check.
  24079. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24080. */
  24081. var isMaskable = coreJsData ? isFunction : stubFalse;
  24082. /**
  24083. * Checks if `value` is likely a prototype object.
  24084. *
  24085. * @private
  24086. * @param {*} value The value to check.
  24087. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24088. */
  24089. function isPrototype(value) {
  24090. var Ctor = value && value.constructor,
  24091. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24092. return value === proto;
  24093. }
  24094. /**
  24095. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24096. *
  24097. * @private
  24098. * @param {*} value The value to check.
  24099. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24100. * equality comparisons, else `false`.
  24101. */
  24102. function isStrictComparable(value) {
  24103. return value === value && !isObject(value);
  24104. }
  24105. /**
  24106. * A specialized version of `matchesProperty` for source values suitable
  24107. * for strict equality comparisons, i.e. `===`.
  24108. *
  24109. * @private
  24110. * @param {string} key The key of the property to get.
  24111. * @param {*} srcValue The value to match.
  24112. * @returns {Function} Returns the new spec function.
  24113. */
  24114. function matchesStrictComparable(key, srcValue) {
  24115. return function(object) {
  24116. if (object == null) {
  24117. return false;
  24118. }
  24119. return object[key] === srcValue &&
  24120. (srcValue !== undefined || (key in Object(object)));
  24121. };
  24122. }
  24123. /**
  24124. * A specialized version of `_.memoize` which clears the memoized function's
  24125. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24126. *
  24127. * @private
  24128. * @param {Function} func The function to have its output memoized.
  24129. * @returns {Function} Returns the new memoized function.
  24130. */
  24131. function memoizeCapped(func) {
  24132. var result = memoize(func, function(key) {
  24133. if (cache.size === MAX_MEMOIZE_SIZE) {
  24134. cache.clear();
  24135. }
  24136. return key;
  24137. });
  24138. var cache = result.cache;
  24139. return result;
  24140. }
  24141. /**
  24142. * Merges the function metadata of `source` into `data`.
  24143. *
  24144. * Merging metadata reduces the number of wrappers used to invoke a function.
  24145. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24146. * may be applied regardless of execution order. Methods like `_.ary` and
  24147. * `_.rearg` modify function arguments, making the order in which they are
  24148. * executed important, preventing the merging of metadata. However, we make
  24149. * an exception for a safe combined case where curried functions have `_.ary`
  24150. * and or `_.rearg` applied.
  24151. *
  24152. * @private
  24153. * @param {Array} data The destination metadata.
  24154. * @param {Array} source The source metadata.
  24155. * @returns {Array} Returns `data`.
  24156. */
  24157. function mergeData(data, source) {
  24158. var bitmask = data[1],
  24159. srcBitmask = source[1],
  24160. newBitmask = bitmask | srcBitmask,
  24161. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24162. var isCombo =
  24163. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24164. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24165. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24166. // Exit early if metadata can't be merged.
  24167. if (!(isCommon || isCombo)) {
  24168. return data;
  24169. }
  24170. // Use source `thisArg` if available.
  24171. if (srcBitmask & WRAP_BIND_FLAG) {
  24172. data[2] = source[2];
  24173. // Set when currying a bound function.
  24174. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24175. }
  24176. // Compose partial arguments.
  24177. var value = source[3];
  24178. if (value) {
  24179. var partials = data[3];
  24180. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24181. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24182. }
  24183. // Compose partial right arguments.
  24184. value = source[5];
  24185. if (value) {
  24186. partials = data[5];
  24187. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24188. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24189. }
  24190. // Use source `argPos` if available.
  24191. value = source[7];
  24192. if (value) {
  24193. data[7] = value;
  24194. }
  24195. // Use source `ary` if it's smaller.
  24196. if (srcBitmask & WRAP_ARY_FLAG) {
  24197. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24198. }
  24199. // Use source `arity` if one is not provided.
  24200. if (data[9] == null) {
  24201. data[9] = source[9];
  24202. }
  24203. // Use source `func` and merge bitmasks.
  24204. data[0] = source[0];
  24205. data[1] = newBitmask;
  24206. return data;
  24207. }
  24208. /**
  24209. * This function is like
  24210. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24211. * except that it includes inherited enumerable properties.
  24212. *
  24213. * @private
  24214. * @param {Object} object The object to query.
  24215. * @returns {Array} Returns the array of property names.
  24216. */
  24217. function nativeKeysIn(object) {
  24218. var result = [];
  24219. if (object != null) {
  24220. for (var key in Object(object)) {
  24221. result.push(key);
  24222. }
  24223. }
  24224. return result;
  24225. }
  24226. /**
  24227. * Converts `value` to a string using `Object.prototype.toString`.
  24228. *
  24229. * @private
  24230. * @param {*} value The value to convert.
  24231. * @returns {string} Returns the converted string.
  24232. */
  24233. function objectToString(value) {
  24234. return nativeObjectToString.call(value);
  24235. }
  24236. /**
  24237. * A specialized version of `baseRest` which transforms the rest array.
  24238. *
  24239. * @private
  24240. * @param {Function} func The function to apply a rest parameter to.
  24241. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24242. * @param {Function} transform The rest array transform.
  24243. * @returns {Function} Returns the new function.
  24244. */
  24245. function overRest(func, start, transform) {
  24246. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24247. return function() {
  24248. var args = arguments,
  24249. index = -1,
  24250. length = nativeMax(args.length - start, 0),
  24251. array = Array(length);
  24252. while (++index < length) {
  24253. array[index] = args[start + index];
  24254. }
  24255. index = -1;
  24256. var otherArgs = Array(start + 1);
  24257. while (++index < start) {
  24258. otherArgs[index] = args[index];
  24259. }
  24260. otherArgs[start] = transform(array);
  24261. return apply(func, this, otherArgs);
  24262. };
  24263. }
  24264. /**
  24265. * Gets the parent value at `path` of `object`.
  24266. *
  24267. * @private
  24268. * @param {Object} object The object to query.
  24269. * @param {Array} path The path to get the parent value of.
  24270. * @returns {*} Returns the parent value.
  24271. */
  24272. function parent(object, path) {
  24273. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24274. }
  24275. /**
  24276. * Reorder `array` according to the specified indexes where the element at
  24277. * the first index is assigned as the first element, the element at
  24278. * the second index is assigned as the second element, and so on.
  24279. *
  24280. * @private
  24281. * @param {Array} array The array to reorder.
  24282. * @param {Array} indexes The arranged array indexes.
  24283. * @returns {Array} Returns `array`.
  24284. */
  24285. function reorder(array, indexes) {
  24286. var arrLength = array.length,
  24287. length = nativeMin(indexes.length, arrLength),
  24288. oldArray = copyArray(array);
  24289. while (length--) {
  24290. var index = indexes[length];
  24291. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24292. }
  24293. return array;
  24294. }
  24295. /**
  24296. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24297. *
  24298. * @private
  24299. * @param {Object} object The object to query.
  24300. * @param {string} key The key of the property to get.
  24301. * @returns {*} Returns the property value.
  24302. */
  24303. function safeGet(object, key) {
  24304. if (key === 'constructor' && typeof object[key] === 'function') {
  24305. return;
  24306. }
  24307. if (key == '__proto__') {
  24308. return;
  24309. }
  24310. return object[key];
  24311. }
  24312. /**
  24313. * Sets metadata for `func`.
  24314. *
  24315. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24316. * period of time, it will trip its breaker and transition to an identity
  24317. * function to avoid garbage collection pauses in V8. See
  24318. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24319. * for more details.
  24320. *
  24321. * @private
  24322. * @param {Function} func The function to associate metadata with.
  24323. * @param {*} data The metadata.
  24324. * @returns {Function} Returns `func`.
  24325. */
  24326. var setData = shortOut(baseSetData);
  24327. /**
  24328. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24329. *
  24330. * @private
  24331. * @param {Function} func The function to delay.
  24332. * @param {number} wait The number of milliseconds to delay invocation.
  24333. * @returns {number|Object} Returns the timer id or timeout object.
  24334. */
  24335. var setTimeout = ctxSetTimeout || function(func, wait) {
  24336. return root.setTimeout(func, wait);
  24337. };
  24338. /**
  24339. * Sets the `toString` method of `func` to return `string`.
  24340. *
  24341. * @private
  24342. * @param {Function} func The function to modify.
  24343. * @param {Function} string The `toString` result.
  24344. * @returns {Function} Returns `func`.
  24345. */
  24346. var setToString = shortOut(baseSetToString);
  24347. /**
  24348. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24349. * with wrapper details in a comment at the top of the source body.
  24350. *
  24351. * @private
  24352. * @param {Function} wrapper The function to modify.
  24353. * @param {Function} reference The reference function.
  24354. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24355. * @returns {Function} Returns `wrapper`.
  24356. */
  24357. function setWrapToString(wrapper, reference, bitmask) {
  24358. var source = (reference + '');
  24359. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24360. }
  24361. /**
  24362. * Creates a function that'll short out and invoke `identity` instead
  24363. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24364. * milliseconds.
  24365. *
  24366. * @private
  24367. * @param {Function} func The function to restrict.
  24368. * @returns {Function} Returns the new shortable function.
  24369. */
  24370. function shortOut(func) {
  24371. var count = 0,
  24372. lastCalled = 0;
  24373. return function() {
  24374. var stamp = nativeNow(),
  24375. remaining = HOT_SPAN - (stamp - lastCalled);
  24376. lastCalled = stamp;
  24377. if (remaining > 0) {
  24378. if (++count >= HOT_COUNT) {
  24379. return arguments[0];
  24380. }
  24381. } else {
  24382. count = 0;
  24383. }
  24384. return func.apply(undefined, arguments);
  24385. };
  24386. }
  24387. /**
  24388. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24389. *
  24390. * @private
  24391. * @param {Array} array The array to shuffle.
  24392. * @param {number} [size=array.length] The size of `array`.
  24393. * @returns {Array} Returns `array`.
  24394. */
  24395. function shuffleSelf(array, size) {
  24396. var index = -1,
  24397. length = array.length,
  24398. lastIndex = length - 1;
  24399. size = size === undefined ? length : size;
  24400. while (++index < size) {
  24401. var rand = baseRandom(index, lastIndex),
  24402. value = array[rand];
  24403. array[rand] = array[index];
  24404. array[index] = value;
  24405. }
  24406. array.length = size;
  24407. return array;
  24408. }
  24409. /**
  24410. * Converts `string` to a property path array.
  24411. *
  24412. * @private
  24413. * @param {string} string The string to convert.
  24414. * @returns {Array} Returns the property path array.
  24415. */
  24416. var stringToPath = memoizeCapped(function(string) {
  24417. var result = [];
  24418. if (string.charCodeAt(0) === 46 /* . */) {
  24419. result.push('');
  24420. }
  24421. string.replace(rePropName, function(match, number, quote, subString) {
  24422. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24423. });
  24424. return result;
  24425. });
  24426. /**
  24427. * Converts `value` to a string key if it's not a string or symbol.
  24428. *
  24429. * @private
  24430. * @param {*} value The value to inspect.
  24431. * @returns {string|symbol} Returns the key.
  24432. */
  24433. function toKey(value) {
  24434. if (typeof value == 'string' || isSymbol(value)) {
  24435. return value;
  24436. }
  24437. var result = (value + '');
  24438. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24439. }
  24440. /**
  24441. * Converts `func` to its source code.
  24442. *
  24443. * @private
  24444. * @param {Function} func The function to convert.
  24445. * @returns {string} Returns the source code.
  24446. */
  24447. function toSource(func) {
  24448. if (func != null) {
  24449. try {
  24450. return funcToString.call(func);
  24451. } catch (e) {}
  24452. try {
  24453. return (func + '');
  24454. } catch (e) {}
  24455. }
  24456. return '';
  24457. }
  24458. /**
  24459. * Updates wrapper `details` based on `bitmask` flags.
  24460. *
  24461. * @private
  24462. * @returns {Array} details The details to modify.
  24463. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24464. * @returns {Array} Returns `details`.
  24465. */
  24466. function updateWrapDetails(details, bitmask) {
  24467. arrayEach(wrapFlags, function(pair) {
  24468. var value = '_.' + pair[0];
  24469. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24470. details.push(value);
  24471. }
  24472. });
  24473. return details.sort();
  24474. }
  24475. /**
  24476. * Creates a clone of `wrapper`.
  24477. *
  24478. * @private
  24479. * @param {Object} wrapper The wrapper to clone.
  24480. * @returns {Object} Returns the cloned wrapper.
  24481. */
  24482. function wrapperClone(wrapper) {
  24483. if (wrapper instanceof LazyWrapper) {
  24484. return wrapper.clone();
  24485. }
  24486. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24487. result.__actions__ = copyArray(wrapper.__actions__);
  24488. result.__index__ = wrapper.__index__;
  24489. result.__values__ = wrapper.__values__;
  24490. return result;
  24491. }
  24492. /*------------------------------------------------------------------------*/
  24493. /**
  24494. * Creates an array of elements split into groups the length of `size`.
  24495. * If `array` can't be split evenly, the final chunk will be the remaining
  24496. * elements.
  24497. *
  24498. * @static
  24499. * @memberOf _
  24500. * @since 3.0.0
  24501. * @category Array
  24502. * @param {Array} array The array to process.
  24503. * @param {number} [size=1] The length of each chunk
  24504. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24505. * @returns {Array} Returns the new array of chunks.
  24506. * @example
  24507. *
  24508. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24509. * // => [['a', 'b'], ['c', 'd']]
  24510. *
  24511. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24512. * // => [['a', 'b', 'c'], ['d']]
  24513. */
  24514. function chunk(array, size, guard) {
  24515. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24516. size = 1;
  24517. } else {
  24518. size = nativeMax(toInteger(size), 0);
  24519. }
  24520. var length = array == null ? 0 : array.length;
  24521. if (!length || size < 1) {
  24522. return [];
  24523. }
  24524. var index = 0,
  24525. resIndex = 0,
  24526. result = Array(nativeCeil(length / size));
  24527. while (index < length) {
  24528. result[resIndex++] = baseSlice(array, index, (index += size));
  24529. }
  24530. return result;
  24531. }
  24532. /**
  24533. * Creates an array with all falsey values removed. The values `false`, `null`,
  24534. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24535. *
  24536. * @static
  24537. * @memberOf _
  24538. * @since 0.1.0
  24539. * @category Array
  24540. * @param {Array} array The array to compact.
  24541. * @returns {Array} Returns the new array of filtered values.
  24542. * @example
  24543. *
  24544. * _.compact([0, 1, false, 2, '', 3]);
  24545. * // => [1, 2, 3]
  24546. */
  24547. function compact(array) {
  24548. var index = -1,
  24549. length = array == null ? 0 : array.length,
  24550. resIndex = 0,
  24551. result = [];
  24552. while (++index < length) {
  24553. var value = array[index];
  24554. if (value) {
  24555. result[resIndex++] = value;
  24556. }
  24557. }
  24558. return result;
  24559. }
  24560. /**
  24561. * Creates a new array concatenating `array` with any additional arrays
  24562. * and/or values.
  24563. *
  24564. * @static
  24565. * @memberOf _
  24566. * @since 4.0.0
  24567. * @category Array
  24568. * @param {Array} array The array to concatenate.
  24569. * @param {...*} [values] The values to concatenate.
  24570. * @returns {Array} Returns the new concatenated array.
  24571. * @example
  24572. *
  24573. * var array = [1];
  24574. * var other = _.concat(array, 2, [3], [[4]]);
  24575. *
  24576. * console.log(other);
  24577. * // => [1, 2, 3, [4]]
  24578. *
  24579. * console.log(array);
  24580. * // => [1]
  24581. */
  24582. function concat() {
  24583. var length = arguments.length;
  24584. if (!length) {
  24585. return [];
  24586. }
  24587. var args = Array(length - 1),
  24588. array = arguments[0],
  24589. index = length;
  24590. while (index--) {
  24591. args[index - 1] = arguments[index];
  24592. }
  24593. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24594. }
  24595. /**
  24596. * Creates an array of `array` values not included in the other given arrays
  24597. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24598. * for equality comparisons. The order and references of result values are
  24599. * determined by the first array.
  24600. *
  24601. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24602. *
  24603. * @static
  24604. * @memberOf _
  24605. * @since 0.1.0
  24606. * @category Array
  24607. * @param {Array} array The array to inspect.
  24608. * @param {...Array} [values] The values to exclude.
  24609. * @returns {Array} Returns the new array of filtered values.
  24610. * @see _.without, _.xor
  24611. * @example
  24612. *
  24613. * _.difference([2, 1], [2, 3]);
  24614. * // => [1]
  24615. */
  24616. var difference = baseRest(function(array, values) {
  24617. return isArrayLikeObject(array)
  24618. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24619. : [];
  24620. });
  24621. /**
  24622. * This method is like `_.difference` except that it accepts `iteratee` which
  24623. * is invoked for each element of `array` and `values` to generate the criterion
  24624. * by which they're compared. The order and references of result values are
  24625. * determined by the first array. The iteratee is invoked with one argument:
  24626. * (value).
  24627. *
  24628. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24629. *
  24630. * @static
  24631. * @memberOf _
  24632. * @since 4.0.0
  24633. * @category Array
  24634. * @param {Array} array The array to inspect.
  24635. * @param {...Array} [values] The values to exclude.
  24636. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24637. * @returns {Array} Returns the new array of filtered values.
  24638. * @example
  24639. *
  24640. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24641. * // => [1.2]
  24642. *
  24643. * // The `_.property` iteratee shorthand.
  24644. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24645. * // => [{ 'x': 2 }]
  24646. */
  24647. var differenceBy = baseRest(function(array, values) {
  24648. var iteratee = last(values);
  24649. if (isArrayLikeObject(iteratee)) {
  24650. iteratee = undefined;
  24651. }
  24652. return isArrayLikeObject(array)
  24653. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24654. : [];
  24655. });
  24656. /**
  24657. * This method is like `_.difference` except that it accepts `comparator`
  24658. * which is invoked to compare elements of `array` to `values`. The order and
  24659. * references of result values are determined by the first array. The comparator
  24660. * is invoked with two arguments: (arrVal, othVal).
  24661. *
  24662. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24663. *
  24664. * @static
  24665. * @memberOf _
  24666. * @since 4.0.0
  24667. * @category Array
  24668. * @param {Array} array The array to inspect.
  24669. * @param {...Array} [values] The values to exclude.
  24670. * @param {Function} [comparator] The comparator invoked per element.
  24671. * @returns {Array} Returns the new array of filtered values.
  24672. * @example
  24673. *
  24674. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24675. *
  24676. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24677. * // => [{ 'x': 2, 'y': 1 }]
  24678. */
  24679. var differenceWith = baseRest(function(array, values) {
  24680. var comparator = last(values);
  24681. if (isArrayLikeObject(comparator)) {
  24682. comparator = undefined;
  24683. }
  24684. return isArrayLikeObject(array)
  24685. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24686. : [];
  24687. });
  24688. /**
  24689. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24690. *
  24691. * @static
  24692. * @memberOf _
  24693. * @since 0.5.0
  24694. * @category Array
  24695. * @param {Array} array The array to query.
  24696. * @param {number} [n=1] The number of elements to drop.
  24697. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24698. * @returns {Array} Returns the slice of `array`.
  24699. * @example
  24700. *
  24701. * _.drop([1, 2, 3]);
  24702. * // => [2, 3]
  24703. *
  24704. * _.drop([1, 2, 3], 2);
  24705. * // => [3]
  24706. *
  24707. * _.drop([1, 2, 3], 5);
  24708. * // => []
  24709. *
  24710. * _.drop([1, 2, 3], 0);
  24711. * // => [1, 2, 3]
  24712. */
  24713. function drop(array, n, guard) {
  24714. var length = array == null ? 0 : array.length;
  24715. if (!length) {
  24716. return [];
  24717. }
  24718. n = (guard || n === undefined) ? 1 : toInteger(n);
  24719. return baseSlice(array, n < 0 ? 0 : n, length);
  24720. }
  24721. /**
  24722. * Creates a slice of `array` with `n` elements dropped from the end.
  24723. *
  24724. * @static
  24725. * @memberOf _
  24726. * @since 3.0.0
  24727. * @category Array
  24728. * @param {Array} array The array to query.
  24729. * @param {number} [n=1] The number of elements to drop.
  24730. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24731. * @returns {Array} Returns the slice of `array`.
  24732. * @example
  24733. *
  24734. * _.dropRight([1, 2, 3]);
  24735. * // => [1, 2]
  24736. *
  24737. * _.dropRight([1, 2, 3], 2);
  24738. * // => [1]
  24739. *
  24740. * _.dropRight([1, 2, 3], 5);
  24741. * // => []
  24742. *
  24743. * _.dropRight([1, 2, 3], 0);
  24744. * // => [1, 2, 3]
  24745. */
  24746. function dropRight(array, n, guard) {
  24747. var length = array == null ? 0 : array.length;
  24748. if (!length) {
  24749. return [];
  24750. }
  24751. n = (guard || n === undefined) ? 1 : toInteger(n);
  24752. n = length - n;
  24753. return baseSlice(array, 0, n < 0 ? 0 : n);
  24754. }
  24755. /**
  24756. * Creates a slice of `array` excluding elements dropped from the end.
  24757. * Elements are dropped until `predicate` returns falsey. The predicate is
  24758. * invoked with three arguments: (value, index, array).
  24759. *
  24760. * @static
  24761. * @memberOf _
  24762. * @since 3.0.0
  24763. * @category Array
  24764. * @param {Array} array The array to query.
  24765. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24766. * @returns {Array} Returns the slice of `array`.
  24767. * @example
  24768. *
  24769. * var users = [
  24770. * { 'user': 'barney', 'active': true },
  24771. * { 'user': 'fred', 'active': false },
  24772. * { 'user': 'pebbles', 'active': false }
  24773. * ];
  24774. *
  24775. * _.dropRightWhile(users, function(o) { return !o.active; });
  24776. * // => objects for ['barney']
  24777. *
  24778. * // The `_.matches` iteratee shorthand.
  24779. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24780. * // => objects for ['barney', 'fred']
  24781. *
  24782. * // The `_.matchesProperty` iteratee shorthand.
  24783. * _.dropRightWhile(users, ['active', false]);
  24784. * // => objects for ['barney']
  24785. *
  24786. * // The `_.property` iteratee shorthand.
  24787. * _.dropRightWhile(users, 'active');
  24788. * // => objects for ['barney', 'fred', 'pebbles']
  24789. */
  24790. function dropRightWhile(array, predicate) {
  24791. return (array && array.length)
  24792. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24793. : [];
  24794. }
  24795. /**
  24796. * Creates a slice of `array` excluding elements dropped from the beginning.
  24797. * Elements are dropped until `predicate` returns falsey. The predicate is
  24798. * invoked with three arguments: (value, index, array).
  24799. *
  24800. * @static
  24801. * @memberOf _
  24802. * @since 3.0.0
  24803. * @category Array
  24804. * @param {Array} array The array to query.
  24805. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24806. * @returns {Array} Returns the slice of `array`.
  24807. * @example
  24808. *
  24809. * var users = [
  24810. * { 'user': 'barney', 'active': false },
  24811. * { 'user': 'fred', 'active': false },
  24812. * { 'user': 'pebbles', 'active': true }
  24813. * ];
  24814. *
  24815. * _.dropWhile(users, function(o) { return !o.active; });
  24816. * // => objects for ['pebbles']
  24817. *
  24818. * // The `_.matches` iteratee shorthand.
  24819. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24820. * // => objects for ['fred', 'pebbles']
  24821. *
  24822. * // The `_.matchesProperty` iteratee shorthand.
  24823. * _.dropWhile(users, ['active', false]);
  24824. * // => objects for ['pebbles']
  24825. *
  24826. * // The `_.property` iteratee shorthand.
  24827. * _.dropWhile(users, 'active');
  24828. * // => objects for ['barney', 'fred', 'pebbles']
  24829. */
  24830. function dropWhile(array, predicate) {
  24831. return (array && array.length)
  24832. ? baseWhile(array, getIteratee(predicate, 3), true)
  24833. : [];
  24834. }
  24835. /**
  24836. * Fills elements of `array` with `value` from `start` up to, but not
  24837. * including, `end`.
  24838. *
  24839. * **Note:** This method mutates `array`.
  24840. *
  24841. * @static
  24842. * @memberOf _
  24843. * @since 3.2.0
  24844. * @category Array
  24845. * @param {Array} array The array to fill.
  24846. * @param {*} value The value to fill `array` with.
  24847. * @param {number} [start=0] The start position.
  24848. * @param {number} [end=array.length] The end position.
  24849. * @returns {Array} Returns `array`.
  24850. * @example
  24851. *
  24852. * var array = [1, 2, 3];
  24853. *
  24854. * _.fill(array, 'a');
  24855. * console.log(array);
  24856. * // => ['a', 'a', 'a']
  24857. *
  24858. * _.fill(Array(3), 2);
  24859. * // => [2, 2, 2]
  24860. *
  24861. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24862. * // => [4, '*', '*', 10]
  24863. */
  24864. function fill(array, value, start, end) {
  24865. var length = array == null ? 0 : array.length;
  24866. if (!length) {
  24867. return [];
  24868. }
  24869. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24870. start = 0;
  24871. end = length;
  24872. }
  24873. return baseFill(array, value, start, end);
  24874. }
  24875. /**
  24876. * This method is like `_.find` except that it returns the index of the first
  24877. * element `predicate` returns truthy for instead of the element itself.
  24878. *
  24879. * @static
  24880. * @memberOf _
  24881. * @since 1.1.0
  24882. * @category Array
  24883. * @param {Array} array The array to inspect.
  24884. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24885. * @param {number} [fromIndex=0] The index to search from.
  24886. * @returns {number} Returns the index of the found element, else `-1`.
  24887. * @example
  24888. *
  24889. * var users = [
  24890. * { 'user': 'barney', 'active': false },
  24891. * { 'user': 'fred', 'active': false },
  24892. * { 'user': 'pebbles', 'active': true }
  24893. * ];
  24894. *
  24895. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24896. * // => 0
  24897. *
  24898. * // The `_.matches` iteratee shorthand.
  24899. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24900. * // => 1
  24901. *
  24902. * // The `_.matchesProperty` iteratee shorthand.
  24903. * _.findIndex(users, ['active', false]);
  24904. * // => 0
  24905. *
  24906. * // The `_.property` iteratee shorthand.
  24907. * _.findIndex(users, 'active');
  24908. * // => 2
  24909. */
  24910. function findIndex(array, predicate, fromIndex) {
  24911. var length = array == null ? 0 : array.length;
  24912. if (!length) {
  24913. return -1;
  24914. }
  24915. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24916. if (index < 0) {
  24917. index = nativeMax(length + index, 0);
  24918. }
  24919. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24920. }
  24921. /**
  24922. * This method is like `_.findIndex` except that it iterates over elements
  24923. * of `collection` from right to left.
  24924. *
  24925. * @static
  24926. * @memberOf _
  24927. * @since 2.0.0
  24928. * @category Array
  24929. * @param {Array} array The array to inspect.
  24930. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24931. * @param {number} [fromIndex=array.length-1] The index to search from.
  24932. * @returns {number} Returns the index of the found element, else `-1`.
  24933. * @example
  24934. *
  24935. * var users = [
  24936. * { 'user': 'barney', 'active': true },
  24937. * { 'user': 'fred', 'active': false },
  24938. * { 'user': 'pebbles', 'active': false }
  24939. * ];
  24940. *
  24941. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24942. * // => 2
  24943. *
  24944. * // The `_.matches` iteratee shorthand.
  24945. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24946. * // => 0
  24947. *
  24948. * // The `_.matchesProperty` iteratee shorthand.
  24949. * _.findLastIndex(users, ['active', false]);
  24950. * // => 2
  24951. *
  24952. * // The `_.property` iteratee shorthand.
  24953. * _.findLastIndex(users, 'active');
  24954. * // => 0
  24955. */
  24956. function findLastIndex(array, predicate, fromIndex) {
  24957. var length = array == null ? 0 : array.length;
  24958. if (!length) {
  24959. return -1;
  24960. }
  24961. var index = length - 1;
  24962. if (fromIndex !== undefined) {
  24963. index = toInteger(fromIndex);
  24964. index = fromIndex < 0
  24965. ? nativeMax(length + index, 0)
  24966. : nativeMin(index, length - 1);
  24967. }
  24968. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24969. }
  24970. /**
  24971. * Flattens `array` a single level deep.
  24972. *
  24973. * @static
  24974. * @memberOf _
  24975. * @since 0.1.0
  24976. * @category Array
  24977. * @param {Array} array The array to flatten.
  24978. * @returns {Array} Returns the new flattened array.
  24979. * @example
  24980. *
  24981. * _.flatten([1, [2, [3, [4]], 5]]);
  24982. * // => [1, 2, [3, [4]], 5]
  24983. */
  24984. function flatten(array) {
  24985. var length = array == null ? 0 : array.length;
  24986. return length ? baseFlatten(array, 1) : [];
  24987. }
  24988. /**
  24989. * Recursively flattens `array`.
  24990. *
  24991. * @static
  24992. * @memberOf _
  24993. * @since 3.0.0
  24994. * @category Array
  24995. * @param {Array} array The array to flatten.
  24996. * @returns {Array} Returns the new flattened array.
  24997. * @example
  24998. *
  24999. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25000. * // => [1, 2, 3, 4, 5]
  25001. */
  25002. function flattenDeep(array) {
  25003. var length = array == null ? 0 : array.length;
  25004. return length ? baseFlatten(array, INFINITY) : [];
  25005. }
  25006. /**
  25007. * Recursively flatten `array` up to `depth` times.
  25008. *
  25009. * @static
  25010. * @memberOf _
  25011. * @since 4.4.0
  25012. * @category Array
  25013. * @param {Array} array The array to flatten.
  25014. * @param {number} [depth=1] The maximum recursion depth.
  25015. * @returns {Array} Returns the new flattened array.
  25016. * @example
  25017. *
  25018. * var array = [1, [2, [3, [4]], 5]];
  25019. *
  25020. * _.flattenDepth(array, 1);
  25021. * // => [1, 2, [3, [4]], 5]
  25022. *
  25023. * _.flattenDepth(array, 2);
  25024. * // => [1, 2, 3, [4], 5]
  25025. */
  25026. function flattenDepth(array, depth) {
  25027. var length = array == null ? 0 : array.length;
  25028. if (!length) {
  25029. return [];
  25030. }
  25031. depth = depth === undefined ? 1 : toInteger(depth);
  25032. return baseFlatten(array, depth);
  25033. }
  25034. /**
  25035. * The inverse of `_.toPairs`; this method returns an object composed
  25036. * from key-value `pairs`.
  25037. *
  25038. * @static
  25039. * @memberOf _
  25040. * @since 4.0.0
  25041. * @category Array
  25042. * @param {Array} pairs The key-value pairs.
  25043. * @returns {Object} Returns the new object.
  25044. * @example
  25045. *
  25046. * _.fromPairs([['a', 1], ['b', 2]]);
  25047. * // => { 'a': 1, 'b': 2 }
  25048. */
  25049. function fromPairs(pairs) {
  25050. var index = -1,
  25051. length = pairs == null ? 0 : pairs.length,
  25052. result = {};
  25053. while (++index < length) {
  25054. var pair = pairs[index];
  25055. result[pair[0]] = pair[1];
  25056. }
  25057. return result;
  25058. }
  25059. /**
  25060. * Gets the first element of `array`.
  25061. *
  25062. * @static
  25063. * @memberOf _
  25064. * @since 0.1.0
  25065. * @alias first
  25066. * @category Array
  25067. * @param {Array} array The array to query.
  25068. * @returns {*} Returns the first element of `array`.
  25069. * @example
  25070. *
  25071. * _.head([1, 2, 3]);
  25072. * // => 1
  25073. *
  25074. * _.head([]);
  25075. * // => undefined
  25076. */
  25077. function head(array) {
  25078. return (array && array.length) ? array[0] : undefined;
  25079. }
  25080. /**
  25081. * Gets the index at which the first occurrence of `value` is found in `array`
  25082. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25083. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25084. * offset from the end of `array`.
  25085. *
  25086. * @static
  25087. * @memberOf _
  25088. * @since 0.1.0
  25089. * @category Array
  25090. * @param {Array} array The array to inspect.
  25091. * @param {*} value The value to search for.
  25092. * @param {number} [fromIndex=0] The index to search from.
  25093. * @returns {number} Returns the index of the matched value, else `-1`.
  25094. * @example
  25095. *
  25096. * _.indexOf([1, 2, 1, 2], 2);
  25097. * // => 1
  25098. *
  25099. * // Search from the `fromIndex`.
  25100. * _.indexOf([1, 2, 1, 2], 2, 2);
  25101. * // => 3
  25102. */
  25103. function indexOf(array, value, fromIndex) {
  25104. var length = array == null ? 0 : array.length;
  25105. if (!length) {
  25106. return -1;
  25107. }
  25108. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25109. if (index < 0) {
  25110. index = nativeMax(length + index, 0);
  25111. }
  25112. return baseIndexOf(array, value, index);
  25113. }
  25114. /**
  25115. * Gets all but the last element of `array`.
  25116. *
  25117. * @static
  25118. * @memberOf _
  25119. * @since 0.1.0
  25120. * @category Array
  25121. * @param {Array} array The array to query.
  25122. * @returns {Array} Returns the slice of `array`.
  25123. * @example
  25124. *
  25125. * _.initial([1, 2, 3]);
  25126. * // => [1, 2]
  25127. */
  25128. function initial(array) {
  25129. var length = array == null ? 0 : array.length;
  25130. return length ? baseSlice(array, 0, -1) : [];
  25131. }
  25132. /**
  25133. * Creates an array of unique values that are included in all given arrays
  25134. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25135. * for equality comparisons. The order and references of result values are
  25136. * determined by the first array.
  25137. *
  25138. * @static
  25139. * @memberOf _
  25140. * @since 0.1.0
  25141. * @category Array
  25142. * @param {...Array} [arrays] The arrays to inspect.
  25143. * @returns {Array} Returns the new array of intersecting values.
  25144. * @example
  25145. *
  25146. * _.intersection([2, 1], [2, 3]);
  25147. * // => [2]
  25148. */
  25149. var intersection = baseRest(function(arrays) {
  25150. var mapped = arrayMap(arrays, castArrayLikeObject);
  25151. return (mapped.length && mapped[0] === arrays[0])
  25152. ? baseIntersection(mapped)
  25153. : [];
  25154. });
  25155. /**
  25156. * This method is like `_.intersection` except that it accepts `iteratee`
  25157. * which is invoked for each element of each `arrays` to generate the criterion
  25158. * by which they're compared. The order and references of result values are
  25159. * determined by the first array. The iteratee is invoked with one argument:
  25160. * (value).
  25161. *
  25162. * @static
  25163. * @memberOf _
  25164. * @since 4.0.0
  25165. * @category Array
  25166. * @param {...Array} [arrays] The arrays to inspect.
  25167. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25168. * @returns {Array} Returns the new array of intersecting values.
  25169. * @example
  25170. *
  25171. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25172. * // => [2.1]
  25173. *
  25174. * // The `_.property` iteratee shorthand.
  25175. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25176. * // => [{ 'x': 1 }]
  25177. */
  25178. var intersectionBy = baseRest(function(arrays) {
  25179. var iteratee = last(arrays),
  25180. mapped = arrayMap(arrays, castArrayLikeObject);
  25181. if (iteratee === last(mapped)) {
  25182. iteratee = undefined;
  25183. } else {
  25184. mapped.pop();
  25185. }
  25186. return (mapped.length && mapped[0] === arrays[0])
  25187. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25188. : [];
  25189. });
  25190. /**
  25191. * This method is like `_.intersection` except that it accepts `comparator`
  25192. * which is invoked to compare elements of `arrays`. The order and references
  25193. * of result values are determined by the first array. The comparator is
  25194. * invoked with two arguments: (arrVal, othVal).
  25195. *
  25196. * @static
  25197. * @memberOf _
  25198. * @since 4.0.0
  25199. * @category Array
  25200. * @param {...Array} [arrays] The arrays to inspect.
  25201. * @param {Function} [comparator] The comparator invoked per element.
  25202. * @returns {Array} Returns the new array of intersecting values.
  25203. * @example
  25204. *
  25205. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25206. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25207. *
  25208. * _.intersectionWith(objects, others, _.isEqual);
  25209. * // => [{ 'x': 1, 'y': 2 }]
  25210. */
  25211. var intersectionWith = baseRest(function(arrays) {
  25212. var comparator = last(arrays),
  25213. mapped = arrayMap(arrays, castArrayLikeObject);
  25214. comparator = typeof comparator == 'function' ? comparator : undefined;
  25215. if (comparator) {
  25216. mapped.pop();
  25217. }
  25218. return (mapped.length && mapped[0] === arrays[0])
  25219. ? baseIntersection(mapped, undefined, comparator)
  25220. : [];
  25221. });
  25222. /**
  25223. * Converts all elements in `array` into a string separated by `separator`.
  25224. *
  25225. * @static
  25226. * @memberOf _
  25227. * @since 4.0.0
  25228. * @category Array
  25229. * @param {Array} array The array to convert.
  25230. * @param {string} [separator=','] The element separator.
  25231. * @returns {string} Returns the joined string.
  25232. * @example
  25233. *
  25234. * _.join(['a', 'b', 'c'], '~');
  25235. * // => 'a~b~c'
  25236. */
  25237. function join(array, separator) {
  25238. return array == null ? '' : nativeJoin.call(array, separator);
  25239. }
  25240. /**
  25241. * Gets the last element of `array`.
  25242. *
  25243. * @static
  25244. * @memberOf _
  25245. * @since 0.1.0
  25246. * @category Array
  25247. * @param {Array} array The array to query.
  25248. * @returns {*} Returns the last element of `array`.
  25249. * @example
  25250. *
  25251. * _.last([1, 2, 3]);
  25252. * // => 3
  25253. */
  25254. function last(array) {
  25255. var length = array == null ? 0 : array.length;
  25256. return length ? array[length - 1] : undefined;
  25257. }
  25258. /**
  25259. * This method is like `_.indexOf` except that it iterates over elements of
  25260. * `array` from right to left.
  25261. *
  25262. * @static
  25263. * @memberOf _
  25264. * @since 0.1.0
  25265. * @category Array
  25266. * @param {Array} array The array to inspect.
  25267. * @param {*} value The value to search for.
  25268. * @param {number} [fromIndex=array.length-1] The index to search from.
  25269. * @returns {number} Returns the index of the matched value, else `-1`.
  25270. * @example
  25271. *
  25272. * _.lastIndexOf([1, 2, 1, 2], 2);
  25273. * // => 3
  25274. *
  25275. * // Search from the `fromIndex`.
  25276. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25277. * // => 1
  25278. */
  25279. function lastIndexOf(array, value, fromIndex) {
  25280. var length = array == null ? 0 : array.length;
  25281. if (!length) {
  25282. return -1;
  25283. }
  25284. var index = length;
  25285. if (fromIndex !== undefined) {
  25286. index = toInteger(fromIndex);
  25287. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25288. }
  25289. return value === value
  25290. ? strictLastIndexOf(array, value, index)
  25291. : baseFindIndex(array, baseIsNaN, index, true);
  25292. }
  25293. /**
  25294. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25295. * element from the end is returned.
  25296. *
  25297. * @static
  25298. * @memberOf _
  25299. * @since 4.11.0
  25300. * @category Array
  25301. * @param {Array} array The array to query.
  25302. * @param {number} [n=0] The index of the element to return.
  25303. * @returns {*} Returns the nth element of `array`.
  25304. * @example
  25305. *
  25306. * var array = ['a', 'b', 'c', 'd'];
  25307. *
  25308. * _.nth(array, 1);
  25309. * // => 'b'
  25310. *
  25311. * _.nth(array, -2);
  25312. * // => 'c';
  25313. */
  25314. function nth(array, n) {
  25315. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25316. }
  25317. /**
  25318. * Removes all given values from `array` using
  25319. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25320. * for equality comparisons.
  25321. *
  25322. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25323. * to remove elements from an array by predicate.
  25324. *
  25325. * @static
  25326. * @memberOf _
  25327. * @since 2.0.0
  25328. * @category Array
  25329. * @param {Array} array The array to modify.
  25330. * @param {...*} [values] The values to remove.
  25331. * @returns {Array} Returns `array`.
  25332. * @example
  25333. *
  25334. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25335. *
  25336. * _.pull(array, 'a', 'c');
  25337. * console.log(array);
  25338. * // => ['b', 'b']
  25339. */
  25340. var pull = baseRest(pullAll);
  25341. /**
  25342. * This method is like `_.pull` except that it accepts an array of values to remove.
  25343. *
  25344. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25345. *
  25346. * @static
  25347. * @memberOf _
  25348. * @since 4.0.0
  25349. * @category Array
  25350. * @param {Array} array The array to modify.
  25351. * @param {Array} values The values to remove.
  25352. * @returns {Array} Returns `array`.
  25353. * @example
  25354. *
  25355. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25356. *
  25357. * _.pullAll(array, ['a', 'c']);
  25358. * console.log(array);
  25359. * // => ['b', 'b']
  25360. */
  25361. function pullAll(array, values) {
  25362. return (array && array.length && values && values.length)
  25363. ? basePullAll(array, values)
  25364. : array;
  25365. }
  25366. /**
  25367. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25368. * invoked for each element of `array` and `values` to generate the criterion
  25369. * by which they're compared. The iteratee is invoked with one argument: (value).
  25370. *
  25371. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25372. *
  25373. * @static
  25374. * @memberOf _
  25375. * @since 4.0.0
  25376. * @category Array
  25377. * @param {Array} array The array to modify.
  25378. * @param {Array} values The values to remove.
  25379. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25380. * @returns {Array} Returns `array`.
  25381. * @example
  25382. *
  25383. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25384. *
  25385. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25386. * console.log(array);
  25387. * // => [{ 'x': 2 }]
  25388. */
  25389. function pullAllBy(array, values, iteratee) {
  25390. return (array && array.length && values && values.length)
  25391. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25392. : array;
  25393. }
  25394. /**
  25395. * This method is like `_.pullAll` except that it accepts `comparator` which
  25396. * is invoked to compare elements of `array` to `values`. The comparator is
  25397. * invoked with two arguments: (arrVal, othVal).
  25398. *
  25399. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25400. *
  25401. * @static
  25402. * @memberOf _
  25403. * @since 4.6.0
  25404. * @category Array
  25405. * @param {Array} array The array to modify.
  25406. * @param {Array} values The values to remove.
  25407. * @param {Function} [comparator] The comparator invoked per element.
  25408. * @returns {Array} Returns `array`.
  25409. * @example
  25410. *
  25411. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25412. *
  25413. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25414. * console.log(array);
  25415. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25416. */
  25417. function pullAllWith(array, values, comparator) {
  25418. return (array && array.length && values && values.length)
  25419. ? basePullAll(array, values, undefined, comparator)
  25420. : array;
  25421. }
  25422. /**
  25423. * Removes elements from `array` corresponding to `indexes` and returns an
  25424. * array of removed elements.
  25425. *
  25426. * **Note:** Unlike `_.at`, this method mutates `array`.
  25427. *
  25428. * @static
  25429. * @memberOf _
  25430. * @since 3.0.0
  25431. * @category Array
  25432. * @param {Array} array The array to modify.
  25433. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25434. * @returns {Array} Returns the new array of removed elements.
  25435. * @example
  25436. *
  25437. * var array = ['a', 'b', 'c', 'd'];
  25438. * var pulled = _.pullAt(array, [1, 3]);
  25439. *
  25440. * console.log(array);
  25441. * // => ['a', 'c']
  25442. *
  25443. * console.log(pulled);
  25444. * // => ['b', 'd']
  25445. */
  25446. var pullAt = flatRest(function(array, indexes) {
  25447. var length = array == null ? 0 : array.length,
  25448. result = baseAt(array, indexes);
  25449. basePullAt(array, arrayMap(indexes, function(index) {
  25450. return isIndex(index, length) ? +index : index;
  25451. }).sort(compareAscending));
  25452. return result;
  25453. });
  25454. /**
  25455. * Removes all elements from `array` that `predicate` returns truthy for
  25456. * and returns an array of the removed elements. The predicate is invoked
  25457. * with three arguments: (value, index, array).
  25458. *
  25459. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25460. * to pull elements from an array by value.
  25461. *
  25462. * @static
  25463. * @memberOf _
  25464. * @since 2.0.0
  25465. * @category Array
  25466. * @param {Array} array The array to modify.
  25467. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25468. * @returns {Array} Returns the new array of removed elements.
  25469. * @example
  25470. *
  25471. * var array = [1, 2, 3, 4];
  25472. * var evens = _.remove(array, function(n) {
  25473. * return n % 2 == 0;
  25474. * });
  25475. *
  25476. * console.log(array);
  25477. * // => [1, 3]
  25478. *
  25479. * console.log(evens);
  25480. * // => [2, 4]
  25481. */
  25482. function remove(array, predicate) {
  25483. var result = [];
  25484. if (!(array && array.length)) {
  25485. return result;
  25486. }
  25487. var index = -1,
  25488. indexes = [],
  25489. length = array.length;
  25490. predicate = getIteratee(predicate, 3);
  25491. while (++index < length) {
  25492. var value = array[index];
  25493. if (predicate(value, index, array)) {
  25494. result.push(value);
  25495. indexes.push(index);
  25496. }
  25497. }
  25498. basePullAt(array, indexes);
  25499. return result;
  25500. }
  25501. /**
  25502. * Reverses `array` so that the first element becomes the last, the second
  25503. * element becomes the second to last, and so on.
  25504. *
  25505. * **Note:** This method mutates `array` and is based on
  25506. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25507. *
  25508. * @static
  25509. * @memberOf _
  25510. * @since 4.0.0
  25511. * @category Array
  25512. * @param {Array} array The array to modify.
  25513. * @returns {Array} Returns `array`.
  25514. * @example
  25515. *
  25516. * var array = [1, 2, 3];
  25517. *
  25518. * _.reverse(array);
  25519. * // => [3, 2, 1]
  25520. *
  25521. * console.log(array);
  25522. * // => [3, 2, 1]
  25523. */
  25524. function reverse(array) {
  25525. return array == null ? array : nativeReverse.call(array);
  25526. }
  25527. /**
  25528. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25529. *
  25530. * **Note:** This method is used instead of
  25531. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25532. * returned.
  25533. *
  25534. * @static
  25535. * @memberOf _
  25536. * @since 3.0.0
  25537. * @category Array
  25538. * @param {Array} array The array to slice.
  25539. * @param {number} [start=0] The start position.
  25540. * @param {number} [end=array.length] The end position.
  25541. * @returns {Array} Returns the slice of `array`.
  25542. */
  25543. function slice(array, start, end) {
  25544. var length = array == null ? 0 : array.length;
  25545. if (!length) {
  25546. return [];
  25547. }
  25548. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25549. start = 0;
  25550. end = length;
  25551. }
  25552. else {
  25553. start = start == null ? 0 : toInteger(start);
  25554. end = end === undefined ? length : toInteger(end);
  25555. }
  25556. return baseSlice(array, start, end);
  25557. }
  25558. /**
  25559. * Uses a binary search to determine the lowest index at which `value`
  25560. * should be inserted into `array` in order to maintain its sort order.
  25561. *
  25562. * @static
  25563. * @memberOf _
  25564. * @since 0.1.0
  25565. * @category Array
  25566. * @param {Array} array The sorted array to inspect.
  25567. * @param {*} value The value to evaluate.
  25568. * @returns {number} Returns the index at which `value` should be inserted
  25569. * into `array`.
  25570. * @example
  25571. *
  25572. * _.sortedIndex([30, 50], 40);
  25573. * // => 1
  25574. */
  25575. function sortedIndex(array, value) {
  25576. return baseSortedIndex(array, value);
  25577. }
  25578. /**
  25579. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25580. * which is invoked for `value` and each element of `array` to compute their
  25581. * sort ranking. The iteratee is invoked with one argument: (value).
  25582. *
  25583. * @static
  25584. * @memberOf _
  25585. * @since 4.0.0
  25586. * @category Array
  25587. * @param {Array} array The sorted array to inspect.
  25588. * @param {*} value The value to evaluate.
  25589. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25590. * @returns {number} Returns the index at which `value` should be inserted
  25591. * into `array`.
  25592. * @example
  25593. *
  25594. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25595. *
  25596. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25597. * // => 0
  25598. *
  25599. * // The `_.property` iteratee shorthand.
  25600. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25601. * // => 0
  25602. */
  25603. function sortedIndexBy(array, value, iteratee) {
  25604. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25605. }
  25606. /**
  25607. * This method is like `_.indexOf` except that it performs a binary
  25608. * search on a sorted `array`.
  25609. *
  25610. * @static
  25611. * @memberOf _
  25612. * @since 4.0.0
  25613. * @category Array
  25614. * @param {Array} array The array to inspect.
  25615. * @param {*} value The value to search for.
  25616. * @returns {number} Returns the index of the matched value, else `-1`.
  25617. * @example
  25618. *
  25619. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25620. * // => 1
  25621. */
  25622. function sortedIndexOf(array, value) {
  25623. var length = array == null ? 0 : array.length;
  25624. if (length) {
  25625. var index = baseSortedIndex(array, value);
  25626. if (index < length && eq(array[index], value)) {
  25627. return index;
  25628. }
  25629. }
  25630. return -1;
  25631. }
  25632. /**
  25633. * This method is like `_.sortedIndex` except that it returns the highest
  25634. * index at which `value` should be inserted into `array` in order to
  25635. * maintain its sort order.
  25636. *
  25637. * @static
  25638. * @memberOf _
  25639. * @since 3.0.0
  25640. * @category Array
  25641. * @param {Array} array The sorted array to inspect.
  25642. * @param {*} value The value to evaluate.
  25643. * @returns {number} Returns the index at which `value` should be inserted
  25644. * into `array`.
  25645. * @example
  25646. *
  25647. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25648. * // => 4
  25649. */
  25650. function sortedLastIndex(array, value) {
  25651. return baseSortedIndex(array, value, true);
  25652. }
  25653. /**
  25654. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25655. * which is invoked for `value` and each element of `array` to compute their
  25656. * sort ranking. The iteratee is invoked with one argument: (value).
  25657. *
  25658. * @static
  25659. * @memberOf _
  25660. * @since 4.0.0
  25661. * @category Array
  25662. * @param {Array} array The sorted array to inspect.
  25663. * @param {*} value The value to evaluate.
  25664. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25665. * @returns {number} Returns the index at which `value` should be inserted
  25666. * into `array`.
  25667. * @example
  25668. *
  25669. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25670. *
  25671. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25672. * // => 1
  25673. *
  25674. * // The `_.property` iteratee shorthand.
  25675. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25676. * // => 1
  25677. */
  25678. function sortedLastIndexBy(array, value, iteratee) {
  25679. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25680. }
  25681. /**
  25682. * This method is like `_.lastIndexOf` except that it performs a binary
  25683. * search on a sorted `array`.
  25684. *
  25685. * @static
  25686. * @memberOf _
  25687. * @since 4.0.0
  25688. * @category Array
  25689. * @param {Array} array The array to inspect.
  25690. * @param {*} value The value to search for.
  25691. * @returns {number} Returns the index of the matched value, else `-1`.
  25692. * @example
  25693. *
  25694. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25695. * // => 3
  25696. */
  25697. function sortedLastIndexOf(array, value) {
  25698. var length = array == null ? 0 : array.length;
  25699. if (length) {
  25700. var index = baseSortedIndex(array, value, true) - 1;
  25701. if (eq(array[index], value)) {
  25702. return index;
  25703. }
  25704. }
  25705. return -1;
  25706. }
  25707. /**
  25708. * This method is like `_.uniq` except that it's designed and optimized
  25709. * for sorted arrays.
  25710. *
  25711. * @static
  25712. * @memberOf _
  25713. * @since 4.0.0
  25714. * @category Array
  25715. * @param {Array} array The array to inspect.
  25716. * @returns {Array} Returns the new duplicate free array.
  25717. * @example
  25718. *
  25719. * _.sortedUniq([1, 1, 2]);
  25720. * // => [1, 2]
  25721. */
  25722. function sortedUniq(array) {
  25723. return (array && array.length)
  25724. ? baseSortedUniq(array)
  25725. : [];
  25726. }
  25727. /**
  25728. * This method is like `_.uniqBy` except that it's designed and optimized
  25729. * for sorted arrays.
  25730. *
  25731. * @static
  25732. * @memberOf _
  25733. * @since 4.0.0
  25734. * @category Array
  25735. * @param {Array} array The array to inspect.
  25736. * @param {Function} [iteratee] The iteratee invoked per element.
  25737. * @returns {Array} Returns the new duplicate free array.
  25738. * @example
  25739. *
  25740. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25741. * // => [1.1, 2.3]
  25742. */
  25743. function sortedUniqBy(array, iteratee) {
  25744. return (array && array.length)
  25745. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25746. : [];
  25747. }
  25748. /**
  25749. * Gets all but the first element of `array`.
  25750. *
  25751. * @static
  25752. * @memberOf _
  25753. * @since 4.0.0
  25754. * @category Array
  25755. * @param {Array} array The array to query.
  25756. * @returns {Array} Returns the slice of `array`.
  25757. * @example
  25758. *
  25759. * _.tail([1, 2, 3]);
  25760. * // => [2, 3]
  25761. */
  25762. function tail(array) {
  25763. var length = array == null ? 0 : array.length;
  25764. return length ? baseSlice(array, 1, length) : [];
  25765. }
  25766. /**
  25767. * Creates a slice of `array` with `n` elements taken from the beginning.
  25768. *
  25769. * @static
  25770. * @memberOf _
  25771. * @since 0.1.0
  25772. * @category Array
  25773. * @param {Array} array The array to query.
  25774. * @param {number} [n=1] The number of elements to take.
  25775. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25776. * @returns {Array} Returns the slice of `array`.
  25777. * @example
  25778. *
  25779. * _.take([1, 2, 3]);
  25780. * // => [1]
  25781. *
  25782. * _.take([1, 2, 3], 2);
  25783. * // => [1, 2]
  25784. *
  25785. * _.take([1, 2, 3], 5);
  25786. * // => [1, 2, 3]
  25787. *
  25788. * _.take([1, 2, 3], 0);
  25789. * // => []
  25790. */
  25791. function take(array, n, guard) {
  25792. if (!(array && array.length)) {
  25793. return [];
  25794. }
  25795. n = (guard || n === undefined) ? 1 : toInteger(n);
  25796. return baseSlice(array, 0, n < 0 ? 0 : n);
  25797. }
  25798. /**
  25799. * Creates a slice of `array` with `n` elements taken from the end.
  25800. *
  25801. * @static
  25802. * @memberOf _
  25803. * @since 3.0.0
  25804. * @category Array
  25805. * @param {Array} array The array to query.
  25806. * @param {number} [n=1] The number of elements to take.
  25807. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25808. * @returns {Array} Returns the slice of `array`.
  25809. * @example
  25810. *
  25811. * _.takeRight([1, 2, 3]);
  25812. * // => [3]
  25813. *
  25814. * _.takeRight([1, 2, 3], 2);
  25815. * // => [2, 3]
  25816. *
  25817. * _.takeRight([1, 2, 3], 5);
  25818. * // => [1, 2, 3]
  25819. *
  25820. * _.takeRight([1, 2, 3], 0);
  25821. * // => []
  25822. */
  25823. function takeRight(array, n, guard) {
  25824. var length = array == null ? 0 : array.length;
  25825. if (!length) {
  25826. return [];
  25827. }
  25828. n = (guard || n === undefined) ? 1 : toInteger(n);
  25829. n = length - n;
  25830. return baseSlice(array, n < 0 ? 0 : n, length);
  25831. }
  25832. /**
  25833. * Creates a slice of `array` with elements taken from the end. Elements are
  25834. * taken until `predicate` returns falsey. The predicate is invoked with
  25835. * three arguments: (value, index, array).
  25836. *
  25837. * @static
  25838. * @memberOf _
  25839. * @since 3.0.0
  25840. * @category Array
  25841. * @param {Array} array The array to query.
  25842. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25843. * @returns {Array} Returns the slice of `array`.
  25844. * @example
  25845. *
  25846. * var users = [
  25847. * { 'user': 'barney', 'active': true },
  25848. * { 'user': 'fred', 'active': false },
  25849. * { 'user': 'pebbles', 'active': false }
  25850. * ];
  25851. *
  25852. * _.takeRightWhile(users, function(o) { return !o.active; });
  25853. * // => objects for ['fred', 'pebbles']
  25854. *
  25855. * // The `_.matches` iteratee shorthand.
  25856. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25857. * // => objects for ['pebbles']
  25858. *
  25859. * // The `_.matchesProperty` iteratee shorthand.
  25860. * _.takeRightWhile(users, ['active', false]);
  25861. * // => objects for ['fred', 'pebbles']
  25862. *
  25863. * // The `_.property` iteratee shorthand.
  25864. * _.takeRightWhile(users, 'active');
  25865. * // => []
  25866. */
  25867. function takeRightWhile(array, predicate) {
  25868. return (array && array.length)
  25869. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25870. : [];
  25871. }
  25872. /**
  25873. * Creates a slice of `array` with elements taken from the beginning. Elements
  25874. * are taken until `predicate` returns falsey. The predicate is invoked with
  25875. * three arguments: (value, index, array).
  25876. *
  25877. * @static
  25878. * @memberOf _
  25879. * @since 3.0.0
  25880. * @category Array
  25881. * @param {Array} array The array to query.
  25882. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25883. * @returns {Array} Returns the slice of `array`.
  25884. * @example
  25885. *
  25886. * var users = [
  25887. * { 'user': 'barney', 'active': false },
  25888. * { 'user': 'fred', 'active': false },
  25889. * { 'user': 'pebbles', 'active': true }
  25890. * ];
  25891. *
  25892. * _.takeWhile(users, function(o) { return !o.active; });
  25893. * // => objects for ['barney', 'fred']
  25894. *
  25895. * // The `_.matches` iteratee shorthand.
  25896. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25897. * // => objects for ['barney']
  25898. *
  25899. * // The `_.matchesProperty` iteratee shorthand.
  25900. * _.takeWhile(users, ['active', false]);
  25901. * // => objects for ['barney', 'fred']
  25902. *
  25903. * // The `_.property` iteratee shorthand.
  25904. * _.takeWhile(users, 'active');
  25905. * // => []
  25906. */
  25907. function takeWhile(array, predicate) {
  25908. return (array && array.length)
  25909. ? baseWhile(array, getIteratee(predicate, 3))
  25910. : [];
  25911. }
  25912. /**
  25913. * Creates an array of unique values, in order, from all given arrays using
  25914. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25915. * for equality comparisons.
  25916. *
  25917. * @static
  25918. * @memberOf _
  25919. * @since 0.1.0
  25920. * @category Array
  25921. * @param {...Array} [arrays] The arrays to inspect.
  25922. * @returns {Array} Returns the new array of combined values.
  25923. * @example
  25924. *
  25925. * _.union([2], [1, 2]);
  25926. * // => [2, 1]
  25927. */
  25928. var union = baseRest(function(arrays) {
  25929. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25930. });
  25931. /**
  25932. * This method is like `_.union` except that it accepts `iteratee` which is
  25933. * invoked for each element of each `arrays` to generate the criterion by
  25934. * which uniqueness is computed. Result values are chosen from the first
  25935. * array in which the value occurs. The iteratee is invoked with one argument:
  25936. * (value).
  25937. *
  25938. * @static
  25939. * @memberOf _
  25940. * @since 4.0.0
  25941. * @category Array
  25942. * @param {...Array} [arrays] The arrays to inspect.
  25943. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25944. * @returns {Array} Returns the new array of combined values.
  25945. * @example
  25946. *
  25947. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25948. * // => [2.1, 1.2]
  25949. *
  25950. * // The `_.property` iteratee shorthand.
  25951. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25952. * // => [{ 'x': 1 }, { 'x': 2 }]
  25953. */
  25954. var unionBy = baseRest(function(arrays) {
  25955. var iteratee = last(arrays);
  25956. if (isArrayLikeObject(iteratee)) {
  25957. iteratee = undefined;
  25958. }
  25959. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25960. });
  25961. /**
  25962. * This method is like `_.union` except that it accepts `comparator` which
  25963. * is invoked to compare elements of `arrays`. Result values are chosen from
  25964. * the first array in which the value occurs. The comparator is invoked
  25965. * with two arguments: (arrVal, othVal).
  25966. *
  25967. * @static
  25968. * @memberOf _
  25969. * @since 4.0.0
  25970. * @category Array
  25971. * @param {...Array} [arrays] The arrays to inspect.
  25972. * @param {Function} [comparator] The comparator invoked per element.
  25973. * @returns {Array} Returns the new array of combined values.
  25974. * @example
  25975. *
  25976. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25977. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25978. *
  25979. * _.unionWith(objects, others, _.isEqual);
  25980. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25981. */
  25982. var unionWith = baseRest(function(arrays) {
  25983. var comparator = last(arrays);
  25984. comparator = typeof comparator == 'function' ? comparator : undefined;
  25985. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  25986. });
  25987. /**
  25988. * Creates a duplicate-free version of an array, using
  25989. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25990. * for equality comparisons, in which only the first occurrence of each element
  25991. * is kept. The order of result values is determined by the order they occur
  25992. * in the array.
  25993. *
  25994. * @static
  25995. * @memberOf _
  25996. * @since 0.1.0
  25997. * @category Array
  25998. * @param {Array} array The array to inspect.
  25999. * @returns {Array} Returns the new duplicate free array.
  26000. * @example
  26001. *
  26002. * _.uniq([2, 1, 2]);
  26003. * // => [2, 1]
  26004. */
  26005. function uniq(array) {
  26006. return (array && array.length) ? baseUniq(array) : [];
  26007. }
  26008. /**
  26009. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26010. * invoked for each element in `array` to generate the criterion by which
  26011. * uniqueness is computed. The order of result values is determined by the
  26012. * order they occur in the array. The iteratee is invoked with one argument:
  26013. * (value).
  26014. *
  26015. * @static
  26016. * @memberOf _
  26017. * @since 4.0.0
  26018. * @category Array
  26019. * @param {Array} array The array to inspect.
  26020. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26021. * @returns {Array} Returns the new duplicate free array.
  26022. * @example
  26023. *
  26024. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26025. * // => [2.1, 1.2]
  26026. *
  26027. * // The `_.property` iteratee shorthand.
  26028. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26029. * // => [{ 'x': 1 }, { 'x': 2 }]
  26030. */
  26031. function uniqBy(array, iteratee) {
  26032. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26033. }
  26034. /**
  26035. * This method is like `_.uniq` except that it accepts `comparator` which
  26036. * is invoked to compare elements of `array`. The order of result values is
  26037. * determined by the order they occur in the array.The comparator is invoked
  26038. * with two arguments: (arrVal, othVal).
  26039. *
  26040. * @static
  26041. * @memberOf _
  26042. * @since 4.0.0
  26043. * @category Array
  26044. * @param {Array} array The array to inspect.
  26045. * @param {Function} [comparator] The comparator invoked per element.
  26046. * @returns {Array} Returns the new duplicate free array.
  26047. * @example
  26048. *
  26049. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26050. *
  26051. * _.uniqWith(objects, _.isEqual);
  26052. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26053. */
  26054. function uniqWith(array, comparator) {
  26055. comparator = typeof comparator == 'function' ? comparator : undefined;
  26056. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26057. }
  26058. /**
  26059. * This method is like `_.zip` except that it accepts an array of grouped
  26060. * elements and creates an array regrouping the elements to their pre-zip
  26061. * configuration.
  26062. *
  26063. * @static
  26064. * @memberOf _
  26065. * @since 1.2.0
  26066. * @category Array
  26067. * @param {Array} array The array of grouped elements to process.
  26068. * @returns {Array} Returns the new array of regrouped elements.
  26069. * @example
  26070. *
  26071. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26072. * // => [['a', 1, true], ['b', 2, false]]
  26073. *
  26074. * _.unzip(zipped);
  26075. * // => [['a', 'b'], [1, 2], [true, false]]
  26076. */
  26077. function unzip(array) {
  26078. if (!(array && array.length)) {
  26079. return [];
  26080. }
  26081. var length = 0;
  26082. array = arrayFilter(array, function(group) {
  26083. if (isArrayLikeObject(group)) {
  26084. length = nativeMax(group.length, length);
  26085. return true;
  26086. }
  26087. });
  26088. return baseTimes(length, function(index) {
  26089. return arrayMap(array, baseProperty(index));
  26090. });
  26091. }
  26092. /**
  26093. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26094. * how regrouped values should be combined. The iteratee is invoked with the
  26095. * elements of each group: (...group).
  26096. *
  26097. * @static
  26098. * @memberOf _
  26099. * @since 3.8.0
  26100. * @category Array
  26101. * @param {Array} array The array of grouped elements to process.
  26102. * @param {Function} [iteratee=_.identity] The function to combine
  26103. * regrouped values.
  26104. * @returns {Array} Returns the new array of regrouped elements.
  26105. * @example
  26106. *
  26107. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26108. * // => [[1, 10, 100], [2, 20, 200]]
  26109. *
  26110. * _.unzipWith(zipped, _.add);
  26111. * // => [3, 30, 300]
  26112. */
  26113. function unzipWith(array, iteratee) {
  26114. if (!(array && array.length)) {
  26115. return [];
  26116. }
  26117. var result = unzip(array);
  26118. if (iteratee == null) {
  26119. return result;
  26120. }
  26121. return arrayMap(result, function(group) {
  26122. return apply(iteratee, undefined, group);
  26123. });
  26124. }
  26125. /**
  26126. * Creates an array excluding all given values using
  26127. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26128. * for equality comparisons.
  26129. *
  26130. * **Note:** Unlike `_.pull`, this method returns a new array.
  26131. *
  26132. * @static
  26133. * @memberOf _
  26134. * @since 0.1.0
  26135. * @category Array
  26136. * @param {Array} array The array to inspect.
  26137. * @param {...*} [values] The values to exclude.
  26138. * @returns {Array} Returns the new array of filtered values.
  26139. * @see _.difference, _.xor
  26140. * @example
  26141. *
  26142. * _.without([2, 1, 2, 3], 1, 2);
  26143. * // => [3]
  26144. */
  26145. var without = baseRest(function(array, values) {
  26146. return isArrayLikeObject(array)
  26147. ? baseDifference(array, values)
  26148. : [];
  26149. });
  26150. /**
  26151. * Creates an array of unique values that is the
  26152. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26153. * of the given arrays. The order of result values is determined by the order
  26154. * they occur in the arrays.
  26155. *
  26156. * @static
  26157. * @memberOf _
  26158. * @since 2.4.0
  26159. * @category Array
  26160. * @param {...Array} [arrays] The arrays to inspect.
  26161. * @returns {Array} Returns the new array of filtered values.
  26162. * @see _.difference, _.without
  26163. * @example
  26164. *
  26165. * _.xor([2, 1], [2, 3]);
  26166. * // => [1, 3]
  26167. */
  26168. var xor = baseRest(function(arrays) {
  26169. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26170. });
  26171. /**
  26172. * This method is like `_.xor` except that it accepts `iteratee` which is
  26173. * invoked for each element of each `arrays` to generate the criterion by
  26174. * which by which they're compared. The order of result values is determined
  26175. * by the order they occur in the arrays. The iteratee is invoked with one
  26176. * argument: (value).
  26177. *
  26178. * @static
  26179. * @memberOf _
  26180. * @since 4.0.0
  26181. * @category Array
  26182. * @param {...Array} [arrays] The arrays to inspect.
  26183. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26184. * @returns {Array} Returns the new array of filtered values.
  26185. * @example
  26186. *
  26187. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26188. * // => [1.2, 3.4]
  26189. *
  26190. * // The `_.property` iteratee shorthand.
  26191. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26192. * // => [{ 'x': 2 }]
  26193. */
  26194. var xorBy = baseRest(function(arrays) {
  26195. var iteratee = last(arrays);
  26196. if (isArrayLikeObject(iteratee)) {
  26197. iteratee = undefined;
  26198. }
  26199. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26200. });
  26201. /**
  26202. * This method is like `_.xor` except that it accepts `comparator` which is
  26203. * invoked to compare elements of `arrays`. The order of result values is
  26204. * determined by the order they occur in the arrays. The comparator is invoked
  26205. * with two arguments: (arrVal, othVal).
  26206. *
  26207. * @static
  26208. * @memberOf _
  26209. * @since 4.0.0
  26210. * @category Array
  26211. * @param {...Array} [arrays] The arrays to inspect.
  26212. * @param {Function} [comparator] The comparator invoked per element.
  26213. * @returns {Array} Returns the new array of filtered values.
  26214. * @example
  26215. *
  26216. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26217. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26218. *
  26219. * _.xorWith(objects, others, _.isEqual);
  26220. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26221. */
  26222. var xorWith = baseRest(function(arrays) {
  26223. var comparator = last(arrays);
  26224. comparator = typeof comparator == 'function' ? comparator : undefined;
  26225. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26226. });
  26227. /**
  26228. * Creates an array of grouped elements, the first of which contains the
  26229. * first elements of the given arrays, the second of which contains the
  26230. * second elements of the given arrays, and so on.
  26231. *
  26232. * @static
  26233. * @memberOf _
  26234. * @since 0.1.0
  26235. * @category Array
  26236. * @param {...Array} [arrays] The arrays to process.
  26237. * @returns {Array} Returns the new array of grouped elements.
  26238. * @example
  26239. *
  26240. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26241. * // => [['a', 1, true], ['b', 2, false]]
  26242. */
  26243. var zip = baseRest(unzip);
  26244. /**
  26245. * This method is like `_.fromPairs` except that it accepts two arrays,
  26246. * one of property identifiers and one of corresponding values.
  26247. *
  26248. * @static
  26249. * @memberOf _
  26250. * @since 0.4.0
  26251. * @category Array
  26252. * @param {Array} [props=[]] The property identifiers.
  26253. * @param {Array} [values=[]] The property values.
  26254. * @returns {Object} Returns the new object.
  26255. * @example
  26256. *
  26257. * _.zipObject(['a', 'b'], [1, 2]);
  26258. * // => { 'a': 1, 'b': 2 }
  26259. */
  26260. function zipObject(props, values) {
  26261. return baseZipObject(props || [], values || [], assignValue);
  26262. }
  26263. /**
  26264. * This method is like `_.zipObject` except that it supports property paths.
  26265. *
  26266. * @static
  26267. * @memberOf _
  26268. * @since 4.1.0
  26269. * @category Array
  26270. * @param {Array} [props=[]] The property identifiers.
  26271. * @param {Array} [values=[]] The property values.
  26272. * @returns {Object} Returns the new object.
  26273. * @example
  26274. *
  26275. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26276. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26277. */
  26278. function zipObjectDeep(props, values) {
  26279. return baseZipObject(props || [], values || [], baseSet);
  26280. }
  26281. /**
  26282. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26283. * how grouped values should be combined. The iteratee is invoked with the
  26284. * elements of each group: (...group).
  26285. *
  26286. * @static
  26287. * @memberOf _
  26288. * @since 3.8.0
  26289. * @category Array
  26290. * @param {...Array} [arrays] The arrays to process.
  26291. * @param {Function} [iteratee=_.identity] The function to combine
  26292. * grouped values.
  26293. * @returns {Array} Returns the new array of grouped elements.
  26294. * @example
  26295. *
  26296. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26297. * return a + b + c;
  26298. * });
  26299. * // => [111, 222]
  26300. */
  26301. var zipWith = baseRest(function(arrays) {
  26302. var length = arrays.length,
  26303. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26304. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26305. return unzipWith(arrays, iteratee);
  26306. });
  26307. /*------------------------------------------------------------------------*/
  26308. /**
  26309. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26310. * chain sequences enabled. The result of such sequences must be unwrapped
  26311. * with `_#value`.
  26312. *
  26313. * @static
  26314. * @memberOf _
  26315. * @since 1.3.0
  26316. * @category Seq
  26317. * @param {*} value The value to wrap.
  26318. * @returns {Object} Returns the new `lodash` wrapper instance.
  26319. * @example
  26320. *
  26321. * var users = [
  26322. * { 'user': 'barney', 'age': 36 },
  26323. * { 'user': 'fred', 'age': 40 },
  26324. * { 'user': 'pebbles', 'age': 1 }
  26325. * ];
  26326. *
  26327. * var youngest = _
  26328. * .chain(users)
  26329. * .sortBy('age')
  26330. * .map(function(o) {
  26331. * return o.user + ' is ' + o.age;
  26332. * })
  26333. * .head()
  26334. * .value();
  26335. * // => 'pebbles is 1'
  26336. */
  26337. function chain(value) {
  26338. var result = lodash(value);
  26339. result.__chain__ = true;
  26340. return result;
  26341. }
  26342. /**
  26343. * This method invokes `interceptor` and returns `value`. The interceptor
  26344. * is invoked with one argument; (value). The purpose of this method is to
  26345. * "tap into" a method chain sequence in order to modify intermediate results.
  26346. *
  26347. * @static
  26348. * @memberOf _
  26349. * @since 0.1.0
  26350. * @category Seq
  26351. * @param {*} value The value to provide to `interceptor`.
  26352. * @param {Function} interceptor The function to invoke.
  26353. * @returns {*} Returns `value`.
  26354. * @example
  26355. *
  26356. * _([1, 2, 3])
  26357. * .tap(function(array) {
  26358. * // Mutate input array.
  26359. * array.pop();
  26360. * })
  26361. * .reverse()
  26362. * .value();
  26363. * // => [2, 1]
  26364. */
  26365. function tap(value, interceptor) {
  26366. interceptor(value);
  26367. return value;
  26368. }
  26369. /**
  26370. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26371. * The purpose of this method is to "pass thru" values replacing intermediate
  26372. * results in a method chain sequence.
  26373. *
  26374. * @static
  26375. * @memberOf _
  26376. * @since 3.0.0
  26377. * @category Seq
  26378. * @param {*} value The value to provide to `interceptor`.
  26379. * @param {Function} interceptor The function to invoke.
  26380. * @returns {*} Returns the result of `interceptor`.
  26381. * @example
  26382. *
  26383. * _(' abc ')
  26384. * .chain()
  26385. * .trim()
  26386. * .thru(function(value) {
  26387. * return [value];
  26388. * })
  26389. * .value();
  26390. * // => ['abc']
  26391. */
  26392. function thru(value, interceptor) {
  26393. return interceptor(value);
  26394. }
  26395. /**
  26396. * This method is the wrapper version of `_.at`.
  26397. *
  26398. * @name at
  26399. * @memberOf _
  26400. * @since 1.0.0
  26401. * @category Seq
  26402. * @param {...(string|string[])} [paths] The property paths to pick.
  26403. * @returns {Object} Returns the new `lodash` wrapper instance.
  26404. * @example
  26405. *
  26406. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26407. *
  26408. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26409. * // => [3, 4]
  26410. */
  26411. var wrapperAt = flatRest(function(paths) {
  26412. var length = paths.length,
  26413. start = length ? paths[0] : 0,
  26414. value = this.__wrapped__,
  26415. interceptor = function(object) { return baseAt(object, paths); };
  26416. if (length > 1 || this.__actions__.length ||
  26417. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26418. return this.thru(interceptor);
  26419. }
  26420. value = value.slice(start, +start + (length ? 1 : 0));
  26421. value.__actions__.push({
  26422. 'func': thru,
  26423. 'args': [interceptor],
  26424. 'thisArg': undefined
  26425. });
  26426. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26427. if (length && !array.length) {
  26428. array.push(undefined);
  26429. }
  26430. return array;
  26431. });
  26432. });
  26433. /**
  26434. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26435. *
  26436. * @name chain
  26437. * @memberOf _
  26438. * @since 0.1.0
  26439. * @category Seq
  26440. * @returns {Object} Returns the new `lodash` wrapper instance.
  26441. * @example
  26442. *
  26443. * var users = [
  26444. * { 'user': 'barney', 'age': 36 },
  26445. * { 'user': 'fred', 'age': 40 }
  26446. * ];
  26447. *
  26448. * // A sequence without explicit chaining.
  26449. * _(users).head();
  26450. * // => { 'user': 'barney', 'age': 36 }
  26451. *
  26452. * // A sequence with explicit chaining.
  26453. * _(users)
  26454. * .chain()
  26455. * .head()
  26456. * .pick('user')
  26457. * .value();
  26458. * // => { 'user': 'barney' }
  26459. */
  26460. function wrapperChain() {
  26461. return chain(this);
  26462. }
  26463. /**
  26464. * Executes the chain sequence and returns the wrapped result.
  26465. *
  26466. * @name commit
  26467. * @memberOf _
  26468. * @since 3.2.0
  26469. * @category Seq
  26470. * @returns {Object} Returns the new `lodash` wrapper instance.
  26471. * @example
  26472. *
  26473. * var array = [1, 2];
  26474. * var wrapped = _(array).push(3);
  26475. *
  26476. * console.log(array);
  26477. * // => [1, 2]
  26478. *
  26479. * wrapped = wrapped.commit();
  26480. * console.log(array);
  26481. * // => [1, 2, 3]
  26482. *
  26483. * wrapped.last();
  26484. * // => 3
  26485. *
  26486. * console.log(array);
  26487. * // => [1, 2, 3]
  26488. */
  26489. function wrapperCommit() {
  26490. return new LodashWrapper(this.value(), this.__chain__);
  26491. }
  26492. /**
  26493. * Gets the next value on a wrapped object following the
  26494. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26495. *
  26496. * @name next
  26497. * @memberOf _
  26498. * @since 4.0.0
  26499. * @category Seq
  26500. * @returns {Object} Returns the next iterator value.
  26501. * @example
  26502. *
  26503. * var wrapped = _([1, 2]);
  26504. *
  26505. * wrapped.next();
  26506. * // => { 'done': false, 'value': 1 }
  26507. *
  26508. * wrapped.next();
  26509. * // => { 'done': false, 'value': 2 }
  26510. *
  26511. * wrapped.next();
  26512. * // => { 'done': true, 'value': undefined }
  26513. */
  26514. function wrapperNext() {
  26515. if (this.__values__ === undefined) {
  26516. this.__values__ = toArray(this.value());
  26517. }
  26518. var done = this.__index__ >= this.__values__.length,
  26519. value = done ? undefined : this.__values__[this.__index__++];
  26520. return { 'done': done, 'value': value };
  26521. }
  26522. /**
  26523. * Enables the wrapper to be iterable.
  26524. *
  26525. * @name Symbol.iterator
  26526. * @memberOf _
  26527. * @since 4.0.0
  26528. * @category Seq
  26529. * @returns {Object} Returns the wrapper object.
  26530. * @example
  26531. *
  26532. * var wrapped = _([1, 2]);
  26533. *
  26534. * wrapped[Symbol.iterator]() === wrapped;
  26535. * // => true
  26536. *
  26537. * Array.from(wrapped);
  26538. * // => [1, 2]
  26539. */
  26540. function wrapperToIterator() {
  26541. return this;
  26542. }
  26543. /**
  26544. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26545. *
  26546. * @name plant
  26547. * @memberOf _
  26548. * @since 3.2.0
  26549. * @category Seq
  26550. * @param {*} value The value to plant.
  26551. * @returns {Object} Returns the new `lodash` wrapper instance.
  26552. * @example
  26553. *
  26554. * function square(n) {
  26555. * return n * n;
  26556. * }
  26557. *
  26558. * var wrapped = _([1, 2]).map(square);
  26559. * var other = wrapped.plant([3, 4]);
  26560. *
  26561. * other.value();
  26562. * // => [9, 16]
  26563. *
  26564. * wrapped.value();
  26565. * // => [1, 4]
  26566. */
  26567. function wrapperPlant(value) {
  26568. var result,
  26569. parent = this;
  26570. while (parent instanceof baseLodash) {
  26571. var clone = wrapperClone(parent);
  26572. clone.__index__ = 0;
  26573. clone.__values__ = undefined;
  26574. if (result) {
  26575. previous.__wrapped__ = clone;
  26576. } else {
  26577. result = clone;
  26578. }
  26579. var previous = clone;
  26580. parent = parent.__wrapped__;
  26581. }
  26582. previous.__wrapped__ = value;
  26583. return result;
  26584. }
  26585. /**
  26586. * This method is the wrapper version of `_.reverse`.
  26587. *
  26588. * **Note:** This method mutates the wrapped array.
  26589. *
  26590. * @name reverse
  26591. * @memberOf _
  26592. * @since 0.1.0
  26593. * @category Seq
  26594. * @returns {Object} Returns the new `lodash` wrapper instance.
  26595. * @example
  26596. *
  26597. * var array = [1, 2, 3];
  26598. *
  26599. * _(array).reverse().value()
  26600. * // => [3, 2, 1]
  26601. *
  26602. * console.log(array);
  26603. * // => [3, 2, 1]
  26604. */
  26605. function wrapperReverse() {
  26606. var value = this.__wrapped__;
  26607. if (value instanceof LazyWrapper) {
  26608. var wrapped = value;
  26609. if (this.__actions__.length) {
  26610. wrapped = new LazyWrapper(this);
  26611. }
  26612. wrapped = wrapped.reverse();
  26613. wrapped.__actions__.push({
  26614. 'func': thru,
  26615. 'args': [reverse],
  26616. 'thisArg': undefined
  26617. });
  26618. return new LodashWrapper(wrapped, this.__chain__);
  26619. }
  26620. return this.thru(reverse);
  26621. }
  26622. /**
  26623. * Executes the chain sequence to resolve the unwrapped value.
  26624. *
  26625. * @name value
  26626. * @memberOf _
  26627. * @since 0.1.0
  26628. * @alias toJSON, valueOf
  26629. * @category Seq
  26630. * @returns {*} Returns the resolved unwrapped value.
  26631. * @example
  26632. *
  26633. * _([1, 2, 3]).value();
  26634. * // => [1, 2, 3]
  26635. */
  26636. function wrapperValue() {
  26637. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26638. }
  26639. /*------------------------------------------------------------------------*/
  26640. /**
  26641. * Creates an object composed of keys generated from the results of running
  26642. * each element of `collection` thru `iteratee`. The corresponding value of
  26643. * each key is the number of times the key was returned by `iteratee`. The
  26644. * iteratee is invoked with one argument: (value).
  26645. *
  26646. * @static
  26647. * @memberOf _
  26648. * @since 0.5.0
  26649. * @category Collection
  26650. * @param {Array|Object} collection The collection to iterate over.
  26651. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26652. * @returns {Object} Returns the composed aggregate object.
  26653. * @example
  26654. *
  26655. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26656. * // => { '4': 1, '6': 2 }
  26657. *
  26658. * // The `_.property` iteratee shorthand.
  26659. * _.countBy(['one', 'two', 'three'], 'length');
  26660. * // => { '3': 2, '5': 1 }
  26661. */
  26662. var countBy = createAggregator(function(result, value, key) {
  26663. if (hasOwnProperty.call(result, key)) {
  26664. ++result[key];
  26665. } else {
  26666. baseAssignValue(result, key, 1);
  26667. }
  26668. });
  26669. /**
  26670. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26671. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26672. * invoked with three arguments: (value, index|key, collection).
  26673. *
  26674. * **Note:** This method returns `true` for
  26675. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26676. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26677. * elements of empty collections.
  26678. *
  26679. * @static
  26680. * @memberOf _
  26681. * @since 0.1.0
  26682. * @category Collection
  26683. * @param {Array|Object} collection The collection to iterate over.
  26684. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26685. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26686. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26687. * else `false`.
  26688. * @example
  26689. *
  26690. * _.every([true, 1, null, 'yes'], Boolean);
  26691. * // => false
  26692. *
  26693. * var users = [
  26694. * { 'user': 'barney', 'age': 36, 'active': false },
  26695. * { 'user': 'fred', 'age': 40, 'active': false }
  26696. * ];
  26697. *
  26698. * // The `_.matches` iteratee shorthand.
  26699. * _.every(users, { 'user': 'barney', 'active': false });
  26700. * // => false
  26701. *
  26702. * // The `_.matchesProperty` iteratee shorthand.
  26703. * _.every(users, ['active', false]);
  26704. * // => true
  26705. *
  26706. * // The `_.property` iteratee shorthand.
  26707. * _.every(users, 'active');
  26708. * // => false
  26709. */
  26710. function every(collection, predicate, guard) {
  26711. var func = isArray(collection) ? arrayEvery : baseEvery;
  26712. if (guard && isIterateeCall(collection, predicate, guard)) {
  26713. predicate = undefined;
  26714. }
  26715. return func(collection, getIteratee(predicate, 3));
  26716. }
  26717. /**
  26718. * Iterates over elements of `collection`, returning an array of all elements
  26719. * `predicate` returns truthy for. The predicate is invoked with three
  26720. * arguments: (value, index|key, collection).
  26721. *
  26722. * **Note:** Unlike `_.remove`, this method returns a new array.
  26723. *
  26724. * @static
  26725. * @memberOf _
  26726. * @since 0.1.0
  26727. * @category Collection
  26728. * @param {Array|Object} collection The collection to iterate over.
  26729. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26730. * @returns {Array} Returns the new filtered array.
  26731. * @see _.reject
  26732. * @example
  26733. *
  26734. * var users = [
  26735. * { 'user': 'barney', 'age': 36, 'active': true },
  26736. * { 'user': 'fred', 'age': 40, 'active': false }
  26737. * ];
  26738. *
  26739. * _.filter(users, function(o) { return !o.active; });
  26740. * // => objects for ['fred']
  26741. *
  26742. * // The `_.matches` iteratee shorthand.
  26743. * _.filter(users, { 'age': 36, 'active': true });
  26744. * // => objects for ['barney']
  26745. *
  26746. * // The `_.matchesProperty` iteratee shorthand.
  26747. * _.filter(users, ['active', false]);
  26748. * // => objects for ['fred']
  26749. *
  26750. * // The `_.property` iteratee shorthand.
  26751. * _.filter(users, 'active');
  26752. * // => objects for ['barney']
  26753. */
  26754. function filter(collection, predicate) {
  26755. var func = isArray(collection) ? arrayFilter : baseFilter;
  26756. return func(collection, getIteratee(predicate, 3));
  26757. }
  26758. /**
  26759. * Iterates over elements of `collection`, returning the first element
  26760. * `predicate` returns truthy for. The predicate is invoked with three
  26761. * arguments: (value, index|key, collection).
  26762. *
  26763. * @static
  26764. * @memberOf _
  26765. * @since 0.1.0
  26766. * @category Collection
  26767. * @param {Array|Object} collection The collection to inspect.
  26768. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26769. * @param {number} [fromIndex=0] The index to search from.
  26770. * @returns {*} Returns the matched element, else `undefined`.
  26771. * @example
  26772. *
  26773. * var users = [
  26774. * { 'user': 'barney', 'age': 36, 'active': true },
  26775. * { 'user': 'fred', 'age': 40, 'active': false },
  26776. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26777. * ];
  26778. *
  26779. * _.find(users, function(o) { return o.age < 40; });
  26780. * // => object for 'barney'
  26781. *
  26782. * // The `_.matches` iteratee shorthand.
  26783. * _.find(users, { 'age': 1, 'active': true });
  26784. * // => object for 'pebbles'
  26785. *
  26786. * // The `_.matchesProperty` iteratee shorthand.
  26787. * _.find(users, ['active', false]);
  26788. * // => object for 'fred'
  26789. *
  26790. * // The `_.property` iteratee shorthand.
  26791. * _.find(users, 'active');
  26792. * // => object for 'barney'
  26793. */
  26794. var find = createFind(findIndex);
  26795. /**
  26796. * This method is like `_.find` except that it iterates over elements of
  26797. * `collection` from right to left.
  26798. *
  26799. * @static
  26800. * @memberOf _
  26801. * @since 2.0.0
  26802. * @category Collection
  26803. * @param {Array|Object} collection The collection to inspect.
  26804. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26805. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26806. * @returns {*} Returns the matched element, else `undefined`.
  26807. * @example
  26808. *
  26809. * _.findLast([1, 2, 3, 4], function(n) {
  26810. * return n % 2 == 1;
  26811. * });
  26812. * // => 3
  26813. */
  26814. var findLast = createFind(findLastIndex);
  26815. /**
  26816. * Creates a flattened array of values by running each element in `collection`
  26817. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26818. * with three arguments: (value, index|key, collection).
  26819. *
  26820. * @static
  26821. * @memberOf _
  26822. * @since 4.0.0
  26823. * @category Collection
  26824. * @param {Array|Object} collection The collection to iterate over.
  26825. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26826. * @returns {Array} Returns the new flattened array.
  26827. * @example
  26828. *
  26829. * function duplicate(n) {
  26830. * return [n, n];
  26831. * }
  26832. *
  26833. * _.flatMap([1, 2], duplicate);
  26834. * // => [1, 1, 2, 2]
  26835. */
  26836. function flatMap(collection, iteratee) {
  26837. return baseFlatten(map(collection, iteratee), 1);
  26838. }
  26839. /**
  26840. * This method is like `_.flatMap` except that it recursively flattens the
  26841. * mapped results.
  26842. *
  26843. * @static
  26844. * @memberOf _
  26845. * @since 4.7.0
  26846. * @category Collection
  26847. * @param {Array|Object} collection The collection to iterate over.
  26848. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26849. * @returns {Array} Returns the new flattened array.
  26850. * @example
  26851. *
  26852. * function duplicate(n) {
  26853. * return [[[n, n]]];
  26854. * }
  26855. *
  26856. * _.flatMapDeep([1, 2], duplicate);
  26857. * // => [1, 1, 2, 2]
  26858. */
  26859. function flatMapDeep(collection, iteratee) {
  26860. return baseFlatten(map(collection, iteratee), INFINITY);
  26861. }
  26862. /**
  26863. * This method is like `_.flatMap` except that it recursively flattens the
  26864. * mapped results up to `depth` times.
  26865. *
  26866. * @static
  26867. * @memberOf _
  26868. * @since 4.7.0
  26869. * @category Collection
  26870. * @param {Array|Object} collection The collection to iterate over.
  26871. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26872. * @param {number} [depth=1] The maximum recursion depth.
  26873. * @returns {Array} Returns the new flattened array.
  26874. * @example
  26875. *
  26876. * function duplicate(n) {
  26877. * return [[[n, n]]];
  26878. * }
  26879. *
  26880. * _.flatMapDepth([1, 2], duplicate, 2);
  26881. * // => [[1, 1], [2, 2]]
  26882. */
  26883. function flatMapDepth(collection, iteratee, depth) {
  26884. depth = depth === undefined ? 1 : toInteger(depth);
  26885. return baseFlatten(map(collection, iteratee), depth);
  26886. }
  26887. /**
  26888. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26889. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26890. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26891. *
  26892. * **Note:** As with other "Collections" methods, objects with a "length"
  26893. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26894. * or `_.forOwn` for object iteration.
  26895. *
  26896. * @static
  26897. * @memberOf _
  26898. * @since 0.1.0
  26899. * @alias each
  26900. * @category Collection
  26901. * @param {Array|Object} collection The collection to iterate over.
  26902. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26903. * @returns {Array|Object} Returns `collection`.
  26904. * @see _.forEachRight
  26905. * @example
  26906. *
  26907. * _.forEach([1, 2], function(value) {
  26908. * console.log(value);
  26909. * });
  26910. * // => Logs `1` then `2`.
  26911. *
  26912. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26913. * console.log(key);
  26914. * });
  26915. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26916. */
  26917. function forEach(collection, iteratee) {
  26918. var func = isArray(collection) ? arrayEach : baseEach;
  26919. return func(collection, getIteratee(iteratee, 3));
  26920. }
  26921. /**
  26922. * This method is like `_.forEach` except that it iterates over elements of
  26923. * `collection` from right to left.
  26924. *
  26925. * @static
  26926. * @memberOf _
  26927. * @since 2.0.0
  26928. * @alias eachRight
  26929. * @category Collection
  26930. * @param {Array|Object} collection The collection to iterate over.
  26931. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26932. * @returns {Array|Object} Returns `collection`.
  26933. * @see _.forEach
  26934. * @example
  26935. *
  26936. * _.forEachRight([1, 2], function(value) {
  26937. * console.log(value);
  26938. * });
  26939. * // => Logs `2` then `1`.
  26940. */
  26941. function forEachRight(collection, iteratee) {
  26942. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26943. return func(collection, getIteratee(iteratee, 3));
  26944. }
  26945. /**
  26946. * Creates an object composed of keys generated from the results of running
  26947. * each element of `collection` thru `iteratee`. The order of grouped values
  26948. * is determined by the order they occur in `collection`. The corresponding
  26949. * value of each key is an array of elements responsible for generating the
  26950. * key. The iteratee is invoked with one argument: (value).
  26951. *
  26952. * @static
  26953. * @memberOf _
  26954. * @since 0.1.0
  26955. * @category Collection
  26956. * @param {Array|Object} collection The collection to iterate over.
  26957. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26958. * @returns {Object} Returns the composed aggregate object.
  26959. * @example
  26960. *
  26961. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26962. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26963. *
  26964. * // The `_.property` iteratee shorthand.
  26965. * _.groupBy(['one', 'two', 'three'], 'length');
  26966. * // => { '3': ['one', 'two'], '5': ['three'] }
  26967. */
  26968. var groupBy = createAggregator(function(result, value, key) {
  26969. if (hasOwnProperty.call(result, key)) {
  26970. result[key].push(value);
  26971. } else {
  26972. baseAssignValue(result, key, [value]);
  26973. }
  26974. });
  26975. /**
  26976. * Checks if `value` is in `collection`. If `collection` is a string, it's
  26977. * checked for a substring of `value`, otherwise
  26978. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26979. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  26980. * the offset from the end of `collection`.
  26981. *
  26982. * @static
  26983. * @memberOf _
  26984. * @since 0.1.0
  26985. * @category Collection
  26986. * @param {Array|Object|string} collection The collection to inspect.
  26987. * @param {*} value The value to search for.
  26988. * @param {number} [fromIndex=0] The index to search from.
  26989. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  26990. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  26991. * @example
  26992. *
  26993. * _.includes([1, 2, 3], 1);
  26994. * // => true
  26995. *
  26996. * _.includes([1, 2, 3], 1, 2);
  26997. * // => false
  26998. *
  26999. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27000. * // => true
  27001. *
  27002. * _.includes('abcd', 'bc');
  27003. * // => true
  27004. */
  27005. function includes(collection, value, fromIndex, guard) {
  27006. collection = isArrayLike(collection) ? collection : values(collection);
  27007. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27008. var length = collection.length;
  27009. if (fromIndex < 0) {
  27010. fromIndex = nativeMax(length + fromIndex, 0);
  27011. }
  27012. return isString(collection)
  27013. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27014. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27015. }
  27016. /**
  27017. * Invokes the method at `path` of each element in `collection`, returning
  27018. * an array of the results of each invoked method. Any additional arguments
  27019. * are provided to each invoked method. If `path` is a function, it's invoked
  27020. * for, and `this` bound to, each element in `collection`.
  27021. *
  27022. * @static
  27023. * @memberOf _
  27024. * @since 4.0.0
  27025. * @category Collection
  27026. * @param {Array|Object} collection The collection to iterate over.
  27027. * @param {Array|Function|string} path The path of the method to invoke or
  27028. * the function invoked per iteration.
  27029. * @param {...*} [args] The arguments to invoke each method with.
  27030. * @returns {Array} Returns the array of results.
  27031. * @example
  27032. *
  27033. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27034. * // => [[1, 5, 7], [1, 2, 3]]
  27035. *
  27036. * _.invokeMap([123, 456], String.prototype.split, '');
  27037. * // => [['1', '2', '3'], ['4', '5', '6']]
  27038. */
  27039. var invokeMap = baseRest(function(collection, path, args) {
  27040. var index = -1,
  27041. isFunc = typeof path == 'function',
  27042. result = isArrayLike(collection) ? Array(collection.length) : [];
  27043. baseEach(collection, function(value) {
  27044. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27045. });
  27046. return result;
  27047. });
  27048. /**
  27049. * Creates an object composed of keys generated from the results of running
  27050. * each element of `collection` thru `iteratee`. The corresponding value of
  27051. * each key is the last element responsible for generating the key. The
  27052. * iteratee is invoked with one argument: (value).
  27053. *
  27054. * @static
  27055. * @memberOf _
  27056. * @since 4.0.0
  27057. * @category Collection
  27058. * @param {Array|Object} collection The collection to iterate over.
  27059. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27060. * @returns {Object} Returns the composed aggregate object.
  27061. * @example
  27062. *
  27063. * var array = [
  27064. * { 'dir': 'left', 'code': 97 },
  27065. * { 'dir': 'right', 'code': 100 }
  27066. * ];
  27067. *
  27068. * _.keyBy(array, function(o) {
  27069. * return String.fromCharCode(o.code);
  27070. * });
  27071. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27072. *
  27073. * _.keyBy(array, 'dir');
  27074. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27075. */
  27076. var keyBy = createAggregator(function(result, value, key) {
  27077. baseAssignValue(result, key, value);
  27078. });
  27079. /**
  27080. * Creates an array of values by running each element in `collection` thru
  27081. * `iteratee`. The iteratee is invoked with three arguments:
  27082. * (value, index|key, collection).
  27083. *
  27084. * Many lodash methods are guarded to work as iteratees for methods like
  27085. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27086. *
  27087. * The guarded methods are:
  27088. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27089. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27090. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27091. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27092. *
  27093. * @static
  27094. * @memberOf _
  27095. * @since 0.1.0
  27096. * @category Collection
  27097. * @param {Array|Object} collection The collection to iterate over.
  27098. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27099. * @returns {Array} Returns the new mapped array.
  27100. * @example
  27101. *
  27102. * function square(n) {
  27103. * return n * n;
  27104. * }
  27105. *
  27106. * _.map([4, 8], square);
  27107. * // => [16, 64]
  27108. *
  27109. * _.map({ 'a': 4, 'b': 8 }, square);
  27110. * // => [16, 64] (iteration order is not guaranteed)
  27111. *
  27112. * var users = [
  27113. * { 'user': 'barney' },
  27114. * { 'user': 'fred' }
  27115. * ];
  27116. *
  27117. * // The `_.property` iteratee shorthand.
  27118. * _.map(users, 'user');
  27119. * // => ['barney', 'fred']
  27120. */
  27121. function map(collection, iteratee) {
  27122. var func = isArray(collection) ? arrayMap : baseMap;
  27123. return func(collection, getIteratee(iteratee, 3));
  27124. }
  27125. /**
  27126. * This method is like `_.sortBy` except that it allows specifying the sort
  27127. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27128. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27129. * descending or "asc" for ascending sort order of corresponding values.
  27130. *
  27131. * @static
  27132. * @memberOf _
  27133. * @since 4.0.0
  27134. * @category Collection
  27135. * @param {Array|Object} collection The collection to iterate over.
  27136. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27137. * The iteratees to sort by.
  27138. * @param {string[]} [orders] The sort orders of `iteratees`.
  27139. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27140. * @returns {Array} Returns the new sorted array.
  27141. * @example
  27142. *
  27143. * var users = [
  27144. * { 'user': 'fred', 'age': 48 },
  27145. * { 'user': 'barney', 'age': 34 },
  27146. * { 'user': 'fred', 'age': 40 },
  27147. * { 'user': 'barney', 'age': 36 }
  27148. * ];
  27149. *
  27150. * // Sort by `user` in ascending order and by `age` in descending order.
  27151. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27152. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27153. */
  27154. function orderBy(collection, iteratees, orders, guard) {
  27155. if (collection == null) {
  27156. return [];
  27157. }
  27158. if (!isArray(iteratees)) {
  27159. iteratees = iteratees == null ? [] : [iteratees];
  27160. }
  27161. orders = guard ? undefined : orders;
  27162. if (!isArray(orders)) {
  27163. orders = orders == null ? [] : [orders];
  27164. }
  27165. return baseOrderBy(collection, iteratees, orders);
  27166. }
  27167. /**
  27168. * Creates an array of elements split into two groups, the first of which
  27169. * contains elements `predicate` returns truthy for, the second of which
  27170. * contains elements `predicate` returns falsey for. The predicate is
  27171. * invoked with one argument: (value).
  27172. *
  27173. * @static
  27174. * @memberOf _
  27175. * @since 3.0.0
  27176. * @category Collection
  27177. * @param {Array|Object} collection The collection to iterate over.
  27178. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27179. * @returns {Array} Returns the array of grouped elements.
  27180. * @example
  27181. *
  27182. * var users = [
  27183. * { 'user': 'barney', 'age': 36, 'active': false },
  27184. * { 'user': 'fred', 'age': 40, 'active': true },
  27185. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27186. * ];
  27187. *
  27188. * _.partition(users, function(o) { return o.active; });
  27189. * // => objects for [['fred'], ['barney', 'pebbles']]
  27190. *
  27191. * // The `_.matches` iteratee shorthand.
  27192. * _.partition(users, { 'age': 1, 'active': false });
  27193. * // => objects for [['pebbles'], ['barney', 'fred']]
  27194. *
  27195. * // The `_.matchesProperty` iteratee shorthand.
  27196. * _.partition(users, ['active', false]);
  27197. * // => objects for [['barney', 'pebbles'], ['fred']]
  27198. *
  27199. * // The `_.property` iteratee shorthand.
  27200. * _.partition(users, 'active');
  27201. * // => objects for [['fred'], ['barney', 'pebbles']]
  27202. */
  27203. var partition = createAggregator(function(result, value, key) {
  27204. result[key ? 0 : 1].push(value);
  27205. }, function() { return [[], []]; });
  27206. /**
  27207. * Reduces `collection` to a value which is the accumulated result of running
  27208. * each element in `collection` thru `iteratee`, where each successive
  27209. * invocation is supplied the return value of the previous. If `accumulator`
  27210. * is not given, the first element of `collection` is used as the initial
  27211. * value. The iteratee is invoked with four arguments:
  27212. * (accumulator, value, index|key, collection).
  27213. *
  27214. * Many lodash methods are guarded to work as iteratees for methods like
  27215. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27216. *
  27217. * The guarded methods are:
  27218. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27219. * and `sortBy`
  27220. *
  27221. * @static
  27222. * @memberOf _
  27223. * @since 0.1.0
  27224. * @category Collection
  27225. * @param {Array|Object} collection The collection to iterate over.
  27226. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27227. * @param {*} [accumulator] The initial value.
  27228. * @returns {*} Returns the accumulated value.
  27229. * @see _.reduceRight
  27230. * @example
  27231. *
  27232. * _.reduce([1, 2], function(sum, n) {
  27233. * return sum + n;
  27234. * }, 0);
  27235. * // => 3
  27236. *
  27237. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27238. * (result[value] || (result[value] = [])).push(key);
  27239. * return result;
  27240. * }, {});
  27241. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27242. */
  27243. function reduce(collection, iteratee, accumulator) {
  27244. var func = isArray(collection) ? arrayReduce : baseReduce,
  27245. initAccum = arguments.length < 3;
  27246. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27247. }
  27248. /**
  27249. * This method is like `_.reduce` except that it iterates over elements of
  27250. * `collection` from right to left.
  27251. *
  27252. * @static
  27253. * @memberOf _
  27254. * @since 0.1.0
  27255. * @category Collection
  27256. * @param {Array|Object} collection The collection to iterate over.
  27257. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27258. * @param {*} [accumulator] The initial value.
  27259. * @returns {*} Returns the accumulated value.
  27260. * @see _.reduce
  27261. * @example
  27262. *
  27263. * var array = [[0, 1], [2, 3], [4, 5]];
  27264. *
  27265. * _.reduceRight(array, function(flattened, other) {
  27266. * return flattened.concat(other);
  27267. * }, []);
  27268. * // => [4, 5, 2, 3, 0, 1]
  27269. */
  27270. function reduceRight(collection, iteratee, accumulator) {
  27271. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27272. initAccum = arguments.length < 3;
  27273. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27274. }
  27275. /**
  27276. * The opposite of `_.filter`; this method returns the elements of `collection`
  27277. * that `predicate` does **not** return truthy for.
  27278. *
  27279. * @static
  27280. * @memberOf _
  27281. * @since 0.1.0
  27282. * @category Collection
  27283. * @param {Array|Object} collection The collection to iterate over.
  27284. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27285. * @returns {Array} Returns the new filtered array.
  27286. * @see _.filter
  27287. * @example
  27288. *
  27289. * var users = [
  27290. * { 'user': 'barney', 'age': 36, 'active': false },
  27291. * { 'user': 'fred', 'age': 40, 'active': true }
  27292. * ];
  27293. *
  27294. * _.reject(users, function(o) { return !o.active; });
  27295. * // => objects for ['fred']
  27296. *
  27297. * // The `_.matches` iteratee shorthand.
  27298. * _.reject(users, { 'age': 40, 'active': true });
  27299. * // => objects for ['barney']
  27300. *
  27301. * // The `_.matchesProperty` iteratee shorthand.
  27302. * _.reject(users, ['active', false]);
  27303. * // => objects for ['fred']
  27304. *
  27305. * // The `_.property` iteratee shorthand.
  27306. * _.reject(users, 'active');
  27307. * // => objects for ['barney']
  27308. */
  27309. function reject(collection, predicate) {
  27310. var func = isArray(collection) ? arrayFilter : baseFilter;
  27311. return func(collection, negate(getIteratee(predicate, 3)));
  27312. }
  27313. /**
  27314. * Gets a random element from `collection`.
  27315. *
  27316. * @static
  27317. * @memberOf _
  27318. * @since 2.0.0
  27319. * @category Collection
  27320. * @param {Array|Object} collection The collection to sample.
  27321. * @returns {*} Returns the random element.
  27322. * @example
  27323. *
  27324. * _.sample([1, 2, 3, 4]);
  27325. * // => 2
  27326. */
  27327. function sample(collection) {
  27328. var func = isArray(collection) ? arraySample : baseSample;
  27329. return func(collection);
  27330. }
  27331. /**
  27332. * Gets `n` random elements at unique keys from `collection` up to the
  27333. * size of `collection`.
  27334. *
  27335. * @static
  27336. * @memberOf _
  27337. * @since 4.0.0
  27338. * @category Collection
  27339. * @param {Array|Object} collection The collection to sample.
  27340. * @param {number} [n=1] The number of elements to sample.
  27341. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27342. * @returns {Array} Returns the random elements.
  27343. * @example
  27344. *
  27345. * _.sampleSize([1, 2, 3], 2);
  27346. * // => [3, 1]
  27347. *
  27348. * _.sampleSize([1, 2, 3], 4);
  27349. * // => [2, 3, 1]
  27350. */
  27351. function sampleSize(collection, n, guard) {
  27352. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27353. n = 1;
  27354. } else {
  27355. n = toInteger(n);
  27356. }
  27357. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27358. return func(collection, n);
  27359. }
  27360. /**
  27361. * Creates an array of shuffled values, using a version of the
  27362. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27363. *
  27364. * @static
  27365. * @memberOf _
  27366. * @since 0.1.0
  27367. * @category Collection
  27368. * @param {Array|Object} collection The collection to shuffle.
  27369. * @returns {Array} Returns the new shuffled array.
  27370. * @example
  27371. *
  27372. * _.shuffle([1, 2, 3, 4]);
  27373. * // => [4, 1, 3, 2]
  27374. */
  27375. function shuffle(collection) {
  27376. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27377. return func(collection);
  27378. }
  27379. /**
  27380. * Gets the size of `collection` by returning its length for array-like
  27381. * values or the number of own enumerable string keyed properties for objects.
  27382. *
  27383. * @static
  27384. * @memberOf _
  27385. * @since 0.1.0
  27386. * @category Collection
  27387. * @param {Array|Object|string} collection The collection to inspect.
  27388. * @returns {number} Returns the collection size.
  27389. * @example
  27390. *
  27391. * _.size([1, 2, 3]);
  27392. * // => 3
  27393. *
  27394. * _.size({ 'a': 1, 'b': 2 });
  27395. * // => 2
  27396. *
  27397. * _.size('pebbles');
  27398. * // => 7
  27399. */
  27400. function size(collection) {
  27401. if (collection == null) {
  27402. return 0;
  27403. }
  27404. if (isArrayLike(collection)) {
  27405. return isString(collection) ? stringSize(collection) : collection.length;
  27406. }
  27407. var tag = getTag(collection);
  27408. if (tag == mapTag || tag == setTag) {
  27409. return collection.size;
  27410. }
  27411. return baseKeys(collection).length;
  27412. }
  27413. /**
  27414. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27415. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27416. * invoked with three arguments: (value, index|key, collection).
  27417. *
  27418. * @static
  27419. * @memberOf _
  27420. * @since 0.1.0
  27421. * @category Collection
  27422. * @param {Array|Object} collection The collection to iterate over.
  27423. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27424. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27425. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27426. * else `false`.
  27427. * @example
  27428. *
  27429. * _.some([null, 0, 'yes', false], Boolean);
  27430. * // => true
  27431. *
  27432. * var users = [
  27433. * { 'user': 'barney', 'active': true },
  27434. * { 'user': 'fred', 'active': false }
  27435. * ];
  27436. *
  27437. * // The `_.matches` iteratee shorthand.
  27438. * _.some(users, { 'user': 'barney', 'active': false });
  27439. * // => false
  27440. *
  27441. * // The `_.matchesProperty` iteratee shorthand.
  27442. * _.some(users, ['active', false]);
  27443. * // => true
  27444. *
  27445. * // The `_.property` iteratee shorthand.
  27446. * _.some(users, 'active');
  27447. * // => true
  27448. */
  27449. function some(collection, predicate, guard) {
  27450. var func = isArray(collection) ? arraySome : baseSome;
  27451. if (guard && isIterateeCall(collection, predicate, guard)) {
  27452. predicate = undefined;
  27453. }
  27454. return func(collection, getIteratee(predicate, 3));
  27455. }
  27456. /**
  27457. * Creates an array of elements, sorted in ascending order by the results of
  27458. * running each element in a collection thru each iteratee. This method
  27459. * performs a stable sort, that is, it preserves the original sort order of
  27460. * equal elements. The iteratees are invoked with one argument: (value).
  27461. *
  27462. * @static
  27463. * @memberOf _
  27464. * @since 0.1.0
  27465. * @category Collection
  27466. * @param {Array|Object} collection The collection to iterate over.
  27467. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27468. * The iteratees to sort by.
  27469. * @returns {Array} Returns the new sorted array.
  27470. * @example
  27471. *
  27472. * var users = [
  27473. * { 'user': 'fred', 'age': 48 },
  27474. * { 'user': 'barney', 'age': 36 },
  27475. * { 'user': 'fred', 'age': 40 },
  27476. * { 'user': 'barney', 'age': 34 }
  27477. * ];
  27478. *
  27479. * _.sortBy(users, [function(o) { return o.user; }]);
  27480. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27481. *
  27482. * _.sortBy(users, ['user', 'age']);
  27483. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27484. */
  27485. var sortBy = baseRest(function(collection, iteratees) {
  27486. if (collection == null) {
  27487. return [];
  27488. }
  27489. var length = iteratees.length;
  27490. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27491. iteratees = [];
  27492. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27493. iteratees = [iteratees[0]];
  27494. }
  27495. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27496. });
  27497. /*------------------------------------------------------------------------*/
  27498. /**
  27499. * Gets the timestamp of the number of milliseconds that have elapsed since
  27500. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27501. *
  27502. * @static
  27503. * @memberOf _
  27504. * @since 2.4.0
  27505. * @category Date
  27506. * @returns {number} Returns the timestamp.
  27507. * @example
  27508. *
  27509. * _.defer(function(stamp) {
  27510. * console.log(_.now() - stamp);
  27511. * }, _.now());
  27512. * // => Logs the number of milliseconds it took for the deferred invocation.
  27513. */
  27514. var now = ctxNow || function() {
  27515. return root.Date.now();
  27516. };
  27517. /*------------------------------------------------------------------------*/
  27518. /**
  27519. * The opposite of `_.before`; this method creates a function that invokes
  27520. * `func` once it's called `n` or more times.
  27521. *
  27522. * @static
  27523. * @memberOf _
  27524. * @since 0.1.0
  27525. * @category Function
  27526. * @param {number} n The number of calls before `func` is invoked.
  27527. * @param {Function} func The function to restrict.
  27528. * @returns {Function} Returns the new restricted function.
  27529. * @example
  27530. *
  27531. * var saves = ['profile', 'settings'];
  27532. *
  27533. * var done = _.after(saves.length, function() {
  27534. * console.log('done saving!');
  27535. * });
  27536. *
  27537. * _.forEach(saves, function(type) {
  27538. * asyncSave({ 'type': type, 'complete': done });
  27539. * });
  27540. * // => Logs 'done saving!' after the two async saves have completed.
  27541. */
  27542. function after(n, func) {
  27543. if (typeof func != 'function') {
  27544. throw new TypeError(FUNC_ERROR_TEXT);
  27545. }
  27546. n = toInteger(n);
  27547. return function() {
  27548. if (--n < 1) {
  27549. return func.apply(this, arguments);
  27550. }
  27551. };
  27552. }
  27553. /**
  27554. * Creates a function that invokes `func`, with up to `n` arguments,
  27555. * ignoring any additional arguments.
  27556. *
  27557. * @static
  27558. * @memberOf _
  27559. * @since 3.0.0
  27560. * @category Function
  27561. * @param {Function} func The function to cap arguments for.
  27562. * @param {number} [n=func.length] The arity cap.
  27563. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27564. * @returns {Function} Returns the new capped function.
  27565. * @example
  27566. *
  27567. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27568. * // => [6, 8, 10]
  27569. */
  27570. function ary(func, n, guard) {
  27571. n = guard ? undefined : n;
  27572. n = (func && n == null) ? func.length : n;
  27573. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27574. }
  27575. /**
  27576. * Creates a function that invokes `func`, with the `this` binding and arguments
  27577. * of the created function, while it's called less than `n` times. Subsequent
  27578. * calls to the created function return the result of the last `func` invocation.
  27579. *
  27580. * @static
  27581. * @memberOf _
  27582. * @since 3.0.0
  27583. * @category Function
  27584. * @param {number} n The number of calls at which `func` is no longer invoked.
  27585. * @param {Function} func The function to restrict.
  27586. * @returns {Function} Returns the new restricted function.
  27587. * @example
  27588. *
  27589. * jQuery(element).on('click', _.before(5, addContactToList));
  27590. * // => Allows adding up to 4 contacts to the list.
  27591. */
  27592. function before(n, func) {
  27593. var result;
  27594. if (typeof func != 'function') {
  27595. throw new TypeError(FUNC_ERROR_TEXT);
  27596. }
  27597. n = toInteger(n);
  27598. return function() {
  27599. if (--n > 0) {
  27600. result = func.apply(this, arguments);
  27601. }
  27602. if (n <= 1) {
  27603. func = undefined;
  27604. }
  27605. return result;
  27606. };
  27607. }
  27608. /**
  27609. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27610. * and `partials` prepended to the arguments it receives.
  27611. *
  27612. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27613. * may be used as a placeholder for partially applied arguments.
  27614. *
  27615. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27616. * property of bound functions.
  27617. *
  27618. * @static
  27619. * @memberOf _
  27620. * @since 0.1.0
  27621. * @category Function
  27622. * @param {Function} func The function to bind.
  27623. * @param {*} thisArg The `this` binding of `func`.
  27624. * @param {...*} [partials] The arguments to be partially applied.
  27625. * @returns {Function} Returns the new bound function.
  27626. * @example
  27627. *
  27628. * function greet(greeting, punctuation) {
  27629. * return greeting + ' ' + this.user + punctuation;
  27630. * }
  27631. *
  27632. * var object = { 'user': 'fred' };
  27633. *
  27634. * var bound = _.bind(greet, object, 'hi');
  27635. * bound('!');
  27636. * // => 'hi fred!'
  27637. *
  27638. * // Bound with placeholders.
  27639. * var bound = _.bind(greet, object, _, '!');
  27640. * bound('hi');
  27641. * // => 'hi fred!'
  27642. */
  27643. var bind = baseRest(function(func, thisArg, partials) {
  27644. var bitmask = WRAP_BIND_FLAG;
  27645. if (partials.length) {
  27646. var holders = replaceHolders(partials, getHolder(bind));
  27647. bitmask |= WRAP_PARTIAL_FLAG;
  27648. }
  27649. return createWrap(func, bitmask, thisArg, partials, holders);
  27650. });
  27651. /**
  27652. * Creates a function that invokes the method at `object[key]` with `partials`
  27653. * prepended to the arguments it receives.
  27654. *
  27655. * This method differs from `_.bind` by allowing bound functions to reference
  27656. * methods that may be redefined or don't yet exist. See
  27657. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27658. * for more details.
  27659. *
  27660. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27661. * builds, may be used as a placeholder for partially applied arguments.
  27662. *
  27663. * @static
  27664. * @memberOf _
  27665. * @since 0.10.0
  27666. * @category Function
  27667. * @param {Object} object The object to invoke the method on.
  27668. * @param {string} key The key of the method.
  27669. * @param {...*} [partials] The arguments to be partially applied.
  27670. * @returns {Function} Returns the new bound function.
  27671. * @example
  27672. *
  27673. * var object = {
  27674. * 'user': 'fred',
  27675. * 'greet': function(greeting, punctuation) {
  27676. * return greeting + ' ' + this.user + punctuation;
  27677. * }
  27678. * };
  27679. *
  27680. * var bound = _.bindKey(object, 'greet', 'hi');
  27681. * bound('!');
  27682. * // => 'hi fred!'
  27683. *
  27684. * object.greet = function(greeting, punctuation) {
  27685. * return greeting + 'ya ' + this.user + punctuation;
  27686. * };
  27687. *
  27688. * bound('!');
  27689. * // => 'hiya fred!'
  27690. *
  27691. * // Bound with placeholders.
  27692. * var bound = _.bindKey(object, 'greet', _, '!');
  27693. * bound('hi');
  27694. * // => 'hiya fred!'
  27695. */
  27696. var bindKey = baseRest(function(object, key, partials) {
  27697. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27698. if (partials.length) {
  27699. var holders = replaceHolders(partials, getHolder(bindKey));
  27700. bitmask |= WRAP_PARTIAL_FLAG;
  27701. }
  27702. return createWrap(key, bitmask, object, partials, holders);
  27703. });
  27704. /**
  27705. * Creates a function that accepts arguments of `func` and either invokes
  27706. * `func` returning its result, if at least `arity` number of arguments have
  27707. * been provided, or returns a function that accepts the remaining `func`
  27708. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27709. * is not sufficient.
  27710. *
  27711. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27712. * may be used as a placeholder for provided arguments.
  27713. *
  27714. * **Note:** This method doesn't set the "length" property of curried functions.
  27715. *
  27716. * @static
  27717. * @memberOf _
  27718. * @since 2.0.0
  27719. * @category Function
  27720. * @param {Function} func The function to curry.
  27721. * @param {number} [arity=func.length] The arity of `func`.
  27722. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27723. * @returns {Function} Returns the new curried function.
  27724. * @example
  27725. *
  27726. * var abc = function(a, b, c) {
  27727. * return [a, b, c];
  27728. * };
  27729. *
  27730. * var curried = _.curry(abc);
  27731. *
  27732. * curried(1)(2)(3);
  27733. * // => [1, 2, 3]
  27734. *
  27735. * curried(1, 2)(3);
  27736. * // => [1, 2, 3]
  27737. *
  27738. * curried(1, 2, 3);
  27739. * // => [1, 2, 3]
  27740. *
  27741. * // Curried with placeholders.
  27742. * curried(1)(_, 3)(2);
  27743. * // => [1, 2, 3]
  27744. */
  27745. function curry(func, arity, guard) {
  27746. arity = guard ? undefined : arity;
  27747. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27748. result.placeholder = curry.placeholder;
  27749. return result;
  27750. }
  27751. /**
  27752. * This method is like `_.curry` except that arguments are applied to `func`
  27753. * in the manner of `_.partialRight` instead of `_.partial`.
  27754. *
  27755. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27756. * builds, may be used as a placeholder for provided arguments.
  27757. *
  27758. * **Note:** This method doesn't set the "length" property of curried functions.
  27759. *
  27760. * @static
  27761. * @memberOf _
  27762. * @since 3.0.0
  27763. * @category Function
  27764. * @param {Function} func The function to curry.
  27765. * @param {number} [arity=func.length] The arity of `func`.
  27766. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27767. * @returns {Function} Returns the new curried function.
  27768. * @example
  27769. *
  27770. * var abc = function(a, b, c) {
  27771. * return [a, b, c];
  27772. * };
  27773. *
  27774. * var curried = _.curryRight(abc);
  27775. *
  27776. * curried(3)(2)(1);
  27777. * // => [1, 2, 3]
  27778. *
  27779. * curried(2, 3)(1);
  27780. * // => [1, 2, 3]
  27781. *
  27782. * curried(1, 2, 3);
  27783. * // => [1, 2, 3]
  27784. *
  27785. * // Curried with placeholders.
  27786. * curried(3)(1, _)(2);
  27787. * // => [1, 2, 3]
  27788. */
  27789. function curryRight(func, arity, guard) {
  27790. arity = guard ? undefined : arity;
  27791. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27792. result.placeholder = curryRight.placeholder;
  27793. return result;
  27794. }
  27795. /**
  27796. * Creates a debounced function that delays invoking `func` until after `wait`
  27797. * milliseconds have elapsed since the last time the debounced function was
  27798. * invoked. The debounced function comes with a `cancel` method to cancel
  27799. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27800. * Provide `options` to indicate whether `func` should be invoked on the
  27801. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27802. * with the last arguments provided to the debounced function. Subsequent
  27803. * calls to the debounced function return the result of the last `func`
  27804. * invocation.
  27805. *
  27806. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27807. * invoked on the trailing edge of the timeout only if the debounced function
  27808. * is invoked more than once during the `wait` timeout.
  27809. *
  27810. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27811. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27812. *
  27813. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27814. * for details over the differences between `_.debounce` and `_.throttle`.
  27815. *
  27816. * @static
  27817. * @memberOf _
  27818. * @since 0.1.0
  27819. * @category Function
  27820. * @param {Function} func The function to debounce.
  27821. * @param {number} [wait=0] The number of milliseconds to delay.
  27822. * @param {Object} [options={}] The options object.
  27823. * @param {boolean} [options.leading=false]
  27824. * Specify invoking on the leading edge of the timeout.
  27825. * @param {number} [options.maxWait]
  27826. * The maximum time `func` is allowed to be delayed before it's invoked.
  27827. * @param {boolean} [options.trailing=true]
  27828. * Specify invoking on the trailing edge of the timeout.
  27829. * @returns {Function} Returns the new debounced function.
  27830. * @example
  27831. *
  27832. * // Avoid costly calculations while the window size is in flux.
  27833. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27834. *
  27835. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27836. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27837. * 'leading': true,
  27838. * 'trailing': false
  27839. * }));
  27840. *
  27841. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27842. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27843. * var source = new EventSource('/stream');
  27844. * jQuery(source).on('message', debounced);
  27845. *
  27846. * // Cancel the trailing debounced invocation.
  27847. * jQuery(window).on('popstate', debounced.cancel);
  27848. */
  27849. function debounce(func, wait, options) {
  27850. var lastArgs,
  27851. lastThis,
  27852. maxWait,
  27853. result,
  27854. timerId,
  27855. lastCallTime,
  27856. lastInvokeTime = 0,
  27857. leading = false,
  27858. maxing = false,
  27859. trailing = true;
  27860. if (typeof func != 'function') {
  27861. throw new TypeError(FUNC_ERROR_TEXT);
  27862. }
  27863. wait = toNumber(wait) || 0;
  27864. if (isObject(options)) {
  27865. leading = !!options.leading;
  27866. maxing = 'maxWait' in options;
  27867. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27868. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27869. }
  27870. function invokeFunc(time) {
  27871. var args = lastArgs,
  27872. thisArg = lastThis;
  27873. lastArgs = lastThis = undefined;
  27874. lastInvokeTime = time;
  27875. result = func.apply(thisArg, args);
  27876. return result;
  27877. }
  27878. function leadingEdge(time) {
  27879. // Reset any `maxWait` timer.
  27880. lastInvokeTime = time;
  27881. // Start the timer for the trailing edge.
  27882. timerId = setTimeout(timerExpired, wait);
  27883. // Invoke the leading edge.
  27884. return leading ? invokeFunc(time) : result;
  27885. }
  27886. function remainingWait(time) {
  27887. var timeSinceLastCall = time - lastCallTime,
  27888. timeSinceLastInvoke = time - lastInvokeTime,
  27889. timeWaiting = wait - timeSinceLastCall;
  27890. return maxing
  27891. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27892. : timeWaiting;
  27893. }
  27894. function shouldInvoke(time) {
  27895. var timeSinceLastCall = time - lastCallTime,
  27896. timeSinceLastInvoke = time - lastInvokeTime;
  27897. // Either this is the first call, activity has stopped and we're at the
  27898. // trailing edge, the system time has gone backwards and we're treating
  27899. // it as the trailing edge, or we've hit the `maxWait` limit.
  27900. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27901. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27902. }
  27903. function timerExpired() {
  27904. var time = now();
  27905. if (shouldInvoke(time)) {
  27906. return trailingEdge(time);
  27907. }
  27908. // Restart the timer.
  27909. timerId = setTimeout(timerExpired, remainingWait(time));
  27910. }
  27911. function trailingEdge(time) {
  27912. timerId = undefined;
  27913. // Only invoke if we have `lastArgs` which means `func` has been
  27914. // debounced at least once.
  27915. if (trailing && lastArgs) {
  27916. return invokeFunc(time);
  27917. }
  27918. lastArgs = lastThis = undefined;
  27919. return result;
  27920. }
  27921. function cancel() {
  27922. if (timerId !== undefined) {
  27923. clearTimeout(timerId);
  27924. }
  27925. lastInvokeTime = 0;
  27926. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27927. }
  27928. function flush() {
  27929. return timerId === undefined ? result : trailingEdge(now());
  27930. }
  27931. function debounced() {
  27932. var time = now(),
  27933. isInvoking = shouldInvoke(time);
  27934. lastArgs = arguments;
  27935. lastThis = this;
  27936. lastCallTime = time;
  27937. if (isInvoking) {
  27938. if (timerId === undefined) {
  27939. return leadingEdge(lastCallTime);
  27940. }
  27941. if (maxing) {
  27942. // Handle invocations in a tight loop.
  27943. clearTimeout(timerId);
  27944. timerId = setTimeout(timerExpired, wait);
  27945. return invokeFunc(lastCallTime);
  27946. }
  27947. }
  27948. if (timerId === undefined) {
  27949. timerId = setTimeout(timerExpired, wait);
  27950. }
  27951. return result;
  27952. }
  27953. debounced.cancel = cancel;
  27954. debounced.flush = flush;
  27955. return debounced;
  27956. }
  27957. /**
  27958. * Defers invoking the `func` until the current call stack has cleared. Any
  27959. * additional arguments are provided to `func` when it's invoked.
  27960. *
  27961. * @static
  27962. * @memberOf _
  27963. * @since 0.1.0
  27964. * @category Function
  27965. * @param {Function} func The function to defer.
  27966. * @param {...*} [args] The arguments to invoke `func` with.
  27967. * @returns {number} Returns the timer id.
  27968. * @example
  27969. *
  27970. * _.defer(function(text) {
  27971. * console.log(text);
  27972. * }, 'deferred');
  27973. * // => Logs 'deferred' after one millisecond.
  27974. */
  27975. var defer = baseRest(function(func, args) {
  27976. return baseDelay(func, 1, args);
  27977. });
  27978. /**
  27979. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  27980. * provided to `func` when it's invoked.
  27981. *
  27982. * @static
  27983. * @memberOf _
  27984. * @since 0.1.0
  27985. * @category Function
  27986. * @param {Function} func The function to delay.
  27987. * @param {number} wait The number of milliseconds to delay invocation.
  27988. * @param {...*} [args] The arguments to invoke `func` with.
  27989. * @returns {number} Returns the timer id.
  27990. * @example
  27991. *
  27992. * _.delay(function(text) {
  27993. * console.log(text);
  27994. * }, 1000, 'later');
  27995. * // => Logs 'later' after one second.
  27996. */
  27997. var delay = baseRest(function(func, wait, args) {
  27998. return baseDelay(func, toNumber(wait) || 0, args);
  27999. });
  28000. /**
  28001. * Creates a function that invokes `func` with arguments reversed.
  28002. *
  28003. * @static
  28004. * @memberOf _
  28005. * @since 4.0.0
  28006. * @category Function
  28007. * @param {Function} func The function to flip arguments for.
  28008. * @returns {Function} Returns the new flipped function.
  28009. * @example
  28010. *
  28011. * var flipped = _.flip(function() {
  28012. * return _.toArray(arguments);
  28013. * });
  28014. *
  28015. * flipped('a', 'b', 'c', 'd');
  28016. * // => ['d', 'c', 'b', 'a']
  28017. */
  28018. function flip(func) {
  28019. return createWrap(func, WRAP_FLIP_FLAG);
  28020. }
  28021. /**
  28022. * Creates a function that memoizes the result of `func`. If `resolver` is
  28023. * provided, it determines the cache key for storing the result based on the
  28024. * arguments provided to the memoized function. By default, the first argument
  28025. * provided to the memoized function is used as the map cache key. The `func`
  28026. * is invoked with the `this` binding of the memoized function.
  28027. *
  28028. * **Note:** The cache is exposed as the `cache` property on the memoized
  28029. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28030. * constructor with one whose instances implement the
  28031. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28032. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28033. *
  28034. * @static
  28035. * @memberOf _
  28036. * @since 0.1.0
  28037. * @category Function
  28038. * @param {Function} func The function to have its output memoized.
  28039. * @param {Function} [resolver] The function to resolve the cache key.
  28040. * @returns {Function} Returns the new memoized function.
  28041. * @example
  28042. *
  28043. * var object = { 'a': 1, 'b': 2 };
  28044. * var other = { 'c': 3, 'd': 4 };
  28045. *
  28046. * var values = _.memoize(_.values);
  28047. * values(object);
  28048. * // => [1, 2]
  28049. *
  28050. * values(other);
  28051. * // => [3, 4]
  28052. *
  28053. * object.a = 2;
  28054. * values(object);
  28055. * // => [1, 2]
  28056. *
  28057. * // Modify the result cache.
  28058. * values.cache.set(object, ['a', 'b']);
  28059. * values(object);
  28060. * // => ['a', 'b']
  28061. *
  28062. * // Replace `_.memoize.Cache`.
  28063. * _.memoize.Cache = WeakMap;
  28064. */
  28065. function memoize(func, resolver) {
  28066. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28067. throw new TypeError(FUNC_ERROR_TEXT);
  28068. }
  28069. var memoized = function() {
  28070. var args = arguments,
  28071. key = resolver ? resolver.apply(this, args) : args[0],
  28072. cache = memoized.cache;
  28073. if (cache.has(key)) {
  28074. return cache.get(key);
  28075. }
  28076. var result = func.apply(this, args);
  28077. memoized.cache = cache.set(key, result) || cache;
  28078. return result;
  28079. };
  28080. memoized.cache = new (memoize.Cache || MapCache);
  28081. return memoized;
  28082. }
  28083. // Expose `MapCache`.
  28084. memoize.Cache = MapCache;
  28085. /**
  28086. * Creates a function that negates the result of the predicate `func`. The
  28087. * `func` predicate is invoked with the `this` binding and arguments of the
  28088. * created function.
  28089. *
  28090. * @static
  28091. * @memberOf _
  28092. * @since 3.0.0
  28093. * @category Function
  28094. * @param {Function} predicate The predicate to negate.
  28095. * @returns {Function} Returns the new negated function.
  28096. * @example
  28097. *
  28098. * function isEven(n) {
  28099. * return n % 2 == 0;
  28100. * }
  28101. *
  28102. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28103. * // => [1, 3, 5]
  28104. */
  28105. function negate(predicate) {
  28106. if (typeof predicate != 'function') {
  28107. throw new TypeError(FUNC_ERROR_TEXT);
  28108. }
  28109. return function() {
  28110. var args = arguments;
  28111. switch (args.length) {
  28112. case 0: return !predicate.call(this);
  28113. case 1: return !predicate.call(this, args[0]);
  28114. case 2: return !predicate.call(this, args[0], args[1]);
  28115. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28116. }
  28117. return !predicate.apply(this, args);
  28118. };
  28119. }
  28120. /**
  28121. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28122. * to the function return the value of the first invocation. The `func` is
  28123. * invoked with the `this` binding and arguments of the created function.
  28124. *
  28125. * @static
  28126. * @memberOf _
  28127. * @since 0.1.0
  28128. * @category Function
  28129. * @param {Function} func The function to restrict.
  28130. * @returns {Function} Returns the new restricted function.
  28131. * @example
  28132. *
  28133. * var initialize = _.once(createApplication);
  28134. * initialize();
  28135. * initialize();
  28136. * // => `createApplication` is invoked once
  28137. */
  28138. function once(func) {
  28139. return before(2, func);
  28140. }
  28141. /**
  28142. * Creates a function that invokes `func` with its arguments transformed.
  28143. *
  28144. * @static
  28145. * @since 4.0.0
  28146. * @memberOf _
  28147. * @category Function
  28148. * @param {Function} func The function to wrap.
  28149. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28150. * The argument transforms.
  28151. * @returns {Function} Returns the new function.
  28152. * @example
  28153. *
  28154. * function doubled(n) {
  28155. * return n * 2;
  28156. * }
  28157. *
  28158. * function square(n) {
  28159. * return n * n;
  28160. * }
  28161. *
  28162. * var func = _.overArgs(function(x, y) {
  28163. * return [x, y];
  28164. * }, [square, doubled]);
  28165. *
  28166. * func(9, 3);
  28167. * // => [81, 6]
  28168. *
  28169. * func(10, 5);
  28170. * // => [100, 10]
  28171. */
  28172. var overArgs = castRest(function(func, transforms) {
  28173. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28174. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28175. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28176. var funcsLength = transforms.length;
  28177. return baseRest(function(args) {
  28178. var index = -1,
  28179. length = nativeMin(args.length, funcsLength);
  28180. while (++index < length) {
  28181. args[index] = transforms[index].call(this, args[index]);
  28182. }
  28183. return apply(func, this, args);
  28184. });
  28185. });
  28186. /**
  28187. * Creates a function that invokes `func` with `partials` prepended to the
  28188. * arguments it receives. This method is like `_.bind` except it does **not**
  28189. * alter the `this` binding.
  28190. *
  28191. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28192. * builds, may be used as a placeholder for partially applied arguments.
  28193. *
  28194. * **Note:** This method doesn't set the "length" property of partially
  28195. * applied functions.
  28196. *
  28197. * @static
  28198. * @memberOf _
  28199. * @since 0.2.0
  28200. * @category Function
  28201. * @param {Function} func The function to partially apply arguments to.
  28202. * @param {...*} [partials] The arguments to be partially applied.
  28203. * @returns {Function} Returns the new partially applied function.
  28204. * @example
  28205. *
  28206. * function greet(greeting, name) {
  28207. * return greeting + ' ' + name;
  28208. * }
  28209. *
  28210. * var sayHelloTo = _.partial(greet, 'hello');
  28211. * sayHelloTo('fred');
  28212. * // => 'hello fred'
  28213. *
  28214. * // Partially applied with placeholders.
  28215. * var greetFred = _.partial(greet, _, 'fred');
  28216. * greetFred('hi');
  28217. * // => 'hi fred'
  28218. */
  28219. var partial = baseRest(function(func, partials) {
  28220. var holders = replaceHolders(partials, getHolder(partial));
  28221. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28222. });
  28223. /**
  28224. * This method is like `_.partial` except that partially applied arguments
  28225. * are appended to the arguments it receives.
  28226. *
  28227. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28228. * builds, may be used as a placeholder for partially applied arguments.
  28229. *
  28230. * **Note:** This method doesn't set the "length" property of partially
  28231. * applied functions.
  28232. *
  28233. * @static
  28234. * @memberOf _
  28235. * @since 1.0.0
  28236. * @category Function
  28237. * @param {Function} func The function to partially apply arguments to.
  28238. * @param {...*} [partials] The arguments to be partially applied.
  28239. * @returns {Function} Returns the new partially applied function.
  28240. * @example
  28241. *
  28242. * function greet(greeting, name) {
  28243. * return greeting + ' ' + name;
  28244. * }
  28245. *
  28246. * var greetFred = _.partialRight(greet, 'fred');
  28247. * greetFred('hi');
  28248. * // => 'hi fred'
  28249. *
  28250. * // Partially applied with placeholders.
  28251. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28252. * sayHelloTo('fred');
  28253. * // => 'hello fred'
  28254. */
  28255. var partialRight = baseRest(function(func, partials) {
  28256. var holders = replaceHolders(partials, getHolder(partialRight));
  28257. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28258. });
  28259. /**
  28260. * Creates a function that invokes `func` with arguments arranged according
  28261. * to the specified `indexes` where the argument value at the first index is
  28262. * provided as the first argument, the argument value at the second index is
  28263. * provided as the second argument, and so on.
  28264. *
  28265. * @static
  28266. * @memberOf _
  28267. * @since 3.0.0
  28268. * @category Function
  28269. * @param {Function} func The function to rearrange arguments for.
  28270. * @param {...(number|number[])} indexes The arranged argument indexes.
  28271. * @returns {Function} Returns the new function.
  28272. * @example
  28273. *
  28274. * var rearged = _.rearg(function(a, b, c) {
  28275. * return [a, b, c];
  28276. * }, [2, 0, 1]);
  28277. *
  28278. * rearged('b', 'c', 'a')
  28279. * // => ['a', 'b', 'c']
  28280. */
  28281. var rearg = flatRest(function(func, indexes) {
  28282. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28283. });
  28284. /**
  28285. * Creates a function that invokes `func` with the `this` binding of the
  28286. * created function and arguments from `start` and beyond provided as
  28287. * an array.
  28288. *
  28289. * **Note:** This method is based on the
  28290. * [rest parameter](https://mdn.io/rest_parameters).
  28291. *
  28292. * @static
  28293. * @memberOf _
  28294. * @since 4.0.0
  28295. * @category Function
  28296. * @param {Function} func The function to apply a rest parameter to.
  28297. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28298. * @returns {Function} Returns the new function.
  28299. * @example
  28300. *
  28301. * var say = _.rest(function(what, names) {
  28302. * return what + ' ' + _.initial(names).join(', ') +
  28303. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28304. * });
  28305. *
  28306. * say('hello', 'fred', 'barney', 'pebbles');
  28307. * // => 'hello fred, barney, & pebbles'
  28308. */
  28309. function rest(func, start) {
  28310. if (typeof func != 'function') {
  28311. throw new TypeError(FUNC_ERROR_TEXT);
  28312. }
  28313. start = start === undefined ? start : toInteger(start);
  28314. return baseRest(func, start);
  28315. }
  28316. /**
  28317. * Creates a function that invokes `func` with the `this` binding of the
  28318. * create function and an array of arguments much like
  28319. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28320. *
  28321. * **Note:** This method is based on the
  28322. * [spread operator](https://mdn.io/spread_operator).
  28323. *
  28324. * @static
  28325. * @memberOf _
  28326. * @since 3.2.0
  28327. * @category Function
  28328. * @param {Function} func The function to spread arguments over.
  28329. * @param {number} [start=0] The start position of the spread.
  28330. * @returns {Function} Returns the new function.
  28331. * @example
  28332. *
  28333. * var say = _.spread(function(who, what) {
  28334. * return who + ' says ' + what;
  28335. * });
  28336. *
  28337. * say(['fred', 'hello']);
  28338. * // => 'fred says hello'
  28339. *
  28340. * var numbers = Promise.all([
  28341. * Promise.resolve(40),
  28342. * Promise.resolve(36)
  28343. * ]);
  28344. *
  28345. * numbers.then(_.spread(function(x, y) {
  28346. * return x + y;
  28347. * }));
  28348. * // => a Promise of 76
  28349. */
  28350. function spread(func, start) {
  28351. if (typeof func != 'function') {
  28352. throw new TypeError(FUNC_ERROR_TEXT);
  28353. }
  28354. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28355. return baseRest(function(args) {
  28356. var array = args[start],
  28357. otherArgs = castSlice(args, 0, start);
  28358. if (array) {
  28359. arrayPush(otherArgs, array);
  28360. }
  28361. return apply(func, this, otherArgs);
  28362. });
  28363. }
  28364. /**
  28365. * Creates a throttled function that only invokes `func` at most once per
  28366. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28367. * method to cancel delayed `func` invocations and a `flush` method to
  28368. * immediately invoke them. Provide `options` to indicate whether `func`
  28369. * should be invoked on the leading and/or trailing edge of the `wait`
  28370. * timeout. The `func` is invoked with the last arguments provided to the
  28371. * throttled function. Subsequent calls to the throttled function return the
  28372. * result of the last `func` invocation.
  28373. *
  28374. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28375. * invoked on the trailing edge of the timeout only if the throttled function
  28376. * is invoked more than once during the `wait` timeout.
  28377. *
  28378. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28379. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28380. *
  28381. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28382. * for details over the differences between `_.throttle` and `_.debounce`.
  28383. *
  28384. * @static
  28385. * @memberOf _
  28386. * @since 0.1.0
  28387. * @category Function
  28388. * @param {Function} func The function to throttle.
  28389. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28390. * @param {Object} [options={}] The options object.
  28391. * @param {boolean} [options.leading=true]
  28392. * Specify invoking on the leading edge of the timeout.
  28393. * @param {boolean} [options.trailing=true]
  28394. * Specify invoking on the trailing edge of the timeout.
  28395. * @returns {Function} Returns the new throttled function.
  28396. * @example
  28397. *
  28398. * // Avoid excessively updating the position while scrolling.
  28399. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28400. *
  28401. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28402. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28403. * jQuery(element).on('click', throttled);
  28404. *
  28405. * // Cancel the trailing throttled invocation.
  28406. * jQuery(window).on('popstate', throttled.cancel);
  28407. */
  28408. function throttle(func, wait, options) {
  28409. var leading = true,
  28410. trailing = true;
  28411. if (typeof func != 'function') {
  28412. throw new TypeError(FUNC_ERROR_TEXT);
  28413. }
  28414. if (isObject(options)) {
  28415. leading = 'leading' in options ? !!options.leading : leading;
  28416. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28417. }
  28418. return debounce(func, wait, {
  28419. 'leading': leading,
  28420. 'maxWait': wait,
  28421. 'trailing': trailing
  28422. });
  28423. }
  28424. /**
  28425. * Creates a function that accepts up to one argument, ignoring any
  28426. * additional arguments.
  28427. *
  28428. * @static
  28429. * @memberOf _
  28430. * @since 4.0.0
  28431. * @category Function
  28432. * @param {Function} func The function to cap arguments for.
  28433. * @returns {Function} Returns the new capped function.
  28434. * @example
  28435. *
  28436. * _.map(['6', '8', '10'], _.unary(parseInt));
  28437. * // => [6, 8, 10]
  28438. */
  28439. function unary(func) {
  28440. return ary(func, 1);
  28441. }
  28442. /**
  28443. * Creates a function that provides `value` to `wrapper` as its first
  28444. * argument. Any additional arguments provided to the function are appended
  28445. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28446. * binding of the created function.
  28447. *
  28448. * @static
  28449. * @memberOf _
  28450. * @since 0.1.0
  28451. * @category Function
  28452. * @param {*} value The value to wrap.
  28453. * @param {Function} [wrapper=identity] The wrapper function.
  28454. * @returns {Function} Returns the new function.
  28455. * @example
  28456. *
  28457. * var p = _.wrap(_.escape, function(func, text) {
  28458. * return '<p>' + func(text) + '</p>';
  28459. * });
  28460. *
  28461. * p('fred, barney, & pebbles');
  28462. * // => '<p>fred, barney, &amp; pebbles</p>'
  28463. */
  28464. function wrap(value, wrapper) {
  28465. return partial(castFunction(wrapper), value);
  28466. }
  28467. /*------------------------------------------------------------------------*/
  28468. /**
  28469. * Casts `value` as an array if it's not one.
  28470. *
  28471. * @static
  28472. * @memberOf _
  28473. * @since 4.4.0
  28474. * @category Lang
  28475. * @param {*} value The value to inspect.
  28476. * @returns {Array} Returns the cast array.
  28477. * @example
  28478. *
  28479. * _.castArray(1);
  28480. * // => [1]
  28481. *
  28482. * _.castArray({ 'a': 1 });
  28483. * // => [{ 'a': 1 }]
  28484. *
  28485. * _.castArray('abc');
  28486. * // => ['abc']
  28487. *
  28488. * _.castArray(null);
  28489. * // => [null]
  28490. *
  28491. * _.castArray(undefined);
  28492. * // => [undefined]
  28493. *
  28494. * _.castArray();
  28495. * // => []
  28496. *
  28497. * var array = [1, 2, 3];
  28498. * console.log(_.castArray(array) === array);
  28499. * // => true
  28500. */
  28501. function castArray() {
  28502. if (!arguments.length) {
  28503. return [];
  28504. }
  28505. var value = arguments[0];
  28506. return isArray(value) ? value : [value];
  28507. }
  28508. /**
  28509. * Creates a shallow clone of `value`.
  28510. *
  28511. * **Note:** This method is loosely based on the
  28512. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28513. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28514. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28515. * arrays. The own enumerable properties of `arguments` objects are cloned
  28516. * as plain objects. An empty object is returned for uncloneable values such
  28517. * as error objects, functions, DOM nodes, and WeakMaps.
  28518. *
  28519. * @static
  28520. * @memberOf _
  28521. * @since 0.1.0
  28522. * @category Lang
  28523. * @param {*} value The value to clone.
  28524. * @returns {*} Returns the cloned value.
  28525. * @see _.cloneDeep
  28526. * @example
  28527. *
  28528. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28529. *
  28530. * var shallow = _.clone(objects);
  28531. * console.log(shallow[0] === objects[0]);
  28532. * // => true
  28533. */
  28534. function clone(value) {
  28535. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28536. }
  28537. /**
  28538. * This method is like `_.clone` except that it accepts `customizer` which
  28539. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28540. * cloning is handled by the method instead. The `customizer` is invoked with
  28541. * up to four arguments; (value [, index|key, object, stack]).
  28542. *
  28543. * @static
  28544. * @memberOf _
  28545. * @since 4.0.0
  28546. * @category Lang
  28547. * @param {*} value The value to clone.
  28548. * @param {Function} [customizer] The function to customize cloning.
  28549. * @returns {*} Returns the cloned value.
  28550. * @see _.cloneDeepWith
  28551. * @example
  28552. *
  28553. * function customizer(value) {
  28554. * if (_.isElement(value)) {
  28555. * return value.cloneNode(false);
  28556. * }
  28557. * }
  28558. *
  28559. * var el = _.cloneWith(document.body, customizer);
  28560. *
  28561. * console.log(el === document.body);
  28562. * // => false
  28563. * console.log(el.nodeName);
  28564. * // => 'BODY'
  28565. * console.log(el.childNodes.length);
  28566. * // => 0
  28567. */
  28568. function cloneWith(value, customizer) {
  28569. customizer = typeof customizer == 'function' ? customizer : undefined;
  28570. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28571. }
  28572. /**
  28573. * This method is like `_.clone` except that it recursively clones `value`.
  28574. *
  28575. * @static
  28576. * @memberOf _
  28577. * @since 1.0.0
  28578. * @category Lang
  28579. * @param {*} value The value to recursively clone.
  28580. * @returns {*} Returns the deep cloned value.
  28581. * @see _.clone
  28582. * @example
  28583. *
  28584. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28585. *
  28586. * var deep = _.cloneDeep(objects);
  28587. * console.log(deep[0] === objects[0]);
  28588. * // => false
  28589. */
  28590. function cloneDeep(value) {
  28591. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28592. }
  28593. /**
  28594. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28595. *
  28596. * @static
  28597. * @memberOf _
  28598. * @since 4.0.0
  28599. * @category Lang
  28600. * @param {*} value The value to recursively clone.
  28601. * @param {Function} [customizer] The function to customize cloning.
  28602. * @returns {*} Returns the deep cloned value.
  28603. * @see _.cloneWith
  28604. * @example
  28605. *
  28606. * function customizer(value) {
  28607. * if (_.isElement(value)) {
  28608. * return value.cloneNode(true);
  28609. * }
  28610. * }
  28611. *
  28612. * var el = _.cloneDeepWith(document.body, customizer);
  28613. *
  28614. * console.log(el === document.body);
  28615. * // => false
  28616. * console.log(el.nodeName);
  28617. * // => 'BODY'
  28618. * console.log(el.childNodes.length);
  28619. * // => 20
  28620. */
  28621. function cloneDeepWith(value, customizer) {
  28622. customizer = typeof customizer == 'function' ? customizer : undefined;
  28623. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28624. }
  28625. /**
  28626. * Checks if `object` conforms to `source` by invoking the predicate
  28627. * properties of `source` with the corresponding property values of `object`.
  28628. *
  28629. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28630. * partially applied.
  28631. *
  28632. * @static
  28633. * @memberOf _
  28634. * @since 4.14.0
  28635. * @category Lang
  28636. * @param {Object} object The object to inspect.
  28637. * @param {Object} source The object of property predicates to conform to.
  28638. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28639. * @example
  28640. *
  28641. * var object = { 'a': 1, 'b': 2 };
  28642. *
  28643. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28644. * // => true
  28645. *
  28646. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28647. * // => false
  28648. */
  28649. function conformsTo(object, source) {
  28650. return source == null || baseConformsTo(object, source, keys(source));
  28651. }
  28652. /**
  28653. * Performs a
  28654. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28655. * comparison between two values to determine if they are equivalent.
  28656. *
  28657. * @static
  28658. * @memberOf _
  28659. * @since 4.0.0
  28660. * @category Lang
  28661. * @param {*} value The value to compare.
  28662. * @param {*} other The other value to compare.
  28663. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28664. * @example
  28665. *
  28666. * var object = { 'a': 1 };
  28667. * var other = { 'a': 1 };
  28668. *
  28669. * _.eq(object, object);
  28670. * // => true
  28671. *
  28672. * _.eq(object, other);
  28673. * // => false
  28674. *
  28675. * _.eq('a', 'a');
  28676. * // => true
  28677. *
  28678. * _.eq('a', Object('a'));
  28679. * // => false
  28680. *
  28681. * _.eq(NaN, NaN);
  28682. * // => true
  28683. */
  28684. function eq(value, other) {
  28685. return value === other || (value !== value && other !== other);
  28686. }
  28687. /**
  28688. * Checks if `value` is greater than `other`.
  28689. *
  28690. * @static
  28691. * @memberOf _
  28692. * @since 3.9.0
  28693. * @category Lang
  28694. * @param {*} value The value to compare.
  28695. * @param {*} other The other value to compare.
  28696. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28697. * else `false`.
  28698. * @see _.lt
  28699. * @example
  28700. *
  28701. * _.gt(3, 1);
  28702. * // => true
  28703. *
  28704. * _.gt(3, 3);
  28705. * // => false
  28706. *
  28707. * _.gt(1, 3);
  28708. * // => false
  28709. */
  28710. var gt = createRelationalOperation(baseGt);
  28711. /**
  28712. * Checks if `value` is greater than or equal to `other`.
  28713. *
  28714. * @static
  28715. * @memberOf _
  28716. * @since 3.9.0
  28717. * @category Lang
  28718. * @param {*} value The value to compare.
  28719. * @param {*} other The other value to compare.
  28720. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28721. * `other`, else `false`.
  28722. * @see _.lte
  28723. * @example
  28724. *
  28725. * _.gte(3, 1);
  28726. * // => true
  28727. *
  28728. * _.gte(3, 3);
  28729. * // => true
  28730. *
  28731. * _.gte(1, 3);
  28732. * // => false
  28733. */
  28734. var gte = createRelationalOperation(function(value, other) {
  28735. return value >= other;
  28736. });
  28737. /**
  28738. * Checks if `value` is likely an `arguments` object.
  28739. *
  28740. * @static
  28741. * @memberOf _
  28742. * @since 0.1.0
  28743. * @category Lang
  28744. * @param {*} value The value to check.
  28745. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28746. * else `false`.
  28747. * @example
  28748. *
  28749. * _.isArguments(function() { return arguments; }());
  28750. * // => true
  28751. *
  28752. * _.isArguments([1, 2, 3]);
  28753. * // => false
  28754. */
  28755. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28756. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28757. !propertyIsEnumerable.call(value, 'callee');
  28758. };
  28759. /**
  28760. * Checks if `value` is classified as an `Array` object.
  28761. *
  28762. * @static
  28763. * @memberOf _
  28764. * @since 0.1.0
  28765. * @category Lang
  28766. * @param {*} value The value to check.
  28767. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28768. * @example
  28769. *
  28770. * _.isArray([1, 2, 3]);
  28771. * // => true
  28772. *
  28773. * _.isArray(document.body.children);
  28774. * // => false
  28775. *
  28776. * _.isArray('abc');
  28777. * // => false
  28778. *
  28779. * _.isArray(_.noop);
  28780. * // => false
  28781. */
  28782. var isArray = Array.isArray;
  28783. /**
  28784. * Checks if `value` is classified as an `ArrayBuffer` object.
  28785. *
  28786. * @static
  28787. * @memberOf _
  28788. * @since 4.3.0
  28789. * @category Lang
  28790. * @param {*} value The value to check.
  28791. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28792. * @example
  28793. *
  28794. * _.isArrayBuffer(new ArrayBuffer(2));
  28795. * // => true
  28796. *
  28797. * _.isArrayBuffer(new Array(2));
  28798. * // => false
  28799. */
  28800. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28801. /**
  28802. * Checks if `value` is array-like. A value is considered array-like if it's
  28803. * not a function and has a `value.length` that's an integer greater than or
  28804. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28805. *
  28806. * @static
  28807. * @memberOf _
  28808. * @since 4.0.0
  28809. * @category Lang
  28810. * @param {*} value The value to check.
  28811. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28812. * @example
  28813. *
  28814. * _.isArrayLike([1, 2, 3]);
  28815. * // => true
  28816. *
  28817. * _.isArrayLike(document.body.children);
  28818. * // => true
  28819. *
  28820. * _.isArrayLike('abc');
  28821. * // => true
  28822. *
  28823. * _.isArrayLike(_.noop);
  28824. * // => false
  28825. */
  28826. function isArrayLike(value) {
  28827. return value != null && isLength(value.length) && !isFunction(value);
  28828. }
  28829. /**
  28830. * This method is like `_.isArrayLike` except that it also checks if `value`
  28831. * is an object.
  28832. *
  28833. * @static
  28834. * @memberOf _
  28835. * @since 4.0.0
  28836. * @category Lang
  28837. * @param {*} value The value to check.
  28838. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28839. * else `false`.
  28840. * @example
  28841. *
  28842. * _.isArrayLikeObject([1, 2, 3]);
  28843. * // => true
  28844. *
  28845. * _.isArrayLikeObject(document.body.children);
  28846. * // => true
  28847. *
  28848. * _.isArrayLikeObject('abc');
  28849. * // => false
  28850. *
  28851. * _.isArrayLikeObject(_.noop);
  28852. * // => false
  28853. */
  28854. function isArrayLikeObject(value) {
  28855. return isObjectLike(value) && isArrayLike(value);
  28856. }
  28857. /**
  28858. * Checks if `value` is classified as a boolean primitive or object.
  28859. *
  28860. * @static
  28861. * @memberOf _
  28862. * @since 0.1.0
  28863. * @category Lang
  28864. * @param {*} value The value to check.
  28865. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28866. * @example
  28867. *
  28868. * _.isBoolean(false);
  28869. * // => true
  28870. *
  28871. * _.isBoolean(null);
  28872. * // => false
  28873. */
  28874. function isBoolean(value) {
  28875. return value === true || value === false ||
  28876. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28877. }
  28878. /**
  28879. * Checks if `value` is a buffer.
  28880. *
  28881. * @static
  28882. * @memberOf _
  28883. * @since 4.3.0
  28884. * @category Lang
  28885. * @param {*} value The value to check.
  28886. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28887. * @example
  28888. *
  28889. * _.isBuffer(new Buffer(2));
  28890. * // => true
  28891. *
  28892. * _.isBuffer(new Uint8Array(2));
  28893. * // => false
  28894. */
  28895. var isBuffer = nativeIsBuffer || stubFalse;
  28896. /**
  28897. * Checks if `value` is classified as a `Date` object.
  28898. *
  28899. * @static
  28900. * @memberOf _
  28901. * @since 0.1.0
  28902. * @category Lang
  28903. * @param {*} value The value to check.
  28904. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28905. * @example
  28906. *
  28907. * _.isDate(new Date);
  28908. * // => true
  28909. *
  28910. * _.isDate('Mon April 23 2012');
  28911. * // => false
  28912. */
  28913. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28914. /**
  28915. * Checks if `value` is likely a DOM element.
  28916. *
  28917. * @static
  28918. * @memberOf _
  28919. * @since 0.1.0
  28920. * @category Lang
  28921. * @param {*} value The value to check.
  28922. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28923. * @example
  28924. *
  28925. * _.isElement(document.body);
  28926. * // => true
  28927. *
  28928. * _.isElement('<body>');
  28929. * // => false
  28930. */
  28931. function isElement(value) {
  28932. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28933. }
  28934. /**
  28935. * Checks if `value` is an empty object, collection, map, or set.
  28936. *
  28937. * Objects are considered empty if they have no own enumerable string keyed
  28938. * properties.
  28939. *
  28940. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28941. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28942. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28943. *
  28944. * @static
  28945. * @memberOf _
  28946. * @since 0.1.0
  28947. * @category Lang
  28948. * @param {*} value The value to check.
  28949. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28950. * @example
  28951. *
  28952. * _.isEmpty(null);
  28953. * // => true
  28954. *
  28955. * _.isEmpty(true);
  28956. * // => true
  28957. *
  28958. * _.isEmpty(1);
  28959. * // => true
  28960. *
  28961. * _.isEmpty([1, 2, 3]);
  28962. * // => false
  28963. *
  28964. * _.isEmpty({ 'a': 1 });
  28965. * // => false
  28966. */
  28967. function isEmpty(value) {
  28968. if (value == null) {
  28969. return true;
  28970. }
  28971. if (isArrayLike(value) &&
  28972. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  28973. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  28974. return !value.length;
  28975. }
  28976. var tag = getTag(value);
  28977. if (tag == mapTag || tag == setTag) {
  28978. return !value.size;
  28979. }
  28980. if (isPrototype(value)) {
  28981. return !baseKeys(value).length;
  28982. }
  28983. for (var key in value) {
  28984. if (hasOwnProperty.call(value, key)) {
  28985. return false;
  28986. }
  28987. }
  28988. return true;
  28989. }
  28990. /**
  28991. * Performs a deep comparison between two values to determine if they are
  28992. * equivalent.
  28993. *
  28994. * **Note:** This method supports comparing arrays, array buffers, booleans,
  28995. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  28996. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  28997. * by their own, not inherited, enumerable properties. Functions and DOM
  28998. * nodes are compared by strict equality, i.e. `===`.
  28999. *
  29000. * @static
  29001. * @memberOf _
  29002. * @since 0.1.0
  29003. * @category Lang
  29004. * @param {*} value The value to compare.
  29005. * @param {*} other The other value to compare.
  29006. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29007. * @example
  29008. *
  29009. * var object = { 'a': 1 };
  29010. * var other = { 'a': 1 };
  29011. *
  29012. * _.isEqual(object, other);
  29013. * // => true
  29014. *
  29015. * object === other;
  29016. * // => false
  29017. */
  29018. function isEqual(value, other) {
  29019. return baseIsEqual(value, other);
  29020. }
  29021. /**
  29022. * This method is like `_.isEqual` except that it accepts `customizer` which
  29023. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29024. * are handled by the method instead. The `customizer` is invoked with up to
  29025. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29026. *
  29027. * @static
  29028. * @memberOf _
  29029. * @since 4.0.0
  29030. * @category Lang
  29031. * @param {*} value The value to compare.
  29032. * @param {*} other The other value to compare.
  29033. * @param {Function} [customizer] The function to customize comparisons.
  29034. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29035. * @example
  29036. *
  29037. * function isGreeting(value) {
  29038. * return /^h(?:i|ello)$/.test(value);
  29039. * }
  29040. *
  29041. * function customizer(objValue, othValue) {
  29042. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29043. * return true;
  29044. * }
  29045. * }
  29046. *
  29047. * var array = ['hello', 'goodbye'];
  29048. * var other = ['hi', 'goodbye'];
  29049. *
  29050. * _.isEqualWith(array, other, customizer);
  29051. * // => true
  29052. */
  29053. function isEqualWith(value, other, customizer) {
  29054. customizer = typeof customizer == 'function' ? customizer : undefined;
  29055. var result = customizer ? customizer(value, other) : undefined;
  29056. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29057. }
  29058. /**
  29059. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29060. * `SyntaxError`, `TypeError`, or `URIError` object.
  29061. *
  29062. * @static
  29063. * @memberOf _
  29064. * @since 3.0.0
  29065. * @category Lang
  29066. * @param {*} value The value to check.
  29067. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29068. * @example
  29069. *
  29070. * _.isError(new Error);
  29071. * // => true
  29072. *
  29073. * _.isError(Error);
  29074. * // => false
  29075. */
  29076. function isError(value) {
  29077. if (!isObjectLike(value)) {
  29078. return false;
  29079. }
  29080. var tag = baseGetTag(value);
  29081. return tag == errorTag || tag == domExcTag ||
  29082. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29083. }
  29084. /**
  29085. * Checks if `value` is a finite primitive number.
  29086. *
  29087. * **Note:** This method is based on
  29088. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29089. *
  29090. * @static
  29091. * @memberOf _
  29092. * @since 0.1.0
  29093. * @category Lang
  29094. * @param {*} value The value to check.
  29095. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29096. * @example
  29097. *
  29098. * _.isFinite(3);
  29099. * // => true
  29100. *
  29101. * _.isFinite(Number.MIN_VALUE);
  29102. * // => true
  29103. *
  29104. * _.isFinite(Infinity);
  29105. * // => false
  29106. *
  29107. * _.isFinite('3');
  29108. * // => false
  29109. */
  29110. function isFinite(value) {
  29111. return typeof value == 'number' && nativeIsFinite(value);
  29112. }
  29113. /**
  29114. * Checks if `value` is classified as a `Function` object.
  29115. *
  29116. * @static
  29117. * @memberOf _
  29118. * @since 0.1.0
  29119. * @category Lang
  29120. * @param {*} value The value to check.
  29121. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29122. * @example
  29123. *
  29124. * _.isFunction(_);
  29125. * // => true
  29126. *
  29127. * _.isFunction(/abc/);
  29128. * // => false
  29129. */
  29130. function isFunction(value) {
  29131. if (!isObject(value)) {
  29132. return false;
  29133. }
  29134. // The use of `Object#toString` avoids issues with the `typeof` operator
  29135. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29136. var tag = baseGetTag(value);
  29137. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29138. }
  29139. /**
  29140. * Checks if `value` is an integer.
  29141. *
  29142. * **Note:** This method is based on
  29143. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29144. *
  29145. * @static
  29146. * @memberOf _
  29147. * @since 4.0.0
  29148. * @category Lang
  29149. * @param {*} value The value to check.
  29150. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29151. * @example
  29152. *
  29153. * _.isInteger(3);
  29154. * // => true
  29155. *
  29156. * _.isInteger(Number.MIN_VALUE);
  29157. * // => false
  29158. *
  29159. * _.isInteger(Infinity);
  29160. * // => false
  29161. *
  29162. * _.isInteger('3');
  29163. * // => false
  29164. */
  29165. function isInteger(value) {
  29166. return typeof value == 'number' && value == toInteger(value);
  29167. }
  29168. /**
  29169. * Checks if `value` is a valid array-like length.
  29170. *
  29171. * **Note:** This method is loosely based on
  29172. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29173. *
  29174. * @static
  29175. * @memberOf _
  29176. * @since 4.0.0
  29177. * @category Lang
  29178. * @param {*} value The value to check.
  29179. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29180. * @example
  29181. *
  29182. * _.isLength(3);
  29183. * // => true
  29184. *
  29185. * _.isLength(Number.MIN_VALUE);
  29186. * // => false
  29187. *
  29188. * _.isLength(Infinity);
  29189. * // => false
  29190. *
  29191. * _.isLength('3');
  29192. * // => false
  29193. */
  29194. function isLength(value) {
  29195. return typeof value == 'number' &&
  29196. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29197. }
  29198. /**
  29199. * Checks if `value` is the
  29200. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29201. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29202. *
  29203. * @static
  29204. * @memberOf _
  29205. * @since 0.1.0
  29206. * @category Lang
  29207. * @param {*} value The value to check.
  29208. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29209. * @example
  29210. *
  29211. * _.isObject({});
  29212. * // => true
  29213. *
  29214. * _.isObject([1, 2, 3]);
  29215. * // => true
  29216. *
  29217. * _.isObject(_.noop);
  29218. * // => true
  29219. *
  29220. * _.isObject(null);
  29221. * // => false
  29222. */
  29223. function isObject(value) {
  29224. var type = typeof value;
  29225. return value != null && (type == 'object' || type == 'function');
  29226. }
  29227. /**
  29228. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29229. * and has a `typeof` result of "object".
  29230. *
  29231. * @static
  29232. * @memberOf _
  29233. * @since 4.0.0
  29234. * @category Lang
  29235. * @param {*} value The value to check.
  29236. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29237. * @example
  29238. *
  29239. * _.isObjectLike({});
  29240. * // => true
  29241. *
  29242. * _.isObjectLike([1, 2, 3]);
  29243. * // => true
  29244. *
  29245. * _.isObjectLike(_.noop);
  29246. * // => false
  29247. *
  29248. * _.isObjectLike(null);
  29249. * // => false
  29250. */
  29251. function isObjectLike(value) {
  29252. return value != null && typeof value == 'object';
  29253. }
  29254. /**
  29255. * Checks if `value` is classified as a `Map` object.
  29256. *
  29257. * @static
  29258. * @memberOf _
  29259. * @since 4.3.0
  29260. * @category Lang
  29261. * @param {*} value The value to check.
  29262. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29263. * @example
  29264. *
  29265. * _.isMap(new Map);
  29266. * // => true
  29267. *
  29268. * _.isMap(new WeakMap);
  29269. * // => false
  29270. */
  29271. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29272. /**
  29273. * Performs a partial deep comparison between `object` and `source` to
  29274. * determine if `object` contains equivalent property values.
  29275. *
  29276. * **Note:** This method is equivalent to `_.matches` when `source` is
  29277. * partially applied.
  29278. *
  29279. * Partial comparisons will match empty array and empty object `source`
  29280. * values against any array or object value, respectively. See `_.isEqual`
  29281. * for a list of supported value comparisons.
  29282. *
  29283. * @static
  29284. * @memberOf _
  29285. * @since 3.0.0
  29286. * @category Lang
  29287. * @param {Object} object The object to inspect.
  29288. * @param {Object} source The object of property values to match.
  29289. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29290. * @example
  29291. *
  29292. * var object = { 'a': 1, 'b': 2 };
  29293. *
  29294. * _.isMatch(object, { 'b': 2 });
  29295. * // => true
  29296. *
  29297. * _.isMatch(object, { 'b': 1 });
  29298. * // => false
  29299. */
  29300. function isMatch(object, source) {
  29301. return object === source || baseIsMatch(object, source, getMatchData(source));
  29302. }
  29303. /**
  29304. * This method is like `_.isMatch` except that it accepts `customizer` which
  29305. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29306. * are handled by the method instead. The `customizer` is invoked with five
  29307. * arguments: (objValue, srcValue, index|key, object, source).
  29308. *
  29309. * @static
  29310. * @memberOf _
  29311. * @since 4.0.0
  29312. * @category Lang
  29313. * @param {Object} object The object to inspect.
  29314. * @param {Object} source The object of property values to match.
  29315. * @param {Function} [customizer] The function to customize comparisons.
  29316. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29317. * @example
  29318. *
  29319. * function isGreeting(value) {
  29320. * return /^h(?:i|ello)$/.test(value);
  29321. * }
  29322. *
  29323. * function customizer(objValue, srcValue) {
  29324. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29325. * return true;
  29326. * }
  29327. * }
  29328. *
  29329. * var object = { 'greeting': 'hello' };
  29330. * var source = { 'greeting': 'hi' };
  29331. *
  29332. * _.isMatchWith(object, source, customizer);
  29333. * // => true
  29334. */
  29335. function isMatchWith(object, source, customizer) {
  29336. customizer = typeof customizer == 'function' ? customizer : undefined;
  29337. return baseIsMatch(object, source, getMatchData(source), customizer);
  29338. }
  29339. /**
  29340. * Checks if `value` is `NaN`.
  29341. *
  29342. * **Note:** This method is based on
  29343. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29344. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29345. * `undefined` and other non-number values.
  29346. *
  29347. * @static
  29348. * @memberOf _
  29349. * @since 0.1.0
  29350. * @category Lang
  29351. * @param {*} value The value to check.
  29352. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29353. * @example
  29354. *
  29355. * _.isNaN(NaN);
  29356. * // => true
  29357. *
  29358. * _.isNaN(new Number(NaN));
  29359. * // => true
  29360. *
  29361. * isNaN(undefined);
  29362. * // => true
  29363. *
  29364. * _.isNaN(undefined);
  29365. * // => false
  29366. */
  29367. function isNaN(value) {
  29368. // An `NaN` primitive is the only value that is not equal to itself.
  29369. // Perform the `toStringTag` check first to avoid errors with some
  29370. // ActiveX objects in IE.
  29371. return isNumber(value) && value != +value;
  29372. }
  29373. /**
  29374. * Checks if `value` is a pristine native function.
  29375. *
  29376. * **Note:** This method can't reliably detect native functions in the presence
  29377. * of the core-js package because core-js circumvents this kind of detection.
  29378. * Despite multiple requests, the core-js maintainer has made it clear: any
  29379. * attempt to fix the detection will be obstructed. As a result, we're left
  29380. * with little choice but to throw an error. Unfortunately, this also affects
  29381. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29382. * which rely on core-js.
  29383. *
  29384. * @static
  29385. * @memberOf _
  29386. * @since 3.0.0
  29387. * @category Lang
  29388. * @param {*} value The value to check.
  29389. * @returns {boolean} Returns `true` if `value` is a native function,
  29390. * else `false`.
  29391. * @example
  29392. *
  29393. * _.isNative(Array.prototype.push);
  29394. * // => true
  29395. *
  29396. * _.isNative(_);
  29397. * // => false
  29398. */
  29399. function isNative(value) {
  29400. if (isMaskable(value)) {
  29401. throw new Error(CORE_ERROR_TEXT);
  29402. }
  29403. return baseIsNative(value);
  29404. }
  29405. /**
  29406. * Checks if `value` is `null`.
  29407. *
  29408. * @static
  29409. * @memberOf _
  29410. * @since 0.1.0
  29411. * @category Lang
  29412. * @param {*} value The value to check.
  29413. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29414. * @example
  29415. *
  29416. * _.isNull(null);
  29417. * // => true
  29418. *
  29419. * _.isNull(void 0);
  29420. * // => false
  29421. */
  29422. function isNull(value) {
  29423. return value === null;
  29424. }
  29425. /**
  29426. * Checks if `value` is `null` or `undefined`.
  29427. *
  29428. * @static
  29429. * @memberOf _
  29430. * @since 4.0.0
  29431. * @category Lang
  29432. * @param {*} value The value to check.
  29433. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29434. * @example
  29435. *
  29436. * _.isNil(null);
  29437. * // => true
  29438. *
  29439. * _.isNil(void 0);
  29440. * // => true
  29441. *
  29442. * _.isNil(NaN);
  29443. * // => false
  29444. */
  29445. function isNil(value) {
  29446. return value == null;
  29447. }
  29448. /**
  29449. * Checks if `value` is classified as a `Number` primitive or object.
  29450. *
  29451. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29452. * classified as numbers, use the `_.isFinite` method.
  29453. *
  29454. * @static
  29455. * @memberOf _
  29456. * @since 0.1.0
  29457. * @category Lang
  29458. * @param {*} value The value to check.
  29459. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29460. * @example
  29461. *
  29462. * _.isNumber(3);
  29463. * // => true
  29464. *
  29465. * _.isNumber(Number.MIN_VALUE);
  29466. * // => true
  29467. *
  29468. * _.isNumber(Infinity);
  29469. * // => true
  29470. *
  29471. * _.isNumber('3');
  29472. * // => false
  29473. */
  29474. function isNumber(value) {
  29475. return typeof value == 'number' ||
  29476. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29477. }
  29478. /**
  29479. * Checks if `value` is a plain object, that is, an object created by the
  29480. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29481. *
  29482. * @static
  29483. * @memberOf _
  29484. * @since 0.8.0
  29485. * @category Lang
  29486. * @param {*} value The value to check.
  29487. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29488. * @example
  29489. *
  29490. * function Foo() {
  29491. * this.a = 1;
  29492. * }
  29493. *
  29494. * _.isPlainObject(new Foo);
  29495. * // => false
  29496. *
  29497. * _.isPlainObject([1, 2, 3]);
  29498. * // => false
  29499. *
  29500. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29501. * // => true
  29502. *
  29503. * _.isPlainObject(Object.create(null));
  29504. * // => true
  29505. */
  29506. function isPlainObject(value) {
  29507. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29508. return false;
  29509. }
  29510. var proto = getPrototype(value);
  29511. if (proto === null) {
  29512. return true;
  29513. }
  29514. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29515. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29516. funcToString.call(Ctor) == objectCtorString;
  29517. }
  29518. /**
  29519. * Checks if `value` is classified as a `RegExp` object.
  29520. *
  29521. * @static
  29522. * @memberOf _
  29523. * @since 0.1.0
  29524. * @category Lang
  29525. * @param {*} value The value to check.
  29526. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29527. * @example
  29528. *
  29529. * _.isRegExp(/abc/);
  29530. * // => true
  29531. *
  29532. * _.isRegExp('/abc/');
  29533. * // => false
  29534. */
  29535. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29536. /**
  29537. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29538. * double precision number which isn't the result of a rounded unsafe integer.
  29539. *
  29540. * **Note:** This method is based on
  29541. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29542. *
  29543. * @static
  29544. * @memberOf _
  29545. * @since 4.0.0
  29546. * @category Lang
  29547. * @param {*} value The value to check.
  29548. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29549. * @example
  29550. *
  29551. * _.isSafeInteger(3);
  29552. * // => true
  29553. *
  29554. * _.isSafeInteger(Number.MIN_VALUE);
  29555. * // => false
  29556. *
  29557. * _.isSafeInteger(Infinity);
  29558. * // => false
  29559. *
  29560. * _.isSafeInteger('3');
  29561. * // => false
  29562. */
  29563. function isSafeInteger(value) {
  29564. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29565. }
  29566. /**
  29567. * Checks if `value` is classified as a `Set` object.
  29568. *
  29569. * @static
  29570. * @memberOf _
  29571. * @since 4.3.0
  29572. * @category Lang
  29573. * @param {*} value The value to check.
  29574. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29575. * @example
  29576. *
  29577. * _.isSet(new Set);
  29578. * // => true
  29579. *
  29580. * _.isSet(new WeakSet);
  29581. * // => false
  29582. */
  29583. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29584. /**
  29585. * Checks if `value` is classified as a `String` primitive or object.
  29586. *
  29587. * @static
  29588. * @since 0.1.0
  29589. * @memberOf _
  29590. * @category Lang
  29591. * @param {*} value The value to check.
  29592. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29593. * @example
  29594. *
  29595. * _.isString('abc');
  29596. * // => true
  29597. *
  29598. * _.isString(1);
  29599. * // => false
  29600. */
  29601. function isString(value) {
  29602. return typeof value == 'string' ||
  29603. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29604. }
  29605. /**
  29606. * Checks if `value` is classified as a `Symbol` primitive or object.
  29607. *
  29608. * @static
  29609. * @memberOf _
  29610. * @since 4.0.0
  29611. * @category Lang
  29612. * @param {*} value The value to check.
  29613. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29614. * @example
  29615. *
  29616. * _.isSymbol(Symbol.iterator);
  29617. * // => true
  29618. *
  29619. * _.isSymbol('abc');
  29620. * // => false
  29621. */
  29622. function isSymbol(value) {
  29623. return typeof value == 'symbol' ||
  29624. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29625. }
  29626. /**
  29627. * Checks if `value` is classified as a typed array.
  29628. *
  29629. * @static
  29630. * @memberOf _
  29631. * @since 3.0.0
  29632. * @category Lang
  29633. * @param {*} value The value to check.
  29634. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29635. * @example
  29636. *
  29637. * _.isTypedArray(new Uint8Array);
  29638. * // => true
  29639. *
  29640. * _.isTypedArray([]);
  29641. * // => false
  29642. */
  29643. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29644. /**
  29645. * Checks if `value` is `undefined`.
  29646. *
  29647. * @static
  29648. * @since 0.1.0
  29649. * @memberOf _
  29650. * @category Lang
  29651. * @param {*} value The value to check.
  29652. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29653. * @example
  29654. *
  29655. * _.isUndefined(void 0);
  29656. * // => true
  29657. *
  29658. * _.isUndefined(null);
  29659. * // => false
  29660. */
  29661. function isUndefined(value) {
  29662. return value === undefined;
  29663. }
  29664. /**
  29665. * Checks if `value` is classified as a `WeakMap` object.
  29666. *
  29667. * @static
  29668. * @memberOf _
  29669. * @since 4.3.0
  29670. * @category Lang
  29671. * @param {*} value The value to check.
  29672. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29673. * @example
  29674. *
  29675. * _.isWeakMap(new WeakMap);
  29676. * // => true
  29677. *
  29678. * _.isWeakMap(new Map);
  29679. * // => false
  29680. */
  29681. function isWeakMap(value) {
  29682. return isObjectLike(value) && getTag(value) == weakMapTag;
  29683. }
  29684. /**
  29685. * Checks if `value` is classified as a `WeakSet` object.
  29686. *
  29687. * @static
  29688. * @memberOf _
  29689. * @since 4.3.0
  29690. * @category Lang
  29691. * @param {*} value The value to check.
  29692. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29693. * @example
  29694. *
  29695. * _.isWeakSet(new WeakSet);
  29696. * // => true
  29697. *
  29698. * _.isWeakSet(new Set);
  29699. * // => false
  29700. */
  29701. function isWeakSet(value) {
  29702. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29703. }
  29704. /**
  29705. * Checks if `value` is less than `other`.
  29706. *
  29707. * @static
  29708. * @memberOf _
  29709. * @since 3.9.0
  29710. * @category Lang
  29711. * @param {*} value The value to compare.
  29712. * @param {*} other The other value to compare.
  29713. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29714. * else `false`.
  29715. * @see _.gt
  29716. * @example
  29717. *
  29718. * _.lt(1, 3);
  29719. * // => true
  29720. *
  29721. * _.lt(3, 3);
  29722. * // => false
  29723. *
  29724. * _.lt(3, 1);
  29725. * // => false
  29726. */
  29727. var lt = createRelationalOperation(baseLt);
  29728. /**
  29729. * Checks if `value` is less than or equal to `other`.
  29730. *
  29731. * @static
  29732. * @memberOf _
  29733. * @since 3.9.0
  29734. * @category Lang
  29735. * @param {*} value The value to compare.
  29736. * @param {*} other The other value to compare.
  29737. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29738. * `other`, else `false`.
  29739. * @see _.gte
  29740. * @example
  29741. *
  29742. * _.lte(1, 3);
  29743. * // => true
  29744. *
  29745. * _.lte(3, 3);
  29746. * // => true
  29747. *
  29748. * _.lte(3, 1);
  29749. * // => false
  29750. */
  29751. var lte = createRelationalOperation(function(value, other) {
  29752. return value <= other;
  29753. });
  29754. /**
  29755. * Converts `value` to an array.
  29756. *
  29757. * @static
  29758. * @since 0.1.0
  29759. * @memberOf _
  29760. * @category Lang
  29761. * @param {*} value The value to convert.
  29762. * @returns {Array} Returns the converted array.
  29763. * @example
  29764. *
  29765. * _.toArray({ 'a': 1, 'b': 2 });
  29766. * // => [1, 2]
  29767. *
  29768. * _.toArray('abc');
  29769. * // => ['a', 'b', 'c']
  29770. *
  29771. * _.toArray(1);
  29772. * // => []
  29773. *
  29774. * _.toArray(null);
  29775. * // => []
  29776. */
  29777. function toArray(value) {
  29778. if (!value) {
  29779. return [];
  29780. }
  29781. if (isArrayLike(value)) {
  29782. return isString(value) ? stringToArray(value) : copyArray(value);
  29783. }
  29784. if (symIterator && value[symIterator]) {
  29785. return iteratorToArray(value[symIterator]());
  29786. }
  29787. var tag = getTag(value),
  29788. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29789. return func(value);
  29790. }
  29791. /**
  29792. * Converts `value` to a finite number.
  29793. *
  29794. * @static
  29795. * @memberOf _
  29796. * @since 4.12.0
  29797. * @category Lang
  29798. * @param {*} value The value to convert.
  29799. * @returns {number} Returns the converted number.
  29800. * @example
  29801. *
  29802. * _.toFinite(3.2);
  29803. * // => 3.2
  29804. *
  29805. * _.toFinite(Number.MIN_VALUE);
  29806. * // => 5e-324
  29807. *
  29808. * _.toFinite(Infinity);
  29809. * // => 1.7976931348623157e+308
  29810. *
  29811. * _.toFinite('3.2');
  29812. * // => 3.2
  29813. */
  29814. function toFinite(value) {
  29815. if (!value) {
  29816. return value === 0 ? value : 0;
  29817. }
  29818. value = toNumber(value);
  29819. if (value === INFINITY || value === -INFINITY) {
  29820. var sign = (value < 0 ? -1 : 1);
  29821. return sign * MAX_INTEGER;
  29822. }
  29823. return value === value ? value : 0;
  29824. }
  29825. /**
  29826. * Converts `value` to an integer.
  29827. *
  29828. * **Note:** This method is loosely based on
  29829. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29830. *
  29831. * @static
  29832. * @memberOf _
  29833. * @since 4.0.0
  29834. * @category Lang
  29835. * @param {*} value The value to convert.
  29836. * @returns {number} Returns the converted integer.
  29837. * @example
  29838. *
  29839. * _.toInteger(3.2);
  29840. * // => 3
  29841. *
  29842. * _.toInteger(Number.MIN_VALUE);
  29843. * // => 0
  29844. *
  29845. * _.toInteger(Infinity);
  29846. * // => 1.7976931348623157e+308
  29847. *
  29848. * _.toInteger('3.2');
  29849. * // => 3
  29850. */
  29851. function toInteger(value) {
  29852. var result = toFinite(value),
  29853. remainder = result % 1;
  29854. return result === result ? (remainder ? result - remainder : result) : 0;
  29855. }
  29856. /**
  29857. * Converts `value` to an integer suitable for use as the length of an
  29858. * array-like object.
  29859. *
  29860. * **Note:** This method is based on
  29861. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29862. *
  29863. * @static
  29864. * @memberOf _
  29865. * @since 4.0.0
  29866. * @category Lang
  29867. * @param {*} value The value to convert.
  29868. * @returns {number} Returns the converted integer.
  29869. * @example
  29870. *
  29871. * _.toLength(3.2);
  29872. * // => 3
  29873. *
  29874. * _.toLength(Number.MIN_VALUE);
  29875. * // => 0
  29876. *
  29877. * _.toLength(Infinity);
  29878. * // => 4294967295
  29879. *
  29880. * _.toLength('3.2');
  29881. * // => 3
  29882. */
  29883. function toLength(value) {
  29884. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29885. }
  29886. /**
  29887. * Converts `value` to a number.
  29888. *
  29889. * @static
  29890. * @memberOf _
  29891. * @since 4.0.0
  29892. * @category Lang
  29893. * @param {*} value The value to process.
  29894. * @returns {number} Returns the number.
  29895. * @example
  29896. *
  29897. * _.toNumber(3.2);
  29898. * // => 3.2
  29899. *
  29900. * _.toNumber(Number.MIN_VALUE);
  29901. * // => 5e-324
  29902. *
  29903. * _.toNumber(Infinity);
  29904. * // => Infinity
  29905. *
  29906. * _.toNumber('3.2');
  29907. * // => 3.2
  29908. */
  29909. function toNumber(value) {
  29910. if (typeof value == 'number') {
  29911. return value;
  29912. }
  29913. if (isSymbol(value)) {
  29914. return NAN;
  29915. }
  29916. if (isObject(value)) {
  29917. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29918. value = isObject(other) ? (other + '') : other;
  29919. }
  29920. if (typeof value != 'string') {
  29921. return value === 0 ? value : +value;
  29922. }
  29923. value = value.replace(reTrim, '');
  29924. var isBinary = reIsBinary.test(value);
  29925. return (isBinary || reIsOctal.test(value))
  29926. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29927. : (reIsBadHex.test(value) ? NAN : +value);
  29928. }
  29929. /**
  29930. * Converts `value` to a plain object flattening inherited enumerable string
  29931. * keyed properties of `value` to own properties of the plain object.
  29932. *
  29933. * @static
  29934. * @memberOf _
  29935. * @since 3.0.0
  29936. * @category Lang
  29937. * @param {*} value The value to convert.
  29938. * @returns {Object} Returns the converted plain object.
  29939. * @example
  29940. *
  29941. * function Foo() {
  29942. * this.b = 2;
  29943. * }
  29944. *
  29945. * Foo.prototype.c = 3;
  29946. *
  29947. * _.assign({ 'a': 1 }, new Foo);
  29948. * // => { 'a': 1, 'b': 2 }
  29949. *
  29950. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29951. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29952. */
  29953. function toPlainObject(value) {
  29954. return copyObject(value, keysIn(value));
  29955. }
  29956. /**
  29957. * Converts `value` to a safe integer. A safe integer can be compared and
  29958. * represented correctly.
  29959. *
  29960. * @static
  29961. * @memberOf _
  29962. * @since 4.0.0
  29963. * @category Lang
  29964. * @param {*} value The value to convert.
  29965. * @returns {number} Returns the converted integer.
  29966. * @example
  29967. *
  29968. * _.toSafeInteger(3.2);
  29969. * // => 3
  29970. *
  29971. * _.toSafeInteger(Number.MIN_VALUE);
  29972. * // => 0
  29973. *
  29974. * _.toSafeInteger(Infinity);
  29975. * // => 9007199254740991
  29976. *
  29977. * _.toSafeInteger('3.2');
  29978. * // => 3
  29979. */
  29980. function toSafeInteger(value) {
  29981. return value
  29982. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  29983. : (value === 0 ? value : 0);
  29984. }
  29985. /**
  29986. * Converts `value` to a string. An empty string is returned for `null`
  29987. * and `undefined` values. The sign of `-0` is preserved.
  29988. *
  29989. * @static
  29990. * @memberOf _
  29991. * @since 4.0.0
  29992. * @category Lang
  29993. * @param {*} value The value to convert.
  29994. * @returns {string} Returns the converted string.
  29995. * @example
  29996. *
  29997. * _.toString(null);
  29998. * // => ''
  29999. *
  30000. * _.toString(-0);
  30001. * // => '-0'
  30002. *
  30003. * _.toString([1, 2, 3]);
  30004. * // => '1,2,3'
  30005. */
  30006. function toString(value) {
  30007. return value == null ? '' : baseToString(value);
  30008. }
  30009. /*------------------------------------------------------------------------*/
  30010. /**
  30011. * Assigns own enumerable string keyed properties of source objects to the
  30012. * destination object. Source objects are applied from left to right.
  30013. * Subsequent sources overwrite property assignments of previous sources.
  30014. *
  30015. * **Note:** This method mutates `object` and is loosely based on
  30016. * [`Object.assign`](https://mdn.io/Object/assign).
  30017. *
  30018. * @static
  30019. * @memberOf _
  30020. * @since 0.10.0
  30021. * @category Object
  30022. * @param {Object} object The destination object.
  30023. * @param {...Object} [sources] The source objects.
  30024. * @returns {Object} Returns `object`.
  30025. * @see _.assignIn
  30026. * @example
  30027. *
  30028. * function Foo() {
  30029. * this.a = 1;
  30030. * }
  30031. *
  30032. * function Bar() {
  30033. * this.c = 3;
  30034. * }
  30035. *
  30036. * Foo.prototype.b = 2;
  30037. * Bar.prototype.d = 4;
  30038. *
  30039. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30040. * // => { 'a': 1, 'c': 3 }
  30041. */
  30042. var assign = createAssigner(function(object, source) {
  30043. if (isPrototype(source) || isArrayLike(source)) {
  30044. copyObject(source, keys(source), object);
  30045. return;
  30046. }
  30047. for (var key in source) {
  30048. if (hasOwnProperty.call(source, key)) {
  30049. assignValue(object, key, source[key]);
  30050. }
  30051. }
  30052. });
  30053. /**
  30054. * This method is like `_.assign` except that it iterates over own and
  30055. * inherited source properties.
  30056. *
  30057. * **Note:** This method mutates `object`.
  30058. *
  30059. * @static
  30060. * @memberOf _
  30061. * @since 4.0.0
  30062. * @alias extend
  30063. * @category Object
  30064. * @param {Object} object The destination object.
  30065. * @param {...Object} [sources] The source objects.
  30066. * @returns {Object} Returns `object`.
  30067. * @see _.assign
  30068. * @example
  30069. *
  30070. * function Foo() {
  30071. * this.a = 1;
  30072. * }
  30073. *
  30074. * function Bar() {
  30075. * this.c = 3;
  30076. * }
  30077. *
  30078. * Foo.prototype.b = 2;
  30079. * Bar.prototype.d = 4;
  30080. *
  30081. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30082. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30083. */
  30084. var assignIn = createAssigner(function(object, source) {
  30085. copyObject(source, keysIn(source), object);
  30086. });
  30087. /**
  30088. * This method is like `_.assignIn` except that it accepts `customizer`
  30089. * which is invoked to produce the assigned values. If `customizer` returns
  30090. * `undefined`, assignment is handled by the method instead. The `customizer`
  30091. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30092. *
  30093. * **Note:** This method mutates `object`.
  30094. *
  30095. * @static
  30096. * @memberOf _
  30097. * @since 4.0.0
  30098. * @alias extendWith
  30099. * @category Object
  30100. * @param {Object} object The destination object.
  30101. * @param {...Object} sources The source objects.
  30102. * @param {Function} [customizer] The function to customize assigned values.
  30103. * @returns {Object} Returns `object`.
  30104. * @see _.assignWith
  30105. * @example
  30106. *
  30107. * function customizer(objValue, srcValue) {
  30108. * return _.isUndefined(objValue) ? srcValue : objValue;
  30109. * }
  30110. *
  30111. * var defaults = _.partialRight(_.assignInWith, customizer);
  30112. *
  30113. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30114. * // => { 'a': 1, 'b': 2 }
  30115. */
  30116. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30117. copyObject(source, keysIn(source), object, customizer);
  30118. });
  30119. /**
  30120. * This method is like `_.assign` except that it accepts `customizer`
  30121. * which is invoked to produce the assigned values. If `customizer` returns
  30122. * `undefined`, assignment is handled by the method instead. The `customizer`
  30123. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30124. *
  30125. * **Note:** This method mutates `object`.
  30126. *
  30127. * @static
  30128. * @memberOf _
  30129. * @since 4.0.0
  30130. * @category Object
  30131. * @param {Object} object The destination object.
  30132. * @param {...Object} sources The source objects.
  30133. * @param {Function} [customizer] The function to customize assigned values.
  30134. * @returns {Object} Returns `object`.
  30135. * @see _.assignInWith
  30136. * @example
  30137. *
  30138. * function customizer(objValue, srcValue) {
  30139. * return _.isUndefined(objValue) ? srcValue : objValue;
  30140. * }
  30141. *
  30142. * var defaults = _.partialRight(_.assignWith, customizer);
  30143. *
  30144. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30145. * // => { 'a': 1, 'b': 2 }
  30146. */
  30147. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30148. copyObject(source, keys(source), object, customizer);
  30149. });
  30150. /**
  30151. * Creates an array of values corresponding to `paths` of `object`.
  30152. *
  30153. * @static
  30154. * @memberOf _
  30155. * @since 1.0.0
  30156. * @category Object
  30157. * @param {Object} object The object to iterate over.
  30158. * @param {...(string|string[])} [paths] The property paths to pick.
  30159. * @returns {Array} Returns the picked values.
  30160. * @example
  30161. *
  30162. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30163. *
  30164. * _.at(object, ['a[0].b.c', 'a[1]']);
  30165. * // => [3, 4]
  30166. */
  30167. var at = flatRest(baseAt);
  30168. /**
  30169. * Creates an object that inherits from the `prototype` object. If a
  30170. * `properties` object is given, its own enumerable string keyed properties
  30171. * are assigned to the created object.
  30172. *
  30173. * @static
  30174. * @memberOf _
  30175. * @since 2.3.0
  30176. * @category Object
  30177. * @param {Object} prototype The object to inherit from.
  30178. * @param {Object} [properties] The properties to assign to the object.
  30179. * @returns {Object} Returns the new object.
  30180. * @example
  30181. *
  30182. * function Shape() {
  30183. * this.x = 0;
  30184. * this.y = 0;
  30185. * }
  30186. *
  30187. * function Circle() {
  30188. * Shape.call(this);
  30189. * }
  30190. *
  30191. * Circle.prototype = _.create(Shape.prototype, {
  30192. * 'constructor': Circle
  30193. * });
  30194. *
  30195. * var circle = new Circle;
  30196. * circle instanceof Circle;
  30197. * // => true
  30198. *
  30199. * circle instanceof Shape;
  30200. * // => true
  30201. */
  30202. function create(prototype, properties) {
  30203. var result = baseCreate(prototype);
  30204. return properties == null ? result : baseAssign(result, properties);
  30205. }
  30206. /**
  30207. * Assigns own and inherited enumerable string keyed properties of source
  30208. * objects to the destination object for all destination properties that
  30209. * resolve to `undefined`. Source objects are applied from left to right.
  30210. * Once a property is set, additional values of the same property are ignored.
  30211. *
  30212. * **Note:** This method mutates `object`.
  30213. *
  30214. * @static
  30215. * @since 0.1.0
  30216. * @memberOf _
  30217. * @category Object
  30218. * @param {Object} object The destination object.
  30219. * @param {...Object} [sources] The source objects.
  30220. * @returns {Object} Returns `object`.
  30221. * @see _.defaultsDeep
  30222. * @example
  30223. *
  30224. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30225. * // => { 'a': 1, 'b': 2 }
  30226. */
  30227. var defaults = baseRest(function(object, sources) {
  30228. object = Object(object);
  30229. var index = -1;
  30230. var length = sources.length;
  30231. var guard = length > 2 ? sources[2] : undefined;
  30232. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30233. length = 1;
  30234. }
  30235. while (++index < length) {
  30236. var source = sources[index];
  30237. var props = keysIn(source);
  30238. var propsIndex = -1;
  30239. var propsLength = props.length;
  30240. while (++propsIndex < propsLength) {
  30241. var key = props[propsIndex];
  30242. var value = object[key];
  30243. if (value === undefined ||
  30244. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30245. object[key] = source[key];
  30246. }
  30247. }
  30248. }
  30249. return object;
  30250. });
  30251. /**
  30252. * This method is like `_.defaults` except that it recursively assigns
  30253. * default properties.
  30254. *
  30255. * **Note:** This method mutates `object`.
  30256. *
  30257. * @static
  30258. * @memberOf _
  30259. * @since 3.10.0
  30260. * @category Object
  30261. * @param {Object} object The destination object.
  30262. * @param {...Object} [sources] The source objects.
  30263. * @returns {Object} Returns `object`.
  30264. * @see _.defaults
  30265. * @example
  30266. *
  30267. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30268. * // => { 'a': { 'b': 2, 'c': 3 } }
  30269. */
  30270. var defaultsDeep = baseRest(function(args) {
  30271. args.push(undefined, customDefaultsMerge);
  30272. return apply(mergeWith, undefined, args);
  30273. });
  30274. /**
  30275. * This method is like `_.find` except that it returns the key of the first
  30276. * element `predicate` returns truthy for instead of the element itself.
  30277. *
  30278. * @static
  30279. * @memberOf _
  30280. * @since 1.1.0
  30281. * @category Object
  30282. * @param {Object} object The object to inspect.
  30283. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30284. * @returns {string|undefined} Returns the key of the matched element,
  30285. * else `undefined`.
  30286. * @example
  30287. *
  30288. * var users = {
  30289. * 'barney': { 'age': 36, 'active': true },
  30290. * 'fred': { 'age': 40, 'active': false },
  30291. * 'pebbles': { 'age': 1, 'active': true }
  30292. * };
  30293. *
  30294. * _.findKey(users, function(o) { return o.age < 40; });
  30295. * // => 'barney' (iteration order is not guaranteed)
  30296. *
  30297. * // The `_.matches` iteratee shorthand.
  30298. * _.findKey(users, { 'age': 1, 'active': true });
  30299. * // => 'pebbles'
  30300. *
  30301. * // The `_.matchesProperty` iteratee shorthand.
  30302. * _.findKey(users, ['active', false]);
  30303. * // => 'fred'
  30304. *
  30305. * // The `_.property` iteratee shorthand.
  30306. * _.findKey(users, 'active');
  30307. * // => 'barney'
  30308. */
  30309. function findKey(object, predicate) {
  30310. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30311. }
  30312. /**
  30313. * This method is like `_.findKey` except that it iterates over elements of
  30314. * a collection in the opposite order.
  30315. *
  30316. * @static
  30317. * @memberOf _
  30318. * @since 2.0.0
  30319. * @category Object
  30320. * @param {Object} object The object to inspect.
  30321. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30322. * @returns {string|undefined} Returns the key of the matched element,
  30323. * else `undefined`.
  30324. * @example
  30325. *
  30326. * var users = {
  30327. * 'barney': { 'age': 36, 'active': true },
  30328. * 'fred': { 'age': 40, 'active': false },
  30329. * 'pebbles': { 'age': 1, 'active': true }
  30330. * };
  30331. *
  30332. * _.findLastKey(users, function(o) { return o.age < 40; });
  30333. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30334. *
  30335. * // The `_.matches` iteratee shorthand.
  30336. * _.findLastKey(users, { 'age': 36, 'active': true });
  30337. * // => 'barney'
  30338. *
  30339. * // The `_.matchesProperty` iteratee shorthand.
  30340. * _.findLastKey(users, ['active', false]);
  30341. * // => 'fred'
  30342. *
  30343. * // The `_.property` iteratee shorthand.
  30344. * _.findLastKey(users, 'active');
  30345. * // => 'pebbles'
  30346. */
  30347. function findLastKey(object, predicate) {
  30348. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30349. }
  30350. /**
  30351. * Iterates over own and inherited enumerable string keyed properties of an
  30352. * object and invokes `iteratee` for each property. The iteratee is invoked
  30353. * with three arguments: (value, key, object). Iteratee functions may exit
  30354. * iteration early by explicitly returning `false`.
  30355. *
  30356. * @static
  30357. * @memberOf _
  30358. * @since 0.3.0
  30359. * @category Object
  30360. * @param {Object} object The object to iterate over.
  30361. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30362. * @returns {Object} Returns `object`.
  30363. * @see _.forInRight
  30364. * @example
  30365. *
  30366. * function Foo() {
  30367. * this.a = 1;
  30368. * this.b = 2;
  30369. * }
  30370. *
  30371. * Foo.prototype.c = 3;
  30372. *
  30373. * _.forIn(new Foo, function(value, key) {
  30374. * console.log(key);
  30375. * });
  30376. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30377. */
  30378. function forIn(object, iteratee) {
  30379. return object == null
  30380. ? object
  30381. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30382. }
  30383. /**
  30384. * This method is like `_.forIn` except that it iterates over properties of
  30385. * `object` in the opposite order.
  30386. *
  30387. * @static
  30388. * @memberOf _
  30389. * @since 2.0.0
  30390. * @category Object
  30391. * @param {Object} object The object to iterate over.
  30392. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30393. * @returns {Object} Returns `object`.
  30394. * @see _.forIn
  30395. * @example
  30396. *
  30397. * function Foo() {
  30398. * this.a = 1;
  30399. * this.b = 2;
  30400. * }
  30401. *
  30402. * Foo.prototype.c = 3;
  30403. *
  30404. * _.forInRight(new Foo, function(value, key) {
  30405. * console.log(key);
  30406. * });
  30407. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30408. */
  30409. function forInRight(object, iteratee) {
  30410. return object == null
  30411. ? object
  30412. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30413. }
  30414. /**
  30415. * Iterates over own enumerable string keyed properties of an object and
  30416. * invokes `iteratee` for each property. The iteratee is invoked with three
  30417. * arguments: (value, key, object). Iteratee functions may exit iteration
  30418. * early by explicitly returning `false`.
  30419. *
  30420. * @static
  30421. * @memberOf _
  30422. * @since 0.3.0
  30423. * @category Object
  30424. * @param {Object} object The object to iterate over.
  30425. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30426. * @returns {Object} Returns `object`.
  30427. * @see _.forOwnRight
  30428. * @example
  30429. *
  30430. * function Foo() {
  30431. * this.a = 1;
  30432. * this.b = 2;
  30433. * }
  30434. *
  30435. * Foo.prototype.c = 3;
  30436. *
  30437. * _.forOwn(new Foo, function(value, key) {
  30438. * console.log(key);
  30439. * });
  30440. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30441. */
  30442. function forOwn(object, iteratee) {
  30443. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30444. }
  30445. /**
  30446. * This method is like `_.forOwn` except that it iterates over properties of
  30447. * `object` in the opposite order.
  30448. *
  30449. * @static
  30450. * @memberOf _
  30451. * @since 2.0.0
  30452. * @category Object
  30453. * @param {Object} object The object to iterate over.
  30454. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30455. * @returns {Object} Returns `object`.
  30456. * @see _.forOwn
  30457. * @example
  30458. *
  30459. * function Foo() {
  30460. * this.a = 1;
  30461. * this.b = 2;
  30462. * }
  30463. *
  30464. * Foo.prototype.c = 3;
  30465. *
  30466. * _.forOwnRight(new Foo, function(value, key) {
  30467. * console.log(key);
  30468. * });
  30469. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30470. */
  30471. function forOwnRight(object, iteratee) {
  30472. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30473. }
  30474. /**
  30475. * Creates an array of function property names from own enumerable properties
  30476. * of `object`.
  30477. *
  30478. * @static
  30479. * @since 0.1.0
  30480. * @memberOf _
  30481. * @category Object
  30482. * @param {Object} object The object to inspect.
  30483. * @returns {Array} Returns the function names.
  30484. * @see _.functionsIn
  30485. * @example
  30486. *
  30487. * function Foo() {
  30488. * this.a = _.constant('a');
  30489. * this.b = _.constant('b');
  30490. * }
  30491. *
  30492. * Foo.prototype.c = _.constant('c');
  30493. *
  30494. * _.functions(new Foo);
  30495. * // => ['a', 'b']
  30496. */
  30497. function functions(object) {
  30498. return object == null ? [] : baseFunctions(object, keys(object));
  30499. }
  30500. /**
  30501. * Creates an array of function property names from own and inherited
  30502. * enumerable properties of `object`.
  30503. *
  30504. * @static
  30505. * @memberOf _
  30506. * @since 4.0.0
  30507. * @category Object
  30508. * @param {Object} object The object to inspect.
  30509. * @returns {Array} Returns the function names.
  30510. * @see _.functions
  30511. * @example
  30512. *
  30513. * function Foo() {
  30514. * this.a = _.constant('a');
  30515. * this.b = _.constant('b');
  30516. * }
  30517. *
  30518. * Foo.prototype.c = _.constant('c');
  30519. *
  30520. * _.functionsIn(new Foo);
  30521. * // => ['a', 'b', 'c']
  30522. */
  30523. function functionsIn(object) {
  30524. return object == null ? [] : baseFunctions(object, keysIn(object));
  30525. }
  30526. /**
  30527. * Gets the value at `path` of `object`. If the resolved value is
  30528. * `undefined`, the `defaultValue` is returned in its place.
  30529. *
  30530. * @static
  30531. * @memberOf _
  30532. * @since 3.7.0
  30533. * @category Object
  30534. * @param {Object} object The object to query.
  30535. * @param {Array|string} path The path of the property to get.
  30536. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30537. * @returns {*} Returns the resolved value.
  30538. * @example
  30539. *
  30540. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30541. *
  30542. * _.get(object, 'a[0].b.c');
  30543. * // => 3
  30544. *
  30545. * _.get(object, ['a', '0', 'b', 'c']);
  30546. * // => 3
  30547. *
  30548. * _.get(object, 'a.b.c', 'default');
  30549. * // => 'default'
  30550. */
  30551. function get(object, path, defaultValue) {
  30552. var result = object == null ? undefined : baseGet(object, path);
  30553. return result === undefined ? defaultValue : result;
  30554. }
  30555. /**
  30556. * Checks if `path` is a direct property of `object`.
  30557. *
  30558. * @static
  30559. * @since 0.1.0
  30560. * @memberOf _
  30561. * @category Object
  30562. * @param {Object} object The object to query.
  30563. * @param {Array|string} path The path to check.
  30564. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30565. * @example
  30566. *
  30567. * var object = { 'a': { 'b': 2 } };
  30568. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30569. *
  30570. * _.has(object, 'a');
  30571. * // => true
  30572. *
  30573. * _.has(object, 'a.b');
  30574. * // => true
  30575. *
  30576. * _.has(object, ['a', 'b']);
  30577. * // => true
  30578. *
  30579. * _.has(other, 'a');
  30580. * // => false
  30581. */
  30582. function has(object, path) {
  30583. return object != null && hasPath(object, path, baseHas);
  30584. }
  30585. /**
  30586. * Checks if `path` is a direct or inherited property of `object`.
  30587. *
  30588. * @static
  30589. * @memberOf _
  30590. * @since 4.0.0
  30591. * @category Object
  30592. * @param {Object} object The object to query.
  30593. * @param {Array|string} path The path to check.
  30594. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30595. * @example
  30596. *
  30597. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30598. *
  30599. * _.hasIn(object, 'a');
  30600. * // => true
  30601. *
  30602. * _.hasIn(object, 'a.b');
  30603. * // => true
  30604. *
  30605. * _.hasIn(object, ['a', 'b']);
  30606. * // => true
  30607. *
  30608. * _.hasIn(object, 'b');
  30609. * // => false
  30610. */
  30611. function hasIn(object, path) {
  30612. return object != null && hasPath(object, path, baseHasIn);
  30613. }
  30614. /**
  30615. * Creates an object composed of the inverted keys and values of `object`.
  30616. * If `object` contains duplicate values, subsequent values overwrite
  30617. * property assignments of previous values.
  30618. *
  30619. * @static
  30620. * @memberOf _
  30621. * @since 0.7.0
  30622. * @category Object
  30623. * @param {Object} object The object to invert.
  30624. * @returns {Object} Returns the new inverted object.
  30625. * @example
  30626. *
  30627. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30628. *
  30629. * _.invert(object);
  30630. * // => { '1': 'c', '2': 'b' }
  30631. */
  30632. var invert = createInverter(function(result, value, key) {
  30633. if (value != null &&
  30634. typeof value.toString != 'function') {
  30635. value = nativeObjectToString.call(value);
  30636. }
  30637. result[value] = key;
  30638. }, constant(identity));
  30639. /**
  30640. * This method is like `_.invert` except that the inverted object is generated
  30641. * from the results of running each element of `object` thru `iteratee`. The
  30642. * corresponding inverted value of each inverted key is an array of keys
  30643. * responsible for generating the inverted value. The iteratee is invoked
  30644. * with one argument: (value).
  30645. *
  30646. * @static
  30647. * @memberOf _
  30648. * @since 4.1.0
  30649. * @category Object
  30650. * @param {Object} object The object to invert.
  30651. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30652. * @returns {Object} Returns the new inverted object.
  30653. * @example
  30654. *
  30655. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30656. *
  30657. * _.invertBy(object);
  30658. * // => { '1': ['a', 'c'], '2': ['b'] }
  30659. *
  30660. * _.invertBy(object, function(value) {
  30661. * return 'group' + value;
  30662. * });
  30663. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30664. */
  30665. var invertBy = createInverter(function(result, value, key) {
  30666. if (value != null &&
  30667. typeof value.toString != 'function') {
  30668. value = nativeObjectToString.call(value);
  30669. }
  30670. if (hasOwnProperty.call(result, value)) {
  30671. result[value].push(key);
  30672. } else {
  30673. result[value] = [key];
  30674. }
  30675. }, getIteratee);
  30676. /**
  30677. * Invokes the method at `path` of `object`.
  30678. *
  30679. * @static
  30680. * @memberOf _
  30681. * @since 4.0.0
  30682. * @category Object
  30683. * @param {Object} object The object to query.
  30684. * @param {Array|string} path The path of the method to invoke.
  30685. * @param {...*} [args] The arguments to invoke the method with.
  30686. * @returns {*} Returns the result of the invoked method.
  30687. * @example
  30688. *
  30689. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30690. *
  30691. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30692. * // => [2, 3]
  30693. */
  30694. var invoke = baseRest(baseInvoke);
  30695. /**
  30696. * Creates an array of the own enumerable property names of `object`.
  30697. *
  30698. * **Note:** Non-object values are coerced to objects. See the
  30699. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30700. * for more details.
  30701. *
  30702. * @static
  30703. * @since 0.1.0
  30704. * @memberOf _
  30705. * @category Object
  30706. * @param {Object} object The object to query.
  30707. * @returns {Array} Returns the array of property names.
  30708. * @example
  30709. *
  30710. * function Foo() {
  30711. * this.a = 1;
  30712. * this.b = 2;
  30713. * }
  30714. *
  30715. * Foo.prototype.c = 3;
  30716. *
  30717. * _.keys(new Foo);
  30718. * // => ['a', 'b'] (iteration order is not guaranteed)
  30719. *
  30720. * _.keys('hi');
  30721. * // => ['0', '1']
  30722. */
  30723. function keys(object) {
  30724. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30725. }
  30726. /**
  30727. * Creates an array of the own and inherited enumerable property names of `object`.
  30728. *
  30729. * **Note:** Non-object values are coerced to objects.
  30730. *
  30731. * @static
  30732. * @memberOf _
  30733. * @since 3.0.0
  30734. * @category Object
  30735. * @param {Object} object The object to query.
  30736. * @returns {Array} Returns the array of property names.
  30737. * @example
  30738. *
  30739. * function Foo() {
  30740. * this.a = 1;
  30741. * this.b = 2;
  30742. * }
  30743. *
  30744. * Foo.prototype.c = 3;
  30745. *
  30746. * _.keysIn(new Foo);
  30747. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30748. */
  30749. function keysIn(object) {
  30750. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30751. }
  30752. /**
  30753. * The opposite of `_.mapValues`; this method creates an object with the
  30754. * same values as `object` and keys generated by running each own enumerable
  30755. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30756. * with three arguments: (value, key, object).
  30757. *
  30758. * @static
  30759. * @memberOf _
  30760. * @since 3.8.0
  30761. * @category Object
  30762. * @param {Object} object The object to iterate over.
  30763. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30764. * @returns {Object} Returns the new mapped object.
  30765. * @see _.mapValues
  30766. * @example
  30767. *
  30768. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30769. * return key + value;
  30770. * });
  30771. * // => { 'a1': 1, 'b2': 2 }
  30772. */
  30773. function mapKeys(object, iteratee) {
  30774. var result = {};
  30775. iteratee = getIteratee(iteratee, 3);
  30776. baseForOwn(object, function(value, key, object) {
  30777. baseAssignValue(result, iteratee(value, key, object), value);
  30778. });
  30779. return result;
  30780. }
  30781. /**
  30782. * Creates an object with the same keys as `object` and values generated
  30783. * by running each own enumerable string keyed property of `object` thru
  30784. * `iteratee`. The iteratee is invoked with three arguments:
  30785. * (value, key, object).
  30786. *
  30787. * @static
  30788. * @memberOf _
  30789. * @since 2.4.0
  30790. * @category Object
  30791. * @param {Object} object The object to iterate over.
  30792. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30793. * @returns {Object} Returns the new mapped object.
  30794. * @see _.mapKeys
  30795. * @example
  30796. *
  30797. * var users = {
  30798. * 'fred': { 'user': 'fred', 'age': 40 },
  30799. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30800. * };
  30801. *
  30802. * _.mapValues(users, function(o) { return o.age; });
  30803. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30804. *
  30805. * // The `_.property` iteratee shorthand.
  30806. * _.mapValues(users, 'age');
  30807. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30808. */
  30809. function mapValues(object, iteratee) {
  30810. var result = {};
  30811. iteratee = getIteratee(iteratee, 3);
  30812. baseForOwn(object, function(value, key, object) {
  30813. baseAssignValue(result, key, iteratee(value, key, object));
  30814. });
  30815. return result;
  30816. }
  30817. /**
  30818. * This method is like `_.assign` except that it recursively merges own and
  30819. * inherited enumerable string keyed properties of source objects into the
  30820. * destination object. Source properties that resolve to `undefined` are
  30821. * skipped if a destination value exists. Array and plain object properties
  30822. * are merged recursively. Other objects and value types are overridden by
  30823. * assignment. Source objects are applied from left to right. Subsequent
  30824. * sources overwrite property assignments of previous sources.
  30825. *
  30826. * **Note:** This method mutates `object`.
  30827. *
  30828. * @static
  30829. * @memberOf _
  30830. * @since 0.5.0
  30831. * @category Object
  30832. * @param {Object} object The destination object.
  30833. * @param {...Object} [sources] The source objects.
  30834. * @returns {Object} Returns `object`.
  30835. * @example
  30836. *
  30837. * var object = {
  30838. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30839. * };
  30840. *
  30841. * var other = {
  30842. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30843. * };
  30844. *
  30845. * _.merge(object, other);
  30846. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30847. */
  30848. var merge = createAssigner(function(object, source, srcIndex) {
  30849. baseMerge(object, source, srcIndex);
  30850. });
  30851. /**
  30852. * This method is like `_.merge` except that it accepts `customizer` which
  30853. * is invoked to produce the merged values of the destination and source
  30854. * properties. If `customizer` returns `undefined`, merging is handled by the
  30855. * method instead. The `customizer` is invoked with six arguments:
  30856. * (objValue, srcValue, key, object, source, stack).
  30857. *
  30858. * **Note:** This method mutates `object`.
  30859. *
  30860. * @static
  30861. * @memberOf _
  30862. * @since 4.0.0
  30863. * @category Object
  30864. * @param {Object} object The destination object.
  30865. * @param {...Object} sources The source objects.
  30866. * @param {Function} customizer The function to customize assigned values.
  30867. * @returns {Object} Returns `object`.
  30868. * @example
  30869. *
  30870. * function customizer(objValue, srcValue) {
  30871. * if (_.isArray(objValue)) {
  30872. * return objValue.concat(srcValue);
  30873. * }
  30874. * }
  30875. *
  30876. * var object = { 'a': [1], 'b': [2] };
  30877. * var other = { 'a': [3], 'b': [4] };
  30878. *
  30879. * _.mergeWith(object, other, customizer);
  30880. * // => { 'a': [1, 3], 'b': [2, 4] }
  30881. */
  30882. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30883. baseMerge(object, source, srcIndex, customizer);
  30884. });
  30885. /**
  30886. * The opposite of `_.pick`; this method creates an object composed of the
  30887. * own and inherited enumerable property paths of `object` that are not omitted.
  30888. *
  30889. * **Note:** This method is considerably slower than `_.pick`.
  30890. *
  30891. * @static
  30892. * @since 0.1.0
  30893. * @memberOf _
  30894. * @category Object
  30895. * @param {Object} object The source object.
  30896. * @param {...(string|string[])} [paths] The property paths to omit.
  30897. * @returns {Object} Returns the new object.
  30898. * @example
  30899. *
  30900. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30901. *
  30902. * _.omit(object, ['a', 'c']);
  30903. * // => { 'b': '2' }
  30904. */
  30905. var omit = flatRest(function(object, paths) {
  30906. var result = {};
  30907. if (object == null) {
  30908. return result;
  30909. }
  30910. var isDeep = false;
  30911. paths = arrayMap(paths, function(path) {
  30912. path = castPath(path, object);
  30913. isDeep || (isDeep = path.length > 1);
  30914. return path;
  30915. });
  30916. copyObject(object, getAllKeysIn(object), result);
  30917. if (isDeep) {
  30918. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30919. }
  30920. var length = paths.length;
  30921. while (length--) {
  30922. baseUnset(result, paths[length]);
  30923. }
  30924. return result;
  30925. });
  30926. /**
  30927. * The opposite of `_.pickBy`; this method creates an object composed of
  30928. * the own and inherited enumerable string keyed properties of `object` that
  30929. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30930. * arguments: (value, key).
  30931. *
  30932. * @static
  30933. * @memberOf _
  30934. * @since 4.0.0
  30935. * @category Object
  30936. * @param {Object} object The source object.
  30937. * @param {Function} [predicate=_.identity] The function invoked per property.
  30938. * @returns {Object} Returns the new object.
  30939. * @example
  30940. *
  30941. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30942. *
  30943. * _.omitBy(object, _.isNumber);
  30944. * // => { 'b': '2' }
  30945. */
  30946. function omitBy(object, predicate) {
  30947. return pickBy(object, negate(getIteratee(predicate)));
  30948. }
  30949. /**
  30950. * Creates an object composed of the picked `object` properties.
  30951. *
  30952. * @static
  30953. * @since 0.1.0
  30954. * @memberOf _
  30955. * @category Object
  30956. * @param {Object} object The source object.
  30957. * @param {...(string|string[])} [paths] The property paths to pick.
  30958. * @returns {Object} Returns the new object.
  30959. * @example
  30960. *
  30961. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30962. *
  30963. * _.pick(object, ['a', 'c']);
  30964. * // => { 'a': 1, 'c': 3 }
  30965. */
  30966. var pick = flatRest(function(object, paths) {
  30967. return object == null ? {} : basePick(object, paths);
  30968. });
  30969. /**
  30970. * Creates an object composed of the `object` properties `predicate` returns
  30971. * truthy for. The predicate is invoked with two arguments: (value, key).
  30972. *
  30973. * @static
  30974. * @memberOf _
  30975. * @since 4.0.0
  30976. * @category Object
  30977. * @param {Object} object The source object.
  30978. * @param {Function} [predicate=_.identity] The function invoked per property.
  30979. * @returns {Object} Returns the new object.
  30980. * @example
  30981. *
  30982. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30983. *
  30984. * _.pickBy(object, _.isNumber);
  30985. * // => { 'a': 1, 'c': 3 }
  30986. */
  30987. function pickBy(object, predicate) {
  30988. if (object == null) {
  30989. return {};
  30990. }
  30991. var props = arrayMap(getAllKeysIn(object), function(prop) {
  30992. return [prop];
  30993. });
  30994. predicate = getIteratee(predicate);
  30995. return basePickBy(object, props, function(value, path) {
  30996. return predicate(value, path[0]);
  30997. });
  30998. }
  30999. /**
  31000. * This method is like `_.get` except that if the resolved value is a
  31001. * function it's invoked with the `this` binding of its parent object and
  31002. * its result is returned.
  31003. *
  31004. * @static
  31005. * @since 0.1.0
  31006. * @memberOf _
  31007. * @category Object
  31008. * @param {Object} object The object to query.
  31009. * @param {Array|string} path The path of the property to resolve.
  31010. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31011. * @returns {*} Returns the resolved value.
  31012. * @example
  31013. *
  31014. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31015. *
  31016. * _.result(object, 'a[0].b.c1');
  31017. * // => 3
  31018. *
  31019. * _.result(object, 'a[0].b.c2');
  31020. * // => 4
  31021. *
  31022. * _.result(object, 'a[0].b.c3', 'default');
  31023. * // => 'default'
  31024. *
  31025. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31026. * // => 'default'
  31027. */
  31028. function result(object, path, defaultValue) {
  31029. path = castPath(path, object);
  31030. var index = -1,
  31031. length = path.length;
  31032. // Ensure the loop is entered when path is empty.
  31033. if (!length) {
  31034. length = 1;
  31035. object = undefined;
  31036. }
  31037. while (++index < length) {
  31038. var value = object == null ? undefined : object[toKey(path[index])];
  31039. if (value === undefined) {
  31040. index = length;
  31041. value = defaultValue;
  31042. }
  31043. object = isFunction(value) ? value.call(object) : value;
  31044. }
  31045. return object;
  31046. }
  31047. /**
  31048. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31049. * it's created. Arrays are created for missing index properties while objects
  31050. * are created for all other missing properties. Use `_.setWith` to customize
  31051. * `path` creation.
  31052. *
  31053. * **Note:** This method mutates `object`.
  31054. *
  31055. * @static
  31056. * @memberOf _
  31057. * @since 3.7.0
  31058. * @category Object
  31059. * @param {Object} object The object to modify.
  31060. * @param {Array|string} path The path of the property to set.
  31061. * @param {*} value The value to set.
  31062. * @returns {Object} Returns `object`.
  31063. * @example
  31064. *
  31065. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31066. *
  31067. * _.set(object, 'a[0].b.c', 4);
  31068. * console.log(object.a[0].b.c);
  31069. * // => 4
  31070. *
  31071. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31072. * console.log(object.x[0].y.z);
  31073. * // => 5
  31074. */
  31075. function set(object, path, value) {
  31076. return object == null ? object : baseSet(object, path, value);
  31077. }
  31078. /**
  31079. * This method is like `_.set` except that it accepts `customizer` which is
  31080. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31081. * path creation is handled by the method instead. The `customizer` is invoked
  31082. * with three arguments: (nsValue, key, nsObject).
  31083. *
  31084. * **Note:** This method mutates `object`.
  31085. *
  31086. * @static
  31087. * @memberOf _
  31088. * @since 4.0.0
  31089. * @category Object
  31090. * @param {Object} object The object to modify.
  31091. * @param {Array|string} path The path of the property to set.
  31092. * @param {*} value The value to set.
  31093. * @param {Function} [customizer] The function to customize assigned values.
  31094. * @returns {Object} Returns `object`.
  31095. * @example
  31096. *
  31097. * var object = {};
  31098. *
  31099. * _.setWith(object, '[0][1]', 'a', Object);
  31100. * // => { '0': { '1': 'a' } }
  31101. */
  31102. function setWith(object, path, value, customizer) {
  31103. customizer = typeof customizer == 'function' ? customizer : undefined;
  31104. return object == null ? object : baseSet(object, path, value, customizer);
  31105. }
  31106. /**
  31107. * Creates an array of own enumerable string keyed-value pairs for `object`
  31108. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31109. * entries are returned.
  31110. *
  31111. * @static
  31112. * @memberOf _
  31113. * @since 4.0.0
  31114. * @alias entries
  31115. * @category Object
  31116. * @param {Object} object The object to query.
  31117. * @returns {Array} Returns the key-value pairs.
  31118. * @example
  31119. *
  31120. * function Foo() {
  31121. * this.a = 1;
  31122. * this.b = 2;
  31123. * }
  31124. *
  31125. * Foo.prototype.c = 3;
  31126. *
  31127. * _.toPairs(new Foo);
  31128. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31129. */
  31130. var toPairs = createToPairs(keys);
  31131. /**
  31132. * Creates an array of own and inherited enumerable string keyed-value pairs
  31133. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31134. * or set, its entries are returned.
  31135. *
  31136. * @static
  31137. * @memberOf _
  31138. * @since 4.0.0
  31139. * @alias entriesIn
  31140. * @category Object
  31141. * @param {Object} object The object to query.
  31142. * @returns {Array} Returns the key-value pairs.
  31143. * @example
  31144. *
  31145. * function Foo() {
  31146. * this.a = 1;
  31147. * this.b = 2;
  31148. * }
  31149. *
  31150. * Foo.prototype.c = 3;
  31151. *
  31152. * _.toPairsIn(new Foo);
  31153. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31154. */
  31155. var toPairsIn = createToPairs(keysIn);
  31156. /**
  31157. * An alternative to `_.reduce`; this method transforms `object` to a new
  31158. * `accumulator` object which is the result of running each of its own
  31159. * enumerable string keyed properties thru `iteratee`, with each invocation
  31160. * potentially mutating the `accumulator` object. If `accumulator` is not
  31161. * provided, a new object with the same `[[Prototype]]` will be used. The
  31162. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31163. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31164. *
  31165. * @static
  31166. * @memberOf _
  31167. * @since 1.3.0
  31168. * @category Object
  31169. * @param {Object} object The object to iterate over.
  31170. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31171. * @param {*} [accumulator] The custom accumulator value.
  31172. * @returns {*} Returns the accumulated value.
  31173. * @example
  31174. *
  31175. * _.transform([2, 3, 4], function(result, n) {
  31176. * result.push(n *= n);
  31177. * return n % 2 == 0;
  31178. * }, []);
  31179. * // => [4, 9]
  31180. *
  31181. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31182. * (result[value] || (result[value] = [])).push(key);
  31183. * }, {});
  31184. * // => { '1': ['a', 'c'], '2': ['b'] }
  31185. */
  31186. function transform(object, iteratee, accumulator) {
  31187. var isArr = isArray(object),
  31188. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31189. iteratee = getIteratee(iteratee, 4);
  31190. if (accumulator == null) {
  31191. var Ctor = object && object.constructor;
  31192. if (isArrLike) {
  31193. accumulator = isArr ? new Ctor : [];
  31194. }
  31195. else if (isObject(object)) {
  31196. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31197. }
  31198. else {
  31199. accumulator = {};
  31200. }
  31201. }
  31202. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31203. return iteratee(accumulator, value, index, object);
  31204. });
  31205. return accumulator;
  31206. }
  31207. /**
  31208. * Removes the property at `path` of `object`.
  31209. *
  31210. * **Note:** This method mutates `object`.
  31211. *
  31212. * @static
  31213. * @memberOf _
  31214. * @since 4.0.0
  31215. * @category Object
  31216. * @param {Object} object The object to modify.
  31217. * @param {Array|string} path The path of the property to unset.
  31218. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31219. * @example
  31220. *
  31221. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31222. * _.unset(object, 'a[0].b.c');
  31223. * // => true
  31224. *
  31225. * console.log(object);
  31226. * // => { 'a': [{ 'b': {} }] };
  31227. *
  31228. * _.unset(object, ['a', '0', 'b', 'c']);
  31229. * // => true
  31230. *
  31231. * console.log(object);
  31232. * // => { 'a': [{ 'b': {} }] };
  31233. */
  31234. function unset(object, path) {
  31235. return object == null ? true : baseUnset(object, path);
  31236. }
  31237. /**
  31238. * This method is like `_.set` except that accepts `updater` to produce the
  31239. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31240. * is invoked with one argument: (value).
  31241. *
  31242. * **Note:** This method mutates `object`.
  31243. *
  31244. * @static
  31245. * @memberOf _
  31246. * @since 4.6.0
  31247. * @category Object
  31248. * @param {Object} object The object to modify.
  31249. * @param {Array|string} path The path of the property to set.
  31250. * @param {Function} updater The function to produce the updated value.
  31251. * @returns {Object} Returns `object`.
  31252. * @example
  31253. *
  31254. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31255. *
  31256. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31257. * console.log(object.a[0].b.c);
  31258. * // => 9
  31259. *
  31260. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31261. * console.log(object.x[0].y.z);
  31262. * // => 0
  31263. */
  31264. function update(object, path, updater) {
  31265. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31266. }
  31267. /**
  31268. * This method is like `_.update` except that it accepts `customizer` which is
  31269. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31270. * path creation is handled by the method instead. The `customizer` is invoked
  31271. * with three arguments: (nsValue, key, nsObject).
  31272. *
  31273. * **Note:** This method mutates `object`.
  31274. *
  31275. * @static
  31276. * @memberOf _
  31277. * @since 4.6.0
  31278. * @category Object
  31279. * @param {Object} object The object to modify.
  31280. * @param {Array|string} path The path of the property to set.
  31281. * @param {Function} updater The function to produce the updated value.
  31282. * @param {Function} [customizer] The function to customize assigned values.
  31283. * @returns {Object} Returns `object`.
  31284. * @example
  31285. *
  31286. * var object = {};
  31287. *
  31288. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31289. * // => { '0': { '1': 'a' } }
  31290. */
  31291. function updateWith(object, path, updater, customizer) {
  31292. customizer = typeof customizer == 'function' ? customizer : undefined;
  31293. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31294. }
  31295. /**
  31296. * Creates an array of the own enumerable string keyed property values of `object`.
  31297. *
  31298. * **Note:** Non-object values are coerced to objects.
  31299. *
  31300. * @static
  31301. * @since 0.1.0
  31302. * @memberOf _
  31303. * @category Object
  31304. * @param {Object} object The object to query.
  31305. * @returns {Array} Returns the array of property values.
  31306. * @example
  31307. *
  31308. * function Foo() {
  31309. * this.a = 1;
  31310. * this.b = 2;
  31311. * }
  31312. *
  31313. * Foo.prototype.c = 3;
  31314. *
  31315. * _.values(new Foo);
  31316. * // => [1, 2] (iteration order is not guaranteed)
  31317. *
  31318. * _.values('hi');
  31319. * // => ['h', 'i']
  31320. */
  31321. function values(object) {
  31322. return object == null ? [] : baseValues(object, keys(object));
  31323. }
  31324. /**
  31325. * Creates an array of the own and inherited enumerable string keyed property
  31326. * values of `object`.
  31327. *
  31328. * **Note:** Non-object values are coerced to objects.
  31329. *
  31330. * @static
  31331. * @memberOf _
  31332. * @since 3.0.0
  31333. * @category Object
  31334. * @param {Object} object The object to query.
  31335. * @returns {Array} Returns the array of property values.
  31336. * @example
  31337. *
  31338. * function Foo() {
  31339. * this.a = 1;
  31340. * this.b = 2;
  31341. * }
  31342. *
  31343. * Foo.prototype.c = 3;
  31344. *
  31345. * _.valuesIn(new Foo);
  31346. * // => [1, 2, 3] (iteration order is not guaranteed)
  31347. */
  31348. function valuesIn(object) {
  31349. return object == null ? [] : baseValues(object, keysIn(object));
  31350. }
  31351. /*------------------------------------------------------------------------*/
  31352. /**
  31353. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31354. *
  31355. * @static
  31356. * @memberOf _
  31357. * @since 4.0.0
  31358. * @category Number
  31359. * @param {number} number The number to clamp.
  31360. * @param {number} [lower] The lower bound.
  31361. * @param {number} upper The upper bound.
  31362. * @returns {number} Returns the clamped number.
  31363. * @example
  31364. *
  31365. * _.clamp(-10, -5, 5);
  31366. * // => -5
  31367. *
  31368. * _.clamp(10, -5, 5);
  31369. * // => 5
  31370. */
  31371. function clamp(number, lower, upper) {
  31372. if (upper === undefined) {
  31373. upper = lower;
  31374. lower = undefined;
  31375. }
  31376. if (upper !== undefined) {
  31377. upper = toNumber(upper);
  31378. upper = upper === upper ? upper : 0;
  31379. }
  31380. if (lower !== undefined) {
  31381. lower = toNumber(lower);
  31382. lower = lower === lower ? lower : 0;
  31383. }
  31384. return baseClamp(toNumber(number), lower, upper);
  31385. }
  31386. /**
  31387. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31388. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31389. * If `start` is greater than `end` the params are swapped to support
  31390. * negative ranges.
  31391. *
  31392. * @static
  31393. * @memberOf _
  31394. * @since 3.3.0
  31395. * @category Number
  31396. * @param {number} number The number to check.
  31397. * @param {number} [start=0] The start of the range.
  31398. * @param {number} end The end of the range.
  31399. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31400. * @see _.range, _.rangeRight
  31401. * @example
  31402. *
  31403. * _.inRange(3, 2, 4);
  31404. * // => true
  31405. *
  31406. * _.inRange(4, 8);
  31407. * // => true
  31408. *
  31409. * _.inRange(4, 2);
  31410. * // => false
  31411. *
  31412. * _.inRange(2, 2);
  31413. * // => false
  31414. *
  31415. * _.inRange(1.2, 2);
  31416. * // => true
  31417. *
  31418. * _.inRange(5.2, 4);
  31419. * // => false
  31420. *
  31421. * _.inRange(-3, -2, -6);
  31422. * // => true
  31423. */
  31424. function inRange(number, start, end) {
  31425. start = toFinite(start);
  31426. if (end === undefined) {
  31427. end = start;
  31428. start = 0;
  31429. } else {
  31430. end = toFinite(end);
  31431. }
  31432. number = toNumber(number);
  31433. return baseInRange(number, start, end);
  31434. }
  31435. /**
  31436. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31437. * If only one argument is provided a number between `0` and the given number
  31438. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31439. * floats, a floating-point number is returned instead of an integer.
  31440. *
  31441. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31442. * floating-point values which can produce unexpected results.
  31443. *
  31444. * @static
  31445. * @memberOf _
  31446. * @since 0.7.0
  31447. * @category Number
  31448. * @param {number} [lower=0] The lower bound.
  31449. * @param {number} [upper=1] The upper bound.
  31450. * @param {boolean} [floating] Specify returning a floating-point number.
  31451. * @returns {number} Returns the random number.
  31452. * @example
  31453. *
  31454. * _.random(0, 5);
  31455. * // => an integer between 0 and 5
  31456. *
  31457. * _.random(5);
  31458. * // => also an integer between 0 and 5
  31459. *
  31460. * _.random(5, true);
  31461. * // => a floating-point number between 0 and 5
  31462. *
  31463. * _.random(1.2, 5.2);
  31464. * // => a floating-point number between 1.2 and 5.2
  31465. */
  31466. function random(lower, upper, floating) {
  31467. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31468. upper = floating = undefined;
  31469. }
  31470. if (floating === undefined) {
  31471. if (typeof upper == 'boolean') {
  31472. floating = upper;
  31473. upper = undefined;
  31474. }
  31475. else if (typeof lower == 'boolean') {
  31476. floating = lower;
  31477. lower = undefined;
  31478. }
  31479. }
  31480. if (lower === undefined && upper === undefined) {
  31481. lower = 0;
  31482. upper = 1;
  31483. }
  31484. else {
  31485. lower = toFinite(lower);
  31486. if (upper === undefined) {
  31487. upper = lower;
  31488. lower = 0;
  31489. } else {
  31490. upper = toFinite(upper);
  31491. }
  31492. }
  31493. if (lower > upper) {
  31494. var temp = lower;
  31495. lower = upper;
  31496. upper = temp;
  31497. }
  31498. if (floating || lower % 1 || upper % 1) {
  31499. var rand = nativeRandom();
  31500. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31501. }
  31502. return baseRandom(lower, upper);
  31503. }
  31504. /*------------------------------------------------------------------------*/
  31505. /**
  31506. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31507. *
  31508. * @static
  31509. * @memberOf _
  31510. * @since 3.0.0
  31511. * @category String
  31512. * @param {string} [string=''] The string to convert.
  31513. * @returns {string} Returns the camel cased string.
  31514. * @example
  31515. *
  31516. * _.camelCase('Foo Bar');
  31517. * // => 'fooBar'
  31518. *
  31519. * _.camelCase('--foo-bar--');
  31520. * // => 'fooBar'
  31521. *
  31522. * _.camelCase('__FOO_BAR__');
  31523. * // => 'fooBar'
  31524. */
  31525. var camelCase = createCompounder(function(result, word, index) {
  31526. word = word.toLowerCase();
  31527. return result + (index ? capitalize(word) : word);
  31528. });
  31529. /**
  31530. * Converts the first character of `string` to upper case and the remaining
  31531. * to lower case.
  31532. *
  31533. * @static
  31534. * @memberOf _
  31535. * @since 3.0.0
  31536. * @category String
  31537. * @param {string} [string=''] The string to capitalize.
  31538. * @returns {string} Returns the capitalized string.
  31539. * @example
  31540. *
  31541. * _.capitalize('FRED');
  31542. * // => 'Fred'
  31543. */
  31544. function capitalize(string) {
  31545. return upperFirst(toString(string).toLowerCase());
  31546. }
  31547. /**
  31548. * Deburrs `string` by converting
  31549. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31550. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31551. * letters to basic Latin letters and removing
  31552. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31553. *
  31554. * @static
  31555. * @memberOf _
  31556. * @since 3.0.0
  31557. * @category String
  31558. * @param {string} [string=''] The string to deburr.
  31559. * @returns {string} Returns the deburred string.
  31560. * @example
  31561. *
  31562. * _.deburr('déjà vu');
  31563. * // => 'deja vu'
  31564. */
  31565. function deburr(string) {
  31566. string = toString(string);
  31567. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31568. }
  31569. /**
  31570. * Checks if `string` ends with the given target string.
  31571. *
  31572. * @static
  31573. * @memberOf _
  31574. * @since 3.0.0
  31575. * @category String
  31576. * @param {string} [string=''] The string to inspect.
  31577. * @param {string} [target] The string to search for.
  31578. * @param {number} [position=string.length] The position to search up to.
  31579. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31580. * else `false`.
  31581. * @example
  31582. *
  31583. * _.endsWith('abc', 'c');
  31584. * // => true
  31585. *
  31586. * _.endsWith('abc', 'b');
  31587. * // => false
  31588. *
  31589. * _.endsWith('abc', 'b', 2);
  31590. * // => true
  31591. */
  31592. function endsWith(string, target, position) {
  31593. string = toString(string);
  31594. target = baseToString(target);
  31595. var length = string.length;
  31596. position = position === undefined
  31597. ? length
  31598. : baseClamp(toInteger(position), 0, length);
  31599. var end = position;
  31600. position -= target.length;
  31601. return position >= 0 && string.slice(position, end) == target;
  31602. }
  31603. /**
  31604. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31605. * corresponding HTML entities.
  31606. *
  31607. * **Note:** No other characters are escaped. To escape additional
  31608. * characters use a third-party library like [_he_](https://mths.be/he).
  31609. *
  31610. * Though the ">" character is escaped for symmetry, characters like
  31611. * ">" and "/" don't need escaping in HTML and have no special meaning
  31612. * unless they're part of a tag or unquoted attribute value. See
  31613. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31614. * (under "semi-related fun fact") for more details.
  31615. *
  31616. * When working with HTML you should always
  31617. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31618. * XSS vectors.
  31619. *
  31620. * @static
  31621. * @since 0.1.0
  31622. * @memberOf _
  31623. * @category String
  31624. * @param {string} [string=''] The string to escape.
  31625. * @returns {string} Returns the escaped string.
  31626. * @example
  31627. *
  31628. * _.escape('fred, barney, & pebbles');
  31629. * // => 'fred, barney, &amp; pebbles'
  31630. */
  31631. function escape(string) {
  31632. string = toString(string);
  31633. return (string && reHasUnescapedHtml.test(string))
  31634. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31635. : string;
  31636. }
  31637. /**
  31638. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31639. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31640. *
  31641. * @static
  31642. * @memberOf _
  31643. * @since 3.0.0
  31644. * @category String
  31645. * @param {string} [string=''] The string to escape.
  31646. * @returns {string} Returns the escaped string.
  31647. * @example
  31648. *
  31649. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31650. * // => '\[lodash\]\(https://lodash\.com/\)'
  31651. */
  31652. function escapeRegExp(string) {
  31653. string = toString(string);
  31654. return (string && reHasRegExpChar.test(string))
  31655. ? string.replace(reRegExpChar, '\\$&')
  31656. : string;
  31657. }
  31658. /**
  31659. * Converts `string` to
  31660. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31661. *
  31662. * @static
  31663. * @memberOf _
  31664. * @since 3.0.0
  31665. * @category String
  31666. * @param {string} [string=''] The string to convert.
  31667. * @returns {string} Returns the kebab cased string.
  31668. * @example
  31669. *
  31670. * _.kebabCase('Foo Bar');
  31671. * // => 'foo-bar'
  31672. *
  31673. * _.kebabCase('fooBar');
  31674. * // => 'foo-bar'
  31675. *
  31676. * _.kebabCase('__FOO_BAR__');
  31677. * // => 'foo-bar'
  31678. */
  31679. var kebabCase = createCompounder(function(result, word, index) {
  31680. return result + (index ? '-' : '') + word.toLowerCase();
  31681. });
  31682. /**
  31683. * Converts `string`, as space separated words, to lower case.
  31684. *
  31685. * @static
  31686. * @memberOf _
  31687. * @since 4.0.0
  31688. * @category String
  31689. * @param {string} [string=''] The string to convert.
  31690. * @returns {string} Returns the lower cased string.
  31691. * @example
  31692. *
  31693. * _.lowerCase('--Foo-Bar--');
  31694. * // => 'foo bar'
  31695. *
  31696. * _.lowerCase('fooBar');
  31697. * // => 'foo bar'
  31698. *
  31699. * _.lowerCase('__FOO_BAR__');
  31700. * // => 'foo bar'
  31701. */
  31702. var lowerCase = createCompounder(function(result, word, index) {
  31703. return result + (index ? ' ' : '') + word.toLowerCase();
  31704. });
  31705. /**
  31706. * Converts the first character of `string` to lower case.
  31707. *
  31708. * @static
  31709. * @memberOf _
  31710. * @since 4.0.0
  31711. * @category String
  31712. * @param {string} [string=''] The string to convert.
  31713. * @returns {string} Returns the converted string.
  31714. * @example
  31715. *
  31716. * _.lowerFirst('Fred');
  31717. * // => 'fred'
  31718. *
  31719. * _.lowerFirst('FRED');
  31720. * // => 'fRED'
  31721. */
  31722. var lowerFirst = createCaseFirst('toLowerCase');
  31723. /**
  31724. * Pads `string` on the left and right sides if it's shorter than `length`.
  31725. * Padding characters are truncated if they can't be evenly divided by `length`.
  31726. *
  31727. * @static
  31728. * @memberOf _
  31729. * @since 3.0.0
  31730. * @category String
  31731. * @param {string} [string=''] The string to pad.
  31732. * @param {number} [length=0] The padding length.
  31733. * @param {string} [chars=' '] The string used as padding.
  31734. * @returns {string} Returns the padded string.
  31735. * @example
  31736. *
  31737. * _.pad('abc', 8);
  31738. * // => ' abc '
  31739. *
  31740. * _.pad('abc', 8, '_-');
  31741. * // => '_-abc_-_'
  31742. *
  31743. * _.pad('abc', 3);
  31744. * // => 'abc'
  31745. */
  31746. function pad(string, length, chars) {
  31747. string = toString(string);
  31748. length = toInteger(length);
  31749. var strLength = length ? stringSize(string) : 0;
  31750. if (!length || strLength >= length) {
  31751. return string;
  31752. }
  31753. var mid = (length - strLength) / 2;
  31754. return (
  31755. createPadding(nativeFloor(mid), chars) +
  31756. string +
  31757. createPadding(nativeCeil(mid), chars)
  31758. );
  31759. }
  31760. /**
  31761. * Pads `string` on the right side if it's shorter than `length`. Padding
  31762. * characters are truncated if they exceed `length`.
  31763. *
  31764. * @static
  31765. * @memberOf _
  31766. * @since 4.0.0
  31767. * @category String
  31768. * @param {string} [string=''] The string to pad.
  31769. * @param {number} [length=0] The padding length.
  31770. * @param {string} [chars=' '] The string used as padding.
  31771. * @returns {string} Returns the padded string.
  31772. * @example
  31773. *
  31774. * _.padEnd('abc', 6);
  31775. * // => 'abc '
  31776. *
  31777. * _.padEnd('abc', 6, '_-');
  31778. * // => 'abc_-_'
  31779. *
  31780. * _.padEnd('abc', 3);
  31781. * // => 'abc'
  31782. */
  31783. function padEnd(string, length, chars) {
  31784. string = toString(string);
  31785. length = toInteger(length);
  31786. var strLength = length ? stringSize(string) : 0;
  31787. return (length && strLength < length)
  31788. ? (string + createPadding(length - strLength, chars))
  31789. : string;
  31790. }
  31791. /**
  31792. * Pads `string` on the left side if it's shorter than `length`. Padding
  31793. * characters are truncated if they exceed `length`.
  31794. *
  31795. * @static
  31796. * @memberOf _
  31797. * @since 4.0.0
  31798. * @category String
  31799. * @param {string} [string=''] The string to pad.
  31800. * @param {number} [length=0] The padding length.
  31801. * @param {string} [chars=' '] The string used as padding.
  31802. * @returns {string} Returns the padded string.
  31803. * @example
  31804. *
  31805. * _.padStart('abc', 6);
  31806. * // => ' abc'
  31807. *
  31808. * _.padStart('abc', 6, '_-');
  31809. * // => '_-_abc'
  31810. *
  31811. * _.padStart('abc', 3);
  31812. * // => 'abc'
  31813. */
  31814. function padStart(string, length, chars) {
  31815. string = toString(string);
  31816. length = toInteger(length);
  31817. var strLength = length ? stringSize(string) : 0;
  31818. return (length && strLength < length)
  31819. ? (createPadding(length - strLength, chars) + string)
  31820. : string;
  31821. }
  31822. /**
  31823. * Converts `string` to an integer of the specified radix. If `radix` is
  31824. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31825. * hexadecimal, in which case a `radix` of `16` is used.
  31826. *
  31827. * **Note:** This method aligns with the
  31828. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31829. *
  31830. * @static
  31831. * @memberOf _
  31832. * @since 1.1.0
  31833. * @category String
  31834. * @param {string} string The string to convert.
  31835. * @param {number} [radix=10] The radix to interpret `value` by.
  31836. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31837. * @returns {number} Returns the converted integer.
  31838. * @example
  31839. *
  31840. * _.parseInt('08');
  31841. * // => 8
  31842. *
  31843. * _.map(['6', '08', '10'], _.parseInt);
  31844. * // => [6, 8, 10]
  31845. */
  31846. function parseInt(string, radix, guard) {
  31847. if (guard || radix == null) {
  31848. radix = 0;
  31849. } else if (radix) {
  31850. radix = +radix;
  31851. }
  31852. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31853. }
  31854. /**
  31855. * Repeats the given string `n` times.
  31856. *
  31857. * @static
  31858. * @memberOf _
  31859. * @since 3.0.0
  31860. * @category String
  31861. * @param {string} [string=''] The string to repeat.
  31862. * @param {number} [n=1] The number of times to repeat the string.
  31863. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31864. * @returns {string} Returns the repeated string.
  31865. * @example
  31866. *
  31867. * _.repeat('*', 3);
  31868. * // => '***'
  31869. *
  31870. * _.repeat('abc', 2);
  31871. * // => 'abcabc'
  31872. *
  31873. * _.repeat('abc', 0);
  31874. * // => ''
  31875. */
  31876. function repeat(string, n, guard) {
  31877. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31878. n = 1;
  31879. } else {
  31880. n = toInteger(n);
  31881. }
  31882. return baseRepeat(toString(string), n);
  31883. }
  31884. /**
  31885. * Replaces matches for `pattern` in `string` with `replacement`.
  31886. *
  31887. * **Note:** This method is based on
  31888. * [`String#replace`](https://mdn.io/String/replace).
  31889. *
  31890. * @static
  31891. * @memberOf _
  31892. * @since 4.0.0
  31893. * @category String
  31894. * @param {string} [string=''] The string to modify.
  31895. * @param {RegExp|string} pattern The pattern to replace.
  31896. * @param {Function|string} replacement The match replacement.
  31897. * @returns {string} Returns the modified string.
  31898. * @example
  31899. *
  31900. * _.replace('Hi Fred', 'Fred', 'Barney');
  31901. * // => 'Hi Barney'
  31902. */
  31903. function replace() {
  31904. var args = arguments,
  31905. string = toString(args[0]);
  31906. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31907. }
  31908. /**
  31909. * Converts `string` to
  31910. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31911. *
  31912. * @static
  31913. * @memberOf _
  31914. * @since 3.0.0
  31915. * @category String
  31916. * @param {string} [string=''] The string to convert.
  31917. * @returns {string} Returns the snake cased string.
  31918. * @example
  31919. *
  31920. * _.snakeCase('Foo Bar');
  31921. * // => 'foo_bar'
  31922. *
  31923. * _.snakeCase('fooBar');
  31924. * // => 'foo_bar'
  31925. *
  31926. * _.snakeCase('--FOO-BAR--');
  31927. * // => 'foo_bar'
  31928. */
  31929. var snakeCase = createCompounder(function(result, word, index) {
  31930. return result + (index ? '_' : '') + word.toLowerCase();
  31931. });
  31932. /**
  31933. * Splits `string` by `separator`.
  31934. *
  31935. * **Note:** This method is based on
  31936. * [`String#split`](https://mdn.io/String/split).
  31937. *
  31938. * @static
  31939. * @memberOf _
  31940. * @since 4.0.0
  31941. * @category String
  31942. * @param {string} [string=''] The string to split.
  31943. * @param {RegExp|string} separator The separator pattern to split by.
  31944. * @param {number} [limit] The length to truncate results to.
  31945. * @returns {Array} Returns the string segments.
  31946. * @example
  31947. *
  31948. * _.split('a-b-c', '-', 2);
  31949. * // => ['a', 'b']
  31950. */
  31951. function split(string, separator, limit) {
  31952. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31953. separator = limit = undefined;
  31954. }
  31955. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31956. if (!limit) {
  31957. return [];
  31958. }
  31959. string = toString(string);
  31960. if (string && (
  31961. typeof separator == 'string' ||
  31962. (separator != null && !isRegExp(separator))
  31963. )) {
  31964. separator = baseToString(separator);
  31965. if (!separator && hasUnicode(string)) {
  31966. return castSlice(stringToArray(string), 0, limit);
  31967. }
  31968. }
  31969. return string.split(separator, limit);
  31970. }
  31971. /**
  31972. * Converts `string` to
  31973. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  31974. *
  31975. * @static
  31976. * @memberOf _
  31977. * @since 3.1.0
  31978. * @category String
  31979. * @param {string} [string=''] The string to convert.
  31980. * @returns {string} Returns the start cased string.
  31981. * @example
  31982. *
  31983. * _.startCase('--foo-bar--');
  31984. * // => 'Foo Bar'
  31985. *
  31986. * _.startCase('fooBar');
  31987. * // => 'Foo Bar'
  31988. *
  31989. * _.startCase('__FOO_BAR__');
  31990. * // => 'FOO BAR'
  31991. */
  31992. var startCase = createCompounder(function(result, word, index) {
  31993. return result + (index ? ' ' : '') + upperFirst(word);
  31994. });
  31995. /**
  31996. * Checks if `string` starts with the given target string.
  31997. *
  31998. * @static
  31999. * @memberOf _
  32000. * @since 3.0.0
  32001. * @category String
  32002. * @param {string} [string=''] The string to inspect.
  32003. * @param {string} [target] The string to search for.
  32004. * @param {number} [position=0] The position to search from.
  32005. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32006. * else `false`.
  32007. * @example
  32008. *
  32009. * _.startsWith('abc', 'a');
  32010. * // => true
  32011. *
  32012. * _.startsWith('abc', 'b');
  32013. * // => false
  32014. *
  32015. * _.startsWith('abc', 'b', 1);
  32016. * // => true
  32017. */
  32018. function startsWith(string, target, position) {
  32019. string = toString(string);
  32020. position = position == null
  32021. ? 0
  32022. : baseClamp(toInteger(position), 0, string.length);
  32023. target = baseToString(target);
  32024. return string.slice(position, position + target.length) == target;
  32025. }
  32026. /**
  32027. * Creates a compiled template function that can interpolate data properties
  32028. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32029. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32030. * properties may be accessed as free variables in the template. If a setting
  32031. * object is given, it takes precedence over `_.templateSettings` values.
  32032. *
  32033. * **Note:** In the development build `_.template` utilizes
  32034. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32035. * for easier debugging.
  32036. *
  32037. * For more information on precompiling templates see
  32038. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32039. *
  32040. * For more information on Chrome extension sandboxes see
  32041. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32042. *
  32043. * @static
  32044. * @since 0.1.0
  32045. * @memberOf _
  32046. * @category String
  32047. * @param {string} [string=''] The template string.
  32048. * @param {Object} [options={}] The options object.
  32049. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32050. * The HTML "escape" delimiter.
  32051. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32052. * The "evaluate" delimiter.
  32053. * @param {Object} [options.imports=_.templateSettings.imports]
  32054. * An object to import into the template as free variables.
  32055. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32056. * The "interpolate" delimiter.
  32057. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32058. * The sourceURL of the compiled template.
  32059. * @param {string} [options.variable='obj']
  32060. * The data object variable name.
  32061. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32062. * @returns {Function} Returns the compiled template function.
  32063. * @example
  32064. *
  32065. * // Use the "interpolate" delimiter to create a compiled template.
  32066. * var compiled = _.template('hello <%= user %>!');
  32067. * compiled({ 'user': 'fred' });
  32068. * // => 'hello fred!'
  32069. *
  32070. * // Use the HTML "escape" delimiter to escape data property values.
  32071. * var compiled = _.template('<b><%- value %></b>');
  32072. * compiled({ 'value': '<script>' });
  32073. * // => '<b>&lt;script&gt;</b>'
  32074. *
  32075. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32076. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32077. * compiled({ 'users': ['fred', 'barney'] });
  32078. * // => '<li>fred</li><li>barney</li>'
  32079. *
  32080. * // Use the internal `print` function in "evaluate" delimiters.
  32081. * var compiled = _.template('<% print("hello " + user); %>!');
  32082. * compiled({ 'user': 'barney' });
  32083. * // => 'hello barney!'
  32084. *
  32085. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32086. * // Disable support by replacing the "interpolate" delimiter.
  32087. * var compiled = _.template('hello ${ user }!');
  32088. * compiled({ 'user': 'pebbles' });
  32089. * // => 'hello pebbles!'
  32090. *
  32091. * // Use backslashes to treat delimiters as plain text.
  32092. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32093. * compiled({ 'value': 'ignored' });
  32094. * // => '<%- value %>'
  32095. *
  32096. * // Use the `imports` option to import `jQuery` as `jq`.
  32097. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32098. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32099. * compiled({ 'users': ['fred', 'barney'] });
  32100. * // => '<li>fred</li><li>barney</li>'
  32101. *
  32102. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32103. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32104. * compiled(data);
  32105. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32106. *
  32107. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32108. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32109. * compiled.source;
  32110. * // => function(data) {
  32111. * // var __t, __p = '';
  32112. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32113. * // return __p;
  32114. * // }
  32115. *
  32116. * // Use custom template delimiters.
  32117. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32118. * var compiled = _.template('hello {{ user }}!');
  32119. * compiled({ 'user': 'mustache' });
  32120. * // => 'hello mustache!'
  32121. *
  32122. * // Use the `source` property to inline compiled templates for meaningful
  32123. * // line numbers in error messages and stack traces.
  32124. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32125. * var JST = {\
  32126. * "main": ' + _.template(mainText).source + '\
  32127. * };\
  32128. * ');
  32129. */
  32130. function template(string, options, guard) {
  32131. // Based on John Resig's `tmpl` implementation
  32132. // (http://ejohn.org/blog/javascript-micro-templating/)
  32133. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32134. var settings = lodash.templateSettings;
  32135. if (guard && isIterateeCall(string, options, guard)) {
  32136. options = undefined;
  32137. }
  32138. string = toString(string);
  32139. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32140. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32141. importsKeys = keys(imports),
  32142. importsValues = baseValues(imports, importsKeys);
  32143. var isEscaping,
  32144. isEvaluating,
  32145. index = 0,
  32146. interpolate = options.interpolate || reNoMatch,
  32147. source = "__p += '";
  32148. // Compile the regexp to match each delimiter.
  32149. var reDelimiters = RegExp(
  32150. (options.escape || reNoMatch).source + '|' +
  32151. interpolate.source + '|' +
  32152. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32153. (options.evaluate || reNoMatch).source + '|$'
  32154. , 'g');
  32155. // Use a sourceURL for easier debugging.
  32156. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32157. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32158. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32159. var sourceURL = '//# sourceURL=' +
  32160. (hasOwnProperty.call(options, 'sourceURL')
  32161. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32162. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32163. ) + '\n';
  32164. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32165. interpolateValue || (interpolateValue = esTemplateValue);
  32166. // Escape characters that can't be included in string literals.
  32167. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32168. // Replace delimiters with snippets.
  32169. if (escapeValue) {
  32170. isEscaping = true;
  32171. source += "' +\n__e(" + escapeValue + ") +\n'";
  32172. }
  32173. if (evaluateValue) {
  32174. isEvaluating = true;
  32175. source += "';\n" + evaluateValue + ";\n__p += '";
  32176. }
  32177. if (interpolateValue) {
  32178. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32179. }
  32180. index = offset + match.length;
  32181. // The JS engine embedded in Adobe products needs `match` returned in
  32182. // order to produce the correct `offset` value.
  32183. return match;
  32184. });
  32185. source += "';\n";
  32186. // If `variable` is not specified wrap a with-statement around the generated
  32187. // code to add the data object to the top of the scope chain.
  32188. // Like with sourceURL, we take care to not check the option's prototype,
  32189. // as this configuration is a code injection vector.
  32190. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32191. if (!variable) {
  32192. source = 'with (obj) {\n' + source + '\n}\n';
  32193. }
  32194. // Cleanup code by stripping empty strings.
  32195. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32196. .replace(reEmptyStringMiddle, '$1')
  32197. .replace(reEmptyStringTrailing, '$1;');
  32198. // Frame code as the function body.
  32199. source = 'function(' + (variable || 'obj') + ') {\n' +
  32200. (variable
  32201. ? ''
  32202. : 'obj || (obj = {});\n'
  32203. ) +
  32204. "var __t, __p = ''" +
  32205. (isEscaping
  32206. ? ', __e = _.escape'
  32207. : ''
  32208. ) +
  32209. (isEvaluating
  32210. ? ', __j = Array.prototype.join;\n' +
  32211. "function print() { __p += __j.call(arguments, '') }\n"
  32212. : ';\n'
  32213. ) +
  32214. source +
  32215. 'return __p\n}';
  32216. var result = attempt(function() {
  32217. return Function(importsKeys, sourceURL + 'return ' + source)
  32218. .apply(undefined, importsValues);
  32219. });
  32220. // Provide the compiled function's source by its `toString` method or
  32221. // the `source` property as a convenience for inlining compiled templates.
  32222. result.source = source;
  32223. if (isError(result)) {
  32224. throw result;
  32225. }
  32226. return result;
  32227. }
  32228. /**
  32229. * Converts `string`, as a whole, to lower case just like
  32230. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32231. *
  32232. * @static
  32233. * @memberOf _
  32234. * @since 4.0.0
  32235. * @category String
  32236. * @param {string} [string=''] The string to convert.
  32237. * @returns {string} Returns the lower cased string.
  32238. * @example
  32239. *
  32240. * _.toLower('--Foo-Bar--');
  32241. * // => '--foo-bar--'
  32242. *
  32243. * _.toLower('fooBar');
  32244. * // => 'foobar'
  32245. *
  32246. * _.toLower('__FOO_BAR__');
  32247. * // => '__foo_bar__'
  32248. */
  32249. function toLower(value) {
  32250. return toString(value).toLowerCase();
  32251. }
  32252. /**
  32253. * Converts `string`, as a whole, to upper case just like
  32254. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32255. *
  32256. * @static
  32257. * @memberOf _
  32258. * @since 4.0.0
  32259. * @category String
  32260. * @param {string} [string=''] The string to convert.
  32261. * @returns {string} Returns the upper cased string.
  32262. * @example
  32263. *
  32264. * _.toUpper('--foo-bar--');
  32265. * // => '--FOO-BAR--'
  32266. *
  32267. * _.toUpper('fooBar');
  32268. * // => 'FOOBAR'
  32269. *
  32270. * _.toUpper('__foo_bar__');
  32271. * // => '__FOO_BAR__'
  32272. */
  32273. function toUpper(value) {
  32274. return toString(value).toUpperCase();
  32275. }
  32276. /**
  32277. * Removes leading and trailing whitespace or specified characters from `string`.
  32278. *
  32279. * @static
  32280. * @memberOf _
  32281. * @since 3.0.0
  32282. * @category String
  32283. * @param {string} [string=''] The string to trim.
  32284. * @param {string} [chars=whitespace] The characters to trim.
  32285. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32286. * @returns {string} Returns the trimmed string.
  32287. * @example
  32288. *
  32289. * _.trim(' abc ');
  32290. * // => 'abc'
  32291. *
  32292. * _.trim('-_-abc-_-', '_-');
  32293. * // => 'abc'
  32294. *
  32295. * _.map([' foo ', ' bar '], _.trim);
  32296. * // => ['foo', 'bar']
  32297. */
  32298. function trim(string, chars, guard) {
  32299. string = toString(string);
  32300. if (string && (guard || chars === undefined)) {
  32301. return string.replace(reTrim, '');
  32302. }
  32303. if (!string || !(chars = baseToString(chars))) {
  32304. return string;
  32305. }
  32306. var strSymbols = stringToArray(string),
  32307. chrSymbols = stringToArray(chars),
  32308. start = charsStartIndex(strSymbols, chrSymbols),
  32309. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32310. return castSlice(strSymbols, start, end).join('');
  32311. }
  32312. /**
  32313. * Removes trailing whitespace or specified characters from `string`.
  32314. *
  32315. * @static
  32316. * @memberOf _
  32317. * @since 4.0.0
  32318. * @category String
  32319. * @param {string} [string=''] The string to trim.
  32320. * @param {string} [chars=whitespace] The characters to trim.
  32321. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32322. * @returns {string} Returns the trimmed string.
  32323. * @example
  32324. *
  32325. * _.trimEnd(' abc ');
  32326. * // => ' abc'
  32327. *
  32328. * _.trimEnd('-_-abc-_-', '_-');
  32329. * // => '-_-abc'
  32330. */
  32331. function trimEnd(string, chars, guard) {
  32332. string = toString(string);
  32333. if (string && (guard || chars === undefined)) {
  32334. return string.replace(reTrimEnd, '');
  32335. }
  32336. if (!string || !(chars = baseToString(chars))) {
  32337. return string;
  32338. }
  32339. var strSymbols = stringToArray(string),
  32340. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32341. return castSlice(strSymbols, 0, end).join('');
  32342. }
  32343. /**
  32344. * Removes leading whitespace or specified characters from `string`.
  32345. *
  32346. * @static
  32347. * @memberOf _
  32348. * @since 4.0.0
  32349. * @category String
  32350. * @param {string} [string=''] The string to trim.
  32351. * @param {string} [chars=whitespace] The characters to trim.
  32352. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32353. * @returns {string} Returns the trimmed string.
  32354. * @example
  32355. *
  32356. * _.trimStart(' abc ');
  32357. * // => 'abc '
  32358. *
  32359. * _.trimStart('-_-abc-_-', '_-');
  32360. * // => 'abc-_-'
  32361. */
  32362. function trimStart(string, chars, guard) {
  32363. string = toString(string);
  32364. if (string && (guard || chars === undefined)) {
  32365. return string.replace(reTrimStart, '');
  32366. }
  32367. if (!string || !(chars = baseToString(chars))) {
  32368. return string;
  32369. }
  32370. var strSymbols = stringToArray(string),
  32371. start = charsStartIndex(strSymbols, stringToArray(chars));
  32372. return castSlice(strSymbols, start).join('');
  32373. }
  32374. /**
  32375. * Truncates `string` if it's longer than the given maximum string length.
  32376. * The last characters of the truncated string are replaced with the omission
  32377. * string which defaults to "...".
  32378. *
  32379. * @static
  32380. * @memberOf _
  32381. * @since 4.0.0
  32382. * @category String
  32383. * @param {string} [string=''] The string to truncate.
  32384. * @param {Object} [options={}] The options object.
  32385. * @param {number} [options.length=30] The maximum string length.
  32386. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32387. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32388. * @returns {string} Returns the truncated string.
  32389. * @example
  32390. *
  32391. * _.truncate('hi-diddly-ho there, neighborino');
  32392. * // => 'hi-diddly-ho there, neighbo...'
  32393. *
  32394. * _.truncate('hi-diddly-ho there, neighborino', {
  32395. * 'length': 24,
  32396. * 'separator': ' '
  32397. * });
  32398. * // => 'hi-diddly-ho there,...'
  32399. *
  32400. * _.truncate('hi-diddly-ho there, neighborino', {
  32401. * 'length': 24,
  32402. * 'separator': /,? +/
  32403. * });
  32404. * // => 'hi-diddly-ho there...'
  32405. *
  32406. * _.truncate('hi-diddly-ho there, neighborino', {
  32407. * 'omission': ' [...]'
  32408. * });
  32409. * // => 'hi-diddly-ho there, neig [...]'
  32410. */
  32411. function truncate(string, options) {
  32412. var length = DEFAULT_TRUNC_LENGTH,
  32413. omission = DEFAULT_TRUNC_OMISSION;
  32414. if (isObject(options)) {
  32415. var separator = 'separator' in options ? options.separator : separator;
  32416. length = 'length' in options ? toInteger(options.length) : length;
  32417. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32418. }
  32419. string = toString(string);
  32420. var strLength = string.length;
  32421. if (hasUnicode(string)) {
  32422. var strSymbols = stringToArray(string);
  32423. strLength = strSymbols.length;
  32424. }
  32425. if (length >= strLength) {
  32426. return string;
  32427. }
  32428. var end = length - stringSize(omission);
  32429. if (end < 1) {
  32430. return omission;
  32431. }
  32432. var result = strSymbols
  32433. ? castSlice(strSymbols, 0, end).join('')
  32434. : string.slice(0, end);
  32435. if (separator === undefined) {
  32436. return result + omission;
  32437. }
  32438. if (strSymbols) {
  32439. end += (result.length - end);
  32440. }
  32441. if (isRegExp(separator)) {
  32442. if (string.slice(end).search(separator)) {
  32443. var match,
  32444. substring = result;
  32445. if (!separator.global) {
  32446. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32447. }
  32448. separator.lastIndex = 0;
  32449. while ((match = separator.exec(substring))) {
  32450. var newEnd = match.index;
  32451. }
  32452. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32453. }
  32454. } else if (string.indexOf(baseToString(separator), end) != end) {
  32455. var index = result.lastIndexOf(separator);
  32456. if (index > -1) {
  32457. result = result.slice(0, index);
  32458. }
  32459. }
  32460. return result + omission;
  32461. }
  32462. /**
  32463. * The inverse of `_.escape`; this method converts the HTML entities
  32464. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32465. * their corresponding characters.
  32466. *
  32467. * **Note:** No other HTML entities are unescaped. To unescape additional
  32468. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32469. *
  32470. * @static
  32471. * @memberOf _
  32472. * @since 0.6.0
  32473. * @category String
  32474. * @param {string} [string=''] The string to unescape.
  32475. * @returns {string} Returns the unescaped string.
  32476. * @example
  32477. *
  32478. * _.unescape('fred, barney, &amp; pebbles');
  32479. * // => 'fred, barney, & pebbles'
  32480. */
  32481. function unescape(string) {
  32482. string = toString(string);
  32483. return (string && reHasEscapedHtml.test(string))
  32484. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32485. : string;
  32486. }
  32487. /**
  32488. * Converts `string`, as space separated words, to upper case.
  32489. *
  32490. * @static
  32491. * @memberOf _
  32492. * @since 4.0.0
  32493. * @category String
  32494. * @param {string} [string=''] The string to convert.
  32495. * @returns {string} Returns the upper cased string.
  32496. * @example
  32497. *
  32498. * _.upperCase('--foo-bar');
  32499. * // => 'FOO BAR'
  32500. *
  32501. * _.upperCase('fooBar');
  32502. * // => 'FOO BAR'
  32503. *
  32504. * _.upperCase('__foo_bar__');
  32505. * // => 'FOO BAR'
  32506. */
  32507. var upperCase = createCompounder(function(result, word, index) {
  32508. return result + (index ? ' ' : '') + word.toUpperCase();
  32509. });
  32510. /**
  32511. * Converts the first character of `string` to upper case.
  32512. *
  32513. * @static
  32514. * @memberOf _
  32515. * @since 4.0.0
  32516. * @category String
  32517. * @param {string} [string=''] The string to convert.
  32518. * @returns {string} Returns the converted string.
  32519. * @example
  32520. *
  32521. * _.upperFirst('fred');
  32522. * // => 'Fred'
  32523. *
  32524. * _.upperFirst('FRED');
  32525. * // => 'FRED'
  32526. */
  32527. var upperFirst = createCaseFirst('toUpperCase');
  32528. /**
  32529. * Splits `string` into an array of its words.
  32530. *
  32531. * @static
  32532. * @memberOf _
  32533. * @since 3.0.0
  32534. * @category String
  32535. * @param {string} [string=''] The string to inspect.
  32536. * @param {RegExp|string} [pattern] The pattern to match words.
  32537. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32538. * @returns {Array} Returns the words of `string`.
  32539. * @example
  32540. *
  32541. * _.words('fred, barney, & pebbles');
  32542. * // => ['fred', 'barney', 'pebbles']
  32543. *
  32544. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32545. * // => ['fred', 'barney', '&', 'pebbles']
  32546. */
  32547. function words(string, pattern, guard) {
  32548. string = toString(string);
  32549. pattern = guard ? undefined : pattern;
  32550. if (pattern === undefined) {
  32551. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32552. }
  32553. return string.match(pattern) || [];
  32554. }
  32555. /*------------------------------------------------------------------------*/
  32556. /**
  32557. * Attempts to invoke `func`, returning either the result or the caught error
  32558. * object. Any additional arguments are provided to `func` when it's invoked.
  32559. *
  32560. * @static
  32561. * @memberOf _
  32562. * @since 3.0.0
  32563. * @category Util
  32564. * @param {Function} func The function to attempt.
  32565. * @param {...*} [args] The arguments to invoke `func` with.
  32566. * @returns {*} Returns the `func` result or error object.
  32567. * @example
  32568. *
  32569. * // Avoid throwing errors for invalid selectors.
  32570. * var elements = _.attempt(function(selector) {
  32571. * return document.querySelectorAll(selector);
  32572. * }, '>_>');
  32573. *
  32574. * if (_.isError(elements)) {
  32575. * elements = [];
  32576. * }
  32577. */
  32578. var attempt = baseRest(function(func, args) {
  32579. try {
  32580. return apply(func, undefined, args);
  32581. } catch (e) {
  32582. return isError(e) ? e : new Error(e);
  32583. }
  32584. });
  32585. /**
  32586. * Binds methods of an object to the object itself, overwriting the existing
  32587. * method.
  32588. *
  32589. * **Note:** This method doesn't set the "length" property of bound functions.
  32590. *
  32591. * @static
  32592. * @since 0.1.0
  32593. * @memberOf _
  32594. * @category Util
  32595. * @param {Object} object The object to bind and assign the bound methods to.
  32596. * @param {...(string|string[])} methodNames The object method names to bind.
  32597. * @returns {Object} Returns `object`.
  32598. * @example
  32599. *
  32600. * var view = {
  32601. * 'label': 'docs',
  32602. * 'click': function() {
  32603. * console.log('clicked ' + this.label);
  32604. * }
  32605. * };
  32606. *
  32607. * _.bindAll(view, ['click']);
  32608. * jQuery(element).on('click', view.click);
  32609. * // => Logs 'clicked docs' when clicked.
  32610. */
  32611. var bindAll = flatRest(function(object, methodNames) {
  32612. arrayEach(methodNames, function(key) {
  32613. key = toKey(key);
  32614. baseAssignValue(object, key, bind(object[key], object));
  32615. });
  32616. return object;
  32617. });
  32618. /**
  32619. * Creates a function that iterates over `pairs` and invokes the corresponding
  32620. * function of the first predicate to return truthy. The predicate-function
  32621. * pairs are invoked with the `this` binding and arguments of the created
  32622. * function.
  32623. *
  32624. * @static
  32625. * @memberOf _
  32626. * @since 4.0.0
  32627. * @category Util
  32628. * @param {Array} pairs The predicate-function pairs.
  32629. * @returns {Function} Returns the new composite function.
  32630. * @example
  32631. *
  32632. * var func = _.cond([
  32633. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32634. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32635. * [_.stubTrue, _.constant('no match')]
  32636. * ]);
  32637. *
  32638. * func({ 'a': 1, 'b': 2 });
  32639. * // => 'matches A'
  32640. *
  32641. * func({ 'a': 0, 'b': 1 });
  32642. * // => 'matches B'
  32643. *
  32644. * func({ 'a': '1', 'b': '2' });
  32645. * // => 'no match'
  32646. */
  32647. function cond(pairs) {
  32648. var length = pairs == null ? 0 : pairs.length,
  32649. toIteratee = getIteratee();
  32650. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32651. if (typeof pair[1] != 'function') {
  32652. throw new TypeError(FUNC_ERROR_TEXT);
  32653. }
  32654. return [toIteratee(pair[0]), pair[1]];
  32655. });
  32656. return baseRest(function(args) {
  32657. var index = -1;
  32658. while (++index < length) {
  32659. var pair = pairs[index];
  32660. if (apply(pair[0], this, args)) {
  32661. return apply(pair[1], this, args);
  32662. }
  32663. }
  32664. });
  32665. }
  32666. /**
  32667. * Creates a function that invokes the predicate properties of `source` with
  32668. * the corresponding property values of a given object, returning `true` if
  32669. * all predicates return truthy, else `false`.
  32670. *
  32671. * **Note:** The created function is equivalent to `_.conformsTo` with
  32672. * `source` partially applied.
  32673. *
  32674. * @static
  32675. * @memberOf _
  32676. * @since 4.0.0
  32677. * @category Util
  32678. * @param {Object} source The object of property predicates to conform to.
  32679. * @returns {Function} Returns the new spec function.
  32680. * @example
  32681. *
  32682. * var objects = [
  32683. * { 'a': 2, 'b': 1 },
  32684. * { 'a': 1, 'b': 2 }
  32685. * ];
  32686. *
  32687. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32688. * // => [{ 'a': 1, 'b': 2 }]
  32689. */
  32690. function conforms(source) {
  32691. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32692. }
  32693. /**
  32694. * Creates a function that returns `value`.
  32695. *
  32696. * @static
  32697. * @memberOf _
  32698. * @since 2.4.0
  32699. * @category Util
  32700. * @param {*} value The value to return from the new function.
  32701. * @returns {Function} Returns the new constant function.
  32702. * @example
  32703. *
  32704. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32705. *
  32706. * console.log(objects);
  32707. * // => [{ 'a': 1 }, { 'a': 1 }]
  32708. *
  32709. * console.log(objects[0] === objects[1]);
  32710. * // => true
  32711. */
  32712. function constant(value) {
  32713. return function() {
  32714. return value;
  32715. };
  32716. }
  32717. /**
  32718. * Checks `value` to determine whether a default value should be returned in
  32719. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32720. * or `undefined`.
  32721. *
  32722. * @static
  32723. * @memberOf _
  32724. * @since 4.14.0
  32725. * @category Util
  32726. * @param {*} value The value to check.
  32727. * @param {*} defaultValue The default value.
  32728. * @returns {*} Returns the resolved value.
  32729. * @example
  32730. *
  32731. * _.defaultTo(1, 10);
  32732. * // => 1
  32733. *
  32734. * _.defaultTo(undefined, 10);
  32735. * // => 10
  32736. */
  32737. function defaultTo(value, defaultValue) {
  32738. return (value == null || value !== value) ? defaultValue : value;
  32739. }
  32740. /**
  32741. * Creates a function that returns the result of invoking the given functions
  32742. * with the `this` binding of the created function, where each successive
  32743. * invocation is supplied the return value of the previous.
  32744. *
  32745. * @static
  32746. * @memberOf _
  32747. * @since 3.0.0
  32748. * @category Util
  32749. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32750. * @returns {Function} Returns the new composite function.
  32751. * @see _.flowRight
  32752. * @example
  32753. *
  32754. * function square(n) {
  32755. * return n * n;
  32756. * }
  32757. *
  32758. * var addSquare = _.flow([_.add, square]);
  32759. * addSquare(1, 2);
  32760. * // => 9
  32761. */
  32762. var flow = createFlow();
  32763. /**
  32764. * This method is like `_.flow` except that it creates a function that
  32765. * invokes the given functions from right to left.
  32766. *
  32767. * @static
  32768. * @since 3.0.0
  32769. * @memberOf _
  32770. * @category Util
  32771. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32772. * @returns {Function} Returns the new composite function.
  32773. * @see _.flow
  32774. * @example
  32775. *
  32776. * function square(n) {
  32777. * return n * n;
  32778. * }
  32779. *
  32780. * var addSquare = _.flowRight([square, _.add]);
  32781. * addSquare(1, 2);
  32782. * // => 9
  32783. */
  32784. var flowRight = createFlow(true);
  32785. /**
  32786. * This method returns the first argument it receives.
  32787. *
  32788. * @static
  32789. * @since 0.1.0
  32790. * @memberOf _
  32791. * @category Util
  32792. * @param {*} value Any value.
  32793. * @returns {*} Returns `value`.
  32794. * @example
  32795. *
  32796. * var object = { 'a': 1 };
  32797. *
  32798. * console.log(_.identity(object) === object);
  32799. * // => true
  32800. */
  32801. function identity(value) {
  32802. return value;
  32803. }
  32804. /**
  32805. * Creates a function that invokes `func` with the arguments of the created
  32806. * function. If `func` is a property name, the created function returns the
  32807. * property value for a given element. If `func` is an array or object, the
  32808. * created function returns `true` for elements that contain the equivalent
  32809. * source properties, otherwise it returns `false`.
  32810. *
  32811. * @static
  32812. * @since 4.0.0
  32813. * @memberOf _
  32814. * @category Util
  32815. * @param {*} [func=_.identity] The value to convert to a callback.
  32816. * @returns {Function} Returns the callback.
  32817. * @example
  32818. *
  32819. * var users = [
  32820. * { 'user': 'barney', 'age': 36, 'active': true },
  32821. * { 'user': 'fred', 'age': 40, 'active': false }
  32822. * ];
  32823. *
  32824. * // The `_.matches` iteratee shorthand.
  32825. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32826. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32827. *
  32828. * // The `_.matchesProperty` iteratee shorthand.
  32829. * _.filter(users, _.iteratee(['user', 'fred']));
  32830. * // => [{ 'user': 'fred', 'age': 40 }]
  32831. *
  32832. * // The `_.property` iteratee shorthand.
  32833. * _.map(users, _.iteratee('user'));
  32834. * // => ['barney', 'fred']
  32835. *
  32836. * // Create custom iteratee shorthands.
  32837. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32838. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32839. * return func.test(string);
  32840. * };
  32841. * });
  32842. *
  32843. * _.filter(['abc', 'def'], /ef/);
  32844. * // => ['def']
  32845. */
  32846. function iteratee(func) {
  32847. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32848. }
  32849. /**
  32850. * Creates a function that performs a partial deep comparison between a given
  32851. * object and `source`, returning `true` if the given object has equivalent
  32852. * property values, else `false`.
  32853. *
  32854. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32855. * partially applied.
  32856. *
  32857. * Partial comparisons will match empty array and empty object `source`
  32858. * values against any array or object value, respectively. See `_.isEqual`
  32859. * for a list of supported value comparisons.
  32860. *
  32861. * @static
  32862. * @memberOf _
  32863. * @since 3.0.0
  32864. * @category Util
  32865. * @param {Object} source The object of property values to match.
  32866. * @returns {Function} Returns the new spec function.
  32867. * @example
  32868. *
  32869. * var objects = [
  32870. * { 'a': 1, 'b': 2, 'c': 3 },
  32871. * { 'a': 4, 'b': 5, 'c': 6 }
  32872. * ];
  32873. *
  32874. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32875. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32876. */
  32877. function matches(source) {
  32878. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32879. }
  32880. /**
  32881. * Creates a function that performs a partial deep comparison between the
  32882. * value at `path` of a given object to `srcValue`, returning `true` if the
  32883. * object value is equivalent, else `false`.
  32884. *
  32885. * **Note:** Partial comparisons will match empty array and empty object
  32886. * `srcValue` values against any array or object value, respectively. See
  32887. * `_.isEqual` for a list of supported value comparisons.
  32888. *
  32889. * @static
  32890. * @memberOf _
  32891. * @since 3.2.0
  32892. * @category Util
  32893. * @param {Array|string} path The path of the property to get.
  32894. * @param {*} srcValue The value to match.
  32895. * @returns {Function} Returns the new spec function.
  32896. * @example
  32897. *
  32898. * var objects = [
  32899. * { 'a': 1, 'b': 2, 'c': 3 },
  32900. * { 'a': 4, 'b': 5, 'c': 6 }
  32901. * ];
  32902. *
  32903. * _.find(objects, _.matchesProperty('a', 4));
  32904. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32905. */
  32906. function matchesProperty(path, srcValue) {
  32907. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32908. }
  32909. /**
  32910. * Creates a function that invokes the method at `path` of a given object.
  32911. * Any additional arguments are provided to the invoked method.
  32912. *
  32913. * @static
  32914. * @memberOf _
  32915. * @since 3.7.0
  32916. * @category Util
  32917. * @param {Array|string} path The path of the method to invoke.
  32918. * @param {...*} [args] The arguments to invoke the method with.
  32919. * @returns {Function} Returns the new invoker function.
  32920. * @example
  32921. *
  32922. * var objects = [
  32923. * { 'a': { 'b': _.constant(2) } },
  32924. * { 'a': { 'b': _.constant(1) } }
  32925. * ];
  32926. *
  32927. * _.map(objects, _.method('a.b'));
  32928. * // => [2, 1]
  32929. *
  32930. * _.map(objects, _.method(['a', 'b']));
  32931. * // => [2, 1]
  32932. */
  32933. var method = baseRest(function(path, args) {
  32934. return function(object) {
  32935. return baseInvoke(object, path, args);
  32936. };
  32937. });
  32938. /**
  32939. * The opposite of `_.method`; this method creates a function that invokes
  32940. * the method at a given path of `object`. Any additional arguments are
  32941. * provided to the invoked method.
  32942. *
  32943. * @static
  32944. * @memberOf _
  32945. * @since 3.7.0
  32946. * @category Util
  32947. * @param {Object} object The object to query.
  32948. * @param {...*} [args] The arguments to invoke the method with.
  32949. * @returns {Function} Returns the new invoker function.
  32950. * @example
  32951. *
  32952. * var array = _.times(3, _.constant),
  32953. * object = { 'a': array, 'b': array, 'c': array };
  32954. *
  32955. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32956. * // => [2, 0]
  32957. *
  32958. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32959. * // => [2, 0]
  32960. */
  32961. var methodOf = baseRest(function(object, args) {
  32962. return function(path) {
  32963. return baseInvoke(object, path, args);
  32964. };
  32965. });
  32966. /**
  32967. * Adds all own enumerable string keyed function properties of a source
  32968. * object to the destination object. If `object` is a function, then methods
  32969. * are added to its prototype as well.
  32970. *
  32971. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  32972. * avoid conflicts caused by modifying the original.
  32973. *
  32974. * @static
  32975. * @since 0.1.0
  32976. * @memberOf _
  32977. * @category Util
  32978. * @param {Function|Object} [object=lodash] The destination object.
  32979. * @param {Object} source The object of functions to add.
  32980. * @param {Object} [options={}] The options object.
  32981. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  32982. * @returns {Function|Object} Returns `object`.
  32983. * @example
  32984. *
  32985. * function vowels(string) {
  32986. * return _.filter(string, function(v) {
  32987. * return /[aeiou]/i.test(v);
  32988. * });
  32989. * }
  32990. *
  32991. * _.mixin({ 'vowels': vowels });
  32992. * _.vowels('fred');
  32993. * // => ['e']
  32994. *
  32995. * _('fred').vowels().value();
  32996. * // => ['e']
  32997. *
  32998. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  32999. * _('fred').vowels();
  33000. * // => ['e']
  33001. */
  33002. function mixin(object, source, options) {
  33003. var props = keys(source),
  33004. methodNames = baseFunctions(source, props);
  33005. if (options == null &&
  33006. !(isObject(source) && (methodNames.length || !props.length))) {
  33007. options = source;
  33008. source = object;
  33009. object = this;
  33010. methodNames = baseFunctions(source, keys(source));
  33011. }
  33012. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33013. isFunc = isFunction(object);
  33014. arrayEach(methodNames, function(methodName) {
  33015. var func = source[methodName];
  33016. object[methodName] = func;
  33017. if (isFunc) {
  33018. object.prototype[methodName] = function() {
  33019. var chainAll = this.__chain__;
  33020. if (chain || chainAll) {
  33021. var result = object(this.__wrapped__),
  33022. actions = result.__actions__ = copyArray(this.__actions__);
  33023. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33024. result.__chain__ = chainAll;
  33025. return result;
  33026. }
  33027. return func.apply(object, arrayPush([this.value()], arguments));
  33028. };
  33029. }
  33030. });
  33031. return object;
  33032. }
  33033. /**
  33034. * Reverts the `_` variable to its previous value and returns a reference to
  33035. * the `lodash` function.
  33036. *
  33037. * @static
  33038. * @since 0.1.0
  33039. * @memberOf _
  33040. * @category Util
  33041. * @returns {Function} Returns the `lodash` function.
  33042. * @example
  33043. *
  33044. * var lodash = _.noConflict();
  33045. */
  33046. function noConflict() {
  33047. if (root._ === this) {
  33048. root._ = oldDash;
  33049. }
  33050. return this;
  33051. }
  33052. /**
  33053. * This method returns `undefined`.
  33054. *
  33055. * @static
  33056. * @memberOf _
  33057. * @since 2.3.0
  33058. * @category Util
  33059. * @example
  33060. *
  33061. * _.times(2, _.noop);
  33062. * // => [undefined, undefined]
  33063. */
  33064. function noop() {
  33065. // No operation performed.
  33066. }
  33067. /**
  33068. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33069. * the nth argument from the end is returned.
  33070. *
  33071. * @static
  33072. * @memberOf _
  33073. * @since 4.0.0
  33074. * @category Util
  33075. * @param {number} [n=0] The index of the argument to return.
  33076. * @returns {Function} Returns the new pass-thru function.
  33077. * @example
  33078. *
  33079. * var func = _.nthArg(1);
  33080. * func('a', 'b', 'c', 'd');
  33081. * // => 'b'
  33082. *
  33083. * var func = _.nthArg(-2);
  33084. * func('a', 'b', 'c', 'd');
  33085. * // => 'c'
  33086. */
  33087. function nthArg(n) {
  33088. n = toInteger(n);
  33089. return baseRest(function(args) {
  33090. return baseNth(args, n);
  33091. });
  33092. }
  33093. /**
  33094. * Creates a function that invokes `iteratees` with the arguments it receives
  33095. * and returns their results.
  33096. *
  33097. * @static
  33098. * @memberOf _
  33099. * @since 4.0.0
  33100. * @category Util
  33101. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33102. * The iteratees to invoke.
  33103. * @returns {Function} Returns the new function.
  33104. * @example
  33105. *
  33106. * var func = _.over([Math.max, Math.min]);
  33107. *
  33108. * func(1, 2, 3, 4);
  33109. * // => [4, 1]
  33110. */
  33111. var over = createOver(arrayMap);
  33112. /**
  33113. * Creates a function that checks if **all** of the `predicates` return
  33114. * truthy when invoked with the arguments it receives.
  33115. *
  33116. * @static
  33117. * @memberOf _
  33118. * @since 4.0.0
  33119. * @category Util
  33120. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33121. * The predicates to check.
  33122. * @returns {Function} Returns the new function.
  33123. * @example
  33124. *
  33125. * var func = _.overEvery([Boolean, isFinite]);
  33126. *
  33127. * func('1');
  33128. * // => true
  33129. *
  33130. * func(null);
  33131. * // => false
  33132. *
  33133. * func(NaN);
  33134. * // => false
  33135. */
  33136. var overEvery = createOver(arrayEvery);
  33137. /**
  33138. * Creates a function that checks if **any** of the `predicates` return
  33139. * truthy when invoked with the arguments it receives.
  33140. *
  33141. * @static
  33142. * @memberOf _
  33143. * @since 4.0.0
  33144. * @category Util
  33145. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33146. * The predicates to check.
  33147. * @returns {Function} Returns the new function.
  33148. * @example
  33149. *
  33150. * var func = _.overSome([Boolean, isFinite]);
  33151. *
  33152. * func('1');
  33153. * // => true
  33154. *
  33155. * func(null);
  33156. * // => true
  33157. *
  33158. * func(NaN);
  33159. * // => false
  33160. */
  33161. var overSome = createOver(arraySome);
  33162. /**
  33163. * Creates a function that returns the value at `path` of a given object.
  33164. *
  33165. * @static
  33166. * @memberOf _
  33167. * @since 2.4.0
  33168. * @category Util
  33169. * @param {Array|string} path The path of the property to get.
  33170. * @returns {Function} Returns the new accessor function.
  33171. * @example
  33172. *
  33173. * var objects = [
  33174. * { 'a': { 'b': 2 } },
  33175. * { 'a': { 'b': 1 } }
  33176. * ];
  33177. *
  33178. * _.map(objects, _.property('a.b'));
  33179. * // => [2, 1]
  33180. *
  33181. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33182. * // => [1, 2]
  33183. */
  33184. function property(path) {
  33185. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33186. }
  33187. /**
  33188. * The opposite of `_.property`; this method creates a function that returns
  33189. * the value at a given path of `object`.
  33190. *
  33191. * @static
  33192. * @memberOf _
  33193. * @since 3.0.0
  33194. * @category Util
  33195. * @param {Object} object The object to query.
  33196. * @returns {Function} Returns the new accessor function.
  33197. * @example
  33198. *
  33199. * var array = [0, 1, 2],
  33200. * object = { 'a': array, 'b': array, 'c': array };
  33201. *
  33202. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33203. * // => [2, 0]
  33204. *
  33205. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33206. * // => [2, 0]
  33207. */
  33208. function propertyOf(object) {
  33209. return function(path) {
  33210. return object == null ? undefined : baseGet(object, path);
  33211. };
  33212. }
  33213. /**
  33214. * Creates an array of numbers (positive and/or negative) progressing from
  33215. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33216. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33217. * it's set to `start` with `start` then set to `0`.
  33218. *
  33219. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33220. * floating-point values which can produce unexpected results.
  33221. *
  33222. * @static
  33223. * @since 0.1.0
  33224. * @memberOf _
  33225. * @category Util
  33226. * @param {number} [start=0] The start of the range.
  33227. * @param {number} end The end of the range.
  33228. * @param {number} [step=1] The value to increment or decrement by.
  33229. * @returns {Array} Returns the range of numbers.
  33230. * @see _.inRange, _.rangeRight
  33231. * @example
  33232. *
  33233. * _.range(4);
  33234. * // => [0, 1, 2, 3]
  33235. *
  33236. * _.range(-4);
  33237. * // => [0, -1, -2, -3]
  33238. *
  33239. * _.range(1, 5);
  33240. * // => [1, 2, 3, 4]
  33241. *
  33242. * _.range(0, 20, 5);
  33243. * // => [0, 5, 10, 15]
  33244. *
  33245. * _.range(0, -4, -1);
  33246. * // => [0, -1, -2, -3]
  33247. *
  33248. * _.range(1, 4, 0);
  33249. * // => [1, 1, 1]
  33250. *
  33251. * _.range(0);
  33252. * // => []
  33253. */
  33254. var range = createRange();
  33255. /**
  33256. * This method is like `_.range` except that it populates values in
  33257. * descending order.
  33258. *
  33259. * @static
  33260. * @memberOf _
  33261. * @since 4.0.0
  33262. * @category Util
  33263. * @param {number} [start=0] The start of the range.
  33264. * @param {number} end The end of the range.
  33265. * @param {number} [step=1] The value to increment or decrement by.
  33266. * @returns {Array} Returns the range of numbers.
  33267. * @see _.inRange, _.range
  33268. * @example
  33269. *
  33270. * _.rangeRight(4);
  33271. * // => [3, 2, 1, 0]
  33272. *
  33273. * _.rangeRight(-4);
  33274. * // => [-3, -2, -1, 0]
  33275. *
  33276. * _.rangeRight(1, 5);
  33277. * // => [4, 3, 2, 1]
  33278. *
  33279. * _.rangeRight(0, 20, 5);
  33280. * // => [15, 10, 5, 0]
  33281. *
  33282. * _.rangeRight(0, -4, -1);
  33283. * // => [-3, -2, -1, 0]
  33284. *
  33285. * _.rangeRight(1, 4, 0);
  33286. * // => [1, 1, 1]
  33287. *
  33288. * _.rangeRight(0);
  33289. * // => []
  33290. */
  33291. var rangeRight = createRange(true);
  33292. /**
  33293. * This method returns a new empty array.
  33294. *
  33295. * @static
  33296. * @memberOf _
  33297. * @since 4.13.0
  33298. * @category Util
  33299. * @returns {Array} Returns the new empty array.
  33300. * @example
  33301. *
  33302. * var arrays = _.times(2, _.stubArray);
  33303. *
  33304. * console.log(arrays);
  33305. * // => [[], []]
  33306. *
  33307. * console.log(arrays[0] === arrays[1]);
  33308. * // => false
  33309. */
  33310. function stubArray() {
  33311. return [];
  33312. }
  33313. /**
  33314. * This method returns `false`.
  33315. *
  33316. * @static
  33317. * @memberOf _
  33318. * @since 4.13.0
  33319. * @category Util
  33320. * @returns {boolean} Returns `false`.
  33321. * @example
  33322. *
  33323. * _.times(2, _.stubFalse);
  33324. * // => [false, false]
  33325. */
  33326. function stubFalse() {
  33327. return false;
  33328. }
  33329. /**
  33330. * This method returns a new empty object.
  33331. *
  33332. * @static
  33333. * @memberOf _
  33334. * @since 4.13.0
  33335. * @category Util
  33336. * @returns {Object} Returns the new empty object.
  33337. * @example
  33338. *
  33339. * var objects = _.times(2, _.stubObject);
  33340. *
  33341. * console.log(objects);
  33342. * // => [{}, {}]
  33343. *
  33344. * console.log(objects[0] === objects[1]);
  33345. * // => false
  33346. */
  33347. function stubObject() {
  33348. return {};
  33349. }
  33350. /**
  33351. * This method returns an empty string.
  33352. *
  33353. * @static
  33354. * @memberOf _
  33355. * @since 4.13.0
  33356. * @category Util
  33357. * @returns {string} Returns the empty string.
  33358. * @example
  33359. *
  33360. * _.times(2, _.stubString);
  33361. * // => ['', '']
  33362. */
  33363. function stubString() {
  33364. return '';
  33365. }
  33366. /**
  33367. * This method returns `true`.
  33368. *
  33369. * @static
  33370. * @memberOf _
  33371. * @since 4.13.0
  33372. * @category Util
  33373. * @returns {boolean} Returns `true`.
  33374. * @example
  33375. *
  33376. * _.times(2, _.stubTrue);
  33377. * // => [true, true]
  33378. */
  33379. function stubTrue() {
  33380. return true;
  33381. }
  33382. /**
  33383. * Invokes the iteratee `n` times, returning an array of the results of
  33384. * each invocation. The iteratee is invoked with one argument; (index).
  33385. *
  33386. * @static
  33387. * @since 0.1.0
  33388. * @memberOf _
  33389. * @category Util
  33390. * @param {number} n The number of times to invoke `iteratee`.
  33391. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33392. * @returns {Array} Returns the array of results.
  33393. * @example
  33394. *
  33395. * _.times(3, String);
  33396. * // => ['0', '1', '2']
  33397. *
  33398. * _.times(4, _.constant(0));
  33399. * // => [0, 0, 0, 0]
  33400. */
  33401. function times(n, iteratee) {
  33402. n = toInteger(n);
  33403. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33404. return [];
  33405. }
  33406. var index = MAX_ARRAY_LENGTH,
  33407. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33408. iteratee = getIteratee(iteratee);
  33409. n -= MAX_ARRAY_LENGTH;
  33410. var result = baseTimes(length, iteratee);
  33411. while (++index < n) {
  33412. iteratee(index);
  33413. }
  33414. return result;
  33415. }
  33416. /**
  33417. * Converts `value` to a property path array.
  33418. *
  33419. * @static
  33420. * @memberOf _
  33421. * @since 4.0.0
  33422. * @category Util
  33423. * @param {*} value The value to convert.
  33424. * @returns {Array} Returns the new property path array.
  33425. * @example
  33426. *
  33427. * _.toPath('a.b.c');
  33428. * // => ['a', 'b', 'c']
  33429. *
  33430. * _.toPath('a[0].b.c');
  33431. * // => ['a', '0', 'b', 'c']
  33432. */
  33433. function toPath(value) {
  33434. if (isArray(value)) {
  33435. return arrayMap(value, toKey);
  33436. }
  33437. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33438. }
  33439. /**
  33440. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33441. *
  33442. * @static
  33443. * @since 0.1.0
  33444. * @memberOf _
  33445. * @category Util
  33446. * @param {string} [prefix=''] The value to prefix the ID with.
  33447. * @returns {string} Returns the unique ID.
  33448. * @example
  33449. *
  33450. * _.uniqueId('contact_');
  33451. * // => 'contact_104'
  33452. *
  33453. * _.uniqueId();
  33454. * // => '105'
  33455. */
  33456. function uniqueId(prefix) {
  33457. var id = ++idCounter;
  33458. return toString(prefix) + id;
  33459. }
  33460. /*------------------------------------------------------------------------*/
  33461. /**
  33462. * Adds two numbers.
  33463. *
  33464. * @static
  33465. * @memberOf _
  33466. * @since 3.4.0
  33467. * @category Math
  33468. * @param {number} augend The first number in an addition.
  33469. * @param {number} addend The second number in an addition.
  33470. * @returns {number} Returns the total.
  33471. * @example
  33472. *
  33473. * _.add(6, 4);
  33474. * // => 10
  33475. */
  33476. var add = createMathOperation(function(augend, addend) {
  33477. return augend + addend;
  33478. }, 0);
  33479. /**
  33480. * Computes `number` rounded up to `precision`.
  33481. *
  33482. * @static
  33483. * @memberOf _
  33484. * @since 3.10.0
  33485. * @category Math
  33486. * @param {number} number The number to round up.
  33487. * @param {number} [precision=0] The precision to round up to.
  33488. * @returns {number} Returns the rounded up number.
  33489. * @example
  33490. *
  33491. * _.ceil(4.006);
  33492. * // => 5
  33493. *
  33494. * _.ceil(6.004, 2);
  33495. * // => 6.01
  33496. *
  33497. * _.ceil(6040, -2);
  33498. * // => 6100
  33499. */
  33500. var ceil = createRound('ceil');
  33501. /**
  33502. * Divide two numbers.
  33503. *
  33504. * @static
  33505. * @memberOf _
  33506. * @since 4.7.0
  33507. * @category Math
  33508. * @param {number} dividend The first number in a division.
  33509. * @param {number} divisor The second number in a division.
  33510. * @returns {number} Returns the quotient.
  33511. * @example
  33512. *
  33513. * _.divide(6, 4);
  33514. * // => 1.5
  33515. */
  33516. var divide = createMathOperation(function(dividend, divisor) {
  33517. return dividend / divisor;
  33518. }, 1);
  33519. /**
  33520. * Computes `number` rounded down to `precision`.
  33521. *
  33522. * @static
  33523. * @memberOf _
  33524. * @since 3.10.0
  33525. * @category Math
  33526. * @param {number} number The number to round down.
  33527. * @param {number} [precision=0] The precision to round down to.
  33528. * @returns {number} Returns the rounded down number.
  33529. * @example
  33530. *
  33531. * _.floor(4.006);
  33532. * // => 4
  33533. *
  33534. * _.floor(0.046, 2);
  33535. * // => 0.04
  33536. *
  33537. * _.floor(4060, -2);
  33538. * // => 4000
  33539. */
  33540. var floor = createRound('floor');
  33541. /**
  33542. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33543. * `undefined` is returned.
  33544. *
  33545. * @static
  33546. * @since 0.1.0
  33547. * @memberOf _
  33548. * @category Math
  33549. * @param {Array} array The array to iterate over.
  33550. * @returns {*} Returns the maximum value.
  33551. * @example
  33552. *
  33553. * _.max([4, 2, 8, 6]);
  33554. * // => 8
  33555. *
  33556. * _.max([]);
  33557. * // => undefined
  33558. */
  33559. function max(array) {
  33560. return (array && array.length)
  33561. ? baseExtremum(array, identity, baseGt)
  33562. : undefined;
  33563. }
  33564. /**
  33565. * This method is like `_.max` except that it accepts `iteratee` which is
  33566. * invoked for each element in `array` to generate the criterion by which
  33567. * the value is ranked. The iteratee is invoked with one argument: (value).
  33568. *
  33569. * @static
  33570. * @memberOf _
  33571. * @since 4.0.0
  33572. * @category Math
  33573. * @param {Array} array The array to iterate over.
  33574. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33575. * @returns {*} Returns the maximum value.
  33576. * @example
  33577. *
  33578. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33579. *
  33580. * _.maxBy(objects, function(o) { return o.n; });
  33581. * // => { 'n': 2 }
  33582. *
  33583. * // The `_.property` iteratee shorthand.
  33584. * _.maxBy(objects, 'n');
  33585. * // => { 'n': 2 }
  33586. */
  33587. function maxBy(array, iteratee) {
  33588. return (array && array.length)
  33589. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33590. : undefined;
  33591. }
  33592. /**
  33593. * Computes the mean of the values in `array`.
  33594. *
  33595. * @static
  33596. * @memberOf _
  33597. * @since 4.0.0
  33598. * @category Math
  33599. * @param {Array} array The array to iterate over.
  33600. * @returns {number} Returns the mean.
  33601. * @example
  33602. *
  33603. * _.mean([4, 2, 8, 6]);
  33604. * // => 5
  33605. */
  33606. function mean(array) {
  33607. return baseMean(array, identity);
  33608. }
  33609. /**
  33610. * This method is like `_.mean` except that it accepts `iteratee` which is
  33611. * invoked for each element in `array` to generate the value to be averaged.
  33612. * The iteratee is invoked with one argument: (value).
  33613. *
  33614. * @static
  33615. * @memberOf _
  33616. * @since 4.7.0
  33617. * @category Math
  33618. * @param {Array} array The array to iterate over.
  33619. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33620. * @returns {number} Returns the mean.
  33621. * @example
  33622. *
  33623. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33624. *
  33625. * _.meanBy(objects, function(o) { return o.n; });
  33626. * // => 5
  33627. *
  33628. * // The `_.property` iteratee shorthand.
  33629. * _.meanBy(objects, 'n');
  33630. * // => 5
  33631. */
  33632. function meanBy(array, iteratee) {
  33633. return baseMean(array, getIteratee(iteratee, 2));
  33634. }
  33635. /**
  33636. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33637. * `undefined` is returned.
  33638. *
  33639. * @static
  33640. * @since 0.1.0
  33641. * @memberOf _
  33642. * @category Math
  33643. * @param {Array} array The array to iterate over.
  33644. * @returns {*} Returns the minimum value.
  33645. * @example
  33646. *
  33647. * _.min([4, 2, 8, 6]);
  33648. * // => 2
  33649. *
  33650. * _.min([]);
  33651. * // => undefined
  33652. */
  33653. function min(array) {
  33654. return (array && array.length)
  33655. ? baseExtremum(array, identity, baseLt)
  33656. : undefined;
  33657. }
  33658. /**
  33659. * This method is like `_.min` except that it accepts `iteratee` which is
  33660. * invoked for each element in `array` to generate the criterion by which
  33661. * the value is ranked. The iteratee is invoked with one argument: (value).
  33662. *
  33663. * @static
  33664. * @memberOf _
  33665. * @since 4.0.0
  33666. * @category Math
  33667. * @param {Array} array The array to iterate over.
  33668. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33669. * @returns {*} Returns the minimum value.
  33670. * @example
  33671. *
  33672. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33673. *
  33674. * _.minBy(objects, function(o) { return o.n; });
  33675. * // => { 'n': 1 }
  33676. *
  33677. * // The `_.property` iteratee shorthand.
  33678. * _.minBy(objects, 'n');
  33679. * // => { 'n': 1 }
  33680. */
  33681. function minBy(array, iteratee) {
  33682. return (array && array.length)
  33683. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33684. : undefined;
  33685. }
  33686. /**
  33687. * Multiply two numbers.
  33688. *
  33689. * @static
  33690. * @memberOf _
  33691. * @since 4.7.0
  33692. * @category Math
  33693. * @param {number} multiplier The first number in a multiplication.
  33694. * @param {number} multiplicand The second number in a multiplication.
  33695. * @returns {number} Returns the product.
  33696. * @example
  33697. *
  33698. * _.multiply(6, 4);
  33699. * // => 24
  33700. */
  33701. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33702. return multiplier * multiplicand;
  33703. }, 1);
  33704. /**
  33705. * Computes `number` rounded to `precision`.
  33706. *
  33707. * @static
  33708. * @memberOf _
  33709. * @since 3.10.0
  33710. * @category Math
  33711. * @param {number} number The number to round.
  33712. * @param {number} [precision=0] The precision to round to.
  33713. * @returns {number} Returns the rounded number.
  33714. * @example
  33715. *
  33716. * _.round(4.006);
  33717. * // => 4
  33718. *
  33719. * _.round(4.006, 2);
  33720. * // => 4.01
  33721. *
  33722. * _.round(4060, -2);
  33723. * // => 4100
  33724. */
  33725. var round = createRound('round');
  33726. /**
  33727. * Subtract two numbers.
  33728. *
  33729. * @static
  33730. * @memberOf _
  33731. * @since 4.0.0
  33732. * @category Math
  33733. * @param {number} minuend The first number in a subtraction.
  33734. * @param {number} subtrahend The second number in a subtraction.
  33735. * @returns {number} Returns the difference.
  33736. * @example
  33737. *
  33738. * _.subtract(6, 4);
  33739. * // => 2
  33740. */
  33741. var subtract = createMathOperation(function(minuend, subtrahend) {
  33742. return minuend - subtrahend;
  33743. }, 0);
  33744. /**
  33745. * Computes the sum of the values in `array`.
  33746. *
  33747. * @static
  33748. * @memberOf _
  33749. * @since 3.4.0
  33750. * @category Math
  33751. * @param {Array} array The array to iterate over.
  33752. * @returns {number} Returns the sum.
  33753. * @example
  33754. *
  33755. * _.sum([4, 2, 8, 6]);
  33756. * // => 20
  33757. */
  33758. function sum(array) {
  33759. return (array && array.length)
  33760. ? baseSum(array, identity)
  33761. : 0;
  33762. }
  33763. /**
  33764. * This method is like `_.sum` except that it accepts `iteratee` which is
  33765. * invoked for each element in `array` to generate the value to be summed.
  33766. * The iteratee is invoked with one argument: (value).
  33767. *
  33768. * @static
  33769. * @memberOf _
  33770. * @since 4.0.0
  33771. * @category Math
  33772. * @param {Array} array The array to iterate over.
  33773. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33774. * @returns {number} Returns the sum.
  33775. * @example
  33776. *
  33777. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33778. *
  33779. * _.sumBy(objects, function(o) { return o.n; });
  33780. * // => 20
  33781. *
  33782. * // The `_.property` iteratee shorthand.
  33783. * _.sumBy(objects, 'n');
  33784. * // => 20
  33785. */
  33786. function sumBy(array, iteratee) {
  33787. return (array && array.length)
  33788. ? baseSum(array, getIteratee(iteratee, 2))
  33789. : 0;
  33790. }
  33791. /*------------------------------------------------------------------------*/
  33792. // Add methods that return wrapped values in chain sequences.
  33793. lodash.after = after;
  33794. lodash.ary = ary;
  33795. lodash.assign = assign;
  33796. lodash.assignIn = assignIn;
  33797. lodash.assignInWith = assignInWith;
  33798. lodash.assignWith = assignWith;
  33799. lodash.at = at;
  33800. lodash.before = before;
  33801. lodash.bind = bind;
  33802. lodash.bindAll = bindAll;
  33803. lodash.bindKey = bindKey;
  33804. lodash.castArray = castArray;
  33805. lodash.chain = chain;
  33806. lodash.chunk = chunk;
  33807. lodash.compact = compact;
  33808. lodash.concat = concat;
  33809. lodash.cond = cond;
  33810. lodash.conforms = conforms;
  33811. lodash.constant = constant;
  33812. lodash.countBy = countBy;
  33813. lodash.create = create;
  33814. lodash.curry = curry;
  33815. lodash.curryRight = curryRight;
  33816. lodash.debounce = debounce;
  33817. lodash.defaults = defaults;
  33818. lodash.defaultsDeep = defaultsDeep;
  33819. lodash.defer = defer;
  33820. lodash.delay = delay;
  33821. lodash.difference = difference;
  33822. lodash.differenceBy = differenceBy;
  33823. lodash.differenceWith = differenceWith;
  33824. lodash.drop = drop;
  33825. lodash.dropRight = dropRight;
  33826. lodash.dropRightWhile = dropRightWhile;
  33827. lodash.dropWhile = dropWhile;
  33828. lodash.fill = fill;
  33829. lodash.filter = filter;
  33830. lodash.flatMap = flatMap;
  33831. lodash.flatMapDeep = flatMapDeep;
  33832. lodash.flatMapDepth = flatMapDepth;
  33833. lodash.flatten = flatten;
  33834. lodash.flattenDeep = flattenDeep;
  33835. lodash.flattenDepth = flattenDepth;
  33836. lodash.flip = flip;
  33837. lodash.flow = flow;
  33838. lodash.flowRight = flowRight;
  33839. lodash.fromPairs = fromPairs;
  33840. lodash.functions = functions;
  33841. lodash.functionsIn = functionsIn;
  33842. lodash.groupBy = groupBy;
  33843. lodash.initial = initial;
  33844. lodash.intersection = intersection;
  33845. lodash.intersectionBy = intersectionBy;
  33846. lodash.intersectionWith = intersectionWith;
  33847. lodash.invert = invert;
  33848. lodash.invertBy = invertBy;
  33849. lodash.invokeMap = invokeMap;
  33850. lodash.iteratee = iteratee;
  33851. lodash.keyBy = keyBy;
  33852. lodash.keys = keys;
  33853. lodash.keysIn = keysIn;
  33854. lodash.map = map;
  33855. lodash.mapKeys = mapKeys;
  33856. lodash.mapValues = mapValues;
  33857. lodash.matches = matches;
  33858. lodash.matchesProperty = matchesProperty;
  33859. lodash.memoize = memoize;
  33860. lodash.merge = merge;
  33861. lodash.mergeWith = mergeWith;
  33862. lodash.method = method;
  33863. lodash.methodOf = methodOf;
  33864. lodash.mixin = mixin;
  33865. lodash.negate = negate;
  33866. lodash.nthArg = nthArg;
  33867. lodash.omit = omit;
  33868. lodash.omitBy = omitBy;
  33869. lodash.once = once;
  33870. lodash.orderBy = orderBy;
  33871. lodash.over = over;
  33872. lodash.overArgs = overArgs;
  33873. lodash.overEvery = overEvery;
  33874. lodash.overSome = overSome;
  33875. lodash.partial = partial;
  33876. lodash.partialRight = partialRight;
  33877. lodash.partition = partition;
  33878. lodash.pick = pick;
  33879. lodash.pickBy = pickBy;
  33880. lodash.property = property;
  33881. lodash.propertyOf = propertyOf;
  33882. lodash.pull = pull;
  33883. lodash.pullAll = pullAll;
  33884. lodash.pullAllBy = pullAllBy;
  33885. lodash.pullAllWith = pullAllWith;
  33886. lodash.pullAt = pullAt;
  33887. lodash.range = range;
  33888. lodash.rangeRight = rangeRight;
  33889. lodash.rearg = rearg;
  33890. lodash.reject = reject;
  33891. lodash.remove = remove;
  33892. lodash.rest = rest;
  33893. lodash.reverse = reverse;
  33894. lodash.sampleSize = sampleSize;
  33895. lodash.set = set;
  33896. lodash.setWith = setWith;
  33897. lodash.shuffle = shuffle;
  33898. lodash.slice = slice;
  33899. lodash.sortBy = sortBy;
  33900. lodash.sortedUniq = sortedUniq;
  33901. lodash.sortedUniqBy = sortedUniqBy;
  33902. lodash.split = split;
  33903. lodash.spread = spread;
  33904. lodash.tail = tail;
  33905. lodash.take = take;
  33906. lodash.takeRight = takeRight;
  33907. lodash.takeRightWhile = takeRightWhile;
  33908. lodash.takeWhile = takeWhile;
  33909. lodash.tap = tap;
  33910. lodash.throttle = throttle;
  33911. lodash.thru = thru;
  33912. lodash.toArray = toArray;
  33913. lodash.toPairs = toPairs;
  33914. lodash.toPairsIn = toPairsIn;
  33915. lodash.toPath = toPath;
  33916. lodash.toPlainObject = toPlainObject;
  33917. lodash.transform = transform;
  33918. lodash.unary = unary;
  33919. lodash.union = union;
  33920. lodash.unionBy = unionBy;
  33921. lodash.unionWith = unionWith;
  33922. lodash.uniq = uniq;
  33923. lodash.uniqBy = uniqBy;
  33924. lodash.uniqWith = uniqWith;
  33925. lodash.unset = unset;
  33926. lodash.unzip = unzip;
  33927. lodash.unzipWith = unzipWith;
  33928. lodash.update = update;
  33929. lodash.updateWith = updateWith;
  33930. lodash.values = values;
  33931. lodash.valuesIn = valuesIn;
  33932. lodash.without = without;
  33933. lodash.words = words;
  33934. lodash.wrap = wrap;
  33935. lodash.xor = xor;
  33936. lodash.xorBy = xorBy;
  33937. lodash.xorWith = xorWith;
  33938. lodash.zip = zip;
  33939. lodash.zipObject = zipObject;
  33940. lodash.zipObjectDeep = zipObjectDeep;
  33941. lodash.zipWith = zipWith;
  33942. // Add aliases.
  33943. lodash.entries = toPairs;
  33944. lodash.entriesIn = toPairsIn;
  33945. lodash.extend = assignIn;
  33946. lodash.extendWith = assignInWith;
  33947. // Add methods to `lodash.prototype`.
  33948. mixin(lodash, lodash);
  33949. /*------------------------------------------------------------------------*/
  33950. // Add methods that return unwrapped values in chain sequences.
  33951. lodash.add = add;
  33952. lodash.attempt = attempt;
  33953. lodash.camelCase = camelCase;
  33954. lodash.capitalize = capitalize;
  33955. lodash.ceil = ceil;
  33956. lodash.clamp = clamp;
  33957. lodash.clone = clone;
  33958. lodash.cloneDeep = cloneDeep;
  33959. lodash.cloneDeepWith = cloneDeepWith;
  33960. lodash.cloneWith = cloneWith;
  33961. lodash.conformsTo = conformsTo;
  33962. lodash.deburr = deburr;
  33963. lodash.defaultTo = defaultTo;
  33964. lodash.divide = divide;
  33965. lodash.endsWith = endsWith;
  33966. lodash.eq = eq;
  33967. lodash.escape = escape;
  33968. lodash.escapeRegExp = escapeRegExp;
  33969. lodash.every = every;
  33970. lodash.find = find;
  33971. lodash.findIndex = findIndex;
  33972. lodash.findKey = findKey;
  33973. lodash.findLast = findLast;
  33974. lodash.findLastIndex = findLastIndex;
  33975. lodash.findLastKey = findLastKey;
  33976. lodash.floor = floor;
  33977. lodash.forEach = forEach;
  33978. lodash.forEachRight = forEachRight;
  33979. lodash.forIn = forIn;
  33980. lodash.forInRight = forInRight;
  33981. lodash.forOwn = forOwn;
  33982. lodash.forOwnRight = forOwnRight;
  33983. lodash.get = get;
  33984. lodash.gt = gt;
  33985. lodash.gte = gte;
  33986. lodash.has = has;
  33987. lodash.hasIn = hasIn;
  33988. lodash.head = head;
  33989. lodash.identity = identity;
  33990. lodash.includes = includes;
  33991. lodash.indexOf = indexOf;
  33992. lodash.inRange = inRange;
  33993. lodash.invoke = invoke;
  33994. lodash.isArguments = isArguments;
  33995. lodash.isArray = isArray;
  33996. lodash.isArrayBuffer = isArrayBuffer;
  33997. lodash.isArrayLike = isArrayLike;
  33998. lodash.isArrayLikeObject = isArrayLikeObject;
  33999. lodash.isBoolean = isBoolean;
  34000. lodash.isBuffer = isBuffer;
  34001. lodash.isDate = isDate;
  34002. lodash.isElement = isElement;
  34003. lodash.isEmpty = isEmpty;
  34004. lodash.isEqual = isEqual;
  34005. lodash.isEqualWith = isEqualWith;
  34006. lodash.isError = isError;
  34007. lodash.isFinite = isFinite;
  34008. lodash.isFunction = isFunction;
  34009. lodash.isInteger = isInteger;
  34010. lodash.isLength = isLength;
  34011. lodash.isMap = isMap;
  34012. lodash.isMatch = isMatch;
  34013. lodash.isMatchWith = isMatchWith;
  34014. lodash.isNaN = isNaN;
  34015. lodash.isNative = isNative;
  34016. lodash.isNil = isNil;
  34017. lodash.isNull = isNull;
  34018. lodash.isNumber = isNumber;
  34019. lodash.isObject = isObject;
  34020. lodash.isObjectLike = isObjectLike;
  34021. lodash.isPlainObject = isPlainObject;
  34022. lodash.isRegExp = isRegExp;
  34023. lodash.isSafeInteger = isSafeInteger;
  34024. lodash.isSet = isSet;
  34025. lodash.isString = isString;
  34026. lodash.isSymbol = isSymbol;
  34027. lodash.isTypedArray = isTypedArray;
  34028. lodash.isUndefined = isUndefined;
  34029. lodash.isWeakMap = isWeakMap;
  34030. lodash.isWeakSet = isWeakSet;
  34031. lodash.join = join;
  34032. lodash.kebabCase = kebabCase;
  34033. lodash.last = last;
  34034. lodash.lastIndexOf = lastIndexOf;
  34035. lodash.lowerCase = lowerCase;
  34036. lodash.lowerFirst = lowerFirst;
  34037. lodash.lt = lt;
  34038. lodash.lte = lte;
  34039. lodash.max = max;
  34040. lodash.maxBy = maxBy;
  34041. lodash.mean = mean;
  34042. lodash.meanBy = meanBy;
  34043. lodash.min = min;
  34044. lodash.minBy = minBy;
  34045. lodash.stubArray = stubArray;
  34046. lodash.stubFalse = stubFalse;
  34047. lodash.stubObject = stubObject;
  34048. lodash.stubString = stubString;
  34049. lodash.stubTrue = stubTrue;
  34050. lodash.multiply = multiply;
  34051. lodash.nth = nth;
  34052. lodash.noConflict = noConflict;
  34053. lodash.noop = noop;
  34054. lodash.now = now;
  34055. lodash.pad = pad;
  34056. lodash.padEnd = padEnd;
  34057. lodash.padStart = padStart;
  34058. lodash.parseInt = parseInt;
  34059. lodash.random = random;
  34060. lodash.reduce = reduce;
  34061. lodash.reduceRight = reduceRight;
  34062. lodash.repeat = repeat;
  34063. lodash.replace = replace;
  34064. lodash.result = result;
  34065. lodash.round = round;
  34066. lodash.runInContext = runInContext;
  34067. lodash.sample = sample;
  34068. lodash.size = size;
  34069. lodash.snakeCase = snakeCase;
  34070. lodash.some = some;
  34071. lodash.sortedIndex = sortedIndex;
  34072. lodash.sortedIndexBy = sortedIndexBy;
  34073. lodash.sortedIndexOf = sortedIndexOf;
  34074. lodash.sortedLastIndex = sortedLastIndex;
  34075. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34076. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34077. lodash.startCase = startCase;
  34078. lodash.startsWith = startsWith;
  34079. lodash.subtract = subtract;
  34080. lodash.sum = sum;
  34081. lodash.sumBy = sumBy;
  34082. lodash.template = template;
  34083. lodash.times = times;
  34084. lodash.toFinite = toFinite;
  34085. lodash.toInteger = toInteger;
  34086. lodash.toLength = toLength;
  34087. lodash.toLower = toLower;
  34088. lodash.toNumber = toNumber;
  34089. lodash.toSafeInteger = toSafeInteger;
  34090. lodash.toString = toString;
  34091. lodash.toUpper = toUpper;
  34092. lodash.trim = trim;
  34093. lodash.trimEnd = trimEnd;
  34094. lodash.trimStart = trimStart;
  34095. lodash.truncate = truncate;
  34096. lodash.unescape = unescape;
  34097. lodash.uniqueId = uniqueId;
  34098. lodash.upperCase = upperCase;
  34099. lodash.upperFirst = upperFirst;
  34100. // Add aliases.
  34101. lodash.each = forEach;
  34102. lodash.eachRight = forEachRight;
  34103. lodash.first = head;
  34104. mixin(lodash, (function() {
  34105. var source = {};
  34106. baseForOwn(lodash, function(func, methodName) {
  34107. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34108. source[methodName] = func;
  34109. }
  34110. });
  34111. return source;
  34112. }()), { 'chain': false });
  34113. /*------------------------------------------------------------------------*/
  34114. /**
  34115. * The semantic version number.
  34116. *
  34117. * @static
  34118. * @memberOf _
  34119. * @type {string}
  34120. */
  34121. lodash.VERSION = VERSION;
  34122. // Assign default placeholders.
  34123. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34124. lodash[methodName].placeholder = lodash;
  34125. });
  34126. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34127. arrayEach(['drop', 'take'], function(methodName, index) {
  34128. LazyWrapper.prototype[methodName] = function(n) {
  34129. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34130. var result = (this.__filtered__ && !index)
  34131. ? new LazyWrapper(this)
  34132. : this.clone();
  34133. if (result.__filtered__) {
  34134. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34135. } else {
  34136. result.__views__.push({
  34137. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34138. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34139. });
  34140. }
  34141. return result;
  34142. };
  34143. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34144. return this.reverse()[methodName](n).reverse();
  34145. };
  34146. });
  34147. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34148. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34149. var type = index + 1,
  34150. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34151. LazyWrapper.prototype[methodName] = function(iteratee) {
  34152. var result = this.clone();
  34153. result.__iteratees__.push({
  34154. 'iteratee': getIteratee(iteratee, 3),
  34155. 'type': type
  34156. });
  34157. result.__filtered__ = result.__filtered__ || isFilter;
  34158. return result;
  34159. };
  34160. });
  34161. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34162. arrayEach(['head', 'last'], function(methodName, index) {
  34163. var takeName = 'take' + (index ? 'Right' : '');
  34164. LazyWrapper.prototype[methodName] = function() {
  34165. return this[takeName](1).value()[0];
  34166. };
  34167. });
  34168. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34169. arrayEach(['initial', 'tail'], function(methodName, index) {
  34170. var dropName = 'drop' + (index ? '' : 'Right');
  34171. LazyWrapper.prototype[methodName] = function() {
  34172. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34173. };
  34174. });
  34175. LazyWrapper.prototype.compact = function() {
  34176. return this.filter(identity);
  34177. };
  34178. LazyWrapper.prototype.find = function(predicate) {
  34179. return this.filter(predicate).head();
  34180. };
  34181. LazyWrapper.prototype.findLast = function(predicate) {
  34182. return this.reverse().find(predicate);
  34183. };
  34184. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34185. if (typeof path == 'function') {
  34186. return new LazyWrapper(this);
  34187. }
  34188. return this.map(function(value) {
  34189. return baseInvoke(value, path, args);
  34190. });
  34191. });
  34192. LazyWrapper.prototype.reject = function(predicate) {
  34193. return this.filter(negate(getIteratee(predicate)));
  34194. };
  34195. LazyWrapper.prototype.slice = function(start, end) {
  34196. start = toInteger(start);
  34197. var result = this;
  34198. if (result.__filtered__ && (start > 0 || end < 0)) {
  34199. return new LazyWrapper(result);
  34200. }
  34201. if (start < 0) {
  34202. result = result.takeRight(-start);
  34203. } else if (start) {
  34204. result = result.drop(start);
  34205. }
  34206. if (end !== undefined) {
  34207. end = toInteger(end);
  34208. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34209. }
  34210. return result;
  34211. };
  34212. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34213. return this.reverse().takeWhile(predicate).reverse();
  34214. };
  34215. LazyWrapper.prototype.toArray = function() {
  34216. return this.take(MAX_ARRAY_LENGTH);
  34217. };
  34218. // Add `LazyWrapper` methods to `lodash.prototype`.
  34219. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34220. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34221. isTaker = /^(?:head|last)$/.test(methodName),
  34222. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34223. retUnwrapped = isTaker || /^find/.test(methodName);
  34224. if (!lodashFunc) {
  34225. return;
  34226. }
  34227. lodash.prototype[methodName] = function() {
  34228. var value = this.__wrapped__,
  34229. args = isTaker ? [1] : arguments,
  34230. isLazy = value instanceof LazyWrapper,
  34231. iteratee = args[0],
  34232. useLazy = isLazy || isArray(value);
  34233. var interceptor = function(value) {
  34234. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34235. return (isTaker && chainAll) ? result[0] : result;
  34236. };
  34237. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34238. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34239. isLazy = useLazy = false;
  34240. }
  34241. var chainAll = this.__chain__,
  34242. isHybrid = !!this.__actions__.length,
  34243. isUnwrapped = retUnwrapped && !chainAll,
  34244. onlyLazy = isLazy && !isHybrid;
  34245. if (!retUnwrapped && useLazy) {
  34246. value = onlyLazy ? value : new LazyWrapper(this);
  34247. var result = func.apply(value, args);
  34248. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34249. return new LodashWrapper(result, chainAll);
  34250. }
  34251. if (isUnwrapped && onlyLazy) {
  34252. return func.apply(this, args);
  34253. }
  34254. result = this.thru(interceptor);
  34255. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34256. };
  34257. });
  34258. // Add `Array` methods to `lodash.prototype`.
  34259. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34260. var func = arrayProto[methodName],
  34261. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34262. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34263. lodash.prototype[methodName] = function() {
  34264. var args = arguments;
  34265. if (retUnwrapped && !this.__chain__) {
  34266. var value = this.value();
  34267. return func.apply(isArray(value) ? value : [], args);
  34268. }
  34269. return this[chainName](function(value) {
  34270. return func.apply(isArray(value) ? value : [], args);
  34271. });
  34272. };
  34273. });
  34274. // Map minified method names to their real names.
  34275. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34276. var lodashFunc = lodash[methodName];
  34277. if (lodashFunc) {
  34278. var key = lodashFunc.name + '';
  34279. if (!hasOwnProperty.call(realNames, key)) {
  34280. realNames[key] = [];
  34281. }
  34282. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34283. }
  34284. });
  34285. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34286. 'name': 'wrapper',
  34287. 'func': undefined
  34288. }];
  34289. // Add methods to `LazyWrapper`.
  34290. LazyWrapper.prototype.clone = lazyClone;
  34291. LazyWrapper.prototype.reverse = lazyReverse;
  34292. LazyWrapper.prototype.value = lazyValue;
  34293. // Add chain sequence methods to the `lodash` wrapper.
  34294. lodash.prototype.at = wrapperAt;
  34295. lodash.prototype.chain = wrapperChain;
  34296. lodash.prototype.commit = wrapperCommit;
  34297. lodash.prototype.next = wrapperNext;
  34298. lodash.prototype.plant = wrapperPlant;
  34299. lodash.prototype.reverse = wrapperReverse;
  34300. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34301. // Add lazy aliases.
  34302. lodash.prototype.first = lodash.prototype.head;
  34303. if (symIterator) {
  34304. lodash.prototype[symIterator] = wrapperToIterator;
  34305. }
  34306. return lodash;
  34307. });
  34308. /*--------------------------------------------------------------------------*/
  34309. // Export lodash.
  34310. var _ = runInContext();
  34311. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34312. if (true) {
  34313. // Expose Lodash on the global object to prevent errors when Lodash is
  34314. // loaded by a script tag in the presence of an AMD loader.
  34315. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34316. // Use `_.noConflict` to remove Lodash from the global object.
  34317. root._ = _;
  34318. // Define as an anonymous module so, through path mapping, it can be
  34319. // referenced as the "underscore" module.
  34320. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34321. return _;
  34322. }).call(exports, __webpack_require__, exports, module),
  34323. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34324. }
  34325. // Check for `exports` after `define` in case a build optimizer adds it.
  34326. else {}
  34327. }.call(this));
  34328. /* 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)))
  34329. /***/ }),
  34330. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34331. /*!***************************************************!*\
  34332. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34333. \***************************************************/
  34334. /*! exports provided: default */
  34335. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34336. "use strict";
  34337. __webpack_require__.r(__webpack_exports__);
  34338. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34339. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34340. * @version 1.16.1
  34341. * @license
  34342. * Copyright (c) 2016 Federico Zivolo and contributors
  34343. *
  34344. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34345. * of this software and associated documentation files (the "Software"), to deal
  34346. * in the Software without restriction, including without limitation the rights
  34347. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34348. * copies of the Software, and to permit persons to whom the Software is
  34349. * furnished to do so, subject to the following conditions:
  34350. *
  34351. * The above copyright notice and this permission notice shall be included in all
  34352. * copies or substantial portions of the Software.
  34353. *
  34354. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34355. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34356. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34357. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34358. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34359. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34360. * SOFTWARE.
  34361. */
  34362. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34363. var timeoutDuration = function () {
  34364. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34365. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34366. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34367. return 1;
  34368. }
  34369. }
  34370. return 0;
  34371. }();
  34372. function microtaskDebounce(fn) {
  34373. var called = false;
  34374. return function () {
  34375. if (called) {
  34376. return;
  34377. }
  34378. called = true;
  34379. window.Promise.resolve().then(function () {
  34380. called = false;
  34381. fn();
  34382. });
  34383. };
  34384. }
  34385. function taskDebounce(fn) {
  34386. var scheduled = false;
  34387. return function () {
  34388. if (!scheduled) {
  34389. scheduled = true;
  34390. setTimeout(function () {
  34391. scheduled = false;
  34392. fn();
  34393. }, timeoutDuration);
  34394. }
  34395. };
  34396. }
  34397. var supportsMicroTasks = isBrowser && window.Promise;
  34398. /**
  34399. * Create a debounced version of a method, that's asynchronously deferred
  34400. * but called in the minimum time possible.
  34401. *
  34402. * @method
  34403. * @memberof Popper.Utils
  34404. * @argument {Function} fn
  34405. * @returns {Function}
  34406. */
  34407. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34408. /**
  34409. * Check if the given variable is a function
  34410. * @method
  34411. * @memberof Popper.Utils
  34412. * @argument {Any} functionToCheck - variable to check
  34413. * @returns {Boolean} answer to: is a function?
  34414. */
  34415. function isFunction(functionToCheck) {
  34416. var getType = {};
  34417. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34418. }
  34419. /**
  34420. * Get CSS computed property of the given element
  34421. * @method
  34422. * @memberof Popper.Utils
  34423. * @argument {Eement} element
  34424. * @argument {String} property
  34425. */
  34426. function getStyleComputedProperty(element, property) {
  34427. if (element.nodeType !== 1) {
  34428. return [];
  34429. }
  34430. // NOTE: 1 DOM access here
  34431. var window = element.ownerDocument.defaultView;
  34432. var css = window.getComputedStyle(element, null);
  34433. return property ? css[property] : css;
  34434. }
  34435. /**
  34436. * Returns the parentNode or the host of the element
  34437. * @method
  34438. * @memberof Popper.Utils
  34439. * @argument {Element} element
  34440. * @returns {Element} parent
  34441. */
  34442. function getParentNode(element) {
  34443. if (element.nodeName === 'HTML') {
  34444. return element;
  34445. }
  34446. return element.parentNode || element.host;
  34447. }
  34448. /**
  34449. * Returns the scrolling parent of the given element
  34450. * @method
  34451. * @memberof Popper.Utils
  34452. * @argument {Element} element
  34453. * @returns {Element} scroll parent
  34454. */
  34455. function getScrollParent(element) {
  34456. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34457. if (!element) {
  34458. return document.body;
  34459. }
  34460. switch (element.nodeName) {
  34461. case 'HTML':
  34462. case 'BODY':
  34463. return element.ownerDocument.body;
  34464. case '#document':
  34465. return element.body;
  34466. }
  34467. // Firefox want us to check `-x` and `-y` variations as well
  34468. var _getStyleComputedProp = getStyleComputedProperty(element),
  34469. overflow = _getStyleComputedProp.overflow,
  34470. overflowX = _getStyleComputedProp.overflowX,
  34471. overflowY = _getStyleComputedProp.overflowY;
  34472. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34473. return element;
  34474. }
  34475. return getScrollParent(getParentNode(element));
  34476. }
  34477. /**
  34478. * Returns the reference node of the reference object, or the reference object itself.
  34479. * @method
  34480. * @memberof Popper.Utils
  34481. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34482. * @returns {Element} parent
  34483. */
  34484. function getReferenceNode(reference) {
  34485. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34486. }
  34487. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34488. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34489. /**
  34490. * Determines if the browser is Internet Explorer
  34491. * @method
  34492. * @memberof Popper.Utils
  34493. * @param {Number} version to check
  34494. * @returns {Boolean} isIE
  34495. */
  34496. function isIE(version) {
  34497. if (version === 11) {
  34498. return isIE11;
  34499. }
  34500. if (version === 10) {
  34501. return isIE10;
  34502. }
  34503. return isIE11 || isIE10;
  34504. }
  34505. /**
  34506. * Returns the offset parent of the given element
  34507. * @method
  34508. * @memberof Popper.Utils
  34509. * @argument {Element} element
  34510. * @returns {Element} offset parent
  34511. */
  34512. function getOffsetParent(element) {
  34513. if (!element) {
  34514. return document.documentElement;
  34515. }
  34516. var noOffsetParent = isIE(10) ? document.body : null;
  34517. // NOTE: 1 DOM access here
  34518. var offsetParent = element.offsetParent || null;
  34519. // Skip hidden elements which don't have an offsetParent
  34520. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34521. offsetParent = (element = element.nextElementSibling).offsetParent;
  34522. }
  34523. var nodeName = offsetParent && offsetParent.nodeName;
  34524. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34525. return element ? element.ownerDocument.documentElement : document.documentElement;
  34526. }
  34527. // .offsetParent will return the closest TH, TD or TABLE in case
  34528. // no offsetParent is present, I hate this job...
  34529. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34530. return getOffsetParent(offsetParent);
  34531. }
  34532. return offsetParent;
  34533. }
  34534. function isOffsetContainer(element) {
  34535. var nodeName = element.nodeName;
  34536. if (nodeName === 'BODY') {
  34537. return false;
  34538. }
  34539. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34540. }
  34541. /**
  34542. * Finds the root node (document, shadowDOM root) of the given element
  34543. * @method
  34544. * @memberof Popper.Utils
  34545. * @argument {Element} node
  34546. * @returns {Element} root node
  34547. */
  34548. function getRoot(node) {
  34549. if (node.parentNode !== null) {
  34550. return getRoot(node.parentNode);
  34551. }
  34552. return node;
  34553. }
  34554. /**
  34555. * Finds the offset parent common to the two provided nodes
  34556. * @method
  34557. * @memberof Popper.Utils
  34558. * @argument {Element} element1
  34559. * @argument {Element} element2
  34560. * @returns {Element} common offset parent
  34561. */
  34562. function findCommonOffsetParent(element1, element2) {
  34563. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34564. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34565. return document.documentElement;
  34566. }
  34567. // Here we make sure to give as "start" the element that comes first in the DOM
  34568. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34569. var start = order ? element1 : element2;
  34570. var end = order ? element2 : element1;
  34571. // Get common ancestor container
  34572. var range = document.createRange();
  34573. range.setStart(start, 0);
  34574. range.setEnd(end, 0);
  34575. var commonAncestorContainer = range.commonAncestorContainer;
  34576. // Both nodes are inside #document
  34577. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34578. if (isOffsetContainer(commonAncestorContainer)) {
  34579. return commonAncestorContainer;
  34580. }
  34581. return getOffsetParent(commonAncestorContainer);
  34582. }
  34583. // one of the nodes is inside shadowDOM, find which one
  34584. var element1root = getRoot(element1);
  34585. if (element1root.host) {
  34586. return findCommonOffsetParent(element1root.host, element2);
  34587. } else {
  34588. return findCommonOffsetParent(element1, getRoot(element2).host);
  34589. }
  34590. }
  34591. /**
  34592. * Gets the scroll value of the given element in the given side (top and left)
  34593. * @method
  34594. * @memberof Popper.Utils
  34595. * @argument {Element} element
  34596. * @argument {String} side `top` or `left`
  34597. * @returns {number} amount of scrolled pixels
  34598. */
  34599. function getScroll(element) {
  34600. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34601. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34602. var nodeName = element.nodeName;
  34603. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34604. var html = element.ownerDocument.documentElement;
  34605. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34606. return scrollingElement[upperSide];
  34607. }
  34608. return element[upperSide];
  34609. }
  34610. /*
  34611. * Sum or subtract the element scroll values (left and top) from a given rect object
  34612. * @method
  34613. * @memberof Popper.Utils
  34614. * @param {Object} rect - Rect object you want to change
  34615. * @param {HTMLElement} element - The element from the function reads the scroll values
  34616. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34617. * @return {Object} rect - The modifier rect object
  34618. */
  34619. function includeScroll(rect, element) {
  34620. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34621. var scrollTop = getScroll(element, 'top');
  34622. var scrollLeft = getScroll(element, 'left');
  34623. var modifier = subtract ? -1 : 1;
  34624. rect.top += scrollTop * modifier;
  34625. rect.bottom += scrollTop * modifier;
  34626. rect.left += scrollLeft * modifier;
  34627. rect.right += scrollLeft * modifier;
  34628. return rect;
  34629. }
  34630. /*
  34631. * Helper to detect borders of a given element
  34632. * @method
  34633. * @memberof Popper.Utils
  34634. * @param {CSSStyleDeclaration} styles
  34635. * Result of `getStyleComputedProperty` on the given element
  34636. * @param {String} axis - `x` or `y`
  34637. * @return {number} borders - The borders size of the given axis
  34638. */
  34639. function getBordersSize(styles, axis) {
  34640. var sideA = axis === 'x' ? 'Left' : 'Top';
  34641. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34642. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34643. }
  34644. function getSize(axis, body, html, computedStyle) {
  34645. 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);
  34646. }
  34647. function getWindowSizes(document) {
  34648. var body = document.body;
  34649. var html = document.documentElement;
  34650. var computedStyle = isIE(10) && getComputedStyle(html);
  34651. return {
  34652. height: getSize('Height', body, html, computedStyle),
  34653. width: getSize('Width', body, html, computedStyle)
  34654. };
  34655. }
  34656. var classCallCheck = function (instance, Constructor) {
  34657. if (!(instance instanceof Constructor)) {
  34658. throw new TypeError("Cannot call a class as a function");
  34659. }
  34660. };
  34661. var createClass = function () {
  34662. function defineProperties(target, props) {
  34663. for (var i = 0; i < props.length; i++) {
  34664. var descriptor = props[i];
  34665. descriptor.enumerable = descriptor.enumerable || false;
  34666. descriptor.configurable = true;
  34667. if ("value" in descriptor) descriptor.writable = true;
  34668. Object.defineProperty(target, descriptor.key, descriptor);
  34669. }
  34670. }
  34671. return function (Constructor, protoProps, staticProps) {
  34672. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34673. if (staticProps) defineProperties(Constructor, staticProps);
  34674. return Constructor;
  34675. };
  34676. }();
  34677. var defineProperty = function (obj, key, value) {
  34678. if (key in obj) {
  34679. Object.defineProperty(obj, key, {
  34680. value: value,
  34681. enumerable: true,
  34682. configurable: true,
  34683. writable: true
  34684. });
  34685. } else {
  34686. obj[key] = value;
  34687. }
  34688. return obj;
  34689. };
  34690. var _extends = Object.assign || function (target) {
  34691. for (var i = 1; i < arguments.length; i++) {
  34692. var source = arguments[i];
  34693. for (var key in source) {
  34694. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34695. target[key] = source[key];
  34696. }
  34697. }
  34698. }
  34699. return target;
  34700. };
  34701. /**
  34702. * Given element offsets, generate an output similar to getBoundingClientRect
  34703. * @method
  34704. * @memberof Popper.Utils
  34705. * @argument {Object} offsets
  34706. * @returns {Object} ClientRect like output
  34707. */
  34708. function getClientRect(offsets) {
  34709. return _extends({}, offsets, {
  34710. right: offsets.left + offsets.width,
  34711. bottom: offsets.top + offsets.height
  34712. });
  34713. }
  34714. /**
  34715. * Get bounding client rect of given element
  34716. * @method
  34717. * @memberof Popper.Utils
  34718. * @param {HTMLElement} element
  34719. * @return {Object} client rect
  34720. */
  34721. function getBoundingClientRect(element) {
  34722. var rect = {};
  34723. // IE10 10 FIX: Please, don't ask, the element isn't
  34724. // considered in DOM in some circumstances...
  34725. // This isn't reproducible in IE10 compatibility mode of IE11
  34726. try {
  34727. if (isIE(10)) {
  34728. rect = element.getBoundingClientRect();
  34729. var scrollTop = getScroll(element, 'top');
  34730. var scrollLeft = getScroll(element, 'left');
  34731. rect.top += scrollTop;
  34732. rect.left += scrollLeft;
  34733. rect.bottom += scrollTop;
  34734. rect.right += scrollLeft;
  34735. } else {
  34736. rect = element.getBoundingClientRect();
  34737. }
  34738. } catch (e) {}
  34739. var result = {
  34740. left: rect.left,
  34741. top: rect.top,
  34742. width: rect.right - rect.left,
  34743. height: rect.bottom - rect.top
  34744. };
  34745. // subtract scrollbar size from sizes
  34746. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34747. var width = sizes.width || element.clientWidth || result.width;
  34748. var height = sizes.height || element.clientHeight || result.height;
  34749. var horizScrollbar = element.offsetWidth - width;
  34750. var vertScrollbar = element.offsetHeight - height;
  34751. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34752. // we make this check conditional for performance reasons
  34753. if (horizScrollbar || vertScrollbar) {
  34754. var styles = getStyleComputedProperty(element);
  34755. horizScrollbar -= getBordersSize(styles, 'x');
  34756. vertScrollbar -= getBordersSize(styles, 'y');
  34757. result.width -= horizScrollbar;
  34758. result.height -= vertScrollbar;
  34759. }
  34760. return getClientRect(result);
  34761. }
  34762. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34763. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34764. var isIE10 = isIE(10);
  34765. var isHTML = parent.nodeName === 'HTML';
  34766. var childrenRect = getBoundingClientRect(children);
  34767. var parentRect = getBoundingClientRect(parent);
  34768. var scrollParent = getScrollParent(children);
  34769. var styles = getStyleComputedProperty(parent);
  34770. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34771. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34772. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34773. if (fixedPosition && isHTML) {
  34774. parentRect.top = Math.max(parentRect.top, 0);
  34775. parentRect.left = Math.max(parentRect.left, 0);
  34776. }
  34777. var offsets = getClientRect({
  34778. top: childrenRect.top - parentRect.top - borderTopWidth,
  34779. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34780. width: childrenRect.width,
  34781. height: childrenRect.height
  34782. });
  34783. offsets.marginTop = 0;
  34784. offsets.marginLeft = 0;
  34785. // Subtract margins of documentElement in case it's being used as parent
  34786. // we do this only on HTML because it's the only element that behaves
  34787. // differently when margins are applied to it. The margins are included in
  34788. // the box of the documentElement, in the other cases not.
  34789. if (!isIE10 && isHTML) {
  34790. var marginTop = parseFloat(styles.marginTop);
  34791. var marginLeft = parseFloat(styles.marginLeft);
  34792. offsets.top -= borderTopWidth - marginTop;
  34793. offsets.bottom -= borderTopWidth - marginTop;
  34794. offsets.left -= borderLeftWidth - marginLeft;
  34795. offsets.right -= borderLeftWidth - marginLeft;
  34796. // Attach marginTop and marginLeft because in some circumstances we may need them
  34797. offsets.marginTop = marginTop;
  34798. offsets.marginLeft = marginLeft;
  34799. }
  34800. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34801. offsets = includeScroll(offsets, parent);
  34802. }
  34803. return offsets;
  34804. }
  34805. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34806. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34807. var html = element.ownerDocument.documentElement;
  34808. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34809. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34810. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34811. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34812. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34813. var offset = {
  34814. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34815. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34816. width: width,
  34817. height: height
  34818. };
  34819. return getClientRect(offset);
  34820. }
  34821. /**
  34822. * Check if the given element is fixed or is inside a fixed parent
  34823. * @method
  34824. * @memberof Popper.Utils
  34825. * @argument {Element} element
  34826. * @argument {Element} customContainer
  34827. * @returns {Boolean} answer to "isFixed?"
  34828. */
  34829. function isFixed(element) {
  34830. var nodeName = element.nodeName;
  34831. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34832. return false;
  34833. }
  34834. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34835. return true;
  34836. }
  34837. var parentNode = getParentNode(element);
  34838. if (!parentNode) {
  34839. return false;
  34840. }
  34841. return isFixed(parentNode);
  34842. }
  34843. /**
  34844. * Finds the first parent of an element that has a transformed property defined
  34845. * @method
  34846. * @memberof Popper.Utils
  34847. * @argument {Element} element
  34848. * @returns {Element} first transformed parent or documentElement
  34849. */
  34850. function getFixedPositionOffsetParent(element) {
  34851. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34852. if (!element || !element.parentElement || isIE()) {
  34853. return document.documentElement;
  34854. }
  34855. var el = element.parentElement;
  34856. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34857. el = el.parentElement;
  34858. }
  34859. return el || document.documentElement;
  34860. }
  34861. /**
  34862. * Computed the boundaries limits and return them
  34863. * @method
  34864. * @memberof Popper.Utils
  34865. * @param {HTMLElement} popper
  34866. * @param {HTMLElement} reference
  34867. * @param {number} padding
  34868. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34869. * @param {Boolean} fixedPosition - Is in fixed position mode
  34870. * @returns {Object} Coordinates of the boundaries
  34871. */
  34872. function getBoundaries(popper, reference, padding, boundariesElement) {
  34873. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34874. // NOTE: 1 DOM access here
  34875. var boundaries = { top: 0, left: 0 };
  34876. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34877. // Handle viewport case
  34878. if (boundariesElement === 'viewport') {
  34879. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34880. } else {
  34881. // Handle other cases based on DOM element used as boundaries
  34882. var boundariesNode = void 0;
  34883. if (boundariesElement === 'scrollParent') {
  34884. boundariesNode = getScrollParent(getParentNode(reference));
  34885. if (boundariesNode.nodeName === 'BODY') {
  34886. boundariesNode = popper.ownerDocument.documentElement;
  34887. }
  34888. } else if (boundariesElement === 'window') {
  34889. boundariesNode = popper.ownerDocument.documentElement;
  34890. } else {
  34891. boundariesNode = boundariesElement;
  34892. }
  34893. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34894. // In case of HTML, we need a different computation
  34895. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34896. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34897. height = _getWindowSizes.height,
  34898. width = _getWindowSizes.width;
  34899. boundaries.top += offsets.top - offsets.marginTop;
  34900. boundaries.bottom = height + offsets.top;
  34901. boundaries.left += offsets.left - offsets.marginLeft;
  34902. boundaries.right = width + offsets.left;
  34903. } else {
  34904. // for all the other DOM elements, this one is good
  34905. boundaries = offsets;
  34906. }
  34907. }
  34908. // Add paddings
  34909. padding = padding || 0;
  34910. var isPaddingNumber = typeof padding === 'number';
  34911. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34912. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34913. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34914. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34915. return boundaries;
  34916. }
  34917. function getArea(_ref) {
  34918. var width = _ref.width,
  34919. height = _ref.height;
  34920. return width * height;
  34921. }
  34922. /**
  34923. * Utility used to transform the `auto` placement to the placement with more
  34924. * available space.
  34925. * @method
  34926. * @memberof Popper.Utils
  34927. * @argument {Object} data - The data object generated by update method
  34928. * @argument {Object} options - Modifiers configuration and options
  34929. * @returns {Object} The data object, properly modified
  34930. */
  34931. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34932. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34933. if (placement.indexOf('auto') === -1) {
  34934. return placement;
  34935. }
  34936. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34937. var rects = {
  34938. top: {
  34939. width: boundaries.width,
  34940. height: refRect.top - boundaries.top
  34941. },
  34942. right: {
  34943. width: boundaries.right - refRect.right,
  34944. height: boundaries.height
  34945. },
  34946. bottom: {
  34947. width: boundaries.width,
  34948. height: boundaries.bottom - refRect.bottom
  34949. },
  34950. left: {
  34951. width: refRect.left - boundaries.left,
  34952. height: boundaries.height
  34953. }
  34954. };
  34955. var sortedAreas = Object.keys(rects).map(function (key) {
  34956. return _extends({
  34957. key: key
  34958. }, rects[key], {
  34959. area: getArea(rects[key])
  34960. });
  34961. }).sort(function (a, b) {
  34962. return b.area - a.area;
  34963. });
  34964. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34965. var width = _ref2.width,
  34966. height = _ref2.height;
  34967. return width >= popper.clientWidth && height >= popper.clientHeight;
  34968. });
  34969. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  34970. var variation = placement.split('-')[1];
  34971. return computedPlacement + (variation ? '-' + variation : '');
  34972. }
  34973. /**
  34974. * Get offsets to the reference element
  34975. * @method
  34976. * @memberof Popper.Utils
  34977. * @param {Object} state
  34978. * @param {Element} popper - the popper element
  34979. * @param {Element} reference - the reference element (the popper will be relative to this)
  34980. * @param {Element} fixedPosition - is in fixed position mode
  34981. * @returns {Object} An object containing the offsets which will be applied to the popper
  34982. */
  34983. function getReferenceOffsets(state, popper, reference) {
  34984. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  34985. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34986. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  34987. }
  34988. /**
  34989. * Get the outer sizes of the given element (offset size + margins)
  34990. * @method
  34991. * @memberof Popper.Utils
  34992. * @argument {Element} element
  34993. * @returns {Object} object containing width and height properties
  34994. */
  34995. function getOuterSizes(element) {
  34996. var window = element.ownerDocument.defaultView;
  34997. var styles = window.getComputedStyle(element);
  34998. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  34999. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35000. var result = {
  35001. width: element.offsetWidth + y,
  35002. height: element.offsetHeight + x
  35003. };
  35004. return result;
  35005. }
  35006. /**
  35007. * Get the opposite placement of the given one
  35008. * @method
  35009. * @memberof Popper.Utils
  35010. * @argument {String} placement
  35011. * @returns {String} flipped placement
  35012. */
  35013. function getOppositePlacement(placement) {
  35014. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35015. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35016. return hash[matched];
  35017. });
  35018. }
  35019. /**
  35020. * Get offsets to the popper
  35021. * @method
  35022. * @memberof Popper.Utils
  35023. * @param {Object} position - CSS position the Popper will get applied
  35024. * @param {HTMLElement} popper - the popper element
  35025. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35026. * @param {String} placement - one of the valid placement options
  35027. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35028. */
  35029. function getPopperOffsets(popper, referenceOffsets, placement) {
  35030. placement = placement.split('-')[0];
  35031. // Get popper node sizes
  35032. var popperRect = getOuterSizes(popper);
  35033. // Add position, width and height to our offsets object
  35034. var popperOffsets = {
  35035. width: popperRect.width,
  35036. height: popperRect.height
  35037. };
  35038. // depending by the popper placement we have to compute its offsets slightly differently
  35039. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35040. var mainSide = isHoriz ? 'top' : 'left';
  35041. var secondarySide = isHoriz ? 'left' : 'top';
  35042. var measurement = isHoriz ? 'height' : 'width';
  35043. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35044. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35045. if (placement === secondarySide) {
  35046. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35047. } else {
  35048. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35049. }
  35050. return popperOffsets;
  35051. }
  35052. /**
  35053. * Mimics the `find` method of Array
  35054. * @method
  35055. * @memberof Popper.Utils
  35056. * @argument {Array} arr
  35057. * @argument prop
  35058. * @argument value
  35059. * @returns index or -1
  35060. */
  35061. function find(arr, check) {
  35062. // use native find if supported
  35063. if (Array.prototype.find) {
  35064. return arr.find(check);
  35065. }
  35066. // use `filter` to obtain the same behavior of `find`
  35067. return arr.filter(check)[0];
  35068. }
  35069. /**
  35070. * Return the index of the matching object
  35071. * @method
  35072. * @memberof Popper.Utils
  35073. * @argument {Array} arr
  35074. * @argument prop
  35075. * @argument value
  35076. * @returns index or -1
  35077. */
  35078. function findIndex(arr, prop, value) {
  35079. // use native findIndex if supported
  35080. if (Array.prototype.findIndex) {
  35081. return arr.findIndex(function (cur) {
  35082. return cur[prop] === value;
  35083. });
  35084. }
  35085. // use `find` + `indexOf` if `findIndex` isn't supported
  35086. var match = find(arr, function (obj) {
  35087. return obj[prop] === value;
  35088. });
  35089. return arr.indexOf(match);
  35090. }
  35091. /**
  35092. * Loop trough the list of modifiers and run them in order,
  35093. * each of them will then edit the data object.
  35094. * @method
  35095. * @memberof Popper.Utils
  35096. * @param {dataObject} data
  35097. * @param {Array} modifiers
  35098. * @param {String} ends - Optional modifier name used as stopper
  35099. * @returns {dataObject}
  35100. */
  35101. function runModifiers(modifiers, data, ends) {
  35102. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35103. modifiersToRun.forEach(function (modifier) {
  35104. if (modifier['function']) {
  35105. // eslint-disable-line dot-notation
  35106. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35107. }
  35108. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35109. if (modifier.enabled && isFunction(fn)) {
  35110. // Add properties to offsets to make them a complete clientRect object
  35111. // we do this before each modifier to make sure the previous one doesn't
  35112. // mess with these values
  35113. data.offsets.popper = getClientRect(data.offsets.popper);
  35114. data.offsets.reference = getClientRect(data.offsets.reference);
  35115. data = fn(data, modifier);
  35116. }
  35117. });
  35118. return data;
  35119. }
  35120. /**
  35121. * Updates the position of the popper, computing the new offsets and applying
  35122. * the new style.<br />
  35123. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35124. * @method
  35125. * @memberof Popper
  35126. */
  35127. function update() {
  35128. // if popper is destroyed, don't perform any further update
  35129. if (this.state.isDestroyed) {
  35130. return;
  35131. }
  35132. var data = {
  35133. instance: this,
  35134. styles: {},
  35135. arrowStyles: {},
  35136. attributes: {},
  35137. flipped: false,
  35138. offsets: {}
  35139. };
  35140. // compute reference element offsets
  35141. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35142. // compute auto placement, store placement inside the data object,
  35143. // modifiers will be able to edit `placement` if needed
  35144. // and refer to originalPlacement to know the original value
  35145. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35146. // store the computed placement inside `originalPlacement`
  35147. data.originalPlacement = data.placement;
  35148. data.positionFixed = this.options.positionFixed;
  35149. // compute the popper offsets
  35150. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35151. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35152. // run the modifiers
  35153. data = runModifiers(this.modifiers, data);
  35154. // the first `update` will call `onCreate` callback
  35155. // the other ones will call `onUpdate` callback
  35156. if (!this.state.isCreated) {
  35157. this.state.isCreated = true;
  35158. this.options.onCreate(data);
  35159. } else {
  35160. this.options.onUpdate(data);
  35161. }
  35162. }
  35163. /**
  35164. * Helper used to know if the given modifier is enabled.
  35165. * @method
  35166. * @memberof Popper.Utils
  35167. * @returns {Boolean}
  35168. */
  35169. function isModifierEnabled(modifiers, modifierName) {
  35170. return modifiers.some(function (_ref) {
  35171. var name = _ref.name,
  35172. enabled = _ref.enabled;
  35173. return enabled && name === modifierName;
  35174. });
  35175. }
  35176. /**
  35177. * Get the prefixed supported property name
  35178. * @method
  35179. * @memberof Popper.Utils
  35180. * @argument {String} property (camelCase)
  35181. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35182. */
  35183. function getSupportedPropertyName(property) {
  35184. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35185. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35186. for (var i = 0; i < prefixes.length; i++) {
  35187. var prefix = prefixes[i];
  35188. var toCheck = prefix ? '' + prefix + upperProp : property;
  35189. if (typeof document.body.style[toCheck] !== 'undefined') {
  35190. return toCheck;
  35191. }
  35192. }
  35193. return null;
  35194. }
  35195. /**
  35196. * Destroys the popper.
  35197. * @method
  35198. * @memberof Popper
  35199. */
  35200. function destroy() {
  35201. this.state.isDestroyed = true;
  35202. // touch DOM only if `applyStyle` modifier is enabled
  35203. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35204. this.popper.removeAttribute('x-placement');
  35205. this.popper.style.position = '';
  35206. this.popper.style.top = '';
  35207. this.popper.style.left = '';
  35208. this.popper.style.right = '';
  35209. this.popper.style.bottom = '';
  35210. this.popper.style.willChange = '';
  35211. this.popper.style[getSupportedPropertyName('transform')] = '';
  35212. }
  35213. this.disableEventListeners();
  35214. // remove the popper if user explicitly asked for the deletion on destroy
  35215. // do not use `remove` because IE11 doesn't support it
  35216. if (this.options.removeOnDestroy) {
  35217. this.popper.parentNode.removeChild(this.popper);
  35218. }
  35219. return this;
  35220. }
  35221. /**
  35222. * Get the window associated with the element
  35223. * @argument {Element} element
  35224. * @returns {Window}
  35225. */
  35226. function getWindow(element) {
  35227. var ownerDocument = element.ownerDocument;
  35228. return ownerDocument ? ownerDocument.defaultView : window;
  35229. }
  35230. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35231. var isBody = scrollParent.nodeName === 'BODY';
  35232. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35233. target.addEventListener(event, callback, { passive: true });
  35234. if (!isBody) {
  35235. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35236. }
  35237. scrollParents.push(target);
  35238. }
  35239. /**
  35240. * Setup needed event listeners used to update the popper position
  35241. * @method
  35242. * @memberof Popper.Utils
  35243. * @private
  35244. */
  35245. function setupEventListeners(reference, options, state, updateBound) {
  35246. // Resize event listener on window
  35247. state.updateBound = updateBound;
  35248. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35249. // Scroll event listener on scroll parents
  35250. var scrollElement = getScrollParent(reference);
  35251. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35252. state.scrollElement = scrollElement;
  35253. state.eventsEnabled = true;
  35254. return state;
  35255. }
  35256. /**
  35257. * It will add resize/scroll events and start recalculating
  35258. * position of the popper element when they are triggered.
  35259. * @method
  35260. * @memberof Popper
  35261. */
  35262. function enableEventListeners() {
  35263. if (!this.state.eventsEnabled) {
  35264. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35265. }
  35266. }
  35267. /**
  35268. * Remove event listeners used to update the popper position
  35269. * @method
  35270. * @memberof Popper.Utils
  35271. * @private
  35272. */
  35273. function removeEventListeners(reference, state) {
  35274. // Remove resize event listener on window
  35275. getWindow(reference).removeEventListener('resize', state.updateBound);
  35276. // Remove scroll event listener on scroll parents
  35277. state.scrollParents.forEach(function (target) {
  35278. target.removeEventListener('scroll', state.updateBound);
  35279. });
  35280. // Reset state
  35281. state.updateBound = null;
  35282. state.scrollParents = [];
  35283. state.scrollElement = null;
  35284. state.eventsEnabled = false;
  35285. return state;
  35286. }
  35287. /**
  35288. * It will remove resize/scroll events and won't recalculate popper position
  35289. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35290. * unless you call `update` method manually.
  35291. * @method
  35292. * @memberof Popper
  35293. */
  35294. function disableEventListeners() {
  35295. if (this.state.eventsEnabled) {
  35296. cancelAnimationFrame(this.scheduleUpdate);
  35297. this.state = removeEventListeners(this.reference, this.state);
  35298. }
  35299. }
  35300. /**
  35301. * Tells if a given input is a number
  35302. * @method
  35303. * @memberof Popper.Utils
  35304. * @param {*} input to check
  35305. * @return {Boolean}
  35306. */
  35307. function isNumeric(n) {
  35308. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35309. }
  35310. /**
  35311. * Set the style to the given popper
  35312. * @method
  35313. * @memberof Popper.Utils
  35314. * @argument {Element} element - Element to apply the style to
  35315. * @argument {Object} styles
  35316. * Object with a list of properties and values which will be applied to the element
  35317. */
  35318. function setStyles(element, styles) {
  35319. Object.keys(styles).forEach(function (prop) {
  35320. var unit = '';
  35321. // add unit if the value is numeric and is one of the following
  35322. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35323. unit = 'px';
  35324. }
  35325. element.style[prop] = styles[prop] + unit;
  35326. });
  35327. }
  35328. /**
  35329. * Set the attributes to the given popper
  35330. * @method
  35331. * @memberof Popper.Utils
  35332. * @argument {Element} element - Element to apply the attributes to
  35333. * @argument {Object} styles
  35334. * Object with a list of properties and values which will be applied to the element
  35335. */
  35336. function setAttributes(element, attributes) {
  35337. Object.keys(attributes).forEach(function (prop) {
  35338. var value = attributes[prop];
  35339. if (value !== false) {
  35340. element.setAttribute(prop, attributes[prop]);
  35341. } else {
  35342. element.removeAttribute(prop);
  35343. }
  35344. });
  35345. }
  35346. /**
  35347. * @function
  35348. * @memberof Modifiers
  35349. * @argument {Object} data - The data object generated by `update` method
  35350. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35351. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35352. * @argument {Object} options - Modifiers configuration and options
  35353. * @returns {Object} The same data object
  35354. */
  35355. function applyStyle(data) {
  35356. // any property present in `data.styles` will be applied to the popper,
  35357. // in this way we can make the 3rd party modifiers add custom styles to it
  35358. // Be aware, modifiers could override the properties defined in the previous
  35359. // lines of this modifier!
  35360. setStyles(data.instance.popper, data.styles);
  35361. // any property present in `data.attributes` will be applied to the popper,
  35362. // they will be set as HTML attributes of the element
  35363. setAttributes(data.instance.popper, data.attributes);
  35364. // if arrowElement is defined and arrowStyles has some properties
  35365. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35366. setStyles(data.arrowElement, data.arrowStyles);
  35367. }
  35368. return data;
  35369. }
  35370. /**
  35371. * Set the x-placement attribute before everything else because it could be used
  35372. * to add margins to the popper margins needs to be calculated to get the
  35373. * correct popper offsets.
  35374. * @method
  35375. * @memberof Popper.modifiers
  35376. * @param {HTMLElement} reference - The reference element used to position the popper
  35377. * @param {HTMLElement} popper - The HTML element used as popper
  35378. * @param {Object} options - Popper.js options
  35379. */
  35380. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35381. // compute reference element offsets
  35382. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35383. // compute auto placement, store placement inside the data object,
  35384. // modifiers will be able to edit `placement` if needed
  35385. // and refer to originalPlacement to know the original value
  35386. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35387. popper.setAttribute('x-placement', placement);
  35388. // Apply `position` to popper before anything else because
  35389. // without the position applied we can't guarantee correct computations
  35390. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35391. return options;
  35392. }
  35393. /**
  35394. * @function
  35395. * @memberof Popper.Utils
  35396. * @argument {Object} data - The data object generated by `update` method
  35397. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35398. * @returns {Object} The popper's position offsets rounded
  35399. *
  35400. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35401. * good as it can be within reason.
  35402. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35403. *
  35404. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35405. * as well on High DPI screens).
  35406. *
  35407. * Firefox prefers no rounding for positioning and does not have blurriness on
  35408. * high DPI screens.
  35409. *
  35410. * Only horizontal placement and left/right values need to be considered.
  35411. */
  35412. function getRoundedOffsets(data, shouldRound) {
  35413. var _data$offsets = data.offsets,
  35414. popper = _data$offsets.popper,
  35415. reference = _data$offsets.reference;
  35416. var round = Math.round,
  35417. floor = Math.floor;
  35418. var noRound = function noRound(v) {
  35419. return v;
  35420. };
  35421. var referenceWidth = round(reference.width);
  35422. var popperWidth = round(popper.width);
  35423. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35424. var isVariation = data.placement.indexOf('-') !== -1;
  35425. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35426. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35427. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35428. var verticalToInteger = !shouldRound ? noRound : round;
  35429. return {
  35430. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35431. top: verticalToInteger(popper.top),
  35432. bottom: verticalToInteger(popper.bottom),
  35433. right: horizontalToInteger(popper.right)
  35434. };
  35435. }
  35436. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35437. /**
  35438. * @function
  35439. * @memberof Modifiers
  35440. * @argument {Object} data - The data object generated by `update` method
  35441. * @argument {Object} options - Modifiers configuration and options
  35442. * @returns {Object} The data object, properly modified
  35443. */
  35444. function computeStyle(data, options) {
  35445. var x = options.x,
  35446. y = options.y;
  35447. var popper = data.offsets.popper;
  35448. // Remove this legacy support in Popper.js v2
  35449. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35450. return modifier.name === 'applyStyle';
  35451. }).gpuAcceleration;
  35452. if (legacyGpuAccelerationOption !== undefined) {
  35453. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35454. }
  35455. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35456. var offsetParent = getOffsetParent(data.instance.popper);
  35457. var offsetParentRect = getBoundingClientRect(offsetParent);
  35458. // Styles
  35459. var styles = {
  35460. position: popper.position
  35461. };
  35462. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35463. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35464. var sideB = y === 'right' ? 'left' : 'right';
  35465. // if gpuAcceleration is set to `true` and transform is supported,
  35466. // we use `translate3d` to apply the position to the popper we
  35467. // automatically use the supported prefixed version if needed
  35468. var prefixedProperty = getSupportedPropertyName('transform');
  35469. // now, let's make a step back and look at this code closely (wtf?)
  35470. // If the content of the popper grows once it's been positioned, it
  35471. // may happen that the popper gets misplaced because of the new content
  35472. // overflowing its reference element
  35473. // To avoid this problem, we provide two options (x and y), which allow
  35474. // the consumer to define the offset origin.
  35475. // If we position a popper on top of a reference element, we can set
  35476. // `x` to `top` to make the popper grow towards its top instead of
  35477. // its bottom.
  35478. var left = void 0,
  35479. top = void 0;
  35480. if (sideA === 'bottom') {
  35481. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35482. // and not the bottom of the html element
  35483. if (offsetParent.nodeName === 'HTML') {
  35484. top = -offsetParent.clientHeight + offsets.bottom;
  35485. } else {
  35486. top = -offsetParentRect.height + offsets.bottom;
  35487. }
  35488. } else {
  35489. top = offsets.top;
  35490. }
  35491. if (sideB === 'right') {
  35492. if (offsetParent.nodeName === 'HTML') {
  35493. left = -offsetParent.clientWidth + offsets.right;
  35494. } else {
  35495. left = -offsetParentRect.width + offsets.right;
  35496. }
  35497. } else {
  35498. left = offsets.left;
  35499. }
  35500. if (gpuAcceleration && prefixedProperty) {
  35501. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35502. styles[sideA] = 0;
  35503. styles[sideB] = 0;
  35504. styles.willChange = 'transform';
  35505. } else {
  35506. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35507. var invertTop = sideA === 'bottom' ? -1 : 1;
  35508. var invertLeft = sideB === 'right' ? -1 : 1;
  35509. styles[sideA] = top * invertTop;
  35510. styles[sideB] = left * invertLeft;
  35511. styles.willChange = sideA + ', ' + sideB;
  35512. }
  35513. // Attributes
  35514. var attributes = {
  35515. 'x-placement': data.placement
  35516. };
  35517. // Update `data` attributes, styles and arrowStyles
  35518. data.attributes = _extends({}, attributes, data.attributes);
  35519. data.styles = _extends({}, styles, data.styles);
  35520. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35521. return data;
  35522. }
  35523. /**
  35524. * Helper used to know if the given modifier depends from another one.<br />
  35525. * It checks if the needed modifier is listed and enabled.
  35526. * @method
  35527. * @memberof Popper.Utils
  35528. * @param {Array} modifiers - list of modifiers
  35529. * @param {String} requestingName - name of requesting modifier
  35530. * @param {String} requestedName - name of requested modifier
  35531. * @returns {Boolean}
  35532. */
  35533. function isModifierRequired(modifiers, requestingName, requestedName) {
  35534. var requesting = find(modifiers, function (_ref) {
  35535. var name = _ref.name;
  35536. return name === requestingName;
  35537. });
  35538. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35539. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35540. });
  35541. if (!isRequired) {
  35542. var _requesting = '`' + requestingName + '`';
  35543. var requested = '`' + requestedName + '`';
  35544. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35545. }
  35546. return isRequired;
  35547. }
  35548. /**
  35549. * @function
  35550. * @memberof Modifiers
  35551. * @argument {Object} data - The data object generated by update method
  35552. * @argument {Object} options - Modifiers configuration and options
  35553. * @returns {Object} The data object, properly modified
  35554. */
  35555. function arrow(data, options) {
  35556. var _data$offsets$arrow;
  35557. // arrow depends on keepTogether in order to work
  35558. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35559. return data;
  35560. }
  35561. var arrowElement = options.element;
  35562. // if arrowElement is a string, suppose it's a CSS selector
  35563. if (typeof arrowElement === 'string') {
  35564. arrowElement = data.instance.popper.querySelector(arrowElement);
  35565. // if arrowElement is not found, don't run the modifier
  35566. if (!arrowElement) {
  35567. return data;
  35568. }
  35569. } else {
  35570. // if the arrowElement isn't a query selector we must check that the
  35571. // provided DOM node is child of its popper node
  35572. if (!data.instance.popper.contains(arrowElement)) {
  35573. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35574. return data;
  35575. }
  35576. }
  35577. var placement = data.placement.split('-')[0];
  35578. var _data$offsets = data.offsets,
  35579. popper = _data$offsets.popper,
  35580. reference = _data$offsets.reference;
  35581. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35582. var len = isVertical ? 'height' : 'width';
  35583. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35584. var side = sideCapitalized.toLowerCase();
  35585. var altSide = isVertical ? 'left' : 'top';
  35586. var opSide = isVertical ? 'bottom' : 'right';
  35587. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35588. //
  35589. // extends keepTogether behavior making sure the popper and its
  35590. // reference have enough pixels in conjunction
  35591. //
  35592. // top/left side
  35593. if (reference[opSide] - arrowElementSize < popper[side]) {
  35594. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35595. }
  35596. // bottom/right side
  35597. if (reference[side] + arrowElementSize > popper[opSide]) {
  35598. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35599. }
  35600. data.offsets.popper = getClientRect(data.offsets.popper);
  35601. // compute center of the popper
  35602. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35603. // Compute the sideValue using the updated popper offsets
  35604. // take popper margin in account because we don't have this info available
  35605. var css = getStyleComputedProperty(data.instance.popper);
  35606. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35607. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35608. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35609. // prevent arrowElement from being placed not contiguously to its popper
  35610. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35611. data.arrowElement = arrowElement;
  35612. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35613. return data;
  35614. }
  35615. /**
  35616. * Get the opposite placement variation of the given one
  35617. * @method
  35618. * @memberof Popper.Utils
  35619. * @argument {String} placement variation
  35620. * @returns {String} flipped placement variation
  35621. */
  35622. function getOppositeVariation(variation) {
  35623. if (variation === 'end') {
  35624. return 'start';
  35625. } else if (variation === 'start') {
  35626. return 'end';
  35627. }
  35628. return variation;
  35629. }
  35630. /**
  35631. * List of accepted placements to use as values of the `placement` option.<br />
  35632. * Valid placements are:
  35633. * - `auto`
  35634. * - `top`
  35635. * - `right`
  35636. * - `bottom`
  35637. * - `left`
  35638. *
  35639. * Each placement can have a variation from this list:
  35640. * - `-start`
  35641. * - `-end`
  35642. *
  35643. * Variations are interpreted easily if you think of them as the left to right
  35644. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35645. * is right.<br />
  35646. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35647. *
  35648. * Some valid examples are:
  35649. * - `top-end` (on top of reference, right aligned)
  35650. * - `right-start` (on right of reference, top aligned)
  35651. * - `bottom` (on bottom, centered)
  35652. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35653. *
  35654. * @static
  35655. * @type {Array}
  35656. * @enum {String}
  35657. * @readonly
  35658. * @method placements
  35659. * @memberof Popper
  35660. */
  35661. 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'];
  35662. // Get rid of `auto` `auto-start` and `auto-end`
  35663. var validPlacements = placements.slice(3);
  35664. /**
  35665. * Given an initial placement, returns all the subsequent placements
  35666. * clockwise (or counter-clockwise).
  35667. *
  35668. * @method
  35669. * @memberof Popper.Utils
  35670. * @argument {String} placement - A valid placement (it accepts variations)
  35671. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35672. * @returns {Array} placements including their variations
  35673. */
  35674. function clockwise(placement) {
  35675. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35676. var index = validPlacements.indexOf(placement);
  35677. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35678. return counter ? arr.reverse() : arr;
  35679. }
  35680. var BEHAVIORS = {
  35681. FLIP: 'flip',
  35682. CLOCKWISE: 'clockwise',
  35683. COUNTERCLOCKWISE: 'counterclockwise'
  35684. };
  35685. /**
  35686. * @function
  35687. * @memberof Modifiers
  35688. * @argument {Object} data - The data object generated by update method
  35689. * @argument {Object} options - Modifiers configuration and options
  35690. * @returns {Object} The data object, properly modified
  35691. */
  35692. function flip(data, options) {
  35693. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35694. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35695. return data;
  35696. }
  35697. if (data.flipped && data.placement === data.originalPlacement) {
  35698. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35699. return data;
  35700. }
  35701. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35702. var placement = data.placement.split('-')[0];
  35703. var placementOpposite = getOppositePlacement(placement);
  35704. var variation = data.placement.split('-')[1] || '';
  35705. var flipOrder = [];
  35706. switch (options.behavior) {
  35707. case BEHAVIORS.FLIP:
  35708. flipOrder = [placement, placementOpposite];
  35709. break;
  35710. case BEHAVIORS.CLOCKWISE:
  35711. flipOrder = clockwise(placement);
  35712. break;
  35713. case BEHAVIORS.COUNTERCLOCKWISE:
  35714. flipOrder = clockwise(placement, true);
  35715. break;
  35716. default:
  35717. flipOrder = options.behavior;
  35718. }
  35719. flipOrder.forEach(function (step, index) {
  35720. if (placement !== step || flipOrder.length === index + 1) {
  35721. return data;
  35722. }
  35723. placement = data.placement.split('-')[0];
  35724. placementOpposite = getOppositePlacement(placement);
  35725. var popperOffsets = data.offsets.popper;
  35726. var refOffsets = data.offsets.reference;
  35727. // using floor because the reference offsets may contain decimals we are not going to consider here
  35728. var floor = Math.floor;
  35729. 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);
  35730. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35731. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35732. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35733. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35734. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35735. // flip the variation if required
  35736. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35737. // flips variation if reference element overflows boundaries
  35738. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35739. // flips variation if popper content overflows boundaries
  35740. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35741. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35742. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35743. // this boolean to detect any flip loop
  35744. data.flipped = true;
  35745. if (overlapsRef || overflowsBoundaries) {
  35746. placement = flipOrder[index + 1];
  35747. }
  35748. if (flippedVariation) {
  35749. variation = getOppositeVariation(variation);
  35750. }
  35751. data.placement = placement + (variation ? '-' + variation : '');
  35752. // this object contains `position`, we want to preserve it along with
  35753. // any additional property we may add in the future
  35754. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35755. data = runModifiers(data.instance.modifiers, data, 'flip');
  35756. }
  35757. });
  35758. return data;
  35759. }
  35760. /**
  35761. * @function
  35762. * @memberof Modifiers
  35763. * @argument {Object} data - The data object generated by update method
  35764. * @argument {Object} options - Modifiers configuration and options
  35765. * @returns {Object} The data object, properly modified
  35766. */
  35767. function keepTogether(data) {
  35768. var _data$offsets = data.offsets,
  35769. popper = _data$offsets.popper,
  35770. reference = _data$offsets.reference;
  35771. var placement = data.placement.split('-')[0];
  35772. var floor = Math.floor;
  35773. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35774. var side = isVertical ? 'right' : 'bottom';
  35775. var opSide = isVertical ? 'left' : 'top';
  35776. var measurement = isVertical ? 'width' : 'height';
  35777. if (popper[side] < floor(reference[opSide])) {
  35778. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35779. }
  35780. if (popper[opSide] > floor(reference[side])) {
  35781. data.offsets.popper[opSide] = floor(reference[side]);
  35782. }
  35783. return data;
  35784. }
  35785. /**
  35786. * Converts a string containing value + unit into a px value number
  35787. * @function
  35788. * @memberof {modifiers~offset}
  35789. * @private
  35790. * @argument {String} str - Value + unit string
  35791. * @argument {String} measurement - `height` or `width`
  35792. * @argument {Object} popperOffsets
  35793. * @argument {Object} referenceOffsets
  35794. * @returns {Number|String}
  35795. * Value in pixels, or original string if no values were extracted
  35796. */
  35797. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35798. // separate value from unit
  35799. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35800. var value = +split[1];
  35801. var unit = split[2];
  35802. // If it's not a number it's an operator, I guess
  35803. if (!value) {
  35804. return str;
  35805. }
  35806. if (unit.indexOf('%') === 0) {
  35807. var element = void 0;
  35808. switch (unit) {
  35809. case '%p':
  35810. element = popperOffsets;
  35811. break;
  35812. case '%':
  35813. case '%r':
  35814. default:
  35815. element = referenceOffsets;
  35816. }
  35817. var rect = getClientRect(element);
  35818. return rect[measurement] / 100 * value;
  35819. } else if (unit === 'vh' || unit === 'vw') {
  35820. // if is a vh or vw, we calculate the size based on the viewport
  35821. var size = void 0;
  35822. if (unit === 'vh') {
  35823. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35824. } else {
  35825. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35826. }
  35827. return size / 100 * value;
  35828. } else {
  35829. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35830. // if is an implicit unit, it's px, and we return just the value
  35831. return value;
  35832. }
  35833. }
  35834. /**
  35835. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35836. * @function
  35837. * @memberof {modifiers~offset}
  35838. * @private
  35839. * @argument {String} offset
  35840. * @argument {Object} popperOffsets
  35841. * @argument {Object} referenceOffsets
  35842. * @argument {String} basePlacement
  35843. * @returns {Array} a two cells array with x and y offsets in numbers
  35844. */
  35845. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35846. var offsets = [0, 0];
  35847. // Use height if placement is left or right and index is 0 otherwise use width
  35848. // in this way the first offset will use an axis and the second one
  35849. // will use the other one
  35850. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35851. // Split the offset string to obtain a list of values and operands
  35852. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35853. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35854. return frag.trim();
  35855. });
  35856. // Detect if the offset string contains a pair of values or a single one
  35857. // they could be separated by comma or space
  35858. var divider = fragments.indexOf(find(fragments, function (frag) {
  35859. return frag.search(/,|\s/) !== -1;
  35860. }));
  35861. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35862. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35863. }
  35864. // If divider is found, we divide the list of values and operands to divide
  35865. // them by ofset X and Y.
  35866. var splitRegex = /\s*,\s*|\s+/;
  35867. 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];
  35868. // Convert the values with units to absolute pixels to allow our computations
  35869. ops = ops.map(function (op, index) {
  35870. // Most of the units rely on the orientation of the popper
  35871. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35872. var mergeWithPrevious = false;
  35873. return op
  35874. // This aggregates any `+` or `-` sign that aren't considered operators
  35875. // e.g.: 10 + +5 => [10, +, +5]
  35876. .reduce(function (a, b) {
  35877. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35878. a[a.length - 1] = b;
  35879. mergeWithPrevious = true;
  35880. return a;
  35881. } else if (mergeWithPrevious) {
  35882. a[a.length - 1] += b;
  35883. mergeWithPrevious = false;
  35884. return a;
  35885. } else {
  35886. return a.concat(b);
  35887. }
  35888. }, [])
  35889. // Here we convert the string values into number values (in px)
  35890. .map(function (str) {
  35891. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35892. });
  35893. });
  35894. // Loop trough the offsets arrays and execute the operations
  35895. ops.forEach(function (op, index) {
  35896. op.forEach(function (frag, index2) {
  35897. if (isNumeric(frag)) {
  35898. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35899. }
  35900. });
  35901. });
  35902. return offsets;
  35903. }
  35904. /**
  35905. * @function
  35906. * @memberof Modifiers
  35907. * @argument {Object} data - The data object generated by update method
  35908. * @argument {Object} options - Modifiers configuration and options
  35909. * @argument {Number|String} options.offset=0
  35910. * The offset value as described in the modifier description
  35911. * @returns {Object} The data object, properly modified
  35912. */
  35913. function offset(data, _ref) {
  35914. var offset = _ref.offset;
  35915. var placement = data.placement,
  35916. _data$offsets = data.offsets,
  35917. popper = _data$offsets.popper,
  35918. reference = _data$offsets.reference;
  35919. var basePlacement = placement.split('-')[0];
  35920. var offsets = void 0;
  35921. if (isNumeric(+offset)) {
  35922. offsets = [+offset, 0];
  35923. } else {
  35924. offsets = parseOffset(offset, popper, reference, basePlacement);
  35925. }
  35926. if (basePlacement === 'left') {
  35927. popper.top += offsets[0];
  35928. popper.left -= offsets[1];
  35929. } else if (basePlacement === 'right') {
  35930. popper.top += offsets[0];
  35931. popper.left += offsets[1];
  35932. } else if (basePlacement === 'top') {
  35933. popper.left += offsets[0];
  35934. popper.top -= offsets[1];
  35935. } else if (basePlacement === 'bottom') {
  35936. popper.left += offsets[0];
  35937. popper.top += offsets[1];
  35938. }
  35939. data.popper = popper;
  35940. return data;
  35941. }
  35942. /**
  35943. * @function
  35944. * @memberof Modifiers
  35945. * @argument {Object} data - The data object generated by `update` method
  35946. * @argument {Object} options - Modifiers configuration and options
  35947. * @returns {Object} The data object, properly modified
  35948. */
  35949. function preventOverflow(data, options) {
  35950. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35951. // If offsetParent is the reference element, we really want to
  35952. // go one step up and use the next offsetParent as reference to
  35953. // avoid to make this modifier completely useless and look like broken
  35954. if (data.instance.reference === boundariesElement) {
  35955. boundariesElement = getOffsetParent(boundariesElement);
  35956. }
  35957. // NOTE: DOM access here
  35958. // resets the popper's position so that the document size can be calculated excluding
  35959. // the size of the popper element itself
  35960. var transformProp = getSupportedPropertyName('transform');
  35961. var popperStyles = data.instance.popper.style; // assignment to help minification
  35962. var top = popperStyles.top,
  35963. left = popperStyles.left,
  35964. transform = popperStyles[transformProp];
  35965. popperStyles.top = '';
  35966. popperStyles.left = '';
  35967. popperStyles[transformProp] = '';
  35968. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35969. // NOTE: DOM access here
  35970. // restores the original style properties after the offsets have been computed
  35971. popperStyles.top = top;
  35972. popperStyles.left = left;
  35973. popperStyles[transformProp] = transform;
  35974. options.boundaries = boundaries;
  35975. var order = options.priority;
  35976. var popper = data.offsets.popper;
  35977. var check = {
  35978. primary: function primary(placement) {
  35979. var value = popper[placement];
  35980. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  35981. value = Math.max(popper[placement], boundaries[placement]);
  35982. }
  35983. return defineProperty({}, placement, value);
  35984. },
  35985. secondary: function secondary(placement) {
  35986. var mainSide = placement === 'right' ? 'left' : 'top';
  35987. var value = popper[mainSide];
  35988. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  35989. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  35990. }
  35991. return defineProperty({}, mainSide, value);
  35992. }
  35993. };
  35994. order.forEach(function (placement) {
  35995. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  35996. popper = _extends({}, popper, check[side](placement));
  35997. });
  35998. data.offsets.popper = popper;
  35999. return data;
  36000. }
  36001. /**
  36002. * @function
  36003. * @memberof Modifiers
  36004. * @argument {Object} data - The data object generated by `update` method
  36005. * @argument {Object} options - Modifiers configuration and options
  36006. * @returns {Object} The data object, properly modified
  36007. */
  36008. function shift(data) {
  36009. var placement = data.placement;
  36010. var basePlacement = placement.split('-')[0];
  36011. var shiftvariation = placement.split('-')[1];
  36012. // if shift shiftvariation is specified, run the modifier
  36013. if (shiftvariation) {
  36014. var _data$offsets = data.offsets,
  36015. reference = _data$offsets.reference,
  36016. popper = _data$offsets.popper;
  36017. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36018. var side = isVertical ? 'left' : 'top';
  36019. var measurement = isVertical ? 'width' : 'height';
  36020. var shiftOffsets = {
  36021. start: defineProperty({}, side, reference[side]),
  36022. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36023. };
  36024. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36025. }
  36026. return data;
  36027. }
  36028. /**
  36029. * @function
  36030. * @memberof Modifiers
  36031. * @argument {Object} data - The data object generated by update method
  36032. * @argument {Object} options - Modifiers configuration and options
  36033. * @returns {Object} The data object, properly modified
  36034. */
  36035. function hide(data) {
  36036. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36037. return data;
  36038. }
  36039. var refRect = data.offsets.reference;
  36040. var bound = find(data.instance.modifiers, function (modifier) {
  36041. return modifier.name === 'preventOverflow';
  36042. }).boundaries;
  36043. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36044. // Avoid unnecessary DOM access if visibility hasn't changed
  36045. if (data.hide === true) {
  36046. return data;
  36047. }
  36048. data.hide = true;
  36049. data.attributes['x-out-of-boundaries'] = '';
  36050. } else {
  36051. // Avoid unnecessary DOM access if visibility hasn't changed
  36052. if (data.hide === false) {
  36053. return data;
  36054. }
  36055. data.hide = false;
  36056. data.attributes['x-out-of-boundaries'] = false;
  36057. }
  36058. return data;
  36059. }
  36060. /**
  36061. * @function
  36062. * @memberof Modifiers
  36063. * @argument {Object} data - The data object generated by `update` method
  36064. * @argument {Object} options - Modifiers configuration and options
  36065. * @returns {Object} The data object, properly modified
  36066. */
  36067. function inner(data) {
  36068. var placement = data.placement;
  36069. var basePlacement = placement.split('-')[0];
  36070. var _data$offsets = data.offsets,
  36071. popper = _data$offsets.popper,
  36072. reference = _data$offsets.reference;
  36073. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36074. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36075. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36076. data.placement = getOppositePlacement(placement);
  36077. data.offsets.popper = getClientRect(popper);
  36078. return data;
  36079. }
  36080. /**
  36081. * Modifier function, each modifier can have a function of this type assigned
  36082. * to its `fn` property.<br />
  36083. * These functions will be called on each update, this means that you must
  36084. * make sure they are performant enough to avoid performance bottlenecks.
  36085. *
  36086. * @function ModifierFn
  36087. * @argument {dataObject} data - The data object generated by `update` method
  36088. * @argument {Object} options - Modifiers configuration and options
  36089. * @returns {dataObject} The data object, properly modified
  36090. */
  36091. /**
  36092. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36093. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36094. * needed by the library.
  36095. *
  36096. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36097. * All the other properties are configurations that could be tweaked.
  36098. * @namespace modifiers
  36099. */
  36100. var modifiers = {
  36101. /**
  36102. * Modifier used to shift the popper on the start or end of its reference
  36103. * element.<br />
  36104. * It will read the variation of the `placement` property.<br />
  36105. * It can be one either `-end` or `-start`.
  36106. * @memberof modifiers
  36107. * @inner
  36108. */
  36109. shift: {
  36110. /** @prop {number} order=100 - Index used to define the order of execution */
  36111. order: 100,
  36112. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36113. enabled: true,
  36114. /** @prop {ModifierFn} */
  36115. fn: shift
  36116. },
  36117. /**
  36118. * The `offset` modifier can shift your popper on both its axis.
  36119. *
  36120. * It accepts the following units:
  36121. * - `px` or unit-less, interpreted as pixels
  36122. * - `%` or `%r`, percentage relative to the length of the reference element
  36123. * - `%p`, percentage relative to the length of the popper element
  36124. * - `vw`, CSS viewport width unit
  36125. * - `vh`, CSS viewport height unit
  36126. *
  36127. * For length is intended the main axis relative to the placement of the popper.<br />
  36128. * This means that if the placement is `top` or `bottom`, the length will be the
  36129. * `width`. In case of `left` or `right`, it will be the `height`.
  36130. *
  36131. * You can provide a single value (as `Number` or `String`), or a pair of values
  36132. * as `String` divided by a comma or one (or more) white spaces.<br />
  36133. * The latter is a deprecated method because it leads to confusion and will be
  36134. * removed in v2.<br />
  36135. * Additionally, it accepts additions and subtractions between different units.
  36136. * Note that multiplications and divisions aren't supported.
  36137. *
  36138. * Valid examples are:
  36139. * ```
  36140. * 10
  36141. * '10%'
  36142. * '10, 10'
  36143. * '10%, 10'
  36144. * '10 + 10%'
  36145. * '10 - 5vh + 3%'
  36146. * '-10px + 5vh, 5px - 6%'
  36147. * ```
  36148. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36149. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36150. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36151. *
  36152. * @memberof modifiers
  36153. * @inner
  36154. */
  36155. offset: {
  36156. /** @prop {number} order=200 - Index used to define the order of execution */
  36157. order: 200,
  36158. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36159. enabled: true,
  36160. /** @prop {ModifierFn} */
  36161. fn: offset,
  36162. /** @prop {Number|String} offset=0
  36163. * The offset value as described in the modifier description
  36164. */
  36165. offset: 0
  36166. },
  36167. /**
  36168. * Modifier used to prevent the popper from being positioned outside the boundary.
  36169. *
  36170. * A scenario exists where the reference itself is not within the boundaries.<br />
  36171. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36172. * In this case we need to decide whether the popper should either:
  36173. *
  36174. * - detach from the reference and remain "trapped" in the boundaries, or
  36175. * - if it should ignore the boundary and "escape with its reference"
  36176. *
  36177. * When `escapeWithReference` is set to`true` and reference is completely
  36178. * outside its boundaries, the popper will overflow (or completely leave)
  36179. * the boundaries in order to remain attached to the edge of the reference.
  36180. *
  36181. * @memberof modifiers
  36182. * @inner
  36183. */
  36184. preventOverflow: {
  36185. /** @prop {number} order=300 - Index used to define the order of execution */
  36186. order: 300,
  36187. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36188. enabled: true,
  36189. /** @prop {ModifierFn} */
  36190. fn: preventOverflow,
  36191. /**
  36192. * @prop {Array} [priority=['left','right','top','bottom']]
  36193. * Popper will try to prevent overflow following these priorities by default,
  36194. * then, it could overflow on the left and on top of the `boundariesElement`
  36195. */
  36196. priority: ['left', 'right', 'top', 'bottom'],
  36197. /**
  36198. * @prop {number} padding=5
  36199. * Amount of pixel used to define a minimum distance between the boundaries
  36200. * and the popper. This makes sure the popper always has a little padding
  36201. * between the edges of its container
  36202. */
  36203. padding: 5,
  36204. /**
  36205. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36206. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36207. * `viewport` or any DOM element.
  36208. */
  36209. boundariesElement: 'scrollParent'
  36210. },
  36211. /**
  36212. * Modifier used to make sure the reference and its popper stay near each other
  36213. * without leaving any gap between the two. Especially useful when the arrow is
  36214. * enabled and you want to ensure that it points to its reference element.
  36215. * It cares only about the first axis. You can still have poppers with margin
  36216. * between the popper and its reference element.
  36217. * @memberof modifiers
  36218. * @inner
  36219. */
  36220. keepTogether: {
  36221. /** @prop {number} order=400 - Index used to define the order of execution */
  36222. order: 400,
  36223. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36224. enabled: true,
  36225. /** @prop {ModifierFn} */
  36226. fn: keepTogether
  36227. },
  36228. /**
  36229. * This modifier is used to move the `arrowElement` of the popper to make
  36230. * sure it is positioned between the reference element and its popper element.
  36231. * It will read the outer size of the `arrowElement` node to detect how many
  36232. * pixels of conjunction are needed.
  36233. *
  36234. * It has no effect if no `arrowElement` is provided.
  36235. * @memberof modifiers
  36236. * @inner
  36237. */
  36238. arrow: {
  36239. /** @prop {number} order=500 - Index used to define the order of execution */
  36240. order: 500,
  36241. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36242. enabled: true,
  36243. /** @prop {ModifierFn} */
  36244. fn: arrow,
  36245. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36246. element: '[x-arrow]'
  36247. },
  36248. /**
  36249. * Modifier used to flip the popper's placement when it starts to overlap its
  36250. * reference element.
  36251. *
  36252. * Requires the `preventOverflow` modifier before it in order to work.
  36253. *
  36254. * **NOTE:** this modifier will interrupt the current update cycle and will
  36255. * restart it if it detects the need to flip the placement.
  36256. * @memberof modifiers
  36257. * @inner
  36258. */
  36259. flip: {
  36260. /** @prop {number} order=600 - Index used to define the order of execution */
  36261. order: 600,
  36262. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36263. enabled: true,
  36264. /** @prop {ModifierFn} */
  36265. fn: flip,
  36266. /**
  36267. * @prop {String|Array} behavior='flip'
  36268. * The behavior used to change the popper's placement. It can be one of
  36269. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36270. * placements (with optional variations)
  36271. */
  36272. behavior: 'flip',
  36273. /**
  36274. * @prop {number} padding=5
  36275. * The popper will flip if it hits the edges of the `boundariesElement`
  36276. */
  36277. padding: 5,
  36278. /**
  36279. * @prop {String|HTMLElement} boundariesElement='viewport'
  36280. * The element which will define the boundaries of the popper position.
  36281. * The popper will never be placed outside of the defined boundaries
  36282. * (except if `keepTogether` is enabled)
  36283. */
  36284. boundariesElement: 'viewport',
  36285. /**
  36286. * @prop {Boolean} flipVariations=false
  36287. * The popper will switch placement variation between `-start` and `-end` when
  36288. * the reference element overlaps its boundaries.
  36289. *
  36290. * The original placement should have a set variation.
  36291. */
  36292. flipVariations: false,
  36293. /**
  36294. * @prop {Boolean} flipVariationsByContent=false
  36295. * The popper will switch placement variation between `-start` and `-end` when
  36296. * the popper element overlaps its reference boundaries.
  36297. *
  36298. * The original placement should have a set variation.
  36299. */
  36300. flipVariationsByContent: false
  36301. },
  36302. /**
  36303. * Modifier used to make the popper flow toward the inner of the reference element.
  36304. * By default, when this modifier is disabled, the popper will be placed outside
  36305. * the reference element.
  36306. * @memberof modifiers
  36307. * @inner
  36308. */
  36309. inner: {
  36310. /** @prop {number} order=700 - Index used to define the order of execution */
  36311. order: 700,
  36312. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36313. enabled: false,
  36314. /** @prop {ModifierFn} */
  36315. fn: inner
  36316. },
  36317. /**
  36318. * Modifier used to hide the popper when its reference element is outside of the
  36319. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36320. * be used to hide with a CSS selector the popper when its reference is
  36321. * out of boundaries.
  36322. *
  36323. * Requires the `preventOverflow` modifier before it in order to work.
  36324. * @memberof modifiers
  36325. * @inner
  36326. */
  36327. hide: {
  36328. /** @prop {number} order=800 - Index used to define the order of execution */
  36329. order: 800,
  36330. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36331. enabled: true,
  36332. /** @prop {ModifierFn} */
  36333. fn: hide
  36334. },
  36335. /**
  36336. * Computes the style that will be applied to the popper element to gets
  36337. * properly positioned.
  36338. *
  36339. * Note that this modifier will not touch the DOM, it just prepares the styles
  36340. * so that `applyStyle` modifier can apply it. This separation is useful
  36341. * in case you need to replace `applyStyle` with a custom implementation.
  36342. *
  36343. * This modifier has `850` as `order` value to maintain backward compatibility
  36344. * with previous versions of Popper.js. Expect the modifiers ordering method
  36345. * to change in future major versions of the library.
  36346. *
  36347. * @memberof modifiers
  36348. * @inner
  36349. */
  36350. computeStyle: {
  36351. /** @prop {number} order=850 - Index used to define the order of execution */
  36352. order: 850,
  36353. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36354. enabled: true,
  36355. /** @prop {ModifierFn} */
  36356. fn: computeStyle,
  36357. /**
  36358. * @prop {Boolean} gpuAcceleration=true
  36359. * If true, it uses the CSS 3D transformation to position the popper.
  36360. * Otherwise, it will use the `top` and `left` properties
  36361. */
  36362. gpuAcceleration: true,
  36363. /**
  36364. * @prop {string} [x='bottom']
  36365. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36366. * Change this if your popper should grow in a direction different from `bottom`
  36367. */
  36368. x: 'bottom',
  36369. /**
  36370. * @prop {string} [x='left']
  36371. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36372. * Change this if your popper should grow in a direction different from `right`
  36373. */
  36374. y: 'right'
  36375. },
  36376. /**
  36377. * Applies the computed styles to the popper element.
  36378. *
  36379. * All the DOM manipulations are limited to this modifier. This is useful in case
  36380. * you want to integrate Popper.js inside a framework or view library and you
  36381. * want to delegate all the DOM manipulations to it.
  36382. *
  36383. * Note that if you disable this modifier, you must make sure the popper element
  36384. * has its position set to `absolute` before Popper.js can do its work!
  36385. *
  36386. * Just disable this modifier and define your own to achieve the desired effect.
  36387. *
  36388. * @memberof modifiers
  36389. * @inner
  36390. */
  36391. applyStyle: {
  36392. /** @prop {number} order=900 - Index used to define the order of execution */
  36393. order: 900,
  36394. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36395. enabled: true,
  36396. /** @prop {ModifierFn} */
  36397. fn: applyStyle,
  36398. /** @prop {Function} */
  36399. onLoad: applyStyleOnLoad,
  36400. /**
  36401. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36402. * @prop {Boolean} gpuAcceleration=true
  36403. * If true, it uses the CSS 3D transformation to position the popper.
  36404. * Otherwise, it will use the `top` and `left` properties
  36405. */
  36406. gpuAcceleration: undefined
  36407. }
  36408. };
  36409. /**
  36410. * The `dataObject` is an object containing all the information used by Popper.js.
  36411. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36412. * @name dataObject
  36413. * @property {Object} data.instance The Popper.js instance
  36414. * @property {String} data.placement Placement applied to popper
  36415. * @property {String} data.originalPlacement Placement originally defined on init
  36416. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36417. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36418. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36419. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36420. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36421. * @property {Object} data.boundaries Offsets of the popper boundaries
  36422. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36423. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36424. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36425. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36426. */
  36427. /**
  36428. * Default options provided to Popper.js constructor.<br />
  36429. * These can be overridden using the `options` argument of Popper.js.<br />
  36430. * To override an option, simply pass an object with the same
  36431. * structure of the `options` object, as the 3rd argument. For example:
  36432. * ```
  36433. * new Popper(ref, pop, {
  36434. * modifiers: {
  36435. * preventOverflow: { enabled: false }
  36436. * }
  36437. * })
  36438. * ```
  36439. * @type {Object}
  36440. * @static
  36441. * @memberof Popper
  36442. */
  36443. var Defaults = {
  36444. /**
  36445. * Popper's placement.
  36446. * @prop {Popper.placements} placement='bottom'
  36447. */
  36448. placement: 'bottom',
  36449. /**
  36450. * Set this to true if you want popper to position it self in 'fixed' mode
  36451. * @prop {Boolean} positionFixed=false
  36452. */
  36453. positionFixed: false,
  36454. /**
  36455. * Whether events (resize, scroll) are initially enabled.
  36456. * @prop {Boolean} eventsEnabled=true
  36457. */
  36458. eventsEnabled: true,
  36459. /**
  36460. * Set to true if you want to automatically remove the popper when
  36461. * you call the `destroy` method.
  36462. * @prop {Boolean} removeOnDestroy=false
  36463. */
  36464. removeOnDestroy: false,
  36465. /**
  36466. * Callback called when the popper is created.<br />
  36467. * By default, it is set to no-op.<br />
  36468. * Access Popper.js instance with `data.instance`.
  36469. * @prop {onCreate}
  36470. */
  36471. onCreate: function onCreate() {},
  36472. /**
  36473. * Callback called when the popper is updated. This callback is not called
  36474. * on the initialization/creation of the popper, but only on subsequent
  36475. * updates.<br />
  36476. * By default, it is set to no-op.<br />
  36477. * Access Popper.js instance with `data.instance`.
  36478. * @prop {onUpdate}
  36479. */
  36480. onUpdate: function onUpdate() {},
  36481. /**
  36482. * List of modifiers used to modify the offsets before they are applied to the popper.
  36483. * They provide most of the functionalities of Popper.js.
  36484. * @prop {modifiers}
  36485. */
  36486. modifiers: modifiers
  36487. };
  36488. /**
  36489. * @callback onCreate
  36490. * @param {dataObject} data
  36491. */
  36492. /**
  36493. * @callback onUpdate
  36494. * @param {dataObject} data
  36495. */
  36496. // Utils
  36497. // Methods
  36498. var Popper = function () {
  36499. /**
  36500. * Creates a new Popper.js instance.
  36501. * @class Popper
  36502. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36503. * @param {Element} popper - The HTML / XML element used as the popper
  36504. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36505. * @return {Object} instance - The generated Popper.js instance
  36506. */
  36507. function Popper(reference, popper) {
  36508. var _this = this;
  36509. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36510. classCallCheck(this, Popper);
  36511. this.scheduleUpdate = function () {
  36512. return requestAnimationFrame(_this.update);
  36513. };
  36514. // make update() debounced, so that it only runs at most once-per-tick
  36515. this.update = debounce(this.update.bind(this));
  36516. // with {} we create a new object with the options inside it
  36517. this.options = _extends({}, Popper.Defaults, options);
  36518. // init state
  36519. this.state = {
  36520. isDestroyed: false,
  36521. isCreated: false,
  36522. scrollParents: []
  36523. };
  36524. // get reference and popper elements (allow jQuery wrappers)
  36525. this.reference = reference && reference.jquery ? reference[0] : reference;
  36526. this.popper = popper && popper.jquery ? popper[0] : popper;
  36527. // Deep merge modifiers options
  36528. this.options.modifiers = {};
  36529. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36530. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36531. });
  36532. // Refactoring modifiers' list (Object => Array)
  36533. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36534. return _extends({
  36535. name: name
  36536. }, _this.options.modifiers[name]);
  36537. })
  36538. // sort the modifiers by order
  36539. .sort(function (a, b) {
  36540. return a.order - b.order;
  36541. });
  36542. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36543. // such code is executed in the same order of its modifier
  36544. // they could add new properties to their options configuration
  36545. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36546. this.modifiers.forEach(function (modifierOptions) {
  36547. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36548. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36549. }
  36550. });
  36551. // fire the first update to position the popper in the right place
  36552. this.update();
  36553. var eventsEnabled = this.options.eventsEnabled;
  36554. if (eventsEnabled) {
  36555. // setup event listeners, they will take care of update the position in specific situations
  36556. this.enableEventListeners();
  36557. }
  36558. this.state.eventsEnabled = eventsEnabled;
  36559. }
  36560. // We can't use class properties because they don't get listed in the
  36561. // class prototype and break stuff like Sinon stubs
  36562. createClass(Popper, [{
  36563. key: 'update',
  36564. value: function update$$1() {
  36565. return update.call(this);
  36566. }
  36567. }, {
  36568. key: 'destroy',
  36569. value: function destroy$$1() {
  36570. return destroy.call(this);
  36571. }
  36572. }, {
  36573. key: 'enableEventListeners',
  36574. value: function enableEventListeners$$1() {
  36575. return enableEventListeners.call(this);
  36576. }
  36577. }, {
  36578. key: 'disableEventListeners',
  36579. value: function disableEventListeners$$1() {
  36580. return disableEventListeners.call(this);
  36581. }
  36582. /**
  36583. * Schedules an update. It will run on the next UI update available.
  36584. * @method scheduleUpdate
  36585. * @memberof Popper
  36586. */
  36587. /**
  36588. * Collection of utilities useful when writing custom modifiers.
  36589. * Starting from version 1.7, this method is available only if you
  36590. * include `popper-utils.js` before `popper.js`.
  36591. *
  36592. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36593. * and will be removed in v2! Use the PopperUtils module directly instead.
  36594. * Due to the high instability of the methods contained in Utils, we can't
  36595. * guarantee them to follow semver. Use them at your own risk!
  36596. * @static
  36597. * @private
  36598. * @type {Object}
  36599. * @deprecated since version 1.8
  36600. * @member Utils
  36601. * @memberof Popper
  36602. */
  36603. }]);
  36604. return Popper;
  36605. }();
  36606. /**
  36607. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36608. * and lets you use it as replacement of a real DOM node.<br />
  36609. * You can use this method to position a popper relatively to a set of coordinates
  36610. * in case you don't have a DOM node to use as reference.
  36611. *
  36612. * ```
  36613. * new Popper(referenceObject, popperNode);
  36614. * ```
  36615. *
  36616. * NB: This feature isn't supported in Internet Explorer 10.
  36617. * @name referenceObject
  36618. * @property {Function} data.getBoundingClientRect
  36619. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36620. * @property {number} data.clientWidth
  36621. * An ES6 getter that will return the width of the virtual reference element.
  36622. * @property {number} data.clientHeight
  36623. * An ES6 getter that will return the height of the virtual reference element.
  36624. */
  36625. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36626. Popper.placements = placements;
  36627. Popper.Defaults = Defaults;
  36628. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36629. //# sourceMappingURL=popper.js.map
  36630. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36631. /***/ }),
  36632. /***/ "./node_modules/process/browser.js":
  36633. /*!*****************************************!*\
  36634. !*** ./node_modules/process/browser.js ***!
  36635. \*****************************************/
  36636. /*! no static exports found */
  36637. /***/ (function(module, exports) {
  36638. // shim for using process in browser
  36639. var process = module.exports = {};
  36640. // cached from whatever global is present so that test runners that stub it
  36641. // don't break things. But we need to wrap it in a try catch in case it is
  36642. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36643. // function because try/catches deoptimize in certain engines.
  36644. var cachedSetTimeout;
  36645. var cachedClearTimeout;
  36646. function defaultSetTimout() {
  36647. throw new Error('setTimeout has not been defined');
  36648. }
  36649. function defaultClearTimeout () {
  36650. throw new Error('clearTimeout has not been defined');
  36651. }
  36652. (function () {
  36653. try {
  36654. if (typeof setTimeout === 'function') {
  36655. cachedSetTimeout = setTimeout;
  36656. } else {
  36657. cachedSetTimeout = defaultSetTimout;
  36658. }
  36659. } catch (e) {
  36660. cachedSetTimeout = defaultSetTimout;
  36661. }
  36662. try {
  36663. if (typeof clearTimeout === 'function') {
  36664. cachedClearTimeout = clearTimeout;
  36665. } else {
  36666. cachedClearTimeout = defaultClearTimeout;
  36667. }
  36668. } catch (e) {
  36669. cachedClearTimeout = defaultClearTimeout;
  36670. }
  36671. } ())
  36672. function runTimeout(fun) {
  36673. if (cachedSetTimeout === setTimeout) {
  36674. //normal enviroments in sane situations
  36675. return setTimeout(fun, 0);
  36676. }
  36677. // if setTimeout wasn't available but was latter defined
  36678. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36679. cachedSetTimeout = setTimeout;
  36680. return setTimeout(fun, 0);
  36681. }
  36682. try {
  36683. // when when somebody has screwed with setTimeout but no I.E. maddness
  36684. return cachedSetTimeout(fun, 0);
  36685. } catch(e){
  36686. try {
  36687. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36688. return cachedSetTimeout.call(null, fun, 0);
  36689. } catch(e){
  36690. // 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
  36691. return cachedSetTimeout.call(this, fun, 0);
  36692. }
  36693. }
  36694. }
  36695. function runClearTimeout(marker) {
  36696. if (cachedClearTimeout === clearTimeout) {
  36697. //normal enviroments in sane situations
  36698. return clearTimeout(marker);
  36699. }
  36700. // if clearTimeout wasn't available but was latter defined
  36701. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36702. cachedClearTimeout = clearTimeout;
  36703. return clearTimeout(marker);
  36704. }
  36705. try {
  36706. // when when somebody has screwed with setTimeout but no I.E. maddness
  36707. return cachedClearTimeout(marker);
  36708. } catch (e){
  36709. try {
  36710. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36711. return cachedClearTimeout.call(null, marker);
  36712. } catch (e){
  36713. // 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.
  36714. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36715. return cachedClearTimeout.call(this, marker);
  36716. }
  36717. }
  36718. }
  36719. var queue = [];
  36720. var draining = false;
  36721. var currentQueue;
  36722. var queueIndex = -1;
  36723. function cleanUpNextTick() {
  36724. if (!draining || !currentQueue) {
  36725. return;
  36726. }
  36727. draining = false;
  36728. if (currentQueue.length) {
  36729. queue = currentQueue.concat(queue);
  36730. } else {
  36731. queueIndex = -1;
  36732. }
  36733. if (queue.length) {
  36734. drainQueue();
  36735. }
  36736. }
  36737. function drainQueue() {
  36738. if (draining) {
  36739. return;
  36740. }
  36741. var timeout = runTimeout(cleanUpNextTick);
  36742. draining = true;
  36743. var len = queue.length;
  36744. while(len) {
  36745. currentQueue = queue;
  36746. queue = [];
  36747. while (++queueIndex < len) {
  36748. if (currentQueue) {
  36749. currentQueue[queueIndex].run();
  36750. }
  36751. }
  36752. queueIndex = -1;
  36753. len = queue.length;
  36754. }
  36755. currentQueue = null;
  36756. draining = false;
  36757. runClearTimeout(timeout);
  36758. }
  36759. process.nextTick = function (fun) {
  36760. var args = new Array(arguments.length - 1);
  36761. if (arguments.length > 1) {
  36762. for (var i = 1; i < arguments.length; i++) {
  36763. args[i - 1] = arguments[i];
  36764. }
  36765. }
  36766. queue.push(new Item(fun, args));
  36767. if (queue.length === 1 && !draining) {
  36768. runTimeout(drainQueue);
  36769. }
  36770. };
  36771. // v8 likes predictible objects
  36772. function Item(fun, array) {
  36773. this.fun = fun;
  36774. this.array = array;
  36775. }
  36776. Item.prototype.run = function () {
  36777. this.fun.apply(null, this.array);
  36778. };
  36779. process.title = 'browser';
  36780. process.browser = true;
  36781. process.env = {};
  36782. process.argv = [];
  36783. process.version = ''; // empty string to avoid regexp issues
  36784. process.versions = {};
  36785. function noop() {}
  36786. process.on = noop;
  36787. process.addListener = noop;
  36788. process.once = noop;
  36789. process.off = noop;
  36790. process.removeListener = noop;
  36791. process.removeAllListeners = noop;
  36792. process.emit = noop;
  36793. process.prependListener = noop;
  36794. process.prependOnceListener = noop;
  36795. process.listeners = function (name) { return [] }
  36796. process.binding = function (name) {
  36797. throw new Error('process.binding is not supported');
  36798. };
  36799. process.cwd = function () { return '/' };
  36800. process.chdir = function (dir) {
  36801. throw new Error('process.chdir is not supported');
  36802. };
  36803. process.umask = function() { return 0; };
  36804. /***/ }),
  36805. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36806. /*!***************************************************!*\
  36807. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36808. \***************************************************/
  36809. /*! no static exports found */
  36810. /***/ (function(module, exports, __webpack_require__) {
  36811. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36812. * Pusher JavaScript Library v5.0.3
  36813. * https://pusher.com/
  36814. *
  36815. * Copyright 2017, Pusher
  36816. * Released under the MIT licence.
  36817. */
  36818. (function webpackUniversalModuleDefinition(root, factory) {
  36819. if(true)
  36820. module.exports = factory();
  36821. else {}
  36822. })(window, function() {
  36823. return /******/ (function(modules) { // webpackBootstrap
  36824. /******/ // The module cache
  36825. /******/ var installedModules = {};
  36826. /******/
  36827. /******/ // The require function
  36828. /******/ function __webpack_require__(moduleId) {
  36829. /******/
  36830. /******/ // Check if module is in cache
  36831. /******/ if(installedModules[moduleId]) {
  36832. /******/ return installedModules[moduleId].exports;
  36833. /******/ }
  36834. /******/ // Create a new module (and put it into the cache)
  36835. /******/ var module = installedModules[moduleId] = {
  36836. /******/ i: moduleId,
  36837. /******/ l: false,
  36838. /******/ exports: {}
  36839. /******/ };
  36840. /******/
  36841. /******/ // Execute the module function
  36842. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36843. /******/
  36844. /******/ // Flag the module as loaded
  36845. /******/ module.l = true;
  36846. /******/
  36847. /******/ // Return the exports of the module
  36848. /******/ return module.exports;
  36849. /******/ }
  36850. /******/
  36851. /******/
  36852. /******/ // expose the modules object (__webpack_modules__)
  36853. /******/ __webpack_require__.m = modules;
  36854. /******/
  36855. /******/ // expose the module cache
  36856. /******/ __webpack_require__.c = installedModules;
  36857. /******/
  36858. /******/ // define getter function for harmony exports
  36859. /******/ __webpack_require__.d = function(exports, name, getter) {
  36860. /******/ if(!__webpack_require__.o(exports, name)) {
  36861. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36862. /******/ }
  36863. /******/ };
  36864. /******/
  36865. /******/ // define __esModule on exports
  36866. /******/ __webpack_require__.r = function(exports) {
  36867. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36868. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36869. /******/ }
  36870. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36871. /******/ };
  36872. /******/
  36873. /******/ // create a fake namespace object
  36874. /******/ // mode & 1: value is a module id, require it
  36875. /******/ // mode & 2: merge all properties of value into the ns
  36876. /******/ // mode & 4: return value when already ns object
  36877. /******/ // mode & 8|1: behave like require
  36878. /******/ __webpack_require__.t = function(value, mode) {
  36879. /******/ if(mode & 1) value = __webpack_require__(value);
  36880. /******/ if(mode & 8) return value;
  36881. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36882. /******/ var ns = Object.create(null);
  36883. /******/ __webpack_require__.r(ns);
  36884. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36885. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36886. /******/ return ns;
  36887. /******/ };
  36888. /******/
  36889. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36890. /******/ __webpack_require__.n = function(module) {
  36891. /******/ var getter = module && module.__esModule ?
  36892. /******/ function getDefault() { return module['default']; } :
  36893. /******/ function getModuleExports() { return module; };
  36894. /******/ __webpack_require__.d(getter, 'a', getter);
  36895. /******/ return getter;
  36896. /******/ };
  36897. /******/
  36898. /******/ // Object.prototype.hasOwnProperty.call
  36899. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36900. /******/
  36901. /******/ // __webpack_public_path__
  36902. /******/ __webpack_require__.p = "";
  36903. /******/
  36904. /******/
  36905. /******/ // Load entry module and return exports
  36906. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36907. /******/ })
  36908. /************************************************************************/
  36909. /******/ ([
  36910. /* 0 */
  36911. /***/ (function(module, exports, __webpack_require__) {
  36912. (function(nacl) {
  36913. 'use strict';
  36914. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36915. // Public domain.
  36916. //
  36917. // Implementation derived from TweetNaCl version 20140427.
  36918. // See for details: http://tweetnacl.cr.yp.to/
  36919. var gf = function(init) {
  36920. var i, r = new Float64Array(16);
  36921. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36922. return r;
  36923. };
  36924. // Pluggable, initialized in high-level API below.
  36925. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36926. var _0 = new Uint8Array(16);
  36927. var _9 = new Uint8Array(32); _9[0] = 9;
  36928. var gf0 = gf(),
  36929. gf1 = gf([1]),
  36930. _121665 = gf([0xdb41, 1]),
  36931. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36932. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36933. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36934. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36935. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36936. function ts64(x, i, h, l) {
  36937. x[i] = (h >> 24) & 0xff;
  36938. x[i+1] = (h >> 16) & 0xff;
  36939. x[i+2] = (h >> 8) & 0xff;
  36940. x[i+3] = h & 0xff;
  36941. x[i+4] = (l >> 24) & 0xff;
  36942. x[i+5] = (l >> 16) & 0xff;
  36943. x[i+6] = (l >> 8) & 0xff;
  36944. x[i+7] = l & 0xff;
  36945. }
  36946. function vn(x, xi, y, yi, n) {
  36947. var i,d = 0;
  36948. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36949. return (1 & ((d - 1) >>> 8)) - 1;
  36950. }
  36951. function crypto_verify_16(x, xi, y, yi) {
  36952. return vn(x,xi,y,yi,16);
  36953. }
  36954. function crypto_verify_32(x, xi, y, yi) {
  36955. return vn(x,xi,y,yi,32);
  36956. }
  36957. function core_salsa20(o, p, k, c) {
  36958. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36959. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36960. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36961. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36962. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36963. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36964. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36965. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36966. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36967. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36968. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36969. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36970. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36971. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36972. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36973. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36974. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36975. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36976. x15 = j15, u;
  36977. for (var i = 0; i < 20; i += 2) {
  36978. u = x0 + x12 | 0;
  36979. x4 ^= u<<7 | u>>>(32-7);
  36980. u = x4 + x0 | 0;
  36981. x8 ^= u<<9 | u>>>(32-9);
  36982. u = x8 + x4 | 0;
  36983. x12 ^= u<<13 | u>>>(32-13);
  36984. u = x12 + x8 | 0;
  36985. x0 ^= u<<18 | u>>>(32-18);
  36986. u = x5 + x1 | 0;
  36987. x9 ^= u<<7 | u>>>(32-7);
  36988. u = x9 + x5 | 0;
  36989. x13 ^= u<<9 | u>>>(32-9);
  36990. u = x13 + x9 | 0;
  36991. x1 ^= u<<13 | u>>>(32-13);
  36992. u = x1 + x13 | 0;
  36993. x5 ^= u<<18 | u>>>(32-18);
  36994. u = x10 + x6 | 0;
  36995. x14 ^= u<<7 | u>>>(32-7);
  36996. u = x14 + x10 | 0;
  36997. x2 ^= u<<9 | u>>>(32-9);
  36998. u = x2 + x14 | 0;
  36999. x6 ^= u<<13 | u>>>(32-13);
  37000. u = x6 + x2 | 0;
  37001. x10 ^= u<<18 | u>>>(32-18);
  37002. u = x15 + x11 | 0;
  37003. x3 ^= u<<7 | u>>>(32-7);
  37004. u = x3 + x15 | 0;
  37005. x7 ^= u<<9 | u>>>(32-9);
  37006. u = x7 + x3 | 0;
  37007. x11 ^= u<<13 | u>>>(32-13);
  37008. u = x11 + x7 | 0;
  37009. x15 ^= u<<18 | u>>>(32-18);
  37010. u = x0 + x3 | 0;
  37011. x1 ^= u<<7 | u>>>(32-7);
  37012. u = x1 + x0 | 0;
  37013. x2 ^= u<<9 | u>>>(32-9);
  37014. u = x2 + x1 | 0;
  37015. x3 ^= u<<13 | u>>>(32-13);
  37016. u = x3 + x2 | 0;
  37017. x0 ^= u<<18 | u>>>(32-18);
  37018. u = x5 + x4 | 0;
  37019. x6 ^= u<<7 | u>>>(32-7);
  37020. u = x6 + x5 | 0;
  37021. x7 ^= u<<9 | u>>>(32-9);
  37022. u = x7 + x6 | 0;
  37023. x4 ^= u<<13 | u>>>(32-13);
  37024. u = x4 + x7 | 0;
  37025. x5 ^= u<<18 | u>>>(32-18);
  37026. u = x10 + x9 | 0;
  37027. x11 ^= u<<7 | u>>>(32-7);
  37028. u = x11 + x10 | 0;
  37029. x8 ^= u<<9 | u>>>(32-9);
  37030. u = x8 + x11 | 0;
  37031. x9 ^= u<<13 | u>>>(32-13);
  37032. u = x9 + x8 | 0;
  37033. x10 ^= u<<18 | u>>>(32-18);
  37034. u = x15 + x14 | 0;
  37035. x12 ^= u<<7 | u>>>(32-7);
  37036. u = x12 + x15 | 0;
  37037. x13 ^= u<<9 | u>>>(32-9);
  37038. u = x13 + x12 | 0;
  37039. x14 ^= u<<13 | u>>>(32-13);
  37040. u = x14 + x13 | 0;
  37041. x15 ^= u<<18 | u>>>(32-18);
  37042. }
  37043. x0 = x0 + j0 | 0;
  37044. x1 = x1 + j1 | 0;
  37045. x2 = x2 + j2 | 0;
  37046. x3 = x3 + j3 | 0;
  37047. x4 = x4 + j4 | 0;
  37048. x5 = x5 + j5 | 0;
  37049. x6 = x6 + j6 | 0;
  37050. x7 = x7 + j7 | 0;
  37051. x8 = x8 + j8 | 0;
  37052. x9 = x9 + j9 | 0;
  37053. x10 = x10 + j10 | 0;
  37054. x11 = x11 + j11 | 0;
  37055. x12 = x12 + j12 | 0;
  37056. x13 = x13 + j13 | 0;
  37057. x14 = x14 + j14 | 0;
  37058. x15 = x15 + j15 | 0;
  37059. o[ 0] = x0 >>> 0 & 0xff;
  37060. o[ 1] = x0 >>> 8 & 0xff;
  37061. o[ 2] = x0 >>> 16 & 0xff;
  37062. o[ 3] = x0 >>> 24 & 0xff;
  37063. o[ 4] = x1 >>> 0 & 0xff;
  37064. o[ 5] = x1 >>> 8 & 0xff;
  37065. o[ 6] = x1 >>> 16 & 0xff;
  37066. o[ 7] = x1 >>> 24 & 0xff;
  37067. o[ 8] = x2 >>> 0 & 0xff;
  37068. o[ 9] = x2 >>> 8 & 0xff;
  37069. o[10] = x2 >>> 16 & 0xff;
  37070. o[11] = x2 >>> 24 & 0xff;
  37071. o[12] = x3 >>> 0 & 0xff;
  37072. o[13] = x3 >>> 8 & 0xff;
  37073. o[14] = x3 >>> 16 & 0xff;
  37074. o[15] = x3 >>> 24 & 0xff;
  37075. o[16] = x4 >>> 0 & 0xff;
  37076. o[17] = x4 >>> 8 & 0xff;
  37077. o[18] = x4 >>> 16 & 0xff;
  37078. o[19] = x4 >>> 24 & 0xff;
  37079. o[20] = x5 >>> 0 & 0xff;
  37080. o[21] = x5 >>> 8 & 0xff;
  37081. o[22] = x5 >>> 16 & 0xff;
  37082. o[23] = x5 >>> 24 & 0xff;
  37083. o[24] = x6 >>> 0 & 0xff;
  37084. o[25] = x6 >>> 8 & 0xff;
  37085. o[26] = x6 >>> 16 & 0xff;
  37086. o[27] = x6 >>> 24 & 0xff;
  37087. o[28] = x7 >>> 0 & 0xff;
  37088. o[29] = x7 >>> 8 & 0xff;
  37089. o[30] = x7 >>> 16 & 0xff;
  37090. o[31] = x7 >>> 24 & 0xff;
  37091. o[32] = x8 >>> 0 & 0xff;
  37092. o[33] = x8 >>> 8 & 0xff;
  37093. o[34] = x8 >>> 16 & 0xff;
  37094. o[35] = x8 >>> 24 & 0xff;
  37095. o[36] = x9 >>> 0 & 0xff;
  37096. o[37] = x9 >>> 8 & 0xff;
  37097. o[38] = x9 >>> 16 & 0xff;
  37098. o[39] = x9 >>> 24 & 0xff;
  37099. o[40] = x10 >>> 0 & 0xff;
  37100. o[41] = x10 >>> 8 & 0xff;
  37101. o[42] = x10 >>> 16 & 0xff;
  37102. o[43] = x10 >>> 24 & 0xff;
  37103. o[44] = x11 >>> 0 & 0xff;
  37104. o[45] = x11 >>> 8 & 0xff;
  37105. o[46] = x11 >>> 16 & 0xff;
  37106. o[47] = x11 >>> 24 & 0xff;
  37107. o[48] = x12 >>> 0 & 0xff;
  37108. o[49] = x12 >>> 8 & 0xff;
  37109. o[50] = x12 >>> 16 & 0xff;
  37110. o[51] = x12 >>> 24 & 0xff;
  37111. o[52] = x13 >>> 0 & 0xff;
  37112. o[53] = x13 >>> 8 & 0xff;
  37113. o[54] = x13 >>> 16 & 0xff;
  37114. o[55] = x13 >>> 24 & 0xff;
  37115. o[56] = x14 >>> 0 & 0xff;
  37116. o[57] = x14 >>> 8 & 0xff;
  37117. o[58] = x14 >>> 16 & 0xff;
  37118. o[59] = x14 >>> 24 & 0xff;
  37119. o[60] = x15 >>> 0 & 0xff;
  37120. o[61] = x15 >>> 8 & 0xff;
  37121. o[62] = x15 >>> 16 & 0xff;
  37122. o[63] = x15 >>> 24 & 0xff;
  37123. }
  37124. function core_hsalsa20(o,p,k,c) {
  37125. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37126. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37127. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37128. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37129. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37130. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37131. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37132. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37133. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37134. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37135. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37136. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37137. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37138. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37139. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37140. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37141. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37142. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37143. x15 = j15, u;
  37144. for (var i = 0; i < 20; i += 2) {
  37145. u = x0 + x12 | 0;
  37146. x4 ^= u<<7 | u>>>(32-7);
  37147. u = x4 + x0 | 0;
  37148. x8 ^= u<<9 | u>>>(32-9);
  37149. u = x8 + x4 | 0;
  37150. x12 ^= u<<13 | u>>>(32-13);
  37151. u = x12 + x8 | 0;
  37152. x0 ^= u<<18 | u>>>(32-18);
  37153. u = x5 + x1 | 0;
  37154. x9 ^= u<<7 | u>>>(32-7);
  37155. u = x9 + x5 | 0;
  37156. x13 ^= u<<9 | u>>>(32-9);
  37157. u = x13 + x9 | 0;
  37158. x1 ^= u<<13 | u>>>(32-13);
  37159. u = x1 + x13 | 0;
  37160. x5 ^= u<<18 | u>>>(32-18);
  37161. u = x10 + x6 | 0;
  37162. x14 ^= u<<7 | u>>>(32-7);
  37163. u = x14 + x10 | 0;
  37164. x2 ^= u<<9 | u>>>(32-9);
  37165. u = x2 + x14 | 0;
  37166. x6 ^= u<<13 | u>>>(32-13);
  37167. u = x6 + x2 | 0;
  37168. x10 ^= u<<18 | u>>>(32-18);
  37169. u = x15 + x11 | 0;
  37170. x3 ^= u<<7 | u>>>(32-7);
  37171. u = x3 + x15 | 0;
  37172. x7 ^= u<<9 | u>>>(32-9);
  37173. u = x7 + x3 | 0;
  37174. x11 ^= u<<13 | u>>>(32-13);
  37175. u = x11 + x7 | 0;
  37176. x15 ^= u<<18 | u>>>(32-18);
  37177. u = x0 + x3 | 0;
  37178. x1 ^= u<<7 | u>>>(32-7);
  37179. u = x1 + x0 | 0;
  37180. x2 ^= u<<9 | u>>>(32-9);
  37181. u = x2 + x1 | 0;
  37182. x3 ^= u<<13 | u>>>(32-13);
  37183. u = x3 + x2 | 0;
  37184. x0 ^= u<<18 | u>>>(32-18);
  37185. u = x5 + x4 | 0;
  37186. x6 ^= u<<7 | u>>>(32-7);
  37187. u = x6 + x5 | 0;
  37188. x7 ^= u<<9 | u>>>(32-9);
  37189. u = x7 + x6 | 0;
  37190. x4 ^= u<<13 | u>>>(32-13);
  37191. u = x4 + x7 | 0;
  37192. x5 ^= u<<18 | u>>>(32-18);
  37193. u = x10 + x9 | 0;
  37194. x11 ^= u<<7 | u>>>(32-7);
  37195. u = x11 + x10 | 0;
  37196. x8 ^= u<<9 | u>>>(32-9);
  37197. u = x8 + x11 | 0;
  37198. x9 ^= u<<13 | u>>>(32-13);
  37199. u = x9 + x8 | 0;
  37200. x10 ^= u<<18 | u>>>(32-18);
  37201. u = x15 + x14 | 0;
  37202. x12 ^= u<<7 | u>>>(32-7);
  37203. u = x12 + x15 | 0;
  37204. x13 ^= u<<9 | u>>>(32-9);
  37205. u = x13 + x12 | 0;
  37206. x14 ^= u<<13 | u>>>(32-13);
  37207. u = x14 + x13 | 0;
  37208. x15 ^= u<<18 | u>>>(32-18);
  37209. }
  37210. o[ 0] = x0 >>> 0 & 0xff;
  37211. o[ 1] = x0 >>> 8 & 0xff;
  37212. o[ 2] = x0 >>> 16 & 0xff;
  37213. o[ 3] = x0 >>> 24 & 0xff;
  37214. o[ 4] = x5 >>> 0 & 0xff;
  37215. o[ 5] = x5 >>> 8 & 0xff;
  37216. o[ 6] = x5 >>> 16 & 0xff;
  37217. o[ 7] = x5 >>> 24 & 0xff;
  37218. o[ 8] = x10 >>> 0 & 0xff;
  37219. o[ 9] = x10 >>> 8 & 0xff;
  37220. o[10] = x10 >>> 16 & 0xff;
  37221. o[11] = x10 >>> 24 & 0xff;
  37222. o[12] = x15 >>> 0 & 0xff;
  37223. o[13] = x15 >>> 8 & 0xff;
  37224. o[14] = x15 >>> 16 & 0xff;
  37225. o[15] = x15 >>> 24 & 0xff;
  37226. o[16] = x6 >>> 0 & 0xff;
  37227. o[17] = x6 >>> 8 & 0xff;
  37228. o[18] = x6 >>> 16 & 0xff;
  37229. o[19] = x6 >>> 24 & 0xff;
  37230. o[20] = x7 >>> 0 & 0xff;
  37231. o[21] = x7 >>> 8 & 0xff;
  37232. o[22] = x7 >>> 16 & 0xff;
  37233. o[23] = x7 >>> 24 & 0xff;
  37234. o[24] = x8 >>> 0 & 0xff;
  37235. o[25] = x8 >>> 8 & 0xff;
  37236. o[26] = x8 >>> 16 & 0xff;
  37237. o[27] = x8 >>> 24 & 0xff;
  37238. o[28] = x9 >>> 0 & 0xff;
  37239. o[29] = x9 >>> 8 & 0xff;
  37240. o[30] = x9 >>> 16 & 0xff;
  37241. o[31] = x9 >>> 24 & 0xff;
  37242. }
  37243. function crypto_core_salsa20(out,inp,k,c) {
  37244. core_salsa20(out,inp,k,c);
  37245. }
  37246. function crypto_core_hsalsa20(out,inp,k,c) {
  37247. core_hsalsa20(out,inp,k,c);
  37248. }
  37249. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37250. // "expand 32-byte k"
  37251. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37252. var z = new Uint8Array(16), x = new Uint8Array(64);
  37253. var u, i;
  37254. for (i = 0; i < 16; i++) z[i] = 0;
  37255. for (i = 0; i < 8; i++) z[i] = n[i];
  37256. while (b >= 64) {
  37257. crypto_core_salsa20(x,z,k,sigma);
  37258. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37259. u = 1;
  37260. for (i = 8; i < 16; i++) {
  37261. u = u + (z[i] & 0xff) | 0;
  37262. z[i] = u & 0xff;
  37263. u >>>= 8;
  37264. }
  37265. b -= 64;
  37266. cpos += 64;
  37267. mpos += 64;
  37268. }
  37269. if (b > 0) {
  37270. crypto_core_salsa20(x,z,k,sigma);
  37271. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37272. }
  37273. return 0;
  37274. }
  37275. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37276. var z = new Uint8Array(16), x = new Uint8Array(64);
  37277. var u, i;
  37278. for (i = 0; i < 16; i++) z[i] = 0;
  37279. for (i = 0; i < 8; i++) z[i] = n[i];
  37280. while (b >= 64) {
  37281. crypto_core_salsa20(x,z,k,sigma);
  37282. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37283. u = 1;
  37284. for (i = 8; i < 16; i++) {
  37285. u = u + (z[i] & 0xff) | 0;
  37286. z[i] = u & 0xff;
  37287. u >>>= 8;
  37288. }
  37289. b -= 64;
  37290. cpos += 64;
  37291. }
  37292. if (b > 0) {
  37293. crypto_core_salsa20(x,z,k,sigma);
  37294. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37295. }
  37296. return 0;
  37297. }
  37298. function crypto_stream(c,cpos,d,n,k) {
  37299. var s = new Uint8Array(32);
  37300. crypto_core_hsalsa20(s,n,k,sigma);
  37301. var sn = new Uint8Array(8);
  37302. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37303. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37304. }
  37305. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37306. var s = new Uint8Array(32);
  37307. crypto_core_hsalsa20(s,n,k,sigma);
  37308. var sn = new Uint8Array(8);
  37309. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37310. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37311. }
  37312. /*
  37313. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37314. * https://github.com/floodyberry/poly1305-donna
  37315. */
  37316. var poly1305 = function(key) {
  37317. this.buffer = new Uint8Array(16);
  37318. this.r = new Uint16Array(10);
  37319. this.h = new Uint16Array(10);
  37320. this.pad = new Uint16Array(8);
  37321. this.leftover = 0;
  37322. this.fin = 0;
  37323. var t0, t1, t2, t3, t4, t5, t6, t7;
  37324. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37325. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37326. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37327. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37328. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37329. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37330. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37331. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37332. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37333. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37334. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37335. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37336. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37337. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37338. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37339. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37340. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37341. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37342. };
  37343. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37344. var hibit = this.fin ? 0 : (1 << 11);
  37345. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37346. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37347. var h0 = this.h[0],
  37348. h1 = this.h[1],
  37349. h2 = this.h[2],
  37350. h3 = this.h[3],
  37351. h4 = this.h[4],
  37352. h5 = this.h[5],
  37353. h6 = this.h[6],
  37354. h7 = this.h[7],
  37355. h8 = this.h[8],
  37356. h9 = this.h[9];
  37357. var r0 = this.r[0],
  37358. r1 = this.r[1],
  37359. r2 = this.r[2],
  37360. r3 = this.r[3],
  37361. r4 = this.r[4],
  37362. r5 = this.r[5],
  37363. r6 = this.r[6],
  37364. r7 = this.r[7],
  37365. r8 = this.r[8],
  37366. r9 = this.r[9];
  37367. while (bytes >= 16) {
  37368. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37369. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37370. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37371. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37372. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37373. h5 += ((t4 >>> 1)) & 0x1fff;
  37374. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37375. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37376. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37377. h9 += ((t7 >>> 5)) | hibit;
  37378. c = 0;
  37379. d0 = c;
  37380. d0 += h0 * r0;
  37381. d0 += h1 * (5 * r9);
  37382. d0 += h2 * (5 * r8);
  37383. d0 += h3 * (5 * r7);
  37384. d0 += h4 * (5 * r6);
  37385. c = (d0 >>> 13); d0 &= 0x1fff;
  37386. d0 += h5 * (5 * r5);
  37387. d0 += h6 * (5 * r4);
  37388. d0 += h7 * (5 * r3);
  37389. d0 += h8 * (5 * r2);
  37390. d0 += h9 * (5 * r1);
  37391. c += (d0 >>> 13); d0 &= 0x1fff;
  37392. d1 = c;
  37393. d1 += h0 * r1;
  37394. d1 += h1 * r0;
  37395. d1 += h2 * (5 * r9);
  37396. d1 += h3 * (5 * r8);
  37397. d1 += h4 * (5 * r7);
  37398. c = (d1 >>> 13); d1 &= 0x1fff;
  37399. d1 += h5 * (5 * r6);
  37400. d1 += h6 * (5 * r5);
  37401. d1 += h7 * (5 * r4);
  37402. d1 += h8 * (5 * r3);
  37403. d1 += h9 * (5 * r2);
  37404. c += (d1 >>> 13); d1 &= 0x1fff;
  37405. d2 = c;
  37406. d2 += h0 * r2;
  37407. d2 += h1 * r1;
  37408. d2 += h2 * r0;
  37409. d2 += h3 * (5 * r9);
  37410. d2 += h4 * (5 * r8);
  37411. c = (d2 >>> 13); d2 &= 0x1fff;
  37412. d2 += h5 * (5 * r7);
  37413. d2 += h6 * (5 * r6);
  37414. d2 += h7 * (5 * r5);
  37415. d2 += h8 * (5 * r4);
  37416. d2 += h9 * (5 * r3);
  37417. c += (d2 >>> 13); d2 &= 0x1fff;
  37418. d3 = c;
  37419. d3 += h0 * r3;
  37420. d3 += h1 * r2;
  37421. d3 += h2 * r1;
  37422. d3 += h3 * r0;
  37423. d3 += h4 * (5 * r9);
  37424. c = (d3 >>> 13); d3 &= 0x1fff;
  37425. d3 += h5 * (5 * r8);
  37426. d3 += h6 * (5 * r7);
  37427. d3 += h7 * (5 * r6);
  37428. d3 += h8 * (5 * r5);
  37429. d3 += h9 * (5 * r4);
  37430. c += (d3 >>> 13); d3 &= 0x1fff;
  37431. d4 = c;
  37432. d4 += h0 * r4;
  37433. d4 += h1 * r3;
  37434. d4 += h2 * r2;
  37435. d4 += h3 * r1;
  37436. d4 += h4 * r0;
  37437. c = (d4 >>> 13); d4 &= 0x1fff;
  37438. d4 += h5 * (5 * r9);
  37439. d4 += h6 * (5 * r8);
  37440. d4 += h7 * (5 * r7);
  37441. d4 += h8 * (5 * r6);
  37442. d4 += h9 * (5 * r5);
  37443. c += (d4 >>> 13); d4 &= 0x1fff;
  37444. d5 = c;
  37445. d5 += h0 * r5;
  37446. d5 += h1 * r4;
  37447. d5 += h2 * r3;
  37448. d5 += h3 * r2;
  37449. d5 += h4 * r1;
  37450. c = (d5 >>> 13); d5 &= 0x1fff;
  37451. d5 += h5 * r0;
  37452. d5 += h6 * (5 * r9);
  37453. d5 += h7 * (5 * r8);
  37454. d5 += h8 * (5 * r7);
  37455. d5 += h9 * (5 * r6);
  37456. c += (d5 >>> 13); d5 &= 0x1fff;
  37457. d6 = c;
  37458. d6 += h0 * r6;
  37459. d6 += h1 * r5;
  37460. d6 += h2 * r4;
  37461. d6 += h3 * r3;
  37462. d6 += h4 * r2;
  37463. c = (d6 >>> 13); d6 &= 0x1fff;
  37464. d6 += h5 * r1;
  37465. d6 += h6 * r0;
  37466. d6 += h7 * (5 * r9);
  37467. d6 += h8 * (5 * r8);
  37468. d6 += h9 * (5 * r7);
  37469. c += (d6 >>> 13); d6 &= 0x1fff;
  37470. d7 = c;
  37471. d7 += h0 * r7;
  37472. d7 += h1 * r6;
  37473. d7 += h2 * r5;
  37474. d7 += h3 * r4;
  37475. d7 += h4 * r3;
  37476. c = (d7 >>> 13); d7 &= 0x1fff;
  37477. d7 += h5 * r2;
  37478. d7 += h6 * r1;
  37479. d7 += h7 * r0;
  37480. d7 += h8 * (5 * r9);
  37481. d7 += h9 * (5 * r8);
  37482. c += (d7 >>> 13); d7 &= 0x1fff;
  37483. d8 = c;
  37484. d8 += h0 * r8;
  37485. d8 += h1 * r7;
  37486. d8 += h2 * r6;
  37487. d8 += h3 * r5;
  37488. d8 += h4 * r4;
  37489. c = (d8 >>> 13); d8 &= 0x1fff;
  37490. d8 += h5 * r3;
  37491. d8 += h6 * r2;
  37492. d8 += h7 * r1;
  37493. d8 += h8 * r0;
  37494. d8 += h9 * (5 * r9);
  37495. c += (d8 >>> 13); d8 &= 0x1fff;
  37496. d9 = c;
  37497. d9 += h0 * r9;
  37498. d9 += h1 * r8;
  37499. d9 += h2 * r7;
  37500. d9 += h3 * r6;
  37501. d9 += h4 * r5;
  37502. c = (d9 >>> 13); d9 &= 0x1fff;
  37503. d9 += h5 * r4;
  37504. d9 += h6 * r3;
  37505. d9 += h7 * r2;
  37506. d9 += h8 * r1;
  37507. d9 += h9 * r0;
  37508. c += (d9 >>> 13); d9 &= 0x1fff;
  37509. c = (((c << 2) + c)) | 0;
  37510. c = (c + d0) | 0;
  37511. d0 = c & 0x1fff;
  37512. c = (c >>> 13);
  37513. d1 += c;
  37514. h0 = d0;
  37515. h1 = d1;
  37516. h2 = d2;
  37517. h3 = d3;
  37518. h4 = d4;
  37519. h5 = d5;
  37520. h6 = d6;
  37521. h7 = d7;
  37522. h8 = d8;
  37523. h9 = d9;
  37524. mpos += 16;
  37525. bytes -= 16;
  37526. }
  37527. this.h[0] = h0;
  37528. this.h[1] = h1;
  37529. this.h[2] = h2;
  37530. this.h[3] = h3;
  37531. this.h[4] = h4;
  37532. this.h[5] = h5;
  37533. this.h[6] = h6;
  37534. this.h[7] = h7;
  37535. this.h[8] = h8;
  37536. this.h[9] = h9;
  37537. };
  37538. poly1305.prototype.finish = function(mac, macpos) {
  37539. var g = new Uint16Array(10);
  37540. var c, mask, f, i;
  37541. if (this.leftover) {
  37542. i = this.leftover;
  37543. this.buffer[i++] = 1;
  37544. for (; i < 16; i++) this.buffer[i] = 0;
  37545. this.fin = 1;
  37546. this.blocks(this.buffer, 0, 16);
  37547. }
  37548. c = this.h[1] >>> 13;
  37549. this.h[1] &= 0x1fff;
  37550. for (i = 2; i < 10; i++) {
  37551. this.h[i] += c;
  37552. c = this.h[i] >>> 13;
  37553. this.h[i] &= 0x1fff;
  37554. }
  37555. this.h[0] += (c * 5);
  37556. c = this.h[0] >>> 13;
  37557. this.h[0] &= 0x1fff;
  37558. this.h[1] += c;
  37559. c = this.h[1] >>> 13;
  37560. this.h[1] &= 0x1fff;
  37561. this.h[2] += c;
  37562. g[0] = this.h[0] + 5;
  37563. c = g[0] >>> 13;
  37564. g[0] &= 0x1fff;
  37565. for (i = 1; i < 10; i++) {
  37566. g[i] = this.h[i] + c;
  37567. c = g[i] >>> 13;
  37568. g[i] &= 0x1fff;
  37569. }
  37570. g[9] -= (1 << 13);
  37571. mask = (c ^ 1) - 1;
  37572. for (i = 0; i < 10; i++) g[i] &= mask;
  37573. mask = ~mask;
  37574. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37575. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37576. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37577. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37578. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37579. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37580. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37581. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37582. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37583. f = this.h[0] + this.pad[0];
  37584. this.h[0] = f & 0xffff;
  37585. for (i = 1; i < 8; i++) {
  37586. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37587. this.h[i] = f & 0xffff;
  37588. }
  37589. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37590. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37591. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37592. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37593. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37594. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37595. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37596. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37597. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37598. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37599. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37600. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37601. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37602. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37603. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37604. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37605. };
  37606. poly1305.prototype.update = function(m, mpos, bytes) {
  37607. var i, want;
  37608. if (this.leftover) {
  37609. want = (16 - this.leftover);
  37610. if (want > bytes)
  37611. want = bytes;
  37612. for (i = 0; i < want; i++)
  37613. this.buffer[this.leftover + i] = m[mpos+i];
  37614. bytes -= want;
  37615. mpos += want;
  37616. this.leftover += want;
  37617. if (this.leftover < 16)
  37618. return;
  37619. this.blocks(this.buffer, 0, 16);
  37620. this.leftover = 0;
  37621. }
  37622. if (bytes >= 16) {
  37623. want = bytes - (bytes % 16);
  37624. this.blocks(m, mpos, want);
  37625. mpos += want;
  37626. bytes -= want;
  37627. }
  37628. if (bytes) {
  37629. for (i = 0; i < bytes; i++)
  37630. this.buffer[this.leftover + i] = m[mpos+i];
  37631. this.leftover += bytes;
  37632. }
  37633. };
  37634. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37635. var s = new poly1305(k);
  37636. s.update(m, mpos, n);
  37637. s.finish(out, outpos);
  37638. return 0;
  37639. }
  37640. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37641. var x = new Uint8Array(16);
  37642. crypto_onetimeauth(x,0,m,mpos,n,k);
  37643. return crypto_verify_16(h,hpos,x,0);
  37644. }
  37645. function crypto_secretbox(c,m,d,n,k) {
  37646. var i;
  37647. if (d < 32) return -1;
  37648. crypto_stream_xor(c,0,m,0,d,n,k);
  37649. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37650. for (i = 0; i < 16; i++) c[i] = 0;
  37651. return 0;
  37652. }
  37653. function crypto_secretbox_open(m,c,d,n,k) {
  37654. var i;
  37655. var x = new Uint8Array(32);
  37656. if (d < 32) return -1;
  37657. crypto_stream(x,0,32,n,k);
  37658. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37659. crypto_stream_xor(m,0,c,0,d,n,k);
  37660. for (i = 0; i < 32; i++) m[i] = 0;
  37661. return 0;
  37662. }
  37663. function set25519(r, a) {
  37664. var i;
  37665. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37666. }
  37667. function car25519(o) {
  37668. var i, v, c = 1;
  37669. for (i = 0; i < 16; i++) {
  37670. v = o[i] + c + 65535;
  37671. c = Math.floor(v / 65536);
  37672. o[i] = v - c * 65536;
  37673. }
  37674. o[0] += c-1 + 37 * (c-1);
  37675. }
  37676. function sel25519(p, q, b) {
  37677. var t, c = ~(b-1);
  37678. for (var i = 0; i < 16; i++) {
  37679. t = c & (p[i] ^ q[i]);
  37680. p[i] ^= t;
  37681. q[i] ^= t;
  37682. }
  37683. }
  37684. function pack25519(o, n) {
  37685. var i, j, b;
  37686. var m = gf(), t = gf();
  37687. for (i = 0; i < 16; i++) t[i] = n[i];
  37688. car25519(t);
  37689. car25519(t);
  37690. car25519(t);
  37691. for (j = 0; j < 2; j++) {
  37692. m[0] = t[0] - 0xffed;
  37693. for (i = 1; i < 15; i++) {
  37694. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37695. m[i-1] &= 0xffff;
  37696. }
  37697. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37698. b = (m[15]>>16) & 1;
  37699. m[14] &= 0xffff;
  37700. sel25519(t, m, 1-b);
  37701. }
  37702. for (i = 0; i < 16; i++) {
  37703. o[2*i] = t[i] & 0xff;
  37704. o[2*i+1] = t[i]>>8;
  37705. }
  37706. }
  37707. function neq25519(a, b) {
  37708. var c = new Uint8Array(32), d = new Uint8Array(32);
  37709. pack25519(c, a);
  37710. pack25519(d, b);
  37711. return crypto_verify_32(c, 0, d, 0);
  37712. }
  37713. function par25519(a) {
  37714. var d = new Uint8Array(32);
  37715. pack25519(d, a);
  37716. return d[0] & 1;
  37717. }
  37718. function unpack25519(o, n) {
  37719. var i;
  37720. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37721. o[15] &= 0x7fff;
  37722. }
  37723. function A(o, a, b) {
  37724. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37725. }
  37726. function Z(o, a, b) {
  37727. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37728. }
  37729. function M(o, a, b) {
  37730. var v, c,
  37731. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37732. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37733. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37734. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37735. b0 = b[0],
  37736. b1 = b[1],
  37737. b2 = b[2],
  37738. b3 = b[3],
  37739. b4 = b[4],
  37740. b5 = b[5],
  37741. b6 = b[6],
  37742. b7 = b[7],
  37743. b8 = b[8],
  37744. b9 = b[9],
  37745. b10 = b[10],
  37746. b11 = b[11],
  37747. b12 = b[12],
  37748. b13 = b[13],
  37749. b14 = b[14],
  37750. b15 = b[15];
  37751. v = a[0];
  37752. t0 += v * b0;
  37753. t1 += v * b1;
  37754. t2 += v * b2;
  37755. t3 += v * b3;
  37756. t4 += v * b4;
  37757. t5 += v * b5;
  37758. t6 += v * b6;
  37759. t7 += v * b7;
  37760. t8 += v * b8;
  37761. t9 += v * b9;
  37762. t10 += v * b10;
  37763. t11 += v * b11;
  37764. t12 += v * b12;
  37765. t13 += v * b13;
  37766. t14 += v * b14;
  37767. t15 += v * b15;
  37768. v = a[1];
  37769. t1 += v * b0;
  37770. t2 += v * b1;
  37771. t3 += v * b2;
  37772. t4 += v * b3;
  37773. t5 += v * b4;
  37774. t6 += v * b5;
  37775. t7 += v * b6;
  37776. t8 += v * b7;
  37777. t9 += v * b8;
  37778. t10 += v * b9;
  37779. t11 += v * b10;
  37780. t12 += v * b11;
  37781. t13 += v * b12;
  37782. t14 += v * b13;
  37783. t15 += v * b14;
  37784. t16 += v * b15;
  37785. v = a[2];
  37786. t2 += v * b0;
  37787. t3 += v * b1;
  37788. t4 += v * b2;
  37789. t5 += v * b3;
  37790. t6 += v * b4;
  37791. t7 += v * b5;
  37792. t8 += v * b6;
  37793. t9 += v * b7;
  37794. t10 += v * b8;
  37795. t11 += v * b9;
  37796. t12 += v * b10;
  37797. t13 += v * b11;
  37798. t14 += v * b12;
  37799. t15 += v * b13;
  37800. t16 += v * b14;
  37801. t17 += v * b15;
  37802. v = a[3];
  37803. t3 += v * b0;
  37804. t4 += v * b1;
  37805. t5 += v * b2;
  37806. t6 += v * b3;
  37807. t7 += v * b4;
  37808. t8 += v * b5;
  37809. t9 += v * b6;
  37810. t10 += v * b7;
  37811. t11 += v * b8;
  37812. t12 += v * b9;
  37813. t13 += v * b10;
  37814. t14 += v * b11;
  37815. t15 += v * b12;
  37816. t16 += v * b13;
  37817. t17 += v * b14;
  37818. t18 += v * b15;
  37819. v = a[4];
  37820. t4 += v * b0;
  37821. t5 += v * b1;
  37822. t6 += v * b2;
  37823. t7 += v * b3;
  37824. t8 += v * b4;
  37825. t9 += v * b5;
  37826. t10 += v * b6;
  37827. t11 += v * b7;
  37828. t12 += v * b8;
  37829. t13 += v * b9;
  37830. t14 += v * b10;
  37831. t15 += v * b11;
  37832. t16 += v * b12;
  37833. t17 += v * b13;
  37834. t18 += v * b14;
  37835. t19 += v * b15;
  37836. v = a[5];
  37837. t5 += v * b0;
  37838. t6 += v * b1;
  37839. t7 += v * b2;
  37840. t8 += v * b3;
  37841. t9 += v * b4;
  37842. t10 += v * b5;
  37843. t11 += v * b6;
  37844. t12 += v * b7;
  37845. t13 += v * b8;
  37846. t14 += v * b9;
  37847. t15 += v * b10;
  37848. t16 += v * b11;
  37849. t17 += v * b12;
  37850. t18 += v * b13;
  37851. t19 += v * b14;
  37852. t20 += v * b15;
  37853. v = a[6];
  37854. t6 += v * b0;
  37855. t7 += v * b1;
  37856. t8 += v * b2;
  37857. t9 += v * b3;
  37858. t10 += v * b4;
  37859. t11 += v * b5;
  37860. t12 += v * b6;
  37861. t13 += v * b7;
  37862. t14 += v * b8;
  37863. t15 += v * b9;
  37864. t16 += v * b10;
  37865. t17 += v * b11;
  37866. t18 += v * b12;
  37867. t19 += v * b13;
  37868. t20 += v * b14;
  37869. t21 += v * b15;
  37870. v = a[7];
  37871. t7 += v * b0;
  37872. t8 += v * b1;
  37873. t9 += v * b2;
  37874. t10 += v * b3;
  37875. t11 += v * b4;
  37876. t12 += v * b5;
  37877. t13 += v * b6;
  37878. t14 += v * b7;
  37879. t15 += v * b8;
  37880. t16 += v * b9;
  37881. t17 += v * b10;
  37882. t18 += v * b11;
  37883. t19 += v * b12;
  37884. t20 += v * b13;
  37885. t21 += v * b14;
  37886. t22 += v * b15;
  37887. v = a[8];
  37888. t8 += v * b0;
  37889. t9 += v * b1;
  37890. t10 += v * b2;
  37891. t11 += v * b3;
  37892. t12 += v * b4;
  37893. t13 += v * b5;
  37894. t14 += v * b6;
  37895. t15 += v * b7;
  37896. t16 += v * b8;
  37897. t17 += v * b9;
  37898. t18 += v * b10;
  37899. t19 += v * b11;
  37900. t20 += v * b12;
  37901. t21 += v * b13;
  37902. t22 += v * b14;
  37903. t23 += v * b15;
  37904. v = a[9];
  37905. t9 += v * b0;
  37906. t10 += v * b1;
  37907. t11 += v * b2;
  37908. t12 += v * b3;
  37909. t13 += v * b4;
  37910. t14 += v * b5;
  37911. t15 += v * b6;
  37912. t16 += v * b7;
  37913. t17 += v * b8;
  37914. t18 += v * b9;
  37915. t19 += v * b10;
  37916. t20 += v * b11;
  37917. t21 += v * b12;
  37918. t22 += v * b13;
  37919. t23 += v * b14;
  37920. t24 += v * b15;
  37921. v = a[10];
  37922. t10 += v * b0;
  37923. t11 += v * b1;
  37924. t12 += v * b2;
  37925. t13 += v * b3;
  37926. t14 += v * b4;
  37927. t15 += v * b5;
  37928. t16 += v * b6;
  37929. t17 += v * b7;
  37930. t18 += v * b8;
  37931. t19 += v * b9;
  37932. t20 += v * b10;
  37933. t21 += v * b11;
  37934. t22 += v * b12;
  37935. t23 += v * b13;
  37936. t24 += v * b14;
  37937. t25 += v * b15;
  37938. v = a[11];
  37939. t11 += v * b0;
  37940. t12 += v * b1;
  37941. t13 += v * b2;
  37942. t14 += v * b3;
  37943. t15 += v * b4;
  37944. t16 += v * b5;
  37945. t17 += v * b6;
  37946. t18 += v * b7;
  37947. t19 += v * b8;
  37948. t20 += v * b9;
  37949. t21 += v * b10;
  37950. t22 += v * b11;
  37951. t23 += v * b12;
  37952. t24 += v * b13;
  37953. t25 += v * b14;
  37954. t26 += v * b15;
  37955. v = a[12];
  37956. t12 += v * b0;
  37957. t13 += v * b1;
  37958. t14 += v * b2;
  37959. t15 += v * b3;
  37960. t16 += v * b4;
  37961. t17 += v * b5;
  37962. t18 += v * b6;
  37963. t19 += v * b7;
  37964. t20 += v * b8;
  37965. t21 += v * b9;
  37966. t22 += v * b10;
  37967. t23 += v * b11;
  37968. t24 += v * b12;
  37969. t25 += v * b13;
  37970. t26 += v * b14;
  37971. t27 += v * b15;
  37972. v = a[13];
  37973. t13 += v * b0;
  37974. t14 += v * b1;
  37975. t15 += v * b2;
  37976. t16 += v * b3;
  37977. t17 += v * b4;
  37978. t18 += v * b5;
  37979. t19 += v * b6;
  37980. t20 += v * b7;
  37981. t21 += v * b8;
  37982. t22 += v * b9;
  37983. t23 += v * b10;
  37984. t24 += v * b11;
  37985. t25 += v * b12;
  37986. t26 += v * b13;
  37987. t27 += v * b14;
  37988. t28 += v * b15;
  37989. v = a[14];
  37990. t14 += v * b0;
  37991. t15 += v * b1;
  37992. t16 += v * b2;
  37993. t17 += v * b3;
  37994. t18 += v * b4;
  37995. t19 += v * b5;
  37996. t20 += v * b6;
  37997. t21 += v * b7;
  37998. t22 += v * b8;
  37999. t23 += v * b9;
  38000. t24 += v * b10;
  38001. t25 += v * b11;
  38002. t26 += v * b12;
  38003. t27 += v * b13;
  38004. t28 += v * b14;
  38005. t29 += v * b15;
  38006. v = a[15];
  38007. t15 += v * b0;
  38008. t16 += v * b1;
  38009. t17 += v * b2;
  38010. t18 += v * b3;
  38011. t19 += v * b4;
  38012. t20 += v * b5;
  38013. t21 += v * b6;
  38014. t22 += v * b7;
  38015. t23 += v * b8;
  38016. t24 += v * b9;
  38017. t25 += v * b10;
  38018. t26 += v * b11;
  38019. t27 += v * b12;
  38020. t28 += v * b13;
  38021. t29 += v * b14;
  38022. t30 += v * b15;
  38023. t0 += 38 * t16;
  38024. t1 += 38 * t17;
  38025. t2 += 38 * t18;
  38026. t3 += 38 * t19;
  38027. t4 += 38 * t20;
  38028. t5 += 38 * t21;
  38029. t6 += 38 * t22;
  38030. t7 += 38 * t23;
  38031. t8 += 38 * t24;
  38032. t9 += 38 * t25;
  38033. t10 += 38 * t26;
  38034. t11 += 38 * t27;
  38035. t12 += 38 * t28;
  38036. t13 += 38 * t29;
  38037. t14 += 38 * t30;
  38038. // t15 left as is
  38039. // first car
  38040. c = 1;
  38041. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38042. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38043. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38044. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38045. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38046. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38047. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38048. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38049. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38050. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38051. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38052. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38053. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38054. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38055. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38056. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38057. t0 += c-1 + 37 * (c-1);
  38058. // second car
  38059. c = 1;
  38060. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38061. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38062. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38063. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38064. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38065. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38066. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38067. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38068. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38069. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38070. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38071. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38072. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38073. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38074. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38075. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38076. t0 += c-1 + 37 * (c-1);
  38077. o[ 0] = t0;
  38078. o[ 1] = t1;
  38079. o[ 2] = t2;
  38080. o[ 3] = t3;
  38081. o[ 4] = t4;
  38082. o[ 5] = t5;
  38083. o[ 6] = t6;
  38084. o[ 7] = t7;
  38085. o[ 8] = t8;
  38086. o[ 9] = t9;
  38087. o[10] = t10;
  38088. o[11] = t11;
  38089. o[12] = t12;
  38090. o[13] = t13;
  38091. o[14] = t14;
  38092. o[15] = t15;
  38093. }
  38094. function S(o, a) {
  38095. M(o, a, a);
  38096. }
  38097. function inv25519(o, i) {
  38098. var c = gf();
  38099. var a;
  38100. for (a = 0; a < 16; a++) c[a] = i[a];
  38101. for (a = 253; a >= 0; a--) {
  38102. S(c, c);
  38103. if(a !== 2 && a !== 4) M(c, c, i);
  38104. }
  38105. for (a = 0; a < 16; a++) o[a] = c[a];
  38106. }
  38107. function pow2523(o, i) {
  38108. var c = gf();
  38109. var a;
  38110. for (a = 0; a < 16; a++) c[a] = i[a];
  38111. for (a = 250; a >= 0; a--) {
  38112. S(c, c);
  38113. if(a !== 1) M(c, c, i);
  38114. }
  38115. for (a = 0; a < 16; a++) o[a] = c[a];
  38116. }
  38117. function crypto_scalarmult(q, n, p) {
  38118. var z = new Uint8Array(32);
  38119. var x = new Float64Array(80), r, i;
  38120. var a = gf(), b = gf(), c = gf(),
  38121. d = gf(), e = gf(), f = gf();
  38122. for (i = 0; i < 31; i++) z[i] = n[i];
  38123. z[31]=(n[31]&127)|64;
  38124. z[0]&=248;
  38125. unpack25519(x,p);
  38126. for (i = 0; i < 16; i++) {
  38127. b[i]=x[i];
  38128. d[i]=a[i]=c[i]=0;
  38129. }
  38130. a[0]=d[0]=1;
  38131. for (i=254; i>=0; --i) {
  38132. r=(z[i>>>3]>>>(i&7))&1;
  38133. sel25519(a,b,r);
  38134. sel25519(c,d,r);
  38135. A(e,a,c);
  38136. Z(a,a,c);
  38137. A(c,b,d);
  38138. Z(b,b,d);
  38139. S(d,e);
  38140. S(f,a);
  38141. M(a,c,a);
  38142. M(c,b,e);
  38143. A(e,a,c);
  38144. Z(a,a,c);
  38145. S(b,a);
  38146. Z(c,d,f);
  38147. M(a,c,_121665);
  38148. A(a,a,d);
  38149. M(c,c,a);
  38150. M(a,d,f);
  38151. M(d,b,x);
  38152. S(b,e);
  38153. sel25519(a,b,r);
  38154. sel25519(c,d,r);
  38155. }
  38156. for (i = 0; i < 16; i++) {
  38157. x[i+16]=a[i];
  38158. x[i+32]=c[i];
  38159. x[i+48]=b[i];
  38160. x[i+64]=d[i];
  38161. }
  38162. var x32 = x.subarray(32);
  38163. var x16 = x.subarray(16);
  38164. inv25519(x32,x32);
  38165. M(x16,x16,x32);
  38166. pack25519(q,x16);
  38167. return 0;
  38168. }
  38169. function crypto_scalarmult_base(q, n) {
  38170. return crypto_scalarmult(q, n, _9);
  38171. }
  38172. function crypto_box_keypair(y, x) {
  38173. randombytes(x, 32);
  38174. return crypto_scalarmult_base(y, x);
  38175. }
  38176. function crypto_box_beforenm(k, y, x) {
  38177. var s = new Uint8Array(32);
  38178. crypto_scalarmult(s, x, y);
  38179. return crypto_core_hsalsa20(k, _0, s, sigma);
  38180. }
  38181. var crypto_box_afternm = crypto_secretbox;
  38182. var crypto_box_open_afternm = crypto_secretbox_open;
  38183. function crypto_box(c, m, d, n, y, x) {
  38184. var k = new Uint8Array(32);
  38185. crypto_box_beforenm(k, y, x);
  38186. return crypto_box_afternm(c, m, d, n, k);
  38187. }
  38188. function crypto_box_open(m, c, d, n, y, x) {
  38189. var k = new Uint8Array(32);
  38190. crypto_box_beforenm(k, y, x);
  38191. return crypto_box_open_afternm(m, c, d, n, k);
  38192. }
  38193. var K = [
  38194. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38195. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38196. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38197. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38198. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38199. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38200. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38201. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38202. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38203. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38204. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38205. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38206. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38207. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38208. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38209. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38210. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38211. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38212. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38213. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38214. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38215. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38216. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38217. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38218. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38219. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38220. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38221. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38222. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38223. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38224. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38225. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38226. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38227. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38228. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38229. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38230. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38231. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38232. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38233. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38234. ];
  38235. function crypto_hashblocks_hl(hh, hl, m, n) {
  38236. var wh = new Int32Array(16), wl = new Int32Array(16),
  38237. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38238. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38239. th, tl, i, j, h, l, a, b, c, d;
  38240. var ah0 = hh[0],
  38241. ah1 = hh[1],
  38242. ah2 = hh[2],
  38243. ah3 = hh[3],
  38244. ah4 = hh[4],
  38245. ah5 = hh[5],
  38246. ah6 = hh[6],
  38247. ah7 = hh[7],
  38248. al0 = hl[0],
  38249. al1 = hl[1],
  38250. al2 = hl[2],
  38251. al3 = hl[3],
  38252. al4 = hl[4],
  38253. al5 = hl[5],
  38254. al6 = hl[6],
  38255. al7 = hl[7];
  38256. var pos = 0;
  38257. while (n >= 128) {
  38258. for (i = 0; i < 16; i++) {
  38259. j = 8 * i + pos;
  38260. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38261. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38262. }
  38263. for (i = 0; i < 80; i++) {
  38264. bh0 = ah0;
  38265. bh1 = ah1;
  38266. bh2 = ah2;
  38267. bh3 = ah3;
  38268. bh4 = ah4;
  38269. bh5 = ah5;
  38270. bh6 = ah6;
  38271. bh7 = ah7;
  38272. bl0 = al0;
  38273. bl1 = al1;
  38274. bl2 = al2;
  38275. bl3 = al3;
  38276. bl4 = al4;
  38277. bl5 = al5;
  38278. bl6 = al6;
  38279. bl7 = al7;
  38280. // add
  38281. h = ah7;
  38282. l = al7;
  38283. a = l & 0xffff; b = l >>> 16;
  38284. c = h & 0xffff; d = h >>> 16;
  38285. // Sigma1
  38286. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38287. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38288. a += l & 0xffff; b += l >>> 16;
  38289. c += h & 0xffff; d += h >>> 16;
  38290. // Ch
  38291. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38292. l = (al4 & al5) ^ (~al4 & al6);
  38293. a += l & 0xffff; b += l >>> 16;
  38294. c += h & 0xffff; d += h >>> 16;
  38295. // K
  38296. h = K[i*2];
  38297. l = K[i*2+1];
  38298. a += l & 0xffff; b += l >>> 16;
  38299. c += h & 0xffff; d += h >>> 16;
  38300. // w
  38301. h = wh[i%16];
  38302. l = wl[i%16];
  38303. a += l & 0xffff; b += l >>> 16;
  38304. c += h & 0xffff; d += h >>> 16;
  38305. b += a >>> 16;
  38306. c += b >>> 16;
  38307. d += c >>> 16;
  38308. th = c & 0xffff | d << 16;
  38309. tl = a & 0xffff | b << 16;
  38310. // add
  38311. h = th;
  38312. l = tl;
  38313. a = l & 0xffff; b = l >>> 16;
  38314. c = h & 0xffff; d = h >>> 16;
  38315. // Sigma0
  38316. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38317. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38318. a += l & 0xffff; b += l >>> 16;
  38319. c += h & 0xffff; d += h >>> 16;
  38320. // Maj
  38321. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38322. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38323. a += l & 0xffff; b += l >>> 16;
  38324. c += h & 0xffff; d += h >>> 16;
  38325. b += a >>> 16;
  38326. c += b >>> 16;
  38327. d += c >>> 16;
  38328. bh7 = (c & 0xffff) | (d << 16);
  38329. bl7 = (a & 0xffff) | (b << 16);
  38330. // add
  38331. h = bh3;
  38332. l = bl3;
  38333. a = l & 0xffff; b = l >>> 16;
  38334. c = h & 0xffff; d = h >>> 16;
  38335. h = th;
  38336. l = tl;
  38337. a += l & 0xffff; b += l >>> 16;
  38338. c += h & 0xffff; d += h >>> 16;
  38339. b += a >>> 16;
  38340. c += b >>> 16;
  38341. d += c >>> 16;
  38342. bh3 = (c & 0xffff) | (d << 16);
  38343. bl3 = (a & 0xffff) | (b << 16);
  38344. ah1 = bh0;
  38345. ah2 = bh1;
  38346. ah3 = bh2;
  38347. ah4 = bh3;
  38348. ah5 = bh4;
  38349. ah6 = bh5;
  38350. ah7 = bh6;
  38351. ah0 = bh7;
  38352. al1 = bl0;
  38353. al2 = bl1;
  38354. al3 = bl2;
  38355. al4 = bl3;
  38356. al5 = bl4;
  38357. al6 = bl5;
  38358. al7 = bl6;
  38359. al0 = bl7;
  38360. if (i%16 === 15) {
  38361. for (j = 0; j < 16; j++) {
  38362. // add
  38363. h = wh[j];
  38364. l = wl[j];
  38365. a = l & 0xffff; b = l >>> 16;
  38366. c = h & 0xffff; d = h >>> 16;
  38367. h = wh[(j+9)%16];
  38368. l = wl[(j+9)%16];
  38369. a += l & 0xffff; b += l >>> 16;
  38370. c += h & 0xffff; d += h >>> 16;
  38371. // sigma0
  38372. th = wh[(j+1)%16];
  38373. tl = wl[(j+1)%16];
  38374. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38375. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38376. a += l & 0xffff; b += l >>> 16;
  38377. c += h & 0xffff; d += h >>> 16;
  38378. // sigma1
  38379. th = wh[(j+14)%16];
  38380. tl = wl[(j+14)%16];
  38381. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38382. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38383. a += l & 0xffff; b += l >>> 16;
  38384. c += h & 0xffff; d += h >>> 16;
  38385. b += a >>> 16;
  38386. c += b >>> 16;
  38387. d += c >>> 16;
  38388. wh[j] = (c & 0xffff) | (d << 16);
  38389. wl[j] = (a & 0xffff) | (b << 16);
  38390. }
  38391. }
  38392. }
  38393. // add
  38394. h = ah0;
  38395. l = al0;
  38396. a = l & 0xffff; b = l >>> 16;
  38397. c = h & 0xffff; d = h >>> 16;
  38398. h = hh[0];
  38399. l = hl[0];
  38400. a += l & 0xffff; b += l >>> 16;
  38401. c += h & 0xffff; d += h >>> 16;
  38402. b += a >>> 16;
  38403. c += b >>> 16;
  38404. d += c >>> 16;
  38405. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38406. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38407. h = ah1;
  38408. l = al1;
  38409. a = l & 0xffff; b = l >>> 16;
  38410. c = h & 0xffff; d = h >>> 16;
  38411. h = hh[1];
  38412. l = hl[1];
  38413. a += l & 0xffff; b += l >>> 16;
  38414. c += h & 0xffff; d += h >>> 16;
  38415. b += a >>> 16;
  38416. c += b >>> 16;
  38417. d += c >>> 16;
  38418. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38419. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38420. h = ah2;
  38421. l = al2;
  38422. a = l & 0xffff; b = l >>> 16;
  38423. c = h & 0xffff; d = h >>> 16;
  38424. h = hh[2];
  38425. l = hl[2];
  38426. a += l & 0xffff; b += l >>> 16;
  38427. c += h & 0xffff; d += h >>> 16;
  38428. b += a >>> 16;
  38429. c += b >>> 16;
  38430. d += c >>> 16;
  38431. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38432. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38433. h = ah3;
  38434. l = al3;
  38435. a = l & 0xffff; b = l >>> 16;
  38436. c = h & 0xffff; d = h >>> 16;
  38437. h = hh[3];
  38438. l = hl[3];
  38439. a += l & 0xffff; b += l >>> 16;
  38440. c += h & 0xffff; d += h >>> 16;
  38441. b += a >>> 16;
  38442. c += b >>> 16;
  38443. d += c >>> 16;
  38444. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38445. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38446. h = ah4;
  38447. l = al4;
  38448. a = l & 0xffff; b = l >>> 16;
  38449. c = h & 0xffff; d = h >>> 16;
  38450. h = hh[4];
  38451. l = hl[4];
  38452. a += l & 0xffff; b += l >>> 16;
  38453. c += h & 0xffff; d += h >>> 16;
  38454. b += a >>> 16;
  38455. c += b >>> 16;
  38456. d += c >>> 16;
  38457. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38458. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38459. h = ah5;
  38460. l = al5;
  38461. a = l & 0xffff; b = l >>> 16;
  38462. c = h & 0xffff; d = h >>> 16;
  38463. h = hh[5];
  38464. l = hl[5];
  38465. a += l & 0xffff; b += l >>> 16;
  38466. c += h & 0xffff; d += h >>> 16;
  38467. b += a >>> 16;
  38468. c += b >>> 16;
  38469. d += c >>> 16;
  38470. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38471. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38472. h = ah6;
  38473. l = al6;
  38474. a = l & 0xffff; b = l >>> 16;
  38475. c = h & 0xffff; d = h >>> 16;
  38476. h = hh[6];
  38477. l = hl[6];
  38478. a += l & 0xffff; b += l >>> 16;
  38479. c += h & 0xffff; d += h >>> 16;
  38480. b += a >>> 16;
  38481. c += b >>> 16;
  38482. d += c >>> 16;
  38483. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38484. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38485. h = ah7;
  38486. l = al7;
  38487. a = l & 0xffff; b = l >>> 16;
  38488. c = h & 0xffff; d = h >>> 16;
  38489. h = hh[7];
  38490. l = hl[7];
  38491. a += l & 0xffff; b += l >>> 16;
  38492. c += h & 0xffff; d += h >>> 16;
  38493. b += a >>> 16;
  38494. c += b >>> 16;
  38495. d += c >>> 16;
  38496. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38497. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38498. pos += 128;
  38499. n -= 128;
  38500. }
  38501. return n;
  38502. }
  38503. function crypto_hash(out, m, n) {
  38504. var hh = new Int32Array(8),
  38505. hl = new Int32Array(8),
  38506. x = new Uint8Array(256),
  38507. i, b = n;
  38508. hh[0] = 0x6a09e667;
  38509. hh[1] = 0xbb67ae85;
  38510. hh[2] = 0x3c6ef372;
  38511. hh[3] = 0xa54ff53a;
  38512. hh[4] = 0x510e527f;
  38513. hh[5] = 0x9b05688c;
  38514. hh[6] = 0x1f83d9ab;
  38515. hh[7] = 0x5be0cd19;
  38516. hl[0] = 0xf3bcc908;
  38517. hl[1] = 0x84caa73b;
  38518. hl[2] = 0xfe94f82b;
  38519. hl[3] = 0x5f1d36f1;
  38520. hl[4] = 0xade682d1;
  38521. hl[5] = 0x2b3e6c1f;
  38522. hl[6] = 0xfb41bd6b;
  38523. hl[7] = 0x137e2179;
  38524. crypto_hashblocks_hl(hh, hl, m, n);
  38525. n %= 128;
  38526. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38527. x[n] = 128;
  38528. n = 256-128*(n<112?1:0);
  38529. x[n-9] = 0;
  38530. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38531. crypto_hashblocks_hl(hh, hl, x, n);
  38532. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38533. return 0;
  38534. }
  38535. function add(p, q) {
  38536. var a = gf(), b = gf(), c = gf(),
  38537. d = gf(), e = gf(), f = gf(),
  38538. g = gf(), h = gf(), t = gf();
  38539. Z(a, p[1], p[0]);
  38540. Z(t, q[1], q[0]);
  38541. M(a, a, t);
  38542. A(b, p[0], p[1]);
  38543. A(t, q[0], q[1]);
  38544. M(b, b, t);
  38545. M(c, p[3], q[3]);
  38546. M(c, c, D2);
  38547. M(d, p[2], q[2]);
  38548. A(d, d, d);
  38549. Z(e, b, a);
  38550. Z(f, d, c);
  38551. A(g, d, c);
  38552. A(h, b, a);
  38553. M(p[0], e, f);
  38554. M(p[1], h, g);
  38555. M(p[2], g, f);
  38556. M(p[3], e, h);
  38557. }
  38558. function cswap(p, q, b) {
  38559. var i;
  38560. for (i = 0; i < 4; i++) {
  38561. sel25519(p[i], q[i], b);
  38562. }
  38563. }
  38564. function pack(r, p) {
  38565. var tx = gf(), ty = gf(), zi = gf();
  38566. inv25519(zi, p[2]);
  38567. M(tx, p[0], zi);
  38568. M(ty, p[1], zi);
  38569. pack25519(r, ty);
  38570. r[31] ^= par25519(tx) << 7;
  38571. }
  38572. function scalarmult(p, q, s) {
  38573. var b, i;
  38574. set25519(p[0], gf0);
  38575. set25519(p[1], gf1);
  38576. set25519(p[2], gf1);
  38577. set25519(p[3], gf0);
  38578. for (i = 255; i >= 0; --i) {
  38579. b = (s[(i/8)|0] >> (i&7)) & 1;
  38580. cswap(p, q, b);
  38581. add(q, p);
  38582. add(p, p);
  38583. cswap(p, q, b);
  38584. }
  38585. }
  38586. function scalarbase(p, s) {
  38587. var q = [gf(), gf(), gf(), gf()];
  38588. set25519(q[0], X);
  38589. set25519(q[1], Y);
  38590. set25519(q[2], gf1);
  38591. M(q[3], X, Y);
  38592. scalarmult(p, q, s);
  38593. }
  38594. function crypto_sign_keypair(pk, sk, seeded) {
  38595. var d = new Uint8Array(64);
  38596. var p = [gf(), gf(), gf(), gf()];
  38597. var i;
  38598. if (!seeded) randombytes(sk, 32);
  38599. crypto_hash(d, sk, 32);
  38600. d[0] &= 248;
  38601. d[31] &= 127;
  38602. d[31] |= 64;
  38603. scalarbase(p, d);
  38604. pack(pk, p);
  38605. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38606. return 0;
  38607. }
  38608. 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]);
  38609. function modL(r, x) {
  38610. var carry, i, j, k;
  38611. for (i = 63; i >= 32; --i) {
  38612. carry = 0;
  38613. for (j = i - 32, k = i - 12; j < k; ++j) {
  38614. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38615. carry = (x[j] + 128) >> 8;
  38616. x[j] -= carry * 256;
  38617. }
  38618. x[j] += carry;
  38619. x[i] = 0;
  38620. }
  38621. carry = 0;
  38622. for (j = 0; j < 32; j++) {
  38623. x[j] += carry - (x[31] >> 4) * L[j];
  38624. carry = x[j] >> 8;
  38625. x[j] &= 255;
  38626. }
  38627. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38628. for (i = 0; i < 32; i++) {
  38629. x[i+1] += x[i] >> 8;
  38630. r[i] = x[i] & 255;
  38631. }
  38632. }
  38633. function reduce(r) {
  38634. var x = new Float64Array(64), i;
  38635. for (i = 0; i < 64; i++) x[i] = r[i];
  38636. for (i = 0; i < 64; i++) r[i] = 0;
  38637. modL(r, x);
  38638. }
  38639. // Note: difference from C - smlen returned, not passed as argument.
  38640. function crypto_sign(sm, m, n, sk) {
  38641. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38642. var i, j, x = new Float64Array(64);
  38643. var p = [gf(), gf(), gf(), gf()];
  38644. crypto_hash(d, sk, 32);
  38645. d[0] &= 248;
  38646. d[31] &= 127;
  38647. d[31] |= 64;
  38648. var smlen = n + 64;
  38649. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38650. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38651. crypto_hash(r, sm.subarray(32), n+32);
  38652. reduce(r);
  38653. scalarbase(p, r);
  38654. pack(sm, p);
  38655. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38656. crypto_hash(h, sm, n + 64);
  38657. reduce(h);
  38658. for (i = 0; i < 64; i++) x[i] = 0;
  38659. for (i = 0; i < 32; i++) x[i] = r[i];
  38660. for (i = 0; i < 32; i++) {
  38661. for (j = 0; j < 32; j++) {
  38662. x[i+j] += h[i] * d[j];
  38663. }
  38664. }
  38665. modL(sm.subarray(32), x);
  38666. return smlen;
  38667. }
  38668. function unpackneg(r, p) {
  38669. var t = gf(), chk = gf(), num = gf(),
  38670. den = gf(), den2 = gf(), den4 = gf(),
  38671. den6 = gf();
  38672. set25519(r[2], gf1);
  38673. unpack25519(r[1], p);
  38674. S(num, r[1]);
  38675. M(den, num, D);
  38676. Z(num, num, r[2]);
  38677. A(den, r[2], den);
  38678. S(den2, den);
  38679. S(den4, den2);
  38680. M(den6, den4, den2);
  38681. M(t, den6, num);
  38682. M(t, t, den);
  38683. pow2523(t, t);
  38684. M(t, t, num);
  38685. M(t, t, den);
  38686. M(t, t, den);
  38687. M(r[0], t, den);
  38688. S(chk, r[0]);
  38689. M(chk, chk, den);
  38690. if (neq25519(chk, num)) M(r[0], r[0], I);
  38691. S(chk, r[0]);
  38692. M(chk, chk, den);
  38693. if (neq25519(chk, num)) return -1;
  38694. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38695. M(r[3], r[0], r[1]);
  38696. return 0;
  38697. }
  38698. function crypto_sign_open(m, sm, n, pk) {
  38699. var i, mlen;
  38700. var t = new Uint8Array(32), h = new Uint8Array(64);
  38701. var p = [gf(), gf(), gf(), gf()],
  38702. q = [gf(), gf(), gf(), gf()];
  38703. mlen = -1;
  38704. if (n < 64) return -1;
  38705. if (unpackneg(q, pk)) return -1;
  38706. for (i = 0; i < n; i++) m[i] = sm[i];
  38707. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38708. crypto_hash(h, m, n);
  38709. reduce(h);
  38710. scalarmult(p, q, h);
  38711. scalarbase(q, sm.subarray(32));
  38712. add(p, q);
  38713. pack(t, p);
  38714. n -= 64;
  38715. if (crypto_verify_32(sm, 0, t, 0)) {
  38716. for (i = 0; i < n; i++) m[i] = 0;
  38717. return -1;
  38718. }
  38719. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38720. mlen = n;
  38721. return mlen;
  38722. }
  38723. var crypto_secretbox_KEYBYTES = 32,
  38724. crypto_secretbox_NONCEBYTES = 24,
  38725. crypto_secretbox_ZEROBYTES = 32,
  38726. crypto_secretbox_BOXZEROBYTES = 16,
  38727. crypto_scalarmult_BYTES = 32,
  38728. crypto_scalarmult_SCALARBYTES = 32,
  38729. crypto_box_PUBLICKEYBYTES = 32,
  38730. crypto_box_SECRETKEYBYTES = 32,
  38731. crypto_box_BEFORENMBYTES = 32,
  38732. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38733. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38734. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38735. crypto_sign_BYTES = 64,
  38736. crypto_sign_PUBLICKEYBYTES = 32,
  38737. crypto_sign_SECRETKEYBYTES = 64,
  38738. crypto_sign_SEEDBYTES = 32,
  38739. crypto_hash_BYTES = 64;
  38740. nacl.lowlevel = {
  38741. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38742. crypto_stream_xor: crypto_stream_xor,
  38743. crypto_stream: crypto_stream,
  38744. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38745. crypto_stream_salsa20: crypto_stream_salsa20,
  38746. crypto_onetimeauth: crypto_onetimeauth,
  38747. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38748. crypto_verify_16: crypto_verify_16,
  38749. crypto_verify_32: crypto_verify_32,
  38750. crypto_secretbox: crypto_secretbox,
  38751. crypto_secretbox_open: crypto_secretbox_open,
  38752. crypto_scalarmult: crypto_scalarmult,
  38753. crypto_scalarmult_base: crypto_scalarmult_base,
  38754. crypto_box_beforenm: crypto_box_beforenm,
  38755. crypto_box_afternm: crypto_box_afternm,
  38756. crypto_box: crypto_box,
  38757. crypto_box_open: crypto_box_open,
  38758. crypto_box_keypair: crypto_box_keypair,
  38759. crypto_hash: crypto_hash,
  38760. crypto_sign: crypto_sign,
  38761. crypto_sign_keypair: crypto_sign_keypair,
  38762. crypto_sign_open: crypto_sign_open,
  38763. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38764. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38765. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38766. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38767. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38768. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38769. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38770. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38771. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38772. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38773. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38774. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38775. crypto_sign_BYTES: crypto_sign_BYTES,
  38776. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38777. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38778. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38779. crypto_hash_BYTES: crypto_hash_BYTES
  38780. };
  38781. /* High-level API */
  38782. function checkLengths(k, n) {
  38783. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38784. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38785. }
  38786. function checkBoxLengths(pk, sk) {
  38787. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38788. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38789. }
  38790. function checkArrayTypes() {
  38791. for (var i = 0; i < arguments.length; i++) {
  38792. if (!(arguments[i] instanceof Uint8Array))
  38793. throw new TypeError('unexpected type, use Uint8Array');
  38794. }
  38795. }
  38796. function cleanup(arr) {
  38797. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38798. }
  38799. nacl.randomBytes = function(n) {
  38800. var b = new Uint8Array(n);
  38801. randombytes(b, n);
  38802. return b;
  38803. };
  38804. nacl.secretbox = function(msg, nonce, key) {
  38805. checkArrayTypes(msg, nonce, key);
  38806. checkLengths(key, nonce);
  38807. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38808. var c = new Uint8Array(m.length);
  38809. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38810. crypto_secretbox(c, m, m.length, nonce, key);
  38811. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38812. };
  38813. nacl.secretbox.open = function(box, nonce, key) {
  38814. checkArrayTypes(box, nonce, key);
  38815. checkLengths(key, nonce);
  38816. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38817. var m = new Uint8Array(c.length);
  38818. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38819. if (c.length < 32) return null;
  38820. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38821. return m.subarray(crypto_secretbox_ZEROBYTES);
  38822. };
  38823. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38824. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38825. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38826. nacl.scalarMult = function(n, p) {
  38827. checkArrayTypes(n, p);
  38828. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38829. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38830. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38831. crypto_scalarmult(q, n, p);
  38832. return q;
  38833. };
  38834. nacl.scalarMult.base = function(n) {
  38835. checkArrayTypes(n);
  38836. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38837. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38838. crypto_scalarmult_base(q, n);
  38839. return q;
  38840. };
  38841. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38842. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38843. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38844. var k = nacl.box.before(publicKey, secretKey);
  38845. return nacl.secretbox(msg, nonce, k);
  38846. };
  38847. nacl.box.before = function(publicKey, secretKey) {
  38848. checkArrayTypes(publicKey, secretKey);
  38849. checkBoxLengths(publicKey, secretKey);
  38850. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38851. crypto_box_beforenm(k, publicKey, secretKey);
  38852. return k;
  38853. };
  38854. nacl.box.after = nacl.secretbox;
  38855. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38856. var k = nacl.box.before(publicKey, secretKey);
  38857. return nacl.secretbox.open(msg, nonce, k);
  38858. };
  38859. nacl.box.open.after = nacl.secretbox.open;
  38860. nacl.box.keyPair = function() {
  38861. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38862. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38863. crypto_box_keypair(pk, sk);
  38864. return {publicKey: pk, secretKey: sk};
  38865. };
  38866. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38867. checkArrayTypes(secretKey);
  38868. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38869. throw new Error('bad secret key size');
  38870. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38871. crypto_scalarmult_base(pk, secretKey);
  38872. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38873. };
  38874. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38875. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38876. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38877. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38878. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38879. nacl.sign = function(msg, secretKey) {
  38880. checkArrayTypes(msg, secretKey);
  38881. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38882. throw new Error('bad secret key size');
  38883. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38884. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38885. return signedMsg;
  38886. };
  38887. nacl.sign.open = function(signedMsg, publicKey) {
  38888. checkArrayTypes(signedMsg, publicKey);
  38889. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38890. throw new Error('bad public key size');
  38891. var tmp = new Uint8Array(signedMsg.length);
  38892. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38893. if (mlen < 0) return null;
  38894. var m = new Uint8Array(mlen);
  38895. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38896. return m;
  38897. };
  38898. nacl.sign.detached = function(msg, secretKey) {
  38899. var signedMsg = nacl.sign(msg, secretKey);
  38900. var sig = new Uint8Array(crypto_sign_BYTES);
  38901. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38902. return sig;
  38903. };
  38904. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38905. checkArrayTypes(msg, sig, publicKey);
  38906. if (sig.length !== crypto_sign_BYTES)
  38907. throw new Error('bad signature size');
  38908. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38909. throw new Error('bad public key size');
  38910. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38911. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38912. var i;
  38913. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38914. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38915. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38916. };
  38917. nacl.sign.keyPair = function() {
  38918. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38919. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38920. crypto_sign_keypair(pk, sk);
  38921. return {publicKey: pk, secretKey: sk};
  38922. };
  38923. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38924. checkArrayTypes(secretKey);
  38925. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38926. throw new Error('bad secret key size');
  38927. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38928. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38929. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38930. };
  38931. nacl.sign.keyPair.fromSeed = function(seed) {
  38932. checkArrayTypes(seed);
  38933. if (seed.length !== crypto_sign_SEEDBYTES)
  38934. throw new Error('bad seed size');
  38935. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38936. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38937. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38938. crypto_sign_keypair(pk, sk, true);
  38939. return {publicKey: pk, secretKey: sk};
  38940. };
  38941. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38942. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38943. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38944. nacl.sign.signatureLength = crypto_sign_BYTES;
  38945. nacl.hash = function(msg) {
  38946. checkArrayTypes(msg);
  38947. var h = new Uint8Array(crypto_hash_BYTES);
  38948. crypto_hash(h, msg, msg.length);
  38949. return h;
  38950. };
  38951. nacl.hash.hashLength = crypto_hash_BYTES;
  38952. nacl.verify = function(x, y) {
  38953. checkArrayTypes(x, y);
  38954. // Zero length arguments are considered not equal.
  38955. if (x.length === 0 || y.length === 0) return false;
  38956. if (x.length !== y.length) return false;
  38957. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38958. };
  38959. nacl.setPRNG = function(fn) {
  38960. randombytes = fn;
  38961. };
  38962. (function() {
  38963. // Initialize PRNG if environment provides CSPRNG.
  38964. // If not, methods calling randombytes will throw.
  38965. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38966. if (crypto && crypto.getRandomValues) {
  38967. // Browsers.
  38968. var QUOTA = 65536;
  38969. nacl.setPRNG(function(x, n) {
  38970. var i, v = new Uint8Array(n);
  38971. for (i = 0; i < n; i += QUOTA) {
  38972. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  38973. }
  38974. for (i = 0; i < n; i++) x[i] = v[i];
  38975. cleanup(v);
  38976. });
  38977. } else if (true) {
  38978. // Node.js.
  38979. crypto = __webpack_require__(3);
  38980. if (crypto && crypto.randomBytes) {
  38981. nacl.setPRNG(function(x, n) {
  38982. var i, v = crypto.randomBytes(n);
  38983. for (i = 0; i < n; i++) x[i] = v[i];
  38984. cleanup(v);
  38985. });
  38986. }
  38987. }
  38988. })();
  38989. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  38990. /***/ }),
  38991. /* 1 */
  38992. /***/ (function(module, exports, __webpack_require__) {
  38993. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  38994. // Public domain.
  38995. (function(root, f) {
  38996. 'use strict';
  38997. if ( true && module.exports) module.exports = f();
  38998. else if (root.nacl) root.nacl.util = f();
  38999. else {
  39000. root.nacl = {};
  39001. root.nacl.util = f();
  39002. }
  39003. }(this, function() {
  39004. 'use strict';
  39005. var util = {};
  39006. function validateBase64(s) {
  39007. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39008. throw new TypeError('invalid encoding');
  39009. }
  39010. }
  39011. util.decodeUTF8 = function(s) {
  39012. if (typeof s !== 'string') throw new TypeError('expected string');
  39013. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39014. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39015. return b;
  39016. };
  39017. util.encodeUTF8 = function(arr) {
  39018. var i, s = [];
  39019. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39020. return decodeURIComponent(escape(s.join('')));
  39021. };
  39022. if (typeof atob === 'undefined') {
  39023. // Node.js
  39024. if (typeof Buffer.from !== 'undefined') {
  39025. // Node v6 and later
  39026. util.encodeBase64 = function (arr) { // v6 and later
  39027. return Buffer.from(arr).toString('base64');
  39028. };
  39029. util.decodeBase64 = function (s) {
  39030. validateBase64(s);
  39031. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39032. };
  39033. } else {
  39034. // Node earlier than v6
  39035. util.encodeBase64 = function (arr) { // v6 and later
  39036. return (new Buffer(arr)).toString('base64');
  39037. };
  39038. util.decodeBase64 = function(s) {
  39039. validateBase64(s);
  39040. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39041. };
  39042. }
  39043. } else {
  39044. // Browsers
  39045. util.encodeBase64 = function(arr) {
  39046. var i, s = [], len = arr.length;
  39047. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39048. return btoa(s.join(''));
  39049. };
  39050. util.decodeBase64 = function(s) {
  39051. validateBase64(s);
  39052. var i, d = atob(s), b = new Uint8Array(d.length);
  39053. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39054. return b;
  39055. };
  39056. }
  39057. return util;
  39058. }));
  39059. /***/ }),
  39060. /* 2 */
  39061. /***/ (function(module, exports, __webpack_require__) {
  39062. // required so we don't have to do require('pusher').default etc.
  39063. module.exports = __webpack_require__(4).default;
  39064. /***/ }),
  39065. /* 3 */
  39066. /***/ (function(module, exports) {
  39067. /* (ignored) */
  39068. /***/ }),
  39069. /* 4 */
  39070. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39071. "use strict";
  39072. __webpack_require__.r(__webpack_exports__);
  39073. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39074. var ScriptReceiverFactory = (function () {
  39075. function ScriptReceiverFactory(prefix, name) {
  39076. this.lastId = 0;
  39077. this.prefix = prefix;
  39078. this.name = name;
  39079. }
  39080. ScriptReceiverFactory.prototype.create = function (callback) {
  39081. this.lastId++;
  39082. var number = this.lastId;
  39083. var id = this.prefix + number;
  39084. var name = this.name + "[" + number + "]";
  39085. var called = false;
  39086. var callbackWrapper = function () {
  39087. if (!called) {
  39088. callback.apply(null, arguments);
  39089. called = true;
  39090. }
  39091. };
  39092. this[number] = callbackWrapper;
  39093. return { number: number, id: id, name: name, callback: callbackWrapper };
  39094. };
  39095. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39096. delete this[receiver.number];
  39097. };
  39098. return ScriptReceiverFactory;
  39099. }());
  39100. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39101. // CONCATENATED MODULE: ./src/core/defaults.ts
  39102. var Defaults = {
  39103. VERSION: "5.0.3",
  39104. PROTOCOL: 7,
  39105. host: 'ws.pusherapp.com',
  39106. ws_port: 80,
  39107. wss_port: 443,
  39108. ws_path: '',
  39109. sockjs_host: 'sockjs.pusher.com',
  39110. sockjs_http_port: 80,
  39111. sockjs_https_port: 443,
  39112. sockjs_path: '/pusher',
  39113. stats_host: 'stats.pusher.com',
  39114. channel_auth_endpoint: '/pusher/auth',
  39115. channel_auth_transport: 'ajax',
  39116. activity_timeout: 120000,
  39117. pong_timeout: 30000,
  39118. unavailable_timeout: 10000,
  39119. cdn_http: "http://js.pusher.com",
  39120. cdn_https: "https://js.pusher.com",
  39121. dependency_suffix: ""
  39122. };
  39123. /* harmony default export */ var defaults = (Defaults);
  39124. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39125. var dependency_loader_DependencyLoader = (function () {
  39126. function DependencyLoader(options) {
  39127. this.options = options;
  39128. this.receivers = options.receivers || ScriptReceivers;
  39129. this.loading = {};
  39130. }
  39131. DependencyLoader.prototype.load = function (name, options, callback) {
  39132. var self = this;
  39133. if (self.loading[name] && self.loading[name].length > 0) {
  39134. self.loading[name].push(callback);
  39135. }
  39136. else {
  39137. self.loading[name] = [callback];
  39138. var request = runtime.createScriptRequest(self.getPath(name, options));
  39139. var receiver = self.receivers.create(function (error) {
  39140. self.receivers.remove(receiver);
  39141. if (self.loading[name]) {
  39142. var callbacks = self.loading[name];
  39143. delete self.loading[name];
  39144. var successCallback = function (wasSuccessful) {
  39145. if (!wasSuccessful) {
  39146. request.cleanup();
  39147. }
  39148. };
  39149. for (var i = 0; i < callbacks.length; i++) {
  39150. callbacks[i](error, successCallback);
  39151. }
  39152. }
  39153. });
  39154. request.send(receiver);
  39155. }
  39156. };
  39157. DependencyLoader.prototype.getRoot = function (options) {
  39158. var cdn;
  39159. var protocol = runtime.getDocument().location.protocol;
  39160. if ((options && options.useTLS) || protocol === "https:") {
  39161. cdn = this.options.cdn_https;
  39162. }
  39163. else {
  39164. cdn = this.options.cdn_http;
  39165. }
  39166. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39167. };
  39168. DependencyLoader.prototype.getPath = function (name, options) {
  39169. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39170. };
  39171. ;
  39172. return DependencyLoader;
  39173. }());
  39174. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39175. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39176. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39177. var Dependencies = new dependency_loader({
  39178. cdn_http: defaults.cdn_http,
  39179. cdn_https: defaults.cdn_https,
  39180. version: defaults.VERSION,
  39181. suffix: defaults.dependency_suffix,
  39182. receivers: DependenciesReceivers
  39183. });
  39184. // CONCATENATED MODULE: ./src/core/base64.ts
  39185. function encode(s) {
  39186. return btoa(utob(s));
  39187. }
  39188. var fromCharCode = String.fromCharCode;
  39189. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39190. var b64tab = {};
  39191. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39192. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39193. }
  39194. var cb_utob = function (c) {
  39195. var cc = c.charCodeAt(0);
  39196. return cc < 0x80
  39197. ? c
  39198. : cc < 0x800
  39199. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39200. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39201. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39202. fromCharCode(0x80 | (cc & 0x3f));
  39203. };
  39204. var utob = function (u) {
  39205. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39206. };
  39207. var cb_encode = function (ccc) {
  39208. var padlen = [0, 2, 1][ccc.length % 3];
  39209. var ord = (ccc.charCodeAt(0) << 16) |
  39210. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39211. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39212. var chars = [
  39213. b64chars.charAt(ord >>> 18),
  39214. b64chars.charAt((ord >>> 12) & 63),
  39215. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39216. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39217. ];
  39218. return chars.join('');
  39219. };
  39220. var btoa = window.btoa ||
  39221. function (b) {
  39222. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39223. };
  39224. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39225. var Timer = (function () {
  39226. function Timer(set, clear, delay, callback) {
  39227. var _this = this;
  39228. this.clear = clear;
  39229. this.timer = set(function () {
  39230. if (_this.timer) {
  39231. _this.timer = callback(_this.timer);
  39232. }
  39233. }, delay);
  39234. }
  39235. Timer.prototype.isRunning = function () {
  39236. return this.timer !== null;
  39237. };
  39238. Timer.prototype.ensureAborted = function () {
  39239. if (this.timer) {
  39240. this.clear(this.timer);
  39241. this.timer = null;
  39242. }
  39243. };
  39244. return Timer;
  39245. }());
  39246. /* harmony default export */ var abstract_timer = (Timer);
  39247. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39248. var __extends = (undefined && undefined.__extends) || (function () {
  39249. var extendStatics = function (d, b) {
  39250. extendStatics = Object.setPrototypeOf ||
  39251. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39252. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39253. return extendStatics(d, b);
  39254. };
  39255. return function (d, b) {
  39256. extendStatics(d, b);
  39257. function __() { this.constructor = d; }
  39258. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39259. };
  39260. })();
  39261. function timers_clearTimeout(timer) {
  39262. window.clearTimeout(timer);
  39263. }
  39264. function timers_clearInterval(timer) {
  39265. window.clearInterval(timer);
  39266. }
  39267. var OneOffTimer = (function (_super) {
  39268. __extends(OneOffTimer, _super);
  39269. function OneOffTimer(delay, callback) {
  39270. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39271. callback();
  39272. return null;
  39273. }) || this;
  39274. }
  39275. return OneOffTimer;
  39276. }(abstract_timer));
  39277. var PeriodicTimer = (function (_super) {
  39278. __extends(PeriodicTimer, _super);
  39279. function PeriodicTimer(delay, callback) {
  39280. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39281. callback();
  39282. return timer;
  39283. }) || this;
  39284. }
  39285. return PeriodicTimer;
  39286. }(abstract_timer));
  39287. // CONCATENATED MODULE: ./src/core/util.ts
  39288. var Util = {
  39289. now: function () {
  39290. if (Date.now) {
  39291. return Date.now();
  39292. }
  39293. else {
  39294. return new Date().valueOf();
  39295. }
  39296. },
  39297. defer: function (callback) {
  39298. return new OneOffTimer(0, callback);
  39299. },
  39300. method: function (name) {
  39301. var args = [];
  39302. for (var _i = 1; _i < arguments.length; _i++) {
  39303. args[_i - 1] = arguments[_i];
  39304. }
  39305. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39306. return function (object) {
  39307. return object[name].apply(object, boundArguments.concat(arguments));
  39308. };
  39309. }
  39310. };
  39311. /* harmony default export */ var util = (Util);
  39312. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39313. function extend(target) {
  39314. var sources = [];
  39315. for (var _i = 1; _i < arguments.length; _i++) {
  39316. sources[_i - 1] = arguments[_i];
  39317. }
  39318. for (var i = 0; i < sources.length; i++) {
  39319. var extensions = sources[i];
  39320. for (var property in extensions) {
  39321. if (extensions[property] && extensions[property].constructor &&
  39322. extensions[property].constructor === Object) {
  39323. target[property] = extend(target[property] || {}, extensions[property]);
  39324. }
  39325. else {
  39326. target[property] = extensions[property];
  39327. }
  39328. }
  39329. }
  39330. return target;
  39331. }
  39332. function stringify() {
  39333. var m = ["Pusher"];
  39334. for (var i = 0; i < arguments.length; i++) {
  39335. if (typeof arguments[i] === "string") {
  39336. m.push(arguments[i]);
  39337. }
  39338. else {
  39339. m.push(safeJSONStringify(arguments[i]));
  39340. }
  39341. }
  39342. return m.join(" : ");
  39343. }
  39344. function arrayIndexOf(array, item) {
  39345. var nativeIndexOf = Array.prototype.indexOf;
  39346. if (array === null) {
  39347. return -1;
  39348. }
  39349. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39350. return array.indexOf(item);
  39351. }
  39352. for (var i = 0, l = array.length; i < l; i++) {
  39353. if (array[i] === item) {
  39354. return i;
  39355. }
  39356. }
  39357. return -1;
  39358. }
  39359. function objectApply(object, f) {
  39360. for (var key in object) {
  39361. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39362. f(object[key], key, object);
  39363. }
  39364. }
  39365. }
  39366. function keys(object) {
  39367. var keys = [];
  39368. objectApply(object, function (_, key) {
  39369. keys.push(key);
  39370. });
  39371. return keys;
  39372. }
  39373. function values(object) {
  39374. var values = [];
  39375. objectApply(object, function (value) {
  39376. values.push(value);
  39377. });
  39378. return values;
  39379. }
  39380. function apply(array, f, context) {
  39381. for (var i = 0; i < array.length; i++) {
  39382. f.call(context || window, array[i], i, array);
  39383. }
  39384. }
  39385. function map(array, f) {
  39386. var result = [];
  39387. for (var i = 0; i < array.length; i++) {
  39388. result.push(f(array[i], i, array, result));
  39389. }
  39390. return result;
  39391. }
  39392. function mapObject(object, f) {
  39393. var result = {};
  39394. objectApply(object, function (value, key) {
  39395. result[key] = f(value);
  39396. });
  39397. return result;
  39398. }
  39399. function filter(array, test) {
  39400. test = test || function (value) { return !!value; };
  39401. var result = [];
  39402. for (var i = 0; i < array.length; i++) {
  39403. if (test(array[i], i, array, result)) {
  39404. result.push(array[i]);
  39405. }
  39406. }
  39407. return result;
  39408. }
  39409. function filterObject(object, test) {
  39410. var result = {};
  39411. objectApply(object, function (value, key) {
  39412. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39413. result[key] = value;
  39414. }
  39415. });
  39416. return result;
  39417. }
  39418. function flatten(object) {
  39419. var result = [];
  39420. objectApply(object, function (value, key) {
  39421. result.push([key, value]);
  39422. });
  39423. return result;
  39424. }
  39425. function any(array, test) {
  39426. for (var i = 0; i < array.length; i++) {
  39427. if (test(array[i], i, array)) {
  39428. return true;
  39429. }
  39430. }
  39431. return false;
  39432. }
  39433. function collections_all(array, test) {
  39434. for (var i = 0; i < array.length; i++) {
  39435. if (!test(array[i], i, array)) {
  39436. return false;
  39437. }
  39438. }
  39439. return true;
  39440. }
  39441. function encodeParamsObject(data) {
  39442. return mapObject(data, function (value) {
  39443. if (typeof value === "object") {
  39444. value = safeJSONStringify(value);
  39445. }
  39446. return encodeURIComponent(encode(value.toString()));
  39447. });
  39448. }
  39449. function buildQueryString(data) {
  39450. var params = filterObject(data, function (value) {
  39451. return value !== undefined;
  39452. });
  39453. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39454. return query;
  39455. }
  39456. function decycleObject(object) {
  39457. var objects = [], paths = [];
  39458. return (function derez(value, path) {
  39459. var i, name, nu;
  39460. switch (typeof value) {
  39461. case 'object':
  39462. if (!value) {
  39463. return null;
  39464. }
  39465. for (i = 0; i < objects.length; i += 1) {
  39466. if (objects[i] === value) {
  39467. return { $ref: paths[i] };
  39468. }
  39469. }
  39470. objects.push(value);
  39471. paths.push(path);
  39472. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39473. nu = [];
  39474. for (i = 0; i < value.length; i += 1) {
  39475. nu[i] = derez(value[i], path + '[' + i + ']');
  39476. }
  39477. }
  39478. else {
  39479. nu = {};
  39480. for (name in value) {
  39481. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39482. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39483. }
  39484. }
  39485. }
  39486. return nu;
  39487. case 'number':
  39488. case 'string':
  39489. case 'boolean':
  39490. return value;
  39491. }
  39492. }(object, '$'));
  39493. }
  39494. function safeJSONStringify(source) {
  39495. try {
  39496. return JSON.stringify(source);
  39497. }
  39498. catch (e) {
  39499. return JSON.stringify(decycleObject(source));
  39500. }
  39501. }
  39502. // CONCATENATED MODULE: ./src/core/logger.ts
  39503. var logger_Logger = (function () {
  39504. function Logger() {
  39505. this.globalLog = function (message) {
  39506. if (window.console && window.console.log) {
  39507. window.console.log(message);
  39508. }
  39509. };
  39510. }
  39511. Logger.prototype.debug = function () {
  39512. var args = [];
  39513. for (var _i = 0; _i < arguments.length; _i++) {
  39514. args[_i] = arguments[_i];
  39515. }
  39516. this.log(this.globalLog, args);
  39517. };
  39518. Logger.prototype.warn = function () {
  39519. var args = [];
  39520. for (var _i = 0; _i < arguments.length; _i++) {
  39521. args[_i] = arguments[_i];
  39522. }
  39523. this.log(this.globalLogWarn, args);
  39524. };
  39525. Logger.prototype.error = function () {
  39526. var args = [];
  39527. for (var _i = 0; _i < arguments.length; _i++) {
  39528. args[_i] = arguments[_i];
  39529. }
  39530. this.log(this.globalLogError, args);
  39531. };
  39532. Logger.prototype.globalLogWarn = function (message) {
  39533. if (window.console && window.console.warn) {
  39534. window.console.warn(message);
  39535. }
  39536. else {
  39537. this.globalLog(message);
  39538. }
  39539. };
  39540. Logger.prototype.globalLogError = function (message) {
  39541. if (window.console && window.console.error) {
  39542. window.console.error(message);
  39543. }
  39544. else {
  39545. this.globalLogWarn(message);
  39546. }
  39547. };
  39548. Logger.prototype.log = function (defaultLoggingFunction) {
  39549. var args = [];
  39550. for (var _i = 1; _i < arguments.length; _i++) {
  39551. args[_i - 1] = arguments[_i];
  39552. }
  39553. var message = stringify.apply(this, arguments);
  39554. if (core_pusher.log) {
  39555. core_pusher.log(message);
  39556. }
  39557. else if (core_pusher.logToConsole) {
  39558. var log = defaultLoggingFunction.bind(this);
  39559. log(message);
  39560. }
  39561. };
  39562. return Logger;
  39563. }());
  39564. /* harmony default export */ var logger = (new logger_Logger());
  39565. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39566. var urlStore = {
  39567. baseUrl: "https://pusher.com",
  39568. urls: {
  39569. authenticationEndpoint: {
  39570. path: "/docs/authenticating_users",
  39571. },
  39572. javascriptQuickStart: {
  39573. path: "/docs/javascript_quick_start"
  39574. },
  39575. triggeringClientEvents: {
  39576. path: "/docs/client_api_guide/client_events#trigger-events"
  39577. }
  39578. }
  39579. };
  39580. var buildLogSuffix = function (key) {
  39581. var urlPrefix = "See:";
  39582. var urlObj = urlStore.urls[key];
  39583. if (!urlObj)
  39584. return "";
  39585. var url;
  39586. if (urlObj.fullUrl) {
  39587. url = urlObj.fullUrl;
  39588. }
  39589. else if (urlObj.path) {
  39590. url = urlStore.baseUrl + urlObj.path;
  39591. }
  39592. if (!url)
  39593. return "";
  39594. return urlPrefix + " " + url;
  39595. };
  39596. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39597. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39598. var ajax = function (context, socketId, callback) {
  39599. var self = this, xhr;
  39600. xhr = runtime.createXHR();
  39601. xhr.open("POST", self.options.authEndpoint, true);
  39602. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39603. for (var headerName in this.authOptions.headers) {
  39604. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39605. }
  39606. xhr.onreadystatechange = function () {
  39607. if (xhr.readyState === 4) {
  39608. if (xhr.status === 200) {
  39609. var data, parsed = false;
  39610. try {
  39611. data = JSON.parse(xhr.responseText);
  39612. parsed = true;
  39613. }
  39614. catch (e) {
  39615. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39616. }
  39617. if (parsed) {
  39618. callback(false, data);
  39619. }
  39620. }
  39621. else {
  39622. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39623. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39624. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39625. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39626. callback(true, xhr.status);
  39627. }
  39628. }
  39629. };
  39630. xhr.send(this.composeQuery(socketId));
  39631. return xhr;
  39632. };
  39633. /* harmony default export */ var xhr_auth = (ajax);
  39634. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39635. var jsonp = function (context, socketId, callback) {
  39636. if (this.authOptions.headers !== undefined) {
  39637. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39638. }
  39639. var callbackName = context.nextAuthCallbackID.toString();
  39640. context.nextAuthCallbackID++;
  39641. var document = context.getDocument();
  39642. var script = document.createElement("script");
  39643. context.auth_callbacks[callbackName] = function (data) {
  39644. callback(false, data);
  39645. };
  39646. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39647. script.src = this.options.authEndpoint +
  39648. '?callback=' +
  39649. encodeURIComponent(callback_name) +
  39650. '&' +
  39651. this.composeQuery(socketId);
  39652. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39653. head.insertBefore(script, head.firstChild);
  39654. };
  39655. /* harmony default export */ var jsonp_auth = (jsonp);
  39656. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39657. var ScriptRequest = (function () {
  39658. function ScriptRequest(src) {
  39659. this.src = src;
  39660. }
  39661. ScriptRequest.prototype.send = function (receiver) {
  39662. var self = this;
  39663. var errorString = "Error loading " + self.src;
  39664. self.script = document.createElement("script");
  39665. self.script.id = receiver.id;
  39666. self.script.src = self.src;
  39667. self.script.type = "text/javascript";
  39668. self.script.charset = "UTF-8";
  39669. if (self.script.addEventListener) {
  39670. self.script.onerror = function () {
  39671. receiver.callback(errorString);
  39672. };
  39673. self.script.onload = function () {
  39674. receiver.callback(null);
  39675. };
  39676. }
  39677. else {
  39678. self.script.onreadystatechange = function () {
  39679. if (self.script.readyState === 'loaded' ||
  39680. self.script.readyState === 'complete') {
  39681. receiver.callback(null);
  39682. }
  39683. };
  39684. }
  39685. if (self.script.async === undefined && document.attachEvent &&
  39686. /opera/i.test(navigator.userAgent)) {
  39687. self.errorScript = document.createElement("script");
  39688. self.errorScript.id = receiver.id + "_error";
  39689. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39690. self.script.async = self.errorScript.async = false;
  39691. }
  39692. else {
  39693. self.script.async = true;
  39694. }
  39695. var head = document.getElementsByTagName('head')[0];
  39696. head.insertBefore(self.script, head.firstChild);
  39697. if (self.errorScript) {
  39698. head.insertBefore(self.errorScript, self.script.nextSibling);
  39699. }
  39700. };
  39701. ScriptRequest.prototype.cleanup = function () {
  39702. if (this.script) {
  39703. this.script.onload = this.script.onerror = null;
  39704. this.script.onreadystatechange = null;
  39705. }
  39706. if (this.script && this.script.parentNode) {
  39707. this.script.parentNode.removeChild(this.script);
  39708. }
  39709. if (this.errorScript && this.errorScript.parentNode) {
  39710. this.errorScript.parentNode.removeChild(this.errorScript);
  39711. }
  39712. this.script = null;
  39713. this.errorScript = null;
  39714. };
  39715. return ScriptRequest;
  39716. }());
  39717. /* harmony default export */ var script_request = (ScriptRequest);
  39718. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39719. var jsonp_request_JSONPRequest = (function () {
  39720. function JSONPRequest(url, data) {
  39721. this.url = url;
  39722. this.data = data;
  39723. }
  39724. JSONPRequest.prototype.send = function (receiver) {
  39725. if (this.request) {
  39726. return;
  39727. }
  39728. var query = buildQueryString(this.data);
  39729. var url = this.url + "/" + receiver.number + "?" + query;
  39730. this.request = runtime.createScriptRequest(url);
  39731. this.request.send(receiver);
  39732. };
  39733. JSONPRequest.prototype.cleanup = function () {
  39734. if (this.request) {
  39735. this.request.cleanup();
  39736. }
  39737. };
  39738. return JSONPRequest;
  39739. }());
  39740. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39741. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39742. var getAgent = function (sender, useTLS) {
  39743. return function (data, callback) {
  39744. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39745. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39746. var request = runtime.createJSONPRequest(url, data);
  39747. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39748. ScriptReceivers.remove(receiver);
  39749. request.cleanup();
  39750. if (result && result.host) {
  39751. sender.host = result.host;
  39752. }
  39753. if (callback) {
  39754. callback(error, result);
  39755. }
  39756. });
  39757. request.send(receiver);
  39758. };
  39759. };
  39760. var jsonp_timeline_jsonp = {
  39761. name: 'jsonp',
  39762. getAgent: getAgent
  39763. };
  39764. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39765. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39766. function getGenericURL(baseScheme, params, path) {
  39767. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39768. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39769. return scheme + "://" + host + path;
  39770. }
  39771. function getGenericPath(key, queryString) {
  39772. var path = "/app/" + key;
  39773. var query = "?protocol=" + defaults.PROTOCOL +
  39774. "&client=js" +
  39775. "&version=" + defaults.VERSION +
  39776. (queryString ? ("&" + queryString) : "");
  39777. return path + query;
  39778. }
  39779. var ws = {
  39780. getInitial: function (key, params) {
  39781. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39782. return getGenericURL("ws", params, path);
  39783. }
  39784. };
  39785. var http = {
  39786. getInitial: function (key, params) {
  39787. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39788. return getGenericURL("http", params, path);
  39789. }
  39790. };
  39791. var sockjs = {
  39792. getInitial: function (key, params) {
  39793. return getGenericURL("http", params, params.httpPath || "/pusher");
  39794. },
  39795. getPath: function (key, params) {
  39796. return getGenericPath(key);
  39797. }
  39798. };
  39799. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39800. var callback_registry_CallbackRegistry = (function () {
  39801. function CallbackRegistry() {
  39802. this._callbacks = {};
  39803. }
  39804. CallbackRegistry.prototype.get = function (name) {
  39805. return this._callbacks[prefix(name)];
  39806. };
  39807. CallbackRegistry.prototype.add = function (name, callback, context) {
  39808. var prefixedEventName = prefix(name);
  39809. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39810. this._callbacks[prefixedEventName].push({
  39811. fn: callback,
  39812. context: context
  39813. });
  39814. };
  39815. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39816. if (!name && !callback && !context) {
  39817. this._callbacks = {};
  39818. return;
  39819. }
  39820. var names = name ? [prefix(name)] : keys(this._callbacks);
  39821. if (callback || context) {
  39822. this.removeCallback(names, callback, context);
  39823. }
  39824. else {
  39825. this.removeAllCallbacks(names);
  39826. }
  39827. };
  39828. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39829. apply(names, function (name) {
  39830. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39831. return (callback && callback !== binding.fn) ||
  39832. (context && context !== binding.context);
  39833. });
  39834. if (this._callbacks[name].length === 0) {
  39835. delete this._callbacks[name];
  39836. }
  39837. }, this);
  39838. };
  39839. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39840. apply(names, function (name) {
  39841. delete this._callbacks[name];
  39842. }, this);
  39843. };
  39844. return CallbackRegistry;
  39845. }());
  39846. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39847. function prefix(name) {
  39848. return "_" + name;
  39849. }
  39850. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39851. var dispatcher_Dispatcher = (function () {
  39852. function Dispatcher(failThrough) {
  39853. this.callbacks = new callback_registry();
  39854. this.global_callbacks = [];
  39855. this.failThrough = failThrough;
  39856. }
  39857. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39858. this.callbacks.add(eventName, callback, context);
  39859. return this;
  39860. };
  39861. Dispatcher.prototype.bind_global = function (callback) {
  39862. this.global_callbacks.push(callback);
  39863. return this;
  39864. };
  39865. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39866. this.callbacks.remove(eventName, callback, context);
  39867. return this;
  39868. };
  39869. Dispatcher.prototype.unbind_global = function (callback) {
  39870. if (!callback) {
  39871. this.global_callbacks = [];
  39872. return this;
  39873. }
  39874. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39875. return this;
  39876. };
  39877. Dispatcher.prototype.unbind_all = function () {
  39878. this.unbind();
  39879. this.unbind_global();
  39880. return this;
  39881. };
  39882. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39883. for (var i = 0; i < this.global_callbacks.length; i++) {
  39884. this.global_callbacks[i](eventName, data);
  39885. }
  39886. var callbacks = this.callbacks.get(eventName);
  39887. var args = [];
  39888. if (metadata) {
  39889. args.push(data, metadata);
  39890. }
  39891. else if (data) {
  39892. args.push(data);
  39893. }
  39894. if (callbacks && callbacks.length > 0) {
  39895. for (var i = 0; i < callbacks.length; i++) {
  39896. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39897. }
  39898. }
  39899. else if (this.failThrough) {
  39900. this.failThrough(eventName, data);
  39901. }
  39902. return this;
  39903. };
  39904. return Dispatcher;
  39905. }());
  39906. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39907. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39908. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39909. var extendStatics = function (d, b) {
  39910. extendStatics = Object.setPrototypeOf ||
  39911. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39912. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39913. return extendStatics(d, b);
  39914. };
  39915. return function (d, b) {
  39916. extendStatics(d, b);
  39917. function __() { this.constructor = d; }
  39918. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39919. };
  39920. })();
  39921. var transport_connection_TransportConnection = (function (_super) {
  39922. transport_connection_extends(TransportConnection, _super);
  39923. function TransportConnection(hooks, name, priority, key, options) {
  39924. var _this = _super.call(this) || this;
  39925. _this.initialize = runtime.transportConnectionInitializer;
  39926. _this.hooks = hooks;
  39927. _this.name = name;
  39928. _this.priority = priority;
  39929. _this.key = key;
  39930. _this.options = options;
  39931. _this.state = "new";
  39932. _this.timeline = options.timeline;
  39933. _this.activityTimeout = options.activityTimeout;
  39934. _this.id = _this.timeline.generateUniqueID();
  39935. return _this;
  39936. }
  39937. TransportConnection.prototype.handlesActivityChecks = function () {
  39938. return Boolean(this.hooks.handlesActivityChecks);
  39939. };
  39940. TransportConnection.prototype.supportsPing = function () {
  39941. return Boolean(this.hooks.supportsPing);
  39942. };
  39943. TransportConnection.prototype.connect = function () {
  39944. var _this = this;
  39945. if (this.socket || this.state !== "initialized") {
  39946. return false;
  39947. }
  39948. var url = this.hooks.urls.getInitial(this.key, this.options);
  39949. try {
  39950. this.socket = this.hooks.getSocket(url, this.options);
  39951. }
  39952. catch (e) {
  39953. util.defer(function () {
  39954. _this.onError(e);
  39955. _this.changeState("closed");
  39956. });
  39957. return false;
  39958. }
  39959. this.bindListeners();
  39960. logger.debug("Connecting", { transport: this.name, url: url });
  39961. this.changeState("connecting");
  39962. return true;
  39963. };
  39964. TransportConnection.prototype.close = function () {
  39965. if (this.socket) {
  39966. this.socket.close();
  39967. return true;
  39968. }
  39969. else {
  39970. return false;
  39971. }
  39972. };
  39973. TransportConnection.prototype.send = function (data) {
  39974. var _this = this;
  39975. if (this.state === "open") {
  39976. util.defer(function () {
  39977. if (_this.socket) {
  39978. _this.socket.send(data);
  39979. }
  39980. });
  39981. return true;
  39982. }
  39983. else {
  39984. return false;
  39985. }
  39986. };
  39987. TransportConnection.prototype.ping = function () {
  39988. if (this.state === "open" && this.supportsPing()) {
  39989. this.socket.ping();
  39990. }
  39991. };
  39992. TransportConnection.prototype.onOpen = function () {
  39993. if (this.hooks.beforeOpen) {
  39994. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  39995. }
  39996. this.changeState("open");
  39997. this.socket.onopen = undefined;
  39998. };
  39999. TransportConnection.prototype.onError = function (error) {
  40000. this.emit("error", { type: 'WebSocketError', error: error });
  40001. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40002. };
  40003. TransportConnection.prototype.onClose = function (closeEvent) {
  40004. if (closeEvent) {
  40005. this.changeState("closed", {
  40006. code: closeEvent.code,
  40007. reason: closeEvent.reason,
  40008. wasClean: closeEvent.wasClean
  40009. });
  40010. }
  40011. else {
  40012. this.changeState("closed");
  40013. }
  40014. this.unbindListeners();
  40015. this.socket = undefined;
  40016. };
  40017. TransportConnection.prototype.onMessage = function (message) {
  40018. this.emit("message", message);
  40019. };
  40020. TransportConnection.prototype.onActivity = function () {
  40021. this.emit("activity");
  40022. };
  40023. TransportConnection.prototype.bindListeners = function () {
  40024. var _this = this;
  40025. this.socket.onopen = function () {
  40026. _this.onOpen();
  40027. };
  40028. this.socket.onerror = function (error) {
  40029. _this.onError(error);
  40030. };
  40031. this.socket.onclose = function (closeEvent) {
  40032. _this.onClose(closeEvent);
  40033. };
  40034. this.socket.onmessage = function (message) {
  40035. _this.onMessage(message);
  40036. };
  40037. if (this.supportsPing()) {
  40038. this.socket.onactivity = function () { _this.onActivity(); };
  40039. }
  40040. };
  40041. TransportConnection.prototype.unbindListeners = function () {
  40042. if (this.socket) {
  40043. this.socket.onopen = undefined;
  40044. this.socket.onerror = undefined;
  40045. this.socket.onclose = undefined;
  40046. this.socket.onmessage = undefined;
  40047. if (this.supportsPing()) {
  40048. this.socket.onactivity = undefined;
  40049. }
  40050. }
  40051. };
  40052. TransportConnection.prototype.changeState = function (state, params) {
  40053. this.state = state;
  40054. this.timeline.info(this.buildTimelineMessage({
  40055. state: state,
  40056. params: params
  40057. }));
  40058. this.emit(state, params);
  40059. };
  40060. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40061. return extend({ cid: this.id }, message);
  40062. };
  40063. return TransportConnection;
  40064. }(dispatcher));
  40065. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40066. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40067. var transport_Transport = (function () {
  40068. function Transport(hooks) {
  40069. this.hooks = hooks;
  40070. }
  40071. Transport.prototype.isSupported = function (environment) {
  40072. return this.hooks.isSupported(environment);
  40073. };
  40074. Transport.prototype.createConnection = function (name, priority, key, options) {
  40075. return new transport_connection(this.hooks, name, priority, key, options);
  40076. };
  40077. return Transport;
  40078. }());
  40079. /* harmony default export */ var transports_transport = (transport_Transport);
  40080. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40081. var WSTransport = new transports_transport({
  40082. urls: ws,
  40083. handlesActivityChecks: false,
  40084. supportsPing: false,
  40085. isInitialized: function () {
  40086. return Boolean(runtime.getWebSocketAPI());
  40087. },
  40088. isSupported: function () {
  40089. return Boolean(runtime.getWebSocketAPI());
  40090. },
  40091. getSocket: function (url) {
  40092. return runtime.createWebSocket(url);
  40093. }
  40094. });
  40095. var httpConfiguration = {
  40096. urls: http,
  40097. handlesActivityChecks: false,
  40098. supportsPing: true,
  40099. isInitialized: function () {
  40100. return true;
  40101. }
  40102. };
  40103. var streamingConfiguration = extend({ getSocket: function (url) {
  40104. return runtime.HTTPFactory.createStreamingSocket(url);
  40105. }
  40106. }, httpConfiguration);
  40107. var pollingConfiguration = extend({ getSocket: function (url) {
  40108. return runtime.HTTPFactory.createPollingSocket(url);
  40109. }
  40110. }, httpConfiguration);
  40111. var xhrConfiguration = {
  40112. isSupported: function () {
  40113. return runtime.isXHRSupported();
  40114. }
  40115. };
  40116. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40117. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40118. var Transports = {
  40119. ws: WSTransport,
  40120. xhr_streaming: XHRStreamingTransport,
  40121. xhr_polling: XHRPollingTransport
  40122. };
  40123. /* harmony default export */ var transports = (Transports);
  40124. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40125. var SockJSTransport = new transports_transport({
  40126. file: "sockjs",
  40127. urls: sockjs,
  40128. handlesActivityChecks: true,
  40129. supportsPing: false,
  40130. isSupported: function () {
  40131. return true;
  40132. },
  40133. isInitialized: function () {
  40134. return window.SockJS !== undefined;
  40135. },
  40136. getSocket: function (url, options) {
  40137. return new window.SockJS(url, null, {
  40138. js_path: Dependencies.getPath("sockjs", {
  40139. useTLS: options.useTLS
  40140. }),
  40141. ignore_null_origin: options.ignoreNullOrigin
  40142. });
  40143. },
  40144. beforeOpen: function (socket, path) {
  40145. socket.send(JSON.stringify({
  40146. path: path
  40147. }));
  40148. }
  40149. });
  40150. var xdrConfiguration = {
  40151. isSupported: function (environment) {
  40152. var yes = runtime.isXDRSupported(environment.useTLS);
  40153. return yes;
  40154. }
  40155. };
  40156. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40157. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40158. transports.xdr_streaming = XDRStreamingTransport;
  40159. transports.xdr_polling = XDRPollingTransport;
  40160. transports.sockjs = SockJSTransport;
  40161. /* harmony default export */ var transports_transports = (transports);
  40162. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40163. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40164. var extendStatics = function (d, b) {
  40165. extendStatics = Object.setPrototypeOf ||
  40166. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40167. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40168. return extendStatics(d, b);
  40169. };
  40170. return function (d, b) {
  40171. extendStatics(d, b);
  40172. function __() { this.constructor = d; }
  40173. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40174. };
  40175. })();
  40176. var NetInfo = (function (_super) {
  40177. net_info_extends(NetInfo, _super);
  40178. function NetInfo() {
  40179. var _this = _super.call(this) || this;
  40180. var self = _this;
  40181. if (window.addEventListener !== undefined) {
  40182. window.addEventListener("online", function () {
  40183. self.emit('online');
  40184. }, false);
  40185. window.addEventListener("offline", function () {
  40186. self.emit('offline');
  40187. }, false);
  40188. }
  40189. return _this;
  40190. }
  40191. NetInfo.prototype.isOnline = function () {
  40192. if (window.navigator.onLine === undefined) {
  40193. return true;
  40194. }
  40195. else {
  40196. return window.navigator.onLine;
  40197. }
  40198. };
  40199. return NetInfo;
  40200. }(dispatcher));
  40201. var net_info_Network = new NetInfo();
  40202. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40203. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40204. function AssistantToTheTransportManager(manager, transport, options) {
  40205. this.manager = manager;
  40206. this.transport = transport;
  40207. this.minPingDelay = options.minPingDelay;
  40208. this.maxPingDelay = options.maxPingDelay;
  40209. this.pingDelay = undefined;
  40210. }
  40211. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40212. var _this = this;
  40213. options = extend({}, options, {
  40214. activityTimeout: this.pingDelay
  40215. });
  40216. var connection = this.transport.createConnection(name, priority, key, options);
  40217. var openTimestamp = null;
  40218. var onOpen = function () {
  40219. connection.unbind("open", onOpen);
  40220. connection.bind("closed", onClosed);
  40221. openTimestamp = util.now();
  40222. };
  40223. var onClosed = function (closeEvent) {
  40224. connection.unbind("closed", onClosed);
  40225. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40226. _this.manager.reportDeath();
  40227. }
  40228. else if (!closeEvent.wasClean && openTimestamp) {
  40229. var lifespan = util.now() - openTimestamp;
  40230. if (lifespan < 2 * _this.maxPingDelay) {
  40231. _this.manager.reportDeath();
  40232. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40233. }
  40234. }
  40235. };
  40236. connection.bind("open", onOpen);
  40237. return connection;
  40238. };
  40239. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40240. return this.manager.isAlive() && this.transport.isSupported(environment);
  40241. };
  40242. return AssistantToTheTransportManager;
  40243. }());
  40244. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40245. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40246. var Protocol = {
  40247. decodeMessage: function (messageEvent) {
  40248. try {
  40249. var messageData = JSON.parse(messageEvent.data);
  40250. var pusherEventData = messageData.data;
  40251. if (typeof pusherEventData === 'string') {
  40252. try {
  40253. pusherEventData = JSON.parse(messageData.data);
  40254. }
  40255. catch (e) { }
  40256. }
  40257. var pusherEvent = {
  40258. event: messageData.event,
  40259. channel: messageData.channel,
  40260. data: pusherEventData,
  40261. };
  40262. if (messageData.user_id) {
  40263. pusherEvent.user_id = messageData.user_id;
  40264. }
  40265. return pusherEvent;
  40266. }
  40267. catch (e) {
  40268. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40269. }
  40270. },
  40271. encodeMessage: function (event) {
  40272. return JSON.stringify(event);
  40273. },
  40274. processHandshake: function (messageEvent) {
  40275. var message = Protocol.decodeMessage(messageEvent);
  40276. if (message.event === "pusher:connection_established") {
  40277. if (!message.data.activity_timeout) {
  40278. throw "No activity timeout specified in handshake";
  40279. }
  40280. return {
  40281. action: "connected",
  40282. id: message.data.socket_id,
  40283. activityTimeout: message.data.activity_timeout * 1000
  40284. };
  40285. }
  40286. else if (message.event === "pusher:error") {
  40287. return {
  40288. action: this.getCloseAction(message.data),
  40289. error: this.getCloseError(message.data)
  40290. };
  40291. }
  40292. else {
  40293. throw "Invalid handshake";
  40294. }
  40295. },
  40296. getCloseAction: function (closeEvent) {
  40297. if (closeEvent.code < 4000) {
  40298. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40299. return "backoff";
  40300. }
  40301. else {
  40302. return null;
  40303. }
  40304. }
  40305. else if (closeEvent.code === 4000) {
  40306. return "tls_only";
  40307. }
  40308. else if (closeEvent.code < 4100) {
  40309. return "refused";
  40310. }
  40311. else if (closeEvent.code < 4200) {
  40312. return "backoff";
  40313. }
  40314. else if (closeEvent.code < 4300) {
  40315. return "retry";
  40316. }
  40317. else {
  40318. return "refused";
  40319. }
  40320. },
  40321. getCloseError: function (closeEvent) {
  40322. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40323. return {
  40324. type: 'PusherError',
  40325. data: {
  40326. code: closeEvent.code,
  40327. message: closeEvent.reason || closeEvent.message
  40328. }
  40329. };
  40330. }
  40331. else {
  40332. return null;
  40333. }
  40334. }
  40335. };
  40336. /* harmony default export */ var protocol_protocol = (Protocol);
  40337. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40338. var connection_extends = (undefined && undefined.__extends) || (function () {
  40339. var extendStatics = function (d, b) {
  40340. extendStatics = Object.setPrototypeOf ||
  40341. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40342. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40343. return extendStatics(d, b);
  40344. };
  40345. return function (d, b) {
  40346. extendStatics(d, b);
  40347. function __() { this.constructor = d; }
  40348. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40349. };
  40350. })();
  40351. var connection_Connection = (function (_super) {
  40352. connection_extends(Connection, _super);
  40353. function Connection(id, transport) {
  40354. var _this = _super.call(this) || this;
  40355. _this.id = id;
  40356. _this.transport = transport;
  40357. _this.activityTimeout = transport.activityTimeout;
  40358. _this.bindListeners();
  40359. return _this;
  40360. }
  40361. Connection.prototype.handlesActivityChecks = function () {
  40362. return this.transport.handlesActivityChecks();
  40363. };
  40364. Connection.prototype.send = function (data) {
  40365. return this.transport.send(data);
  40366. };
  40367. Connection.prototype.send_event = function (name, data, channel) {
  40368. var event = { event: name, data: data };
  40369. if (channel) {
  40370. event.channel = channel;
  40371. }
  40372. logger.debug('Event sent', event);
  40373. return this.send(protocol_protocol.encodeMessage(event));
  40374. };
  40375. Connection.prototype.ping = function () {
  40376. if (this.transport.supportsPing()) {
  40377. this.transport.ping();
  40378. }
  40379. else {
  40380. this.send_event('pusher:ping', {});
  40381. }
  40382. };
  40383. Connection.prototype.close = function () {
  40384. this.transport.close();
  40385. };
  40386. Connection.prototype.bindListeners = function () {
  40387. var _this = this;
  40388. var listeners = {
  40389. message: function (messageEvent) {
  40390. var pusherEvent;
  40391. try {
  40392. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40393. }
  40394. catch (e) {
  40395. _this.emit('error', {
  40396. type: 'MessageParseError',
  40397. error: e,
  40398. data: messageEvent.data
  40399. });
  40400. }
  40401. if (pusherEvent !== undefined) {
  40402. logger.debug('Event recd', pusherEvent);
  40403. switch (pusherEvent.event) {
  40404. case 'pusher:error':
  40405. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40406. break;
  40407. case 'pusher:ping':
  40408. _this.emit("ping");
  40409. break;
  40410. case 'pusher:pong':
  40411. _this.emit("pong");
  40412. break;
  40413. }
  40414. _this.emit('message', pusherEvent);
  40415. }
  40416. },
  40417. activity: function () {
  40418. _this.emit("activity");
  40419. },
  40420. error: function (error) {
  40421. _this.emit("error", { type: "WebSocketError", error: error });
  40422. },
  40423. closed: function (closeEvent) {
  40424. unbindListeners();
  40425. if (closeEvent && closeEvent.code) {
  40426. _this.handleCloseEvent(closeEvent);
  40427. }
  40428. _this.transport = null;
  40429. _this.emit("closed");
  40430. }
  40431. };
  40432. var unbindListeners = function () {
  40433. objectApply(listeners, function (listener, event) {
  40434. _this.transport.unbind(event, listener);
  40435. });
  40436. };
  40437. objectApply(listeners, function (listener, event) {
  40438. _this.transport.bind(event, listener);
  40439. });
  40440. };
  40441. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40442. var action = protocol_protocol.getCloseAction(closeEvent);
  40443. var error = protocol_protocol.getCloseError(closeEvent);
  40444. if (error) {
  40445. this.emit('error', error);
  40446. }
  40447. if (action) {
  40448. this.emit(action, { action: action, error: error });
  40449. }
  40450. };
  40451. return Connection;
  40452. }(dispatcher));
  40453. /* harmony default export */ var connection_connection = (connection_Connection);
  40454. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40455. var handshake_Handshake = (function () {
  40456. function Handshake(transport, callback) {
  40457. this.transport = transport;
  40458. this.callback = callback;
  40459. this.bindListeners();
  40460. }
  40461. Handshake.prototype.close = function () {
  40462. this.unbindListeners();
  40463. this.transport.close();
  40464. };
  40465. Handshake.prototype.bindListeners = function () {
  40466. var _this = this;
  40467. this.onMessage = function (m) {
  40468. _this.unbindListeners();
  40469. var result;
  40470. try {
  40471. result = protocol_protocol.processHandshake(m);
  40472. }
  40473. catch (e) {
  40474. _this.finish("error", { error: e });
  40475. _this.transport.close();
  40476. return;
  40477. }
  40478. if (result.action === "connected") {
  40479. _this.finish("connected", {
  40480. connection: new connection_connection(result.id, _this.transport),
  40481. activityTimeout: result.activityTimeout
  40482. });
  40483. }
  40484. else {
  40485. _this.finish(result.action, { error: result.error });
  40486. _this.transport.close();
  40487. }
  40488. };
  40489. this.onClosed = function (closeEvent) {
  40490. _this.unbindListeners();
  40491. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40492. var error = protocol_protocol.getCloseError(closeEvent);
  40493. _this.finish(action, { error: error });
  40494. };
  40495. this.transport.bind("message", this.onMessage);
  40496. this.transport.bind("closed", this.onClosed);
  40497. };
  40498. Handshake.prototype.unbindListeners = function () {
  40499. this.transport.unbind("message", this.onMessage);
  40500. this.transport.unbind("closed", this.onClosed);
  40501. };
  40502. Handshake.prototype.finish = function (action, params) {
  40503. this.callback(extend({ transport: this.transport, action: action }, params));
  40504. };
  40505. return Handshake;
  40506. }());
  40507. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40508. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40509. var pusher_authorizer_PusherAuthorizer = (function () {
  40510. function PusherAuthorizer(channel, options) {
  40511. this.channel = channel;
  40512. var authTransport = options.authTransport;
  40513. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40514. throw "'" + authTransport + "' is not a recognized auth transport";
  40515. }
  40516. this.type = authTransport;
  40517. this.options = options;
  40518. this.authOptions = (options || {}).auth || {};
  40519. }
  40520. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40521. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40522. '&channel_name=' + encodeURIComponent(this.channel.name);
  40523. for (var i in this.authOptions.params) {
  40524. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40525. }
  40526. return query;
  40527. };
  40528. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40529. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40530. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40531. };
  40532. return PusherAuthorizer;
  40533. }());
  40534. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40535. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40536. var timeline_sender_TimelineSender = (function () {
  40537. function TimelineSender(timeline, options) {
  40538. this.timeline = timeline;
  40539. this.options = options || {};
  40540. }
  40541. TimelineSender.prototype.send = function (useTLS, callback) {
  40542. if (this.timeline.isEmpty()) {
  40543. return;
  40544. }
  40545. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40546. };
  40547. return TimelineSender;
  40548. }());
  40549. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40550. // CONCATENATED MODULE: ./src/core/errors.ts
  40551. var errors_extends = (undefined && undefined.__extends) || (function () {
  40552. var extendStatics = function (d, b) {
  40553. extendStatics = Object.setPrototypeOf ||
  40554. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40555. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40556. return extendStatics(d, b);
  40557. };
  40558. return function (d, b) {
  40559. extendStatics(d, b);
  40560. function __() { this.constructor = d; }
  40561. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40562. };
  40563. })();
  40564. var BadEventName = (function (_super) {
  40565. errors_extends(BadEventName, _super);
  40566. function BadEventName(msg) {
  40567. var _newTarget = this.constructor;
  40568. var _this = _super.call(this, msg) || this;
  40569. Object.setPrototypeOf(_this, _newTarget.prototype);
  40570. return _this;
  40571. }
  40572. return BadEventName;
  40573. }(Error));
  40574. var RequestTimedOut = (function (_super) {
  40575. errors_extends(RequestTimedOut, _super);
  40576. function RequestTimedOut(msg) {
  40577. var _newTarget = this.constructor;
  40578. var _this = _super.call(this, msg) || this;
  40579. Object.setPrototypeOf(_this, _newTarget.prototype);
  40580. return _this;
  40581. }
  40582. return RequestTimedOut;
  40583. }(Error));
  40584. var TransportPriorityTooLow = (function (_super) {
  40585. errors_extends(TransportPriorityTooLow, _super);
  40586. function TransportPriorityTooLow(msg) {
  40587. var _newTarget = this.constructor;
  40588. var _this = _super.call(this, msg) || this;
  40589. Object.setPrototypeOf(_this, _newTarget.prototype);
  40590. return _this;
  40591. }
  40592. return TransportPriorityTooLow;
  40593. }(Error));
  40594. var TransportClosed = (function (_super) {
  40595. errors_extends(TransportClosed, _super);
  40596. function TransportClosed(msg) {
  40597. var _newTarget = this.constructor;
  40598. var _this = _super.call(this, msg) || this;
  40599. Object.setPrototypeOf(_this, _newTarget.prototype);
  40600. return _this;
  40601. }
  40602. return TransportClosed;
  40603. }(Error));
  40604. var UnsupportedFeature = (function (_super) {
  40605. errors_extends(UnsupportedFeature, _super);
  40606. function UnsupportedFeature(msg) {
  40607. var _newTarget = this.constructor;
  40608. var _this = _super.call(this, msg) || this;
  40609. Object.setPrototypeOf(_this, _newTarget.prototype);
  40610. return _this;
  40611. }
  40612. return UnsupportedFeature;
  40613. }(Error));
  40614. var UnsupportedTransport = (function (_super) {
  40615. errors_extends(UnsupportedTransport, _super);
  40616. function UnsupportedTransport(msg) {
  40617. var _newTarget = this.constructor;
  40618. var _this = _super.call(this, msg) || this;
  40619. Object.setPrototypeOf(_this, _newTarget.prototype);
  40620. return _this;
  40621. }
  40622. return UnsupportedTransport;
  40623. }(Error));
  40624. var UnsupportedStrategy = (function (_super) {
  40625. errors_extends(UnsupportedStrategy, _super);
  40626. function UnsupportedStrategy(msg) {
  40627. var _newTarget = this.constructor;
  40628. var _this = _super.call(this, msg) || this;
  40629. Object.setPrototypeOf(_this, _newTarget.prototype);
  40630. return _this;
  40631. }
  40632. return UnsupportedStrategy;
  40633. }(Error));
  40634. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40635. var channel_extends = (undefined && undefined.__extends) || (function () {
  40636. var extendStatics = function (d, b) {
  40637. extendStatics = Object.setPrototypeOf ||
  40638. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40639. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40640. return extendStatics(d, b);
  40641. };
  40642. return function (d, b) {
  40643. extendStatics(d, b);
  40644. function __() { this.constructor = d; }
  40645. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40646. };
  40647. })();
  40648. var channel_Channel = (function (_super) {
  40649. channel_extends(Channel, _super);
  40650. function Channel(name, pusher) {
  40651. var _this = _super.call(this, function (event, data) {
  40652. logger.debug('No callbacks on ' + name + ' for ' + event);
  40653. }) || this;
  40654. _this.name = name;
  40655. _this.pusher = pusher;
  40656. _this.subscribed = false;
  40657. _this.subscriptionPending = false;
  40658. _this.subscriptionCancelled = false;
  40659. return _this;
  40660. }
  40661. Channel.prototype.authorize = function (socketId, callback) {
  40662. return callback(false, {});
  40663. };
  40664. Channel.prototype.trigger = function (event, data) {
  40665. if (event.indexOf("client-") !== 0) {
  40666. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40667. }
  40668. if (!this.subscribed) {
  40669. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40670. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40671. }
  40672. return this.pusher.send_event(event, data, this.name);
  40673. };
  40674. Channel.prototype.disconnect = function () {
  40675. this.subscribed = false;
  40676. this.subscriptionPending = false;
  40677. };
  40678. Channel.prototype.handleEvent = function (event) {
  40679. var eventName = event.event;
  40680. var data = event.data;
  40681. if (eventName === "pusher_internal:subscription_succeeded") {
  40682. this.handleSubscriptionSucceededEvent(event);
  40683. }
  40684. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40685. var metadata = {};
  40686. this.emit(eventName, data, metadata);
  40687. }
  40688. };
  40689. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40690. this.subscriptionPending = false;
  40691. this.subscribed = true;
  40692. if (this.subscriptionCancelled) {
  40693. this.pusher.unsubscribe(this.name);
  40694. }
  40695. else {
  40696. this.emit("pusher:subscription_succeeded", event.data);
  40697. }
  40698. };
  40699. Channel.prototype.subscribe = function () {
  40700. var _this = this;
  40701. if (this.subscribed) {
  40702. return;
  40703. }
  40704. this.subscriptionPending = true;
  40705. this.subscriptionCancelled = false;
  40706. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40707. if (error) {
  40708. logger.error(data);
  40709. _this.emit('pusher:subscription_error', data);
  40710. }
  40711. else {
  40712. _this.pusher.send_event('pusher:subscribe', {
  40713. auth: data.auth,
  40714. channel_data: data.channel_data,
  40715. channel: _this.name
  40716. });
  40717. }
  40718. });
  40719. };
  40720. Channel.prototype.unsubscribe = function () {
  40721. this.subscribed = false;
  40722. this.pusher.send_event('pusher:unsubscribe', {
  40723. channel: this.name
  40724. });
  40725. };
  40726. Channel.prototype.cancelSubscription = function () {
  40727. this.subscriptionCancelled = true;
  40728. };
  40729. Channel.prototype.reinstateSubscription = function () {
  40730. this.subscriptionCancelled = false;
  40731. };
  40732. return Channel;
  40733. }(dispatcher));
  40734. /* harmony default export */ var channels_channel = (channel_Channel);
  40735. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40736. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40737. var extendStatics = function (d, b) {
  40738. extendStatics = Object.setPrototypeOf ||
  40739. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40740. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40741. return extendStatics(d, b);
  40742. };
  40743. return function (d, b) {
  40744. extendStatics(d, b);
  40745. function __() { this.constructor = d; }
  40746. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40747. };
  40748. })();
  40749. var private_channel_PrivateChannel = (function (_super) {
  40750. private_channel_extends(PrivateChannel, _super);
  40751. function PrivateChannel() {
  40752. return _super !== null && _super.apply(this, arguments) || this;
  40753. }
  40754. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40755. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40756. return authorizer.authorize(socketId, callback);
  40757. };
  40758. return PrivateChannel;
  40759. }(channels_channel));
  40760. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40761. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40762. var members_Members = (function () {
  40763. function Members() {
  40764. this.reset();
  40765. }
  40766. Members.prototype.get = function (id) {
  40767. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40768. return {
  40769. id: id,
  40770. info: this.members[id]
  40771. };
  40772. }
  40773. else {
  40774. return null;
  40775. }
  40776. };
  40777. Members.prototype.each = function (callback) {
  40778. var _this = this;
  40779. objectApply(this.members, function (member, id) {
  40780. callback(_this.get(id));
  40781. });
  40782. };
  40783. Members.prototype.setMyID = function (id) {
  40784. this.myID = id;
  40785. };
  40786. Members.prototype.onSubscription = function (subscriptionData) {
  40787. this.members = subscriptionData.presence.hash;
  40788. this.count = subscriptionData.presence.count;
  40789. this.me = this.get(this.myID);
  40790. };
  40791. Members.prototype.addMember = function (memberData) {
  40792. if (this.get(memberData.user_id) === null) {
  40793. this.count++;
  40794. }
  40795. this.members[memberData.user_id] = memberData.user_info;
  40796. return this.get(memberData.user_id);
  40797. };
  40798. Members.prototype.removeMember = function (memberData) {
  40799. var member = this.get(memberData.user_id);
  40800. if (member) {
  40801. delete this.members[memberData.user_id];
  40802. this.count--;
  40803. }
  40804. return member;
  40805. };
  40806. Members.prototype.reset = function () {
  40807. this.members = {};
  40808. this.count = 0;
  40809. this.myID = null;
  40810. this.me = null;
  40811. };
  40812. return Members;
  40813. }());
  40814. /* harmony default export */ var members = (members_Members);
  40815. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40816. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40817. var extendStatics = function (d, b) {
  40818. extendStatics = Object.setPrototypeOf ||
  40819. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40820. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40821. return extendStatics(d, b);
  40822. };
  40823. return function (d, b) {
  40824. extendStatics(d, b);
  40825. function __() { this.constructor = d; }
  40826. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40827. };
  40828. })();
  40829. var presence_channel_PresenceChannel = (function (_super) {
  40830. presence_channel_extends(PresenceChannel, _super);
  40831. function PresenceChannel(name, pusher) {
  40832. var _this = _super.call(this, name, pusher) || this;
  40833. _this.members = new members();
  40834. return _this;
  40835. }
  40836. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40837. var _this = this;
  40838. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40839. if (!error) {
  40840. if (authData.channel_data === undefined) {
  40841. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40842. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40843. ("expected 'channel_data' field. " + suffix));
  40844. callback("Invalid auth response");
  40845. return;
  40846. }
  40847. var channelData = JSON.parse(authData.channel_data);
  40848. _this.members.setMyID(channelData.user_id);
  40849. }
  40850. callback(error, authData);
  40851. });
  40852. };
  40853. PresenceChannel.prototype.handleEvent = function (event) {
  40854. var eventName = event.event;
  40855. if (eventName.indexOf("pusher_internal:") === 0) {
  40856. this.handleInternalEvent(event);
  40857. }
  40858. else {
  40859. var data = event.data;
  40860. var metadata = {};
  40861. if (event.user_id) {
  40862. metadata.user_id = event.user_id;
  40863. }
  40864. this.emit(eventName, data, metadata);
  40865. }
  40866. };
  40867. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40868. var eventName = event.event;
  40869. var data = event.data;
  40870. switch (eventName) {
  40871. case "pusher_internal:subscription_succeeded":
  40872. this.handleSubscriptionSucceededEvent(event);
  40873. break;
  40874. case "pusher_internal:member_added":
  40875. var addedMember = this.members.addMember(data);
  40876. this.emit('pusher:member_added', addedMember);
  40877. break;
  40878. case "pusher_internal:member_removed":
  40879. var removedMember = this.members.removeMember(data);
  40880. if (removedMember) {
  40881. this.emit('pusher:member_removed', removedMember);
  40882. }
  40883. break;
  40884. }
  40885. };
  40886. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40887. this.subscriptionPending = false;
  40888. this.subscribed = true;
  40889. if (this.subscriptionCancelled) {
  40890. this.pusher.unsubscribe(this.name);
  40891. }
  40892. else {
  40893. this.members.onSubscription(event.data);
  40894. this.emit("pusher:subscription_succeeded", this.members);
  40895. }
  40896. };
  40897. PresenceChannel.prototype.disconnect = function () {
  40898. this.members.reset();
  40899. _super.prototype.disconnect.call(this);
  40900. };
  40901. return PresenceChannel;
  40902. }(private_channel));
  40903. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40904. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40905. var nacl_fast = __webpack_require__(0);
  40906. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40907. var nacl_util = __webpack_require__(1);
  40908. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40909. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40910. var extendStatics = function (d, b) {
  40911. extendStatics = Object.setPrototypeOf ||
  40912. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40913. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40914. return extendStatics(d, b);
  40915. };
  40916. return function (d, b) {
  40917. extendStatics(d, b);
  40918. function __() { this.constructor = d; }
  40919. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40920. };
  40921. })();
  40922. var encrypted_channel_EncryptedChannel = (function (_super) {
  40923. encrypted_channel_extends(EncryptedChannel, _super);
  40924. function EncryptedChannel() {
  40925. var _this = _super !== null && _super.apply(this, arguments) || this;
  40926. _this.key = null;
  40927. return _this;
  40928. }
  40929. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40930. var _this = this;
  40931. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40932. if (error) {
  40933. callback(true, authData);
  40934. return;
  40935. }
  40936. var sharedSecret = authData["shared_secret"];
  40937. if (!sharedSecret) {
  40938. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40939. callback(true, errorMsg);
  40940. return;
  40941. }
  40942. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40943. delete authData["shared_secret"];
  40944. callback(false, authData);
  40945. });
  40946. };
  40947. EncryptedChannel.prototype.trigger = function (event, data) {
  40948. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40949. };
  40950. EncryptedChannel.prototype.handleEvent = function (event) {
  40951. var eventName = event.event;
  40952. var data = event.data;
  40953. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40954. _super.prototype.handleEvent.call(this, event);
  40955. return;
  40956. }
  40957. this.handleEncryptedEvent(eventName, data);
  40958. };
  40959. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40960. var _this = this;
  40961. if (!this.key) {
  40962. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40963. return;
  40964. }
  40965. if (!data.ciphertext || !data.nonce) {
  40966. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40967. return;
  40968. }
  40969. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  40970. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  40971. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  40972. return;
  40973. }
  40974. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  40975. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  40976. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  40977. return;
  40978. }
  40979. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  40980. if (bytes === null) {
  40981. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  40982. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  40983. if (error) {
  40984. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  40985. return;
  40986. }
  40987. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  40988. if (bytes === null) {
  40989. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  40990. return;
  40991. }
  40992. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40993. return;
  40994. });
  40995. return;
  40996. }
  40997. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  40998. };
  40999. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41000. try {
  41001. this.emit(eventName, JSON.parse(data));
  41002. }
  41003. catch (e) {
  41004. this.emit(eventName, data);
  41005. }
  41006. return this;
  41007. };
  41008. return EncryptedChannel;
  41009. }(private_channel));
  41010. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41011. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41012. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41013. var extendStatics = function (d, b) {
  41014. extendStatics = Object.setPrototypeOf ||
  41015. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41016. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41017. return extendStatics(d, b);
  41018. };
  41019. return function (d, b) {
  41020. extendStatics(d, b);
  41021. function __() { this.constructor = d; }
  41022. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41023. };
  41024. })();
  41025. var connection_manager_ConnectionManager = (function (_super) {
  41026. connection_manager_extends(ConnectionManager, _super);
  41027. function ConnectionManager(key, options) {
  41028. var _this = _super.call(this) || this;
  41029. _this.key = key;
  41030. _this.options = options || {};
  41031. _this.state = "initialized";
  41032. _this.connection = null;
  41033. _this.usingTLS = !!options.useTLS;
  41034. _this.timeline = _this.options.timeline;
  41035. _this.errorCallbacks = _this.buildErrorCallbacks();
  41036. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41037. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41038. var Network = runtime.getNetwork();
  41039. Network.bind("online", function () {
  41040. _this.timeline.info({ netinfo: "online" });
  41041. if (_this.state === "connecting" || _this.state === "unavailable") {
  41042. _this.retryIn(0);
  41043. }
  41044. });
  41045. Network.bind("offline", function () {
  41046. _this.timeline.info({ netinfo: "offline" });
  41047. if (_this.connection) {
  41048. _this.sendActivityCheck();
  41049. }
  41050. });
  41051. _this.updateStrategy();
  41052. return _this;
  41053. }
  41054. ConnectionManager.prototype.connect = function () {
  41055. if (this.connection || this.runner) {
  41056. return;
  41057. }
  41058. if (!this.strategy.isSupported()) {
  41059. this.updateState("failed");
  41060. return;
  41061. }
  41062. this.updateState("connecting");
  41063. this.startConnecting();
  41064. this.setUnavailableTimer();
  41065. };
  41066. ;
  41067. ConnectionManager.prototype.send = function (data) {
  41068. if (this.connection) {
  41069. return this.connection.send(data);
  41070. }
  41071. else {
  41072. return false;
  41073. }
  41074. };
  41075. ;
  41076. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41077. if (this.connection) {
  41078. return this.connection.send_event(name, data, channel);
  41079. }
  41080. else {
  41081. return false;
  41082. }
  41083. };
  41084. ;
  41085. ConnectionManager.prototype.disconnect = function () {
  41086. this.disconnectInternally();
  41087. this.updateState("disconnected");
  41088. };
  41089. ;
  41090. ConnectionManager.prototype.isUsingTLS = function () {
  41091. return this.usingTLS;
  41092. };
  41093. ;
  41094. ConnectionManager.prototype.startConnecting = function () {
  41095. var _this = this;
  41096. var callback = function (error, handshake) {
  41097. if (error) {
  41098. _this.runner = _this.strategy.connect(0, callback);
  41099. }
  41100. else {
  41101. if (handshake.action === "error") {
  41102. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41103. _this.timeline.error({ handshakeError: handshake.error });
  41104. }
  41105. else {
  41106. _this.abortConnecting();
  41107. _this.handshakeCallbacks[handshake.action](handshake);
  41108. }
  41109. }
  41110. };
  41111. this.runner = this.strategy.connect(0, callback);
  41112. };
  41113. ;
  41114. ConnectionManager.prototype.abortConnecting = function () {
  41115. if (this.runner) {
  41116. this.runner.abort();
  41117. this.runner = null;
  41118. }
  41119. };
  41120. ;
  41121. ConnectionManager.prototype.disconnectInternally = function () {
  41122. this.abortConnecting();
  41123. this.clearRetryTimer();
  41124. this.clearUnavailableTimer();
  41125. if (this.connection) {
  41126. var connection = this.abandonConnection();
  41127. connection.close();
  41128. }
  41129. };
  41130. ;
  41131. ConnectionManager.prototype.updateStrategy = function () {
  41132. this.strategy = this.options.getStrategy({
  41133. key: this.key,
  41134. timeline: this.timeline,
  41135. useTLS: this.usingTLS
  41136. });
  41137. };
  41138. ;
  41139. ConnectionManager.prototype.retryIn = function (delay) {
  41140. var _this = this;
  41141. this.timeline.info({ action: "retry", delay: delay });
  41142. if (delay > 0) {
  41143. this.emit("connecting_in", Math.round(delay / 1000));
  41144. }
  41145. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41146. _this.disconnectInternally();
  41147. _this.connect();
  41148. });
  41149. };
  41150. ;
  41151. ConnectionManager.prototype.clearRetryTimer = function () {
  41152. if (this.retryTimer) {
  41153. this.retryTimer.ensureAborted();
  41154. this.retryTimer = null;
  41155. }
  41156. };
  41157. ;
  41158. ConnectionManager.prototype.setUnavailableTimer = function () {
  41159. var _this = this;
  41160. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41161. _this.updateState("unavailable");
  41162. });
  41163. };
  41164. ;
  41165. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41166. if (this.unavailableTimer) {
  41167. this.unavailableTimer.ensureAborted();
  41168. }
  41169. };
  41170. ;
  41171. ConnectionManager.prototype.sendActivityCheck = function () {
  41172. var _this = this;
  41173. this.stopActivityCheck();
  41174. this.connection.ping();
  41175. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41176. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41177. _this.retryIn(0);
  41178. });
  41179. };
  41180. ;
  41181. ConnectionManager.prototype.resetActivityCheck = function () {
  41182. var _this = this;
  41183. this.stopActivityCheck();
  41184. if (this.connection && !this.connection.handlesActivityChecks()) {
  41185. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41186. _this.sendActivityCheck();
  41187. });
  41188. }
  41189. };
  41190. ;
  41191. ConnectionManager.prototype.stopActivityCheck = function () {
  41192. if (this.activityTimer) {
  41193. this.activityTimer.ensureAborted();
  41194. }
  41195. };
  41196. ;
  41197. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41198. var _this = this;
  41199. return extend({}, errorCallbacks, {
  41200. message: function (message) {
  41201. _this.resetActivityCheck();
  41202. _this.emit('message', message);
  41203. },
  41204. ping: function () {
  41205. _this.send_event('pusher:pong', {});
  41206. },
  41207. activity: function () {
  41208. _this.resetActivityCheck();
  41209. },
  41210. error: function (error) {
  41211. _this.emit("error", { type: "WebSocketError", error: error });
  41212. },
  41213. closed: function () {
  41214. _this.abandonConnection();
  41215. if (_this.shouldRetry()) {
  41216. _this.retryIn(1000);
  41217. }
  41218. }
  41219. });
  41220. };
  41221. ;
  41222. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41223. var _this = this;
  41224. return extend({}, errorCallbacks, {
  41225. connected: function (handshake) {
  41226. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41227. _this.clearUnavailableTimer();
  41228. _this.setConnection(handshake.connection);
  41229. _this.socket_id = _this.connection.id;
  41230. _this.updateState("connected", { socket_id: _this.socket_id });
  41231. }
  41232. });
  41233. };
  41234. ;
  41235. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41236. var _this = this;
  41237. var withErrorEmitted = function (callback) {
  41238. return function (result) {
  41239. if (result.error) {
  41240. _this.emit("error", { type: "WebSocketError", error: result.error });
  41241. }
  41242. callback(result);
  41243. };
  41244. };
  41245. return {
  41246. tls_only: withErrorEmitted(function () {
  41247. _this.usingTLS = true;
  41248. _this.updateStrategy();
  41249. _this.retryIn(0);
  41250. }),
  41251. refused: withErrorEmitted(function () {
  41252. _this.disconnect();
  41253. }),
  41254. backoff: withErrorEmitted(function () {
  41255. _this.retryIn(1000);
  41256. }),
  41257. retry: withErrorEmitted(function () {
  41258. _this.retryIn(0);
  41259. })
  41260. };
  41261. };
  41262. ;
  41263. ConnectionManager.prototype.setConnection = function (connection) {
  41264. this.connection = connection;
  41265. for (var event in this.connectionCallbacks) {
  41266. this.connection.bind(event, this.connectionCallbacks[event]);
  41267. }
  41268. this.resetActivityCheck();
  41269. };
  41270. ;
  41271. ConnectionManager.prototype.abandonConnection = function () {
  41272. if (!this.connection) {
  41273. return;
  41274. }
  41275. this.stopActivityCheck();
  41276. for (var event in this.connectionCallbacks) {
  41277. this.connection.unbind(event, this.connectionCallbacks[event]);
  41278. }
  41279. var connection = this.connection;
  41280. this.connection = null;
  41281. return connection;
  41282. };
  41283. ConnectionManager.prototype.updateState = function (newState, data) {
  41284. var previousState = this.state;
  41285. this.state = newState;
  41286. if (previousState !== newState) {
  41287. var newStateDescription = newState;
  41288. if (newStateDescription === "connected") {
  41289. newStateDescription += " with new socket ID " + data.socket_id;
  41290. }
  41291. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41292. this.timeline.info({ state: newState, params: data });
  41293. this.emit('state_change', { previous: previousState, current: newState });
  41294. this.emit(newState, data);
  41295. }
  41296. };
  41297. ConnectionManager.prototype.shouldRetry = function () {
  41298. return this.state === "connecting" || this.state === "connected";
  41299. };
  41300. return ConnectionManager;
  41301. }(dispatcher));
  41302. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41303. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41304. var channels_Channels = (function () {
  41305. function Channels() {
  41306. this.channels = {};
  41307. }
  41308. Channels.prototype.add = function (name, pusher) {
  41309. if (!this.channels[name]) {
  41310. this.channels[name] = createChannel(name, pusher);
  41311. }
  41312. return this.channels[name];
  41313. };
  41314. Channels.prototype.all = function () {
  41315. return values(this.channels);
  41316. };
  41317. Channels.prototype.find = function (name) {
  41318. return this.channels[name];
  41319. };
  41320. Channels.prototype.remove = function (name) {
  41321. var channel = this.channels[name];
  41322. delete this.channels[name];
  41323. return channel;
  41324. };
  41325. Channels.prototype.disconnect = function () {
  41326. objectApply(this.channels, function (channel) {
  41327. channel.disconnect();
  41328. });
  41329. };
  41330. return Channels;
  41331. }());
  41332. /* harmony default export */ var channels = (channels_Channels);
  41333. function createChannel(name, pusher) {
  41334. if (name.indexOf('private-encrypted-') === 0) {
  41335. if (false) { var errorMsg; }
  41336. return factory.createEncryptedChannel(name, pusher);
  41337. }
  41338. else if (name.indexOf('private-') === 0) {
  41339. return factory.createPrivateChannel(name, pusher);
  41340. }
  41341. else if (name.indexOf('presence-') === 0) {
  41342. return factory.createPresenceChannel(name, pusher);
  41343. }
  41344. else {
  41345. return factory.createChannel(name, pusher);
  41346. }
  41347. }
  41348. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41349. var Factory = {
  41350. createChannels: function () {
  41351. return new channels();
  41352. },
  41353. createConnectionManager: function (key, options) {
  41354. return new connection_manager(key, options);
  41355. },
  41356. createChannel: function (name, pusher) {
  41357. return new channels_channel(name, pusher);
  41358. },
  41359. createPrivateChannel: function (name, pusher) {
  41360. return new private_channel(name, pusher);
  41361. },
  41362. createPresenceChannel: function (name, pusher) {
  41363. return new presence_channel(name, pusher);
  41364. },
  41365. createEncryptedChannel: function (name, pusher) {
  41366. return new encrypted_channel(name, pusher);
  41367. },
  41368. createTimelineSender: function (timeline, options) {
  41369. return new timeline_sender(timeline, options);
  41370. },
  41371. createAuthorizer: function (channel, options) {
  41372. if (options.authorizer) {
  41373. return options.authorizer(channel, options);
  41374. }
  41375. return new pusher_authorizer(channel, options);
  41376. },
  41377. createHandshake: function (transport, callback) {
  41378. return new connection_handshake(transport, callback);
  41379. },
  41380. createAssistantToTheTransportManager: function (manager, transport, options) {
  41381. return new assistant_to_the_transport_manager(manager, transport, options);
  41382. }
  41383. };
  41384. /* harmony default export */ var factory = (Factory);
  41385. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41386. var transport_manager_TransportManager = (function () {
  41387. function TransportManager(options) {
  41388. this.options = options || {};
  41389. this.livesLeft = this.options.lives || Infinity;
  41390. }
  41391. TransportManager.prototype.getAssistant = function (transport) {
  41392. return factory.createAssistantToTheTransportManager(this, transport, {
  41393. minPingDelay: this.options.minPingDelay,
  41394. maxPingDelay: this.options.maxPingDelay
  41395. });
  41396. };
  41397. TransportManager.prototype.isAlive = function () {
  41398. return this.livesLeft > 0;
  41399. };
  41400. TransportManager.prototype.reportDeath = function () {
  41401. this.livesLeft -= 1;
  41402. };
  41403. return TransportManager;
  41404. }());
  41405. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41406. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41407. var sequential_strategy_SequentialStrategy = (function () {
  41408. function SequentialStrategy(strategies, options) {
  41409. this.strategies = strategies;
  41410. this.loop = Boolean(options.loop);
  41411. this.failFast = Boolean(options.failFast);
  41412. this.timeout = options.timeout;
  41413. this.timeoutLimit = options.timeoutLimit;
  41414. }
  41415. SequentialStrategy.prototype.isSupported = function () {
  41416. return any(this.strategies, util.method("isSupported"));
  41417. };
  41418. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41419. var _this = this;
  41420. var strategies = this.strategies;
  41421. var current = 0;
  41422. var timeout = this.timeout;
  41423. var runner = null;
  41424. var tryNextStrategy = function (error, handshake) {
  41425. if (handshake) {
  41426. callback(null, handshake);
  41427. }
  41428. else {
  41429. current = current + 1;
  41430. if (_this.loop) {
  41431. current = current % strategies.length;
  41432. }
  41433. if (current < strategies.length) {
  41434. if (timeout) {
  41435. timeout = timeout * 2;
  41436. if (_this.timeoutLimit) {
  41437. timeout = Math.min(timeout, _this.timeoutLimit);
  41438. }
  41439. }
  41440. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41441. }
  41442. else {
  41443. callback(true);
  41444. }
  41445. }
  41446. };
  41447. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41448. return {
  41449. abort: function () {
  41450. runner.abort();
  41451. },
  41452. forceMinPriority: function (p) {
  41453. minPriority = p;
  41454. if (runner) {
  41455. runner.forceMinPriority(p);
  41456. }
  41457. }
  41458. };
  41459. };
  41460. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41461. var timer = null;
  41462. var runner = null;
  41463. if (options.timeout > 0) {
  41464. timer = new OneOffTimer(options.timeout, function () {
  41465. runner.abort();
  41466. callback(true);
  41467. });
  41468. }
  41469. runner = strategy.connect(minPriority, function (error, handshake) {
  41470. if (error && timer && timer.isRunning() && !options.failFast) {
  41471. return;
  41472. }
  41473. if (timer) {
  41474. timer.ensureAborted();
  41475. }
  41476. callback(error, handshake);
  41477. });
  41478. return {
  41479. abort: function () {
  41480. if (timer) {
  41481. timer.ensureAborted();
  41482. }
  41483. runner.abort();
  41484. },
  41485. forceMinPriority: function (p) {
  41486. runner.forceMinPriority(p);
  41487. }
  41488. };
  41489. };
  41490. return SequentialStrategy;
  41491. }());
  41492. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41493. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41494. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41495. function BestConnectedEverStrategy(strategies) {
  41496. this.strategies = strategies;
  41497. }
  41498. BestConnectedEverStrategy.prototype.isSupported = function () {
  41499. return any(this.strategies, util.method("isSupported"));
  41500. };
  41501. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41502. return connect(this.strategies, minPriority, function (i, runners) {
  41503. return function (error, handshake) {
  41504. runners[i].error = error;
  41505. if (error) {
  41506. if (allRunnersFailed(runners)) {
  41507. callback(true);
  41508. }
  41509. return;
  41510. }
  41511. apply(runners, function (runner) {
  41512. runner.forceMinPriority(handshake.transport.priority);
  41513. });
  41514. callback(null, handshake);
  41515. };
  41516. });
  41517. };
  41518. return BestConnectedEverStrategy;
  41519. }());
  41520. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41521. function connect(strategies, minPriority, callbackBuilder) {
  41522. var runners = map(strategies, function (strategy, i, _, rs) {
  41523. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41524. });
  41525. return {
  41526. abort: function () {
  41527. apply(runners, abortRunner);
  41528. },
  41529. forceMinPriority: function (p) {
  41530. apply(runners, function (runner) {
  41531. runner.forceMinPriority(p);
  41532. });
  41533. }
  41534. };
  41535. }
  41536. function allRunnersFailed(runners) {
  41537. return collections_all(runners, function (runner) {
  41538. return Boolean(runner.error);
  41539. });
  41540. }
  41541. function abortRunner(runner) {
  41542. if (!runner.error && !runner.aborted) {
  41543. runner.abort();
  41544. runner.aborted = true;
  41545. }
  41546. }
  41547. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41548. var cached_strategy_CachedStrategy = (function () {
  41549. function CachedStrategy(strategy, transports, options) {
  41550. this.strategy = strategy;
  41551. this.transports = transports;
  41552. this.ttl = options.ttl || 1800 * 1000;
  41553. this.usingTLS = options.useTLS;
  41554. this.timeline = options.timeline;
  41555. }
  41556. CachedStrategy.prototype.isSupported = function () {
  41557. return this.strategy.isSupported();
  41558. };
  41559. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41560. var usingTLS = this.usingTLS;
  41561. var info = fetchTransportCache(usingTLS);
  41562. var strategies = [this.strategy];
  41563. if (info && info.timestamp + this.ttl >= util.now()) {
  41564. var transport = this.transports[info.transport];
  41565. if (transport) {
  41566. this.timeline.info({
  41567. cached: true,
  41568. transport: info.transport,
  41569. latency: info.latency
  41570. });
  41571. strategies.push(new sequential_strategy([transport], {
  41572. timeout: info.latency * 2 + 1000,
  41573. failFast: true
  41574. }));
  41575. }
  41576. }
  41577. var startTimestamp = util.now();
  41578. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41579. if (error) {
  41580. flushTransportCache(usingTLS);
  41581. if (strategies.length > 0) {
  41582. startTimestamp = util.now();
  41583. runner = strategies.pop().connect(minPriority, cb);
  41584. }
  41585. else {
  41586. callback(error);
  41587. }
  41588. }
  41589. else {
  41590. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41591. callback(null, handshake);
  41592. }
  41593. });
  41594. return {
  41595. abort: function () {
  41596. runner.abort();
  41597. },
  41598. forceMinPriority: function (p) {
  41599. minPriority = p;
  41600. if (runner) {
  41601. runner.forceMinPriority(p);
  41602. }
  41603. }
  41604. };
  41605. };
  41606. return CachedStrategy;
  41607. }());
  41608. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41609. function getTransportCacheKey(usingTLS) {
  41610. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41611. }
  41612. function fetchTransportCache(usingTLS) {
  41613. var storage = runtime.getLocalStorage();
  41614. if (storage) {
  41615. try {
  41616. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41617. if (serializedCache) {
  41618. return JSON.parse(serializedCache);
  41619. }
  41620. }
  41621. catch (e) {
  41622. flushTransportCache(usingTLS);
  41623. }
  41624. }
  41625. return null;
  41626. }
  41627. function storeTransportCache(usingTLS, transport, latency) {
  41628. var storage = runtime.getLocalStorage();
  41629. if (storage) {
  41630. try {
  41631. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41632. timestamp: util.now(),
  41633. transport: transport,
  41634. latency: latency
  41635. });
  41636. }
  41637. catch (e) {
  41638. }
  41639. }
  41640. }
  41641. function flushTransportCache(usingTLS) {
  41642. var storage = runtime.getLocalStorage();
  41643. if (storage) {
  41644. try {
  41645. delete storage[getTransportCacheKey(usingTLS)];
  41646. }
  41647. catch (e) {
  41648. }
  41649. }
  41650. }
  41651. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41652. var delayed_strategy_DelayedStrategy = (function () {
  41653. function DelayedStrategy(strategy, _a) {
  41654. var number = _a.delay;
  41655. this.strategy = strategy;
  41656. this.options = { delay: number };
  41657. }
  41658. DelayedStrategy.prototype.isSupported = function () {
  41659. return this.strategy.isSupported();
  41660. };
  41661. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41662. var strategy = this.strategy;
  41663. var runner;
  41664. var timer = new OneOffTimer(this.options.delay, function () {
  41665. runner = strategy.connect(minPriority, callback);
  41666. });
  41667. return {
  41668. abort: function () {
  41669. timer.ensureAborted();
  41670. if (runner) {
  41671. runner.abort();
  41672. }
  41673. },
  41674. forceMinPriority: function (p) {
  41675. minPriority = p;
  41676. if (runner) {
  41677. runner.forceMinPriority(p);
  41678. }
  41679. }
  41680. };
  41681. };
  41682. return DelayedStrategy;
  41683. }());
  41684. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41685. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41686. var IfStrategy = (function () {
  41687. function IfStrategy(test, trueBranch, falseBranch) {
  41688. this.test = test;
  41689. this.trueBranch = trueBranch;
  41690. this.falseBranch = falseBranch;
  41691. }
  41692. IfStrategy.prototype.isSupported = function () {
  41693. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41694. return branch.isSupported();
  41695. };
  41696. IfStrategy.prototype.connect = function (minPriority, callback) {
  41697. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41698. return branch.connect(minPriority, callback);
  41699. };
  41700. return IfStrategy;
  41701. }());
  41702. /* harmony default export */ var if_strategy = (IfStrategy);
  41703. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41704. var FirstConnectedStrategy = (function () {
  41705. function FirstConnectedStrategy(strategy) {
  41706. this.strategy = strategy;
  41707. }
  41708. FirstConnectedStrategy.prototype.isSupported = function () {
  41709. return this.strategy.isSupported();
  41710. };
  41711. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41712. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41713. if (handshake) {
  41714. runner.abort();
  41715. }
  41716. callback(error, handshake);
  41717. });
  41718. return runner;
  41719. };
  41720. return FirstConnectedStrategy;
  41721. }());
  41722. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41723. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41724. function testSupportsStrategy(strategy) {
  41725. return function () {
  41726. return strategy.isSupported();
  41727. };
  41728. }
  41729. var getDefaultStrategy = function (config, defineTransport) {
  41730. var definedTransports = {};
  41731. function defineTransportStrategy(name, type, priority, options, manager) {
  41732. var transport = defineTransport(config, name, type, priority, options, manager);
  41733. definedTransports[name] = transport;
  41734. return transport;
  41735. }
  41736. var ws_options = {
  41737. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41738. hostTLS: config.wsHost + ":" + config.wssPort,
  41739. httpPath: config.wsPath
  41740. };
  41741. var wss_options = extend({}, ws_options, {
  41742. useTLS: true
  41743. });
  41744. var sockjs_options = {
  41745. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41746. hostTLS: config.httpHost + ":" + config.httpsPort,
  41747. httpPath: config.httpPath
  41748. };
  41749. var timeouts = {
  41750. loop: true,
  41751. timeout: 15000,
  41752. timeoutLimit: 60000
  41753. };
  41754. var ws_manager = new transport_manager({
  41755. lives: 2,
  41756. minPingDelay: 10000,
  41757. maxPingDelay: config.activity_timeout
  41758. });
  41759. var streaming_manager = new transport_manager({
  41760. lives: 2,
  41761. minPingDelay: 10000,
  41762. maxPingDelay: config.activity_timeout
  41763. });
  41764. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41765. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41766. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41767. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41768. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41769. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41770. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41771. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41772. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41773. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41774. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41775. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41776. 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);
  41777. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41778. var wsStrategy;
  41779. if (config.useTLS) {
  41780. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41781. }
  41782. else {
  41783. wsStrategy = new best_connected_ever_strategy([
  41784. ws_loop,
  41785. new delayed_strategy(wss_loop, { delay: 2000 }),
  41786. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41787. ]);
  41788. }
  41789. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41790. ttl: 1800000,
  41791. timeline: config.timeline,
  41792. useTLS: config.useTLS
  41793. });
  41794. };
  41795. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41796. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41797. /* harmony default export */ var transport_connection_initializer = (function () {
  41798. var self = this;
  41799. self.timeline.info(self.buildTimelineMessage({
  41800. transport: self.name + (self.options.useTLS ? "s" : "")
  41801. }));
  41802. if (self.hooks.isInitialized()) {
  41803. self.changeState("initialized");
  41804. }
  41805. else if (self.hooks.file) {
  41806. self.changeState("initializing");
  41807. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41808. if (self.hooks.isInitialized()) {
  41809. self.changeState("initialized");
  41810. callback(true);
  41811. }
  41812. else {
  41813. if (error) {
  41814. self.onError(error);
  41815. }
  41816. self.onClose();
  41817. callback(false);
  41818. }
  41819. });
  41820. }
  41821. else {
  41822. self.onClose();
  41823. }
  41824. });
  41825. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41826. var http_xdomain_request_hooks = {
  41827. getRequest: function (socket) {
  41828. var xdr = new window.XDomainRequest();
  41829. xdr.ontimeout = function () {
  41830. socket.emit("error", new RequestTimedOut());
  41831. socket.close();
  41832. };
  41833. xdr.onerror = function (e) {
  41834. socket.emit("error", e);
  41835. socket.close();
  41836. };
  41837. xdr.onprogress = function () {
  41838. if (xdr.responseText && xdr.responseText.length > 0) {
  41839. socket.onChunk(200, xdr.responseText);
  41840. }
  41841. };
  41842. xdr.onload = function () {
  41843. if (xdr.responseText && xdr.responseText.length > 0) {
  41844. socket.onChunk(200, xdr.responseText);
  41845. }
  41846. socket.emit("finished", 200);
  41847. socket.close();
  41848. };
  41849. return xdr;
  41850. },
  41851. abortRequest: function (xdr) {
  41852. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41853. xdr.abort();
  41854. }
  41855. };
  41856. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41857. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41858. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41859. var extendStatics = function (d, b) {
  41860. extendStatics = Object.setPrototypeOf ||
  41861. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41862. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41863. return extendStatics(d, b);
  41864. };
  41865. return function (d, b) {
  41866. extendStatics(d, b);
  41867. function __() { this.constructor = d; }
  41868. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41869. };
  41870. })();
  41871. var MAX_BUFFER_LENGTH = 256 * 1024;
  41872. var http_request_HTTPRequest = (function (_super) {
  41873. http_request_extends(HTTPRequest, _super);
  41874. function HTTPRequest(hooks, method, url) {
  41875. var _this = _super.call(this) || this;
  41876. _this.hooks = hooks;
  41877. _this.method = method;
  41878. _this.url = url;
  41879. return _this;
  41880. }
  41881. HTTPRequest.prototype.start = function (payload) {
  41882. var _this = this;
  41883. this.position = 0;
  41884. this.xhr = this.hooks.getRequest(this);
  41885. this.unloader = function () {
  41886. _this.close();
  41887. };
  41888. runtime.addUnloadListener(this.unloader);
  41889. this.xhr.open(this.method, this.url, true);
  41890. if (this.xhr.setRequestHeader) {
  41891. this.xhr.setRequestHeader("Content-Type", "application/json");
  41892. }
  41893. this.xhr.send(payload);
  41894. };
  41895. HTTPRequest.prototype.close = function () {
  41896. if (this.unloader) {
  41897. runtime.removeUnloadListener(this.unloader);
  41898. this.unloader = null;
  41899. }
  41900. if (this.xhr) {
  41901. this.hooks.abortRequest(this.xhr);
  41902. this.xhr = null;
  41903. }
  41904. };
  41905. HTTPRequest.prototype.onChunk = function (status, data) {
  41906. while (true) {
  41907. var chunk = this.advanceBuffer(data);
  41908. if (chunk) {
  41909. this.emit("chunk", { status: status, data: chunk });
  41910. }
  41911. else {
  41912. break;
  41913. }
  41914. }
  41915. if (this.isBufferTooLong(data)) {
  41916. this.emit("buffer_too_long");
  41917. }
  41918. };
  41919. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41920. var unreadData = buffer.slice(this.position);
  41921. var endOfLinePosition = unreadData.indexOf("\n");
  41922. if (endOfLinePosition !== -1) {
  41923. this.position += endOfLinePosition + 1;
  41924. return unreadData.slice(0, endOfLinePosition);
  41925. }
  41926. else {
  41927. return null;
  41928. }
  41929. };
  41930. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41931. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41932. };
  41933. return HTTPRequest;
  41934. }(dispatcher));
  41935. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41936. // CONCATENATED MODULE: ./src/core/http/state.ts
  41937. var State;
  41938. (function (State) {
  41939. State[State["CONNECTING"] = 0] = "CONNECTING";
  41940. State[State["OPEN"] = 1] = "OPEN";
  41941. State[State["CLOSED"] = 3] = "CLOSED";
  41942. })(State || (State = {}));
  41943. /* harmony default export */ var state = (State);
  41944. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41945. var autoIncrement = 1;
  41946. var http_socket_HTTPSocket = (function () {
  41947. function HTTPSocket(hooks, url) {
  41948. this.hooks = hooks;
  41949. this.session = randomNumber(1000) + "/" + randomString(8);
  41950. this.location = getLocation(url);
  41951. this.readyState = state.CONNECTING;
  41952. this.openStream();
  41953. }
  41954. HTTPSocket.prototype.send = function (payload) {
  41955. return this.sendRaw(JSON.stringify([payload]));
  41956. };
  41957. HTTPSocket.prototype.ping = function () {
  41958. this.hooks.sendHeartbeat(this);
  41959. };
  41960. HTTPSocket.prototype.close = function (code, reason) {
  41961. this.onClose(code, reason, true);
  41962. };
  41963. HTTPSocket.prototype.sendRaw = function (payload) {
  41964. if (this.readyState === state.OPEN) {
  41965. try {
  41966. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41967. return true;
  41968. }
  41969. catch (e) {
  41970. return false;
  41971. }
  41972. }
  41973. else {
  41974. return false;
  41975. }
  41976. };
  41977. HTTPSocket.prototype.reconnect = function () {
  41978. this.closeStream();
  41979. this.openStream();
  41980. };
  41981. ;
  41982. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  41983. this.closeStream();
  41984. this.readyState = state.CLOSED;
  41985. if (this.onclose) {
  41986. this.onclose({
  41987. code: code,
  41988. reason: reason,
  41989. wasClean: wasClean
  41990. });
  41991. }
  41992. };
  41993. HTTPSocket.prototype.onChunk = function (chunk) {
  41994. if (chunk.status !== 200) {
  41995. return;
  41996. }
  41997. if (this.readyState === state.OPEN) {
  41998. this.onActivity();
  41999. }
  42000. var payload;
  42001. var type = chunk.data.slice(0, 1);
  42002. switch (type) {
  42003. case 'o':
  42004. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42005. this.onOpen(payload);
  42006. break;
  42007. case 'a':
  42008. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42009. for (var i = 0; i < payload.length; i++) {
  42010. this.onEvent(payload[i]);
  42011. }
  42012. break;
  42013. case 'm':
  42014. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42015. this.onEvent(payload);
  42016. break;
  42017. case 'h':
  42018. this.hooks.onHeartbeat(this);
  42019. break;
  42020. case 'c':
  42021. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42022. this.onClose(payload[0], payload[1], true);
  42023. break;
  42024. }
  42025. };
  42026. HTTPSocket.prototype.onOpen = function (options) {
  42027. if (this.readyState === state.CONNECTING) {
  42028. if (options && options.hostname) {
  42029. this.location.base = replaceHost(this.location.base, options.hostname);
  42030. }
  42031. this.readyState = state.OPEN;
  42032. if (this.onopen) {
  42033. this.onopen();
  42034. }
  42035. }
  42036. else {
  42037. this.onClose(1006, "Server lost session", true);
  42038. }
  42039. };
  42040. HTTPSocket.prototype.onEvent = function (event) {
  42041. if (this.readyState === state.OPEN && this.onmessage) {
  42042. this.onmessage({ data: event });
  42043. }
  42044. };
  42045. HTTPSocket.prototype.onActivity = function () {
  42046. if (this.onactivity) {
  42047. this.onactivity();
  42048. }
  42049. };
  42050. HTTPSocket.prototype.onError = function (error) {
  42051. if (this.onerror) {
  42052. this.onerror(error);
  42053. }
  42054. };
  42055. HTTPSocket.prototype.openStream = function () {
  42056. var _this = this;
  42057. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42058. this.stream.bind("chunk", function (chunk) {
  42059. _this.onChunk(chunk);
  42060. });
  42061. this.stream.bind("finished", function (status) {
  42062. _this.hooks.onFinished(_this, status);
  42063. });
  42064. this.stream.bind("buffer_too_long", function () {
  42065. _this.reconnect();
  42066. });
  42067. try {
  42068. this.stream.start();
  42069. }
  42070. catch (error) {
  42071. util.defer(function () {
  42072. _this.onError(error);
  42073. _this.onClose(1006, "Could not start streaming", false);
  42074. });
  42075. }
  42076. };
  42077. HTTPSocket.prototype.closeStream = function () {
  42078. if (this.stream) {
  42079. this.stream.unbind_all();
  42080. this.stream.close();
  42081. this.stream = null;
  42082. }
  42083. };
  42084. return HTTPSocket;
  42085. }());
  42086. function getLocation(url) {
  42087. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42088. return {
  42089. base: parts[1],
  42090. queryString: parts[2]
  42091. };
  42092. }
  42093. function getSendURL(url, session) {
  42094. return url.base + "/" + session + "/xhr_send";
  42095. }
  42096. function getUniqueURL(url) {
  42097. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42098. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42099. }
  42100. function replaceHost(url, hostname) {
  42101. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42102. return urlParts[1] + hostname + urlParts[3];
  42103. }
  42104. function randomNumber(max) {
  42105. return Math.floor(Math.random() * max);
  42106. }
  42107. function randomString(length) {
  42108. var result = [];
  42109. for (var i = 0; i < length; i++) {
  42110. result.push(randomNumber(32).toString(32));
  42111. }
  42112. return result.join('');
  42113. }
  42114. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42115. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42116. var http_streaming_socket_hooks = {
  42117. getReceiveURL: function (url, session) {
  42118. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42119. },
  42120. onHeartbeat: function (socket) {
  42121. socket.sendRaw("[]");
  42122. },
  42123. sendHeartbeat: function (socket) {
  42124. socket.sendRaw("[]");
  42125. },
  42126. onFinished: function (socket, status) {
  42127. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42128. }
  42129. };
  42130. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42131. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42132. var http_polling_socket_hooks = {
  42133. getReceiveURL: function (url, session) {
  42134. return url.base + "/" + session + "/xhr" + url.queryString;
  42135. },
  42136. onHeartbeat: function () {
  42137. },
  42138. sendHeartbeat: function (socket) {
  42139. socket.sendRaw("[]");
  42140. },
  42141. onFinished: function (socket, status) {
  42142. if (status === 200) {
  42143. socket.reconnect();
  42144. }
  42145. else {
  42146. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42147. }
  42148. }
  42149. };
  42150. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42151. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42152. var http_xhr_request_hooks = {
  42153. getRequest: function (socket) {
  42154. var Constructor = runtime.getXHRAPI();
  42155. var xhr = new Constructor();
  42156. xhr.onreadystatechange = xhr.onprogress = function () {
  42157. switch (xhr.readyState) {
  42158. case 3:
  42159. if (xhr.responseText && xhr.responseText.length > 0) {
  42160. socket.onChunk(xhr.status, xhr.responseText);
  42161. }
  42162. break;
  42163. case 4:
  42164. if (xhr.responseText && xhr.responseText.length > 0) {
  42165. socket.onChunk(xhr.status, xhr.responseText);
  42166. }
  42167. socket.emit("finished", xhr.status);
  42168. socket.close();
  42169. break;
  42170. }
  42171. };
  42172. return xhr;
  42173. },
  42174. abortRequest: function (xhr) {
  42175. xhr.onreadystatechange = null;
  42176. xhr.abort();
  42177. }
  42178. };
  42179. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42180. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42181. var HTTP = {
  42182. createStreamingSocket: function (url) {
  42183. return this.createSocket(http_streaming_socket, url);
  42184. },
  42185. createPollingSocket: function (url) {
  42186. return this.createSocket(http_polling_socket, url);
  42187. },
  42188. createSocket: function (hooks, url) {
  42189. return new http_socket(hooks, url);
  42190. },
  42191. createXHR: function (method, url) {
  42192. return this.createRequest(http_xhr_request, method, url);
  42193. },
  42194. createRequest: function (hooks, method, url) {
  42195. return new http_request(hooks, method, url);
  42196. }
  42197. };
  42198. /* harmony default export */ var http_http = (HTTP);
  42199. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42200. http_http.createXDR = function (method, url) {
  42201. return this.createRequest(http_xdomain_request, method, url);
  42202. };
  42203. /* harmony default export */ var web_http_http = (http_http);
  42204. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42205. var Runtime = {
  42206. nextAuthCallbackID: 1,
  42207. auth_callbacks: {},
  42208. ScriptReceivers: ScriptReceivers,
  42209. DependenciesReceivers: DependenciesReceivers,
  42210. getDefaultStrategy: default_strategy,
  42211. Transports: transports_transports,
  42212. transportConnectionInitializer: transport_connection_initializer,
  42213. HTTPFactory: web_http_http,
  42214. TimelineTransport: jsonp_timeline,
  42215. getXHRAPI: function () {
  42216. return window.XMLHttpRequest;
  42217. },
  42218. getWebSocketAPI: function () {
  42219. return window.WebSocket || window.MozWebSocket;
  42220. },
  42221. setup: function (PusherClass) {
  42222. var _this = this;
  42223. window.Pusher = PusherClass;
  42224. var initializeOnDocumentBody = function () {
  42225. _this.onDocumentBody(PusherClass.ready);
  42226. };
  42227. if (!window.JSON) {
  42228. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42229. }
  42230. else {
  42231. initializeOnDocumentBody();
  42232. }
  42233. },
  42234. getDocument: function () {
  42235. return document;
  42236. },
  42237. getProtocol: function () {
  42238. return this.getDocument().location.protocol;
  42239. },
  42240. getAuthorizers: function () {
  42241. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42242. },
  42243. onDocumentBody: function (callback) {
  42244. var _this = this;
  42245. if (document.body) {
  42246. callback();
  42247. }
  42248. else {
  42249. setTimeout(function () {
  42250. _this.onDocumentBody(callback);
  42251. }, 0);
  42252. }
  42253. },
  42254. createJSONPRequest: function (url, data) {
  42255. return new jsonp_request(url, data);
  42256. },
  42257. createScriptRequest: function (src) {
  42258. return new script_request(src);
  42259. },
  42260. getLocalStorage: function () {
  42261. try {
  42262. return window.localStorage;
  42263. }
  42264. catch (e) {
  42265. return undefined;
  42266. }
  42267. },
  42268. createXHR: function () {
  42269. if (this.getXHRAPI()) {
  42270. return this.createXMLHttpRequest();
  42271. }
  42272. else {
  42273. return this.createMicrosoftXHR();
  42274. }
  42275. },
  42276. createXMLHttpRequest: function () {
  42277. var Constructor = this.getXHRAPI();
  42278. return new Constructor();
  42279. },
  42280. createMicrosoftXHR: function () {
  42281. return new ActiveXObject("Microsoft.XMLHTTP");
  42282. },
  42283. getNetwork: function () {
  42284. return net_info_Network;
  42285. },
  42286. createWebSocket: function (url) {
  42287. var Constructor = this.getWebSocketAPI();
  42288. return new Constructor(url);
  42289. },
  42290. createSocketRequest: function (method, url) {
  42291. if (this.isXHRSupported()) {
  42292. return this.HTTPFactory.createXHR(method, url);
  42293. }
  42294. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42295. return this.HTTPFactory.createXDR(method, url);
  42296. }
  42297. else {
  42298. throw "Cross-origin HTTP requests are not supported";
  42299. }
  42300. },
  42301. isXHRSupported: function () {
  42302. var Constructor = this.getXHRAPI();
  42303. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42304. },
  42305. isXDRSupported: function (useTLS) {
  42306. var protocol = useTLS ? "https:" : "http:";
  42307. var documentProtocol = this.getProtocol();
  42308. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42309. },
  42310. addUnloadListener: function (listener) {
  42311. if (window.addEventListener !== undefined) {
  42312. window.addEventListener("unload", listener, false);
  42313. }
  42314. else if (window.attachEvent !== undefined) {
  42315. window.attachEvent("onunload", listener);
  42316. }
  42317. },
  42318. removeUnloadListener: function (listener) {
  42319. if (window.addEventListener !== undefined) {
  42320. window.removeEventListener("unload", listener, false);
  42321. }
  42322. else if (window.detachEvent !== undefined) {
  42323. window.detachEvent("onunload", listener);
  42324. }
  42325. }
  42326. };
  42327. /* harmony default export */ var runtime = (Runtime);
  42328. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42329. var TimelineLevel;
  42330. (function (TimelineLevel) {
  42331. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42332. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42333. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42334. })(TimelineLevel || (TimelineLevel = {}));
  42335. /* harmony default export */ var timeline_level = (TimelineLevel);
  42336. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42337. var timeline_Timeline = (function () {
  42338. function Timeline(key, session, options) {
  42339. this.key = key;
  42340. this.session = session;
  42341. this.events = [];
  42342. this.options = options || {};
  42343. this.sent = 0;
  42344. this.uniqueID = 0;
  42345. }
  42346. Timeline.prototype.log = function (level, event) {
  42347. if (level <= this.options.level) {
  42348. this.events.push(extend({}, event, { timestamp: util.now() }));
  42349. if (this.options.limit && this.events.length > this.options.limit) {
  42350. this.events.shift();
  42351. }
  42352. }
  42353. };
  42354. Timeline.prototype.error = function (event) {
  42355. this.log(timeline_level.ERROR, event);
  42356. };
  42357. Timeline.prototype.info = function (event) {
  42358. this.log(timeline_level.INFO, event);
  42359. };
  42360. Timeline.prototype.debug = function (event) {
  42361. this.log(timeline_level.DEBUG, event);
  42362. };
  42363. Timeline.prototype.isEmpty = function () {
  42364. return this.events.length === 0;
  42365. };
  42366. Timeline.prototype.send = function (sendfn, callback) {
  42367. var _this = this;
  42368. var data = extend({
  42369. session: this.session,
  42370. bundle: this.sent + 1,
  42371. key: this.key,
  42372. lib: "js",
  42373. version: this.options.version,
  42374. cluster: this.options.cluster,
  42375. features: this.options.features,
  42376. timeline: this.events
  42377. }, this.options.params);
  42378. this.events = [];
  42379. sendfn(data, function (error, result) {
  42380. if (!error) {
  42381. _this.sent++;
  42382. }
  42383. if (callback) {
  42384. callback(error, result);
  42385. }
  42386. });
  42387. return true;
  42388. };
  42389. Timeline.prototype.generateUniqueID = function () {
  42390. this.uniqueID++;
  42391. return this.uniqueID;
  42392. };
  42393. return Timeline;
  42394. }());
  42395. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42396. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42397. var transport_strategy_TransportStrategy = (function () {
  42398. function TransportStrategy(name, priority, transport, options) {
  42399. this.name = name;
  42400. this.priority = priority;
  42401. this.transport = transport;
  42402. this.options = options || {};
  42403. }
  42404. TransportStrategy.prototype.isSupported = function () {
  42405. return this.transport.isSupported({
  42406. useTLS: this.options.useTLS
  42407. });
  42408. };
  42409. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42410. var _this = this;
  42411. if (!this.isSupported()) {
  42412. return failAttempt(new UnsupportedStrategy(), callback);
  42413. }
  42414. else if (this.priority < minPriority) {
  42415. return failAttempt(new TransportPriorityTooLow(), callback);
  42416. }
  42417. var connected = false;
  42418. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42419. var handshake = null;
  42420. var onInitialized = function () {
  42421. transport.unbind("initialized", onInitialized);
  42422. transport.connect();
  42423. };
  42424. var onOpen = function () {
  42425. handshake = factory.createHandshake(transport, function (result) {
  42426. connected = true;
  42427. unbindListeners();
  42428. callback(null, result);
  42429. });
  42430. };
  42431. var onError = function (error) {
  42432. unbindListeners();
  42433. callback(error);
  42434. };
  42435. var onClosed = function () {
  42436. unbindListeners();
  42437. var serializedTransport;
  42438. serializedTransport = safeJSONStringify(transport);
  42439. callback(new TransportClosed(serializedTransport));
  42440. };
  42441. var unbindListeners = function () {
  42442. transport.unbind("initialized", onInitialized);
  42443. transport.unbind("open", onOpen);
  42444. transport.unbind("error", onError);
  42445. transport.unbind("closed", onClosed);
  42446. };
  42447. transport.bind("initialized", onInitialized);
  42448. transport.bind("open", onOpen);
  42449. transport.bind("error", onError);
  42450. transport.bind("closed", onClosed);
  42451. transport.initialize();
  42452. return {
  42453. abort: function () {
  42454. if (connected) {
  42455. return;
  42456. }
  42457. unbindListeners();
  42458. if (handshake) {
  42459. handshake.close();
  42460. }
  42461. else {
  42462. transport.close();
  42463. }
  42464. },
  42465. forceMinPriority: function (p) {
  42466. if (connected) {
  42467. return;
  42468. }
  42469. if (_this.priority < p) {
  42470. if (handshake) {
  42471. handshake.close();
  42472. }
  42473. else {
  42474. transport.close();
  42475. }
  42476. }
  42477. }
  42478. };
  42479. };
  42480. return TransportStrategy;
  42481. }());
  42482. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42483. function failAttempt(error, callback) {
  42484. util.defer(function () {
  42485. callback(error);
  42486. });
  42487. return {
  42488. abort: function () { },
  42489. forceMinPriority: function () { }
  42490. };
  42491. }
  42492. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42493. var strategy_builder_Transports = runtime.Transports;
  42494. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42495. var transportClass = strategy_builder_Transports[type];
  42496. if (!transportClass) {
  42497. throw new UnsupportedTransport(type);
  42498. }
  42499. var enabled = (!config.enabledTransports ||
  42500. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42501. (!config.disabledTransports ||
  42502. arrayIndexOf(config.disabledTransports, name) === -1);
  42503. var transport;
  42504. if (enabled) {
  42505. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42506. key: config.key,
  42507. useTLS: config.useTLS,
  42508. timeline: config.timeline,
  42509. ignoreNullOrigin: config.ignoreNullOrigin
  42510. }, options));
  42511. }
  42512. else {
  42513. transport = strategy_builder_UnsupportedStrategy;
  42514. }
  42515. return transport;
  42516. };
  42517. var strategy_builder_UnsupportedStrategy = {
  42518. isSupported: function () {
  42519. return false;
  42520. },
  42521. connect: function (_, callback) {
  42522. var deferred = util.defer(function () {
  42523. callback(new UnsupportedStrategy());
  42524. });
  42525. return {
  42526. abort: function () {
  42527. deferred.ensureAborted();
  42528. },
  42529. forceMinPriority: function () { }
  42530. };
  42531. }
  42532. };
  42533. // CONCATENATED MODULE: ./src/core/config.ts
  42534. var getGlobalConfig = function () {
  42535. return {
  42536. wsHost: defaults.host,
  42537. wsPort: defaults.ws_port,
  42538. wssPort: defaults.wss_port,
  42539. wsPath: defaults.ws_path,
  42540. httpHost: defaults.sockjs_host,
  42541. httpPort: defaults.sockjs_http_port,
  42542. httpsPort: defaults.sockjs_https_port,
  42543. httpPath: defaults.sockjs_path,
  42544. statsHost: defaults.stats_host,
  42545. authEndpoint: defaults.channel_auth_endpoint,
  42546. authTransport: defaults.channel_auth_transport,
  42547. activity_timeout: defaults.activity_timeout,
  42548. pong_timeout: defaults.pong_timeout,
  42549. unavailable_timeout: defaults.unavailable_timeout
  42550. };
  42551. };
  42552. var getClusterConfig = function (clusterName) {
  42553. return {
  42554. wsHost: 'ws-' + clusterName + '.pusher.com',
  42555. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42556. };
  42557. };
  42558. // CONCATENATED MODULE: ./src/core/pusher.ts
  42559. var pusher_Pusher = (function () {
  42560. function Pusher(app_key, options) {
  42561. var _this = this;
  42562. checkAppKey(app_key);
  42563. options = options || {};
  42564. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42565. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42566. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42567. }
  42568. this.key = app_key;
  42569. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42570. this.channels = factory.createChannels();
  42571. this.global_emitter = new dispatcher();
  42572. this.sessionID = Math.floor(Math.random() * 1000000000);
  42573. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42574. cluster: this.config.cluster,
  42575. features: Pusher.getClientFeatures(),
  42576. params: this.config.timelineParams || {},
  42577. limit: 50,
  42578. level: timeline_level.INFO,
  42579. version: defaults.VERSION
  42580. });
  42581. if (!this.config.disableStats) {
  42582. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42583. host: this.config.statsHost,
  42584. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42585. });
  42586. }
  42587. var getStrategy = function (options) {
  42588. var config = extend({}, _this.config, options);
  42589. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42590. };
  42591. this.connection = factory.createConnectionManager(this.key, extend({
  42592. getStrategy: getStrategy,
  42593. timeline: this.timeline,
  42594. activityTimeout: this.config.activity_timeout,
  42595. pongTimeout: this.config.pong_timeout,
  42596. unavailableTimeout: this.config.unavailable_timeout
  42597. }, this.config, { useTLS: this.shouldUseTLS() }));
  42598. this.connection.bind('connected', function () {
  42599. _this.subscribeAll();
  42600. if (_this.timelineSender) {
  42601. _this.timelineSender.send(_this.connection.isUsingTLS());
  42602. }
  42603. });
  42604. this.connection.bind('message', function (event) {
  42605. var eventName = event.event;
  42606. var internal = eventName.indexOf('pusher_internal:') === 0;
  42607. if (event.channel) {
  42608. var channel = _this.channel(event.channel);
  42609. if (channel) {
  42610. channel.handleEvent(event);
  42611. }
  42612. }
  42613. if (!internal) {
  42614. _this.global_emitter.emit(event.event, event.data);
  42615. }
  42616. });
  42617. this.connection.bind('connecting', function () {
  42618. _this.channels.disconnect();
  42619. });
  42620. this.connection.bind('disconnected', function () {
  42621. _this.channels.disconnect();
  42622. });
  42623. this.connection.bind('error', function (err) {
  42624. logger.warn(err);
  42625. });
  42626. Pusher.instances.push(this);
  42627. this.timeline.info({ instances: Pusher.instances.length });
  42628. if (Pusher.isReady) {
  42629. this.connect();
  42630. }
  42631. }
  42632. Pusher.ready = function () {
  42633. Pusher.isReady = true;
  42634. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42635. Pusher.instances[i].connect();
  42636. }
  42637. };
  42638. Pusher.getClientFeatures = function () {
  42639. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42640. return t.isSupported({});
  42641. }));
  42642. };
  42643. Pusher.prototype.channel = function (name) {
  42644. return this.channels.find(name);
  42645. };
  42646. Pusher.prototype.allChannels = function () {
  42647. return this.channels.all();
  42648. };
  42649. Pusher.prototype.connect = function () {
  42650. this.connection.connect();
  42651. if (this.timelineSender) {
  42652. if (!this.timelineSenderTimer) {
  42653. var usingTLS = this.connection.isUsingTLS();
  42654. var timelineSender = this.timelineSender;
  42655. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42656. timelineSender.send(usingTLS);
  42657. });
  42658. }
  42659. }
  42660. };
  42661. Pusher.prototype.disconnect = function () {
  42662. this.connection.disconnect();
  42663. if (this.timelineSenderTimer) {
  42664. this.timelineSenderTimer.ensureAborted();
  42665. this.timelineSenderTimer = null;
  42666. }
  42667. };
  42668. Pusher.prototype.bind = function (event_name, callback, context) {
  42669. this.global_emitter.bind(event_name, callback, context);
  42670. return this;
  42671. };
  42672. Pusher.prototype.unbind = function (event_name, callback, context) {
  42673. this.global_emitter.unbind(event_name, callback, context);
  42674. return this;
  42675. };
  42676. Pusher.prototype.bind_global = function (callback) {
  42677. this.global_emitter.bind_global(callback);
  42678. return this;
  42679. };
  42680. Pusher.prototype.unbind_global = function (callback) {
  42681. this.global_emitter.unbind_global(callback);
  42682. return this;
  42683. };
  42684. Pusher.prototype.unbind_all = function (callback) {
  42685. this.global_emitter.unbind_all();
  42686. return this;
  42687. };
  42688. Pusher.prototype.subscribeAll = function () {
  42689. var channelName;
  42690. for (channelName in this.channels.channels) {
  42691. if (this.channels.channels.hasOwnProperty(channelName)) {
  42692. this.subscribe(channelName);
  42693. }
  42694. }
  42695. };
  42696. Pusher.prototype.subscribe = function (channel_name) {
  42697. var channel = this.channels.add(channel_name, this);
  42698. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42699. channel.reinstateSubscription();
  42700. }
  42701. else if (!channel.subscriptionPending &&
  42702. this.connection.state === 'connected') {
  42703. channel.subscribe();
  42704. }
  42705. return channel;
  42706. };
  42707. Pusher.prototype.unsubscribe = function (channel_name) {
  42708. var channel = this.channels.find(channel_name);
  42709. if (channel && channel.subscriptionPending) {
  42710. channel.cancelSubscription();
  42711. }
  42712. else {
  42713. channel = this.channels.remove(channel_name);
  42714. if (channel && this.connection.state === 'connected') {
  42715. channel.unsubscribe();
  42716. }
  42717. }
  42718. };
  42719. Pusher.prototype.send_event = function (event_name, data, channel) {
  42720. return this.connection.send_event(event_name, data, channel);
  42721. };
  42722. Pusher.prototype.shouldUseTLS = function () {
  42723. if (runtime.getProtocol() === 'https:') {
  42724. return true;
  42725. }
  42726. else if (this.config.forceTLS === true) {
  42727. return true;
  42728. }
  42729. else {
  42730. return Boolean(this.config.encrypted);
  42731. }
  42732. };
  42733. Pusher.instances = [];
  42734. Pusher.isReady = false;
  42735. Pusher.logToConsole = false;
  42736. Pusher.Runtime = runtime;
  42737. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42738. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42739. Pusher.auth_callbacks = runtime.auth_callbacks;
  42740. return Pusher;
  42741. }());
  42742. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42743. function checkAppKey(key) {
  42744. if (key === null || key === undefined) {
  42745. throw 'You must pass your app key when you instantiate Pusher.';
  42746. }
  42747. }
  42748. runtime.setup(pusher_Pusher);
  42749. /***/ })
  42750. /******/ ]);
  42751. });
  42752. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42753. /***/ }),
  42754. /***/ "./node_modules/setimmediate/setImmediate.js":
  42755. /*!***************************************************!*\
  42756. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42757. \***************************************************/
  42758. /*! no static exports found */
  42759. /***/ (function(module, exports, __webpack_require__) {
  42760. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42761. "use strict";
  42762. if (global.setImmediate) {
  42763. return;
  42764. }
  42765. var nextHandle = 1; // Spec says greater than zero
  42766. var tasksByHandle = {};
  42767. var currentlyRunningATask = false;
  42768. var doc = global.document;
  42769. var registerImmediate;
  42770. function setImmediate(callback) {
  42771. // Callback can either be a function or a string
  42772. if (typeof callback !== "function") {
  42773. callback = new Function("" + callback);
  42774. }
  42775. // Copy function arguments
  42776. var args = new Array(arguments.length - 1);
  42777. for (var i = 0; i < args.length; i++) {
  42778. args[i] = arguments[i + 1];
  42779. }
  42780. // Store and register the task
  42781. var task = { callback: callback, args: args };
  42782. tasksByHandle[nextHandle] = task;
  42783. registerImmediate(nextHandle);
  42784. return nextHandle++;
  42785. }
  42786. function clearImmediate(handle) {
  42787. delete tasksByHandle[handle];
  42788. }
  42789. function run(task) {
  42790. var callback = task.callback;
  42791. var args = task.args;
  42792. switch (args.length) {
  42793. case 0:
  42794. callback();
  42795. break;
  42796. case 1:
  42797. callback(args[0]);
  42798. break;
  42799. case 2:
  42800. callback(args[0], args[1]);
  42801. break;
  42802. case 3:
  42803. callback(args[0], args[1], args[2]);
  42804. break;
  42805. default:
  42806. callback.apply(undefined, args);
  42807. break;
  42808. }
  42809. }
  42810. function runIfPresent(handle) {
  42811. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42812. // So if we're currently running a task, we'll need to delay this invocation.
  42813. if (currentlyRunningATask) {
  42814. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42815. // "too much recursion" error.
  42816. setTimeout(runIfPresent, 0, handle);
  42817. } else {
  42818. var task = tasksByHandle[handle];
  42819. if (task) {
  42820. currentlyRunningATask = true;
  42821. try {
  42822. run(task);
  42823. } finally {
  42824. clearImmediate(handle);
  42825. currentlyRunningATask = false;
  42826. }
  42827. }
  42828. }
  42829. }
  42830. function installNextTickImplementation() {
  42831. registerImmediate = function(handle) {
  42832. process.nextTick(function () { runIfPresent(handle); });
  42833. };
  42834. }
  42835. function canUsePostMessage() {
  42836. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42837. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42838. if (global.postMessage && !global.importScripts) {
  42839. var postMessageIsAsynchronous = true;
  42840. var oldOnMessage = global.onmessage;
  42841. global.onmessage = function() {
  42842. postMessageIsAsynchronous = false;
  42843. };
  42844. global.postMessage("", "*");
  42845. global.onmessage = oldOnMessage;
  42846. return postMessageIsAsynchronous;
  42847. }
  42848. }
  42849. function installPostMessageImplementation() {
  42850. // Installs an event handler on `global` for the `message` event: see
  42851. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42852. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42853. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42854. var onGlobalMessage = function(event) {
  42855. if (event.source === global &&
  42856. typeof event.data === "string" &&
  42857. event.data.indexOf(messagePrefix) === 0) {
  42858. runIfPresent(+event.data.slice(messagePrefix.length));
  42859. }
  42860. };
  42861. if (global.addEventListener) {
  42862. global.addEventListener("message", onGlobalMessage, false);
  42863. } else {
  42864. global.attachEvent("onmessage", onGlobalMessage);
  42865. }
  42866. registerImmediate = function(handle) {
  42867. global.postMessage(messagePrefix + handle, "*");
  42868. };
  42869. }
  42870. function installMessageChannelImplementation() {
  42871. var channel = new MessageChannel();
  42872. channel.port1.onmessage = function(event) {
  42873. var handle = event.data;
  42874. runIfPresent(handle);
  42875. };
  42876. registerImmediate = function(handle) {
  42877. channel.port2.postMessage(handle);
  42878. };
  42879. }
  42880. function installReadyStateChangeImplementation() {
  42881. var html = doc.documentElement;
  42882. registerImmediate = function(handle) {
  42883. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42884. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42885. var script = doc.createElement("script");
  42886. script.onreadystatechange = function () {
  42887. runIfPresent(handle);
  42888. script.onreadystatechange = null;
  42889. html.removeChild(script);
  42890. script = null;
  42891. };
  42892. html.appendChild(script);
  42893. };
  42894. }
  42895. function installSetTimeoutImplementation() {
  42896. registerImmediate = function(handle) {
  42897. setTimeout(runIfPresent, 0, handle);
  42898. };
  42899. }
  42900. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42901. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42902. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42903. // Don't get fooled by e.g. browserify environments.
  42904. if ({}.toString.call(global.process) === "[object process]") {
  42905. // For Node.js before 0.9
  42906. installNextTickImplementation();
  42907. } else if (canUsePostMessage()) {
  42908. // For non-IE10 modern browsers
  42909. installPostMessageImplementation();
  42910. } else if (global.MessageChannel) {
  42911. // For web workers, where supported
  42912. installMessageChannelImplementation();
  42913. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42914. // For IE 6–8
  42915. installReadyStateChangeImplementation();
  42916. } else {
  42917. // For older browsers
  42918. installSetTimeoutImplementation();
  42919. }
  42920. attachTo.setImmediate = setImmediate;
  42921. attachTo.clearImmediate = clearImmediate;
  42922. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42923. /* 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")))
  42924. /***/ }),
  42925. /***/ "./node_modules/timers-browserify/main.js":
  42926. /*!************************************************!*\
  42927. !*** ./node_modules/timers-browserify/main.js ***!
  42928. \************************************************/
  42929. /*! no static exports found */
  42930. /***/ (function(module, exports, __webpack_require__) {
  42931. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  42932. (typeof self !== "undefined" && self) ||
  42933. window;
  42934. var apply = Function.prototype.apply;
  42935. // DOM APIs, for completeness
  42936. exports.setTimeout = function() {
  42937. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  42938. };
  42939. exports.setInterval = function() {
  42940. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  42941. };
  42942. exports.clearTimeout =
  42943. exports.clearInterval = function(timeout) {
  42944. if (timeout) {
  42945. timeout.close();
  42946. }
  42947. };
  42948. function Timeout(id, clearFn) {
  42949. this._id = id;
  42950. this._clearFn = clearFn;
  42951. }
  42952. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  42953. Timeout.prototype.close = function() {
  42954. this._clearFn.call(scope, this._id);
  42955. };
  42956. // Does not start the time, just sets up the members needed.
  42957. exports.enroll = function(item, msecs) {
  42958. clearTimeout(item._idleTimeoutId);
  42959. item._idleTimeout = msecs;
  42960. };
  42961. exports.unenroll = function(item) {
  42962. clearTimeout(item._idleTimeoutId);
  42963. item._idleTimeout = -1;
  42964. };
  42965. exports._unrefActive = exports.active = function(item) {
  42966. clearTimeout(item._idleTimeoutId);
  42967. var msecs = item._idleTimeout;
  42968. if (msecs >= 0) {
  42969. item._idleTimeoutId = setTimeout(function onTimeout() {
  42970. if (item._onTimeout)
  42971. item._onTimeout();
  42972. }, msecs);
  42973. }
  42974. };
  42975. // setimmediate attaches itself to the global object
  42976. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  42977. // On some exotic environments, it's not clear which object `setimmediate` was
  42978. // able to install onto. Search each possibility in the same order as the
  42979. // `setimmediate` library.
  42980. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  42981. (typeof global !== "undefined" && global.setImmediate) ||
  42982. (this && this.setImmediate);
  42983. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  42984. (typeof global !== "undefined" && global.clearImmediate) ||
  42985. (this && this.clearImmediate);
  42986. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  42987. /***/ }),
  42988. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  42989. /*!*******************************************************************************************************************************************************************************************************************!*\
  42990. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  42991. \*******************************************************************************************************************************************************************************************************************/
  42992. /*! exports provided: render, staticRenderFns */
  42993. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  42994. "use strict";
  42995. __webpack_require__.r(__webpack_exports__);
  42996. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  42997. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  42998. var render = function() {
  42999. var _vm = this
  43000. var _h = _vm.$createElement
  43001. var _c = _vm._self._c || _h
  43002. return _vm._m(0)
  43003. }
  43004. var staticRenderFns = [
  43005. function() {
  43006. var _vm = this
  43007. var _h = _vm.$createElement
  43008. var _c = _vm._self._c || _h
  43009. return _c("div", { staticClass: "container" }, [
  43010. _c("div", { staticClass: "row justify-content-center" }, [
  43011. _c("div", { staticClass: "col-md-8" }, [
  43012. _c("div", { staticClass: "card" }, [
  43013. _c("div", { staticClass: "card-header" }, [
  43014. _vm._v("Example Component")
  43015. ]),
  43016. _vm._v(" "),
  43017. _c("div", { staticClass: "card-body" }, [
  43018. _vm._v(
  43019. "\n I'm an example component.\n "
  43020. )
  43021. ])
  43022. ])
  43023. ])
  43024. ])
  43025. ])
  43026. }
  43027. ]
  43028. render._withStripped = true
  43029. /***/ }),
  43030. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  43031. /*!************************************************************************************************************************************************************************************************************!*\
  43032. !*** ./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=4fe1d2e3& ***!
  43033. \************************************************************************************************************************************************************************************************************/
  43034. /*! exports provided: render, staticRenderFns */
  43035. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43036. "use strict";
  43037. __webpack_require__.r(__webpack_exports__);
  43038. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43039. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43040. var render = function() {
  43041. var _vm = this
  43042. var _h = _vm.$createElement
  43043. var _c = _vm._self._c || _h
  43044. return _c(
  43045. "div",
  43046. [
  43047. _c(
  43048. "modal",
  43049. {
  43050. attrs: {
  43051. id: "asseteditModal",
  43052. tabindex: "-1",
  43053. role: "dialog",
  43054. "aria-labelledby": "asseteditModalLabel"
  43055. }
  43056. },
  43057. [
  43058. _c(
  43059. "h5",
  43060. {
  43061. staticClass: "modal-title",
  43062. attrs: { slot: "header", id: "asseteditModalLabel" },
  43063. slot: "header"
  43064. },
  43065. [_vm._v("\n Edit Work Order Information\n ")]
  43066. ),
  43067. _vm._v(" "),
  43068. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43069. _c("div", { staticClass: "form-group" }, [
  43070. _c("label", { attrs: { for: "manufacturer" } }, [
  43071. _vm._v("Manufacturer")
  43072. ]),
  43073. _vm._v(" "),
  43074. _c("input", {
  43075. directives: [
  43076. {
  43077. name: "model",
  43078. rawName: "v-model.lazy",
  43079. value: _vm.data.pcmanu,
  43080. expression: "data.pcmanu",
  43081. modifiers: { lazy: true }
  43082. }
  43083. ],
  43084. staticClass: "form-control",
  43085. attrs: {
  43086. type: "text",
  43087. name: "manufacturer",
  43088. id: "manufacturer"
  43089. },
  43090. domProps: { value: _vm.data.pcmanu },
  43091. on: {
  43092. change: function($event) {
  43093. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  43094. }
  43095. }
  43096. })
  43097. ]),
  43098. _vm._v(" "),
  43099. _c("div", { staticClass: "form-group" }, [
  43100. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  43101. _vm._v(" "),
  43102. _c("input", {
  43103. directives: [
  43104. {
  43105. name: "model",
  43106. rawName: "v-model.lazy",
  43107. value: _vm.data.pcmake,
  43108. expression: "data.pcmake",
  43109. modifiers: { lazy: true }
  43110. }
  43111. ],
  43112. staticClass: "form-control",
  43113. attrs: { type: "text", name: "make", id: "make" },
  43114. domProps: { value: _vm.data.pcmake },
  43115. on: {
  43116. change: function($event) {
  43117. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  43118. }
  43119. }
  43120. })
  43121. ]),
  43122. _vm._v(" "),
  43123. _c("div", { staticClass: "form-group" }, [
  43124. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  43125. _vm._v(" "),
  43126. _c("input", {
  43127. directives: [
  43128. {
  43129. name: "model",
  43130. rawName: "v-model.lazy",
  43131. value: _vm.data.pcnickname,
  43132. expression: "data.pcnickname",
  43133. modifiers: { lazy: true }
  43134. }
  43135. ],
  43136. staticClass: "form-control",
  43137. attrs: { type: "text", name: "nickname", id: "nickname" },
  43138. domProps: { value: _vm.data.pcnickname },
  43139. on: {
  43140. change: function($event) {
  43141. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  43142. }
  43143. }
  43144. })
  43145. ]),
  43146. _vm._v(" "),
  43147. _c("div", { staticClass: "form-group" }, [
  43148. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  43149. _vm._v(" "),
  43150. _c("input", {
  43151. directives: [
  43152. {
  43153. name: "model",
  43154. rawName: "v-model.lazy",
  43155. value: _vm.pcextra[2],
  43156. expression: "pcextra[2]",
  43157. modifiers: { lazy: true }
  43158. }
  43159. ],
  43160. staticClass: "form-control",
  43161. attrs: { type: "text", name: "os", id: "os" },
  43162. domProps: { value: _vm.pcextra[2] },
  43163. on: {
  43164. change: function($event) {
  43165. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  43166. }
  43167. }
  43168. })
  43169. ]),
  43170. _vm._v(" "),
  43171. _c("div", { staticClass: "form-group" }, [
  43172. _c("label", { attrs: { for: "serial" } }, [
  43173. _vm._v("Serial Number")
  43174. ]),
  43175. _vm._v(" "),
  43176. _c("input", {
  43177. directives: [
  43178. {
  43179. name: "model",
  43180. rawName: "v-model.lazy",
  43181. value: _vm.pcextra[104],
  43182. expression: "pcextra[104]",
  43183. modifiers: { lazy: true }
  43184. }
  43185. ],
  43186. staticClass: "form-control",
  43187. attrs: { type: "text", id: "serial", name: "serial" },
  43188. domProps: { value: _vm.pcextra[104] },
  43189. on: {
  43190. change: function($event) {
  43191. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  43192. }
  43193. }
  43194. })
  43195. ]),
  43196. _vm._v(" "),
  43197. _c("div", { staticClass: "form-group" }, [
  43198. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  43199. _vm._v(" "),
  43200. _c("input", {
  43201. directives: [
  43202. {
  43203. name: "model",
  43204. rawName: "v-model.lazy",
  43205. value: _vm.pcextra[101],
  43206. expression: "pcextra[101]",
  43207. modifiers: { lazy: true }
  43208. }
  43209. ],
  43210. staticClass: "form-control",
  43211. attrs: { type: "text", id: "cpu", name: "cpu" },
  43212. domProps: { value: _vm.pcextra[101] },
  43213. on: {
  43214. change: function($event) {
  43215. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  43216. }
  43217. }
  43218. })
  43219. ]),
  43220. _vm._v(" "),
  43221. _c("div", { staticClass: "form-group" }, [
  43222. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  43223. _vm._v(" "),
  43224. _c("input", {
  43225. directives: [
  43226. {
  43227. name: "model",
  43228. rawName: "v-model.lazy",
  43229. value: _vm.pcextra[100],
  43230. expression: "pcextra[100]",
  43231. modifiers: { lazy: true }
  43232. }
  43233. ],
  43234. staticClass: "form-control",
  43235. attrs: { type: "text", name: "ram", id: "ram" },
  43236. domProps: { value: _vm.pcextra[100] },
  43237. on: {
  43238. change: function($event) {
  43239. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  43240. }
  43241. }
  43242. })
  43243. ]),
  43244. _vm._v(" "),
  43245. _c("div", { staticClass: "form-group" }, [
  43246. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  43247. _vm._v(" "),
  43248. _c("input", {
  43249. directives: [
  43250. {
  43251. name: "model",
  43252. rawName: "v-model.lazy",
  43253. value: _vm.pcextra[4],
  43254. expression: "pcextra[4]",
  43255. modifiers: { lazy: true }
  43256. }
  43257. ],
  43258. staticClass: "form-control",
  43259. attrs: { type: "text", name: "graphics", id: "grapics" },
  43260. domProps: { value: _vm.pcextra[4] },
  43261. on: {
  43262. change: function($event) {
  43263. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  43264. }
  43265. }
  43266. })
  43267. ])
  43268. ]),
  43269. _vm._v(" "),
  43270. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43271. _c(
  43272. "button",
  43273. {
  43274. staticClass: "btn btn-secondary",
  43275. attrs: { type: "button", "data-dismiss": "modal" }
  43276. },
  43277. [_vm._v("Close")]
  43278. ),
  43279. _vm._v(" "),
  43280. _c(
  43281. "button",
  43282. {
  43283. staticClass: "btn btn-primary",
  43284. attrs: { type: "button" },
  43285. on: {
  43286. click: function($event) {
  43287. return _vm.updateAsset()
  43288. }
  43289. }
  43290. },
  43291. [_vm._v("Save")]
  43292. )
  43293. ])
  43294. ]
  43295. ),
  43296. _vm._v(" "),
  43297. _c("h4", { staticClass: "text-center" }, [
  43298. _vm._v(
  43299. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43300. ),
  43301. _c("small", { staticClass: "text-muted" }, [
  43302. _vm._v(_vm._s(this.data.pcnickname))
  43303. ])
  43304. ]),
  43305. _vm._v(" "),
  43306. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43307. _vm._v(" "),
  43308. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43309. _vm._v(" "),
  43310. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43311. _vm._v(" "),
  43312. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43313. _vm._v(" "),
  43314. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43315. _vm._v(" "),
  43316. _c(
  43317. "button",
  43318. {
  43319. staticClass: "btn btn-primary",
  43320. attrs: {
  43321. type: "button",
  43322. "data-toggle": "modal",
  43323. "data-target": "#asseteditModal"
  43324. }
  43325. },
  43326. [_vm._v("Edit")]
  43327. )
  43328. ],
  43329. 1
  43330. )
  43331. }
  43332. var staticRenderFns = []
  43333. render._withStripped = true
  43334. /***/ }),
  43335. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  43336. /*!*******************************************************************************************************************************************************************************************************************************!*\
  43337. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  43338. \*******************************************************************************************************************************************************************************************************************************/
  43339. /*! exports provided: render, staticRenderFns */
  43340. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43341. "use strict";
  43342. __webpack_require__.r(__webpack_exports__);
  43343. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43344. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43345. var render = function() {
  43346. var _vm = this
  43347. var _h = _vm.$createElement
  43348. var _c = _vm._self._c || _h
  43349. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  43350. _c("div", { staticClass: "input-group" }, [
  43351. _c("input", {
  43352. directives: [
  43353. {
  43354. name: "model",
  43355. rawName: "v-model",
  43356. value: _vm.searchText,
  43357. expression: "searchText"
  43358. }
  43359. ],
  43360. staticClass: "form-control",
  43361. attrs: { type: "text" },
  43362. domProps: { value: _vm.searchText },
  43363. on: {
  43364. input: [
  43365. function($event) {
  43366. if ($event.target.composing) {
  43367. return
  43368. }
  43369. _vm.searchText = $event.target.value
  43370. },
  43371. _vm.searchChanged
  43372. ]
  43373. }
  43374. }),
  43375. _vm._v(" "),
  43376. _c("div", { staticClass: "form-group-append" }, [
  43377. _c(
  43378. "a",
  43379. {
  43380. staticClass: "toggle input-group-text bg-primary text-light",
  43381. on: {
  43382. mousedown: function($event) {
  43383. $event.preventDefault()
  43384. },
  43385. click: function($event) {
  43386. return _vm.setOpen(!_vm.open)
  43387. }
  43388. }
  43389. },
  43390. [
  43391. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  43392. _vm._v(" "),
  43393. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  43394. ]
  43395. )
  43396. ])
  43397. ]),
  43398. _vm._v(" "),
  43399. _c(
  43400. "ul",
  43401. { staticClass: "suggestion-list list-unstyled" },
  43402. _vm._l(_vm.matches, function(suggestion, index) {
  43403. return _c(
  43404. "li",
  43405. {
  43406. key: index,
  43407. on: {
  43408. mousedown: function($event) {
  43409. $event.preventDefault()
  43410. },
  43411. click: function($event) {
  43412. return _vm.suggestionSelected(suggestion)
  43413. }
  43414. }
  43415. },
  43416. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  43417. )
  43418. }),
  43419. 0
  43420. )
  43421. ])
  43422. }
  43423. var staticRenderFns = []
  43424. render._withStripped = true
  43425. /***/ }),
  43426. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  43427. /*!************************************************************************************************************************************************************************************************************************!*\
  43428. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  43429. \************************************************************************************************************************************************************************************************************************/
  43430. /*! exports provided: render, staticRenderFns */
  43431. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43432. "use strict";
  43433. __webpack_require__.r(__webpack_exports__);
  43434. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43435. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43436. var render = function() {
  43437. var _vm = this
  43438. var _h = _vm.$createElement
  43439. var _c = _vm._self._c || _h
  43440. return _c(
  43441. "modal",
  43442. {
  43443. attrs: {
  43444. id: _vm.id,
  43445. tabindex: "-1",
  43446. role: "dialog",
  43447. "aria-labelledby": _vm.id + "Label"
  43448. }
  43449. },
  43450. [
  43451. _c(
  43452. "h5",
  43453. {
  43454. staticClass: "modal-title",
  43455. attrs: { slot: "header", id: _vm.id + "Label" },
  43456. slot: "header"
  43457. },
  43458. [_vm._v("\n Edit Credential\n ")]
  43459. ),
  43460. _vm._v(" "),
  43461. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43462. _c(
  43463. "div",
  43464. { staticClass: "form" },
  43465. [
  43466. _c("autocomplete-custom-dropdown", {
  43467. attrs: {
  43468. options: _vm.descriptions,
  43469. value: _vm.creddesc,
  43470. "allow-custom": true
  43471. },
  43472. model: {
  43473. value: _vm.creddesc,
  43474. callback: function($$v) {
  43475. _vm.creddesc = $$v
  43476. },
  43477. expression: "creddesc"
  43478. }
  43479. })
  43480. ],
  43481. 1
  43482. ),
  43483. _vm._v(" "),
  43484. _c("div", { staticClass: "form-group" }, [
  43485. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  43486. _vm._v(" "),
  43487. _c("input", {
  43488. directives: [
  43489. {
  43490. name: "model",
  43491. rawName: "v-model",
  43492. value: _vm.data.creduser,
  43493. expression: "data.creduser"
  43494. }
  43495. ],
  43496. staticClass: "form-control credential",
  43497. attrs: {
  43498. type: "text",
  43499. name: "newusername" + _vm.data.credid,
  43500. id: "newusername" + _vm.data.credid
  43501. },
  43502. domProps: { value: _vm.data.creduser },
  43503. on: {
  43504. input: function($event) {
  43505. if ($event.target.composing) {
  43506. return
  43507. }
  43508. _vm.$set(_vm.data, "creduser", $event.target.value)
  43509. }
  43510. }
  43511. })
  43512. ]),
  43513. _vm._v(" "),
  43514. _c("div", { staticClass: "form-group" }, [
  43515. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  43516. _vm._v(" "),
  43517. _c("input", {
  43518. directives: [
  43519. {
  43520. name: "model",
  43521. rawName: "v-model",
  43522. value: _vm.data.credpass,
  43523. expression: "data.credpass"
  43524. }
  43525. ],
  43526. staticClass: "form-control credential",
  43527. attrs: {
  43528. type: "text",
  43529. name: "newpassword" + _vm.data.credid,
  43530. id: "newpassword" + _vm.data.credid
  43531. },
  43532. domProps: { value: _vm.data.credpass },
  43533. on: {
  43534. input: function($event) {
  43535. if ($event.target.composing) {
  43536. return
  43537. }
  43538. _vm.$set(_vm.data, "credpass", $event.target.value)
  43539. }
  43540. }
  43541. }),
  43542. _vm._v(" "),
  43543. _c(
  43544. "button",
  43545. {
  43546. staticClass: "btn btn-secondary",
  43547. attrs: { type: "button" },
  43548. on: {
  43549. click: function($event) {
  43550. return _vm.getRandomPassword(_vm.data.credid)
  43551. }
  43552. }
  43553. },
  43554. [_vm._v("Generate Random")]
  43555. )
  43556. ]),
  43557. _vm._v(" "),
  43558. _c("div", { staticClass: "form-group" })
  43559. ]),
  43560. _vm._v(" "),
  43561. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43562. _c(
  43563. "button",
  43564. {
  43565. staticClass: "btn btn-secondary",
  43566. attrs: { type: "button", "data-dismiss": "modal" }
  43567. },
  43568. [_vm._v("Close")]
  43569. ),
  43570. _vm._v(" "),
  43571. _c(
  43572. "button",
  43573. {
  43574. staticClass: "btn btn-primary",
  43575. attrs: { type: "button" },
  43576. on: {
  43577. click: function($event) {
  43578. return _vm.updateCredential()
  43579. }
  43580. }
  43581. },
  43582. [_vm._v("Save")]
  43583. )
  43584. ])
  43585. ]
  43586. )
  43587. }
  43588. var staticRenderFns = []
  43589. render._withStripped = true
  43590. /***/ }),
  43591. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  43592. /*!******************************************************************************************************************************************************************************************************************!*\
  43593. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  43594. \******************************************************************************************************************************************************************************************************************/
  43595. /*! exports provided: render, staticRenderFns */
  43596. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43597. "use strict";
  43598. __webpack_require__.r(__webpack_exports__);
  43599. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43600. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43601. var render = function() {
  43602. var _vm = this
  43603. var _h = _vm.$createElement
  43604. var _c = _vm._self._c || _h
  43605. return _c(
  43606. "div",
  43607. [
  43608. _c("credential-form-modal", {
  43609. attrs: {
  43610. "modal-id": "newCredentialModal",
  43611. descriptions: _vm.creddescList,
  43612. create: true,
  43613. pcid: _vm.pcid
  43614. }
  43615. }),
  43616. _vm._v(" "),
  43617. _c(
  43618. "button",
  43619. {
  43620. staticClass: "btn btn-primary",
  43621. attrs: {
  43622. type: "button",
  43623. "data-toggle": "modal",
  43624. "data-target": "#newCredentialModal"
  43625. }
  43626. },
  43627. [_vm._v("New Credential")]
  43628. ),
  43629. _vm._v(" "),
  43630. _vm._l(_vm.credentials, function(credential) {
  43631. return _c(
  43632. "div",
  43633. { key: credential.credid },
  43634. [
  43635. _c("credential", {
  43636. attrs: { credential: credential, descriptions: _vm.creddescList }
  43637. })
  43638. ],
  43639. 1
  43640. )
  43641. })
  43642. ],
  43643. 2
  43644. )
  43645. }
  43646. var staticRenderFns = []
  43647. render._withStripped = true
  43648. /***/ }),
  43649. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  43650. /*!*************************************************************************************************************************************************************************************************************!*\
  43651. !*** ./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=0f5cc562& ***!
  43652. \*************************************************************************************************************************************************************************************************************/
  43653. /*! exports provided: render, staticRenderFns */
  43654. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43655. "use strict";
  43656. __webpack_require__.r(__webpack_exports__);
  43657. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43658. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43659. var render = function() {
  43660. var _vm = this
  43661. var _h = _vm.$createElement
  43662. var _c = _vm._self._c || _h
  43663. return _c(
  43664. "div",
  43665. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43666. [
  43667. _c("credential-form-modal", {
  43668. attrs: {
  43669. descriptions: _vm.creddescList,
  43670. "modal-id": "credential" + this.data.credid + "editModal",
  43671. populateWith: this.data
  43672. }
  43673. }),
  43674. _vm._v(" "),
  43675. _c(
  43676. "modal",
  43677. {
  43678. attrs: {
  43679. id: "credential" + this.data.credid + "deleteModal",
  43680. tabindex: "-1"
  43681. }
  43682. },
  43683. [
  43684. _c(
  43685. "h5",
  43686. {
  43687. staticClass: "modal-title",
  43688. attrs: {
  43689. slot: "header",
  43690. id: "credential" + this.data.credid + "deleteModalLabel"
  43691. },
  43692. slot: "header"
  43693. },
  43694. [_vm._v("\r\n Delete Credential\r\n ")]
  43695. ),
  43696. _vm._v(" "),
  43697. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43698. _vm._v("\r\n Are you sure?\r\n ")
  43699. ]),
  43700. _vm._v(" "),
  43701. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43702. _c(
  43703. "button",
  43704. {
  43705. staticClass: "btn btn-secondary",
  43706. attrs: { type: "button", "data-dismiss": "modal" }
  43707. },
  43708. [_vm._v("Cancel")]
  43709. ),
  43710. _vm._v(" "),
  43711. _c(
  43712. "button",
  43713. {
  43714. staticClass: "btn btn-danger",
  43715. attrs: { type: "button" },
  43716. on: {
  43717. click: function($event) {
  43718. return _vm.deleteCredential()
  43719. }
  43720. }
  43721. },
  43722. [_vm._v("Confirm")]
  43723. )
  43724. ])
  43725. ]
  43726. ),
  43727. _vm._v(" "),
  43728. _c("div", { staticClass: "row no-gutters" }, [
  43729. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43730. _vm._v(_vm._s(this.data.creddesc))
  43731. ]),
  43732. _vm._v(" "),
  43733. _c("div", { staticClass: "col-9 text-right" }, [
  43734. _vm._v(_vm._s(this.data.creddate))
  43735. ])
  43736. ]),
  43737. _vm._v(" "),
  43738. _c("div", { staticClass: "row" }, [
  43739. _c("div", { staticClass: "col-lg-9" }, [
  43740. _c("div", [
  43741. _vm._m(0),
  43742. _vm._v(" "),
  43743. _c("input", {
  43744. staticClass: "border-0 credential",
  43745. attrs: {
  43746. type: "text",
  43747. id: "username" + this.data.credid,
  43748. readonly: ""
  43749. },
  43750. domProps: { value: this.data.creduser }
  43751. }),
  43752. _vm._v(" "),
  43753. _c(
  43754. "button",
  43755. {
  43756. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43757. attrs: {
  43758. id: "btn-username" + this.data.credid,
  43759. "data-clipboard-target": "#username" + this.data.credid
  43760. }
  43761. },
  43762. [_c("i", { staticClass: "far fa-clone" })]
  43763. )
  43764. ]),
  43765. _vm._v(" "),
  43766. _c("div", [
  43767. _vm._m(1),
  43768. _vm._v(" "),
  43769. _c("input", {
  43770. staticClass: "border-0 credential",
  43771. attrs: {
  43772. type: "text",
  43773. id: "password" + this.data.credid,
  43774. readonly: ""
  43775. },
  43776. domProps: { value: this.data.credpass }
  43777. }),
  43778. _vm._v(" "),
  43779. _c(
  43780. "button",
  43781. {
  43782. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43783. attrs: {
  43784. id: "btn-password" + this.data.credid,
  43785. "data-clipboard-target": "#password" + this.data.credid
  43786. }
  43787. },
  43788. [_c("i", { staticClass: "far fa-clone" })]
  43789. )
  43790. ])
  43791. ]),
  43792. _vm._v(" "),
  43793. _c(
  43794. "div",
  43795. {
  43796. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43797. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43798. },
  43799. [
  43800. _c(
  43801. "button",
  43802. {
  43803. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43804. attrs: {
  43805. type: "button",
  43806. "data-toggle": "modal",
  43807. "data-target": "#credential" + this.data.credid + "editModal"
  43808. }
  43809. },
  43810. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43811. ),
  43812. _vm._v(" "),
  43813. _c(
  43814. "button",
  43815. {
  43816. staticClass: "btn btn-sm btn-danger p-lg-1",
  43817. attrs: {
  43818. type: "button",
  43819. "data-toggle": "modal",
  43820. "data-target":
  43821. "#credential" + this.data.credid + "deleteModal"
  43822. }
  43823. },
  43824. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43825. )
  43826. ]
  43827. )
  43828. ])
  43829. ],
  43830. 1
  43831. )
  43832. }
  43833. var staticRenderFns = [
  43834. function() {
  43835. var _vm = this
  43836. var _h = _vm.$createElement
  43837. var _c = _vm._self._c || _h
  43838. return _c("label", { attrs: { for: "username" } }, [
  43839. _c("i", { staticClass: "fas fa-fw fa-user" })
  43840. ])
  43841. },
  43842. function() {
  43843. var _vm = this
  43844. var _h = _vm.$createElement
  43845. var _c = _vm._self._c || _h
  43846. return _c("label", { attrs: { for: "password" } }, [
  43847. _c("i", { staticClass: "fas fa-fw fa-key" })
  43848. ])
  43849. }
  43850. ]
  43851. render._withStripped = true
  43852. /***/ }),
  43853. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  43854. /*!************************************************************************************************************************************************************************************************************!*\
  43855. !*** ./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=1546f5eb& ***!
  43856. \************************************************************************************************************************************************************************************************************/
  43857. /*! exports provided: render, staticRenderFns */
  43858. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43859. "use strict";
  43860. __webpack_require__.r(__webpack_exports__);
  43861. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43862. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43863. var render = function() {
  43864. var _vm = this
  43865. var _h = _vm.$createElement
  43866. var _c = _vm._self._c || _h
  43867. return _c(
  43868. "ul",
  43869. { staticClass: "list-unstyled" },
  43870. _vm._l(_vm.errorList, function(error) {
  43871. return _c("li", { key: error, staticClass: "text-danger" }, [
  43872. _vm._v(" " + _vm._s(error) + " ")
  43873. ])
  43874. }),
  43875. 0
  43876. )
  43877. }
  43878. var staticRenderFns = []
  43879. render._withStripped = true
  43880. /***/ }),
  43881. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  43882. /*!********************************************************************************************************************************************************************************************************!*\
  43883. !*** ./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=478d961c& ***!
  43884. \********************************************************************************************************************************************************************************************************/
  43885. /*! exports provided: render, staticRenderFns */
  43886. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43887. "use strict";
  43888. __webpack_require__.r(__webpack_exports__);
  43889. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43890. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43891. var render = function() {
  43892. var _vm = this
  43893. var _h = _vm.$createElement
  43894. var _c = _vm._self._c || _h
  43895. return _c("div", { staticClass: "modal fade" }, [
  43896. _c(
  43897. "div",
  43898. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  43899. [
  43900. _c("div", { staticClass: "modal-content" }, [
  43901. _c(
  43902. "div",
  43903. { staticClass: "modal-header" },
  43904. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  43905. 2
  43906. ),
  43907. _vm._v(" "),
  43908. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  43909. _vm._v(" "),
  43910. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  43911. ])
  43912. ]
  43913. )
  43914. ])
  43915. }
  43916. var staticRenderFns = [
  43917. function() {
  43918. var _vm = this
  43919. var _h = _vm.$createElement
  43920. var _c = _vm._self._c || _h
  43921. return _c(
  43922. "button",
  43923. {
  43924. staticClass: "close",
  43925. attrs: {
  43926. type: "button",
  43927. "data-dismiss": "modal",
  43928. "aria-label": "Close"
  43929. }
  43930. },
  43931. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  43932. )
  43933. }
  43934. ]
  43935. render._withStripped = true
  43936. /***/ }),
  43937. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  43938. /*!********************************************************************************************************************************************************************************************************!*\
  43939. !*** ./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=73d141f4& ***!
  43940. \********************************************************************************************************************************************************************************************************/
  43941. /*! exports provided: render, staticRenderFns */
  43942. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43943. "use strict";
  43944. __webpack_require__.r(__webpack_exports__);
  43945. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43946. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43947. var render = function() {
  43948. var _vm = this
  43949. var _h = _vm.$createElement
  43950. var _c = _vm._self._c || _h
  43951. return _c(
  43952. "ul",
  43953. { staticClass: "list-unstyled" },
  43954. _vm._l(this.notes, function(note) {
  43955. return _c(
  43956. "li",
  43957. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  43958. [
  43959. _c(
  43960. "modal",
  43961. {
  43962. attrs: {
  43963. id: "note" + note.noteid + "editModal",
  43964. tabindex: "-1",
  43965. role: "dialog",
  43966. "aria-labelledby": "note" + note.noteid + "editModalLabel"
  43967. }
  43968. },
  43969. [
  43970. _c(
  43971. "h5",
  43972. {
  43973. staticClass: "modal-title",
  43974. attrs: {
  43975. slot: "header",
  43976. id: "note" + note.noteid + "editModalLabel"
  43977. },
  43978. slot: "header"
  43979. },
  43980. [_vm._v("\n Edit Note\n ")]
  43981. ),
  43982. _vm._v(" "),
  43983. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43984. _c("div", { staticClass: "form-group" }, [
  43985. _c("label", { attrs: { for: "content" } }, [
  43986. _vm._v("Content")
  43987. ]),
  43988. _vm._v(" "),
  43989. _c("textarea", {
  43990. directives: [
  43991. {
  43992. name: "model",
  43993. rawName: "v-model",
  43994. value: note.thenote,
  43995. expression: "note.thenote"
  43996. }
  43997. ],
  43998. staticClass: "form-control",
  43999. attrs: {
  44000. name: "content" + note.noteid,
  44001. id: "content" + note.noteid
  44002. },
  44003. domProps: { value: note.thenote },
  44004. on: {
  44005. input: function($event) {
  44006. if ($event.target.composing) {
  44007. return
  44008. }
  44009. _vm.$set(note, "thenote", $event.target.value)
  44010. }
  44011. }
  44012. })
  44013. ])
  44014. ]),
  44015. _vm._v(" "),
  44016. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44017. _c(
  44018. "button",
  44019. {
  44020. staticClass: "btn btn-secondary",
  44021. attrs: { type: "button", "data-dismiss": "modal" }
  44022. },
  44023. [_vm._v("Close")]
  44024. ),
  44025. _vm._v(" "),
  44026. _c(
  44027. "button",
  44028. {
  44029. staticClass: "btn btn-primary",
  44030. attrs: { type: "button" },
  44031. on: {
  44032. click: function($event) {
  44033. return _vm.updateNote(note.noteid)
  44034. }
  44035. }
  44036. },
  44037. [_vm._v("Save")]
  44038. )
  44039. ])
  44040. ]
  44041. ),
  44042. _vm._v(" "),
  44043. _c("div", { staticClass: "col-md-1 d-flex flex-column mx-md-3" }, [
  44044. _c("div", { staticClass: "text-center p-0 m-0" }, [
  44045. _vm._v(_vm._s(note.noteuser))
  44046. ]),
  44047. _vm._v(" "),
  44048. _c(
  44049. "div",
  44050. { staticClass: "text-muted text-small text-center p-0 m-0" },
  44051. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  44052. ),
  44053. _vm._v(" "),
  44054. _c(
  44055. "div",
  44056. { staticClass: "btn-group justify-content-center p-0 m-0" },
  44057. [
  44058. _vm.authusername === note.noteuser ||
  44059. _vm.authusername === "admin"
  44060. ? [
  44061. _c(
  44062. "button",
  44063. {
  44064. staticClass: "btn btn-sm btn-primary m-1",
  44065. attrs: {
  44066. "data-toggle": "modal",
  44067. "data-target": "#note" + note.noteid + "editModal"
  44068. }
  44069. },
  44070. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44071. ),
  44072. _vm._v(" "),
  44073. _vm._m(0, true),
  44074. _vm._v(" "),
  44075. _vm._m(1, true)
  44076. ]
  44077. : _vm._e()
  44078. ],
  44079. 2
  44080. )
  44081. ]),
  44082. _vm._v(" "),
  44083. _c("div", { staticClass: "col-md-10" }, [
  44084. _c("div", { staticClass: "card m-2" }, [
  44085. _c("div", { staticClass: "card-body p-2" }, [
  44086. _vm._v(
  44087. "\n " +
  44088. _vm._s(note.thenote) +
  44089. "\n "
  44090. )
  44091. ])
  44092. ])
  44093. ])
  44094. ],
  44095. 1
  44096. )
  44097. }),
  44098. 0
  44099. )
  44100. }
  44101. var staticRenderFns = [
  44102. function() {
  44103. var _vm = this
  44104. var _h = _vm.$createElement
  44105. var _c = _vm._self._c || _h
  44106. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  44107. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  44108. ])
  44109. },
  44110. function() {
  44111. var _vm = this
  44112. var _h = _vm.$createElement
  44113. var _c = _vm._self._c || _h
  44114. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  44115. _c("i", { staticClass: "fa fa-fw fa-random" })
  44116. ])
  44117. }
  44118. ]
  44119. render._withStripped = true
  44120. /***/ }),
  44121. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  44122. /*!********************************************************************************************************************************************************************************************************************!*\
  44123. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  44124. \********************************************************************************************************************************************************************************************************************/
  44125. /*! exports provided: render, staticRenderFns */
  44126. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44127. "use strict";
  44128. __webpack_require__.r(__webpack_exports__);
  44129. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44130. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44131. var render = function() {
  44132. var _vm = this
  44133. var _h = _vm.$createElement
  44134. var _c = _vm._self._c || _h
  44135. return _c(
  44136. "modal",
  44137. {
  44138. attrs: {
  44139. id: _vm.id,
  44140. tabindex: "-1",
  44141. role: "dialog",
  44142. "aria-labelledby": _vm.id + "Label"
  44143. }
  44144. },
  44145. [
  44146. _c(
  44147. "h5",
  44148. {
  44149. staticClass: "modal-title",
  44150. attrs: { slot: "header", id: _vm.id + "Label" },
  44151. slot: "header"
  44152. },
  44153. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  44154. ),
  44155. _vm._v(" "),
  44156. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44157. _c(
  44158. "div",
  44159. { staticClass: "form-group" },
  44160. [
  44161. _c("label", { attrs: { for: "probdesc" } }, [
  44162. _vm._v("Problem Description")
  44163. ]),
  44164. _vm._v(" "),
  44165. _c("textarea", {
  44166. directives: [
  44167. {
  44168. name: "model",
  44169. rawName: "v-model",
  44170. value: _vm.data.probdesc,
  44171. expression: "data.probdesc"
  44172. }
  44173. ],
  44174. class: {
  44175. "form-control": true,
  44176. "is-invalid": _vm.errors.probdesc
  44177. },
  44178. attrs: { id: "probdesc", name: "probdesc" },
  44179. domProps: { value: _vm.data.probdesc },
  44180. on: {
  44181. input: function($event) {
  44182. if ($event.target.composing) {
  44183. return
  44184. }
  44185. _vm.$set(_vm.data, "probdesc", $event.target.value)
  44186. }
  44187. }
  44188. }),
  44189. _vm._v(" "),
  44190. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  44191. ],
  44192. 1
  44193. ),
  44194. _vm._v(" "),
  44195. _c(
  44196. "div",
  44197. { staticClass: "form-group" },
  44198. [
  44199. _c("label", { attrs: { for: "suggested" } }, [
  44200. _vm._v("Suggested Solution")
  44201. ]),
  44202. _vm._v(" "),
  44203. _c("textarea", {
  44204. directives: [
  44205. {
  44206. name: "model",
  44207. rawName: "v-model",
  44208. value: _vm.data.suggested,
  44209. expression: "data.suggested"
  44210. }
  44211. ],
  44212. class: {
  44213. "form-control": true,
  44214. "is-invalid": _vm.errors.suggested
  44215. },
  44216. attrs: { id: "suggested", name: "suggested" },
  44217. domProps: { value: _vm.data.suggested },
  44218. on: {
  44219. input: function($event) {
  44220. if ($event.target.composing) {
  44221. return
  44222. }
  44223. _vm.$set(_vm.data, "suggested", $event.target.value)
  44224. }
  44225. }
  44226. }),
  44227. _vm._v(" "),
  44228. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  44229. ],
  44230. 1
  44231. ),
  44232. _vm._v(" "),
  44233. _c(
  44234. "div",
  44235. { staticClass: "form-group" },
  44236. [
  44237. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  44238. _vm._v(" "),
  44239. _c("autocomplete-custom-dropdown", {
  44240. attrs: { options: _vm.storeList, value: this.store },
  44241. model: {
  44242. value: _vm.store,
  44243. callback: function($$v) {
  44244. _vm.store = $$v
  44245. },
  44246. expression: "store"
  44247. }
  44248. })
  44249. ],
  44250. 1
  44251. )
  44252. ]),
  44253. _vm._v(" "),
  44254. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44255. _c(
  44256. "button",
  44257. {
  44258. staticClass: "btn btn-secondary",
  44259. attrs: { type: "button", "data-dismiss": "modal" }
  44260. },
  44261. [_vm._v("Close")]
  44262. ),
  44263. _vm._v(" "),
  44264. _c(
  44265. "button",
  44266. {
  44267. staticClass: "btn btn-primary",
  44268. attrs: { type: "button" },
  44269. on: {
  44270. click: function($event) {
  44271. return _vm.updateWorkOrder()
  44272. }
  44273. }
  44274. },
  44275. [_vm._v("Save")]
  44276. )
  44277. ])
  44278. ]
  44279. )
  44280. }
  44281. var staticRenderFns = []
  44282. render._withStripped = true
  44283. /***/ }),
  44284. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  44285. /*!*********************************************************************************************************************************************************************************************************!*\
  44286. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  44287. \*********************************************************************************************************************************************************************************************************/
  44288. /*! exports provided: render, staticRenderFns */
  44289. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44290. "use strict";
  44291. __webpack_require__.r(__webpack_exports__);
  44292. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44293. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44294. var render = function() {
  44295. var _vm = this
  44296. var _h = _vm.$createElement
  44297. var _c = _vm._self._c || _h
  44298. return _c(
  44299. "div",
  44300. [
  44301. _c("woinfo-edit-modal", {
  44302. attrs: {
  44303. "modal-id": "workordereditModal",
  44304. "populate-with": this.data,
  44305. "store-list": this.storeList
  44306. }
  44307. }),
  44308. _vm._v(" "),
  44309. _c("p", [
  44310. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  44311. _vm._v(" "),
  44312. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  44313. ]),
  44314. _vm._v(" "),
  44315. _c("p", [
  44316. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  44317. _vm._v(" "),
  44318. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  44319. ]),
  44320. _vm._v(" "),
  44321. _c("p", [
  44322. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  44323. _vm._v(" "),
  44324. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  44325. ]),
  44326. _vm._v(" "),
  44327. _c("p", [
  44328. _c("i", { staticClass: "fas fa-fw fa-building" }),
  44329. _vm._v(" "),
  44330. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.data.storeid]))])
  44331. ]),
  44332. _vm._v(" "),
  44333. _c("p", [
  44334. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  44335. _vm._v(" "),
  44336. _c(
  44337. "span",
  44338. {
  44339. staticClass: "dashed-underline",
  44340. attrs: {
  44341. "data-toggle": "tooltip",
  44342. "data-placement": "bottom",
  44343. title: this.getHRDate(this.data.dropdate)
  44344. }
  44345. },
  44346. [
  44347. _vm._v(
  44348. "\n " +
  44349. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  44350. " days ago\n "
  44351. )
  44352. ]
  44353. )
  44354. ]),
  44355. _vm._v(" "),
  44356. _c("p", [
  44357. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44358. _vm._v(" "),
  44359. !this.isZero(this.data.pickupdate)
  44360. ? _c(
  44361. "span",
  44362. {
  44363. staticClass: "dashed-underline",
  44364. attrs: {
  44365. "data-toggle": "tooltip",
  44366. "data-placement": "bottom",
  44367. title: this.getHRDate(this.data.pickupdate)
  44368. }
  44369. },
  44370. [
  44371. _vm._v(
  44372. "\n " +
  44373. _vm._s(
  44374. Math.floor(this.daysSinceToday(this.data.pickupdate))
  44375. ) +
  44376. " days ago\n "
  44377. )
  44378. ]
  44379. )
  44380. : _vm._e()
  44381. ]),
  44382. _vm._v(" "),
  44383. _c(
  44384. "button",
  44385. {
  44386. staticClass: "btn btn-primary",
  44387. attrs: {
  44388. type: "button",
  44389. "data-toggle": "modal",
  44390. "data-target": "#workordereditModal"
  44391. }
  44392. },
  44393. [_vm._v("Edit")]
  44394. )
  44395. ],
  44396. 1
  44397. )
  44398. }
  44399. var staticRenderFns = []
  44400. render._withStripped = true
  44401. /***/ }),
  44402. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  44403. /*!********************************************************************!*\
  44404. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  44405. \********************************************************************/
  44406. /*! exports provided: default */
  44407. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44408. "use strict";
  44409. __webpack_require__.r(__webpack_exports__);
  44410. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  44411. /* globals __VUE_SSR_CONTEXT__ */
  44412. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  44413. // This module is a runtime utility for cleaner component module output and will
  44414. // be included in the final webpack user bundle.
  44415. function normalizeComponent (
  44416. scriptExports,
  44417. render,
  44418. staticRenderFns,
  44419. functionalTemplate,
  44420. injectStyles,
  44421. scopeId,
  44422. moduleIdentifier, /* server only */
  44423. shadowMode /* vue-cli only */
  44424. ) {
  44425. // Vue.extend constructor export interop
  44426. var options = typeof scriptExports === 'function'
  44427. ? scriptExports.options
  44428. : scriptExports
  44429. // render functions
  44430. if (render) {
  44431. options.render = render
  44432. options.staticRenderFns = staticRenderFns
  44433. options._compiled = true
  44434. }
  44435. // functional template
  44436. if (functionalTemplate) {
  44437. options.functional = true
  44438. }
  44439. // scopedId
  44440. if (scopeId) {
  44441. options._scopeId = 'data-v-' + scopeId
  44442. }
  44443. var hook
  44444. if (moduleIdentifier) { // server build
  44445. hook = function (context) {
  44446. // 2.3 injection
  44447. context =
  44448. context || // cached call
  44449. (this.$vnode && this.$vnode.ssrContext) || // stateful
  44450. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  44451. // 2.2 with runInNewContext: true
  44452. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  44453. context = __VUE_SSR_CONTEXT__
  44454. }
  44455. // inject component styles
  44456. if (injectStyles) {
  44457. injectStyles.call(this, context)
  44458. }
  44459. // register component module identifier for async chunk inferrence
  44460. if (context && context._registeredComponents) {
  44461. context._registeredComponents.add(moduleIdentifier)
  44462. }
  44463. }
  44464. // used by ssr in case component is cached and beforeCreate
  44465. // never gets called
  44466. options._ssrRegister = hook
  44467. } else if (injectStyles) {
  44468. hook = shadowMode
  44469. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44470. : injectStyles
  44471. }
  44472. if (hook) {
  44473. if (options.functional) {
  44474. // for template-only hot-reload because in that case the render fn doesn't
  44475. // go through the normalizer
  44476. options._injectStyles = hook
  44477. // register for functioal component in vue file
  44478. var originalRender = options.render
  44479. options.render = function renderWithStyleInjection (h, context) {
  44480. hook.call(context)
  44481. return originalRender(h, context)
  44482. }
  44483. } else {
  44484. // inject component registration as beforeCreate hook
  44485. var existing = options.beforeCreate
  44486. options.beforeCreate = existing
  44487. ? [].concat(existing, hook)
  44488. : [hook]
  44489. }
  44490. }
  44491. return {
  44492. exports: scriptExports,
  44493. options: options
  44494. }
  44495. }
  44496. /***/ }),
  44497. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  44498. /*!*************************************************!*\
  44499. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44500. \*************************************************/
  44501. /*! no static exports found */
  44502. /***/ (function(module, exports, __webpack_require__) {
  44503. "use strict";
  44504. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44505. * Vue.js v2.6.11
  44506. * (c) 2014-2019 Evan You
  44507. * Released under the MIT License.
  44508. */
  44509. /* */
  44510. var emptyObject = Object.freeze({});
  44511. // These helpers produce better VM code in JS engines due to their
  44512. // explicitness and function inlining.
  44513. function isUndef (v) {
  44514. return v === undefined || v === null
  44515. }
  44516. function isDef (v) {
  44517. return v !== undefined && v !== null
  44518. }
  44519. function isTrue (v) {
  44520. return v === true
  44521. }
  44522. function isFalse (v) {
  44523. return v === false
  44524. }
  44525. /**
  44526. * Check if value is primitive.
  44527. */
  44528. function isPrimitive (value) {
  44529. return (
  44530. typeof value === 'string' ||
  44531. typeof value === 'number' ||
  44532. // $flow-disable-line
  44533. typeof value === 'symbol' ||
  44534. typeof value === 'boolean'
  44535. )
  44536. }
  44537. /**
  44538. * Quick object check - this is primarily used to tell
  44539. * Objects from primitive values when we know the value
  44540. * is a JSON-compliant type.
  44541. */
  44542. function isObject (obj) {
  44543. return obj !== null && typeof obj === 'object'
  44544. }
  44545. /**
  44546. * Get the raw type string of a value, e.g., [object Object].
  44547. */
  44548. var _toString = Object.prototype.toString;
  44549. function toRawType (value) {
  44550. return _toString.call(value).slice(8, -1)
  44551. }
  44552. /**
  44553. * Strict object type check. Only returns true
  44554. * for plain JavaScript objects.
  44555. */
  44556. function isPlainObject (obj) {
  44557. return _toString.call(obj) === '[object Object]'
  44558. }
  44559. function isRegExp (v) {
  44560. return _toString.call(v) === '[object RegExp]'
  44561. }
  44562. /**
  44563. * Check if val is a valid array index.
  44564. */
  44565. function isValidArrayIndex (val) {
  44566. var n = parseFloat(String(val));
  44567. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44568. }
  44569. function isPromise (val) {
  44570. return (
  44571. isDef(val) &&
  44572. typeof val.then === 'function' &&
  44573. typeof val.catch === 'function'
  44574. )
  44575. }
  44576. /**
  44577. * Convert a value to a string that is actually rendered.
  44578. */
  44579. function toString (val) {
  44580. return val == null
  44581. ? ''
  44582. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44583. ? JSON.stringify(val, null, 2)
  44584. : String(val)
  44585. }
  44586. /**
  44587. * Convert an input value to a number for persistence.
  44588. * If the conversion fails, return original string.
  44589. */
  44590. function toNumber (val) {
  44591. var n = parseFloat(val);
  44592. return isNaN(n) ? val : n
  44593. }
  44594. /**
  44595. * Make a map and return a function for checking if a key
  44596. * is in that map.
  44597. */
  44598. function makeMap (
  44599. str,
  44600. expectsLowerCase
  44601. ) {
  44602. var map = Object.create(null);
  44603. var list = str.split(',');
  44604. for (var i = 0; i < list.length; i++) {
  44605. map[list[i]] = true;
  44606. }
  44607. return expectsLowerCase
  44608. ? function (val) { return map[val.toLowerCase()]; }
  44609. : function (val) { return map[val]; }
  44610. }
  44611. /**
  44612. * Check if a tag is a built-in tag.
  44613. */
  44614. var isBuiltInTag = makeMap('slot,component', true);
  44615. /**
  44616. * Check if an attribute is a reserved attribute.
  44617. */
  44618. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44619. /**
  44620. * Remove an item from an array.
  44621. */
  44622. function remove (arr, item) {
  44623. if (arr.length) {
  44624. var index = arr.indexOf(item);
  44625. if (index > -1) {
  44626. return arr.splice(index, 1)
  44627. }
  44628. }
  44629. }
  44630. /**
  44631. * Check whether an object has the property.
  44632. */
  44633. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44634. function hasOwn (obj, key) {
  44635. return hasOwnProperty.call(obj, key)
  44636. }
  44637. /**
  44638. * Create a cached version of a pure function.
  44639. */
  44640. function cached (fn) {
  44641. var cache = Object.create(null);
  44642. return (function cachedFn (str) {
  44643. var hit = cache[str];
  44644. return hit || (cache[str] = fn(str))
  44645. })
  44646. }
  44647. /**
  44648. * Camelize a hyphen-delimited string.
  44649. */
  44650. var camelizeRE = /-(\w)/g;
  44651. var camelize = cached(function (str) {
  44652. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44653. });
  44654. /**
  44655. * Capitalize a string.
  44656. */
  44657. var capitalize = cached(function (str) {
  44658. return str.charAt(0).toUpperCase() + str.slice(1)
  44659. });
  44660. /**
  44661. * Hyphenate a camelCase string.
  44662. */
  44663. var hyphenateRE = /\B([A-Z])/g;
  44664. var hyphenate = cached(function (str) {
  44665. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44666. });
  44667. /**
  44668. * Simple bind polyfill for environments that do not support it,
  44669. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44670. * since native bind is now performant enough in most browsers.
  44671. * But removing it would mean breaking code that was able to run in
  44672. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44673. */
  44674. /* istanbul ignore next */
  44675. function polyfillBind (fn, ctx) {
  44676. function boundFn (a) {
  44677. var l = arguments.length;
  44678. return l
  44679. ? l > 1
  44680. ? fn.apply(ctx, arguments)
  44681. : fn.call(ctx, a)
  44682. : fn.call(ctx)
  44683. }
  44684. boundFn._length = fn.length;
  44685. return boundFn
  44686. }
  44687. function nativeBind (fn, ctx) {
  44688. return fn.bind(ctx)
  44689. }
  44690. var bind = Function.prototype.bind
  44691. ? nativeBind
  44692. : polyfillBind;
  44693. /**
  44694. * Convert an Array-like object to a real Array.
  44695. */
  44696. function toArray (list, start) {
  44697. start = start || 0;
  44698. var i = list.length - start;
  44699. var ret = new Array(i);
  44700. while (i--) {
  44701. ret[i] = list[i + start];
  44702. }
  44703. return ret
  44704. }
  44705. /**
  44706. * Mix properties into target object.
  44707. */
  44708. function extend (to, _from) {
  44709. for (var key in _from) {
  44710. to[key] = _from[key];
  44711. }
  44712. return to
  44713. }
  44714. /**
  44715. * Merge an Array of Objects into a single Object.
  44716. */
  44717. function toObject (arr) {
  44718. var res = {};
  44719. for (var i = 0; i < arr.length; i++) {
  44720. if (arr[i]) {
  44721. extend(res, arr[i]);
  44722. }
  44723. }
  44724. return res
  44725. }
  44726. /* eslint-disable no-unused-vars */
  44727. /**
  44728. * Perform no operation.
  44729. * Stubbing args to make Flow happy without leaving useless transpiled code
  44730. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44731. */
  44732. function noop (a, b, c) {}
  44733. /**
  44734. * Always return false.
  44735. */
  44736. var no = function (a, b, c) { return false; };
  44737. /* eslint-enable no-unused-vars */
  44738. /**
  44739. * Return the same value.
  44740. */
  44741. var identity = function (_) { return _; };
  44742. /**
  44743. * Generate a string containing static keys from compiler modules.
  44744. */
  44745. function genStaticKeys (modules) {
  44746. return modules.reduce(function (keys, m) {
  44747. return keys.concat(m.staticKeys || [])
  44748. }, []).join(',')
  44749. }
  44750. /**
  44751. * Check if two values are loosely equal - that is,
  44752. * if they are plain objects, do they have the same shape?
  44753. */
  44754. function looseEqual (a, b) {
  44755. if (a === b) { return true }
  44756. var isObjectA = isObject(a);
  44757. var isObjectB = isObject(b);
  44758. if (isObjectA && isObjectB) {
  44759. try {
  44760. var isArrayA = Array.isArray(a);
  44761. var isArrayB = Array.isArray(b);
  44762. if (isArrayA && isArrayB) {
  44763. return a.length === b.length && a.every(function (e, i) {
  44764. return looseEqual(e, b[i])
  44765. })
  44766. } else if (a instanceof Date && b instanceof Date) {
  44767. return a.getTime() === b.getTime()
  44768. } else if (!isArrayA && !isArrayB) {
  44769. var keysA = Object.keys(a);
  44770. var keysB = Object.keys(b);
  44771. return keysA.length === keysB.length && keysA.every(function (key) {
  44772. return looseEqual(a[key], b[key])
  44773. })
  44774. } else {
  44775. /* istanbul ignore next */
  44776. return false
  44777. }
  44778. } catch (e) {
  44779. /* istanbul ignore next */
  44780. return false
  44781. }
  44782. } else if (!isObjectA && !isObjectB) {
  44783. return String(a) === String(b)
  44784. } else {
  44785. return false
  44786. }
  44787. }
  44788. /**
  44789. * Return the first index at which a loosely equal value can be
  44790. * found in the array (if value is a plain object, the array must
  44791. * contain an object of the same shape), or -1 if it is not present.
  44792. */
  44793. function looseIndexOf (arr, val) {
  44794. for (var i = 0; i < arr.length; i++) {
  44795. if (looseEqual(arr[i], val)) { return i }
  44796. }
  44797. return -1
  44798. }
  44799. /**
  44800. * Ensure a function is called only once.
  44801. */
  44802. function once (fn) {
  44803. var called = false;
  44804. return function () {
  44805. if (!called) {
  44806. called = true;
  44807. fn.apply(this, arguments);
  44808. }
  44809. }
  44810. }
  44811. var SSR_ATTR = 'data-server-rendered';
  44812. var ASSET_TYPES = [
  44813. 'component',
  44814. 'directive',
  44815. 'filter'
  44816. ];
  44817. var LIFECYCLE_HOOKS = [
  44818. 'beforeCreate',
  44819. 'created',
  44820. 'beforeMount',
  44821. 'mounted',
  44822. 'beforeUpdate',
  44823. 'updated',
  44824. 'beforeDestroy',
  44825. 'destroyed',
  44826. 'activated',
  44827. 'deactivated',
  44828. 'errorCaptured',
  44829. 'serverPrefetch'
  44830. ];
  44831. /* */
  44832. var config = ({
  44833. /**
  44834. * Option merge strategies (used in core/util/options)
  44835. */
  44836. // $flow-disable-line
  44837. optionMergeStrategies: Object.create(null),
  44838. /**
  44839. * Whether to suppress warnings.
  44840. */
  44841. silent: false,
  44842. /**
  44843. * Show production mode tip message on boot?
  44844. */
  44845. productionTip: "development" !== 'production',
  44846. /**
  44847. * Whether to enable devtools
  44848. */
  44849. devtools: "development" !== 'production',
  44850. /**
  44851. * Whether to record perf
  44852. */
  44853. performance: false,
  44854. /**
  44855. * Error handler for watcher errors
  44856. */
  44857. errorHandler: null,
  44858. /**
  44859. * Warn handler for watcher warns
  44860. */
  44861. warnHandler: null,
  44862. /**
  44863. * Ignore certain custom elements
  44864. */
  44865. ignoredElements: [],
  44866. /**
  44867. * Custom user key aliases for v-on
  44868. */
  44869. // $flow-disable-line
  44870. keyCodes: Object.create(null),
  44871. /**
  44872. * Check if a tag is reserved so that it cannot be registered as a
  44873. * component. This is platform-dependent and may be overwritten.
  44874. */
  44875. isReservedTag: no,
  44876. /**
  44877. * Check if an attribute is reserved so that it cannot be used as a component
  44878. * prop. This is platform-dependent and may be overwritten.
  44879. */
  44880. isReservedAttr: no,
  44881. /**
  44882. * Check if a tag is an unknown element.
  44883. * Platform-dependent.
  44884. */
  44885. isUnknownElement: no,
  44886. /**
  44887. * Get the namespace of an element
  44888. */
  44889. getTagNamespace: noop,
  44890. /**
  44891. * Parse the real tag name for the specific platform.
  44892. */
  44893. parsePlatformTagName: identity,
  44894. /**
  44895. * Check if an attribute must be bound using property, e.g. value
  44896. * Platform-dependent.
  44897. */
  44898. mustUseProp: no,
  44899. /**
  44900. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  44901. * This will significantly reduce performance if set to false.
  44902. */
  44903. async: true,
  44904. /**
  44905. * Exposed for legacy reasons
  44906. */
  44907. _lifecycleHooks: LIFECYCLE_HOOKS
  44908. });
  44909. /* */
  44910. /**
  44911. * unicode letters used for parsing html tags, component names and property paths.
  44912. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  44913. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  44914. */
  44915. 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/;
  44916. /**
  44917. * Check if a string starts with $ or _
  44918. */
  44919. function isReserved (str) {
  44920. var c = (str + '').charCodeAt(0);
  44921. return c === 0x24 || c === 0x5F
  44922. }
  44923. /**
  44924. * Define a property.
  44925. */
  44926. function def (obj, key, val, enumerable) {
  44927. Object.defineProperty(obj, key, {
  44928. value: val,
  44929. enumerable: !!enumerable,
  44930. writable: true,
  44931. configurable: true
  44932. });
  44933. }
  44934. /**
  44935. * Parse simple path.
  44936. */
  44937. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  44938. function parsePath (path) {
  44939. if (bailRE.test(path)) {
  44940. return
  44941. }
  44942. var segments = path.split('.');
  44943. return function (obj) {
  44944. for (var i = 0; i < segments.length; i++) {
  44945. if (!obj) { return }
  44946. obj = obj[segments[i]];
  44947. }
  44948. return obj
  44949. }
  44950. }
  44951. /* */
  44952. // can we use __proto__?
  44953. var hasProto = '__proto__' in {};
  44954. // Browser environment sniffing
  44955. var inBrowser = typeof window !== 'undefined';
  44956. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  44957. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  44958. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  44959. var isIE = UA && /msie|trident/.test(UA);
  44960. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  44961. var isEdge = UA && UA.indexOf('edge/') > 0;
  44962. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  44963. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  44964. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  44965. var isPhantomJS = UA && /phantomjs/.test(UA);
  44966. var isFF = UA && UA.match(/firefox\/(\d+)/);
  44967. // Firefox has a "watch" function on Object.prototype...
  44968. var nativeWatch = ({}).watch;
  44969. var supportsPassive = false;
  44970. if (inBrowser) {
  44971. try {
  44972. var opts = {};
  44973. Object.defineProperty(opts, 'passive', ({
  44974. get: function get () {
  44975. /* istanbul ignore next */
  44976. supportsPassive = true;
  44977. }
  44978. })); // https://github.com/facebook/flow/issues/285
  44979. window.addEventListener('test-passive', null, opts);
  44980. } catch (e) {}
  44981. }
  44982. // this needs to be lazy-evaled because vue may be required before
  44983. // vue-server-renderer can set VUE_ENV
  44984. var _isServer;
  44985. var isServerRendering = function () {
  44986. if (_isServer === undefined) {
  44987. /* istanbul ignore if */
  44988. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  44989. // detect presence of vue-server-renderer and avoid
  44990. // Webpack shimming the process
  44991. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  44992. } else {
  44993. _isServer = false;
  44994. }
  44995. }
  44996. return _isServer
  44997. };
  44998. // detect devtools
  44999. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  45000. /* istanbul ignore next */
  45001. function isNative (Ctor) {
  45002. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  45003. }
  45004. var hasSymbol =
  45005. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  45006. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  45007. var _Set;
  45008. /* istanbul ignore if */ // $flow-disable-line
  45009. if (typeof Set !== 'undefined' && isNative(Set)) {
  45010. // use native Set when available.
  45011. _Set = Set;
  45012. } else {
  45013. // a non-standard Set polyfill that only works with primitive keys.
  45014. _Set = /*@__PURE__*/(function () {
  45015. function Set () {
  45016. this.set = Object.create(null);
  45017. }
  45018. Set.prototype.has = function has (key) {
  45019. return this.set[key] === true
  45020. };
  45021. Set.prototype.add = function add (key) {
  45022. this.set[key] = true;
  45023. };
  45024. Set.prototype.clear = function clear () {
  45025. this.set = Object.create(null);
  45026. };
  45027. return Set;
  45028. }());
  45029. }
  45030. /* */
  45031. var warn = noop;
  45032. var tip = noop;
  45033. var generateComponentTrace = (noop); // work around flow check
  45034. var formatComponentName = (noop);
  45035. {
  45036. var hasConsole = typeof console !== 'undefined';
  45037. var classifyRE = /(?:^|[-_])(\w)/g;
  45038. var classify = function (str) { return str
  45039. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  45040. .replace(/[-_]/g, ''); };
  45041. warn = function (msg, vm) {
  45042. var trace = vm ? generateComponentTrace(vm) : '';
  45043. if (config.warnHandler) {
  45044. config.warnHandler.call(null, msg, vm, trace);
  45045. } else if (hasConsole && (!config.silent)) {
  45046. console.error(("[Vue warn]: " + msg + trace));
  45047. }
  45048. };
  45049. tip = function (msg, vm) {
  45050. if (hasConsole && (!config.silent)) {
  45051. console.warn("[Vue tip]: " + msg + (
  45052. vm ? generateComponentTrace(vm) : ''
  45053. ));
  45054. }
  45055. };
  45056. formatComponentName = function (vm, includeFile) {
  45057. if (vm.$root === vm) {
  45058. return '<Root>'
  45059. }
  45060. var options = typeof vm === 'function' && vm.cid != null
  45061. ? vm.options
  45062. : vm._isVue
  45063. ? vm.$options || vm.constructor.options
  45064. : vm;
  45065. var name = options.name || options._componentTag;
  45066. var file = options.__file;
  45067. if (!name && file) {
  45068. var match = file.match(/([^/\\]+)\.vue$/);
  45069. name = match && match[1];
  45070. }
  45071. return (
  45072. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  45073. (file && includeFile !== false ? (" at " + file) : '')
  45074. )
  45075. };
  45076. var repeat = function (str, n) {
  45077. var res = '';
  45078. while (n) {
  45079. if (n % 2 === 1) { res += str; }
  45080. if (n > 1) { str += str; }
  45081. n >>= 1;
  45082. }
  45083. return res
  45084. };
  45085. generateComponentTrace = function (vm) {
  45086. if (vm._isVue && vm.$parent) {
  45087. var tree = [];
  45088. var currentRecursiveSequence = 0;
  45089. while (vm) {
  45090. if (tree.length > 0) {
  45091. var last = tree[tree.length - 1];
  45092. if (last.constructor === vm.constructor) {
  45093. currentRecursiveSequence++;
  45094. vm = vm.$parent;
  45095. continue
  45096. } else if (currentRecursiveSequence > 0) {
  45097. tree[tree.length - 1] = [last, currentRecursiveSequence];
  45098. currentRecursiveSequence = 0;
  45099. }
  45100. }
  45101. tree.push(vm);
  45102. vm = vm.$parent;
  45103. }
  45104. return '\n\nfound in\n\n' + tree
  45105. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  45106. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  45107. : formatComponentName(vm))); })
  45108. .join('\n')
  45109. } else {
  45110. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  45111. }
  45112. };
  45113. }
  45114. /* */
  45115. var uid = 0;
  45116. /**
  45117. * A dep is an observable that can have multiple
  45118. * directives subscribing to it.
  45119. */
  45120. var Dep = function Dep () {
  45121. this.id = uid++;
  45122. this.subs = [];
  45123. };
  45124. Dep.prototype.addSub = function addSub (sub) {
  45125. this.subs.push(sub);
  45126. };
  45127. Dep.prototype.removeSub = function removeSub (sub) {
  45128. remove(this.subs, sub);
  45129. };
  45130. Dep.prototype.depend = function depend () {
  45131. if (Dep.target) {
  45132. Dep.target.addDep(this);
  45133. }
  45134. };
  45135. Dep.prototype.notify = function notify () {
  45136. // stabilize the subscriber list first
  45137. var subs = this.subs.slice();
  45138. if (!config.async) {
  45139. // subs aren't sorted in scheduler if not running async
  45140. // we need to sort them now to make sure they fire in correct
  45141. // order
  45142. subs.sort(function (a, b) { return a.id - b.id; });
  45143. }
  45144. for (var i = 0, l = subs.length; i < l; i++) {
  45145. subs[i].update();
  45146. }
  45147. };
  45148. // The current target watcher being evaluated.
  45149. // This is globally unique because only one watcher
  45150. // can be evaluated at a time.
  45151. Dep.target = null;
  45152. var targetStack = [];
  45153. function pushTarget (target) {
  45154. targetStack.push(target);
  45155. Dep.target = target;
  45156. }
  45157. function popTarget () {
  45158. targetStack.pop();
  45159. Dep.target = targetStack[targetStack.length - 1];
  45160. }
  45161. /* */
  45162. var VNode = function VNode (
  45163. tag,
  45164. data,
  45165. children,
  45166. text,
  45167. elm,
  45168. context,
  45169. componentOptions,
  45170. asyncFactory
  45171. ) {
  45172. this.tag = tag;
  45173. this.data = data;
  45174. this.children = children;
  45175. this.text = text;
  45176. this.elm = elm;
  45177. this.ns = undefined;
  45178. this.context = context;
  45179. this.fnContext = undefined;
  45180. this.fnOptions = undefined;
  45181. this.fnScopeId = undefined;
  45182. this.key = data && data.key;
  45183. this.componentOptions = componentOptions;
  45184. this.componentInstance = undefined;
  45185. this.parent = undefined;
  45186. this.raw = false;
  45187. this.isStatic = false;
  45188. this.isRootInsert = true;
  45189. this.isComment = false;
  45190. this.isCloned = false;
  45191. this.isOnce = false;
  45192. this.asyncFactory = asyncFactory;
  45193. this.asyncMeta = undefined;
  45194. this.isAsyncPlaceholder = false;
  45195. };
  45196. var prototypeAccessors = { child: { configurable: true } };
  45197. // DEPRECATED: alias for componentInstance for backwards compat.
  45198. /* istanbul ignore next */
  45199. prototypeAccessors.child.get = function () {
  45200. return this.componentInstance
  45201. };
  45202. Object.defineProperties( VNode.prototype, prototypeAccessors );
  45203. var createEmptyVNode = function (text) {
  45204. if ( text === void 0 ) text = '';
  45205. var node = new VNode();
  45206. node.text = text;
  45207. node.isComment = true;
  45208. return node
  45209. };
  45210. function createTextVNode (val) {
  45211. return new VNode(undefined, undefined, undefined, String(val))
  45212. }
  45213. // optimized shallow clone
  45214. // used for static nodes and slot nodes because they may be reused across
  45215. // multiple renders, cloning them avoids errors when DOM manipulations rely
  45216. // on their elm reference.
  45217. function cloneVNode (vnode) {
  45218. var cloned = new VNode(
  45219. vnode.tag,
  45220. vnode.data,
  45221. // #7975
  45222. // clone children array to avoid mutating original in case of cloning
  45223. // a child.
  45224. vnode.children && vnode.children.slice(),
  45225. vnode.text,
  45226. vnode.elm,
  45227. vnode.context,
  45228. vnode.componentOptions,
  45229. vnode.asyncFactory
  45230. );
  45231. cloned.ns = vnode.ns;
  45232. cloned.isStatic = vnode.isStatic;
  45233. cloned.key = vnode.key;
  45234. cloned.isComment = vnode.isComment;
  45235. cloned.fnContext = vnode.fnContext;
  45236. cloned.fnOptions = vnode.fnOptions;
  45237. cloned.fnScopeId = vnode.fnScopeId;
  45238. cloned.asyncMeta = vnode.asyncMeta;
  45239. cloned.isCloned = true;
  45240. return cloned
  45241. }
  45242. /*
  45243. * not type checking this file because flow doesn't play well with
  45244. * dynamically accessing methods on Array prototype
  45245. */
  45246. var arrayProto = Array.prototype;
  45247. var arrayMethods = Object.create(arrayProto);
  45248. var methodsToPatch = [
  45249. 'push',
  45250. 'pop',
  45251. 'shift',
  45252. 'unshift',
  45253. 'splice',
  45254. 'sort',
  45255. 'reverse'
  45256. ];
  45257. /**
  45258. * Intercept mutating methods and emit events
  45259. */
  45260. methodsToPatch.forEach(function (method) {
  45261. // cache original method
  45262. var original = arrayProto[method];
  45263. def(arrayMethods, method, function mutator () {
  45264. var args = [], len = arguments.length;
  45265. while ( len-- ) args[ len ] = arguments[ len ];
  45266. var result = original.apply(this, args);
  45267. var ob = this.__ob__;
  45268. var inserted;
  45269. switch (method) {
  45270. case 'push':
  45271. case 'unshift':
  45272. inserted = args;
  45273. break
  45274. case 'splice':
  45275. inserted = args.slice(2);
  45276. break
  45277. }
  45278. if (inserted) { ob.observeArray(inserted); }
  45279. // notify change
  45280. ob.dep.notify();
  45281. return result
  45282. });
  45283. });
  45284. /* */
  45285. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  45286. /**
  45287. * In some cases we may want to disable observation inside a component's
  45288. * update computation.
  45289. */
  45290. var shouldObserve = true;
  45291. function toggleObserving (value) {
  45292. shouldObserve = value;
  45293. }
  45294. /**
  45295. * Observer class that is attached to each observed
  45296. * object. Once attached, the observer converts the target
  45297. * object's property keys into getter/setters that
  45298. * collect dependencies and dispatch updates.
  45299. */
  45300. var Observer = function Observer (value) {
  45301. this.value = value;
  45302. this.dep = new Dep();
  45303. this.vmCount = 0;
  45304. def(value, '__ob__', this);
  45305. if (Array.isArray(value)) {
  45306. if (hasProto) {
  45307. protoAugment(value, arrayMethods);
  45308. } else {
  45309. copyAugment(value, arrayMethods, arrayKeys);
  45310. }
  45311. this.observeArray(value);
  45312. } else {
  45313. this.walk(value);
  45314. }
  45315. };
  45316. /**
  45317. * Walk through all properties and convert them into
  45318. * getter/setters. This method should only be called when
  45319. * value type is Object.
  45320. */
  45321. Observer.prototype.walk = function walk (obj) {
  45322. var keys = Object.keys(obj);
  45323. for (var i = 0; i < keys.length; i++) {
  45324. defineReactive$$1(obj, keys[i]);
  45325. }
  45326. };
  45327. /**
  45328. * Observe a list of Array items.
  45329. */
  45330. Observer.prototype.observeArray = function observeArray (items) {
  45331. for (var i = 0, l = items.length; i < l; i++) {
  45332. observe(items[i]);
  45333. }
  45334. };
  45335. // helpers
  45336. /**
  45337. * Augment a target Object or Array by intercepting
  45338. * the prototype chain using __proto__
  45339. */
  45340. function protoAugment (target, src) {
  45341. /* eslint-disable no-proto */
  45342. target.__proto__ = src;
  45343. /* eslint-enable no-proto */
  45344. }
  45345. /**
  45346. * Augment a target Object or Array by defining
  45347. * hidden properties.
  45348. */
  45349. /* istanbul ignore next */
  45350. function copyAugment (target, src, keys) {
  45351. for (var i = 0, l = keys.length; i < l; i++) {
  45352. var key = keys[i];
  45353. def(target, key, src[key]);
  45354. }
  45355. }
  45356. /**
  45357. * Attempt to create an observer instance for a value,
  45358. * returns the new observer if successfully observed,
  45359. * or the existing observer if the value already has one.
  45360. */
  45361. function observe (value, asRootData) {
  45362. if (!isObject(value) || value instanceof VNode) {
  45363. return
  45364. }
  45365. var ob;
  45366. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  45367. ob = value.__ob__;
  45368. } else if (
  45369. shouldObserve &&
  45370. !isServerRendering() &&
  45371. (Array.isArray(value) || isPlainObject(value)) &&
  45372. Object.isExtensible(value) &&
  45373. !value._isVue
  45374. ) {
  45375. ob = new Observer(value);
  45376. }
  45377. if (asRootData && ob) {
  45378. ob.vmCount++;
  45379. }
  45380. return ob
  45381. }
  45382. /**
  45383. * Define a reactive property on an Object.
  45384. */
  45385. function defineReactive$$1 (
  45386. obj,
  45387. key,
  45388. val,
  45389. customSetter,
  45390. shallow
  45391. ) {
  45392. var dep = new Dep();
  45393. var property = Object.getOwnPropertyDescriptor(obj, key);
  45394. if (property && property.configurable === false) {
  45395. return
  45396. }
  45397. // cater for pre-defined getter/setters
  45398. var getter = property && property.get;
  45399. var setter = property && property.set;
  45400. if ((!getter || setter) && arguments.length === 2) {
  45401. val = obj[key];
  45402. }
  45403. var childOb = !shallow && observe(val);
  45404. Object.defineProperty(obj, key, {
  45405. enumerable: true,
  45406. configurable: true,
  45407. get: function reactiveGetter () {
  45408. var value = getter ? getter.call(obj) : val;
  45409. if (Dep.target) {
  45410. dep.depend();
  45411. if (childOb) {
  45412. childOb.dep.depend();
  45413. if (Array.isArray(value)) {
  45414. dependArray(value);
  45415. }
  45416. }
  45417. }
  45418. return value
  45419. },
  45420. set: function reactiveSetter (newVal) {
  45421. var value = getter ? getter.call(obj) : val;
  45422. /* eslint-disable no-self-compare */
  45423. if (newVal === value || (newVal !== newVal && value !== value)) {
  45424. return
  45425. }
  45426. /* eslint-enable no-self-compare */
  45427. if (customSetter) {
  45428. customSetter();
  45429. }
  45430. // #7981: for accessor properties without setter
  45431. if (getter && !setter) { return }
  45432. if (setter) {
  45433. setter.call(obj, newVal);
  45434. } else {
  45435. val = newVal;
  45436. }
  45437. childOb = !shallow && observe(newVal);
  45438. dep.notify();
  45439. }
  45440. });
  45441. }
  45442. /**
  45443. * Set a property on an object. Adds the new property and
  45444. * triggers change notification if the property doesn't
  45445. * already exist.
  45446. */
  45447. function set (target, key, val) {
  45448. if (isUndef(target) || isPrimitive(target)
  45449. ) {
  45450. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  45451. }
  45452. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45453. target.length = Math.max(target.length, key);
  45454. target.splice(key, 1, val);
  45455. return val
  45456. }
  45457. if (key in target && !(key in Object.prototype)) {
  45458. target[key] = val;
  45459. return val
  45460. }
  45461. var ob = (target).__ob__;
  45462. if (target._isVue || (ob && ob.vmCount)) {
  45463. warn(
  45464. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  45465. 'at runtime - declare it upfront in the data option.'
  45466. );
  45467. return val
  45468. }
  45469. if (!ob) {
  45470. target[key] = val;
  45471. return val
  45472. }
  45473. defineReactive$$1(ob.value, key, val);
  45474. ob.dep.notify();
  45475. return val
  45476. }
  45477. /**
  45478. * Delete a property and trigger change if necessary.
  45479. */
  45480. function del (target, key) {
  45481. if (isUndef(target) || isPrimitive(target)
  45482. ) {
  45483. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  45484. }
  45485. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45486. target.splice(key, 1);
  45487. return
  45488. }
  45489. var ob = (target).__ob__;
  45490. if (target._isVue || (ob && ob.vmCount)) {
  45491. warn(
  45492. 'Avoid deleting properties on a Vue instance or its root $data ' +
  45493. '- just set it to null.'
  45494. );
  45495. return
  45496. }
  45497. if (!hasOwn(target, key)) {
  45498. return
  45499. }
  45500. delete target[key];
  45501. if (!ob) {
  45502. return
  45503. }
  45504. ob.dep.notify();
  45505. }
  45506. /**
  45507. * Collect dependencies on array elements when the array is touched, since
  45508. * we cannot intercept array element access like property getters.
  45509. */
  45510. function dependArray (value) {
  45511. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45512. e = value[i];
  45513. e && e.__ob__ && e.__ob__.dep.depend();
  45514. if (Array.isArray(e)) {
  45515. dependArray(e);
  45516. }
  45517. }
  45518. }
  45519. /* */
  45520. /**
  45521. * Option overwriting strategies are functions that handle
  45522. * how to merge a parent option value and a child option
  45523. * value into the final value.
  45524. */
  45525. var strats = config.optionMergeStrategies;
  45526. /**
  45527. * Options with restrictions
  45528. */
  45529. {
  45530. strats.el = strats.propsData = function (parent, child, vm, key) {
  45531. if (!vm) {
  45532. warn(
  45533. "option \"" + key + "\" can only be used during instance " +
  45534. 'creation with the `new` keyword.'
  45535. );
  45536. }
  45537. return defaultStrat(parent, child)
  45538. };
  45539. }
  45540. /**
  45541. * Helper that recursively merges two data objects together.
  45542. */
  45543. function mergeData (to, from) {
  45544. if (!from) { return to }
  45545. var key, toVal, fromVal;
  45546. var keys = hasSymbol
  45547. ? Reflect.ownKeys(from)
  45548. : Object.keys(from);
  45549. for (var i = 0; i < keys.length; i++) {
  45550. key = keys[i];
  45551. // in case the object is already observed...
  45552. if (key === '__ob__') { continue }
  45553. toVal = to[key];
  45554. fromVal = from[key];
  45555. if (!hasOwn(to, key)) {
  45556. set(to, key, fromVal);
  45557. } else if (
  45558. toVal !== fromVal &&
  45559. isPlainObject(toVal) &&
  45560. isPlainObject(fromVal)
  45561. ) {
  45562. mergeData(toVal, fromVal);
  45563. }
  45564. }
  45565. return to
  45566. }
  45567. /**
  45568. * Data
  45569. */
  45570. function mergeDataOrFn (
  45571. parentVal,
  45572. childVal,
  45573. vm
  45574. ) {
  45575. if (!vm) {
  45576. // in a Vue.extend merge, both should be functions
  45577. if (!childVal) {
  45578. return parentVal
  45579. }
  45580. if (!parentVal) {
  45581. return childVal
  45582. }
  45583. // when parentVal & childVal are both present,
  45584. // we need to return a function that returns the
  45585. // merged result of both functions... no need to
  45586. // check if parentVal is a function here because
  45587. // it has to be a function to pass previous merges.
  45588. return function mergedDataFn () {
  45589. return mergeData(
  45590. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45591. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45592. )
  45593. }
  45594. } else {
  45595. return function mergedInstanceDataFn () {
  45596. // instance merge
  45597. var instanceData = typeof childVal === 'function'
  45598. ? childVal.call(vm, vm)
  45599. : childVal;
  45600. var defaultData = typeof parentVal === 'function'
  45601. ? parentVal.call(vm, vm)
  45602. : parentVal;
  45603. if (instanceData) {
  45604. return mergeData(instanceData, defaultData)
  45605. } else {
  45606. return defaultData
  45607. }
  45608. }
  45609. }
  45610. }
  45611. strats.data = function (
  45612. parentVal,
  45613. childVal,
  45614. vm
  45615. ) {
  45616. if (!vm) {
  45617. if (childVal && typeof childVal !== 'function') {
  45618. warn(
  45619. 'The "data" option should be a function ' +
  45620. 'that returns a per-instance value in component ' +
  45621. 'definitions.',
  45622. vm
  45623. );
  45624. return parentVal
  45625. }
  45626. return mergeDataOrFn(parentVal, childVal)
  45627. }
  45628. return mergeDataOrFn(parentVal, childVal, vm)
  45629. };
  45630. /**
  45631. * Hooks and props are merged as arrays.
  45632. */
  45633. function mergeHook (
  45634. parentVal,
  45635. childVal
  45636. ) {
  45637. var res = childVal
  45638. ? parentVal
  45639. ? parentVal.concat(childVal)
  45640. : Array.isArray(childVal)
  45641. ? childVal
  45642. : [childVal]
  45643. : parentVal;
  45644. return res
  45645. ? dedupeHooks(res)
  45646. : res
  45647. }
  45648. function dedupeHooks (hooks) {
  45649. var res = [];
  45650. for (var i = 0; i < hooks.length; i++) {
  45651. if (res.indexOf(hooks[i]) === -1) {
  45652. res.push(hooks[i]);
  45653. }
  45654. }
  45655. return res
  45656. }
  45657. LIFECYCLE_HOOKS.forEach(function (hook) {
  45658. strats[hook] = mergeHook;
  45659. });
  45660. /**
  45661. * Assets
  45662. *
  45663. * When a vm is present (instance creation), we need to do
  45664. * a three-way merge between constructor options, instance
  45665. * options and parent options.
  45666. */
  45667. function mergeAssets (
  45668. parentVal,
  45669. childVal,
  45670. vm,
  45671. key
  45672. ) {
  45673. var res = Object.create(parentVal || null);
  45674. if (childVal) {
  45675. assertObjectType(key, childVal, vm);
  45676. return extend(res, childVal)
  45677. } else {
  45678. return res
  45679. }
  45680. }
  45681. ASSET_TYPES.forEach(function (type) {
  45682. strats[type + 's'] = mergeAssets;
  45683. });
  45684. /**
  45685. * Watchers.
  45686. *
  45687. * Watchers hashes should not overwrite one
  45688. * another, so we merge them as arrays.
  45689. */
  45690. strats.watch = function (
  45691. parentVal,
  45692. childVal,
  45693. vm,
  45694. key
  45695. ) {
  45696. // work around Firefox's Object.prototype.watch...
  45697. if (parentVal === nativeWatch) { parentVal = undefined; }
  45698. if (childVal === nativeWatch) { childVal = undefined; }
  45699. /* istanbul ignore if */
  45700. if (!childVal) { return Object.create(parentVal || null) }
  45701. {
  45702. assertObjectType(key, childVal, vm);
  45703. }
  45704. if (!parentVal) { return childVal }
  45705. var ret = {};
  45706. extend(ret, parentVal);
  45707. for (var key$1 in childVal) {
  45708. var parent = ret[key$1];
  45709. var child = childVal[key$1];
  45710. if (parent && !Array.isArray(parent)) {
  45711. parent = [parent];
  45712. }
  45713. ret[key$1] = parent
  45714. ? parent.concat(child)
  45715. : Array.isArray(child) ? child : [child];
  45716. }
  45717. return ret
  45718. };
  45719. /**
  45720. * Other object hashes.
  45721. */
  45722. strats.props =
  45723. strats.methods =
  45724. strats.inject =
  45725. strats.computed = function (
  45726. parentVal,
  45727. childVal,
  45728. vm,
  45729. key
  45730. ) {
  45731. if (childVal && "development" !== 'production') {
  45732. assertObjectType(key, childVal, vm);
  45733. }
  45734. if (!parentVal) { return childVal }
  45735. var ret = Object.create(null);
  45736. extend(ret, parentVal);
  45737. if (childVal) { extend(ret, childVal); }
  45738. return ret
  45739. };
  45740. strats.provide = mergeDataOrFn;
  45741. /**
  45742. * Default strategy.
  45743. */
  45744. var defaultStrat = function (parentVal, childVal) {
  45745. return childVal === undefined
  45746. ? parentVal
  45747. : childVal
  45748. };
  45749. /**
  45750. * Validate component names
  45751. */
  45752. function checkComponents (options) {
  45753. for (var key in options.components) {
  45754. validateComponentName(key);
  45755. }
  45756. }
  45757. function validateComponentName (name) {
  45758. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45759. warn(
  45760. 'Invalid component name: "' + name + '". Component names ' +
  45761. 'should conform to valid custom element name in html5 specification.'
  45762. );
  45763. }
  45764. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  45765. warn(
  45766. 'Do not use built-in or reserved HTML elements as component ' +
  45767. 'id: ' + name
  45768. );
  45769. }
  45770. }
  45771. /**
  45772. * Ensure all props option syntax are normalized into the
  45773. * Object-based format.
  45774. */
  45775. function normalizeProps (options, vm) {
  45776. var props = options.props;
  45777. if (!props) { return }
  45778. var res = {};
  45779. var i, val, name;
  45780. if (Array.isArray(props)) {
  45781. i = props.length;
  45782. while (i--) {
  45783. val = props[i];
  45784. if (typeof val === 'string') {
  45785. name = camelize(val);
  45786. res[name] = { type: null };
  45787. } else {
  45788. warn('props must be strings when using array syntax.');
  45789. }
  45790. }
  45791. } else if (isPlainObject(props)) {
  45792. for (var key in props) {
  45793. val = props[key];
  45794. name = camelize(key);
  45795. res[name] = isPlainObject(val)
  45796. ? val
  45797. : { type: val };
  45798. }
  45799. } else {
  45800. warn(
  45801. "Invalid value for option \"props\": expected an Array or an Object, " +
  45802. "but got " + (toRawType(props)) + ".",
  45803. vm
  45804. );
  45805. }
  45806. options.props = res;
  45807. }
  45808. /**
  45809. * Normalize all injections into Object-based format
  45810. */
  45811. function normalizeInject (options, vm) {
  45812. var inject = options.inject;
  45813. if (!inject) { return }
  45814. var normalized = options.inject = {};
  45815. if (Array.isArray(inject)) {
  45816. for (var i = 0; i < inject.length; i++) {
  45817. normalized[inject[i]] = { from: inject[i] };
  45818. }
  45819. } else if (isPlainObject(inject)) {
  45820. for (var key in inject) {
  45821. var val = inject[key];
  45822. normalized[key] = isPlainObject(val)
  45823. ? extend({ from: key }, val)
  45824. : { from: val };
  45825. }
  45826. } else {
  45827. warn(
  45828. "Invalid value for option \"inject\": expected an Array or an Object, " +
  45829. "but got " + (toRawType(inject)) + ".",
  45830. vm
  45831. );
  45832. }
  45833. }
  45834. /**
  45835. * Normalize raw function directives into object format.
  45836. */
  45837. function normalizeDirectives (options) {
  45838. var dirs = options.directives;
  45839. if (dirs) {
  45840. for (var key in dirs) {
  45841. var def$$1 = dirs[key];
  45842. if (typeof def$$1 === 'function') {
  45843. dirs[key] = { bind: def$$1, update: def$$1 };
  45844. }
  45845. }
  45846. }
  45847. }
  45848. function assertObjectType (name, value, vm) {
  45849. if (!isPlainObject(value)) {
  45850. warn(
  45851. "Invalid value for option \"" + name + "\": expected an Object, " +
  45852. "but got " + (toRawType(value)) + ".",
  45853. vm
  45854. );
  45855. }
  45856. }
  45857. /**
  45858. * Merge two option objects into a new one.
  45859. * Core utility used in both instantiation and inheritance.
  45860. */
  45861. function mergeOptions (
  45862. parent,
  45863. child,
  45864. vm
  45865. ) {
  45866. {
  45867. checkComponents(child);
  45868. }
  45869. if (typeof child === 'function') {
  45870. child = child.options;
  45871. }
  45872. normalizeProps(child, vm);
  45873. normalizeInject(child, vm);
  45874. normalizeDirectives(child);
  45875. // Apply extends and mixins on the child options,
  45876. // but only if it is a raw options object that isn't
  45877. // the result of another mergeOptions call.
  45878. // Only merged options has the _base property.
  45879. if (!child._base) {
  45880. if (child.extends) {
  45881. parent = mergeOptions(parent, child.extends, vm);
  45882. }
  45883. if (child.mixins) {
  45884. for (var i = 0, l = child.mixins.length; i < l; i++) {
  45885. parent = mergeOptions(parent, child.mixins[i], vm);
  45886. }
  45887. }
  45888. }
  45889. var options = {};
  45890. var key;
  45891. for (key in parent) {
  45892. mergeField(key);
  45893. }
  45894. for (key in child) {
  45895. if (!hasOwn(parent, key)) {
  45896. mergeField(key);
  45897. }
  45898. }
  45899. function mergeField (key) {
  45900. var strat = strats[key] || defaultStrat;
  45901. options[key] = strat(parent[key], child[key], vm, key);
  45902. }
  45903. return options
  45904. }
  45905. /**
  45906. * Resolve an asset.
  45907. * This function is used because child instances need access
  45908. * to assets defined in its ancestor chain.
  45909. */
  45910. function resolveAsset (
  45911. options,
  45912. type,
  45913. id,
  45914. warnMissing
  45915. ) {
  45916. /* istanbul ignore if */
  45917. if (typeof id !== 'string') {
  45918. return
  45919. }
  45920. var assets = options[type];
  45921. // check local registration variations first
  45922. if (hasOwn(assets, id)) { return assets[id] }
  45923. var camelizedId = camelize(id);
  45924. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  45925. var PascalCaseId = capitalize(camelizedId);
  45926. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  45927. // fallback to prototype chain
  45928. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  45929. if (warnMissing && !res) {
  45930. warn(
  45931. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  45932. options
  45933. );
  45934. }
  45935. return res
  45936. }
  45937. /* */
  45938. function validateProp (
  45939. key,
  45940. propOptions,
  45941. propsData,
  45942. vm
  45943. ) {
  45944. var prop = propOptions[key];
  45945. var absent = !hasOwn(propsData, key);
  45946. var value = propsData[key];
  45947. // boolean casting
  45948. var booleanIndex = getTypeIndex(Boolean, prop.type);
  45949. if (booleanIndex > -1) {
  45950. if (absent && !hasOwn(prop, 'default')) {
  45951. value = false;
  45952. } else if (value === '' || value === hyphenate(key)) {
  45953. // only cast empty string / same name to boolean if
  45954. // boolean has higher priority
  45955. var stringIndex = getTypeIndex(String, prop.type);
  45956. if (stringIndex < 0 || booleanIndex < stringIndex) {
  45957. value = true;
  45958. }
  45959. }
  45960. }
  45961. // check default value
  45962. if (value === undefined) {
  45963. value = getPropDefaultValue(vm, prop, key);
  45964. // since the default value is a fresh copy,
  45965. // make sure to observe it.
  45966. var prevShouldObserve = shouldObserve;
  45967. toggleObserving(true);
  45968. observe(value);
  45969. toggleObserving(prevShouldObserve);
  45970. }
  45971. {
  45972. assertProp(prop, key, value, vm, absent);
  45973. }
  45974. return value
  45975. }
  45976. /**
  45977. * Get the default value of a prop.
  45978. */
  45979. function getPropDefaultValue (vm, prop, key) {
  45980. // no default, return undefined
  45981. if (!hasOwn(prop, 'default')) {
  45982. return undefined
  45983. }
  45984. var def = prop.default;
  45985. // warn against non-factory defaults for Object & Array
  45986. if (isObject(def)) {
  45987. warn(
  45988. 'Invalid default value for prop "' + key + '": ' +
  45989. 'Props with type Object/Array must use a factory function ' +
  45990. 'to return the default value.',
  45991. vm
  45992. );
  45993. }
  45994. // the raw prop value was also undefined from previous render,
  45995. // return previous default value to avoid unnecessary watcher trigger
  45996. if (vm && vm.$options.propsData &&
  45997. vm.$options.propsData[key] === undefined &&
  45998. vm._props[key] !== undefined
  45999. ) {
  46000. return vm._props[key]
  46001. }
  46002. // call factory function for non-Function types
  46003. // a value is Function if its prototype is function even across different execution context
  46004. return typeof def === 'function' && getType(prop.type) !== 'Function'
  46005. ? def.call(vm)
  46006. : def
  46007. }
  46008. /**
  46009. * Assert whether a prop is valid.
  46010. */
  46011. function assertProp (
  46012. prop,
  46013. name,
  46014. value,
  46015. vm,
  46016. absent
  46017. ) {
  46018. if (prop.required && absent) {
  46019. warn(
  46020. 'Missing required prop: "' + name + '"',
  46021. vm
  46022. );
  46023. return
  46024. }
  46025. if (value == null && !prop.required) {
  46026. return
  46027. }
  46028. var type = prop.type;
  46029. var valid = !type || type === true;
  46030. var expectedTypes = [];
  46031. if (type) {
  46032. if (!Array.isArray(type)) {
  46033. type = [type];
  46034. }
  46035. for (var i = 0; i < type.length && !valid; i++) {
  46036. var assertedType = assertType(value, type[i]);
  46037. expectedTypes.push(assertedType.expectedType || '');
  46038. valid = assertedType.valid;
  46039. }
  46040. }
  46041. if (!valid) {
  46042. warn(
  46043. getInvalidTypeMessage(name, value, expectedTypes),
  46044. vm
  46045. );
  46046. return
  46047. }
  46048. var validator = prop.validator;
  46049. if (validator) {
  46050. if (!validator(value)) {
  46051. warn(
  46052. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  46053. vm
  46054. );
  46055. }
  46056. }
  46057. }
  46058. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  46059. function assertType (value, type) {
  46060. var valid;
  46061. var expectedType = getType(type);
  46062. if (simpleCheckRE.test(expectedType)) {
  46063. var t = typeof value;
  46064. valid = t === expectedType.toLowerCase();
  46065. // for primitive wrapper objects
  46066. if (!valid && t === 'object') {
  46067. valid = value instanceof type;
  46068. }
  46069. } else if (expectedType === 'Object') {
  46070. valid = isPlainObject(value);
  46071. } else if (expectedType === 'Array') {
  46072. valid = Array.isArray(value);
  46073. } else {
  46074. valid = value instanceof type;
  46075. }
  46076. return {
  46077. valid: valid,
  46078. expectedType: expectedType
  46079. }
  46080. }
  46081. /**
  46082. * Use function string name to check built-in types,
  46083. * because a simple equality check will fail when running
  46084. * across different vms / iframes.
  46085. */
  46086. function getType (fn) {
  46087. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  46088. return match ? match[1] : ''
  46089. }
  46090. function isSameType (a, b) {
  46091. return getType(a) === getType(b)
  46092. }
  46093. function getTypeIndex (type, expectedTypes) {
  46094. if (!Array.isArray(expectedTypes)) {
  46095. return isSameType(expectedTypes, type) ? 0 : -1
  46096. }
  46097. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  46098. if (isSameType(expectedTypes[i], type)) {
  46099. return i
  46100. }
  46101. }
  46102. return -1
  46103. }
  46104. function getInvalidTypeMessage (name, value, expectedTypes) {
  46105. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  46106. " Expected " + (expectedTypes.map(capitalize).join(', '));
  46107. var expectedType = expectedTypes[0];
  46108. var receivedType = toRawType(value);
  46109. var expectedValue = styleValue(value, expectedType);
  46110. var receivedValue = styleValue(value, receivedType);
  46111. // check if we need to specify expected value
  46112. if (expectedTypes.length === 1 &&
  46113. isExplicable(expectedType) &&
  46114. !isBoolean(expectedType, receivedType)) {
  46115. message += " with value " + expectedValue;
  46116. }
  46117. message += ", got " + receivedType + " ";
  46118. // check if we need to specify received value
  46119. if (isExplicable(receivedType)) {
  46120. message += "with value " + receivedValue + ".";
  46121. }
  46122. return message
  46123. }
  46124. function styleValue (value, type) {
  46125. if (type === 'String') {
  46126. return ("\"" + value + "\"")
  46127. } else if (type === 'Number') {
  46128. return ("" + (Number(value)))
  46129. } else {
  46130. return ("" + value)
  46131. }
  46132. }
  46133. function isExplicable (value) {
  46134. var explicitTypes = ['string', 'number', 'boolean'];
  46135. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  46136. }
  46137. function isBoolean () {
  46138. var args = [], len = arguments.length;
  46139. while ( len-- ) args[ len ] = arguments[ len ];
  46140. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  46141. }
  46142. /* */
  46143. function handleError (err, vm, info) {
  46144. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  46145. // See: https://github.com/vuejs/vuex/issues/1505
  46146. pushTarget();
  46147. try {
  46148. if (vm) {
  46149. var cur = vm;
  46150. while ((cur = cur.$parent)) {
  46151. var hooks = cur.$options.errorCaptured;
  46152. if (hooks) {
  46153. for (var i = 0; i < hooks.length; i++) {
  46154. try {
  46155. var capture = hooks[i].call(cur, err, vm, info) === false;
  46156. if (capture) { return }
  46157. } catch (e) {
  46158. globalHandleError(e, cur, 'errorCaptured hook');
  46159. }
  46160. }
  46161. }
  46162. }
  46163. }
  46164. globalHandleError(err, vm, info);
  46165. } finally {
  46166. popTarget();
  46167. }
  46168. }
  46169. function invokeWithErrorHandling (
  46170. handler,
  46171. context,
  46172. args,
  46173. vm,
  46174. info
  46175. ) {
  46176. var res;
  46177. try {
  46178. res = args ? handler.apply(context, args) : handler.call(context);
  46179. if (res && !res._isVue && isPromise(res) && !res._handled) {
  46180. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  46181. // issue #9511
  46182. // avoid catch triggering multiple times when nested calls
  46183. res._handled = true;
  46184. }
  46185. } catch (e) {
  46186. handleError(e, vm, info);
  46187. }
  46188. return res
  46189. }
  46190. function globalHandleError (err, vm, info) {
  46191. if (config.errorHandler) {
  46192. try {
  46193. return config.errorHandler.call(null, err, vm, info)
  46194. } catch (e) {
  46195. // if the user intentionally throws the original error in the handler,
  46196. // do not log it twice
  46197. if (e !== err) {
  46198. logError(e, null, 'config.errorHandler');
  46199. }
  46200. }
  46201. }
  46202. logError(err, vm, info);
  46203. }
  46204. function logError (err, vm, info) {
  46205. {
  46206. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  46207. }
  46208. /* istanbul ignore else */
  46209. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  46210. console.error(err);
  46211. } else {
  46212. throw err
  46213. }
  46214. }
  46215. /* */
  46216. var isUsingMicroTask = false;
  46217. var callbacks = [];
  46218. var pending = false;
  46219. function flushCallbacks () {
  46220. pending = false;
  46221. var copies = callbacks.slice(0);
  46222. callbacks.length = 0;
  46223. for (var i = 0; i < copies.length; i++) {
  46224. copies[i]();
  46225. }
  46226. }
  46227. // Here we have async deferring wrappers using microtasks.
  46228. // In 2.5 we used (macro) tasks (in combination with microtasks).
  46229. // However, it has subtle problems when state is changed right before repaint
  46230. // (e.g. #6813, out-in transitions).
  46231. // Also, using (macro) tasks in event handler would cause some weird behaviors
  46232. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  46233. // So we now use microtasks everywhere, again.
  46234. // A major drawback of this tradeoff is that there are some scenarios
  46235. // where microtasks have too high a priority and fire in between supposedly
  46236. // sequential events (e.g. #4521, #6690, which have workarounds)
  46237. // or even between bubbling of the same event (#6566).
  46238. var timerFunc;
  46239. // The nextTick behavior leverages the microtask queue, which can be accessed
  46240. // via either native Promise.then or MutationObserver.
  46241. // MutationObserver has wider support, however it is seriously bugged in
  46242. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  46243. // completely stops working after triggering a few times... so, if native
  46244. // Promise is available, we will use it:
  46245. /* istanbul ignore next, $flow-disable-line */
  46246. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  46247. var p = Promise.resolve();
  46248. timerFunc = function () {
  46249. p.then(flushCallbacks);
  46250. // In problematic UIWebViews, Promise.then doesn't completely break, but
  46251. // it can get stuck in a weird state where callbacks are pushed into the
  46252. // microtask queue but the queue isn't being flushed, until the browser
  46253. // needs to do some other work, e.g. handle a timer. Therefore we can
  46254. // "force" the microtask queue to be flushed by adding an empty timer.
  46255. if (isIOS) { setTimeout(noop); }
  46256. };
  46257. isUsingMicroTask = true;
  46258. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  46259. isNative(MutationObserver) ||
  46260. // PhantomJS and iOS 7.x
  46261. MutationObserver.toString() === '[object MutationObserverConstructor]'
  46262. )) {
  46263. // Use MutationObserver where native Promise is not available,
  46264. // e.g. PhantomJS, iOS7, Android 4.4
  46265. // (#6466 MutationObserver is unreliable in IE11)
  46266. var counter = 1;
  46267. var observer = new MutationObserver(flushCallbacks);
  46268. var textNode = document.createTextNode(String(counter));
  46269. observer.observe(textNode, {
  46270. characterData: true
  46271. });
  46272. timerFunc = function () {
  46273. counter = (counter + 1) % 2;
  46274. textNode.data = String(counter);
  46275. };
  46276. isUsingMicroTask = true;
  46277. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  46278. // Fallback to setImmediate.
  46279. // Technically it leverages the (macro) task queue,
  46280. // but it is still a better choice than setTimeout.
  46281. timerFunc = function () {
  46282. setImmediate(flushCallbacks);
  46283. };
  46284. } else {
  46285. // Fallback to setTimeout.
  46286. timerFunc = function () {
  46287. setTimeout(flushCallbacks, 0);
  46288. };
  46289. }
  46290. function nextTick (cb, ctx) {
  46291. var _resolve;
  46292. callbacks.push(function () {
  46293. if (cb) {
  46294. try {
  46295. cb.call(ctx);
  46296. } catch (e) {
  46297. handleError(e, ctx, 'nextTick');
  46298. }
  46299. } else if (_resolve) {
  46300. _resolve(ctx);
  46301. }
  46302. });
  46303. if (!pending) {
  46304. pending = true;
  46305. timerFunc();
  46306. }
  46307. // $flow-disable-line
  46308. if (!cb && typeof Promise !== 'undefined') {
  46309. return new Promise(function (resolve) {
  46310. _resolve = resolve;
  46311. })
  46312. }
  46313. }
  46314. /* */
  46315. var mark;
  46316. var measure;
  46317. {
  46318. var perf = inBrowser && window.performance;
  46319. /* istanbul ignore if */
  46320. if (
  46321. perf &&
  46322. perf.mark &&
  46323. perf.measure &&
  46324. perf.clearMarks &&
  46325. perf.clearMeasures
  46326. ) {
  46327. mark = function (tag) { return perf.mark(tag); };
  46328. measure = function (name, startTag, endTag) {
  46329. perf.measure(name, startTag, endTag);
  46330. perf.clearMarks(startTag);
  46331. perf.clearMarks(endTag);
  46332. // perf.clearMeasures(name)
  46333. };
  46334. }
  46335. }
  46336. /* not type checking this file because flow doesn't play well with Proxy */
  46337. var initProxy;
  46338. {
  46339. var allowedGlobals = makeMap(
  46340. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  46341. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  46342. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  46343. 'require' // for Webpack/Browserify
  46344. );
  46345. var warnNonPresent = function (target, key) {
  46346. warn(
  46347. "Property or method \"" + key + "\" is not defined on the instance but " +
  46348. 'referenced during render. Make sure that this property is reactive, ' +
  46349. 'either in the data option, or for class-based components, by ' +
  46350. 'initializing the property. ' +
  46351. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  46352. target
  46353. );
  46354. };
  46355. var warnReservedPrefix = function (target, key) {
  46356. warn(
  46357. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  46358. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  46359. 'prevent conflicts with Vue internals. ' +
  46360. 'See: https://vuejs.org/v2/api/#data',
  46361. target
  46362. );
  46363. };
  46364. var hasProxy =
  46365. typeof Proxy !== 'undefined' && isNative(Proxy);
  46366. if (hasProxy) {
  46367. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  46368. config.keyCodes = new Proxy(config.keyCodes, {
  46369. set: function set (target, key, value) {
  46370. if (isBuiltInModifier(key)) {
  46371. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  46372. return false
  46373. } else {
  46374. target[key] = value;
  46375. return true
  46376. }
  46377. }
  46378. });
  46379. }
  46380. var hasHandler = {
  46381. has: function has (target, key) {
  46382. var has = key in target;
  46383. var isAllowed = allowedGlobals(key) ||
  46384. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  46385. if (!has && !isAllowed) {
  46386. if (key in target.$data) { warnReservedPrefix(target, key); }
  46387. else { warnNonPresent(target, key); }
  46388. }
  46389. return has || !isAllowed
  46390. }
  46391. };
  46392. var getHandler = {
  46393. get: function get (target, key) {
  46394. if (typeof key === 'string' && !(key in target)) {
  46395. if (key in target.$data) { warnReservedPrefix(target, key); }
  46396. else { warnNonPresent(target, key); }
  46397. }
  46398. return target[key]
  46399. }
  46400. };
  46401. initProxy = function initProxy (vm) {
  46402. if (hasProxy) {
  46403. // determine which proxy handler to use
  46404. var options = vm.$options;
  46405. var handlers = options.render && options.render._withStripped
  46406. ? getHandler
  46407. : hasHandler;
  46408. vm._renderProxy = new Proxy(vm, handlers);
  46409. } else {
  46410. vm._renderProxy = vm;
  46411. }
  46412. };
  46413. }
  46414. /* */
  46415. var seenObjects = new _Set();
  46416. /**
  46417. * Recursively traverse an object to evoke all converted
  46418. * getters, so that every nested property inside the object
  46419. * is collected as a "deep" dependency.
  46420. */
  46421. function traverse (val) {
  46422. _traverse(val, seenObjects);
  46423. seenObjects.clear();
  46424. }
  46425. function _traverse (val, seen) {
  46426. var i, keys;
  46427. var isA = Array.isArray(val);
  46428. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  46429. return
  46430. }
  46431. if (val.__ob__) {
  46432. var depId = val.__ob__.dep.id;
  46433. if (seen.has(depId)) {
  46434. return
  46435. }
  46436. seen.add(depId);
  46437. }
  46438. if (isA) {
  46439. i = val.length;
  46440. while (i--) { _traverse(val[i], seen); }
  46441. } else {
  46442. keys = Object.keys(val);
  46443. i = keys.length;
  46444. while (i--) { _traverse(val[keys[i]], seen); }
  46445. }
  46446. }
  46447. /* */
  46448. var normalizeEvent = cached(function (name) {
  46449. var passive = name.charAt(0) === '&';
  46450. name = passive ? name.slice(1) : name;
  46451. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  46452. name = once$$1 ? name.slice(1) : name;
  46453. var capture = name.charAt(0) === '!';
  46454. name = capture ? name.slice(1) : name;
  46455. return {
  46456. name: name,
  46457. once: once$$1,
  46458. capture: capture,
  46459. passive: passive
  46460. }
  46461. });
  46462. function createFnInvoker (fns, vm) {
  46463. function invoker () {
  46464. var arguments$1 = arguments;
  46465. var fns = invoker.fns;
  46466. if (Array.isArray(fns)) {
  46467. var cloned = fns.slice();
  46468. for (var i = 0; i < cloned.length; i++) {
  46469. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  46470. }
  46471. } else {
  46472. // return handler return value for single handlers
  46473. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  46474. }
  46475. }
  46476. invoker.fns = fns;
  46477. return invoker
  46478. }
  46479. function updateListeners (
  46480. on,
  46481. oldOn,
  46482. add,
  46483. remove$$1,
  46484. createOnceHandler,
  46485. vm
  46486. ) {
  46487. var name, def$$1, cur, old, event;
  46488. for (name in on) {
  46489. def$$1 = cur = on[name];
  46490. old = oldOn[name];
  46491. event = normalizeEvent(name);
  46492. if (isUndef(cur)) {
  46493. warn(
  46494. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  46495. vm
  46496. );
  46497. } else if (isUndef(old)) {
  46498. if (isUndef(cur.fns)) {
  46499. cur = on[name] = createFnInvoker(cur, vm);
  46500. }
  46501. if (isTrue(event.once)) {
  46502. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46503. }
  46504. add(event.name, cur, event.capture, event.passive, event.params);
  46505. } else if (cur !== old) {
  46506. old.fns = cur;
  46507. on[name] = old;
  46508. }
  46509. }
  46510. for (name in oldOn) {
  46511. if (isUndef(on[name])) {
  46512. event = normalizeEvent(name);
  46513. remove$$1(event.name, oldOn[name], event.capture);
  46514. }
  46515. }
  46516. }
  46517. /* */
  46518. function mergeVNodeHook (def, hookKey, hook) {
  46519. if (def instanceof VNode) {
  46520. def = def.data.hook || (def.data.hook = {});
  46521. }
  46522. var invoker;
  46523. var oldHook = def[hookKey];
  46524. function wrappedHook () {
  46525. hook.apply(this, arguments);
  46526. // important: remove merged hook to ensure it's called only once
  46527. // and prevent memory leak
  46528. remove(invoker.fns, wrappedHook);
  46529. }
  46530. if (isUndef(oldHook)) {
  46531. // no existing hook
  46532. invoker = createFnInvoker([wrappedHook]);
  46533. } else {
  46534. /* istanbul ignore if */
  46535. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46536. // already a merged invoker
  46537. invoker = oldHook;
  46538. invoker.fns.push(wrappedHook);
  46539. } else {
  46540. // existing plain hook
  46541. invoker = createFnInvoker([oldHook, wrappedHook]);
  46542. }
  46543. }
  46544. invoker.merged = true;
  46545. def[hookKey] = invoker;
  46546. }
  46547. /* */
  46548. function extractPropsFromVNodeData (
  46549. data,
  46550. Ctor,
  46551. tag
  46552. ) {
  46553. // we are only extracting raw values here.
  46554. // validation and default values are handled in the child
  46555. // component itself.
  46556. var propOptions = Ctor.options.props;
  46557. if (isUndef(propOptions)) {
  46558. return
  46559. }
  46560. var res = {};
  46561. var attrs = data.attrs;
  46562. var props = data.props;
  46563. if (isDef(attrs) || isDef(props)) {
  46564. for (var key in propOptions) {
  46565. var altKey = hyphenate(key);
  46566. {
  46567. var keyInLowerCase = key.toLowerCase();
  46568. if (
  46569. key !== keyInLowerCase &&
  46570. attrs && hasOwn(attrs, keyInLowerCase)
  46571. ) {
  46572. tip(
  46573. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46574. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46575. " \"" + key + "\". " +
  46576. "Note that HTML attributes are case-insensitive and camelCased " +
  46577. "props need to use their kebab-case equivalents when using in-DOM " +
  46578. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46579. );
  46580. }
  46581. }
  46582. checkProp(res, props, key, altKey, true) ||
  46583. checkProp(res, attrs, key, altKey, false);
  46584. }
  46585. }
  46586. return res
  46587. }
  46588. function checkProp (
  46589. res,
  46590. hash,
  46591. key,
  46592. altKey,
  46593. preserve
  46594. ) {
  46595. if (isDef(hash)) {
  46596. if (hasOwn(hash, key)) {
  46597. res[key] = hash[key];
  46598. if (!preserve) {
  46599. delete hash[key];
  46600. }
  46601. return true
  46602. } else if (hasOwn(hash, altKey)) {
  46603. res[key] = hash[altKey];
  46604. if (!preserve) {
  46605. delete hash[altKey];
  46606. }
  46607. return true
  46608. }
  46609. }
  46610. return false
  46611. }
  46612. /* */
  46613. // The template compiler attempts to minimize the need for normalization by
  46614. // statically analyzing the template at compile time.
  46615. //
  46616. // For plain HTML markup, normalization can be completely skipped because the
  46617. // generated render function is guaranteed to return Array<VNode>. There are
  46618. // two cases where extra normalization is needed:
  46619. // 1. When the children contains components - because a functional component
  46620. // may return an Array instead of a single root. In this case, just a simple
  46621. // normalization is needed - if any child is an Array, we flatten the whole
  46622. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46623. // because functional components already normalize their own children.
  46624. function simpleNormalizeChildren (children) {
  46625. for (var i = 0; i < children.length; i++) {
  46626. if (Array.isArray(children[i])) {
  46627. return Array.prototype.concat.apply([], children)
  46628. }
  46629. }
  46630. return children
  46631. }
  46632. // 2. When the children contains constructs that always generated nested Arrays,
  46633. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46634. // with hand-written render functions / JSX. In such cases a full normalization
  46635. // is needed to cater to all possible types of children values.
  46636. function normalizeChildren (children) {
  46637. return isPrimitive(children)
  46638. ? [createTextVNode(children)]
  46639. : Array.isArray(children)
  46640. ? normalizeArrayChildren(children)
  46641. : undefined
  46642. }
  46643. function isTextNode (node) {
  46644. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46645. }
  46646. function normalizeArrayChildren (children, nestedIndex) {
  46647. var res = [];
  46648. var i, c, lastIndex, last;
  46649. for (i = 0; i < children.length; i++) {
  46650. c = children[i];
  46651. if (isUndef(c) || typeof c === 'boolean') { continue }
  46652. lastIndex = res.length - 1;
  46653. last = res[lastIndex];
  46654. // nested
  46655. if (Array.isArray(c)) {
  46656. if (c.length > 0) {
  46657. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46658. // merge adjacent text nodes
  46659. if (isTextNode(c[0]) && isTextNode(last)) {
  46660. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46661. c.shift();
  46662. }
  46663. res.push.apply(res, c);
  46664. }
  46665. } else if (isPrimitive(c)) {
  46666. if (isTextNode(last)) {
  46667. // merge adjacent text nodes
  46668. // this is necessary for SSR hydration because text nodes are
  46669. // essentially merged when rendered to HTML strings
  46670. res[lastIndex] = createTextVNode(last.text + c);
  46671. } else if (c !== '') {
  46672. // convert primitive to vnode
  46673. res.push(createTextVNode(c));
  46674. }
  46675. } else {
  46676. if (isTextNode(c) && isTextNode(last)) {
  46677. // merge adjacent text nodes
  46678. res[lastIndex] = createTextVNode(last.text + c.text);
  46679. } else {
  46680. // default key for nested array children (likely generated by v-for)
  46681. if (isTrue(children._isVList) &&
  46682. isDef(c.tag) &&
  46683. isUndef(c.key) &&
  46684. isDef(nestedIndex)) {
  46685. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46686. }
  46687. res.push(c);
  46688. }
  46689. }
  46690. }
  46691. return res
  46692. }
  46693. /* */
  46694. function initProvide (vm) {
  46695. var provide = vm.$options.provide;
  46696. if (provide) {
  46697. vm._provided = typeof provide === 'function'
  46698. ? provide.call(vm)
  46699. : provide;
  46700. }
  46701. }
  46702. function initInjections (vm) {
  46703. var result = resolveInject(vm.$options.inject, vm);
  46704. if (result) {
  46705. toggleObserving(false);
  46706. Object.keys(result).forEach(function (key) {
  46707. /* istanbul ignore else */
  46708. {
  46709. defineReactive$$1(vm, key, result[key], function () {
  46710. warn(
  46711. "Avoid mutating an injected value directly since the changes will be " +
  46712. "overwritten whenever the provided component re-renders. " +
  46713. "injection being mutated: \"" + key + "\"",
  46714. vm
  46715. );
  46716. });
  46717. }
  46718. });
  46719. toggleObserving(true);
  46720. }
  46721. }
  46722. function resolveInject (inject, vm) {
  46723. if (inject) {
  46724. // inject is :any because flow is not smart enough to figure out cached
  46725. var result = Object.create(null);
  46726. var keys = hasSymbol
  46727. ? Reflect.ownKeys(inject)
  46728. : Object.keys(inject);
  46729. for (var i = 0; i < keys.length; i++) {
  46730. var key = keys[i];
  46731. // #6574 in case the inject object is observed...
  46732. if (key === '__ob__') { continue }
  46733. var provideKey = inject[key].from;
  46734. var source = vm;
  46735. while (source) {
  46736. if (source._provided && hasOwn(source._provided, provideKey)) {
  46737. result[key] = source._provided[provideKey];
  46738. break
  46739. }
  46740. source = source.$parent;
  46741. }
  46742. if (!source) {
  46743. if ('default' in inject[key]) {
  46744. var provideDefault = inject[key].default;
  46745. result[key] = typeof provideDefault === 'function'
  46746. ? provideDefault.call(vm)
  46747. : provideDefault;
  46748. } else {
  46749. warn(("Injection \"" + key + "\" not found"), vm);
  46750. }
  46751. }
  46752. }
  46753. return result
  46754. }
  46755. }
  46756. /* */
  46757. /**
  46758. * Runtime helper for resolving raw children VNodes into a slot object.
  46759. */
  46760. function resolveSlots (
  46761. children,
  46762. context
  46763. ) {
  46764. if (!children || !children.length) {
  46765. return {}
  46766. }
  46767. var slots = {};
  46768. for (var i = 0, l = children.length; i < l; i++) {
  46769. var child = children[i];
  46770. var data = child.data;
  46771. // remove slot attribute if the node is resolved as a Vue slot node
  46772. if (data && data.attrs && data.attrs.slot) {
  46773. delete data.attrs.slot;
  46774. }
  46775. // named slots should only be respected if the vnode was rendered in the
  46776. // same context.
  46777. if ((child.context === context || child.fnContext === context) &&
  46778. data && data.slot != null
  46779. ) {
  46780. var name = data.slot;
  46781. var slot = (slots[name] || (slots[name] = []));
  46782. if (child.tag === 'template') {
  46783. slot.push.apply(slot, child.children || []);
  46784. } else {
  46785. slot.push(child);
  46786. }
  46787. } else {
  46788. (slots.default || (slots.default = [])).push(child);
  46789. }
  46790. }
  46791. // ignore slots that contains only whitespace
  46792. for (var name$1 in slots) {
  46793. if (slots[name$1].every(isWhitespace)) {
  46794. delete slots[name$1];
  46795. }
  46796. }
  46797. return slots
  46798. }
  46799. function isWhitespace (node) {
  46800. return (node.isComment && !node.asyncFactory) || node.text === ' '
  46801. }
  46802. /* */
  46803. function normalizeScopedSlots (
  46804. slots,
  46805. normalSlots,
  46806. prevSlots
  46807. ) {
  46808. var res;
  46809. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  46810. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  46811. var key = slots && slots.$key;
  46812. if (!slots) {
  46813. res = {};
  46814. } else if (slots._normalized) {
  46815. // fast path 1: child component re-render only, parent did not change
  46816. return slots._normalized
  46817. } else if (
  46818. isStable &&
  46819. prevSlots &&
  46820. prevSlots !== emptyObject &&
  46821. key === prevSlots.$key &&
  46822. !hasNormalSlots &&
  46823. !prevSlots.$hasNormal
  46824. ) {
  46825. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  46826. // only need to normalize once
  46827. return prevSlots
  46828. } else {
  46829. res = {};
  46830. for (var key$1 in slots) {
  46831. if (slots[key$1] && key$1[0] !== '$') {
  46832. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  46833. }
  46834. }
  46835. }
  46836. // expose normal slots on scopedSlots
  46837. for (var key$2 in normalSlots) {
  46838. if (!(key$2 in res)) {
  46839. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  46840. }
  46841. }
  46842. // avoriaz seems to mock a non-extensible $scopedSlots object
  46843. // and when that is passed down this would cause an error
  46844. if (slots && Object.isExtensible(slots)) {
  46845. (slots)._normalized = res;
  46846. }
  46847. def(res, '$stable', isStable);
  46848. def(res, '$key', key);
  46849. def(res, '$hasNormal', hasNormalSlots);
  46850. return res
  46851. }
  46852. function normalizeScopedSlot(normalSlots, key, fn) {
  46853. var normalized = function () {
  46854. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  46855. res = res && typeof res === 'object' && !Array.isArray(res)
  46856. ? [res] // single vnode
  46857. : normalizeChildren(res);
  46858. return res && (
  46859. res.length === 0 ||
  46860. (res.length === 1 && res[0].isComment) // #9658
  46861. ) ? undefined
  46862. : res
  46863. };
  46864. // this is a slot using the new v-slot syntax without scope. although it is
  46865. // compiled as a scoped slot, render fn users would expect it to be present
  46866. // on this.$slots because the usage is semantically a normal slot.
  46867. if (fn.proxy) {
  46868. Object.defineProperty(normalSlots, key, {
  46869. get: normalized,
  46870. enumerable: true,
  46871. configurable: true
  46872. });
  46873. }
  46874. return normalized
  46875. }
  46876. function proxyNormalSlot(slots, key) {
  46877. return function () { return slots[key]; }
  46878. }
  46879. /* */
  46880. /**
  46881. * Runtime helper for rendering v-for lists.
  46882. */
  46883. function renderList (
  46884. val,
  46885. render
  46886. ) {
  46887. var ret, i, l, keys, key;
  46888. if (Array.isArray(val) || typeof val === 'string') {
  46889. ret = new Array(val.length);
  46890. for (i = 0, l = val.length; i < l; i++) {
  46891. ret[i] = render(val[i], i);
  46892. }
  46893. } else if (typeof val === 'number') {
  46894. ret = new Array(val);
  46895. for (i = 0; i < val; i++) {
  46896. ret[i] = render(i + 1, i);
  46897. }
  46898. } else if (isObject(val)) {
  46899. if (hasSymbol && val[Symbol.iterator]) {
  46900. ret = [];
  46901. var iterator = val[Symbol.iterator]();
  46902. var result = iterator.next();
  46903. while (!result.done) {
  46904. ret.push(render(result.value, ret.length));
  46905. result = iterator.next();
  46906. }
  46907. } else {
  46908. keys = Object.keys(val);
  46909. ret = new Array(keys.length);
  46910. for (i = 0, l = keys.length; i < l; i++) {
  46911. key = keys[i];
  46912. ret[i] = render(val[key], key, i);
  46913. }
  46914. }
  46915. }
  46916. if (!isDef(ret)) {
  46917. ret = [];
  46918. }
  46919. (ret)._isVList = true;
  46920. return ret
  46921. }
  46922. /* */
  46923. /**
  46924. * Runtime helper for rendering <slot>
  46925. */
  46926. function renderSlot (
  46927. name,
  46928. fallback,
  46929. props,
  46930. bindObject
  46931. ) {
  46932. var scopedSlotFn = this.$scopedSlots[name];
  46933. var nodes;
  46934. if (scopedSlotFn) { // scoped slot
  46935. props = props || {};
  46936. if (bindObject) {
  46937. if (!isObject(bindObject)) {
  46938. warn(
  46939. 'slot v-bind without argument expects an Object',
  46940. this
  46941. );
  46942. }
  46943. props = extend(extend({}, bindObject), props);
  46944. }
  46945. nodes = scopedSlotFn(props) || fallback;
  46946. } else {
  46947. nodes = this.$slots[name] || fallback;
  46948. }
  46949. var target = props && props.slot;
  46950. if (target) {
  46951. return this.$createElement('template', { slot: target }, nodes)
  46952. } else {
  46953. return nodes
  46954. }
  46955. }
  46956. /* */
  46957. /**
  46958. * Runtime helper for resolving filters
  46959. */
  46960. function resolveFilter (id) {
  46961. return resolveAsset(this.$options, 'filters', id, true) || identity
  46962. }
  46963. /* */
  46964. function isKeyNotMatch (expect, actual) {
  46965. if (Array.isArray(expect)) {
  46966. return expect.indexOf(actual) === -1
  46967. } else {
  46968. return expect !== actual
  46969. }
  46970. }
  46971. /**
  46972. * Runtime helper for checking keyCodes from config.
  46973. * exposed as Vue.prototype._k
  46974. * passing in eventKeyName as last argument separately for backwards compat
  46975. */
  46976. function checkKeyCodes (
  46977. eventKeyCode,
  46978. key,
  46979. builtInKeyCode,
  46980. eventKeyName,
  46981. builtInKeyName
  46982. ) {
  46983. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  46984. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  46985. return isKeyNotMatch(builtInKeyName, eventKeyName)
  46986. } else if (mappedKeyCode) {
  46987. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  46988. } else if (eventKeyName) {
  46989. return hyphenate(eventKeyName) !== key
  46990. }
  46991. }
  46992. /* */
  46993. /**
  46994. * Runtime helper for merging v-bind="object" into a VNode's data.
  46995. */
  46996. function bindObjectProps (
  46997. data,
  46998. tag,
  46999. value,
  47000. asProp,
  47001. isSync
  47002. ) {
  47003. if (value) {
  47004. if (!isObject(value)) {
  47005. warn(
  47006. 'v-bind without argument expects an Object or Array value',
  47007. this
  47008. );
  47009. } else {
  47010. if (Array.isArray(value)) {
  47011. value = toObject(value);
  47012. }
  47013. var hash;
  47014. var loop = function ( key ) {
  47015. if (
  47016. key === 'class' ||
  47017. key === 'style' ||
  47018. isReservedAttribute(key)
  47019. ) {
  47020. hash = data;
  47021. } else {
  47022. var type = data.attrs && data.attrs.type;
  47023. hash = asProp || config.mustUseProp(tag, type, key)
  47024. ? data.domProps || (data.domProps = {})
  47025. : data.attrs || (data.attrs = {});
  47026. }
  47027. var camelizedKey = camelize(key);
  47028. var hyphenatedKey = hyphenate(key);
  47029. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  47030. hash[key] = value[key];
  47031. if (isSync) {
  47032. var on = data.on || (data.on = {});
  47033. on[("update:" + key)] = function ($event) {
  47034. value[key] = $event;
  47035. };
  47036. }
  47037. }
  47038. };
  47039. for (var key in value) loop( key );
  47040. }
  47041. }
  47042. return data
  47043. }
  47044. /* */
  47045. /**
  47046. * Runtime helper for rendering static trees.
  47047. */
  47048. function renderStatic (
  47049. index,
  47050. isInFor
  47051. ) {
  47052. var cached = this._staticTrees || (this._staticTrees = []);
  47053. var tree = cached[index];
  47054. // if has already-rendered static tree and not inside v-for,
  47055. // we can reuse the same tree.
  47056. if (tree && !isInFor) {
  47057. return tree
  47058. }
  47059. // otherwise, render a fresh tree.
  47060. tree = cached[index] = this.$options.staticRenderFns[index].call(
  47061. this._renderProxy,
  47062. null,
  47063. this // for render fns generated for functional component templates
  47064. );
  47065. markStatic(tree, ("__static__" + index), false);
  47066. return tree
  47067. }
  47068. /**
  47069. * Runtime helper for v-once.
  47070. * Effectively it means marking the node as static with a unique key.
  47071. */
  47072. function markOnce (
  47073. tree,
  47074. index,
  47075. key
  47076. ) {
  47077. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  47078. return tree
  47079. }
  47080. function markStatic (
  47081. tree,
  47082. key,
  47083. isOnce
  47084. ) {
  47085. if (Array.isArray(tree)) {
  47086. for (var i = 0; i < tree.length; i++) {
  47087. if (tree[i] && typeof tree[i] !== 'string') {
  47088. markStaticNode(tree[i], (key + "_" + i), isOnce);
  47089. }
  47090. }
  47091. } else {
  47092. markStaticNode(tree, key, isOnce);
  47093. }
  47094. }
  47095. function markStaticNode (node, key, isOnce) {
  47096. node.isStatic = true;
  47097. node.key = key;
  47098. node.isOnce = isOnce;
  47099. }
  47100. /* */
  47101. function bindObjectListeners (data, value) {
  47102. if (value) {
  47103. if (!isPlainObject(value)) {
  47104. warn(
  47105. 'v-on without argument expects an Object value',
  47106. this
  47107. );
  47108. } else {
  47109. var on = data.on = data.on ? extend({}, data.on) : {};
  47110. for (var key in value) {
  47111. var existing = on[key];
  47112. var ours = value[key];
  47113. on[key] = existing ? [].concat(existing, ours) : ours;
  47114. }
  47115. }
  47116. }
  47117. return data
  47118. }
  47119. /* */
  47120. function resolveScopedSlots (
  47121. fns, // see flow/vnode
  47122. res,
  47123. // the following are added in 2.6
  47124. hasDynamicKeys,
  47125. contentHashKey
  47126. ) {
  47127. res = res || { $stable: !hasDynamicKeys };
  47128. for (var i = 0; i < fns.length; i++) {
  47129. var slot = fns[i];
  47130. if (Array.isArray(slot)) {
  47131. resolveScopedSlots(slot, res, hasDynamicKeys);
  47132. } else if (slot) {
  47133. // marker for reverse proxying v-slot without scope on this.$slots
  47134. if (slot.proxy) {
  47135. slot.fn.proxy = true;
  47136. }
  47137. res[slot.key] = slot.fn;
  47138. }
  47139. }
  47140. if (contentHashKey) {
  47141. (res).$key = contentHashKey;
  47142. }
  47143. return res
  47144. }
  47145. /* */
  47146. function bindDynamicKeys (baseObj, values) {
  47147. for (var i = 0; i < values.length; i += 2) {
  47148. var key = values[i];
  47149. if (typeof key === 'string' && key) {
  47150. baseObj[values[i]] = values[i + 1];
  47151. } else if (key !== '' && key !== null) {
  47152. // null is a special value for explicitly removing a binding
  47153. warn(
  47154. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  47155. this
  47156. );
  47157. }
  47158. }
  47159. return baseObj
  47160. }
  47161. // helper to dynamically append modifier runtime markers to event names.
  47162. // ensure only append when value is already string, otherwise it will be cast
  47163. // to string and cause the type check to miss.
  47164. function prependModifier (value, symbol) {
  47165. return typeof value === 'string' ? symbol + value : value
  47166. }
  47167. /* */
  47168. function installRenderHelpers (target) {
  47169. target._o = markOnce;
  47170. target._n = toNumber;
  47171. target._s = toString;
  47172. target._l = renderList;
  47173. target._t = renderSlot;
  47174. target._q = looseEqual;
  47175. target._i = looseIndexOf;
  47176. target._m = renderStatic;
  47177. target._f = resolveFilter;
  47178. target._k = checkKeyCodes;
  47179. target._b = bindObjectProps;
  47180. target._v = createTextVNode;
  47181. target._e = createEmptyVNode;
  47182. target._u = resolveScopedSlots;
  47183. target._g = bindObjectListeners;
  47184. target._d = bindDynamicKeys;
  47185. target._p = prependModifier;
  47186. }
  47187. /* */
  47188. function FunctionalRenderContext (
  47189. data,
  47190. props,
  47191. children,
  47192. parent,
  47193. Ctor
  47194. ) {
  47195. var this$1 = this;
  47196. var options = Ctor.options;
  47197. // ensure the createElement function in functional components
  47198. // gets a unique context - this is necessary for correct named slot check
  47199. var contextVm;
  47200. if (hasOwn(parent, '_uid')) {
  47201. contextVm = Object.create(parent);
  47202. // $flow-disable-line
  47203. contextVm._original = parent;
  47204. } else {
  47205. // the context vm passed in is a functional context as well.
  47206. // in this case we want to make sure we are able to get a hold to the
  47207. // real context instance.
  47208. contextVm = parent;
  47209. // $flow-disable-line
  47210. parent = parent._original;
  47211. }
  47212. var isCompiled = isTrue(options._compiled);
  47213. var needNormalization = !isCompiled;
  47214. this.data = data;
  47215. this.props = props;
  47216. this.children = children;
  47217. this.parent = parent;
  47218. this.listeners = data.on || emptyObject;
  47219. this.injections = resolveInject(options.inject, parent);
  47220. this.slots = function () {
  47221. if (!this$1.$slots) {
  47222. normalizeScopedSlots(
  47223. data.scopedSlots,
  47224. this$1.$slots = resolveSlots(children, parent)
  47225. );
  47226. }
  47227. return this$1.$slots
  47228. };
  47229. Object.defineProperty(this, 'scopedSlots', ({
  47230. enumerable: true,
  47231. get: function get () {
  47232. return normalizeScopedSlots(data.scopedSlots, this.slots())
  47233. }
  47234. }));
  47235. // support for compiled functional template
  47236. if (isCompiled) {
  47237. // exposing $options for renderStatic()
  47238. this.$options = options;
  47239. // pre-resolve slots for renderSlot()
  47240. this.$slots = this.slots();
  47241. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  47242. }
  47243. if (options._scopeId) {
  47244. this._c = function (a, b, c, d) {
  47245. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  47246. if (vnode && !Array.isArray(vnode)) {
  47247. vnode.fnScopeId = options._scopeId;
  47248. vnode.fnContext = parent;
  47249. }
  47250. return vnode
  47251. };
  47252. } else {
  47253. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  47254. }
  47255. }
  47256. installRenderHelpers(FunctionalRenderContext.prototype);
  47257. function createFunctionalComponent (
  47258. Ctor,
  47259. propsData,
  47260. data,
  47261. contextVm,
  47262. children
  47263. ) {
  47264. var options = Ctor.options;
  47265. var props = {};
  47266. var propOptions = options.props;
  47267. if (isDef(propOptions)) {
  47268. for (var key in propOptions) {
  47269. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  47270. }
  47271. } else {
  47272. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  47273. if (isDef(data.props)) { mergeProps(props, data.props); }
  47274. }
  47275. var renderContext = new FunctionalRenderContext(
  47276. data,
  47277. props,
  47278. children,
  47279. contextVm,
  47280. Ctor
  47281. );
  47282. var vnode = options.render.call(null, renderContext._c, renderContext);
  47283. if (vnode instanceof VNode) {
  47284. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  47285. } else if (Array.isArray(vnode)) {
  47286. var vnodes = normalizeChildren(vnode) || [];
  47287. var res = new Array(vnodes.length);
  47288. for (var i = 0; i < vnodes.length; i++) {
  47289. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  47290. }
  47291. return res
  47292. }
  47293. }
  47294. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  47295. // #7817 clone node before setting fnContext, otherwise if the node is reused
  47296. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  47297. // that should not be matched to match.
  47298. var clone = cloneVNode(vnode);
  47299. clone.fnContext = contextVm;
  47300. clone.fnOptions = options;
  47301. {
  47302. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  47303. }
  47304. if (data.slot) {
  47305. (clone.data || (clone.data = {})).slot = data.slot;
  47306. }
  47307. return clone
  47308. }
  47309. function mergeProps (to, from) {
  47310. for (var key in from) {
  47311. to[camelize(key)] = from[key];
  47312. }
  47313. }
  47314. /* */
  47315. /* */
  47316. /* */
  47317. /* */
  47318. // inline hooks to be invoked on component VNodes during patch
  47319. var componentVNodeHooks = {
  47320. init: function init (vnode, hydrating) {
  47321. if (
  47322. vnode.componentInstance &&
  47323. !vnode.componentInstance._isDestroyed &&
  47324. vnode.data.keepAlive
  47325. ) {
  47326. // kept-alive components, treat as a patch
  47327. var mountedNode = vnode; // work around flow
  47328. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  47329. } else {
  47330. var child = vnode.componentInstance = createComponentInstanceForVnode(
  47331. vnode,
  47332. activeInstance
  47333. );
  47334. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  47335. }
  47336. },
  47337. prepatch: function prepatch (oldVnode, vnode) {
  47338. var options = vnode.componentOptions;
  47339. var child = vnode.componentInstance = oldVnode.componentInstance;
  47340. updateChildComponent(
  47341. child,
  47342. options.propsData, // updated props
  47343. options.listeners, // updated listeners
  47344. vnode, // new parent vnode
  47345. options.children // new children
  47346. );
  47347. },
  47348. insert: function insert (vnode) {
  47349. var context = vnode.context;
  47350. var componentInstance = vnode.componentInstance;
  47351. if (!componentInstance._isMounted) {
  47352. componentInstance._isMounted = true;
  47353. callHook(componentInstance, 'mounted');
  47354. }
  47355. if (vnode.data.keepAlive) {
  47356. if (context._isMounted) {
  47357. // vue-router#1212
  47358. // During updates, a kept-alive component's child components may
  47359. // change, so directly walking the tree here may call activated hooks
  47360. // on incorrect children. Instead we push them into a queue which will
  47361. // be processed after the whole patch process ended.
  47362. queueActivatedComponent(componentInstance);
  47363. } else {
  47364. activateChildComponent(componentInstance, true /* direct */);
  47365. }
  47366. }
  47367. },
  47368. destroy: function destroy (vnode) {
  47369. var componentInstance = vnode.componentInstance;
  47370. if (!componentInstance._isDestroyed) {
  47371. if (!vnode.data.keepAlive) {
  47372. componentInstance.$destroy();
  47373. } else {
  47374. deactivateChildComponent(componentInstance, true /* direct */);
  47375. }
  47376. }
  47377. }
  47378. };
  47379. var hooksToMerge = Object.keys(componentVNodeHooks);
  47380. function createComponent (
  47381. Ctor,
  47382. data,
  47383. context,
  47384. children,
  47385. tag
  47386. ) {
  47387. if (isUndef(Ctor)) {
  47388. return
  47389. }
  47390. var baseCtor = context.$options._base;
  47391. // plain options object: turn it into a constructor
  47392. if (isObject(Ctor)) {
  47393. Ctor = baseCtor.extend(Ctor);
  47394. }
  47395. // if at this stage it's not a constructor or an async component factory,
  47396. // reject.
  47397. if (typeof Ctor !== 'function') {
  47398. {
  47399. warn(("Invalid Component definition: " + (String(Ctor))), context);
  47400. }
  47401. return
  47402. }
  47403. // async component
  47404. var asyncFactory;
  47405. if (isUndef(Ctor.cid)) {
  47406. asyncFactory = Ctor;
  47407. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  47408. if (Ctor === undefined) {
  47409. // return a placeholder node for async component, which is rendered
  47410. // as a comment node but preserves all the raw information for the node.
  47411. // the information will be used for async server-rendering and hydration.
  47412. return createAsyncPlaceholder(
  47413. asyncFactory,
  47414. data,
  47415. context,
  47416. children,
  47417. tag
  47418. )
  47419. }
  47420. }
  47421. data = data || {};
  47422. // resolve constructor options in case global mixins are applied after
  47423. // component constructor creation
  47424. resolveConstructorOptions(Ctor);
  47425. // transform component v-model data into props & events
  47426. if (isDef(data.model)) {
  47427. transformModel(Ctor.options, data);
  47428. }
  47429. // extract props
  47430. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  47431. // functional component
  47432. if (isTrue(Ctor.options.functional)) {
  47433. return createFunctionalComponent(Ctor, propsData, data, context, children)
  47434. }
  47435. // extract listeners, since these needs to be treated as
  47436. // child component listeners instead of DOM listeners
  47437. var listeners = data.on;
  47438. // replace with listeners with .native modifier
  47439. // so it gets processed during parent component patch.
  47440. data.on = data.nativeOn;
  47441. if (isTrue(Ctor.options.abstract)) {
  47442. // abstract components do not keep anything
  47443. // other than props & listeners & slot
  47444. // work around flow
  47445. var slot = data.slot;
  47446. data = {};
  47447. if (slot) {
  47448. data.slot = slot;
  47449. }
  47450. }
  47451. // install component management hooks onto the placeholder node
  47452. installComponentHooks(data);
  47453. // return a placeholder vnode
  47454. var name = Ctor.options.name || tag;
  47455. var vnode = new VNode(
  47456. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  47457. data, undefined, undefined, undefined, context,
  47458. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  47459. asyncFactory
  47460. );
  47461. return vnode
  47462. }
  47463. function createComponentInstanceForVnode (
  47464. vnode, // we know it's MountedComponentVNode but flow doesn't
  47465. parent // activeInstance in lifecycle state
  47466. ) {
  47467. var options = {
  47468. _isComponent: true,
  47469. _parentVnode: vnode,
  47470. parent: parent
  47471. };
  47472. // check inline-template render functions
  47473. var inlineTemplate = vnode.data.inlineTemplate;
  47474. if (isDef(inlineTemplate)) {
  47475. options.render = inlineTemplate.render;
  47476. options.staticRenderFns = inlineTemplate.staticRenderFns;
  47477. }
  47478. return new vnode.componentOptions.Ctor(options)
  47479. }
  47480. function installComponentHooks (data) {
  47481. var hooks = data.hook || (data.hook = {});
  47482. for (var i = 0; i < hooksToMerge.length; i++) {
  47483. var key = hooksToMerge[i];
  47484. var existing = hooks[key];
  47485. var toMerge = componentVNodeHooks[key];
  47486. if (existing !== toMerge && !(existing && existing._merged)) {
  47487. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  47488. }
  47489. }
  47490. }
  47491. function mergeHook$1 (f1, f2) {
  47492. var merged = function (a, b) {
  47493. // flow complains about extra args which is why we use any
  47494. f1(a, b);
  47495. f2(a, b);
  47496. };
  47497. merged._merged = true;
  47498. return merged
  47499. }
  47500. // transform component v-model info (value and callback) into
  47501. // prop and event handler respectively.
  47502. function transformModel (options, data) {
  47503. var prop = (options.model && options.model.prop) || 'value';
  47504. var event = (options.model && options.model.event) || 'input'
  47505. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47506. var on = data.on || (data.on = {});
  47507. var existing = on[event];
  47508. var callback = data.model.callback;
  47509. if (isDef(existing)) {
  47510. if (
  47511. Array.isArray(existing)
  47512. ? existing.indexOf(callback) === -1
  47513. : existing !== callback
  47514. ) {
  47515. on[event] = [callback].concat(existing);
  47516. }
  47517. } else {
  47518. on[event] = callback;
  47519. }
  47520. }
  47521. /* */
  47522. var SIMPLE_NORMALIZE = 1;
  47523. var ALWAYS_NORMALIZE = 2;
  47524. // wrapper function for providing a more flexible interface
  47525. // without getting yelled at by flow
  47526. function createElement (
  47527. context,
  47528. tag,
  47529. data,
  47530. children,
  47531. normalizationType,
  47532. alwaysNormalize
  47533. ) {
  47534. if (Array.isArray(data) || isPrimitive(data)) {
  47535. normalizationType = children;
  47536. children = data;
  47537. data = undefined;
  47538. }
  47539. if (isTrue(alwaysNormalize)) {
  47540. normalizationType = ALWAYS_NORMALIZE;
  47541. }
  47542. return _createElement(context, tag, data, children, normalizationType)
  47543. }
  47544. function _createElement (
  47545. context,
  47546. tag,
  47547. data,
  47548. children,
  47549. normalizationType
  47550. ) {
  47551. if (isDef(data) && isDef((data).__ob__)) {
  47552. warn(
  47553. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47554. 'Always create fresh vnode data objects in each render!',
  47555. context
  47556. );
  47557. return createEmptyVNode()
  47558. }
  47559. // object syntax in v-bind
  47560. if (isDef(data) && isDef(data.is)) {
  47561. tag = data.is;
  47562. }
  47563. if (!tag) {
  47564. // in case of component :is set to falsy value
  47565. return createEmptyVNode()
  47566. }
  47567. // warn against non-primitive key
  47568. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47569. ) {
  47570. {
  47571. warn(
  47572. 'Avoid using non-primitive value as key, ' +
  47573. 'use string/number value instead.',
  47574. context
  47575. );
  47576. }
  47577. }
  47578. // support single function children as default scoped slot
  47579. if (Array.isArray(children) &&
  47580. typeof children[0] === 'function'
  47581. ) {
  47582. data = data || {};
  47583. data.scopedSlots = { default: children[0] };
  47584. children.length = 0;
  47585. }
  47586. if (normalizationType === ALWAYS_NORMALIZE) {
  47587. children = normalizeChildren(children);
  47588. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47589. children = simpleNormalizeChildren(children);
  47590. }
  47591. var vnode, ns;
  47592. if (typeof tag === 'string') {
  47593. var Ctor;
  47594. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47595. if (config.isReservedTag(tag)) {
  47596. // platform built-in elements
  47597. if (isDef(data) && isDef(data.nativeOn)) {
  47598. warn(
  47599. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47600. context
  47601. );
  47602. }
  47603. vnode = new VNode(
  47604. config.parsePlatformTagName(tag), data, children,
  47605. undefined, undefined, context
  47606. );
  47607. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47608. // component
  47609. vnode = createComponent(Ctor, data, context, children, tag);
  47610. } else {
  47611. // unknown or unlisted namespaced elements
  47612. // check at runtime because it may get assigned a namespace when its
  47613. // parent normalizes children
  47614. vnode = new VNode(
  47615. tag, data, children,
  47616. undefined, undefined, context
  47617. );
  47618. }
  47619. } else {
  47620. // direct component options / constructor
  47621. vnode = createComponent(tag, data, context, children);
  47622. }
  47623. if (Array.isArray(vnode)) {
  47624. return vnode
  47625. } else if (isDef(vnode)) {
  47626. if (isDef(ns)) { applyNS(vnode, ns); }
  47627. if (isDef(data)) { registerDeepBindings(data); }
  47628. return vnode
  47629. } else {
  47630. return createEmptyVNode()
  47631. }
  47632. }
  47633. function applyNS (vnode, ns, force) {
  47634. vnode.ns = ns;
  47635. if (vnode.tag === 'foreignObject') {
  47636. // use default namespace inside foreignObject
  47637. ns = undefined;
  47638. force = true;
  47639. }
  47640. if (isDef(vnode.children)) {
  47641. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47642. var child = vnode.children[i];
  47643. if (isDef(child.tag) && (
  47644. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47645. applyNS(child, ns, force);
  47646. }
  47647. }
  47648. }
  47649. }
  47650. // ref #5318
  47651. // necessary to ensure parent re-render when deep bindings like :style and
  47652. // :class are used on slot nodes
  47653. function registerDeepBindings (data) {
  47654. if (isObject(data.style)) {
  47655. traverse(data.style);
  47656. }
  47657. if (isObject(data.class)) {
  47658. traverse(data.class);
  47659. }
  47660. }
  47661. /* */
  47662. function initRender (vm) {
  47663. vm._vnode = null; // the root of the child tree
  47664. vm._staticTrees = null; // v-once cached trees
  47665. var options = vm.$options;
  47666. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47667. var renderContext = parentVnode && parentVnode.context;
  47668. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47669. vm.$scopedSlots = emptyObject;
  47670. // bind the createElement fn to this instance
  47671. // so that we get proper render context inside it.
  47672. // args order: tag, data, children, normalizationType, alwaysNormalize
  47673. // internal version is used by render functions compiled from templates
  47674. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47675. // normalization is always applied for the public version, used in
  47676. // user-written render functions.
  47677. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47678. // $attrs & $listeners are exposed for easier HOC creation.
  47679. // they need to be reactive so that HOCs using them are always updated
  47680. var parentData = parentVnode && parentVnode.data;
  47681. /* istanbul ignore else */
  47682. {
  47683. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47684. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47685. }, true);
  47686. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47687. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47688. }, true);
  47689. }
  47690. }
  47691. var currentRenderingInstance = null;
  47692. function renderMixin (Vue) {
  47693. // install runtime convenience helpers
  47694. installRenderHelpers(Vue.prototype);
  47695. Vue.prototype.$nextTick = function (fn) {
  47696. return nextTick(fn, this)
  47697. };
  47698. Vue.prototype._render = function () {
  47699. var vm = this;
  47700. var ref = vm.$options;
  47701. var render = ref.render;
  47702. var _parentVnode = ref._parentVnode;
  47703. if (_parentVnode) {
  47704. vm.$scopedSlots = normalizeScopedSlots(
  47705. _parentVnode.data.scopedSlots,
  47706. vm.$slots,
  47707. vm.$scopedSlots
  47708. );
  47709. }
  47710. // set parent vnode. this allows render functions to have access
  47711. // to the data on the placeholder node.
  47712. vm.$vnode = _parentVnode;
  47713. // render self
  47714. var vnode;
  47715. try {
  47716. // There's no need to maintain a stack because all render fns are called
  47717. // separately from one another. Nested component's render fns are called
  47718. // when parent component is patched.
  47719. currentRenderingInstance = vm;
  47720. vnode = render.call(vm._renderProxy, vm.$createElement);
  47721. } catch (e) {
  47722. handleError(e, vm, "render");
  47723. // return error render result,
  47724. // or previous vnode to prevent render error causing blank component
  47725. /* istanbul ignore else */
  47726. if (vm.$options.renderError) {
  47727. try {
  47728. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47729. } catch (e) {
  47730. handleError(e, vm, "renderError");
  47731. vnode = vm._vnode;
  47732. }
  47733. } else {
  47734. vnode = vm._vnode;
  47735. }
  47736. } finally {
  47737. currentRenderingInstance = null;
  47738. }
  47739. // if the returned array contains only a single node, allow it
  47740. if (Array.isArray(vnode) && vnode.length === 1) {
  47741. vnode = vnode[0];
  47742. }
  47743. // return empty vnode in case the render function errored out
  47744. if (!(vnode instanceof VNode)) {
  47745. if (Array.isArray(vnode)) {
  47746. warn(
  47747. 'Multiple root nodes returned from render function. Render function ' +
  47748. 'should return a single root node.',
  47749. vm
  47750. );
  47751. }
  47752. vnode = createEmptyVNode();
  47753. }
  47754. // set parent
  47755. vnode.parent = _parentVnode;
  47756. return vnode
  47757. };
  47758. }
  47759. /* */
  47760. function ensureCtor (comp, base) {
  47761. if (
  47762. comp.__esModule ||
  47763. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  47764. ) {
  47765. comp = comp.default;
  47766. }
  47767. return isObject(comp)
  47768. ? base.extend(comp)
  47769. : comp
  47770. }
  47771. function createAsyncPlaceholder (
  47772. factory,
  47773. data,
  47774. context,
  47775. children,
  47776. tag
  47777. ) {
  47778. var node = createEmptyVNode();
  47779. node.asyncFactory = factory;
  47780. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  47781. return node
  47782. }
  47783. function resolveAsyncComponent (
  47784. factory,
  47785. baseCtor
  47786. ) {
  47787. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  47788. return factory.errorComp
  47789. }
  47790. if (isDef(factory.resolved)) {
  47791. return factory.resolved
  47792. }
  47793. var owner = currentRenderingInstance;
  47794. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  47795. // already pending
  47796. factory.owners.push(owner);
  47797. }
  47798. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  47799. return factory.loadingComp
  47800. }
  47801. if (owner && !isDef(factory.owners)) {
  47802. var owners = factory.owners = [owner];
  47803. var sync = true;
  47804. var timerLoading = null;
  47805. var timerTimeout = null
  47806. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  47807. var forceRender = function (renderCompleted) {
  47808. for (var i = 0, l = owners.length; i < l; i++) {
  47809. (owners[i]).$forceUpdate();
  47810. }
  47811. if (renderCompleted) {
  47812. owners.length = 0;
  47813. if (timerLoading !== null) {
  47814. clearTimeout(timerLoading);
  47815. timerLoading = null;
  47816. }
  47817. if (timerTimeout !== null) {
  47818. clearTimeout(timerTimeout);
  47819. timerTimeout = null;
  47820. }
  47821. }
  47822. };
  47823. var resolve = once(function (res) {
  47824. // cache resolved
  47825. factory.resolved = ensureCtor(res, baseCtor);
  47826. // invoke callbacks only if this is not a synchronous resolve
  47827. // (async resolves are shimmed as synchronous during SSR)
  47828. if (!sync) {
  47829. forceRender(true);
  47830. } else {
  47831. owners.length = 0;
  47832. }
  47833. });
  47834. var reject = once(function (reason) {
  47835. warn(
  47836. "Failed to resolve async component: " + (String(factory)) +
  47837. (reason ? ("\nReason: " + reason) : '')
  47838. );
  47839. if (isDef(factory.errorComp)) {
  47840. factory.error = true;
  47841. forceRender(true);
  47842. }
  47843. });
  47844. var res = factory(resolve, reject);
  47845. if (isObject(res)) {
  47846. if (isPromise(res)) {
  47847. // () => Promise
  47848. if (isUndef(factory.resolved)) {
  47849. res.then(resolve, reject);
  47850. }
  47851. } else if (isPromise(res.component)) {
  47852. res.component.then(resolve, reject);
  47853. if (isDef(res.error)) {
  47854. factory.errorComp = ensureCtor(res.error, baseCtor);
  47855. }
  47856. if (isDef(res.loading)) {
  47857. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  47858. if (res.delay === 0) {
  47859. factory.loading = true;
  47860. } else {
  47861. timerLoading = setTimeout(function () {
  47862. timerLoading = null;
  47863. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  47864. factory.loading = true;
  47865. forceRender(false);
  47866. }
  47867. }, res.delay || 200);
  47868. }
  47869. }
  47870. if (isDef(res.timeout)) {
  47871. timerTimeout = setTimeout(function () {
  47872. timerTimeout = null;
  47873. if (isUndef(factory.resolved)) {
  47874. reject(
  47875. "timeout (" + (res.timeout) + "ms)"
  47876. );
  47877. }
  47878. }, res.timeout);
  47879. }
  47880. }
  47881. }
  47882. sync = false;
  47883. // return in case resolved synchronously
  47884. return factory.loading
  47885. ? factory.loadingComp
  47886. : factory.resolved
  47887. }
  47888. }
  47889. /* */
  47890. function isAsyncPlaceholder (node) {
  47891. return node.isComment && node.asyncFactory
  47892. }
  47893. /* */
  47894. function getFirstComponentChild (children) {
  47895. if (Array.isArray(children)) {
  47896. for (var i = 0; i < children.length; i++) {
  47897. var c = children[i];
  47898. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  47899. return c
  47900. }
  47901. }
  47902. }
  47903. }
  47904. /* */
  47905. /* */
  47906. function initEvents (vm) {
  47907. vm._events = Object.create(null);
  47908. vm._hasHookEvent = false;
  47909. // init parent attached events
  47910. var listeners = vm.$options._parentListeners;
  47911. if (listeners) {
  47912. updateComponentListeners(vm, listeners);
  47913. }
  47914. }
  47915. var target;
  47916. function add (event, fn) {
  47917. target.$on(event, fn);
  47918. }
  47919. function remove$1 (event, fn) {
  47920. target.$off(event, fn);
  47921. }
  47922. function createOnceHandler (event, fn) {
  47923. var _target = target;
  47924. return function onceHandler () {
  47925. var res = fn.apply(null, arguments);
  47926. if (res !== null) {
  47927. _target.$off(event, onceHandler);
  47928. }
  47929. }
  47930. }
  47931. function updateComponentListeners (
  47932. vm,
  47933. listeners,
  47934. oldListeners
  47935. ) {
  47936. target = vm;
  47937. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  47938. target = undefined;
  47939. }
  47940. function eventsMixin (Vue) {
  47941. var hookRE = /^hook:/;
  47942. Vue.prototype.$on = function (event, fn) {
  47943. var vm = this;
  47944. if (Array.isArray(event)) {
  47945. for (var i = 0, l = event.length; i < l; i++) {
  47946. vm.$on(event[i], fn);
  47947. }
  47948. } else {
  47949. (vm._events[event] || (vm._events[event] = [])).push(fn);
  47950. // optimize hook:event cost by using a boolean flag marked at registration
  47951. // instead of a hash lookup
  47952. if (hookRE.test(event)) {
  47953. vm._hasHookEvent = true;
  47954. }
  47955. }
  47956. return vm
  47957. };
  47958. Vue.prototype.$once = function (event, fn) {
  47959. var vm = this;
  47960. function on () {
  47961. vm.$off(event, on);
  47962. fn.apply(vm, arguments);
  47963. }
  47964. on.fn = fn;
  47965. vm.$on(event, on);
  47966. return vm
  47967. };
  47968. Vue.prototype.$off = function (event, fn) {
  47969. var vm = this;
  47970. // all
  47971. if (!arguments.length) {
  47972. vm._events = Object.create(null);
  47973. return vm
  47974. }
  47975. // array of events
  47976. if (Array.isArray(event)) {
  47977. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  47978. vm.$off(event[i$1], fn);
  47979. }
  47980. return vm
  47981. }
  47982. // specific event
  47983. var cbs = vm._events[event];
  47984. if (!cbs) {
  47985. return vm
  47986. }
  47987. if (!fn) {
  47988. vm._events[event] = null;
  47989. return vm
  47990. }
  47991. // specific handler
  47992. var cb;
  47993. var i = cbs.length;
  47994. while (i--) {
  47995. cb = cbs[i];
  47996. if (cb === fn || cb.fn === fn) {
  47997. cbs.splice(i, 1);
  47998. break
  47999. }
  48000. }
  48001. return vm
  48002. };
  48003. Vue.prototype.$emit = function (event) {
  48004. var vm = this;
  48005. {
  48006. var lowerCaseEvent = event.toLowerCase();
  48007. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  48008. tip(
  48009. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  48010. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  48011. "Note that HTML attributes are case-insensitive and you cannot use " +
  48012. "v-on to listen to camelCase events when using in-DOM templates. " +
  48013. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  48014. );
  48015. }
  48016. }
  48017. var cbs = vm._events[event];
  48018. if (cbs) {
  48019. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  48020. var args = toArray(arguments, 1);
  48021. var info = "event handler for \"" + event + "\"";
  48022. for (var i = 0, l = cbs.length; i < l; i++) {
  48023. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  48024. }
  48025. }
  48026. return vm
  48027. };
  48028. }
  48029. /* */
  48030. var activeInstance = null;
  48031. var isUpdatingChildComponent = false;
  48032. function setActiveInstance(vm) {
  48033. var prevActiveInstance = activeInstance;
  48034. activeInstance = vm;
  48035. return function () {
  48036. activeInstance = prevActiveInstance;
  48037. }
  48038. }
  48039. function initLifecycle (vm) {
  48040. var options = vm.$options;
  48041. // locate first non-abstract parent
  48042. var parent = options.parent;
  48043. if (parent && !options.abstract) {
  48044. while (parent.$options.abstract && parent.$parent) {
  48045. parent = parent.$parent;
  48046. }
  48047. parent.$children.push(vm);
  48048. }
  48049. vm.$parent = parent;
  48050. vm.$root = parent ? parent.$root : vm;
  48051. vm.$children = [];
  48052. vm.$refs = {};
  48053. vm._watcher = null;
  48054. vm._inactive = null;
  48055. vm._directInactive = false;
  48056. vm._isMounted = false;
  48057. vm._isDestroyed = false;
  48058. vm._isBeingDestroyed = false;
  48059. }
  48060. function lifecycleMixin (Vue) {
  48061. Vue.prototype._update = function (vnode, hydrating) {
  48062. var vm = this;
  48063. var prevEl = vm.$el;
  48064. var prevVnode = vm._vnode;
  48065. var restoreActiveInstance = setActiveInstance(vm);
  48066. vm._vnode = vnode;
  48067. // Vue.prototype.__patch__ is injected in entry points
  48068. // based on the rendering backend used.
  48069. if (!prevVnode) {
  48070. // initial render
  48071. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  48072. } else {
  48073. // updates
  48074. vm.$el = vm.__patch__(prevVnode, vnode);
  48075. }
  48076. restoreActiveInstance();
  48077. // update __vue__ reference
  48078. if (prevEl) {
  48079. prevEl.__vue__ = null;
  48080. }
  48081. if (vm.$el) {
  48082. vm.$el.__vue__ = vm;
  48083. }
  48084. // if parent is an HOC, update its $el as well
  48085. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  48086. vm.$parent.$el = vm.$el;
  48087. }
  48088. // updated hook is called by the scheduler to ensure that children are
  48089. // updated in a parent's updated hook.
  48090. };
  48091. Vue.prototype.$forceUpdate = function () {
  48092. var vm = this;
  48093. if (vm._watcher) {
  48094. vm._watcher.update();
  48095. }
  48096. };
  48097. Vue.prototype.$destroy = function () {
  48098. var vm = this;
  48099. if (vm._isBeingDestroyed) {
  48100. return
  48101. }
  48102. callHook(vm, 'beforeDestroy');
  48103. vm._isBeingDestroyed = true;
  48104. // remove self from parent
  48105. var parent = vm.$parent;
  48106. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  48107. remove(parent.$children, vm);
  48108. }
  48109. // teardown watchers
  48110. if (vm._watcher) {
  48111. vm._watcher.teardown();
  48112. }
  48113. var i = vm._watchers.length;
  48114. while (i--) {
  48115. vm._watchers[i].teardown();
  48116. }
  48117. // remove reference from data ob
  48118. // frozen object may not have observer.
  48119. if (vm._data.__ob__) {
  48120. vm._data.__ob__.vmCount--;
  48121. }
  48122. // call the last hook...
  48123. vm._isDestroyed = true;
  48124. // invoke destroy hooks on current rendered tree
  48125. vm.__patch__(vm._vnode, null);
  48126. // fire destroyed hook
  48127. callHook(vm, 'destroyed');
  48128. // turn off all instance listeners.
  48129. vm.$off();
  48130. // remove __vue__ reference
  48131. if (vm.$el) {
  48132. vm.$el.__vue__ = null;
  48133. }
  48134. // release circular reference (#6759)
  48135. if (vm.$vnode) {
  48136. vm.$vnode.parent = null;
  48137. }
  48138. };
  48139. }
  48140. function mountComponent (
  48141. vm,
  48142. el,
  48143. hydrating
  48144. ) {
  48145. vm.$el = el;
  48146. if (!vm.$options.render) {
  48147. vm.$options.render = createEmptyVNode;
  48148. {
  48149. /* istanbul ignore if */
  48150. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  48151. vm.$options.el || el) {
  48152. warn(
  48153. 'You are using the runtime-only build of Vue where the template ' +
  48154. 'compiler is not available. Either pre-compile the templates into ' +
  48155. 'render functions, or use the compiler-included build.',
  48156. vm
  48157. );
  48158. } else {
  48159. warn(
  48160. 'Failed to mount component: template or render function not defined.',
  48161. vm
  48162. );
  48163. }
  48164. }
  48165. }
  48166. callHook(vm, 'beforeMount');
  48167. var updateComponent;
  48168. /* istanbul ignore if */
  48169. if (config.performance && mark) {
  48170. updateComponent = function () {
  48171. var name = vm._name;
  48172. var id = vm._uid;
  48173. var startTag = "vue-perf-start:" + id;
  48174. var endTag = "vue-perf-end:" + id;
  48175. mark(startTag);
  48176. var vnode = vm._render();
  48177. mark(endTag);
  48178. measure(("vue " + name + " render"), startTag, endTag);
  48179. mark(startTag);
  48180. vm._update(vnode, hydrating);
  48181. mark(endTag);
  48182. measure(("vue " + name + " patch"), startTag, endTag);
  48183. };
  48184. } else {
  48185. updateComponent = function () {
  48186. vm._update(vm._render(), hydrating);
  48187. };
  48188. }
  48189. // we set this to vm._watcher inside the watcher's constructor
  48190. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  48191. // component's mounted hook), which relies on vm._watcher being already defined
  48192. new Watcher(vm, updateComponent, noop, {
  48193. before: function before () {
  48194. if (vm._isMounted && !vm._isDestroyed) {
  48195. callHook(vm, 'beforeUpdate');
  48196. }
  48197. }
  48198. }, true /* isRenderWatcher */);
  48199. hydrating = false;
  48200. // manually mounted instance, call mounted on self
  48201. // mounted is called for render-created child components in its inserted hook
  48202. if (vm.$vnode == null) {
  48203. vm._isMounted = true;
  48204. callHook(vm, 'mounted');
  48205. }
  48206. return vm
  48207. }
  48208. function updateChildComponent (
  48209. vm,
  48210. propsData,
  48211. listeners,
  48212. parentVnode,
  48213. renderChildren
  48214. ) {
  48215. {
  48216. isUpdatingChildComponent = true;
  48217. }
  48218. // determine whether component has slot children
  48219. // we need to do this before overwriting $options._renderChildren.
  48220. // check if there are dynamic scopedSlots (hand-written or compiled but with
  48221. // dynamic slot names). Static scoped slots compiled from template has the
  48222. // "$stable" marker.
  48223. var newScopedSlots = parentVnode.data.scopedSlots;
  48224. var oldScopedSlots = vm.$scopedSlots;
  48225. var hasDynamicScopedSlot = !!(
  48226. (newScopedSlots && !newScopedSlots.$stable) ||
  48227. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  48228. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  48229. );
  48230. // Any static slot children from the parent may have changed during parent's
  48231. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  48232. // update is necessary to ensure correctness.
  48233. var needsForceUpdate = !!(
  48234. renderChildren || // has new static slots
  48235. vm.$options._renderChildren || // has old static slots
  48236. hasDynamicScopedSlot
  48237. );
  48238. vm.$options._parentVnode = parentVnode;
  48239. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  48240. if (vm._vnode) { // update child tree's parent
  48241. vm._vnode.parent = parentVnode;
  48242. }
  48243. vm.$options._renderChildren = renderChildren;
  48244. // update $attrs and $listeners hash
  48245. // these are also reactive so they may trigger child update if the child
  48246. // used them during render
  48247. vm.$attrs = parentVnode.data.attrs || emptyObject;
  48248. vm.$listeners = listeners || emptyObject;
  48249. // update props
  48250. if (propsData && vm.$options.props) {
  48251. toggleObserving(false);
  48252. var props = vm._props;
  48253. var propKeys = vm.$options._propKeys || [];
  48254. for (var i = 0; i < propKeys.length; i++) {
  48255. var key = propKeys[i];
  48256. var propOptions = vm.$options.props; // wtf flow?
  48257. props[key] = validateProp(key, propOptions, propsData, vm);
  48258. }
  48259. toggleObserving(true);
  48260. // keep a copy of raw propsData
  48261. vm.$options.propsData = propsData;
  48262. }
  48263. // update listeners
  48264. listeners = listeners || emptyObject;
  48265. var oldListeners = vm.$options._parentListeners;
  48266. vm.$options._parentListeners = listeners;
  48267. updateComponentListeners(vm, listeners, oldListeners);
  48268. // resolve slots + force update if has children
  48269. if (needsForceUpdate) {
  48270. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  48271. vm.$forceUpdate();
  48272. }
  48273. {
  48274. isUpdatingChildComponent = false;
  48275. }
  48276. }
  48277. function isInInactiveTree (vm) {
  48278. while (vm && (vm = vm.$parent)) {
  48279. if (vm._inactive) { return true }
  48280. }
  48281. return false
  48282. }
  48283. function activateChildComponent (vm, direct) {
  48284. if (direct) {
  48285. vm._directInactive = false;
  48286. if (isInInactiveTree(vm)) {
  48287. return
  48288. }
  48289. } else if (vm._directInactive) {
  48290. return
  48291. }
  48292. if (vm._inactive || vm._inactive === null) {
  48293. vm._inactive = false;
  48294. for (var i = 0; i < vm.$children.length; i++) {
  48295. activateChildComponent(vm.$children[i]);
  48296. }
  48297. callHook(vm, 'activated');
  48298. }
  48299. }
  48300. function deactivateChildComponent (vm, direct) {
  48301. if (direct) {
  48302. vm._directInactive = true;
  48303. if (isInInactiveTree(vm)) {
  48304. return
  48305. }
  48306. }
  48307. if (!vm._inactive) {
  48308. vm._inactive = true;
  48309. for (var i = 0; i < vm.$children.length; i++) {
  48310. deactivateChildComponent(vm.$children[i]);
  48311. }
  48312. callHook(vm, 'deactivated');
  48313. }
  48314. }
  48315. function callHook (vm, hook) {
  48316. // #7573 disable dep collection when invoking lifecycle hooks
  48317. pushTarget();
  48318. var handlers = vm.$options[hook];
  48319. var info = hook + " hook";
  48320. if (handlers) {
  48321. for (var i = 0, j = handlers.length; i < j; i++) {
  48322. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  48323. }
  48324. }
  48325. if (vm._hasHookEvent) {
  48326. vm.$emit('hook:' + hook);
  48327. }
  48328. popTarget();
  48329. }
  48330. /* */
  48331. var MAX_UPDATE_COUNT = 100;
  48332. var queue = [];
  48333. var activatedChildren = [];
  48334. var has = {};
  48335. var circular = {};
  48336. var waiting = false;
  48337. var flushing = false;
  48338. var index = 0;
  48339. /**
  48340. * Reset the scheduler's state.
  48341. */
  48342. function resetSchedulerState () {
  48343. index = queue.length = activatedChildren.length = 0;
  48344. has = {};
  48345. {
  48346. circular = {};
  48347. }
  48348. waiting = flushing = false;
  48349. }
  48350. // Async edge case #6566 requires saving the timestamp when event listeners are
  48351. // attached. However, calling performance.now() has a perf overhead especially
  48352. // if the page has thousands of event listeners. Instead, we take a timestamp
  48353. // every time the scheduler flushes and use that for all event listeners
  48354. // attached during that flush.
  48355. var currentFlushTimestamp = 0;
  48356. // Async edge case fix requires storing an event listener's attach timestamp.
  48357. var getNow = Date.now;
  48358. // Determine what event timestamp the browser is using. Annoyingly, the
  48359. // timestamp can either be hi-res (relative to page load) or low-res
  48360. // (relative to UNIX epoch), so in order to compare time we have to use the
  48361. // same timestamp type when saving the flush timestamp.
  48362. // All IE versions use low-res event timestamps, and have problematic clock
  48363. // implementations (#9632)
  48364. if (inBrowser && !isIE) {
  48365. var performance = window.performance;
  48366. if (
  48367. performance &&
  48368. typeof performance.now === 'function' &&
  48369. getNow() > document.createEvent('Event').timeStamp
  48370. ) {
  48371. // if the event timestamp, although evaluated AFTER the Date.now(), is
  48372. // smaller than it, it means the event is using a hi-res timestamp,
  48373. // and we need to use the hi-res version for event listener timestamps as
  48374. // well.
  48375. getNow = function () { return performance.now(); };
  48376. }
  48377. }
  48378. /**
  48379. * Flush both queues and run the watchers.
  48380. */
  48381. function flushSchedulerQueue () {
  48382. currentFlushTimestamp = getNow();
  48383. flushing = true;
  48384. var watcher, id;
  48385. // Sort queue before flush.
  48386. // This ensures that:
  48387. // 1. Components are updated from parent to child. (because parent is always
  48388. // created before the child)
  48389. // 2. A component's user watchers are run before its render watcher (because
  48390. // user watchers are created before the render watcher)
  48391. // 3. If a component is destroyed during a parent component's watcher run,
  48392. // its watchers can be skipped.
  48393. queue.sort(function (a, b) { return a.id - b.id; });
  48394. // do not cache length because more watchers might be pushed
  48395. // as we run existing watchers
  48396. for (index = 0; index < queue.length; index++) {
  48397. watcher = queue[index];
  48398. if (watcher.before) {
  48399. watcher.before();
  48400. }
  48401. id = watcher.id;
  48402. has[id] = null;
  48403. watcher.run();
  48404. // in dev build, check and stop circular updates.
  48405. if (has[id] != null) {
  48406. circular[id] = (circular[id] || 0) + 1;
  48407. if (circular[id] > MAX_UPDATE_COUNT) {
  48408. warn(
  48409. 'You may have an infinite update loop ' + (
  48410. watcher.user
  48411. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  48412. : "in a component render function."
  48413. ),
  48414. watcher.vm
  48415. );
  48416. break
  48417. }
  48418. }
  48419. }
  48420. // keep copies of post queues before resetting state
  48421. var activatedQueue = activatedChildren.slice();
  48422. var updatedQueue = queue.slice();
  48423. resetSchedulerState();
  48424. // call component updated and activated hooks
  48425. callActivatedHooks(activatedQueue);
  48426. callUpdatedHooks(updatedQueue);
  48427. // devtool hook
  48428. /* istanbul ignore if */
  48429. if (devtools && config.devtools) {
  48430. devtools.emit('flush');
  48431. }
  48432. }
  48433. function callUpdatedHooks (queue) {
  48434. var i = queue.length;
  48435. while (i--) {
  48436. var watcher = queue[i];
  48437. var vm = watcher.vm;
  48438. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  48439. callHook(vm, 'updated');
  48440. }
  48441. }
  48442. }
  48443. /**
  48444. * Queue a kept-alive component that was activated during patch.
  48445. * The queue will be processed after the entire tree has been patched.
  48446. */
  48447. function queueActivatedComponent (vm) {
  48448. // setting _inactive to false here so that a render function can
  48449. // rely on checking whether it's in an inactive tree (e.g. router-view)
  48450. vm._inactive = false;
  48451. activatedChildren.push(vm);
  48452. }
  48453. function callActivatedHooks (queue) {
  48454. for (var i = 0; i < queue.length; i++) {
  48455. queue[i]._inactive = true;
  48456. activateChildComponent(queue[i], true /* true */);
  48457. }
  48458. }
  48459. /**
  48460. * Push a watcher into the watcher queue.
  48461. * Jobs with duplicate IDs will be skipped unless it's
  48462. * pushed when the queue is being flushed.
  48463. */
  48464. function queueWatcher (watcher) {
  48465. var id = watcher.id;
  48466. if (has[id] == null) {
  48467. has[id] = true;
  48468. if (!flushing) {
  48469. queue.push(watcher);
  48470. } else {
  48471. // if already flushing, splice the watcher based on its id
  48472. // if already past its id, it will be run next immediately.
  48473. var i = queue.length - 1;
  48474. while (i > index && queue[i].id > watcher.id) {
  48475. i--;
  48476. }
  48477. queue.splice(i + 1, 0, watcher);
  48478. }
  48479. // queue the flush
  48480. if (!waiting) {
  48481. waiting = true;
  48482. if (!config.async) {
  48483. flushSchedulerQueue();
  48484. return
  48485. }
  48486. nextTick(flushSchedulerQueue);
  48487. }
  48488. }
  48489. }
  48490. /* */
  48491. var uid$2 = 0;
  48492. /**
  48493. * A watcher parses an expression, collects dependencies,
  48494. * and fires callback when the expression value changes.
  48495. * This is used for both the $watch() api and directives.
  48496. */
  48497. var Watcher = function Watcher (
  48498. vm,
  48499. expOrFn,
  48500. cb,
  48501. options,
  48502. isRenderWatcher
  48503. ) {
  48504. this.vm = vm;
  48505. if (isRenderWatcher) {
  48506. vm._watcher = this;
  48507. }
  48508. vm._watchers.push(this);
  48509. // options
  48510. if (options) {
  48511. this.deep = !!options.deep;
  48512. this.user = !!options.user;
  48513. this.lazy = !!options.lazy;
  48514. this.sync = !!options.sync;
  48515. this.before = options.before;
  48516. } else {
  48517. this.deep = this.user = this.lazy = this.sync = false;
  48518. }
  48519. this.cb = cb;
  48520. this.id = ++uid$2; // uid for batching
  48521. this.active = true;
  48522. this.dirty = this.lazy; // for lazy watchers
  48523. this.deps = [];
  48524. this.newDeps = [];
  48525. this.depIds = new _Set();
  48526. this.newDepIds = new _Set();
  48527. this.expression = expOrFn.toString();
  48528. // parse expression for getter
  48529. if (typeof expOrFn === 'function') {
  48530. this.getter = expOrFn;
  48531. } else {
  48532. this.getter = parsePath(expOrFn);
  48533. if (!this.getter) {
  48534. this.getter = noop;
  48535. warn(
  48536. "Failed watching path: \"" + expOrFn + "\" " +
  48537. 'Watcher only accepts simple dot-delimited paths. ' +
  48538. 'For full control, use a function instead.',
  48539. vm
  48540. );
  48541. }
  48542. }
  48543. this.value = this.lazy
  48544. ? undefined
  48545. : this.get();
  48546. };
  48547. /**
  48548. * Evaluate the getter, and re-collect dependencies.
  48549. */
  48550. Watcher.prototype.get = function get () {
  48551. pushTarget(this);
  48552. var value;
  48553. var vm = this.vm;
  48554. try {
  48555. value = this.getter.call(vm, vm);
  48556. } catch (e) {
  48557. if (this.user) {
  48558. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48559. } else {
  48560. throw e
  48561. }
  48562. } finally {
  48563. // "touch" every property so they are all tracked as
  48564. // dependencies for deep watching
  48565. if (this.deep) {
  48566. traverse(value);
  48567. }
  48568. popTarget();
  48569. this.cleanupDeps();
  48570. }
  48571. return value
  48572. };
  48573. /**
  48574. * Add a dependency to this directive.
  48575. */
  48576. Watcher.prototype.addDep = function addDep (dep) {
  48577. var id = dep.id;
  48578. if (!this.newDepIds.has(id)) {
  48579. this.newDepIds.add(id);
  48580. this.newDeps.push(dep);
  48581. if (!this.depIds.has(id)) {
  48582. dep.addSub(this);
  48583. }
  48584. }
  48585. };
  48586. /**
  48587. * Clean up for dependency collection.
  48588. */
  48589. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48590. var i = this.deps.length;
  48591. while (i--) {
  48592. var dep = this.deps[i];
  48593. if (!this.newDepIds.has(dep.id)) {
  48594. dep.removeSub(this);
  48595. }
  48596. }
  48597. var tmp = this.depIds;
  48598. this.depIds = this.newDepIds;
  48599. this.newDepIds = tmp;
  48600. this.newDepIds.clear();
  48601. tmp = this.deps;
  48602. this.deps = this.newDeps;
  48603. this.newDeps = tmp;
  48604. this.newDeps.length = 0;
  48605. };
  48606. /**
  48607. * Subscriber interface.
  48608. * Will be called when a dependency changes.
  48609. */
  48610. Watcher.prototype.update = function update () {
  48611. /* istanbul ignore else */
  48612. if (this.lazy) {
  48613. this.dirty = true;
  48614. } else if (this.sync) {
  48615. this.run();
  48616. } else {
  48617. queueWatcher(this);
  48618. }
  48619. };
  48620. /**
  48621. * Scheduler job interface.
  48622. * Will be called by the scheduler.
  48623. */
  48624. Watcher.prototype.run = function run () {
  48625. if (this.active) {
  48626. var value = this.get();
  48627. if (
  48628. value !== this.value ||
  48629. // Deep watchers and watchers on Object/Arrays should fire even
  48630. // when the value is the same, because the value may
  48631. // have mutated.
  48632. isObject(value) ||
  48633. this.deep
  48634. ) {
  48635. // set new value
  48636. var oldValue = this.value;
  48637. this.value = value;
  48638. if (this.user) {
  48639. try {
  48640. this.cb.call(this.vm, value, oldValue);
  48641. } catch (e) {
  48642. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48643. }
  48644. } else {
  48645. this.cb.call(this.vm, value, oldValue);
  48646. }
  48647. }
  48648. }
  48649. };
  48650. /**
  48651. * Evaluate the value of the watcher.
  48652. * This only gets called for lazy watchers.
  48653. */
  48654. Watcher.prototype.evaluate = function evaluate () {
  48655. this.value = this.get();
  48656. this.dirty = false;
  48657. };
  48658. /**
  48659. * Depend on all deps collected by this watcher.
  48660. */
  48661. Watcher.prototype.depend = function depend () {
  48662. var i = this.deps.length;
  48663. while (i--) {
  48664. this.deps[i].depend();
  48665. }
  48666. };
  48667. /**
  48668. * Remove self from all dependencies' subscriber list.
  48669. */
  48670. Watcher.prototype.teardown = function teardown () {
  48671. if (this.active) {
  48672. // remove self from vm's watcher list
  48673. // this is a somewhat expensive operation so we skip it
  48674. // if the vm is being destroyed.
  48675. if (!this.vm._isBeingDestroyed) {
  48676. remove(this.vm._watchers, this);
  48677. }
  48678. var i = this.deps.length;
  48679. while (i--) {
  48680. this.deps[i].removeSub(this);
  48681. }
  48682. this.active = false;
  48683. }
  48684. };
  48685. /* */
  48686. var sharedPropertyDefinition = {
  48687. enumerable: true,
  48688. configurable: true,
  48689. get: noop,
  48690. set: noop
  48691. };
  48692. function proxy (target, sourceKey, key) {
  48693. sharedPropertyDefinition.get = function proxyGetter () {
  48694. return this[sourceKey][key]
  48695. };
  48696. sharedPropertyDefinition.set = function proxySetter (val) {
  48697. this[sourceKey][key] = val;
  48698. };
  48699. Object.defineProperty(target, key, sharedPropertyDefinition);
  48700. }
  48701. function initState (vm) {
  48702. vm._watchers = [];
  48703. var opts = vm.$options;
  48704. if (opts.props) { initProps(vm, opts.props); }
  48705. if (opts.methods) { initMethods(vm, opts.methods); }
  48706. if (opts.data) {
  48707. initData(vm);
  48708. } else {
  48709. observe(vm._data = {}, true /* asRootData */);
  48710. }
  48711. if (opts.computed) { initComputed(vm, opts.computed); }
  48712. if (opts.watch && opts.watch !== nativeWatch) {
  48713. initWatch(vm, opts.watch);
  48714. }
  48715. }
  48716. function initProps (vm, propsOptions) {
  48717. var propsData = vm.$options.propsData || {};
  48718. var props = vm._props = {};
  48719. // cache prop keys so that future props updates can iterate using Array
  48720. // instead of dynamic object key enumeration.
  48721. var keys = vm.$options._propKeys = [];
  48722. var isRoot = !vm.$parent;
  48723. // root instance props should be converted
  48724. if (!isRoot) {
  48725. toggleObserving(false);
  48726. }
  48727. var loop = function ( key ) {
  48728. keys.push(key);
  48729. var value = validateProp(key, propsOptions, propsData, vm);
  48730. /* istanbul ignore else */
  48731. {
  48732. var hyphenatedKey = hyphenate(key);
  48733. if (isReservedAttribute(hyphenatedKey) ||
  48734. config.isReservedAttr(hyphenatedKey)) {
  48735. warn(
  48736. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48737. vm
  48738. );
  48739. }
  48740. defineReactive$$1(props, key, value, function () {
  48741. if (!isRoot && !isUpdatingChildComponent) {
  48742. warn(
  48743. "Avoid mutating a prop directly since the value will be " +
  48744. "overwritten whenever the parent component re-renders. " +
  48745. "Instead, use a data or computed property based on the prop's " +
  48746. "value. Prop being mutated: \"" + key + "\"",
  48747. vm
  48748. );
  48749. }
  48750. });
  48751. }
  48752. // static props are already proxied on the component's prototype
  48753. // during Vue.extend(). We only need to proxy props defined at
  48754. // instantiation here.
  48755. if (!(key in vm)) {
  48756. proxy(vm, "_props", key);
  48757. }
  48758. };
  48759. for (var key in propsOptions) loop( key );
  48760. toggleObserving(true);
  48761. }
  48762. function initData (vm) {
  48763. var data = vm.$options.data;
  48764. data = vm._data = typeof data === 'function'
  48765. ? getData(data, vm)
  48766. : data || {};
  48767. if (!isPlainObject(data)) {
  48768. data = {};
  48769. warn(
  48770. 'data functions should return an object:\n' +
  48771. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  48772. vm
  48773. );
  48774. }
  48775. // proxy data on instance
  48776. var keys = Object.keys(data);
  48777. var props = vm.$options.props;
  48778. var methods = vm.$options.methods;
  48779. var i = keys.length;
  48780. while (i--) {
  48781. var key = keys[i];
  48782. {
  48783. if (methods && hasOwn(methods, key)) {
  48784. warn(
  48785. ("Method \"" + key + "\" has already been defined as a data property."),
  48786. vm
  48787. );
  48788. }
  48789. }
  48790. if (props && hasOwn(props, key)) {
  48791. warn(
  48792. "The data property \"" + key + "\" is already declared as a prop. " +
  48793. "Use prop default value instead.",
  48794. vm
  48795. );
  48796. } else if (!isReserved(key)) {
  48797. proxy(vm, "_data", key);
  48798. }
  48799. }
  48800. // observe data
  48801. observe(data, true /* asRootData */);
  48802. }
  48803. function getData (data, vm) {
  48804. // #7573 disable dep collection when invoking data getters
  48805. pushTarget();
  48806. try {
  48807. return data.call(vm, vm)
  48808. } catch (e) {
  48809. handleError(e, vm, "data()");
  48810. return {}
  48811. } finally {
  48812. popTarget();
  48813. }
  48814. }
  48815. var computedWatcherOptions = { lazy: true };
  48816. function initComputed (vm, computed) {
  48817. // $flow-disable-line
  48818. var watchers = vm._computedWatchers = Object.create(null);
  48819. // computed properties are just getters during SSR
  48820. var isSSR = isServerRendering();
  48821. for (var key in computed) {
  48822. var userDef = computed[key];
  48823. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  48824. if (getter == null) {
  48825. warn(
  48826. ("Getter is missing for computed property \"" + key + "\"."),
  48827. vm
  48828. );
  48829. }
  48830. if (!isSSR) {
  48831. // create internal watcher for the computed property.
  48832. watchers[key] = new Watcher(
  48833. vm,
  48834. getter || noop,
  48835. noop,
  48836. computedWatcherOptions
  48837. );
  48838. }
  48839. // component-defined computed properties are already defined on the
  48840. // component prototype. We only need to define computed properties defined
  48841. // at instantiation here.
  48842. if (!(key in vm)) {
  48843. defineComputed(vm, key, userDef);
  48844. } else {
  48845. if (key in vm.$data) {
  48846. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  48847. } else if (vm.$options.props && key in vm.$options.props) {
  48848. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  48849. }
  48850. }
  48851. }
  48852. }
  48853. function defineComputed (
  48854. target,
  48855. key,
  48856. userDef
  48857. ) {
  48858. var shouldCache = !isServerRendering();
  48859. if (typeof userDef === 'function') {
  48860. sharedPropertyDefinition.get = shouldCache
  48861. ? createComputedGetter(key)
  48862. : createGetterInvoker(userDef);
  48863. sharedPropertyDefinition.set = noop;
  48864. } else {
  48865. sharedPropertyDefinition.get = userDef.get
  48866. ? shouldCache && userDef.cache !== false
  48867. ? createComputedGetter(key)
  48868. : createGetterInvoker(userDef.get)
  48869. : noop;
  48870. sharedPropertyDefinition.set = userDef.set || noop;
  48871. }
  48872. if (sharedPropertyDefinition.set === noop) {
  48873. sharedPropertyDefinition.set = function () {
  48874. warn(
  48875. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  48876. this
  48877. );
  48878. };
  48879. }
  48880. Object.defineProperty(target, key, sharedPropertyDefinition);
  48881. }
  48882. function createComputedGetter (key) {
  48883. return function computedGetter () {
  48884. var watcher = this._computedWatchers && this._computedWatchers[key];
  48885. if (watcher) {
  48886. if (watcher.dirty) {
  48887. watcher.evaluate();
  48888. }
  48889. if (Dep.target) {
  48890. watcher.depend();
  48891. }
  48892. return watcher.value
  48893. }
  48894. }
  48895. }
  48896. function createGetterInvoker(fn) {
  48897. return function computedGetter () {
  48898. return fn.call(this, this)
  48899. }
  48900. }
  48901. function initMethods (vm, methods) {
  48902. var props = vm.$options.props;
  48903. for (var key in methods) {
  48904. {
  48905. if (typeof methods[key] !== 'function') {
  48906. warn(
  48907. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  48908. "Did you reference the function correctly?",
  48909. vm
  48910. );
  48911. }
  48912. if (props && hasOwn(props, key)) {
  48913. warn(
  48914. ("Method \"" + key + "\" has already been defined as a prop."),
  48915. vm
  48916. );
  48917. }
  48918. if ((key in vm) && isReserved(key)) {
  48919. warn(
  48920. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  48921. "Avoid defining component methods that start with _ or $."
  48922. );
  48923. }
  48924. }
  48925. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  48926. }
  48927. }
  48928. function initWatch (vm, watch) {
  48929. for (var key in watch) {
  48930. var handler = watch[key];
  48931. if (Array.isArray(handler)) {
  48932. for (var i = 0; i < handler.length; i++) {
  48933. createWatcher(vm, key, handler[i]);
  48934. }
  48935. } else {
  48936. createWatcher(vm, key, handler);
  48937. }
  48938. }
  48939. }
  48940. function createWatcher (
  48941. vm,
  48942. expOrFn,
  48943. handler,
  48944. options
  48945. ) {
  48946. if (isPlainObject(handler)) {
  48947. options = handler;
  48948. handler = handler.handler;
  48949. }
  48950. if (typeof handler === 'string') {
  48951. handler = vm[handler];
  48952. }
  48953. return vm.$watch(expOrFn, handler, options)
  48954. }
  48955. function stateMixin (Vue) {
  48956. // flow somehow has problems with directly declared definition object
  48957. // when using Object.defineProperty, so we have to procedurally build up
  48958. // the object here.
  48959. var dataDef = {};
  48960. dataDef.get = function () { return this._data };
  48961. var propsDef = {};
  48962. propsDef.get = function () { return this._props };
  48963. {
  48964. dataDef.set = function () {
  48965. warn(
  48966. 'Avoid replacing instance root $data. ' +
  48967. 'Use nested data properties instead.',
  48968. this
  48969. );
  48970. };
  48971. propsDef.set = function () {
  48972. warn("$props is readonly.", this);
  48973. };
  48974. }
  48975. Object.defineProperty(Vue.prototype, '$data', dataDef);
  48976. Object.defineProperty(Vue.prototype, '$props', propsDef);
  48977. Vue.prototype.$set = set;
  48978. Vue.prototype.$delete = del;
  48979. Vue.prototype.$watch = function (
  48980. expOrFn,
  48981. cb,
  48982. options
  48983. ) {
  48984. var vm = this;
  48985. if (isPlainObject(cb)) {
  48986. return createWatcher(vm, expOrFn, cb, options)
  48987. }
  48988. options = options || {};
  48989. options.user = true;
  48990. var watcher = new Watcher(vm, expOrFn, cb, options);
  48991. if (options.immediate) {
  48992. try {
  48993. cb.call(vm, watcher.value);
  48994. } catch (error) {
  48995. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  48996. }
  48997. }
  48998. return function unwatchFn () {
  48999. watcher.teardown();
  49000. }
  49001. };
  49002. }
  49003. /* */
  49004. var uid$3 = 0;
  49005. function initMixin (Vue) {
  49006. Vue.prototype._init = function (options) {
  49007. var vm = this;
  49008. // a uid
  49009. vm._uid = uid$3++;
  49010. var startTag, endTag;
  49011. /* istanbul ignore if */
  49012. if (config.performance && mark) {
  49013. startTag = "vue-perf-start:" + (vm._uid);
  49014. endTag = "vue-perf-end:" + (vm._uid);
  49015. mark(startTag);
  49016. }
  49017. // a flag to avoid this being observed
  49018. vm._isVue = true;
  49019. // merge options
  49020. if (options && options._isComponent) {
  49021. // optimize internal component instantiation
  49022. // since dynamic options merging is pretty slow, and none of the
  49023. // internal component options needs special treatment.
  49024. initInternalComponent(vm, options);
  49025. } else {
  49026. vm.$options = mergeOptions(
  49027. resolveConstructorOptions(vm.constructor),
  49028. options || {},
  49029. vm
  49030. );
  49031. }
  49032. /* istanbul ignore else */
  49033. {
  49034. initProxy(vm);
  49035. }
  49036. // expose real self
  49037. vm._self = vm;
  49038. initLifecycle(vm);
  49039. initEvents(vm);
  49040. initRender(vm);
  49041. callHook(vm, 'beforeCreate');
  49042. initInjections(vm); // resolve injections before data/props
  49043. initState(vm);
  49044. initProvide(vm); // resolve provide after data/props
  49045. callHook(vm, 'created');
  49046. /* istanbul ignore if */
  49047. if (config.performance && mark) {
  49048. vm._name = formatComponentName(vm, false);
  49049. mark(endTag);
  49050. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  49051. }
  49052. if (vm.$options.el) {
  49053. vm.$mount(vm.$options.el);
  49054. }
  49055. };
  49056. }
  49057. function initInternalComponent (vm, options) {
  49058. var opts = vm.$options = Object.create(vm.constructor.options);
  49059. // doing this because it's faster than dynamic enumeration.
  49060. var parentVnode = options._parentVnode;
  49061. opts.parent = options.parent;
  49062. opts._parentVnode = parentVnode;
  49063. var vnodeComponentOptions = parentVnode.componentOptions;
  49064. opts.propsData = vnodeComponentOptions.propsData;
  49065. opts._parentListeners = vnodeComponentOptions.listeners;
  49066. opts._renderChildren = vnodeComponentOptions.children;
  49067. opts._componentTag = vnodeComponentOptions.tag;
  49068. if (options.render) {
  49069. opts.render = options.render;
  49070. opts.staticRenderFns = options.staticRenderFns;
  49071. }
  49072. }
  49073. function resolveConstructorOptions (Ctor) {
  49074. var options = Ctor.options;
  49075. if (Ctor.super) {
  49076. var superOptions = resolveConstructorOptions(Ctor.super);
  49077. var cachedSuperOptions = Ctor.superOptions;
  49078. if (superOptions !== cachedSuperOptions) {
  49079. // super option changed,
  49080. // need to resolve new options.
  49081. Ctor.superOptions = superOptions;
  49082. // check if there are any late-modified/attached options (#4976)
  49083. var modifiedOptions = resolveModifiedOptions(Ctor);
  49084. // update base extend options
  49085. if (modifiedOptions) {
  49086. extend(Ctor.extendOptions, modifiedOptions);
  49087. }
  49088. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  49089. if (options.name) {
  49090. options.components[options.name] = Ctor;
  49091. }
  49092. }
  49093. }
  49094. return options
  49095. }
  49096. function resolveModifiedOptions (Ctor) {
  49097. var modified;
  49098. var latest = Ctor.options;
  49099. var sealed = Ctor.sealedOptions;
  49100. for (var key in latest) {
  49101. if (latest[key] !== sealed[key]) {
  49102. if (!modified) { modified = {}; }
  49103. modified[key] = latest[key];
  49104. }
  49105. }
  49106. return modified
  49107. }
  49108. function Vue (options) {
  49109. if (!(this instanceof Vue)
  49110. ) {
  49111. warn('Vue is a constructor and should be called with the `new` keyword');
  49112. }
  49113. this._init(options);
  49114. }
  49115. initMixin(Vue);
  49116. stateMixin(Vue);
  49117. eventsMixin(Vue);
  49118. lifecycleMixin(Vue);
  49119. renderMixin(Vue);
  49120. /* */
  49121. function initUse (Vue) {
  49122. Vue.use = function (plugin) {
  49123. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  49124. if (installedPlugins.indexOf(plugin) > -1) {
  49125. return this
  49126. }
  49127. // additional parameters
  49128. var args = toArray(arguments, 1);
  49129. args.unshift(this);
  49130. if (typeof plugin.install === 'function') {
  49131. plugin.install.apply(plugin, args);
  49132. } else if (typeof plugin === 'function') {
  49133. plugin.apply(null, args);
  49134. }
  49135. installedPlugins.push(plugin);
  49136. return this
  49137. };
  49138. }
  49139. /* */
  49140. function initMixin$1 (Vue) {
  49141. Vue.mixin = function (mixin) {
  49142. this.options = mergeOptions(this.options, mixin);
  49143. return this
  49144. };
  49145. }
  49146. /* */
  49147. function initExtend (Vue) {
  49148. /**
  49149. * Each instance constructor, including Vue, has a unique
  49150. * cid. This enables us to create wrapped "child
  49151. * constructors" for prototypal inheritance and cache them.
  49152. */
  49153. Vue.cid = 0;
  49154. var cid = 1;
  49155. /**
  49156. * Class inheritance
  49157. */
  49158. Vue.extend = function (extendOptions) {
  49159. extendOptions = extendOptions || {};
  49160. var Super = this;
  49161. var SuperId = Super.cid;
  49162. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  49163. if (cachedCtors[SuperId]) {
  49164. return cachedCtors[SuperId]
  49165. }
  49166. var name = extendOptions.name || Super.options.name;
  49167. if (name) {
  49168. validateComponentName(name);
  49169. }
  49170. var Sub = function VueComponent (options) {
  49171. this._init(options);
  49172. };
  49173. Sub.prototype = Object.create(Super.prototype);
  49174. Sub.prototype.constructor = Sub;
  49175. Sub.cid = cid++;
  49176. Sub.options = mergeOptions(
  49177. Super.options,
  49178. extendOptions
  49179. );
  49180. Sub['super'] = Super;
  49181. // For props and computed properties, we define the proxy getters on
  49182. // the Vue instances at extension time, on the extended prototype. This
  49183. // avoids Object.defineProperty calls for each instance created.
  49184. if (Sub.options.props) {
  49185. initProps$1(Sub);
  49186. }
  49187. if (Sub.options.computed) {
  49188. initComputed$1(Sub);
  49189. }
  49190. // allow further extension/mixin/plugin usage
  49191. Sub.extend = Super.extend;
  49192. Sub.mixin = Super.mixin;
  49193. Sub.use = Super.use;
  49194. // create asset registers, so extended classes
  49195. // can have their private assets too.
  49196. ASSET_TYPES.forEach(function (type) {
  49197. Sub[type] = Super[type];
  49198. });
  49199. // enable recursive self-lookup
  49200. if (name) {
  49201. Sub.options.components[name] = Sub;
  49202. }
  49203. // keep a reference to the super options at extension time.
  49204. // later at instantiation we can check if Super's options have
  49205. // been updated.
  49206. Sub.superOptions = Super.options;
  49207. Sub.extendOptions = extendOptions;
  49208. Sub.sealedOptions = extend({}, Sub.options);
  49209. // cache constructor
  49210. cachedCtors[SuperId] = Sub;
  49211. return Sub
  49212. };
  49213. }
  49214. function initProps$1 (Comp) {
  49215. var props = Comp.options.props;
  49216. for (var key in props) {
  49217. proxy(Comp.prototype, "_props", key);
  49218. }
  49219. }
  49220. function initComputed$1 (Comp) {
  49221. var computed = Comp.options.computed;
  49222. for (var key in computed) {
  49223. defineComputed(Comp.prototype, key, computed[key]);
  49224. }
  49225. }
  49226. /* */
  49227. function initAssetRegisters (Vue) {
  49228. /**
  49229. * Create asset registration methods.
  49230. */
  49231. ASSET_TYPES.forEach(function (type) {
  49232. Vue[type] = function (
  49233. id,
  49234. definition
  49235. ) {
  49236. if (!definition) {
  49237. return this.options[type + 's'][id]
  49238. } else {
  49239. /* istanbul ignore if */
  49240. if (type === 'component') {
  49241. validateComponentName(id);
  49242. }
  49243. if (type === 'component' && isPlainObject(definition)) {
  49244. definition.name = definition.name || id;
  49245. definition = this.options._base.extend(definition);
  49246. }
  49247. if (type === 'directive' && typeof definition === 'function') {
  49248. definition = { bind: definition, update: definition };
  49249. }
  49250. this.options[type + 's'][id] = definition;
  49251. return definition
  49252. }
  49253. };
  49254. });
  49255. }
  49256. /* */
  49257. function getComponentName (opts) {
  49258. return opts && (opts.Ctor.options.name || opts.tag)
  49259. }
  49260. function matches (pattern, name) {
  49261. if (Array.isArray(pattern)) {
  49262. return pattern.indexOf(name) > -1
  49263. } else if (typeof pattern === 'string') {
  49264. return pattern.split(',').indexOf(name) > -1
  49265. } else if (isRegExp(pattern)) {
  49266. return pattern.test(name)
  49267. }
  49268. /* istanbul ignore next */
  49269. return false
  49270. }
  49271. function pruneCache (keepAliveInstance, filter) {
  49272. var cache = keepAliveInstance.cache;
  49273. var keys = keepAliveInstance.keys;
  49274. var _vnode = keepAliveInstance._vnode;
  49275. for (var key in cache) {
  49276. var cachedNode = cache[key];
  49277. if (cachedNode) {
  49278. var name = getComponentName(cachedNode.componentOptions);
  49279. if (name && !filter(name)) {
  49280. pruneCacheEntry(cache, key, keys, _vnode);
  49281. }
  49282. }
  49283. }
  49284. }
  49285. function pruneCacheEntry (
  49286. cache,
  49287. key,
  49288. keys,
  49289. current
  49290. ) {
  49291. var cached$$1 = cache[key];
  49292. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  49293. cached$$1.componentInstance.$destroy();
  49294. }
  49295. cache[key] = null;
  49296. remove(keys, key);
  49297. }
  49298. var patternTypes = [String, RegExp, Array];
  49299. var KeepAlive = {
  49300. name: 'keep-alive',
  49301. abstract: true,
  49302. props: {
  49303. include: patternTypes,
  49304. exclude: patternTypes,
  49305. max: [String, Number]
  49306. },
  49307. created: function created () {
  49308. this.cache = Object.create(null);
  49309. this.keys = [];
  49310. },
  49311. destroyed: function destroyed () {
  49312. for (var key in this.cache) {
  49313. pruneCacheEntry(this.cache, key, this.keys);
  49314. }
  49315. },
  49316. mounted: function mounted () {
  49317. var this$1 = this;
  49318. this.$watch('include', function (val) {
  49319. pruneCache(this$1, function (name) { return matches(val, name); });
  49320. });
  49321. this.$watch('exclude', function (val) {
  49322. pruneCache(this$1, function (name) { return !matches(val, name); });
  49323. });
  49324. },
  49325. render: function render () {
  49326. var slot = this.$slots.default;
  49327. var vnode = getFirstComponentChild(slot);
  49328. var componentOptions = vnode && vnode.componentOptions;
  49329. if (componentOptions) {
  49330. // check pattern
  49331. var name = getComponentName(componentOptions);
  49332. var ref = this;
  49333. var include = ref.include;
  49334. var exclude = ref.exclude;
  49335. if (
  49336. // not included
  49337. (include && (!name || !matches(include, name))) ||
  49338. // excluded
  49339. (exclude && name && matches(exclude, name))
  49340. ) {
  49341. return vnode
  49342. }
  49343. var ref$1 = this;
  49344. var cache = ref$1.cache;
  49345. var keys = ref$1.keys;
  49346. var key = vnode.key == null
  49347. // same constructor may get registered as different local components
  49348. // so cid alone is not enough (#3269)
  49349. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  49350. : vnode.key;
  49351. if (cache[key]) {
  49352. vnode.componentInstance = cache[key].componentInstance;
  49353. // make current key freshest
  49354. remove(keys, key);
  49355. keys.push(key);
  49356. } else {
  49357. cache[key] = vnode;
  49358. keys.push(key);
  49359. // prune oldest entry
  49360. if (this.max && keys.length > parseInt(this.max)) {
  49361. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  49362. }
  49363. }
  49364. vnode.data.keepAlive = true;
  49365. }
  49366. return vnode || (slot && slot[0])
  49367. }
  49368. };
  49369. var builtInComponents = {
  49370. KeepAlive: KeepAlive
  49371. };
  49372. /* */
  49373. function initGlobalAPI (Vue) {
  49374. // config
  49375. var configDef = {};
  49376. configDef.get = function () { return config; };
  49377. {
  49378. configDef.set = function () {
  49379. warn(
  49380. 'Do not replace the Vue.config object, set individual fields instead.'
  49381. );
  49382. };
  49383. }
  49384. Object.defineProperty(Vue, 'config', configDef);
  49385. // exposed util methods.
  49386. // NOTE: these are not considered part of the public API - avoid relying on
  49387. // them unless you are aware of the risk.
  49388. Vue.util = {
  49389. warn: warn,
  49390. extend: extend,
  49391. mergeOptions: mergeOptions,
  49392. defineReactive: defineReactive$$1
  49393. };
  49394. Vue.set = set;
  49395. Vue.delete = del;
  49396. Vue.nextTick = nextTick;
  49397. // 2.6 explicit observable API
  49398. Vue.observable = function (obj) {
  49399. observe(obj);
  49400. return obj
  49401. };
  49402. Vue.options = Object.create(null);
  49403. ASSET_TYPES.forEach(function (type) {
  49404. Vue.options[type + 's'] = Object.create(null);
  49405. });
  49406. // this is used to identify the "base" constructor to extend all plain-object
  49407. // components with in Weex's multi-instance scenarios.
  49408. Vue.options._base = Vue;
  49409. extend(Vue.options.components, builtInComponents);
  49410. initUse(Vue);
  49411. initMixin$1(Vue);
  49412. initExtend(Vue);
  49413. initAssetRegisters(Vue);
  49414. }
  49415. initGlobalAPI(Vue);
  49416. Object.defineProperty(Vue.prototype, '$isServer', {
  49417. get: isServerRendering
  49418. });
  49419. Object.defineProperty(Vue.prototype, '$ssrContext', {
  49420. get: function get () {
  49421. /* istanbul ignore next */
  49422. return this.$vnode && this.$vnode.ssrContext
  49423. }
  49424. });
  49425. // expose FunctionalRenderContext for ssr runtime helper installation
  49426. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  49427. value: FunctionalRenderContext
  49428. });
  49429. Vue.version = '2.6.11';
  49430. /* */
  49431. // these are reserved for web because they are directly compiled away
  49432. // during template compilation
  49433. var isReservedAttr = makeMap('style,class');
  49434. // attributes that should be using props for binding
  49435. var acceptValue = makeMap('input,textarea,option,select,progress');
  49436. var mustUseProp = function (tag, type, attr) {
  49437. return (
  49438. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  49439. (attr === 'selected' && tag === 'option') ||
  49440. (attr === 'checked' && tag === 'input') ||
  49441. (attr === 'muted' && tag === 'video')
  49442. )
  49443. };
  49444. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  49445. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  49446. var convertEnumeratedValue = function (key, value) {
  49447. return isFalsyAttrValue(value) || value === 'false'
  49448. ? 'false'
  49449. // allow arbitrary string value for contenteditable
  49450. : key === 'contenteditable' && isValidContentEditableValue(value)
  49451. ? value
  49452. : 'true'
  49453. };
  49454. var isBooleanAttr = makeMap(
  49455. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  49456. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  49457. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  49458. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  49459. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  49460. 'truespeed,typemustmatch,visible'
  49461. );
  49462. var xlinkNS = 'http://www.w3.org/1999/xlink';
  49463. var isXlink = function (name) {
  49464. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  49465. };
  49466. var getXlinkProp = function (name) {
  49467. return isXlink(name) ? name.slice(6, name.length) : ''
  49468. };
  49469. var isFalsyAttrValue = function (val) {
  49470. return val == null || val === false
  49471. };
  49472. /* */
  49473. function genClassForVnode (vnode) {
  49474. var data = vnode.data;
  49475. var parentNode = vnode;
  49476. var childNode = vnode;
  49477. while (isDef(childNode.componentInstance)) {
  49478. childNode = childNode.componentInstance._vnode;
  49479. if (childNode && childNode.data) {
  49480. data = mergeClassData(childNode.data, data);
  49481. }
  49482. }
  49483. while (isDef(parentNode = parentNode.parent)) {
  49484. if (parentNode && parentNode.data) {
  49485. data = mergeClassData(data, parentNode.data);
  49486. }
  49487. }
  49488. return renderClass(data.staticClass, data.class)
  49489. }
  49490. function mergeClassData (child, parent) {
  49491. return {
  49492. staticClass: concat(child.staticClass, parent.staticClass),
  49493. class: isDef(child.class)
  49494. ? [child.class, parent.class]
  49495. : parent.class
  49496. }
  49497. }
  49498. function renderClass (
  49499. staticClass,
  49500. dynamicClass
  49501. ) {
  49502. if (isDef(staticClass) || isDef(dynamicClass)) {
  49503. return concat(staticClass, stringifyClass(dynamicClass))
  49504. }
  49505. /* istanbul ignore next */
  49506. return ''
  49507. }
  49508. function concat (a, b) {
  49509. return a ? b ? (a + ' ' + b) : a : (b || '')
  49510. }
  49511. function stringifyClass (value) {
  49512. if (Array.isArray(value)) {
  49513. return stringifyArray(value)
  49514. }
  49515. if (isObject(value)) {
  49516. return stringifyObject(value)
  49517. }
  49518. if (typeof value === 'string') {
  49519. return value
  49520. }
  49521. /* istanbul ignore next */
  49522. return ''
  49523. }
  49524. function stringifyArray (value) {
  49525. var res = '';
  49526. var stringified;
  49527. for (var i = 0, l = value.length; i < l; i++) {
  49528. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49529. if (res) { res += ' '; }
  49530. res += stringified;
  49531. }
  49532. }
  49533. return res
  49534. }
  49535. function stringifyObject (value) {
  49536. var res = '';
  49537. for (var key in value) {
  49538. if (value[key]) {
  49539. if (res) { res += ' '; }
  49540. res += key;
  49541. }
  49542. }
  49543. return res
  49544. }
  49545. /* */
  49546. var namespaceMap = {
  49547. svg: 'http://www.w3.org/2000/svg',
  49548. math: 'http://www.w3.org/1998/Math/MathML'
  49549. };
  49550. var isHTMLTag = makeMap(
  49551. 'html,body,base,head,link,meta,style,title,' +
  49552. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49553. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49554. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49555. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49556. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49557. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49558. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49559. 'output,progress,select,textarea,' +
  49560. 'details,dialog,menu,menuitem,summary,' +
  49561. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49562. );
  49563. // this map is intentionally selective, only covering SVG elements that may
  49564. // contain child elements.
  49565. var isSVG = makeMap(
  49566. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49567. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49568. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49569. true
  49570. );
  49571. var isPreTag = function (tag) { return tag === 'pre'; };
  49572. var isReservedTag = function (tag) {
  49573. return isHTMLTag(tag) || isSVG(tag)
  49574. };
  49575. function getTagNamespace (tag) {
  49576. if (isSVG(tag)) {
  49577. return 'svg'
  49578. }
  49579. // basic support for MathML
  49580. // note it doesn't support other MathML elements being component roots
  49581. if (tag === 'math') {
  49582. return 'math'
  49583. }
  49584. }
  49585. var unknownElementCache = Object.create(null);
  49586. function isUnknownElement (tag) {
  49587. /* istanbul ignore if */
  49588. if (!inBrowser) {
  49589. return true
  49590. }
  49591. if (isReservedTag(tag)) {
  49592. return false
  49593. }
  49594. tag = tag.toLowerCase();
  49595. /* istanbul ignore if */
  49596. if (unknownElementCache[tag] != null) {
  49597. return unknownElementCache[tag]
  49598. }
  49599. var el = document.createElement(tag);
  49600. if (tag.indexOf('-') > -1) {
  49601. // http://stackoverflow.com/a/28210364/1070244
  49602. return (unknownElementCache[tag] = (
  49603. el.constructor === window.HTMLUnknownElement ||
  49604. el.constructor === window.HTMLElement
  49605. ))
  49606. } else {
  49607. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49608. }
  49609. }
  49610. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49611. /* */
  49612. /**
  49613. * Query an element selector if it's not an element already.
  49614. */
  49615. function query (el) {
  49616. if (typeof el === 'string') {
  49617. var selected = document.querySelector(el);
  49618. if (!selected) {
  49619. warn(
  49620. 'Cannot find element: ' + el
  49621. );
  49622. return document.createElement('div')
  49623. }
  49624. return selected
  49625. } else {
  49626. return el
  49627. }
  49628. }
  49629. /* */
  49630. function createElement$1 (tagName, vnode) {
  49631. var elm = document.createElement(tagName);
  49632. if (tagName !== 'select') {
  49633. return elm
  49634. }
  49635. // false or null will remove the attribute but undefined will not
  49636. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49637. elm.setAttribute('multiple', 'multiple');
  49638. }
  49639. return elm
  49640. }
  49641. function createElementNS (namespace, tagName) {
  49642. return document.createElementNS(namespaceMap[namespace], tagName)
  49643. }
  49644. function createTextNode (text) {
  49645. return document.createTextNode(text)
  49646. }
  49647. function createComment (text) {
  49648. return document.createComment(text)
  49649. }
  49650. function insertBefore (parentNode, newNode, referenceNode) {
  49651. parentNode.insertBefore(newNode, referenceNode);
  49652. }
  49653. function removeChild (node, child) {
  49654. node.removeChild(child);
  49655. }
  49656. function appendChild (node, child) {
  49657. node.appendChild(child);
  49658. }
  49659. function parentNode (node) {
  49660. return node.parentNode
  49661. }
  49662. function nextSibling (node) {
  49663. return node.nextSibling
  49664. }
  49665. function tagName (node) {
  49666. return node.tagName
  49667. }
  49668. function setTextContent (node, text) {
  49669. node.textContent = text;
  49670. }
  49671. function setStyleScope (node, scopeId) {
  49672. node.setAttribute(scopeId, '');
  49673. }
  49674. var nodeOps = /*#__PURE__*/Object.freeze({
  49675. createElement: createElement$1,
  49676. createElementNS: createElementNS,
  49677. createTextNode: createTextNode,
  49678. createComment: createComment,
  49679. insertBefore: insertBefore,
  49680. removeChild: removeChild,
  49681. appendChild: appendChild,
  49682. parentNode: parentNode,
  49683. nextSibling: nextSibling,
  49684. tagName: tagName,
  49685. setTextContent: setTextContent,
  49686. setStyleScope: setStyleScope
  49687. });
  49688. /* */
  49689. var ref = {
  49690. create: function create (_, vnode) {
  49691. registerRef(vnode);
  49692. },
  49693. update: function update (oldVnode, vnode) {
  49694. if (oldVnode.data.ref !== vnode.data.ref) {
  49695. registerRef(oldVnode, true);
  49696. registerRef(vnode);
  49697. }
  49698. },
  49699. destroy: function destroy (vnode) {
  49700. registerRef(vnode, true);
  49701. }
  49702. };
  49703. function registerRef (vnode, isRemoval) {
  49704. var key = vnode.data.ref;
  49705. if (!isDef(key)) { return }
  49706. var vm = vnode.context;
  49707. var ref = vnode.componentInstance || vnode.elm;
  49708. var refs = vm.$refs;
  49709. if (isRemoval) {
  49710. if (Array.isArray(refs[key])) {
  49711. remove(refs[key], ref);
  49712. } else if (refs[key] === ref) {
  49713. refs[key] = undefined;
  49714. }
  49715. } else {
  49716. if (vnode.data.refInFor) {
  49717. if (!Array.isArray(refs[key])) {
  49718. refs[key] = [ref];
  49719. } else if (refs[key].indexOf(ref) < 0) {
  49720. // $flow-disable-line
  49721. refs[key].push(ref);
  49722. }
  49723. } else {
  49724. refs[key] = ref;
  49725. }
  49726. }
  49727. }
  49728. /**
  49729. * Virtual DOM patching algorithm based on Snabbdom by
  49730. * Simon Friis Vindum (@paldepind)
  49731. * Licensed under the MIT License
  49732. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49733. *
  49734. * modified by Evan You (@yyx990803)
  49735. *
  49736. * Not type-checking this because this file is perf-critical and the cost
  49737. * of making flow understand it is not worth it.
  49738. */
  49739. var emptyNode = new VNode('', {}, []);
  49740. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49741. function sameVnode (a, b) {
  49742. return (
  49743. a.key === b.key && (
  49744. (
  49745. a.tag === b.tag &&
  49746. a.isComment === b.isComment &&
  49747. isDef(a.data) === isDef(b.data) &&
  49748. sameInputType(a, b)
  49749. ) || (
  49750. isTrue(a.isAsyncPlaceholder) &&
  49751. a.asyncFactory === b.asyncFactory &&
  49752. isUndef(b.asyncFactory.error)
  49753. )
  49754. )
  49755. )
  49756. }
  49757. function sameInputType (a, b) {
  49758. if (a.tag !== 'input') { return true }
  49759. var i;
  49760. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  49761. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  49762. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  49763. }
  49764. function createKeyToOldIdx (children, beginIdx, endIdx) {
  49765. var i, key;
  49766. var map = {};
  49767. for (i = beginIdx; i <= endIdx; ++i) {
  49768. key = children[i].key;
  49769. if (isDef(key)) { map[key] = i; }
  49770. }
  49771. return map
  49772. }
  49773. function createPatchFunction (backend) {
  49774. var i, j;
  49775. var cbs = {};
  49776. var modules = backend.modules;
  49777. var nodeOps = backend.nodeOps;
  49778. for (i = 0; i < hooks.length; ++i) {
  49779. cbs[hooks[i]] = [];
  49780. for (j = 0; j < modules.length; ++j) {
  49781. if (isDef(modules[j][hooks[i]])) {
  49782. cbs[hooks[i]].push(modules[j][hooks[i]]);
  49783. }
  49784. }
  49785. }
  49786. function emptyNodeAt (elm) {
  49787. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  49788. }
  49789. function createRmCb (childElm, listeners) {
  49790. function remove$$1 () {
  49791. if (--remove$$1.listeners === 0) {
  49792. removeNode(childElm);
  49793. }
  49794. }
  49795. remove$$1.listeners = listeners;
  49796. return remove$$1
  49797. }
  49798. function removeNode (el) {
  49799. var parent = nodeOps.parentNode(el);
  49800. // element may have already been removed due to v-html / v-text
  49801. if (isDef(parent)) {
  49802. nodeOps.removeChild(parent, el);
  49803. }
  49804. }
  49805. function isUnknownElement$$1 (vnode, inVPre) {
  49806. return (
  49807. !inVPre &&
  49808. !vnode.ns &&
  49809. !(
  49810. config.ignoredElements.length &&
  49811. config.ignoredElements.some(function (ignore) {
  49812. return isRegExp(ignore)
  49813. ? ignore.test(vnode.tag)
  49814. : ignore === vnode.tag
  49815. })
  49816. ) &&
  49817. config.isUnknownElement(vnode.tag)
  49818. )
  49819. }
  49820. var creatingElmInVPre = 0;
  49821. function createElm (
  49822. vnode,
  49823. insertedVnodeQueue,
  49824. parentElm,
  49825. refElm,
  49826. nested,
  49827. ownerArray,
  49828. index
  49829. ) {
  49830. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49831. // This vnode was used in a previous render!
  49832. // now it's used as a new node, overwriting its elm would cause
  49833. // potential patch errors down the road when it's used as an insertion
  49834. // reference node. Instead, we clone the node on-demand before creating
  49835. // associated DOM element for it.
  49836. vnode = ownerArray[index] = cloneVNode(vnode);
  49837. }
  49838. vnode.isRootInsert = !nested; // for transition enter check
  49839. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  49840. return
  49841. }
  49842. var data = vnode.data;
  49843. var children = vnode.children;
  49844. var tag = vnode.tag;
  49845. if (isDef(tag)) {
  49846. {
  49847. if (data && data.pre) {
  49848. creatingElmInVPre++;
  49849. }
  49850. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  49851. warn(
  49852. 'Unknown custom element: <' + tag + '> - did you ' +
  49853. 'register the component correctly? For recursive components, ' +
  49854. 'make sure to provide the "name" option.',
  49855. vnode.context
  49856. );
  49857. }
  49858. }
  49859. vnode.elm = vnode.ns
  49860. ? nodeOps.createElementNS(vnode.ns, tag)
  49861. : nodeOps.createElement(tag, vnode);
  49862. setScope(vnode);
  49863. /* istanbul ignore if */
  49864. {
  49865. createChildren(vnode, children, insertedVnodeQueue);
  49866. if (isDef(data)) {
  49867. invokeCreateHooks(vnode, insertedVnodeQueue);
  49868. }
  49869. insert(parentElm, vnode.elm, refElm);
  49870. }
  49871. if (data && data.pre) {
  49872. creatingElmInVPre--;
  49873. }
  49874. } else if (isTrue(vnode.isComment)) {
  49875. vnode.elm = nodeOps.createComment(vnode.text);
  49876. insert(parentElm, vnode.elm, refElm);
  49877. } else {
  49878. vnode.elm = nodeOps.createTextNode(vnode.text);
  49879. insert(parentElm, vnode.elm, refElm);
  49880. }
  49881. }
  49882. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49883. var i = vnode.data;
  49884. if (isDef(i)) {
  49885. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  49886. if (isDef(i = i.hook) && isDef(i = i.init)) {
  49887. i(vnode, false /* hydrating */);
  49888. }
  49889. // after calling the init hook, if the vnode is a child component
  49890. // it should've created a child instance and mounted it. the child
  49891. // component also has set the placeholder vnode's elm.
  49892. // in that case we can just return the element and be done.
  49893. if (isDef(vnode.componentInstance)) {
  49894. initComponent(vnode, insertedVnodeQueue);
  49895. insert(parentElm, vnode.elm, refElm);
  49896. if (isTrue(isReactivated)) {
  49897. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  49898. }
  49899. return true
  49900. }
  49901. }
  49902. }
  49903. function initComponent (vnode, insertedVnodeQueue) {
  49904. if (isDef(vnode.data.pendingInsert)) {
  49905. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  49906. vnode.data.pendingInsert = null;
  49907. }
  49908. vnode.elm = vnode.componentInstance.$el;
  49909. if (isPatchable(vnode)) {
  49910. invokeCreateHooks(vnode, insertedVnodeQueue);
  49911. setScope(vnode);
  49912. } else {
  49913. // empty component root.
  49914. // skip all element-related modules except for ref (#3455)
  49915. registerRef(vnode);
  49916. // make sure to invoke the insert hook
  49917. insertedVnodeQueue.push(vnode);
  49918. }
  49919. }
  49920. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49921. var i;
  49922. // hack for #4339: a reactivated component with inner transition
  49923. // does not trigger because the inner node's created hooks are not called
  49924. // again. It's not ideal to involve module-specific logic in here but
  49925. // there doesn't seem to be a better way to do it.
  49926. var innerNode = vnode;
  49927. while (innerNode.componentInstance) {
  49928. innerNode = innerNode.componentInstance._vnode;
  49929. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  49930. for (i = 0; i < cbs.activate.length; ++i) {
  49931. cbs.activate[i](emptyNode, innerNode);
  49932. }
  49933. insertedVnodeQueue.push(innerNode);
  49934. break
  49935. }
  49936. }
  49937. // unlike a newly created component,
  49938. // a reactivated keep-alive component doesn't insert itself
  49939. insert(parentElm, vnode.elm, refElm);
  49940. }
  49941. function insert (parent, elm, ref$$1) {
  49942. if (isDef(parent)) {
  49943. if (isDef(ref$$1)) {
  49944. if (nodeOps.parentNode(ref$$1) === parent) {
  49945. nodeOps.insertBefore(parent, elm, ref$$1);
  49946. }
  49947. } else {
  49948. nodeOps.appendChild(parent, elm);
  49949. }
  49950. }
  49951. }
  49952. function createChildren (vnode, children, insertedVnodeQueue) {
  49953. if (Array.isArray(children)) {
  49954. {
  49955. checkDuplicateKeys(children);
  49956. }
  49957. for (var i = 0; i < children.length; ++i) {
  49958. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  49959. }
  49960. } else if (isPrimitive(vnode.text)) {
  49961. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  49962. }
  49963. }
  49964. function isPatchable (vnode) {
  49965. while (vnode.componentInstance) {
  49966. vnode = vnode.componentInstance._vnode;
  49967. }
  49968. return isDef(vnode.tag)
  49969. }
  49970. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  49971. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49972. cbs.create[i$1](emptyNode, vnode);
  49973. }
  49974. i = vnode.data.hook; // Reuse variable
  49975. if (isDef(i)) {
  49976. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  49977. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  49978. }
  49979. }
  49980. // set scope id attribute for scoped CSS.
  49981. // this is implemented as a special case to avoid the overhead
  49982. // of going through the normal attribute patching process.
  49983. function setScope (vnode) {
  49984. var i;
  49985. if (isDef(i = vnode.fnScopeId)) {
  49986. nodeOps.setStyleScope(vnode.elm, i);
  49987. } else {
  49988. var ancestor = vnode;
  49989. while (ancestor) {
  49990. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  49991. nodeOps.setStyleScope(vnode.elm, i);
  49992. }
  49993. ancestor = ancestor.parent;
  49994. }
  49995. }
  49996. // for slot content they should also get the scopeId from the host instance.
  49997. if (isDef(i = activeInstance) &&
  49998. i !== vnode.context &&
  49999. i !== vnode.fnContext &&
  50000. isDef(i = i.$options._scopeId)
  50001. ) {
  50002. nodeOps.setStyleScope(vnode.elm, i);
  50003. }
  50004. }
  50005. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  50006. for (; startIdx <= endIdx; ++startIdx) {
  50007. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  50008. }
  50009. }
  50010. function invokeDestroyHook (vnode) {
  50011. var i, j;
  50012. var data = vnode.data;
  50013. if (isDef(data)) {
  50014. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  50015. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  50016. }
  50017. if (isDef(i = vnode.children)) {
  50018. for (j = 0; j < vnode.children.length; ++j) {
  50019. invokeDestroyHook(vnode.children[j]);
  50020. }
  50021. }
  50022. }
  50023. function removeVnodes (vnodes, startIdx, endIdx) {
  50024. for (; startIdx <= endIdx; ++startIdx) {
  50025. var ch = vnodes[startIdx];
  50026. if (isDef(ch)) {
  50027. if (isDef(ch.tag)) {
  50028. removeAndInvokeRemoveHook(ch);
  50029. invokeDestroyHook(ch);
  50030. } else { // Text node
  50031. removeNode(ch.elm);
  50032. }
  50033. }
  50034. }
  50035. }
  50036. function removeAndInvokeRemoveHook (vnode, rm) {
  50037. if (isDef(rm) || isDef(vnode.data)) {
  50038. var i;
  50039. var listeners = cbs.remove.length + 1;
  50040. if (isDef(rm)) {
  50041. // we have a recursively passed down rm callback
  50042. // increase the listeners count
  50043. rm.listeners += listeners;
  50044. } else {
  50045. // directly removing
  50046. rm = createRmCb(vnode.elm, listeners);
  50047. }
  50048. // recursively invoke hooks on child component root node
  50049. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  50050. removeAndInvokeRemoveHook(i, rm);
  50051. }
  50052. for (i = 0; i < cbs.remove.length; ++i) {
  50053. cbs.remove[i](vnode, rm);
  50054. }
  50055. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  50056. i(vnode, rm);
  50057. } else {
  50058. rm();
  50059. }
  50060. } else {
  50061. removeNode(vnode.elm);
  50062. }
  50063. }
  50064. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  50065. var oldStartIdx = 0;
  50066. var newStartIdx = 0;
  50067. var oldEndIdx = oldCh.length - 1;
  50068. var oldStartVnode = oldCh[0];
  50069. var oldEndVnode = oldCh[oldEndIdx];
  50070. var newEndIdx = newCh.length - 1;
  50071. var newStartVnode = newCh[0];
  50072. var newEndVnode = newCh[newEndIdx];
  50073. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  50074. // removeOnly is a special flag used only by <transition-group>
  50075. // to ensure removed elements stay in correct relative positions
  50076. // during leaving transitions
  50077. var canMove = !removeOnly;
  50078. {
  50079. checkDuplicateKeys(newCh);
  50080. }
  50081. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  50082. if (isUndef(oldStartVnode)) {
  50083. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  50084. } else if (isUndef(oldEndVnode)) {
  50085. oldEndVnode = oldCh[--oldEndIdx];
  50086. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  50087. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50088. oldStartVnode = oldCh[++oldStartIdx];
  50089. newStartVnode = newCh[++newStartIdx];
  50090. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  50091. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50092. oldEndVnode = oldCh[--oldEndIdx];
  50093. newEndVnode = newCh[--newEndIdx];
  50094. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  50095. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50096. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  50097. oldStartVnode = oldCh[++oldStartIdx];
  50098. newEndVnode = newCh[--newEndIdx];
  50099. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  50100. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50101. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  50102. oldEndVnode = oldCh[--oldEndIdx];
  50103. newStartVnode = newCh[++newStartIdx];
  50104. } else {
  50105. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  50106. idxInOld = isDef(newStartVnode.key)
  50107. ? oldKeyToIdx[newStartVnode.key]
  50108. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  50109. if (isUndef(idxInOld)) { // New element
  50110. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50111. } else {
  50112. vnodeToMove = oldCh[idxInOld];
  50113. if (sameVnode(vnodeToMove, newStartVnode)) {
  50114. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50115. oldCh[idxInOld] = undefined;
  50116. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  50117. } else {
  50118. // same key but different element. treat as new element
  50119. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50120. }
  50121. }
  50122. newStartVnode = newCh[++newStartIdx];
  50123. }
  50124. }
  50125. if (oldStartIdx > oldEndIdx) {
  50126. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  50127. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  50128. } else if (newStartIdx > newEndIdx) {
  50129. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  50130. }
  50131. }
  50132. function checkDuplicateKeys (children) {
  50133. var seenKeys = {};
  50134. for (var i = 0; i < children.length; i++) {
  50135. var vnode = children[i];
  50136. var key = vnode.key;
  50137. if (isDef(key)) {
  50138. if (seenKeys[key]) {
  50139. warn(
  50140. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  50141. vnode.context
  50142. );
  50143. } else {
  50144. seenKeys[key] = true;
  50145. }
  50146. }
  50147. }
  50148. }
  50149. function findIdxInOld (node, oldCh, start, end) {
  50150. for (var i = start; i < end; i++) {
  50151. var c = oldCh[i];
  50152. if (isDef(c) && sameVnode(node, c)) { return i }
  50153. }
  50154. }
  50155. function patchVnode (
  50156. oldVnode,
  50157. vnode,
  50158. insertedVnodeQueue,
  50159. ownerArray,
  50160. index,
  50161. removeOnly
  50162. ) {
  50163. if (oldVnode === vnode) {
  50164. return
  50165. }
  50166. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50167. // clone reused vnode
  50168. vnode = ownerArray[index] = cloneVNode(vnode);
  50169. }
  50170. var elm = vnode.elm = oldVnode.elm;
  50171. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  50172. if (isDef(vnode.asyncFactory.resolved)) {
  50173. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  50174. } else {
  50175. vnode.isAsyncPlaceholder = true;
  50176. }
  50177. return
  50178. }
  50179. // reuse element for static trees.
  50180. // note we only do this if the vnode is cloned -
  50181. // if the new node is not cloned it means the render functions have been
  50182. // reset by the hot-reload-api and we need to do a proper re-render.
  50183. if (isTrue(vnode.isStatic) &&
  50184. isTrue(oldVnode.isStatic) &&
  50185. vnode.key === oldVnode.key &&
  50186. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  50187. ) {
  50188. vnode.componentInstance = oldVnode.componentInstance;
  50189. return
  50190. }
  50191. var i;
  50192. var data = vnode.data;
  50193. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  50194. i(oldVnode, vnode);
  50195. }
  50196. var oldCh = oldVnode.children;
  50197. var ch = vnode.children;
  50198. if (isDef(data) && isPatchable(vnode)) {
  50199. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  50200. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  50201. }
  50202. if (isUndef(vnode.text)) {
  50203. if (isDef(oldCh) && isDef(ch)) {
  50204. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  50205. } else if (isDef(ch)) {
  50206. {
  50207. checkDuplicateKeys(ch);
  50208. }
  50209. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  50210. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  50211. } else if (isDef(oldCh)) {
  50212. removeVnodes(oldCh, 0, oldCh.length - 1);
  50213. } else if (isDef(oldVnode.text)) {
  50214. nodeOps.setTextContent(elm, '');
  50215. }
  50216. } else if (oldVnode.text !== vnode.text) {
  50217. nodeOps.setTextContent(elm, vnode.text);
  50218. }
  50219. if (isDef(data)) {
  50220. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  50221. }
  50222. }
  50223. function invokeInsertHook (vnode, queue, initial) {
  50224. // delay insert hooks for component root nodes, invoke them after the
  50225. // element is really inserted
  50226. if (isTrue(initial) && isDef(vnode.parent)) {
  50227. vnode.parent.data.pendingInsert = queue;
  50228. } else {
  50229. for (var i = 0; i < queue.length; ++i) {
  50230. queue[i].data.hook.insert(queue[i]);
  50231. }
  50232. }
  50233. }
  50234. var hydrationBailed = false;
  50235. // list of modules that can skip create hook during hydration because they
  50236. // are already rendered on the client or has no need for initialization
  50237. // Note: style is excluded because it relies on initial clone for future
  50238. // deep updates (#7063).
  50239. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  50240. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  50241. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  50242. var i;
  50243. var tag = vnode.tag;
  50244. var data = vnode.data;
  50245. var children = vnode.children;
  50246. inVPre = inVPre || (data && data.pre);
  50247. vnode.elm = elm;
  50248. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  50249. vnode.isAsyncPlaceholder = true;
  50250. return true
  50251. }
  50252. // assert node match
  50253. {
  50254. if (!assertNodeMatch(elm, vnode, inVPre)) {
  50255. return false
  50256. }
  50257. }
  50258. if (isDef(data)) {
  50259. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  50260. if (isDef(i = vnode.componentInstance)) {
  50261. // child component. it should have hydrated its own tree.
  50262. initComponent(vnode, insertedVnodeQueue);
  50263. return true
  50264. }
  50265. }
  50266. if (isDef(tag)) {
  50267. if (isDef(children)) {
  50268. // empty element, allow client to pick up and populate children
  50269. if (!elm.hasChildNodes()) {
  50270. createChildren(vnode, children, insertedVnodeQueue);
  50271. } else {
  50272. // v-html and domProps: innerHTML
  50273. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  50274. if (i !== elm.innerHTML) {
  50275. /* istanbul ignore if */
  50276. if (typeof console !== 'undefined' &&
  50277. !hydrationBailed
  50278. ) {
  50279. hydrationBailed = true;
  50280. console.warn('Parent: ', elm);
  50281. console.warn('server innerHTML: ', i);
  50282. console.warn('client innerHTML: ', elm.innerHTML);
  50283. }
  50284. return false
  50285. }
  50286. } else {
  50287. // iterate and compare children lists
  50288. var childrenMatch = true;
  50289. var childNode = elm.firstChild;
  50290. for (var i$1 = 0; i$1 < children.length; i$1++) {
  50291. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  50292. childrenMatch = false;
  50293. break
  50294. }
  50295. childNode = childNode.nextSibling;
  50296. }
  50297. // if childNode is not null, it means the actual childNodes list is
  50298. // longer than the virtual children list.
  50299. if (!childrenMatch || childNode) {
  50300. /* istanbul ignore if */
  50301. if (typeof console !== 'undefined' &&
  50302. !hydrationBailed
  50303. ) {
  50304. hydrationBailed = true;
  50305. console.warn('Parent: ', elm);
  50306. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  50307. }
  50308. return false
  50309. }
  50310. }
  50311. }
  50312. }
  50313. if (isDef(data)) {
  50314. var fullInvoke = false;
  50315. for (var key in data) {
  50316. if (!isRenderedModule(key)) {
  50317. fullInvoke = true;
  50318. invokeCreateHooks(vnode, insertedVnodeQueue);
  50319. break
  50320. }
  50321. }
  50322. if (!fullInvoke && data['class']) {
  50323. // ensure collecting deps for deep class bindings for future updates
  50324. traverse(data['class']);
  50325. }
  50326. }
  50327. } else if (elm.data !== vnode.text) {
  50328. elm.data = vnode.text;
  50329. }
  50330. return true
  50331. }
  50332. function assertNodeMatch (node, vnode, inVPre) {
  50333. if (isDef(vnode.tag)) {
  50334. return vnode.tag.indexOf('vue-component') === 0 || (
  50335. !isUnknownElement$$1(vnode, inVPre) &&
  50336. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  50337. )
  50338. } else {
  50339. return node.nodeType === (vnode.isComment ? 8 : 3)
  50340. }
  50341. }
  50342. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  50343. if (isUndef(vnode)) {
  50344. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  50345. return
  50346. }
  50347. var isInitialPatch = false;
  50348. var insertedVnodeQueue = [];
  50349. if (isUndef(oldVnode)) {
  50350. // empty mount (likely as component), create new root element
  50351. isInitialPatch = true;
  50352. createElm(vnode, insertedVnodeQueue);
  50353. } else {
  50354. var isRealElement = isDef(oldVnode.nodeType);
  50355. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  50356. // patch existing root node
  50357. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  50358. } else {
  50359. if (isRealElement) {
  50360. // mounting to a real element
  50361. // check if this is server-rendered content and if we can perform
  50362. // a successful hydration.
  50363. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  50364. oldVnode.removeAttribute(SSR_ATTR);
  50365. hydrating = true;
  50366. }
  50367. if (isTrue(hydrating)) {
  50368. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  50369. invokeInsertHook(vnode, insertedVnodeQueue, true);
  50370. return oldVnode
  50371. } else {
  50372. warn(
  50373. 'The client-side rendered virtual DOM tree is not matching ' +
  50374. 'server-rendered content. This is likely caused by incorrect ' +
  50375. 'HTML markup, for example nesting block-level elements inside ' +
  50376. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  50377. 'full client-side render.'
  50378. );
  50379. }
  50380. }
  50381. // either not server-rendered, or hydration failed.
  50382. // create an empty node and replace it
  50383. oldVnode = emptyNodeAt(oldVnode);
  50384. }
  50385. // replacing existing element
  50386. var oldElm = oldVnode.elm;
  50387. var parentElm = nodeOps.parentNode(oldElm);
  50388. // create new node
  50389. createElm(
  50390. vnode,
  50391. insertedVnodeQueue,
  50392. // extremely rare edge case: do not insert if old element is in a
  50393. // leaving transition. Only happens when combining transition +
  50394. // keep-alive + HOCs. (#4590)
  50395. oldElm._leaveCb ? null : parentElm,
  50396. nodeOps.nextSibling(oldElm)
  50397. );
  50398. // update parent placeholder node element, recursively
  50399. if (isDef(vnode.parent)) {
  50400. var ancestor = vnode.parent;
  50401. var patchable = isPatchable(vnode);
  50402. while (ancestor) {
  50403. for (var i = 0; i < cbs.destroy.length; ++i) {
  50404. cbs.destroy[i](ancestor);
  50405. }
  50406. ancestor.elm = vnode.elm;
  50407. if (patchable) {
  50408. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50409. cbs.create[i$1](emptyNode, ancestor);
  50410. }
  50411. // #6513
  50412. // invoke insert hooks that may have been merged by create hooks.
  50413. // e.g. for directives that uses the "inserted" hook.
  50414. var insert = ancestor.data.hook.insert;
  50415. if (insert.merged) {
  50416. // start at index 1 to avoid re-invoking component mounted hook
  50417. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  50418. insert.fns[i$2]();
  50419. }
  50420. }
  50421. } else {
  50422. registerRef(ancestor);
  50423. }
  50424. ancestor = ancestor.parent;
  50425. }
  50426. }
  50427. // destroy old node
  50428. if (isDef(parentElm)) {
  50429. removeVnodes([oldVnode], 0, 0);
  50430. } else if (isDef(oldVnode.tag)) {
  50431. invokeDestroyHook(oldVnode);
  50432. }
  50433. }
  50434. }
  50435. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  50436. return vnode.elm
  50437. }
  50438. }
  50439. /* */
  50440. var directives = {
  50441. create: updateDirectives,
  50442. update: updateDirectives,
  50443. destroy: function unbindDirectives (vnode) {
  50444. updateDirectives(vnode, emptyNode);
  50445. }
  50446. };
  50447. function updateDirectives (oldVnode, vnode) {
  50448. if (oldVnode.data.directives || vnode.data.directives) {
  50449. _update(oldVnode, vnode);
  50450. }
  50451. }
  50452. function _update (oldVnode, vnode) {
  50453. var isCreate = oldVnode === emptyNode;
  50454. var isDestroy = vnode === emptyNode;
  50455. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  50456. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  50457. var dirsWithInsert = [];
  50458. var dirsWithPostpatch = [];
  50459. var key, oldDir, dir;
  50460. for (key in newDirs) {
  50461. oldDir = oldDirs[key];
  50462. dir = newDirs[key];
  50463. if (!oldDir) {
  50464. // new directive, bind
  50465. callHook$1(dir, 'bind', vnode, oldVnode);
  50466. if (dir.def && dir.def.inserted) {
  50467. dirsWithInsert.push(dir);
  50468. }
  50469. } else {
  50470. // existing directive, update
  50471. dir.oldValue = oldDir.value;
  50472. dir.oldArg = oldDir.arg;
  50473. callHook$1(dir, 'update', vnode, oldVnode);
  50474. if (dir.def && dir.def.componentUpdated) {
  50475. dirsWithPostpatch.push(dir);
  50476. }
  50477. }
  50478. }
  50479. if (dirsWithInsert.length) {
  50480. var callInsert = function () {
  50481. for (var i = 0; i < dirsWithInsert.length; i++) {
  50482. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  50483. }
  50484. };
  50485. if (isCreate) {
  50486. mergeVNodeHook(vnode, 'insert', callInsert);
  50487. } else {
  50488. callInsert();
  50489. }
  50490. }
  50491. if (dirsWithPostpatch.length) {
  50492. mergeVNodeHook(vnode, 'postpatch', function () {
  50493. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  50494. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  50495. }
  50496. });
  50497. }
  50498. if (!isCreate) {
  50499. for (key in oldDirs) {
  50500. if (!newDirs[key]) {
  50501. // no longer present, unbind
  50502. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50503. }
  50504. }
  50505. }
  50506. }
  50507. var emptyModifiers = Object.create(null);
  50508. function normalizeDirectives$1 (
  50509. dirs,
  50510. vm
  50511. ) {
  50512. var res = Object.create(null);
  50513. if (!dirs) {
  50514. // $flow-disable-line
  50515. return res
  50516. }
  50517. var i, dir;
  50518. for (i = 0; i < dirs.length; i++) {
  50519. dir = dirs[i];
  50520. if (!dir.modifiers) {
  50521. // $flow-disable-line
  50522. dir.modifiers = emptyModifiers;
  50523. }
  50524. res[getRawDirName(dir)] = dir;
  50525. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50526. }
  50527. // $flow-disable-line
  50528. return res
  50529. }
  50530. function getRawDirName (dir) {
  50531. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50532. }
  50533. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50534. var fn = dir.def && dir.def[hook];
  50535. if (fn) {
  50536. try {
  50537. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50538. } catch (e) {
  50539. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50540. }
  50541. }
  50542. }
  50543. var baseModules = [
  50544. ref,
  50545. directives
  50546. ];
  50547. /* */
  50548. function updateAttrs (oldVnode, vnode) {
  50549. var opts = vnode.componentOptions;
  50550. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50551. return
  50552. }
  50553. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50554. return
  50555. }
  50556. var key, cur, old;
  50557. var elm = vnode.elm;
  50558. var oldAttrs = oldVnode.data.attrs || {};
  50559. var attrs = vnode.data.attrs || {};
  50560. // clone observed objects, as the user probably wants to mutate it
  50561. if (isDef(attrs.__ob__)) {
  50562. attrs = vnode.data.attrs = extend({}, attrs);
  50563. }
  50564. for (key in attrs) {
  50565. cur = attrs[key];
  50566. old = oldAttrs[key];
  50567. if (old !== cur) {
  50568. setAttr(elm, key, cur);
  50569. }
  50570. }
  50571. // #4391: in IE9, setting type can reset value for input[type=radio]
  50572. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50573. /* istanbul ignore if */
  50574. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50575. setAttr(elm, 'value', attrs.value);
  50576. }
  50577. for (key in oldAttrs) {
  50578. if (isUndef(attrs[key])) {
  50579. if (isXlink(key)) {
  50580. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50581. } else if (!isEnumeratedAttr(key)) {
  50582. elm.removeAttribute(key);
  50583. }
  50584. }
  50585. }
  50586. }
  50587. function setAttr (el, key, value) {
  50588. if (el.tagName.indexOf('-') > -1) {
  50589. baseSetAttr(el, key, value);
  50590. } else if (isBooleanAttr(key)) {
  50591. // set attribute for blank value
  50592. // e.g. <option disabled>Select one</option>
  50593. if (isFalsyAttrValue(value)) {
  50594. el.removeAttribute(key);
  50595. } else {
  50596. // technically allowfullscreen is a boolean attribute for <iframe>,
  50597. // but Flash expects a value of "true" when used on <embed> tag
  50598. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50599. ? 'true'
  50600. : key;
  50601. el.setAttribute(key, value);
  50602. }
  50603. } else if (isEnumeratedAttr(key)) {
  50604. el.setAttribute(key, convertEnumeratedValue(key, value));
  50605. } else if (isXlink(key)) {
  50606. if (isFalsyAttrValue(value)) {
  50607. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50608. } else {
  50609. el.setAttributeNS(xlinkNS, key, value);
  50610. }
  50611. } else {
  50612. baseSetAttr(el, key, value);
  50613. }
  50614. }
  50615. function baseSetAttr (el, key, value) {
  50616. if (isFalsyAttrValue(value)) {
  50617. el.removeAttribute(key);
  50618. } else {
  50619. // #7138: IE10 & 11 fires input event when setting placeholder on
  50620. // <textarea>... block the first input event and remove the blocker
  50621. // immediately.
  50622. /* istanbul ignore if */
  50623. if (
  50624. isIE && !isIE9 &&
  50625. el.tagName === 'TEXTAREA' &&
  50626. key === 'placeholder' && value !== '' && !el.__ieph
  50627. ) {
  50628. var blocker = function (e) {
  50629. e.stopImmediatePropagation();
  50630. el.removeEventListener('input', blocker);
  50631. };
  50632. el.addEventListener('input', blocker);
  50633. // $flow-disable-line
  50634. el.__ieph = true; /* IE placeholder patched */
  50635. }
  50636. el.setAttribute(key, value);
  50637. }
  50638. }
  50639. var attrs = {
  50640. create: updateAttrs,
  50641. update: updateAttrs
  50642. };
  50643. /* */
  50644. function updateClass (oldVnode, vnode) {
  50645. var el = vnode.elm;
  50646. var data = vnode.data;
  50647. var oldData = oldVnode.data;
  50648. if (
  50649. isUndef(data.staticClass) &&
  50650. isUndef(data.class) && (
  50651. isUndef(oldData) || (
  50652. isUndef(oldData.staticClass) &&
  50653. isUndef(oldData.class)
  50654. )
  50655. )
  50656. ) {
  50657. return
  50658. }
  50659. var cls = genClassForVnode(vnode);
  50660. // handle transition classes
  50661. var transitionClass = el._transitionClasses;
  50662. if (isDef(transitionClass)) {
  50663. cls = concat(cls, stringifyClass(transitionClass));
  50664. }
  50665. // set the class
  50666. if (cls !== el._prevClass) {
  50667. el.setAttribute('class', cls);
  50668. el._prevClass = cls;
  50669. }
  50670. }
  50671. var klass = {
  50672. create: updateClass,
  50673. update: updateClass
  50674. };
  50675. /* */
  50676. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50677. function parseFilters (exp) {
  50678. var inSingle = false;
  50679. var inDouble = false;
  50680. var inTemplateString = false;
  50681. var inRegex = false;
  50682. var curly = 0;
  50683. var square = 0;
  50684. var paren = 0;
  50685. var lastFilterIndex = 0;
  50686. var c, prev, i, expression, filters;
  50687. for (i = 0; i < exp.length; i++) {
  50688. prev = c;
  50689. c = exp.charCodeAt(i);
  50690. if (inSingle) {
  50691. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50692. } else if (inDouble) {
  50693. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50694. } else if (inTemplateString) {
  50695. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50696. } else if (inRegex) {
  50697. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50698. } else if (
  50699. c === 0x7C && // pipe
  50700. exp.charCodeAt(i + 1) !== 0x7C &&
  50701. exp.charCodeAt(i - 1) !== 0x7C &&
  50702. !curly && !square && !paren
  50703. ) {
  50704. if (expression === undefined) {
  50705. // first filter, end of expression
  50706. lastFilterIndex = i + 1;
  50707. expression = exp.slice(0, i).trim();
  50708. } else {
  50709. pushFilter();
  50710. }
  50711. } else {
  50712. switch (c) {
  50713. case 0x22: inDouble = true; break // "
  50714. case 0x27: inSingle = true; break // '
  50715. case 0x60: inTemplateString = true; break // `
  50716. case 0x28: paren++; break // (
  50717. case 0x29: paren--; break // )
  50718. case 0x5B: square++; break // [
  50719. case 0x5D: square--; break // ]
  50720. case 0x7B: curly++; break // {
  50721. case 0x7D: curly--; break // }
  50722. }
  50723. if (c === 0x2f) { // /
  50724. var j = i - 1;
  50725. var p = (void 0);
  50726. // find first non-whitespace prev char
  50727. for (; j >= 0; j--) {
  50728. p = exp.charAt(j);
  50729. if (p !== ' ') { break }
  50730. }
  50731. if (!p || !validDivisionCharRE.test(p)) {
  50732. inRegex = true;
  50733. }
  50734. }
  50735. }
  50736. }
  50737. if (expression === undefined) {
  50738. expression = exp.slice(0, i).trim();
  50739. } else if (lastFilterIndex !== 0) {
  50740. pushFilter();
  50741. }
  50742. function pushFilter () {
  50743. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50744. lastFilterIndex = i + 1;
  50745. }
  50746. if (filters) {
  50747. for (i = 0; i < filters.length; i++) {
  50748. expression = wrapFilter(expression, filters[i]);
  50749. }
  50750. }
  50751. return expression
  50752. }
  50753. function wrapFilter (exp, filter) {
  50754. var i = filter.indexOf('(');
  50755. if (i < 0) {
  50756. // _f: resolveFilter
  50757. return ("_f(\"" + filter + "\")(" + exp + ")")
  50758. } else {
  50759. var name = filter.slice(0, i);
  50760. var args = filter.slice(i + 1);
  50761. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  50762. }
  50763. }
  50764. /* */
  50765. /* eslint-disable no-unused-vars */
  50766. function baseWarn (msg, range) {
  50767. console.error(("[Vue compiler]: " + msg));
  50768. }
  50769. /* eslint-enable no-unused-vars */
  50770. function pluckModuleFunction (
  50771. modules,
  50772. key
  50773. ) {
  50774. return modules
  50775. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  50776. : []
  50777. }
  50778. function addProp (el, name, value, range, dynamic) {
  50779. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50780. el.plain = false;
  50781. }
  50782. function addAttr (el, name, value, range, dynamic) {
  50783. var attrs = dynamic
  50784. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  50785. : (el.attrs || (el.attrs = []));
  50786. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50787. el.plain = false;
  50788. }
  50789. // add a raw attr (use this in preTransforms)
  50790. function addRawAttr (el, name, value, range) {
  50791. el.attrsMap[name] = value;
  50792. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  50793. }
  50794. function addDirective (
  50795. el,
  50796. name,
  50797. rawName,
  50798. value,
  50799. arg,
  50800. isDynamicArg,
  50801. modifiers,
  50802. range
  50803. ) {
  50804. (el.directives || (el.directives = [])).push(rangeSetItem({
  50805. name: name,
  50806. rawName: rawName,
  50807. value: value,
  50808. arg: arg,
  50809. isDynamicArg: isDynamicArg,
  50810. modifiers: modifiers
  50811. }, range));
  50812. el.plain = false;
  50813. }
  50814. function prependModifierMarker (symbol, name, dynamic) {
  50815. return dynamic
  50816. ? ("_p(" + name + ",\"" + symbol + "\")")
  50817. : symbol + name // mark the event as captured
  50818. }
  50819. function addHandler (
  50820. el,
  50821. name,
  50822. value,
  50823. modifiers,
  50824. important,
  50825. warn,
  50826. range,
  50827. dynamic
  50828. ) {
  50829. modifiers = modifiers || emptyObject;
  50830. // warn prevent and passive modifier
  50831. /* istanbul ignore if */
  50832. if (
  50833. warn &&
  50834. modifiers.prevent && modifiers.passive
  50835. ) {
  50836. warn(
  50837. 'passive and prevent can\'t be used together. ' +
  50838. 'Passive handler can\'t prevent default event.',
  50839. range
  50840. );
  50841. }
  50842. // normalize click.right and click.middle since they don't actually fire
  50843. // this is technically browser-specific, but at least for now browsers are
  50844. // the only target envs that have right/middle clicks.
  50845. if (modifiers.right) {
  50846. if (dynamic) {
  50847. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  50848. } else if (name === 'click') {
  50849. name = 'contextmenu';
  50850. delete modifiers.right;
  50851. }
  50852. } else if (modifiers.middle) {
  50853. if (dynamic) {
  50854. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  50855. } else if (name === 'click') {
  50856. name = 'mouseup';
  50857. }
  50858. }
  50859. // check capture modifier
  50860. if (modifiers.capture) {
  50861. delete modifiers.capture;
  50862. name = prependModifierMarker('!', name, dynamic);
  50863. }
  50864. if (modifiers.once) {
  50865. delete modifiers.once;
  50866. name = prependModifierMarker('~', name, dynamic);
  50867. }
  50868. /* istanbul ignore if */
  50869. if (modifiers.passive) {
  50870. delete modifiers.passive;
  50871. name = prependModifierMarker('&', name, dynamic);
  50872. }
  50873. var events;
  50874. if (modifiers.native) {
  50875. delete modifiers.native;
  50876. events = el.nativeEvents || (el.nativeEvents = {});
  50877. } else {
  50878. events = el.events || (el.events = {});
  50879. }
  50880. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  50881. if (modifiers !== emptyObject) {
  50882. newHandler.modifiers = modifiers;
  50883. }
  50884. var handlers = events[name];
  50885. /* istanbul ignore if */
  50886. if (Array.isArray(handlers)) {
  50887. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  50888. } else if (handlers) {
  50889. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  50890. } else {
  50891. events[name] = newHandler;
  50892. }
  50893. el.plain = false;
  50894. }
  50895. function getRawBindingAttr (
  50896. el,
  50897. name
  50898. ) {
  50899. return el.rawAttrsMap[':' + name] ||
  50900. el.rawAttrsMap['v-bind:' + name] ||
  50901. el.rawAttrsMap[name]
  50902. }
  50903. function getBindingAttr (
  50904. el,
  50905. name,
  50906. getStatic
  50907. ) {
  50908. var dynamicValue =
  50909. getAndRemoveAttr(el, ':' + name) ||
  50910. getAndRemoveAttr(el, 'v-bind:' + name);
  50911. if (dynamicValue != null) {
  50912. return parseFilters(dynamicValue)
  50913. } else if (getStatic !== false) {
  50914. var staticValue = getAndRemoveAttr(el, name);
  50915. if (staticValue != null) {
  50916. return JSON.stringify(staticValue)
  50917. }
  50918. }
  50919. }
  50920. // note: this only removes the attr from the Array (attrsList) so that it
  50921. // doesn't get processed by processAttrs.
  50922. // By default it does NOT remove it from the map (attrsMap) because the map is
  50923. // needed during codegen.
  50924. function getAndRemoveAttr (
  50925. el,
  50926. name,
  50927. removeFromMap
  50928. ) {
  50929. var val;
  50930. if ((val = el.attrsMap[name]) != null) {
  50931. var list = el.attrsList;
  50932. for (var i = 0, l = list.length; i < l; i++) {
  50933. if (list[i].name === name) {
  50934. list.splice(i, 1);
  50935. break
  50936. }
  50937. }
  50938. }
  50939. if (removeFromMap) {
  50940. delete el.attrsMap[name];
  50941. }
  50942. return val
  50943. }
  50944. function getAndRemoveAttrByRegex (
  50945. el,
  50946. name
  50947. ) {
  50948. var list = el.attrsList;
  50949. for (var i = 0, l = list.length; i < l; i++) {
  50950. var attr = list[i];
  50951. if (name.test(attr.name)) {
  50952. list.splice(i, 1);
  50953. return attr
  50954. }
  50955. }
  50956. }
  50957. function rangeSetItem (
  50958. item,
  50959. range
  50960. ) {
  50961. if (range) {
  50962. if (range.start != null) {
  50963. item.start = range.start;
  50964. }
  50965. if (range.end != null) {
  50966. item.end = range.end;
  50967. }
  50968. }
  50969. return item
  50970. }
  50971. /* */
  50972. /**
  50973. * Cross-platform code generation for component v-model
  50974. */
  50975. function genComponentModel (
  50976. el,
  50977. value,
  50978. modifiers
  50979. ) {
  50980. var ref = modifiers || {};
  50981. var number = ref.number;
  50982. var trim = ref.trim;
  50983. var baseValueExpression = '$$v';
  50984. var valueExpression = baseValueExpression;
  50985. if (trim) {
  50986. valueExpression =
  50987. "(typeof " + baseValueExpression + " === 'string'" +
  50988. "? " + baseValueExpression + ".trim()" +
  50989. ": " + baseValueExpression + ")";
  50990. }
  50991. if (number) {
  50992. valueExpression = "_n(" + valueExpression + ")";
  50993. }
  50994. var assignment = genAssignmentCode(value, valueExpression);
  50995. el.model = {
  50996. value: ("(" + value + ")"),
  50997. expression: JSON.stringify(value),
  50998. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  50999. };
  51000. }
  51001. /**
  51002. * Cross-platform codegen helper for generating v-model value assignment code.
  51003. */
  51004. function genAssignmentCode (
  51005. value,
  51006. assignment
  51007. ) {
  51008. var res = parseModel(value);
  51009. if (res.key === null) {
  51010. return (value + "=" + assignment)
  51011. } else {
  51012. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  51013. }
  51014. }
  51015. /**
  51016. * Parse a v-model expression into a base path and a final key segment.
  51017. * Handles both dot-path and possible square brackets.
  51018. *
  51019. * Possible cases:
  51020. *
  51021. * - test
  51022. * - test[key]
  51023. * - test[test1[key]]
  51024. * - test["a"][key]
  51025. * - xxx.test[a[a].test1[key]]
  51026. * - test.xxx.a["asa"][test1[key]]
  51027. *
  51028. */
  51029. var len, str, chr, index$1, expressionPos, expressionEndPos;
  51030. function parseModel (val) {
  51031. // Fix https://github.com/vuejs/vue/pull/7730
  51032. // allow v-model="obj.val " (trailing whitespace)
  51033. val = val.trim();
  51034. len = val.length;
  51035. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  51036. index$1 = val.lastIndexOf('.');
  51037. if (index$1 > -1) {
  51038. return {
  51039. exp: val.slice(0, index$1),
  51040. key: '"' + val.slice(index$1 + 1) + '"'
  51041. }
  51042. } else {
  51043. return {
  51044. exp: val,
  51045. key: null
  51046. }
  51047. }
  51048. }
  51049. str = val;
  51050. index$1 = expressionPos = expressionEndPos = 0;
  51051. while (!eof()) {
  51052. chr = next();
  51053. /* istanbul ignore if */
  51054. if (isStringStart(chr)) {
  51055. parseString(chr);
  51056. } else if (chr === 0x5B) {
  51057. parseBracket(chr);
  51058. }
  51059. }
  51060. return {
  51061. exp: val.slice(0, expressionPos),
  51062. key: val.slice(expressionPos + 1, expressionEndPos)
  51063. }
  51064. }
  51065. function next () {
  51066. return str.charCodeAt(++index$1)
  51067. }
  51068. function eof () {
  51069. return index$1 >= len
  51070. }
  51071. function isStringStart (chr) {
  51072. return chr === 0x22 || chr === 0x27
  51073. }
  51074. function parseBracket (chr) {
  51075. var inBracket = 1;
  51076. expressionPos = index$1;
  51077. while (!eof()) {
  51078. chr = next();
  51079. if (isStringStart(chr)) {
  51080. parseString(chr);
  51081. continue
  51082. }
  51083. if (chr === 0x5B) { inBracket++; }
  51084. if (chr === 0x5D) { inBracket--; }
  51085. if (inBracket === 0) {
  51086. expressionEndPos = index$1;
  51087. break
  51088. }
  51089. }
  51090. }
  51091. function parseString (chr) {
  51092. var stringQuote = chr;
  51093. while (!eof()) {
  51094. chr = next();
  51095. if (chr === stringQuote) {
  51096. break
  51097. }
  51098. }
  51099. }
  51100. /* */
  51101. var warn$1;
  51102. // in some cases, the event used has to be determined at runtime
  51103. // so we used some reserved tokens during compile.
  51104. var RANGE_TOKEN = '__r';
  51105. var CHECKBOX_RADIO_TOKEN = '__c';
  51106. function model (
  51107. el,
  51108. dir,
  51109. _warn
  51110. ) {
  51111. warn$1 = _warn;
  51112. var value = dir.value;
  51113. var modifiers = dir.modifiers;
  51114. var tag = el.tag;
  51115. var type = el.attrsMap.type;
  51116. {
  51117. // inputs with type="file" are read only and setting the input's
  51118. // value will throw an error.
  51119. if (tag === 'input' && type === 'file') {
  51120. warn$1(
  51121. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  51122. "File inputs are read only. Use a v-on:change listener instead.",
  51123. el.rawAttrsMap['v-model']
  51124. );
  51125. }
  51126. }
  51127. if (el.component) {
  51128. genComponentModel(el, value, modifiers);
  51129. // component v-model doesn't need extra runtime
  51130. return false
  51131. } else if (tag === 'select') {
  51132. genSelect(el, value, modifiers);
  51133. } else if (tag === 'input' && type === 'checkbox') {
  51134. genCheckboxModel(el, value, modifiers);
  51135. } else if (tag === 'input' && type === 'radio') {
  51136. genRadioModel(el, value, modifiers);
  51137. } else if (tag === 'input' || tag === 'textarea') {
  51138. genDefaultModel(el, value, modifiers);
  51139. } else if (!config.isReservedTag(tag)) {
  51140. genComponentModel(el, value, modifiers);
  51141. // component v-model doesn't need extra runtime
  51142. return false
  51143. } else {
  51144. warn$1(
  51145. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  51146. "v-model is not supported on this element type. " +
  51147. 'If you are working with contenteditable, it\'s recommended to ' +
  51148. 'wrap a library dedicated for that purpose inside a custom component.',
  51149. el.rawAttrsMap['v-model']
  51150. );
  51151. }
  51152. // ensure runtime directive metadata
  51153. return true
  51154. }
  51155. function genCheckboxModel (
  51156. el,
  51157. value,
  51158. modifiers
  51159. ) {
  51160. var number = modifiers && modifiers.number;
  51161. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51162. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  51163. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  51164. addProp(el, 'checked',
  51165. "Array.isArray(" + value + ")" +
  51166. "?_i(" + value + "," + valueBinding + ")>-1" + (
  51167. trueValueBinding === 'true'
  51168. ? (":(" + value + ")")
  51169. : (":_q(" + value + "," + trueValueBinding + ")")
  51170. )
  51171. );
  51172. addHandler(el, 'change',
  51173. "var $$a=" + value + "," +
  51174. '$$el=$event.target,' +
  51175. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  51176. 'if(Array.isArray($$a)){' +
  51177. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  51178. '$$i=_i($$a,$$v);' +
  51179. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  51180. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  51181. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  51182. null, true
  51183. );
  51184. }
  51185. function genRadioModel (
  51186. el,
  51187. value,
  51188. modifiers
  51189. ) {
  51190. var number = modifiers && modifiers.number;
  51191. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51192. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  51193. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  51194. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  51195. }
  51196. function genSelect (
  51197. el,
  51198. value,
  51199. modifiers
  51200. ) {
  51201. var number = modifiers && modifiers.number;
  51202. var selectedVal = "Array.prototype.filter" +
  51203. ".call($event.target.options,function(o){return o.selected})" +
  51204. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  51205. "return " + (number ? '_n(val)' : 'val') + "})";
  51206. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  51207. var code = "var $$selectedVal = " + selectedVal + ";";
  51208. code = code + " " + (genAssignmentCode(value, assignment));
  51209. addHandler(el, 'change', code, null, true);
  51210. }
  51211. function genDefaultModel (
  51212. el,
  51213. value,
  51214. modifiers
  51215. ) {
  51216. var type = el.attrsMap.type;
  51217. // warn if v-bind:value conflicts with v-model
  51218. // except for inputs with v-bind:type
  51219. {
  51220. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  51221. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  51222. if (value$1 && !typeBinding) {
  51223. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  51224. warn$1(
  51225. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  51226. 'because the latter already expands to a value binding internally',
  51227. el.rawAttrsMap[binding]
  51228. );
  51229. }
  51230. }
  51231. var ref = modifiers || {};
  51232. var lazy = ref.lazy;
  51233. var number = ref.number;
  51234. var trim = ref.trim;
  51235. var needCompositionGuard = !lazy && type !== 'range';
  51236. var event = lazy
  51237. ? 'change'
  51238. : type === 'range'
  51239. ? RANGE_TOKEN
  51240. : 'input';
  51241. var valueExpression = '$event.target.value';
  51242. if (trim) {
  51243. valueExpression = "$event.target.value.trim()";
  51244. }
  51245. if (number) {
  51246. valueExpression = "_n(" + valueExpression + ")";
  51247. }
  51248. var code = genAssignmentCode(value, valueExpression);
  51249. if (needCompositionGuard) {
  51250. code = "if($event.target.composing)return;" + code;
  51251. }
  51252. addProp(el, 'value', ("(" + value + ")"));
  51253. addHandler(el, event, code, null, true);
  51254. if (trim || number) {
  51255. addHandler(el, 'blur', '$forceUpdate()');
  51256. }
  51257. }
  51258. /* */
  51259. // normalize v-model event tokens that can only be determined at runtime.
  51260. // it's important to place the event as the first in the array because
  51261. // the whole point is ensuring the v-model callback gets called before
  51262. // user-attached handlers.
  51263. function normalizeEvents (on) {
  51264. /* istanbul ignore if */
  51265. if (isDef(on[RANGE_TOKEN])) {
  51266. // IE input[type=range] only supports `change` event
  51267. var event = isIE ? 'change' : 'input';
  51268. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  51269. delete on[RANGE_TOKEN];
  51270. }
  51271. // This was originally intended to fix #4521 but no longer necessary
  51272. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  51273. /* istanbul ignore if */
  51274. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  51275. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  51276. delete on[CHECKBOX_RADIO_TOKEN];
  51277. }
  51278. }
  51279. var target$1;
  51280. function createOnceHandler$1 (event, handler, capture) {
  51281. var _target = target$1; // save current target element in closure
  51282. return function onceHandler () {
  51283. var res = handler.apply(null, arguments);
  51284. if (res !== null) {
  51285. remove$2(event, onceHandler, capture, _target);
  51286. }
  51287. }
  51288. }
  51289. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  51290. // implementation and does not fire microtasks in between event propagation, so
  51291. // safe to exclude.
  51292. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  51293. function add$1 (
  51294. name,
  51295. handler,
  51296. capture,
  51297. passive
  51298. ) {
  51299. // async edge case #6566: inner click event triggers patch, event handler
  51300. // attached to outer element during patch, and triggered again. This
  51301. // happens because browsers fire microtask ticks between event propagation.
  51302. // the solution is simple: we save the timestamp when a handler is attached,
  51303. // and the handler would only fire if the event passed to it was fired
  51304. // AFTER it was attached.
  51305. if (useMicrotaskFix) {
  51306. var attachedTimestamp = currentFlushTimestamp;
  51307. var original = handler;
  51308. handler = original._wrapper = function (e) {
  51309. if (
  51310. // no bubbling, should always fire.
  51311. // this is just a safety net in case event.timeStamp is unreliable in
  51312. // certain weird environments...
  51313. e.target === e.currentTarget ||
  51314. // event is fired after handler attachment
  51315. e.timeStamp >= attachedTimestamp ||
  51316. // bail for environments that have buggy event.timeStamp implementations
  51317. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  51318. // #9681 QtWebEngine event.timeStamp is negative value
  51319. e.timeStamp <= 0 ||
  51320. // #9448 bail if event is fired in another document in a multi-page
  51321. // electron/nw.js app, since event.timeStamp will be using a different
  51322. // starting reference
  51323. e.target.ownerDocument !== document
  51324. ) {
  51325. return original.apply(this, arguments)
  51326. }
  51327. };
  51328. }
  51329. target$1.addEventListener(
  51330. name,
  51331. handler,
  51332. supportsPassive
  51333. ? { capture: capture, passive: passive }
  51334. : capture
  51335. );
  51336. }
  51337. function remove$2 (
  51338. name,
  51339. handler,
  51340. capture,
  51341. _target
  51342. ) {
  51343. (_target || target$1).removeEventListener(
  51344. name,
  51345. handler._wrapper || handler,
  51346. capture
  51347. );
  51348. }
  51349. function updateDOMListeners (oldVnode, vnode) {
  51350. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  51351. return
  51352. }
  51353. var on = vnode.data.on || {};
  51354. var oldOn = oldVnode.data.on || {};
  51355. target$1 = vnode.elm;
  51356. normalizeEvents(on);
  51357. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  51358. target$1 = undefined;
  51359. }
  51360. var events = {
  51361. create: updateDOMListeners,
  51362. update: updateDOMListeners
  51363. };
  51364. /* */
  51365. var svgContainer;
  51366. function updateDOMProps (oldVnode, vnode) {
  51367. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  51368. return
  51369. }
  51370. var key, cur;
  51371. var elm = vnode.elm;
  51372. var oldProps = oldVnode.data.domProps || {};
  51373. var props = vnode.data.domProps || {};
  51374. // clone observed objects, as the user probably wants to mutate it
  51375. if (isDef(props.__ob__)) {
  51376. props = vnode.data.domProps = extend({}, props);
  51377. }
  51378. for (key in oldProps) {
  51379. if (!(key in props)) {
  51380. elm[key] = '';
  51381. }
  51382. }
  51383. for (key in props) {
  51384. cur = props[key];
  51385. // ignore children if the node has textContent or innerHTML,
  51386. // as these will throw away existing DOM nodes and cause removal errors
  51387. // on subsequent patches (#3360)
  51388. if (key === 'textContent' || key === 'innerHTML') {
  51389. if (vnode.children) { vnode.children.length = 0; }
  51390. if (cur === oldProps[key]) { continue }
  51391. // #6601 work around Chrome version <= 55 bug where single textNode
  51392. // replaced by innerHTML/textContent retains its parentNode property
  51393. if (elm.childNodes.length === 1) {
  51394. elm.removeChild(elm.childNodes[0]);
  51395. }
  51396. }
  51397. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  51398. // store value as _value as well since
  51399. // non-string values will be stringified
  51400. elm._value = cur;
  51401. // avoid resetting cursor position when value is the same
  51402. var strCur = isUndef(cur) ? '' : String(cur);
  51403. if (shouldUpdateValue(elm, strCur)) {
  51404. elm.value = strCur;
  51405. }
  51406. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  51407. // IE doesn't support innerHTML for SVG elements
  51408. svgContainer = svgContainer || document.createElement('div');
  51409. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  51410. var svg = svgContainer.firstChild;
  51411. while (elm.firstChild) {
  51412. elm.removeChild(elm.firstChild);
  51413. }
  51414. while (svg.firstChild) {
  51415. elm.appendChild(svg.firstChild);
  51416. }
  51417. } else if (
  51418. // skip the update if old and new VDOM state is the same.
  51419. // `value` is handled separately because the DOM value may be temporarily
  51420. // out of sync with VDOM state due to focus, composition and modifiers.
  51421. // This #4521 by skipping the unnecesarry `checked` update.
  51422. cur !== oldProps[key]
  51423. ) {
  51424. // some property updates can throw
  51425. // e.g. `value` on <progress> w/ non-finite value
  51426. try {
  51427. elm[key] = cur;
  51428. } catch (e) {}
  51429. }
  51430. }
  51431. }
  51432. // check platforms/web/util/attrs.js acceptValue
  51433. function shouldUpdateValue (elm, checkVal) {
  51434. return (!elm.composing && (
  51435. elm.tagName === 'OPTION' ||
  51436. isNotInFocusAndDirty(elm, checkVal) ||
  51437. isDirtyWithModifiers(elm, checkVal)
  51438. ))
  51439. }
  51440. function isNotInFocusAndDirty (elm, checkVal) {
  51441. // return true when textbox (.number and .trim) loses focus and its value is
  51442. // not equal to the updated value
  51443. var notInFocus = true;
  51444. // #6157
  51445. // work around IE bug when accessing document.activeElement in an iframe
  51446. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  51447. return notInFocus && elm.value !== checkVal
  51448. }
  51449. function isDirtyWithModifiers (elm, newVal) {
  51450. var value = elm.value;
  51451. var modifiers = elm._vModifiers; // injected by v-model runtime
  51452. if (isDef(modifiers)) {
  51453. if (modifiers.number) {
  51454. return toNumber(value) !== toNumber(newVal)
  51455. }
  51456. if (modifiers.trim) {
  51457. return value.trim() !== newVal.trim()
  51458. }
  51459. }
  51460. return value !== newVal
  51461. }
  51462. var domProps = {
  51463. create: updateDOMProps,
  51464. update: updateDOMProps
  51465. };
  51466. /* */
  51467. var parseStyleText = cached(function (cssText) {
  51468. var res = {};
  51469. var listDelimiter = /;(?![^(]*\))/g;
  51470. var propertyDelimiter = /:(.+)/;
  51471. cssText.split(listDelimiter).forEach(function (item) {
  51472. if (item) {
  51473. var tmp = item.split(propertyDelimiter);
  51474. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  51475. }
  51476. });
  51477. return res
  51478. });
  51479. // merge static and dynamic style data on the same vnode
  51480. function normalizeStyleData (data) {
  51481. var style = normalizeStyleBinding(data.style);
  51482. // static style is pre-processed into an object during compilation
  51483. // and is always a fresh object, so it's safe to merge into it
  51484. return data.staticStyle
  51485. ? extend(data.staticStyle, style)
  51486. : style
  51487. }
  51488. // normalize possible array / string values into Object
  51489. function normalizeStyleBinding (bindingStyle) {
  51490. if (Array.isArray(bindingStyle)) {
  51491. return toObject(bindingStyle)
  51492. }
  51493. if (typeof bindingStyle === 'string') {
  51494. return parseStyleText(bindingStyle)
  51495. }
  51496. return bindingStyle
  51497. }
  51498. /**
  51499. * parent component style should be after child's
  51500. * so that parent component's style could override it
  51501. */
  51502. function getStyle (vnode, checkChild) {
  51503. var res = {};
  51504. var styleData;
  51505. if (checkChild) {
  51506. var childNode = vnode;
  51507. while (childNode.componentInstance) {
  51508. childNode = childNode.componentInstance._vnode;
  51509. if (
  51510. childNode && childNode.data &&
  51511. (styleData = normalizeStyleData(childNode.data))
  51512. ) {
  51513. extend(res, styleData);
  51514. }
  51515. }
  51516. }
  51517. if ((styleData = normalizeStyleData(vnode.data))) {
  51518. extend(res, styleData);
  51519. }
  51520. var parentNode = vnode;
  51521. while ((parentNode = parentNode.parent)) {
  51522. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51523. extend(res, styleData);
  51524. }
  51525. }
  51526. return res
  51527. }
  51528. /* */
  51529. var cssVarRE = /^--/;
  51530. var importantRE = /\s*!important$/;
  51531. var setProp = function (el, name, val) {
  51532. /* istanbul ignore if */
  51533. if (cssVarRE.test(name)) {
  51534. el.style.setProperty(name, val);
  51535. } else if (importantRE.test(val)) {
  51536. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51537. } else {
  51538. var normalizedName = normalize(name);
  51539. if (Array.isArray(val)) {
  51540. // Support values array created by autoprefixer, e.g.
  51541. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51542. // Set them one by one, and the browser will only set those it can recognize
  51543. for (var i = 0, len = val.length; i < len; i++) {
  51544. el.style[normalizedName] = val[i];
  51545. }
  51546. } else {
  51547. el.style[normalizedName] = val;
  51548. }
  51549. }
  51550. };
  51551. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51552. var emptyStyle;
  51553. var normalize = cached(function (prop) {
  51554. emptyStyle = emptyStyle || document.createElement('div').style;
  51555. prop = camelize(prop);
  51556. if (prop !== 'filter' && (prop in emptyStyle)) {
  51557. return prop
  51558. }
  51559. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51560. for (var i = 0; i < vendorNames.length; i++) {
  51561. var name = vendorNames[i] + capName;
  51562. if (name in emptyStyle) {
  51563. return name
  51564. }
  51565. }
  51566. });
  51567. function updateStyle (oldVnode, vnode) {
  51568. var data = vnode.data;
  51569. var oldData = oldVnode.data;
  51570. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51571. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51572. ) {
  51573. return
  51574. }
  51575. var cur, name;
  51576. var el = vnode.elm;
  51577. var oldStaticStyle = oldData.staticStyle;
  51578. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51579. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51580. var oldStyle = oldStaticStyle || oldStyleBinding;
  51581. var style = normalizeStyleBinding(vnode.data.style) || {};
  51582. // store normalized style under a different key for next diff
  51583. // make sure to clone it if it's reactive, since the user likely wants
  51584. // to mutate it.
  51585. vnode.data.normalizedStyle = isDef(style.__ob__)
  51586. ? extend({}, style)
  51587. : style;
  51588. var newStyle = getStyle(vnode, true);
  51589. for (name in oldStyle) {
  51590. if (isUndef(newStyle[name])) {
  51591. setProp(el, name, '');
  51592. }
  51593. }
  51594. for (name in newStyle) {
  51595. cur = newStyle[name];
  51596. if (cur !== oldStyle[name]) {
  51597. // ie9 setting to null has no effect, must use empty string
  51598. setProp(el, name, cur == null ? '' : cur);
  51599. }
  51600. }
  51601. }
  51602. var style = {
  51603. create: updateStyle,
  51604. update: updateStyle
  51605. };
  51606. /* */
  51607. var whitespaceRE = /\s+/;
  51608. /**
  51609. * Add class with compatibility for SVG since classList is not supported on
  51610. * SVG elements in IE
  51611. */
  51612. function addClass (el, cls) {
  51613. /* istanbul ignore if */
  51614. if (!cls || !(cls = cls.trim())) {
  51615. return
  51616. }
  51617. /* istanbul ignore else */
  51618. if (el.classList) {
  51619. if (cls.indexOf(' ') > -1) {
  51620. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51621. } else {
  51622. el.classList.add(cls);
  51623. }
  51624. } else {
  51625. var cur = " " + (el.getAttribute('class') || '') + " ";
  51626. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51627. el.setAttribute('class', (cur + cls).trim());
  51628. }
  51629. }
  51630. }
  51631. /**
  51632. * Remove class with compatibility for SVG since classList is not supported on
  51633. * SVG elements in IE
  51634. */
  51635. function removeClass (el, cls) {
  51636. /* istanbul ignore if */
  51637. if (!cls || !(cls = cls.trim())) {
  51638. return
  51639. }
  51640. /* istanbul ignore else */
  51641. if (el.classList) {
  51642. if (cls.indexOf(' ') > -1) {
  51643. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51644. } else {
  51645. el.classList.remove(cls);
  51646. }
  51647. if (!el.classList.length) {
  51648. el.removeAttribute('class');
  51649. }
  51650. } else {
  51651. var cur = " " + (el.getAttribute('class') || '') + " ";
  51652. var tar = ' ' + cls + ' ';
  51653. while (cur.indexOf(tar) >= 0) {
  51654. cur = cur.replace(tar, ' ');
  51655. }
  51656. cur = cur.trim();
  51657. if (cur) {
  51658. el.setAttribute('class', cur);
  51659. } else {
  51660. el.removeAttribute('class');
  51661. }
  51662. }
  51663. }
  51664. /* */
  51665. function resolveTransition (def$$1) {
  51666. if (!def$$1) {
  51667. return
  51668. }
  51669. /* istanbul ignore else */
  51670. if (typeof def$$1 === 'object') {
  51671. var res = {};
  51672. if (def$$1.css !== false) {
  51673. extend(res, autoCssTransition(def$$1.name || 'v'));
  51674. }
  51675. extend(res, def$$1);
  51676. return res
  51677. } else if (typeof def$$1 === 'string') {
  51678. return autoCssTransition(def$$1)
  51679. }
  51680. }
  51681. var autoCssTransition = cached(function (name) {
  51682. return {
  51683. enterClass: (name + "-enter"),
  51684. enterToClass: (name + "-enter-to"),
  51685. enterActiveClass: (name + "-enter-active"),
  51686. leaveClass: (name + "-leave"),
  51687. leaveToClass: (name + "-leave-to"),
  51688. leaveActiveClass: (name + "-leave-active")
  51689. }
  51690. });
  51691. var hasTransition = inBrowser && !isIE9;
  51692. var TRANSITION = 'transition';
  51693. var ANIMATION = 'animation';
  51694. // Transition property/event sniffing
  51695. var transitionProp = 'transition';
  51696. var transitionEndEvent = 'transitionend';
  51697. var animationProp = 'animation';
  51698. var animationEndEvent = 'animationend';
  51699. if (hasTransition) {
  51700. /* istanbul ignore if */
  51701. if (window.ontransitionend === undefined &&
  51702. window.onwebkittransitionend !== undefined
  51703. ) {
  51704. transitionProp = 'WebkitTransition';
  51705. transitionEndEvent = 'webkitTransitionEnd';
  51706. }
  51707. if (window.onanimationend === undefined &&
  51708. window.onwebkitanimationend !== undefined
  51709. ) {
  51710. animationProp = 'WebkitAnimation';
  51711. animationEndEvent = 'webkitAnimationEnd';
  51712. }
  51713. }
  51714. // binding to window is necessary to make hot reload work in IE in strict mode
  51715. var raf = inBrowser
  51716. ? window.requestAnimationFrame
  51717. ? window.requestAnimationFrame.bind(window)
  51718. : setTimeout
  51719. : /* istanbul ignore next */ function (fn) { return fn(); };
  51720. function nextFrame (fn) {
  51721. raf(function () {
  51722. raf(fn);
  51723. });
  51724. }
  51725. function addTransitionClass (el, cls) {
  51726. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51727. if (transitionClasses.indexOf(cls) < 0) {
  51728. transitionClasses.push(cls);
  51729. addClass(el, cls);
  51730. }
  51731. }
  51732. function removeTransitionClass (el, cls) {
  51733. if (el._transitionClasses) {
  51734. remove(el._transitionClasses, cls);
  51735. }
  51736. removeClass(el, cls);
  51737. }
  51738. function whenTransitionEnds (
  51739. el,
  51740. expectedType,
  51741. cb
  51742. ) {
  51743. var ref = getTransitionInfo(el, expectedType);
  51744. var type = ref.type;
  51745. var timeout = ref.timeout;
  51746. var propCount = ref.propCount;
  51747. if (!type) { return cb() }
  51748. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51749. var ended = 0;
  51750. var end = function () {
  51751. el.removeEventListener(event, onEnd);
  51752. cb();
  51753. };
  51754. var onEnd = function (e) {
  51755. if (e.target === el) {
  51756. if (++ended >= propCount) {
  51757. end();
  51758. }
  51759. }
  51760. };
  51761. setTimeout(function () {
  51762. if (ended < propCount) {
  51763. end();
  51764. }
  51765. }, timeout + 1);
  51766. el.addEventListener(event, onEnd);
  51767. }
  51768. var transformRE = /\b(transform|all)(,|$)/;
  51769. function getTransitionInfo (el, expectedType) {
  51770. var styles = window.getComputedStyle(el);
  51771. // JSDOM may return undefined for transition properties
  51772. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  51773. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  51774. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  51775. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  51776. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  51777. var animationTimeout = getTimeout(animationDelays, animationDurations);
  51778. var type;
  51779. var timeout = 0;
  51780. var propCount = 0;
  51781. /* istanbul ignore if */
  51782. if (expectedType === TRANSITION) {
  51783. if (transitionTimeout > 0) {
  51784. type = TRANSITION;
  51785. timeout = transitionTimeout;
  51786. propCount = transitionDurations.length;
  51787. }
  51788. } else if (expectedType === ANIMATION) {
  51789. if (animationTimeout > 0) {
  51790. type = ANIMATION;
  51791. timeout = animationTimeout;
  51792. propCount = animationDurations.length;
  51793. }
  51794. } else {
  51795. timeout = Math.max(transitionTimeout, animationTimeout);
  51796. type = timeout > 0
  51797. ? transitionTimeout > animationTimeout
  51798. ? TRANSITION
  51799. : ANIMATION
  51800. : null;
  51801. propCount = type
  51802. ? type === TRANSITION
  51803. ? transitionDurations.length
  51804. : animationDurations.length
  51805. : 0;
  51806. }
  51807. var hasTransform =
  51808. type === TRANSITION &&
  51809. transformRE.test(styles[transitionProp + 'Property']);
  51810. return {
  51811. type: type,
  51812. timeout: timeout,
  51813. propCount: propCount,
  51814. hasTransform: hasTransform
  51815. }
  51816. }
  51817. function getTimeout (delays, durations) {
  51818. /* istanbul ignore next */
  51819. while (delays.length < durations.length) {
  51820. delays = delays.concat(delays);
  51821. }
  51822. return Math.max.apply(null, durations.map(function (d, i) {
  51823. return toMs(d) + toMs(delays[i])
  51824. }))
  51825. }
  51826. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  51827. // in a locale-dependent way, using a comma instead of a dot.
  51828. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  51829. // as a floor function) causing unexpected behaviors
  51830. function toMs (s) {
  51831. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  51832. }
  51833. /* */
  51834. function enter (vnode, toggleDisplay) {
  51835. var el = vnode.elm;
  51836. // call leave callback now
  51837. if (isDef(el._leaveCb)) {
  51838. el._leaveCb.cancelled = true;
  51839. el._leaveCb();
  51840. }
  51841. var data = resolveTransition(vnode.data.transition);
  51842. if (isUndef(data)) {
  51843. return
  51844. }
  51845. /* istanbul ignore if */
  51846. if (isDef(el._enterCb) || el.nodeType !== 1) {
  51847. return
  51848. }
  51849. var css = data.css;
  51850. var type = data.type;
  51851. var enterClass = data.enterClass;
  51852. var enterToClass = data.enterToClass;
  51853. var enterActiveClass = data.enterActiveClass;
  51854. var appearClass = data.appearClass;
  51855. var appearToClass = data.appearToClass;
  51856. var appearActiveClass = data.appearActiveClass;
  51857. var beforeEnter = data.beforeEnter;
  51858. var enter = data.enter;
  51859. var afterEnter = data.afterEnter;
  51860. var enterCancelled = data.enterCancelled;
  51861. var beforeAppear = data.beforeAppear;
  51862. var appear = data.appear;
  51863. var afterAppear = data.afterAppear;
  51864. var appearCancelled = data.appearCancelled;
  51865. var duration = data.duration;
  51866. // activeInstance will always be the <transition> component managing this
  51867. // transition. One edge case to check is when the <transition> is placed
  51868. // as the root node of a child component. In that case we need to check
  51869. // <transition>'s parent for appear check.
  51870. var context = activeInstance;
  51871. var transitionNode = activeInstance.$vnode;
  51872. while (transitionNode && transitionNode.parent) {
  51873. context = transitionNode.context;
  51874. transitionNode = transitionNode.parent;
  51875. }
  51876. var isAppear = !context._isMounted || !vnode.isRootInsert;
  51877. if (isAppear && !appear && appear !== '') {
  51878. return
  51879. }
  51880. var startClass = isAppear && appearClass
  51881. ? appearClass
  51882. : enterClass;
  51883. var activeClass = isAppear && appearActiveClass
  51884. ? appearActiveClass
  51885. : enterActiveClass;
  51886. var toClass = isAppear && appearToClass
  51887. ? appearToClass
  51888. : enterToClass;
  51889. var beforeEnterHook = isAppear
  51890. ? (beforeAppear || beforeEnter)
  51891. : beforeEnter;
  51892. var enterHook = isAppear
  51893. ? (typeof appear === 'function' ? appear : enter)
  51894. : enter;
  51895. var afterEnterHook = isAppear
  51896. ? (afterAppear || afterEnter)
  51897. : afterEnter;
  51898. var enterCancelledHook = isAppear
  51899. ? (appearCancelled || enterCancelled)
  51900. : enterCancelled;
  51901. var explicitEnterDuration = toNumber(
  51902. isObject(duration)
  51903. ? duration.enter
  51904. : duration
  51905. );
  51906. if (explicitEnterDuration != null) {
  51907. checkDuration(explicitEnterDuration, 'enter', vnode);
  51908. }
  51909. var expectsCSS = css !== false && !isIE9;
  51910. var userWantsControl = getHookArgumentsLength(enterHook);
  51911. var cb = el._enterCb = once(function () {
  51912. if (expectsCSS) {
  51913. removeTransitionClass(el, toClass);
  51914. removeTransitionClass(el, activeClass);
  51915. }
  51916. if (cb.cancelled) {
  51917. if (expectsCSS) {
  51918. removeTransitionClass(el, startClass);
  51919. }
  51920. enterCancelledHook && enterCancelledHook(el);
  51921. } else {
  51922. afterEnterHook && afterEnterHook(el);
  51923. }
  51924. el._enterCb = null;
  51925. });
  51926. if (!vnode.data.show) {
  51927. // remove pending leave element on enter by injecting an insert hook
  51928. mergeVNodeHook(vnode, 'insert', function () {
  51929. var parent = el.parentNode;
  51930. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  51931. if (pendingNode &&
  51932. pendingNode.tag === vnode.tag &&
  51933. pendingNode.elm._leaveCb
  51934. ) {
  51935. pendingNode.elm._leaveCb();
  51936. }
  51937. enterHook && enterHook(el, cb);
  51938. });
  51939. }
  51940. // start enter transition
  51941. beforeEnterHook && beforeEnterHook(el);
  51942. if (expectsCSS) {
  51943. addTransitionClass(el, startClass);
  51944. addTransitionClass(el, activeClass);
  51945. nextFrame(function () {
  51946. removeTransitionClass(el, startClass);
  51947. if (!cb.cancelled) {
  51948. addTransitionClass(el, toClass);
  51949. if (!userWantsControl) {
  51950. if (isValidDuration(explicitEnterDuration)) {
  51951. setTimeout(cb, explicitEnterDuration);
  51952. } else {
  51953. whenTransitionEnds(el, type, cb);
  51954. }
  51955. }
  51956. }
  51957. });
  51958. }
  51959. if (vnode.data.show) {
  51960. toggleDisplay && toggleDisplay();
  51961. enterHook && enterHook(el, cb);
  51962. }
  51963. if (!expectsCSS && !userWantsControl) {
  51964. cb();
  51965. }
  51966. }
  51967. function leave (vnode, rm) {
  51968. var el = vnode.elm;
  51969. // call enter callback now
  51970. if (isDef(el._enterCb)) {
  51971. el._enterCb.cancelled = true;
  51972. el._enterCb();
  51973. }
  51974. var data = resolveTransition(vnode.data.transition);
  51975. if (isUndef(data) || el.nodeType !== 1) {
  51976. return rm()
  51977. }
  51978. /* istanbul ignore if */
  51979. if (isDef(el._leaveCb)) {
  51980. return
  51981. }
  51982. var css = data.css;
  51983. var type = data.type;
  51984. var leaveClass = data.leaveClass;
  51985. var leaveToClass = data.leaveToClass;
  51986. var leaveActiveClass = data.leaveActiveClass;
  51987. var beforeLeave = data.beforeLeave;
  51988. var leave = data.leave;
  51989. var afterLeave = data.afterLeave;
  51990. var leaveCancelled = data.leaveCancelled;
  51991. var delayLeave = data.delayLeave;
  51992. var duration = data.duration;
  51993. var expectsCSS = css !== false && !isIE9;
  51994. var userWantsControl = getHookArgumentsLength(leave);
  51995. var explicitLeaveDuration = toNumber(
  51996. isObject(duration)
  51997. ? duration.leave
  51998. : duration
  51999. );
  52000. if (isDef(explicitLeaveDuration)) {
  52001. checkDuration(explicitLeaveDuration, 'leave', vnode);
  52002. }
  52003. var cb = el._leaveCb = once(function () {
  52004. if (el.parentNode && el.parentNode._pending) {
  52005. el.parentNode._pending[vnode.key] = null;
  52006. }
  52007. if (expectsCSS) {
  52008. removeTransitionClass(el, leaveToClass);
  52009. removeTransitionClass(el, leaveActiveClass);
  52010. }
  52011. if (cb.cancelled) {
  52012. if (expectsCSS) {
  52013. removeTransitionClass(el, leaveClass);
  52014. }
  52015. leaveCancelled && leaveCancelled(el);
  52016. } else {
  52017. rm();
  52018. afterLeave && afterLeave(el);
  52019. }
  52020. el._leaveCb = null;
  52021. });
  52022. if (delayLeave) {
  52023. delayLeave(performLeave);
  52024. } else {
  52025. performLeave();
  52026. }
  52027. function performLeave () {
  52028. // the delayed leave may have already been cancelled
  52029. if (cb.cancelled) {
  52030. return
  52031. }
  52032. // record leaving element
  52033. if (!vnode.data.show && el.parentNode) {
  52034. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  52035. }
  52036. beforeLeave && beforeLeave(el);
  52037. if (expectsCSS) {
  52038. addTransitionClass(el, leaveClass);
  52039. addTransitionClass(el, leaveActiveClass);
  52040. nextFrame(function () {
  52041. removeTransitionClass(el, leaveClass);
  52042. if (!cb.cancelled) {
  52043. addTransitionClass(el, leaveToClass);
  52044. if (!userWantsControl) {
  52045. if (isValidDuration(explicitLeaveDuration)) {
  52046. setTimeout(cb, explicitLeaveDuration);
  52047. } else {
  52048. whenTransitionEnds(el, type, cb);
  52049. }
  52050. }
  52051. }
  52052. });
  52053. }
  52054. leave && leave(el, cb);
  52055. if (!expectsCSS && !userWantsControl) {
  52056. cb();
  52057. }
  52058. }
  52059. }
  52060. // only used in dev mode
  52061. function checkDuration (val, name, vnode) {
  52062. if (typeof val !== 'number') {
  52063. warn(
  52064. "<transition> explicit " + name + " duration is not a valid number - " +
  52065. "got " + (JSON.stringify(val)) + ".",
  52066. vnode.context
  52067. );
  52068. } else if (isNaN(val)) {
  52069. warn(
  52070. "<transition> explicit " + name + " duration is NaN - " +
  52071. 'the duration expression might be incorrect.',
  52072. vnode.context
  52073. );
  52074. }
  52075. }
  52076. function isValidDuration (val) {
  52077. return typeof val === 'number' && !isNaN(val)
  52078. }
  52079. /**
  52080. * Normalize a transition hook's argument length. The hook may be:
  52081. * - a merged hook (invoker) with the original in .fns
  52082. * - a wrapped component method (check ._length)
  52083. * - a plain function (.length)
  52084. */
  52085. function getHookArgumentsLength (fn) {
  52086. if (isUndef(fn)) {
  52087. return false
  52088. }
  52089. var invokerFns = fn.fns;
  52090. if (isDef(invokerFns)) {
  52091. // invoker
  52092. return getHookArgumentsLength(
  52093. Array.isArray(invokerFns)
  52094. ? invokerFns[0]
  52095. : invokerFns
  52096. )
  52097. } else {
  52098. return (fn._length || fn.length) > 1
  52099. }
  52100. }
  52101. function _enter (_, vnode) {
  52102. if (vnode.data.show !== true) {
  52103. enter(vnode);
  52104. }
  52105. }
  52106. var transition = inBrowser ? {
  52107. create: _enter,
  52108. activate: _enter,
  52109. remove: function remove$$1 (vnode, rm) {
  52110. /* istanbul ignore else */
  52111. if (vnode.data.show !== true) {
  52112. leave(vnode, rm);
  52113. } else {
  52114. rm();
  52115. }
  52116. }
  52117. } : {};
  52118. var platformModules = [
  52119. attrs,
  52120. klass,
  52121. events,
  52122. domProps,
  52123. style,
  52124. transition
  52125. ];
  52126. /* */
  52127. // the directive module should be applied last, after all
  52128. // built-in modules have been applied.
  52129. var modules = platformModules.concat(baseModules);
  52130. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  52131. /**
  52132. * Not type checking this file because flow doesn't like attaching
  52133. * properties to Elements.
  52134. */
  52135. /* istanbul ignore if */
  52136. if (isIE9) {
  52137. // http://www.matts411.com/post/internet-explorer-9-oninput/
  52138. document.addEventListener('selectionchange', function () {
  52139. var el = document.activeElement;
  52140. if (el && el.vmodel) {
  52141. trigger(el, 'input');
  52142. }
  52143. });
  52144. }
  52145. var directive = {
  52146. inserted: function inserted (el, binding, vnode, oldVnode) {
  52147. if (vnode.tag === 'select') {
  52148. // #6903
  52149. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  52150. mergeVNodeHook(vnode, 'postpatch', function () {
  52151. directive.componentUpdated(el, binding, vnode);
  52152. });
  52153. } else {
  52154. setSelected(el, binding, vnode.context);
  52155. }
  52156. el._vOptions = [].map.call(el.options, getValue);
  52157. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  52158. el._vModifiers = binding.modifiers;
  52159. if (!binding.modifiers.lazy) {
  52160. el.addEventListener('compositionstart', onCompositionStart);
  52161. el.addEventListener('compositionend', onCompositionEnd);
  52162. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  52163. // switching focus before confirming composition choice
  52164. // this also fixes the issue where some browsers e.g. iOS Chrome
  52165. // fires "change" instead of "input" on autocomplete.
  52166. el.addEventListener('change', onCompositionEnd);
  52167. /* istanbul ignore if */
  52168. if (isIE9) {
  52169. el.vmodel = true;
  52170. }
  52171. }
  52172. }
  52173. },
  52174. componentUpdated: function componentUpdated (el, binding, vnode) {
  52175. if (vnode.tag === 'select') {
  52176. setSelected(el, binding, vnode.context);
  52177. // in case the options rendered by v-for have changed,
  52178. // it's possible that the value is out-of-sync with the rendered options.
  52179. // detect such cases and filter out values that no longer has a matching
  52180. // option in the DOM.
  52181. var prevOptions = el._vOptions;
  52182. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  52183. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  52184. // trigger change event if
  52185. // no matching option found for at least one value
  52186. var needReset = el.multiple
  52187. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  52188. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  52189. if (needReset) {
  52190. trigger(el, 'change');
  52191. }
  52192. }
  52193. }
  52194. }
  52195. };
  52196. function setSelected (el, binding, vm) {
  52197. actuallySetSelected(el, binding, vm);
  52198. /* istanbul ignore if */
  52199. if (isIE || isEdge) {
  52200. setTimeout(function () {
  52201. actuallySetSelected(el, binding, vm);
  52202. }, 0);
  52203. }
  52204. }
  52205. function actuallySetSelected (el, binding, vm) {
  52206. var value = binding.value;
  52207. var isMultiple = el.multiple;
  52208. if (isMultiple && !Array.isArray(value)) {
  52209. warn(
  52210. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  52211. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  52212. vm
  52213. );
  52214. return
  52215. }
  52216. var selected, option;
  52217. for (var i = 0, l = el.options.length; i < l; i++) {
  52218. option = el.options[i];
  52219. if (isMultiple) {
  52220. selected = looseIndexOf(value, getValue(option)) > -1;
  52221. if (option.selected !== selected) {
  52222. option.selected = selected;
  52223. }
  52224. } else {
  52225. if (looseEqual(getValue(option), value)) {
  52226. if (el.selectedIndex !== i) {
  52227. el.selectedIndex = i;
  52228. }
  52229. return
  52230. }
  52231. }
  52232. }
  52233. if (!isMultiple) {
  52234. el.selectedIndex = -1;
  52235. }
  52236. }
  52237. function hasNoMatchingOption (value, options) {
  52238. return options.every(function (o) { return !looseEqual(o, value); })
  52239. }
  52240. function getValue (option) {
  52241. return '_value' in option
  52242. ? option._value
  52243. : option.value
  52244. }
  52245. function onCompositionStart (e) {
  52246. e.target.composing = true;
  52247. }
  52248. function onCompositionEnd (e) {
  52249. // prevent triggering an input event for no reason
  52250. if (!e.target.composing) { return }
  52251. e.target.composing = false;
  52252. trigger(e.target, 'input');
  52253. }
  52254. function trigger (el, type) {
  52255. var e = document.createEvent('HTMLEvents');
  52256. e.initEvent(type, true, true);
  52257. el.dispatchEvent(e);
  52258. }
  52259. /* */
  52260. // recursively search for possible transition defined inside the component root
  52261. function locateNode (vnode) {
  52262. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  52263. ? locateNode(vnode.componentInstance._vnode)
  52264. : vnode
  52265. }
  52266. var show = {
  52267. bind: function bind (el, ref, vnode) {
  52268. var value = ref.value;
  52269. vnode = locateNode(vnode);
  52270. var transition$$1 = vnode.data && vnode.data.transition;
  52271. var originalDisplay = el.__vOriginalDisplay =
  52272. el.style.display === 'none' ? '' : el.style.display;
  52273. if (value && transition$$1) {
  52274. vnode.data.show = true;
  52275. enter(vnode, function () {
  52276. el.style.display = originalDisplay;
  52277. });
  52278. } else {
  52279. el.style.display = value ? originalDisplay : 'none';
  52280. }
  52281. },
  52282. update: function update (el, ref, vnode) {
  52283. var value = ref.value;
  52284. var oldValue = ref.oldValue;
  52285. /* istanbul ignore if */
  52286. if (!value === !oldValue) { return }
  52287. vnode = locateNode(vnode);
  52288. var transition$$1 = vnode.data && vnode.data.transition;
  52289. if (transition$$1) {
  52290. vnode.data.show = true;
  52291. if (value) {
  52292. enter(vnode, function () {
  52293. el.style.display = el.__vOriginalDisplay;
  52294. });
  52295. } else {
  52296. leave(vnode, function () {
  52297. el.style.display = 'none';
  52298. });
  52299. }
  52300. } else {
  52301. el.style.display = value ? el.__vOriginalDisplay : 'none';
  52302. }
  52303. },
  52304. unbind: function unbind (
  52305. el,
  52306. binding,
  52307. vnode,
  52308. oldVnode,
  52309. isDestroy
  52310. ) {
  52311. if (!isDestroy) {
  52312. el.style.display = el.__vOriginalDisplay;
  52313. }
  52314. }
  52315. };
  52316. var platformDirectives = {
  52317. model: directive,
  52318. show: show
  52319. };
  52320. /* */
  52321. var transitionProps = {
  52322. name: String,
  52323. appear: Boolean,
  52324. css: Boolean,
  52325. mode: String,
  52326. type: String,
  52327. enterClass: String,
  52328. leaveClass: String,
  52329. enterToClass: String,
  52330. leaveToClass: String,
  52331. enterActiveClass: String,
  52332. leaveActiveClass: String,
  52333. appearClass: String,
  52334. appearActiveClass: String,
  52335. appearToClass: String,
  52336. duration: [Number, String, Object]
  52337. };
  52338. // in case the child is also an abstract component, e.g. <keep-alive>
  52339. // we want to recursively retrieve the real component to be rendered
  52340. function getRealChild (vnode) {
  52341. var compOptions = vnode && vnode.componentOptions;
  52342. if (compOptions && compOptions.Ctor.options.abstract) {
  52343. return getRealChild(getFirstComponentChild(compOptions.children))
  52344. } else {
  52345. return vnode
  52346. }
  52347. }
  52348. function extractTransitionData (comp) {
  52349. var data = {};
  52350. var options = comp.$options;
  52351. // props
  52352. for (var key in options.propsData) {
  52353. data[key] = comp[key];
  52354. }
  52355. // events.
  52356. // extract listeners and pass them directly to the transition methods
  52357. var listeners = options._parentListeners;
  52358. for (var key$1 in listeners) {
  52359. data[camelize(key$1)] = listeners[key$1];
  52360. }
  52361. return data
  52362. }
  52363. function placeholder (h, rawChild) {
  52364. if (/\d-keep-alive$/.test(rawChild.tag)) {
  52365. return h('keep-alive', {
  52366. props: rawChild.componentOptions.propsData
  52367. })
  52368. }
  52369. }
  52370. function hasParentTransition (vnode) {
  52371. while ((vnode = vnode.parent)) {
  52372. if (vnode.data.transition) {
  52373. return true
  52374. }
  52375. }
  52376. }
  52377. function isSameChild (child, oldChild) {
  52378. return oldChild.key === child.key && oldChild.tag === child.tag
  52379. }
  52380. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  52381. var isVShowDirective = function (d) { return d.name === 'show'; };
  52382. var Transition = {
  52383. name: 'transition',
  52384. props: transitionProps,
  52385. abstract: true,
  52386. render: function render (h) {
  52387. var this$1 = this;
  52388. var children = this.$slots.default;
  52389. if (!children) {
  52390. return
  52391. }
  52392. // filter out text nodes (possible whitespaces)
  52393. children = children.filter(isNotTextNode);
  52394. /* istanbul ignore if */
  52395. if (!children.length) {
  52396. return
  52397. }
  52398. // warn multiple elements
  52399. if (children.length > 1) {
  52400. warn(
  52401. '<transition> can only be used on a single element. Use ' +
  52402. '<transition-group> for lists.',
  52403. this.$parent
  52404. );
  52405. }
  52406. var mode = this.mode;
  52407. // warn invalid mode
  52408. if (mode && mode !== 'in-out' && mode !== 'out-in'
  52409. ) {
  52410. warn(
  52411. 'invalid <transition> mode: ' + mode,
  52412. this.$parent
  52413. );
  52414. }
  52415. var rawChild = children[0];
  52416. // if this is a component root node and the component's
  52417. // parent container node also has transition, skip.
  52418. if (hasParentTransition(this.$vnode)) {
  52419. return rawChild
  52420. }
  52421. // apply transition data to child
  52422. // use getRealChild() to ignore abstract components e.g. keep-alive
  52423. var child = getRealChild(rawChild);
  52424. /* istanbul ignore if */
  52425. if (!child) {
  52426. return rawChild
  52427. }
  52428. if (this._leaving) {
  52429. return placeholder(h, rawChild)
  52430. }
  52431. // ensure a key that is unique to the vnode type and to this transition
  52432. // component instance. This key will be used to remove pending leaving nodes
  52433. // during entering.
  52434. var id = "__transition-" + (this._uid) + "-";
  52435. child.key = child.key == null
  52436. ? child.isComment
  52437. ? id + 'comment'
  52438. : id + child.tag
  52439. : isPrimitive(child.key)
  52440. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  52441. : child.key;
  52442. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  52443. var oldRawChild = this._vnode;
  52444. var oldChild = getRealChild(oldRawChild);
  52445. // mark v-show
  52446. // so that the transition module can hand over the control to the directive
  52447. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  52448. child.data.show = true;
  52449. }
  52450. if (
  52451. oldChild &&
  52452. oldChild.data &&
  52453. !isSameChild(child, oldChild) &&
  52454. !isAsyncPlaceholder(oldChild) &&
  52455. // #6687 component root is a comment node
  52456. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  52457. ) {
  52458. // replace old child transition data with fresh one
  52459. // important for dynamic transitions!
  52460. var oldData = oldChild.data.transition = extend({}, data);
  52461. // handle transition mode
  52462. if (mode === 'out-in') {
  52463. // return placeholder node and queue update when leave finishes
  52464. this._leaving = true;
  52465. mergeVNodeHook(oldData, 'afterLeave', function () {
  52466. this$1._leaving = false;
  52467. this$1.$forceUpdate();
  52468. });
  52469. return placeholder(h, rawChild)
  52470. } else if (mode === 'in-out') {
  52471. if (isAsyncPlaceholder(child)) {
  52472. return oldRawChild
  52473. }
  52474. var delayedLeave;
  52475. var performLeave = function () { delayedLeave(); };
  52476. mergeVNodeHook(data, 'afterEnter', performLeave);
  52477. mergeVNodeHook(data, 'enterCancelled', performLeave);
  52478. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  52479. }
  52480. }
  52481. return rawChild
  52482. }
  52483. };
  52484. /* */
  52485. var props = extend({
  52486. tag: String,
  52487. moveClass: String
  52488. }, transitionProps);
  52489. delete props.mode;
  52490. var TransitionGroup = {
  52491. props: props,
  52492. beforeMount: function beforeMount () {
  52493. var this$1 = this;
  52494. var update = this._update;
  52495. this._update = function (vnode, hydrating) {
  52496. var restoreActiveInstance = setActiveInstance(this$1);
  52497. // force removing pass
  52498. this$1.__patch__(
  52499. this$1._vnode,
  52500. this$1.kept,
  52501. false, // hydrating
  52502. true // removeOnly (!important, avoids unnecessary moves)
  52503. );
  52504. this$1._vnode = this$1.kept;
  52505. restoreActiveInstance();
  52506. update.call(this$1, vnode, hydrating);
  52507. };
  52508. },
  52509. render: function render (h) {
  52510. var tag = this.tag || this.$vnode.data.tag || 'span';
  52511. var map = Object.create(null);
  52512. var prevChildren = this.prevChildren = this.children;
  52513. var rawChildren = this.$slots.default || [];
  52514. var children = this.children = [];
  52515. var transitionData = extractTransitionData(this);
  52516. for (var i = 0; i < rawChildren.length; i++) {
  52517. var c = rawChildren[i];
  52518. if (c.tag) {
  52519. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52520. children.push(c);
  52521. map[c.key] = c
  52522. ;(c.data || (c.data = {})).transition = transitionData;
  52523. } else {
  52524. var opts = c.componentOptions;
  52525. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52526. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52527. }
  52528. }
  52529. }
  52530. if (prevChildren) {
  52531. var kept = [];
  52532. var removed = [];
  52533. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52534. var c$1 = prevChildren[i$1];
  52535. c$1.data.transition = transitionData;
  52536. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52537. if (map[c$1.key]) {
  52538. kept.push(c$1);
  52539. } else {
  52540. removed.push(c$1);
  52541. }
  52542. }
  52543. this.kept = h(tag, null, kept);
  52544. this.removed = removed;
  52545. }
  52546. return h(tag, null, children)
  52547. },
  52548. updated: function updated () {
  52549. var children = this.prevChildren;
  52550. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52551. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52552. return
  52553. }
  52554. // we divide the work into three loops to avoid mixing DOM reads and writes
  52555. // in each iteration - which helps prevent layout thrashing.
  52556. children.forEach(callPendingCbs);
  52557. children.forEach(recordPosition);
  52558. children.forEach(applyTranslation);
  52559. // force reflow to put everything in position
  52560. // assign to this to avoid being removed in tree-shaking
  52561. // $flow-disable-line
  52562. this._reflow = document.body.offsetHeight;
  52563. children.forEach(function (c) {
  52564. if (c.data.moved) {
  52565. var el = c.elm;
  52566. var s = el.style;
  52567. addTransitionClass(el, moveClass);
  52568. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52569. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52570. if (e && e.target !== el) {
  52571. return
  52572. }
  52573. if (!e || /transform$/.test(e.propertyName)) {
  52574. el.removeEventListener(transitionEndEvent, cb);
  52575. el._moveCb = null;
  52576. removeTransitionClass(el, moveClass);
  52577. }
  52578. });
  52579. }
  52580. });
  52581. },
  52582. methods: {
  52583. hasMove: function hasMove (el, moveClass) {
  52584. /* istanbul ignore if */
  52585. if (!hasTransition) {
  52586. return false
  52587. }
  52588. /* istanbul ignore if */
  52589. if (this._hasMove) {
  52590. return this._hasMove
  52591. }
  52592. // Detect whether an element with the move class applied has
  52593. // CSS transitions. Since the element may be inside an entering
  52594. // transition at this very moment, we make a clone of it and remove
  52595. // all other transition classes applied to ensure only the move class
  52596. // is applied.
  52597. var clone = el.cloneNode();
  52598. if (el._transitionClasses) {
  52599. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52600. }
  52601. addClass(clone, moveClass);
  52602. clone.style.display = 'none';
  52603. this.$el.appendChild(clone);
  52604. var info = getTransitionInfo(clone);
  52605. this.$el.removeChild(clone);
  52606. return (this._hasMove = info.hasTransform)
  52607. }
  52608. }
  52609. };
  52610. function callPendingCbs (c) {
  52611. /* istanbul ignore if */
  52612. if (c.elm._moveCb) {
  52613. c.elm._moveCb();
  52614. }
  52615. /* istanbul ignore if */
  52616. if (c.elm._enterCb) {
  52617. c.elm._enterCb();
  52618. }
  52619. }
  52620. function recordPosition (c) {
  52621. c.data.newPos = c.elm.getBoundingClientRect();
  52622. }
  52623. function applyTranslation (c) {
  52624. var oldPos = c.data.pos;
  52625. var newPos = c.data.newPos;
  52626. var dx = oldPos.left - newPos.left;
  52627. var dy = oldPos.top - newPos.top;
  52628. if (dx || dy) {
  52629. c.data.moved = true;
  52630. var s = c.elm.style;
  52631. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52632. s.transitionDuration = '0s';
  52633. }
  52634. }
  52635. var platformComponents = {
  52636. Transition: Transition,
  52637. TransitionGroup: TransitionGroup
  52638. };
  52639. /* */
  52640. // install platform specific utils
  52641. Vue.config.mustUseProp = mustUseProp;
  52642. Vue.config.isReservedTag = isReservedTag;
  52643. Vue.config.isReservedAttr = isReservedAttr;
  52644. Vue.config.getTagNamespace = getTagNamespace;
  52645. Vue.config.isUnknownElement = isUnknownElement;
  52646. // install platform runtime directives & components
  52647. extend(Vue.options.directives, platformDirectives);
  52648. extend(Vue.options.components, platformComponents);
  52649. // install platform patch function
  52650. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52651. // public mount method
  52652. Vue.prototype.$mount = function (
  52653. el,
  52654. hydrating
  52655. ) {
  52656. el = el && inBrowser ? query(el) : undefined;
  52657. return mountComponent(this, el, hydrating)
  52658. };
  52659. // devtools global hook
  52660. /* istanbul ignore next */
  52661. if (inBrowser) {
  52662. setTimeout(function () {
  52663. if (config.devtools) {
  52664. if (devtools) {
  52665. devtools.emit('init', Vue);
  52666. } else {
  52667. console[console.info ? 'info' : 'log'](
  52668. 'Download the Vue Devtools extension for a better development experience:\n' +
  52669. 'https://github.com/vuejs/vue-devtools'
  52670. );
  52671. }
  52672. }
  52673. if (config.productionTip !== false &&
  52674. typeof console !== 'undefined'
  52675. ) {
  52676. console[console.info ? 'info' : 'log'](
  52677. "You are running Vue in development mode.\n" +
  52678. "Make sure to turn on production mode when deploying for production.\n" +
  52679. "See more tips at https://vuejs.org/guide/deployment.html"
  52680. );
  52681. }
  52682. }, 0);
  52683. }
  52684. /* */
  52685. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52686. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52687. var buildRegex = cached(function (delimiters) {
  52688. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52689. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52690. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52691. });
  52692. function parseText (
  52693. text,
  52694. delimiters
  52695. ) {
  52696. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52697. if (!tagRE.test(text)) {
  52698. return
  52699. }
  52700. var tokens = [];
  52701. var rawTokens = [];
  52702. var lastIndex = tagRE.lastIndex = 0;
  52703. var match, index, tokenValue;
  52704. while ((match = tagRE.exec(text))) {
  52705. index = match.index;
  52706. // push text token
  52707. if (index > lastIndex) {
  52708. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52709. tokens.push(JSON.stringify(tokenValue));
  52710. }
  52711. // tag token
  52712. var exp = parseFilters(match[1].trim());
  52713. tokens.push(("_s(" + exp + ")"));
  52714. rawTokens.push({ '@binding': exp });
  52715. lastIndex = index + match[0].length;
  52716. }
  52717. if (lastIndex < text.length) {
  52718. rawTokens.push(tokenValue = text.slice(lastIndex));
  52719. tokens.push(JSON.stringify(tokenValue));
  52720. }
  52721. return {
  52722. expression: tokens.join('+'),
  52723. tokens: rawTokens
  52724. }
  52725. }
  52726. /* */
  52727. function transformNode (el, options) {
  52728. var warn = options.warn || baseWarn;
  52729. var staticClass = getAndRemoveAttr(el, 'class');
  52730. if (staticClass) {
  52731. var res = parseText(staticClass, options.delimiters);
  52732. if (res) {
  52733. warn(
  52734. "class=\"" + staticClass + "\": " +
  52735. 'Interpolation inside attributes has been removed. ' +
  52736. 'Use v-bind or the colon shorthand instead. For example, ' +
  52737. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52738. el.rawAttrsMap['class']
  52739. );
  52740. }
  52741. }
  52742. if (staticClass) {
  52743. el.staticClass = JSON.stringify(staticClass);
  52744. }
  52745. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52746. if (classBinding) {
  52747. el.classBinding = classBinding;
  52748. }
  52749. }
  52750. function genData (el) {
  52751. var data = '';
  52752. if (el.staticClass) {
  52753. data += "staticClass:" + (el.staticClass) + ",";
  52754. }
  52755. if (el.classBinding) {
  52756. data += "class:" + (el.classBinding) + ",";
  52757. }
  52758. return data
  52759. }
  52760. var klass$1 = {
  52761. staticKeys: ['staticClass'],
  52762. transformNode: transformNode,
  52763. genData: genData
  52764. };
  52765. /* */
  52766. function transformNode$1 (el, options) {
  52767. var warn = options.warn || baseWarn;
  52768. var staticStyle = getAndRemoveAttr(el, 'style');
  52769. if (staticStyle) {
  52770. /* istanbul ignore if */
  52771. {
  52772. var res = parseText(staticStyle, options.delimiters);
  52773. if (res) {
  52774. warn(
  52775. "style=\"" + staticStyle + "\": " +
  52776. 'Interpolation inside attributes has been removed. ' +
  52777. 'Use v-bind or the colon shorthand instead. For example, ' +
  52778. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  52779. el.rawAttrsMap['style']
  52780. );
  52781. }
  52782. }
  52783. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  52784. }
  52785. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  52786. if (styleBinding) {
  52787. el.styleBinding = styleBinding;
  52788. }
  52789. }
  52790. function genData$1 (el) {
  52791. var data = '';
  52792. if (el.staticStyle) {
  52793. data += "staticStyle:" + (el.staticStyle) + ",";
  52794. }
  52795. if (el.styleBinding) {
  52796. data += "style:(" + (el.styleBinding) + "),";
  52797. }
  52798. return data
  52799. }
  52800. var style$1 = {
  52801. staticKeys: ['staticStyle'],
  52802. transformNode: transformNode$1,
  52803. genData: genData$1
  52804. };
  52805. /* */
  52806. var decoder;
  52807. var he = {
  52808. decode: function decode (html) {
  52809. decoder = decoder || document.createElement('div');
  52810. decoder.innerHTML = html;
  52811. return decoder.textContent
  52812. }
  52813. };
  52814. /* */
  52815. var isUnaryTag = makeMap(
  52816. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  52817. 'link,meta,param,source,track,wbr'
  52818. );
  52819. // Elements that you can, intentionally, leave open
  52820. // (and which close themselves)
  52821. var canBeLeftOpenTag = makeMap(
  52822. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  52823. );
  52824. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  52825. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  52826. var isNonPhrasingTag = makeMap(
  52827. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  52828. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  52829. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  52830. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  52831. 'title,tr,track'
  52832. );
  52833. /**
  52834. * Not type-checking this file because it's mostly vendor code.
  52835. */
  52836. // Regular Expressions for parsing tags and attributes
  52837. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52838. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52839. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  52840. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  52841. var startTagOpen = new RegExp(("^<" + qnameCapture));
  52842. var startTagClose = /^\s*(\/?)>/;
  52843. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  52844. var doctype = /^<!DOCTYPE [^>]+>/i;
  52845. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  52846. var comment = /^<!\--/;
  52847. var conditionalComment = /^<!\[/;
  52848. // Special Elements (can contain anything)
  52849. var isPlainTextElement = makeMap('script,style,textarea', true);
  52850. var reCache = {};
  52851. var decodingMap = {
  52852. '&lt;': '<',
  52853. '&gt;': '>',
  52854. '&quot;': '"',
  52855. '&amp;': '&',
  52856. '&#10;': '\n',
  52857. '&#9;': '\t',
  52858. '&#39;': "'"
  52859. };
  52860. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  52861. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  52862. // #5992
  52863. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  52864. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  52865. function decodeAttr (value, shouldDecodeNewlines) {
  52866. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  52867. return value.replace(re, function (match) { return decodingMap[match]; })
  52868. }
  52869. function parseHTML (html, options) {
  52870. var stack = [];
  52871. var expectHTML = options.expectHTML;
  52872. var isUnaryTag$$1 = options.isUnaryTag || no;
  52873. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  52874. var index = 0;
  52875. var last, lastTag;
  52876. while (html) {
  52877. last = html;
  52878. // Make sure we're not in a plaintext content element like script/style
  52879. if (!lastTag || !isPlainTextElement(lastTag)) {
  52880. var textEnd = html.indexOf('<');
  52881. if (textEnd === 0) {
  52882. // Comment:
  52883. if (comment.test(html)) {
  52884. var commentEnd = html.indexOf('-->');
  52885. if (commentEnd >= 0) {
  52886. if (options.shouldKeepComment) {
  52887. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  52888. }
  52889. advance(commentEnd + 3);
  52890. continue
  52891. }
  52892. }
  52893. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  52894. if (conditionalComment.test(html)) {
  52895. var conditionalEnd = html.indexOf(']>');
  52896. if (conditionalEnd >= 0) {
  52897. advance(conditionalEnd + 2);
  52898. continue
  52899. }
  52900. }
  52901. // Doctype:
  52902. var doctypeMatch = html.match(doctype);
  52903. if (doctypeMatch) {
  52904. advance(doctypeMatch[0].length);
  52905. continue
  52906. }
  52907. // End tag:
  52908. var endTagMatch = html.match(endTag);
  52909. if (endTagMatch) {
  52910. var curIndex = index;
  52911. advance(endTagMatch[0].length);
  52912. parseEndTag(endTagMatch[1], curIndex, index);
  52913. continue
  52914. }
  52915. // Start tag:
  52916. var startTagMatch = parseStartTag();
  52917. if (startTagMatch) {
  52918. handleStartTag(startTagMatch);
  52919. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  52920. advance(1);
  52921. }
  52922. continue
  52923. }
  52924. }
  52925. var text = (void 0), rest = (void 0), next = (void 0);
  52926. if (textEnd >= 0) {
  52927. rest = html.slice(textEnd);
  52928. while (
  52929. !endTag.test(rest) &&
  52930. !startTagOpen.test(rest) &&
  52931. !comment.test(rest) &&
  52932. !conditionalComment.test(rest)
  52933. ) {
  52934. // < in plain text, be forgiving and treat it as text
  52935. next = rest.indexOf('<', 1);
  52936. if (next < 0) { break }
  52937. textEnd += next;
  52938. rest = html.slice(textEnd);
  52939. }
  52940. text = html.substring(0, textEnd);
  52941. }
  52942. if (textEnd < 0) {
  52943. text = html;
  52944. }
  52945. if (text) {
  52946. advance(text.length);
  52947. }
  52948. if (options.chars && text) {
  52949. options.chars(text, index - text.length, index);
  52950. }
  52951. } else {
  52952. var endTagLength = 0;
  52953. var stackedTag = lastTag.toLowerCase();
  52954. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  52955. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  52956. endTagLength = endTag.length;
  52957. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  52958. text = text
  52959. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  52960. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  52961. }
  52962. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  52963. text = text.slice(1);
  52964. }
  52965. if (options.chars) {
  52966. options.chars(text);
  52967. }
  52968. return ''
  52969. });
  52970. index += html.length - rest$1.length;
  52971. html = rest$1;
  52972. parseEndTag(stackedTag, index - endTagLength, index);
  52973. }
  52974. if (html === last) {
  52975. options.chars && options.chars(html);
  52976. if (!stack.length && options.warn) {
  52977. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  52978. }
  52979. break
  52980. }
  52981. }
  52982. // Clean up any remaining tags
  52983. parseEndTag();
  52984. function advance (n) {
  52985. index += n;
  52986. html = html.substring(n);
  52987. }
  52988. function parseStartTag () {
  52989. var start = html.match(startTagOpen);
  52990. if (start) {
  52991. var match = {
  52992. tagName: start[1],
  52993. attrs: [],
  52994. start: index
  52995. };
  52996. advance(start[0].length);
  52997. var end, attr;
  52998. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  52999. attr.start = index;
  53000. advance(attr[0].length);
  53001. attr.end = index;
  53002. match.attrs.push(attr);
  53003. }
  53004. if (end) {
  53005. match.unarySlash = end[1];
  53006. advance(end[0].length);
  53007. match.end = index;
  53008. return match
  53009. }
  53010. }
  53011. }
  53012. function handleStartTag (match) {
  53013. var tagName = match.tagName;
  53014. var unarySlash = match.unarySlash;
  53015. if (expectHTML) {
  53016. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  53017. parseEndTag(lastTag);
  53018. }
  53019. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  53020. parseEndTag(tagName);
  53021. }
  53022. }
  53023. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  53024. var l = match.attrs.length;
  53025. var attrs = new Array(l);
  53026. for (var i = 0; i < l; i++) {
  53027. var args = match.attrs[i];
  53028. var value = args[3] || args[4] || args[5] || '';
  53029. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  53030. ? options.shouldDecodeNewlinesForHref
  53031. : options.shouldDecodeNewlines;
  53032. attrs[i] = {
  53033. name: args[1],
  53034. value: decodeAttr(value, shouldDecodeNewlines)
  53035. };
  53036. if (options.outputSourceRange) {
  53037. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  53038. attrs[i].end = args.end;
  53039. }
  53040. }
  53041. if (!unary) {
  53042. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  53043. lastTag = tagName;
  53044. }
  53045. if (options.start) {
  53046. options.start(tagName, attrs, unary, match.start, match.end);
  53047. }
  53048. }
  53049. function parseEndTag (tagName, start, end) {
  53050. var pos, lowerCasedTagName;
  53051. if (start == null) { start = index; }
  53052. if (end == null) { end = index; }
  53053. // Find the closest opened tag of the same type
  53054. if (tagName) {
  53055. lowerCasedTagName = tagName.toLowerCase();
  53056. for (pos = stack.length - 1; pos >= 0; pos--) {
  53057. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  53058. break
  53059. }
  53060. }
  53061. } else {
  53062. // If no tag name is provided, clean shop
  53063. pos = 0;
  53064. }
  53065. if (pos >= 0) {
  53066. // Close all the open elements, up the stack
  53067. for (var i = stack.length - 1; i >= pos; i--) {
  53068. if (i > pos || !tagName &&
  53069. options.warn
  53070. ) {
  53071. options.warn(
  53072. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  53073. { start: stack[i].start, end: stack[i].end }
  53074. );
  53075. }
  53076. if (options.end) {
  53077. options.end(stack[i].tag, start, end);
  53078. }
  53079. }
  53080. // Remove the open elements from the stack
  53081. stack.length = pos;
  53082. lastTag = pos && stack[pos - 1].tag;
  53083. } else if (lowerCasedTagName === 'br') {
  53084. if (options.start) {
  53085. options.start(tagName, [], true, start, end);
  53086. }
  53087. } else if (lowerCasedTagName === 'p') {
  53088. if (options.start) {
  53089. options.start(tagName, [], false, start, end);
  53090. }
  53091. if (options.end) {
  53092. options.end(tagName, start, end);
  53093. }
  53094. }
  53095. }
  53096. }
  53097. /* */
  53098. var onRE = /^@|^v-on:/;
  53099. var dirRE = /^v-|^@|^:|^#/;
  53100. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  53101. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  53102. var stripParensRE = /^\(|\)$/g;
  53103. var dynamicArgRE = /^\[.*\]$/;
  53104. var argRE = /:(.*)$/;
  53105. var bindRE = /^:|^\.|^v-bind:/;
  53106. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  53107. var slotRE = /^v-slot(:|$)|^#/;
  53108. var lineBreakRE = /[\r\n]/;
  53109. var whitespaceRE$1 = /\s+/g;
  53110. var invalidAttributeRE = /[\s"'<>\/=]/;
  53111. var decodeHTMLCached = cached(he.decode);
  53112. var emptySlotScopeToken = "_empty_";
  53113. // configurable state
  53114. var warn$2;
  53115. var delimiters;
  53116. var transforms;
  53117. var preTransforms;
  53118. var postTransforms;
  53119. var platformIsPreTag;
  53120. var platformMustUseProp;
  53121. var platformGetTagNamespace;
  53122. var maybeComponent;
  53123. function createASTElement (
  53124. tag,
  53125. attrs,
  53126. parent
  53127. ) {
  53128. return {
  53129. type: 1,
  53130. tag: tag,
  53131. attrsList: attrs,
  53132. attrsMap: makeAttrsMap(attrs),
  53133. rawAttrsMap: {},
  53134. parent: parent,
  53135. children: []
  53136. }
  53137. }
  53138. /**
  53139. * Convert HTML string to AST.
  53140. */
  53141. function parse (
  53142. template,
  53143. options
  53144. ) {
  53145. warn$2 = options.warn || baseWarn;
  53146. platformIsPreTag = options.isPreTag || no;
  53147. platformMustUseProp = options.mustUseProp || no;
  53148. platformGetTagNamespace = options.getTagNamespace || no;
  53149. var isReservedTag = options.isReservedTag || no;
  53150. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53151. transforms = pluckModuleFunction(options.modules, 'transformNode');
  53152. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  53153. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  53154. delimiters = options.delimiters;
  53155. var stack = [];
  53156. var preserveWhitespace = options.preserveWhitespace !== false;
  53157. var whitespaceOption = options.whitespace;
  53158. var root;
  53159. var currentParent;
  53160. var inVPre = false;
  53161. var inPre = false;
  53162. var warned = false;
  53163. function warnOnce (msg, range) {
  53164. if (!warned) {
  53165. warned = true;
  53166. warn$2(msg, range);
  53167. }
  53168. }
  53169. function closeElement (element) {
  53170. trimEndingWhitespace(element);
  53171. if (!inVPre && !element.processed) {
  53172. element = processElement(element, options);
  53173. }
  53174. // tree management
  53175. if (!stack.length && element !== root) {
  53176. // allow root elements with v-if, v-else-if and v-else
  53177. if (root.if && (element.elseif || element.else)) {
  53178. {
  53179. checkRootConstraints(element);
  53180. }
  53181. addIfCondition(root, {
  53182. exp: element.elseif,
  53183. block: element
  53184. });
  53185. } else {
  53186. warnOnce(
  53187. "Component template should contain exactly one root element. " +
  53188. "If you are using v-if on multiple elements, " +
  53189. "use v-else-if to chain them instead.",
  53190. { start: element.start }
  53191. );
  53192. }
  53193. }
  53194. if (currentParent && !element.forbidden) {
  53195. if (element.elseif || element.else) {
  53196. processIfConditions(element, currentParent);
  53197. } else {
  53198. if (element.slotScope) {
  53199. // scoped slot
  53200. // keep it in the children list so that v-else(-if) conditions can
  53201. // find it as the prev node.
  53202. var name = element.slotTarget || '"default"'
  53203. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  53204. }
  53205. currentParent.children.push(element);
  53206. element.parent = currentParent;
  53207. }
  53208. }
  53209. // final children cleanup
  53210. // filter out scoped slots
  53211. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  53212. // remove trailing whitespace node again
  53213. trimEndingWhitespace(element);
  53214. // check pre state
  53215. if (element.pre) {
  53216. inVPre = false;
  53217. }
  53218. if (platformIsPreTag(element.tag)) {
  53219. inPre = false;
  53220. }
  53221. // apply post-transforms
  53222. for (var i = 0; i < postTransforms.length; i++) {
  53223. postTransforms[i](element, options);
  53224. }
  53225. }
  53226. function trimEndingWhitespace (el) {
  53227. // remove trailing whitespace node
  53228. if (!inPre) {
  53229. var lastNode;
  53230. while (
  53231. (lastNode = el.children[el.children.length - 1]) &&
  53232. lastNode.type === 3 &&
  53233. lastNode.text === ' '
  53234. ) {
  53235. el.children.pop();
  53236. }
  53237. }
  53238. }
  53239. function checkRootConstraints (el) {
  53240. if (el.tag === 'slot' || el.tag === 'template') {
  53241. warnOnce(
  53242. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  53243. 'contain multiple nodes.',
  53244. { start: el.start }
  53245. );
  53246. }
  53247. if (el.attrsMap.hasOwnProperty('v-for')) {
  53248. warnOnce(
  53249. 'Cannot use v-for on stateful component root element because ' +
  53250. 'it renders multiple elements.',
  53251. el.rawAttrsMap['v-for']
  53252. );
  53253. }
  53254. }
  53255. parseHTML(template, {
  53256. warn: warn$2,
  53257. expectHTML: options.expectHTML,
  53258. isUnaryTag: options.isUnaryTag,
  53259. canBeLeftOpenTag: options.canBeLeftOpenTag,
  53260. shouldDecodeNewlines: options.shouldDecodeNewlines,
  53261. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  53262. shouldKeepComment: options.comments,
  53263. outputSourceRange: options.outputSourceRange,
  53264. start: function start (tag, attrs, unary, start$1, end) {
  53265. // check namespace.
  53266. // inherit parent ns if there is one
  53267. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  53268. // handle IE svg bug
  53269. /* istanbul ignore if */
  53270. if (isIE && ns === 'svg') {
  53271. attrs = guardIESVGBug(attrs);
  53272. }
  53273. var element = createASTElement(tag, attrs, currentParent);
  53274. if (ns) {
  53275. element.ns = ns;
  53276. }
  53277. {
  53278. if (options.outputSourceRange) {
  53279. element.start = start$1;
  53280. element.end = end;
  53281. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  53282. cumulated[attr.name] = attr;
  53283. return cumulated
  53284. }, {});
  53285. }
  53286. attrs.forEach(function (attr) {
  53287. if (invalidAttributeRE.test(attr.name)) {
  53288. warn$2(
  53289. "Invalid dynamic argument expression: attribute names cannot contain " +
  53290. "spaces, quotes, <, >, / or =.",
  53291. {
  53292. start: attr.start + attr.name.indexOf("["),
  53293. end: attr.start + attr.name.length
  53294. }
  53295. );
  53296. }
  53297. });
  53298. }
  53299. if (isForbiddenTag(element) && !isServerRendering()) {
  53300. element.forbidden = true;
  53301. warn$2(
  53302. 'Templates should only be responsible for mapping the state to the ' +
  53303. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  53304. "<" + tag + ">" + ', as they will not be parsed.',
  53305. { start: element.start }
  53306. );
  53307. }
  53308. // apply pre-transforms
  53309. for (var i = 0; i < preTransforms.length; i++) {
  53310. element = preTransforms[i](element, options) || element;
  53311. }
  53312. if (!inVPre) {
  53313. processPre(element);
  53314. if (element.pre) {
  53315. inVPre = true;
  53316. }
  53317. }
  53318. if (platformIsPreTag(element.tag)) {
  53319. inPre = true;
  53320. }
  53321. if (inVPre) {
  53322. processRawAttrs(element);
  53323. } else if (!element.processed) {
  53324. // structural directives
  53325. processFor(element);
  53326. processIf(element);
  53327. processOnce(element);
  53328. }
  53329. if (!root) {
  53330. root = element;
  53331. {
  53332. checkRootConstraints(root);
  53333. }
  53334. }
  53335. if (!unary) {
  53336. currentParent = element;
  53337. stack.push(element);
  53338. } else {
  53339. closeElement(element);
  53340. }
  53341. },
  53342. end: function end (tag, start, end$1) {
  53343. var element = stack[stack.length - 1];
  53344. // pop stack
  53345. stack.length -= 1;
  53346. currentParent = stack[stack.length - 1];
  53347. if (options.outputSourceRange) {
  53348. element.end = end$1;
  53349. }
  53350. closeElement(element);
  53351. },
  53352. chars: function chars (text, start, end) {
  53353. if (!currentParent) {
  53354. {
  53355. if (text === template) {
  53356. warnOnce(
  53357. 'Component template requires a root element, rather than just text.',
  53358. { start: start }
  53359. );
  53360. } else if ((text = text.trim())) {
  53361. warnOnce(
  53362. ("text \"" + text + "\" outside root element will be ignored."),
  53363. { start: start }
  53364. );
  53365. }
  53366. }
  53367. return
  53368. }
  53369. // IE textarea placeholder bug
  53370. /* istanbul ignore if */
  53371. if (isIE &&
  53372. currentParent.tag === 'textarea' &&
  53373. currentParent.attrsMap.placeholder === text
  53374. ) {
  53375. return
  53376. }
  53377. var children = currentParent.children;
  53378. if (inPre || text.trim()) {
  53379. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  53380. } else if (!children.length) {
  53381. // remove the whitespace-only node right after an opening tag
  53382. text = '';
  53383. } else if (whitespaceOption) {
  53384. if (whitespaceOption === 'condense') {
  53385. // in condense mode, remove the whitespace node if it contains
  53386. // line break, otherwise condense to a single space
  53387. text = lineBreakRE.test(text) ? '' : ' ';
  53388. } else {
  53389. text = ' ';
  53390. }
  53391. } else {
  53392. text = preserveWhitespace ? ' ' : '';
  53393. }
  53394. if (text) {
  53395. if (!inPre && whitespaceOption === 'condense') {
  53396. // condense consecutive whitespaces into single space
  53397. text = text.replace(whitespaceRE$1, ' ');
  53398. }
  53399. var res;
  53400. var child;
  53401. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  53402. child = {
  53403. type: 2,
  53404. expression: res.expression,
  53405. tokens: res.tokens,
  53406. text: text
  53407. };
  53408. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  53409. child = {
  53410. type: 3,
  53411. text: text
  53412. };
  53413. }
  53414. if (child) {
  53415. if (options.outputSourceRange) {
  53416. child.start = start;
  53417. child.end = end;
  53418. }
  53419. children.push(child);
  53420. }
  53421. }
  53422. },
  53423. comment: function comment (text, start, end) {
  53424. // adding anyting as a sibling to the root node is forbidden
  53425. // comments should still be allowed, but ignored
  53426. if (currentParent) {
  53427. var child = {
  53428. type: 3,
  53429. text: text,
  53430. isComment: true
  53431. };
  53432. if (options.outputSourceRange) {
  53433. child.start = start;
  53434. child.end = end;
  53435. }
  53436. currentParent.children.push(child);
  53437. }
  53438. }
  53439. });
  53440. return root
  53441. }
  53442. function processPre (el) {
  53443. if (getAndRemoveAttr(el, 'v-pre') != null) {
  53444. el.pre = true;
  53445. }
  53446. }
  53447. function processRawAttrs (el) {
  53448. var list = el.attrsList;
  53449. var len = list.length;
  53450. if (len) {
  53451. var attrs = el.attrs = new Array(len);
  53452. for (var i = 0; i < len; i++) {
  53453. attrs[i] = {
  53454. name: list[i].name,
  53455. value: JSON.stringify(list[i].value)
  53456. };
  53457. if (list[i].start != null) {
  53458. attrs[i].start = list[i].start;
  53459. attrs[i].end = list[i].end;
  53460. }
  53461. }
  53462. } else if (!el.pre) {
  53463. // non root node in pre blocks with no attributes
  53464. el.plain = true;
  53465. }
  53466. }
  53467. function processElement (
  53468. element,
  53469. options
  53470. ) {
  53471. processKey(element);
  53472. // determine whether this is a plain element after
  53473. // removing structural attributes
  53474. element.plain = (
  53475. !element.key &&
  53476. !element.scopedSlots &&
  53477. !element.attrsList.length
  53478. );
  53479. processRef(element);
  53480. processSlotContent(element);
  53481. processSlotOutlet(element);
  53482. processComponent(element);
  53483. for (var i = 0; i < transforms.length; i++) {
  53484. element = transforms[i](element, options) || element;
  53485. }
  53486. processAttrs(element);
  53487. return element
  53488. }
  53489. function processKey (el) {
  53490. var exp = getBindingAttr(el, 'key');
  53491. if (exp) {
  53492. {
  53493. if (el.tag === 'template') {
  53494. warn$2(
  53495. "<template> cannot be keyed. Place the key on real elements instead.",
  53496. getRawBindingAttr(el, 'key')
  53497. );
  53498. }
  53499. if (el.for) {
  53500. var iterator = el.iterator2 || el.iterator1;
  53501. var parent = el.parent;
  53502. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53503. warn$2(
  53504. "Do not use v-for index as key on <transition-group> children, " +
  53505. "this is the same as not using keys.",
  53506. getRawBindingAttr(el, 'key'),
  53507. true /* tip */
  53508. );
  53509. }
  53510. }
  53511. }
  53512. el.key = exp;
  53513. }
  53514. }
  53515. function processRef (el) {
  53516. var ref = getBindingAttr(el, 'ref');
  53517. if (ref) {
  53518. el.ref = ref;
  53519. el.refInFor = checkInFor(el);
  53520. }
  53521. }
  53522. function processFor (el) {
  53523. var exp;
  53524. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53525. var res = parseFor(exp);
  53526. if (res) {
  53527. extend(el, res);
  53528. } else {
  53529. warn$2(
  53530. ("Invalid v-for expression: " + exp),
  53531. el.rawAttrsMap['v-for']
  53532. );
  53533. }
  53534. }
  53535. }
  53536. function parseFor (exp) {
  53537. var inMatch = exp.match(forAliasRE);
  53538. if (!inMatch) { return }
  53539. var res = {};
  53540. res.for = inMatch[2].trim();
  53541. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53542. var iteratorMatch = alias.match(forIteratorRE);
  53543. if (iteratorMatch) {
  53544. res.alias = alias.replace(forIteratorRE, '').trim();
  53545. res.iterator1 = iteratorMatch[1].trim();
  53546. if (iteratorMatch[2]) {
  53547. res.iterator2 = iteratorMatch[2].trim();
  53548. }
  53549. } else {
  53550. res.alias = alias;
  53551. }
  53552. return res
  53553. }
  53554. function processIf (el) {
  53555. var exp = getAndRemoveAttr(el, 'v-if');
  53556. if (exp) {
  53557. el.if = exp;
  53558. addIfCondition(el, {
  53559. exp: exp,
  53560. block: el
  53561. });
  53562. } else {
  53563. if (getAndRemoveAttr(el, 'v-else') != null) {
  53564. el.else = true;
  53565. }
  53566. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53567. if (elseif) {
  53568. el.elseif = elseif;
  53569. }
  53570. }
  53571. }
  53572. function processIfConditions (el, parent) {
  53573. var prev = findPrevElement(parent.children);
  53574. if (prev && prev.if) {
  53575. addIfCondition(prev, {
  53576. exp: el.elseif,
  53577. block: el
  53578. });
  53579. } else {
  53580. warn$2(
  53581. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53582. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53583. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53584. );
  53585. }
  53586. }
  53587. function findPrevElement (children) {
  53588. var i = children.length;
  53589. while (i--) {
  53590. if (children[i].type === 1) {
  53591. return children[i]
  53592. } else {
  53593. if (children[i].text !== ' ') {
  53594. warn$2(
  53595. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53596. "will be ignored.",
  53597. children[i]
  53598. );
  53599. }
  53600. children.pop();
  53601. }
  53602. }
  53603. }
  53604. function addIfCondition (el, condition) {
  53605. if (!el.ifConditions) {
  53606. el.ifConditions = [];
  53607. }
  53608. el.ifConditions.push(condition);
  53609. }
  53610. function processOnce (el) {
  53611. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53612. if (once$$1 != null) {
  53613. el.once = true;
  53614. }
  53615. }
  53616. // handle content being passed to a component as slot,
  53617. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53618. function processSlotContent (el) {
  53619. var slotScope;
  53620. if (el.tag === 'template') {
  53621. slotScope = getAndRemoveAttr(el, 'scope');
  53622. /* istanbul ignore if */
  53623. if (slotScope) {
  53624. warn$2(
  53625. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53626. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53627. "can also be used on plain elements in addition to <template> to " +
  53628. "denote scoped slots.",
  53629. el.rawAttrsMap['scope'],
  53630. true
  53631. );
  53632. }
  53633. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53634. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53635. /* istanbul ignore if */
  53636. if (el.attrsMap['v-for']) {
  53637. warn$2(
  53638. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53639. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53640. "scoped slot to make it clearer.",
  53641. el.rawAttrsMap['slot-scope'],
  53642. true
  53643. );
  53644. }
  53645. el.slotScope = slotScope;
  53646. }
  53647. // slot="xxx"
  53648. var slotTarget = getBindingAttr(el, 'slot');
  53649. if (slotTarget) {
  53650. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53651. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53652. // preserve slot as an attribute for native shadow DOM compat
  53653. // only for non-scoped slots.
  53654. if (el.tag !== 'template' && !el.slotScope) {
  53655. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53656. }
  53657. }
  53658. // 2.6 v-slot syntax
  53659. {
  53660. if (el.tag === 'template') {
  53661. // v-slot on <template>
  53662. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53663. if (slotBinding) {
  53664. {
  53665. if (el.slotTarget || el.slotScope) {
  53666. warn$2(
  53667. "Unexpected mixed usage of different slot syntaxes.",
  53668. el
  53669. );
  53670. }
  53671. if (el.parent && !maybeComponent(el.parent)) {
  53672. warn$2(
  53673. "<template v-slot> can only appear at the root level inside " +
  53674. "the receiving component",
  53675. el
  53676. );
  53677. }
  53678. }
  53679. var ref = getSlotName(slotBinding);
  53680. var name = ref.name;
  53681. var dynamic = ref.dynamic;
  53682. el.slotTarget = name;
  53683. el.slotTargetDynamic = dynamic;
  53684. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53685. }
  53686. } else {
  53687. // v-slot on component, denotes default slot
  53688. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53689. if (slotBinding$1) {
  53690. {
  53691. if (!maybeComponent(el)) {
  53692. warn$2(
  53693. "v-slot can only be used on components or <template>.",
  53694. slotBinding$1
  53695. );
  53696. }
  53697. if (el.slotScope || el.slotTarget) {
  53698. warn$2(
  53699. "Unexpected mixed usage of different slot syntaxes.",
  53700. el
  53701. );
  53702. }
  53703. if (el.scopedSlots) {
  53704. warn$2(
  53705. "To avoid scope ambiguity, the default slot should also use " +
  53706. "<template> syntax when there are other named slots.",
  53707. slotBinding$1
  53708. );
  53709. }
  53710. }
  53711. // add the component's children to its default slot
  53712. var slots = el.scopedSlots || (el.scopedSlots = {});
  53713. var ref$1 = getSlotName(slotBinding$1);
  53714. var name$1 = ref$1.name;
  53715. var dynamic$1 = ref$1.dynamic;
  53716. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53717. slotContainer.slotTarget = name$1;
  53718. slotContainer.slotTargetDynamic = dynamic$1;
  53719. slotContainer.children = el.children.filter(function (c) {
  53720. if (!c.slotScope) {
  53721. c.parent = slotContainer;
  53722. return true
  53723. }
  53724. });
  53725. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53726. // remove children as they are returned from scopedSlots now
  53727. el.children = [];
  53728. // mark el non-plain so data gets generated
  53729. el.plain = false;
  53730. }
  53731. }
  53732. }
  53733. }
  53734. function getSlotName (binding) {
  53735. var name = binding.name.replace(slotRE, '');
  53736. if (!name) {
  53737. if (binding.name[0] !== '#') {
  53738. name = 'default';
  53739. } else {
  53740. warn$2(
  53741. "v-slot shorthand syntax requires a slot name.",
  53742. binding
  53743. );
  53744. }
  53745. }
  53746. return dynamicArgRE.test(name)
  53747. // dynamic [name]
  53748. ? { name: name.slice(1, -1), dynamic: true }
  53749. // static name
  53750. : { name: ("\"" + name + "\""), dynamic: false }
  53751. }
  53752. // handle <slot/> outlets
  53753. function processSlotOutlet (el) {
  53754. if (el.tag === 'slot') {
  53755. el.slotName = getBindingAttr(el, 'name');
  53756. if (el.key) {
  53757. warn$2(
  53758. "`key` does not work on <slot> because slots are abstract outlets " +
  53759. "and can possibly expand into multiple elements. " +
  53760. "Use the key on a wrapping element instead.",
  53761. getRawBindingAttr(el, 'key')
  53762. );
  53763. }
  53764. }
  53765. }
  53766. function processComponent (el) {
  53767. var binding;
  53768. if ((binding = getBindingAttr(el, 'is'))) {
  53769. el.component = binding;
  53770. }
  53771. if (getAndRemoveAttr(el, 'inline-template') != null) {
  53772. el.inlineTemplate = true;
  53773. }
  53774. }
  53775. function processAttrs (el) {
  53776. var list = el.attrsList;
  53777. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  53778. for (i = 0, l = list.length; i < l; i++) {
  53779. name = rawName = list[i].name;
  53780. value = list[i].value;
  53781. if (dirRE.test(name)) {
  53782. // mark element as dynamic
  53783. el.hasBindings = true;
  53784. // modifiers
  53785. modifiers = parseModifiers(name.replace(dirRE, ''));
  53786. // support .foo shorthand syntax for the .prop modifier
  53787. if (modifiers) {
  53788. name = name.replace(modifierRE, '');
  53789. }
  53790. if (bindRE.test(name)) { // v-bind
  53791. name = name.replace(bindRE, '');
  53792. value = parseFilters(value);
  53793. isDynamic = dynamicArgRE.test(name);
  53794. if (isDynamic) {
  53795. name = name.slice(1, -1);
  53796. }
  53797. if (
  53798. value.trim().length === 0
  53799. ) {
  53800. warn$2(
  53801. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  53802. );
  53803. }
  53804. if (modifiers) {
  53805. if (modifiers.prop && !isDynamic) {
  53806. name = camelize(name);
  53807. if (name === 'innerHtml') { name = 'innerHTML'; }
  53808. }
  53809. if (modifiers.camel && !isDynamic) {
  53810. name = camelize(name);
  53811. }
  53812. if (modifiers.sync) {
  53813. syncGen = genAssignmentCode(value, "$event");
  53814. if (!isDynamic) {
  53815. addHandler(
  53816. el,
  53817. ("update:" + (camelize(name))),
  53818. syncGen,
  53819. null,
  53820. false,
  53821. warn$2,
  53822. list[i]
  53823. );
  53824. if (hyphenate(name) !== camelize(name)) {
  53825. addHandler(
  53826. el,
  53827. ("update:" + (hyphenate(name))),
  53828. syncGen,
  53829. null,
  53830. false,
  53831. warn$2,
  53832. list[i]
  53833. );
  53834. }
  53835. } else {
  53836. // handler w/ dynamic event name
  53837. addHandler(
  53838. el,
  53839. ("\"update:\"+(" + name + ")"),
  53840. syncGen,
  53841. null,
  53842. false,
  53843. warn$2,
  53844. list[i],
  53845. true // dynamic
  53846. );
  53847. }
  53848. }
  53849. }
  53850. if ((modifiers && modifiers.prop) || (
  53851. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  53852. )) {
  53853. addProp(el, name, value, list[i], isDynamic);
  53854. } else {
  53855. addAttr(el, name, value, list[i], isDynamic);
  53856. }
  53857. } else if (onRE.test(name)) { // v-on
  53858. name = name.replace(onRE, '');
  53859. isDynamic = dynamicArgRE.test(name);
  53860. if (isDynamic) {
  53861. name = name.slice(1, -1);
  53862. }
  53863. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  53864. } else { // normal directives
  53865. name = name.replace(dirRE, '');
  53866. // parse arg
  53867. var argMatch = name.match(argRE);
  53868. var arg = argMatch && argMatch[1];
  53869. isDynamic = false;
  53870. if (arg) {
  53871. name = name.slice(0, -(arg.length + 1));
  53872. if (dynamicArgRE.test(arg)) {
  53873. arg = arg.slice(1, -1);
  53874. isDynamic = true;
  53875. }
  53876. }
  53877. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  53878. if (name === 'model') {
  53879. checkForAliasModel(el, value);
  53880. }
  53881. }
  53882. } else {
  53883. // literal attribute
  53884. {
  53885. var res = parseText(value, delimiters);
  53886. if (res) {
  53887. warn$2(
  53888. name + "=\"" + value + "\": " +
  53889. 'Interpolation inside attributes has been removed. ' +
  53890. 'Use v-bind or the colon shorthand instead. For example, ' +
  53891. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  53892. list[i]
  53893. );
  53894. }
  53895. }
  53896. addAttr(el, name, JSON.stringify(value), list[i]);
  53897. // #6887 firefox doesn't update muted state if set via attribute
  53898. // even immediately after element creation
  53899. if (!el.component &&
  53900. name === 'muted' &&
  53901. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  53902. addProp(el, name, 'true', list[i]);
  53903. }
  53904. }
  53905. }
  53906. }
  53907. function checkInFor (el) {
  53908. var parent = el;
  53909. while (parent) {
  53910. if (parent.for !== undefined) {
  53911. return true
  53912. }
  53913. parent = parent.parent;
  53914. }
  53915. return false
  53916. }
  53917. function parseModifiers (name) {
  53918. var match = name.match(modifierRE);
  53919. if (match) {
  53920. var ret = {};
  53921. match.forEach(function (m) { ret[m.slice(1)] = true; });
  53922. return ret
  53923. }
  53924. }
  53925. function makeAttrsMap (attrs) {
  53926. var map = {};
  53927. for (var i = 0, l = attrs.length; i < l; i++) {
  53928. if (
  53929. map[attrs[i].name] && !isIE && !isEdge
  53930. ) {
  53931. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  53932. }
  53933. map[attrs[i].name] = attrs[i].value;
  53934. }
  53935. return map
  53936. }
  53937. // for script (e.g. type="x/template") or style, do not decode content
  53938. function isTextTag (el) {
  53939. return el.tag === 'script' || el.tag === 'style'
  53940. }
  53941. function isForbiddenTag (el) {
  53942. return (
  53943. el.tag === 'style' ||
  53944. (el.tag === 'script' && (
  53945. !el.attrsMap.type ||
  53946. el.attrsMap.type === 'text/javascript'
  53947. ))
  53948. )
  53949. }
  53950. var ieNSBug = /^xmlns:NS\d+/;
  53951. var ieNSPrefix = /^NS\d+:/;
  53952. /* istanbul ignore next */
  53953. function guardIESVGBug (attrs) {
  53954. var res = [];
  53955. for (var i = 0; i < attrs.length; i++) {
  53956. var attr = attrs[i];
  53957. if (!ieNSBug.test(attr.name)) {
  53958. attr.name = attr.name.replace(ieNSPrefix, '');
  53959. res.push(attr);
  53960. }
  53961. }
  53962. return res
  53963. }
  53964. function checkForAliasModel (el, value) {
  53965. var _el = el;
  53966. while (_el) {
  53967. if (_el.for && _el.alias === value) {
  53968. warn$2(
  53969. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  53970. "You are binding v-model directly to a v-for iteration alias. " +
  53971. "This will not be able to modify the v-for source array because " +
  53972. "writing to the alias is like modifying a function local variable. " +
  53973. "Consider using an array of objects and use v-model on an object property instead.",
  53974. el.rawAttrsMap['v-model']
  53975. );
  53976. }
  53977. _el = _el.parent;
  53978. }
  53979. }
  53980. /* */
  53981. function preTransformNode (el, options) {
  53982. if (el.tag === 'input') {
  53983. var map = el.attrsMap;
  53984. if (!map['v-model']) {
  53985. return
  53986. }
  53987. var typeBinding;
  53988. if (map[':type'] || map['v-bind:type']) {
  53989. typeBinding = getBindingAttr(el, 'type');
  53990. }
  53991. if (!map.type && !typeBinding && map['v-bind']) {
  53992. typeBinding = "(" + (map['v-bind']) + ").type";
  53993. }
  53994. if (typeBinding) {
  53995. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  53996. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  53997. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  53998. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  53999. // 1. checkbox
  54000. var branch0 = cloneASTElement(el);
  54001. // process for on the main node
  54002. processFor(branch0);
  54003. addRawAttr(branch0, 'type', 'checkbox');
  54004. processElement(branch0, options);
  54005. branch0.processed = true; // prevent it from double-processed
  54006. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  54007. addIfCondition(branch0, {
  54008. exp: branch0.if,
  54009. block: branch0
  54010. });
  54011. // 2. add radio else-if condition
  54012. var branch1 = cloneASTElement(el);
  54013. getAndRemoveAttr(branch1, 'v-for', true);
  54014. addRawAttr(branch1, 'type', 'radio');
  54015. processElement(branch1, options);
  54016. addIfCondition(branch0, {
  54017. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  54018. block: branch1
  54019. });
  54020. // 3. other
  54021. var branch2 = cloneASTElement(el);
  54022. getAndRemoveAttr(branch2, 'v-for', true);
  54023. addRawAttr(branch2, ':type', typeBinding);
  54024. processElement(branch2, options);
  54025. addIfCondition(branch0, {
  54026. exp: ifCondition,
  54027. block: branch2
  54028. });
  54029. if (hasElse) {
  54030. branch0.else = true;
  54031. } else if (elseIfCondition) {
  54032. branch0.elseif = elseIfCondition;
  54033. }
  54034. return branch0
  54035. }
  54036. }
  54037. }
  54038. function cloneASTElement (el) {
  54039. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  54040. }
  54041. var model$1 = {
  54042. preTransformNode: preTransformNode
  54043. };
  54044. var modules$1 = [
  54045. klass$1,
  54046. style$1,
  54047. model$1
  54048. ];
  54049. /* */
  54050. function text (el, dir) {
  54051. if (dir.value) {
  54052. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  54053. }
  54054. }
  54055. /* */
  54056. function html (el, dir) {
  54057. if (dir.value) {
  54058. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  54059. }
  54060. }
  54061. var directives$1 = {
  54062. model: model,
  54063. text: text,
  54064. html: html
  54065. };
  54066. /* */
  54067. var baseOptions = {
  54068. expectHTML: true,
  54069. modules: modules$1,
  54070. directives: directives$1,
  54071. isPreTag: isPreTag,
  54072. isUnaryTag: isUnaryTag,
  54073. mustUseProp: mustUseProp,
  54074. canBeLeftOpenTag: canBeLeftOpenTag,
  54075. isReservedTag: isReservedTag,
  54076. getTagNamespace: getTagNamespace,
  54077. staticKeys: genStaticKeys(modules$1)
  54078. };
  54079. /* */
  54080. var isStaticKey;
  54081. var isPlatformReservedTag;
  54082. var genStaticKeysCached = cached(genStaticKeys$1);
  54083. /**
  54084. * Goal of the optimizer: walk the generated template AST tree
  54085. * and detect sub-trees that are purely static, i.e. parts of
  54086. * the DOM that never needs to change.
  54087. *
  54088. * Once we detect these sub-trees, we can:
  54089. *
  54090. * 1. Hoist them into constants, so that we no longer need to
  54091. * create fresh nodes for them on each re-render;
  54092. * 2. Completely skip them in the patching process.
  54093. */
  54094. function optimize (root, options) {
  54095. if (!root) { return }
  54096. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  54097. isPlatformReservedTag = options.isReservedTag || no;
  54098. // first pass: mark all non-static nodes.
  54099. markStatic$1(root);
  54100. // second pass: mark static roots.
  54101. markStaticRoots(root, false);
  54102. }
  54103. function genStaticKeys$1 (keys) {
  54104. return makeMap(
  54105. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  54106. (keys ? ',' + keys : '')
  54107. )
  54108. }
  54109. function markStatic$1 (node) {
  54110. node.static = isStatic(node);
  54111. if (node.type === 1) {
  54112. // do not make component slot content static. this avoids
  54113. // 1. components not able to mutate slot nodes
  54114. // 2. static slot content fails for hot-reloading
  54115. if (
  54116. !isPlatformReservedTag(node.tag) &&
  54117. node.tag !== 'slot' &&
  54118. node.attrsMap['inline-template'] == null
  54119. ) {
  54120. return
  54121. }
  54122. for (var i = 0, l = node.children.length; i < l; i++) {
  54123. var child = node.children[i];
  54124. markStatic$1(child);
  54125. if (!child.static) {
  54126. node.static = false;
  54127. }
  54128. }
  54129. if (node.ifConditions) {
  54130. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54131. var block = node.ifConditions[i$1].block;
  54132. markStatic$1(block);
  54133. if (!block.static) {
  54134. node.static = false;
  54135. }
  54136. }
  54137. }
  54138. }
  54139. }
  54140. function markStaticRoots (node, isInFor) {
  54141. if (node.type === 1) {
  54142. if (node.static || node.once) {
  54143. node.staticInFor = isInFor;
  54144. }
  54145. // For a node to qualify as a static root, it should have children that
  54146. // are not just static text. Otherwise the cost of hoisting out will
  54147. // outweigh the benefits and it's better off to just always render it fresh.
  54148. if (node.static && node.children.length && !(
  54149. node.children.length === 1 &&
  54150. node.children[0].type === 3
  54151. )) {
  54152. node.staticRoot = true;
  54153. return
  54154. } else {
  54155. node.staticRoot = false;
  54156. }
  54157. if (node.children) {
  54158. for (var i = 0, l = node.children.length; i < l; i++) {
  54159. markStaticRoots(node.children[i], isInFor || !!node.for);
  54160. }
  54161. }
  54162. if (node.ifConditions) {
  54163. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54164. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  54165. }
  54166. }
  54167. }
  54168. }
  54169. function isStatic (node) {
  54170. if (node.type === 2) { // expression
  54171. return false
  54172. }
  54173. if (node.type === 3) { // text
  54174. return true
  54175. }
  54176. return !!(node.pre || (
  54177. !node.hasBindings && // no dynamic bindings
  54178. !node.if && !node.for && // not v-if or v-for or v-else
  54179. !isBuiltInTag(node.tag) && // not a built-in
  54180. isPlatformReservedTag(node.tag) && // not a component
  54181. !isDirectChildOfTemplateFor(node) &&
  54182. Object.keys(node).every(isStaticKey)
  54183. ))
  54184. }
  54185. function isDirectChildOfTemplateFor (node) {
  54186. while (node.parent) {
  54187. node = node.parent;
  54188. if (node.tag !== 'template') {
  54189. return false
  54190. }
  54191. if (node.for) {
  54192. return true
  54193. }
  54194. }
  54195. return false
  54196. }
  54197. /* */
  54198. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  54199. var fnInvokeRE = /\([^)]*?\);*$/;
  54200. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  54201. // KeyboardEvent.keyCode aliases
  54202. var keyCodes = {
  54203. esc: 27,
  54204. tab: 9,
  54205. enter: 13,
  54206. space: 32,
  54207. up: 38,
  54208. left: 37,
  54209. right: 39,
  54210. down: 40,
  54211. 'delete': [8, 46]
  54212. };
  54213. // KeyboardEvent.key aliases
  54214. var keyNames = {
  54215. // #7880: IE11 and Edge use `Esc` for Escape key name.
  54216. esc: ['Esc', 'Escape'],
  54217. tab: 'Tab',
  54218. enter: 'Enter',
  54219. // #9112: IE11 uses `Spacebar` for Space key name.
  54220. space: [' ', 'Spacebar'],
  54221. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  54222. up: ['Up', 'ArrowUp'],
  54223. left: ['Left', 'ArrowLeft'],
  54224. right: ['Right', 'ArrowRight'],
  54225. down: ['Down', 'ArrowDown'],
  54226. // #9112: IE11 uses `Del` for Delete key name.
  54227. 'delete': ['Backspace', 'Delete', 'Del']
  54228. };
  54229. // #4868: modifiers that prevent the execution of the listener
  54230. // need to explicitly return null so that we can determine whether to remove
  54231. // the listener for .once
  54232. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  54233. var modifierCode = {
  54234. stop: '$event.stopPropagation();',
  54235. prevent: '$event.preventDefault();',
  54236. self: genGuard("$event.target !== $event.currentTarget"),
  54237. ctrl: genGuard("!$event.ctrlKey"),
  54238. shift: genGuard("!$event.shiftKey"),
  54239. alt: genGuard("!$event.altKey"),
  54240. meta: genGuard("!$event.metaKey"),
  54241. left: genGuard("'button' in $event && $event.button !== 0"),
  54242. middle: genGuard("'button' in $event && $event.button !== 1"),
  54243. right: genGuard("'button' in $event && $event.button !== 2")
  54244. };
  54245. function genHandlers (
  54246. events,
  54247. isNative
  54248. ) {
  54249. var prefix = isNative ? 'nativeOn:' : 'on:';
  54250. var staticHandlers = "";
  54251. var dynamicHandlers = "";
  54252. for (var name in events) {
  54253. var handlerCode = genHandler(events[name]);
  54254. if (events[name] && events[name].dynamic) {
  54255. dynamicHandlers += name + "," + handlerCode + ",";
  54256. } else {
  54257. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  54258. }
  54259. }
  54260. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  54261. if (dynamicHandlers) {
  54262. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  54263. } else {
  54264. return prefix + staticHandlers
  54265. }
  54266. }
  54267. function genHandler (handler) {
  54268. if (!handler) {
  54269. return 'function(){}'
  54270. }
  54271. if (Array.isArray(handler)) {
  54272. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  54273. }
  54274. var isMethodPath = simplePathRE.test(handler.value);
  54275. var isFunctionExpression = fnExpRE.test(handler.value);
  54276. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  54277. if (!handler.modifiers) {
  54278. if (isMethodPath || isFunctionExpression) {
  54279. return handler.value
  54280. }
  54281. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  54282. } else {
  54283. var code = '';
  54284. var genModifierCode = '';
  54285. var keys = [];
  54286. for (var key in handler.modifiers) {
  54287. if (modifierCode[key]) {
  54288. genModifierCode += modifierCode[key];
  54289. // left/right
  54290. if (keyCodes[key]) {
  54291. keys.push(key);
  54292. }
  54293. } else if (key === 'exact') {
  54294. var modifiers = (handler.modifiers);
  54295. genModifierCode += genGuard(
  54296. ['ctrl', 'shift', 'alt', 'meta']
  54297. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  54298. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  54299. .join('||')
  54300. );
  54301. } else {
  54302. keys.push(key);
  54303. }
  54304. }
  54305. if (keys.length) {
  54306. code += genKeyFilter(keys);
  54307. }
  54308. // Make sure modifiers like prevent and stop get executed after key filtering
  54309. if (genModifierCode) {
  54310. code += genModifierCode;
  54311. }
  54312. var handlerCode = isMethodPath
  54313. ? ("return " + (handler.value) + "($event)")
  54314. : isFunctionExpression
  54315. ? ("return (" + (handler.value) + ")($event)")
  54316. : isFunctionInvocation
  54317. ? ("return " + (handler.value))
  54318. : handler.value;
  54319. return ("function($event){" + code + handlerCode + "}")
  54320. }
  54321. }
  54322. function genKeyFilter (keys) {
  54323. return (
  54324. // make sure the key filters only apply to KeyboardEvents
  54325. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  54326. // key events that do not have keyCode property...
  54327. "if(!$event.type.indexOf('key')&&" +
  54328. (keys.map(genFilterCode).join('&&')) + ")return null;"
  54329. )
  54330. }
  54331. function genFilterCode (key) {
  54332. var keyVal = parseInt(key, 10);
  54333. if (keyVal) {
  54334. return ("$event.keyCode!==" + keyVal)
  54335. }
  54336. var keyCode = keyCodes[key];
  54337. var keyName = keyNames[key];
  54338. return (
  54339. "_k($event.keyCode," +
  54340. (JSON.stringify(key)) + "," +
  54341. (JSON.stringify(keyCode)) + "," +
  54342. "$event.key," +
  54343. "" + (JSON.stringify(keyName)) +
  54344. ")"
  54345. )
  54346. }
  54347. /* */
  54348. function on (el, dir) {
  54349. if (dir.modifiers) {
  54350. warn("v-on without argument does not support modifiers.");
  54351. }
  54352. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  54353. }
  54354. /* */
  54355. function bind$1 (el, dir) {
  54356. el.wrapData = function (code) {
  54357. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  54358. };
  54359. }
  54360. /* */
  54361. var baseDirectives = {
  54362. on: on,
  54363. bind: bind$1,
  54364. cloak: noop
  54365. };
  54366. /* */
  54367. var CodegenState = function CodegenState (options) {
  54368. this.options = options;
  54369. this.warn = options.warn || baseWarn;
  54370. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  54371. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  54372. this.directives = extend(extend({}, baseDirectives), options.directives);
  54373. var isReservedTag = options.isReservedTag || no;
  54374. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  54375. this.onceId = 0;
  54376. this.staticRenderFns = [];
  54377. this.pre = false;
  54378. };
  54379. function generate (
  54380. ast,
  54381. options
  54382. ) {
  54383. var state = new CodegenState(options);
  54384. var code = ast ? genElement(ast, state) : '_c("div")';
  54385. return {
  54386. render: ("with(this){return " + code + "}"),
  54387. staticRenderFns: state.staticRenderFns
  54388. }
  54389. }
  54390. function genElement (el, state) {
  54391. if (el.parent) {
  54392. el.pre = el.pre || el.parent.pre;
  54393. }
  54394. if (el.staticRoot && !el.staticProcessed) {
  54395. return genStatic(el, state)
  54396. } else if (el.once && !el.onceProcessed) {
  54397. return genOnce(el, state)
  54398. } else if (el.for && !el.forProcessed) {
  54399. return genFor(el, state)
  54400. } else if (el.if && !el.ifProcessed) {
  54401. return genIf(el, state)
  54402. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  54403. return genChildren(el, state) || 'void 0'
  54404. } else if (el.tag === 'slot') {
  54405. return genSlot(el, state)
  54406. } else {
  54407. // component or element
  54408. var code;
  54409. if (el.component) {
  54410. code = genComponent(el.component, el, state);
  54411. } else {
  54412. var data;
  54413. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  54414. data = genData$2(el, state);
  54415. }
  54416. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54417. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  54418. }
  54419. // module transforms
  54420. for (var i = 0; i < state.transforms.length; i++) {
  54421. code = state.transforms[i](el, code);
  54422. }
  54423. return code
  54424. }
  54425. }
  54426. // hoist static sub-trees out
  54427. function genStatic (el, state) {
  54428. el.staticProcessed = true;
  54429. // Some elements (templates) need to behave differently inside of a v-pre
  54430. // node. All pre nodes are static roots, so we can use this as a location to
  54431. // wrap a state change and reset it upon exiting the pre node.
  54432. var originalPreState = state.pre;
  54433. if (el.pre) {
  54434. state.pre = el.pre;
  54435. }
  54436. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  54437. state.pre = originalPreState;
  54438. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  54439. }
  54440. // v-once
  54441. function genOnce (el, state) {
  54442. el.onceProcessed = true;
  54443. if (el.if && !el.ifProcessed) {
  54444. return genIf(el, state)
  54445. } else if (el.staticInFor) {
  54446. var key = '';
  54447. var parent = el.parent;
  54448. while (parent) {
  54449. if (parent.for) {
  54450. key = parent.key;
  54451. break
  54452. }
  54453. parent = parent.parent;
  54454. }
  54455. if (!key) {
  54456. state.warn(
  54457. "v-once can only be used inside v-for that is keyed. ",
  54458. el.rawAttrsMap['v-once']
  54459. );
  54460. return genElement(el, state)
  54461. }
  54462. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  54463. } else {
  54464. return genStatic(el, state)
  54465. }
  54466. }
  54467. function genIf (
  54468. el,
  54469. state,
  54470. altGen,
  54471. altEmpty
  54472. ) {
  54473. el.ifProcessed = true; // avoid recursion
  54474. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  54475. }
  54476. function genIfConditions (
  54477. conditions,
  54478. state,
  54479. altGen,
  54480. altEmpty
  54481. ) {
  54482. if (!conditions.length) {
  54483. return altEmpty || '_e()'
  54484. }
  54485. var condition = conditions.shift();
  54486. if (condition.exp) {
  54487. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  54488. } else {
  54489. return ("" + (genTernaryExp(condition.block)))
  54490. }
  54491. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  54492. function genTernaryExp (el) {
  54493. return altGen
  54494. ? altGen(el, state)
  54495. : el.once
  54496. ? genOnce(el, state)
  54497. : genElement(el, state)
  54498. }
  54499. }
  54500. function genFor (
  54501. el,
  54502. state,
  54503. altGen,
  54504. altHelper
  54505. ) {
  54506. var exp = el.for;
  54507. var alias = el.alias;
  54508. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54509. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54510. if (state.maybeComponent(el) &&
  54511. el.tag !== 'slot' &&
  54512. el.tag !== 'template' &&
  54513. !el.key
  54514. ) {
  54515. state.warn(
  54516. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54517. "v-for should have explicit keys. " +
  54518. "See https://vuejs.org/guide/list.html#key for more info.",
  54519. el.rawAttrsMap['v-for'],
  54520. true /* tip */
  54521. );
  54522. }
  54523. el.forProcessed = true; // avoid recursion
  54524. return (altHelper || '_l') + "((" + exp + ")," +
  54525. "function(" + alias + iterator1 + iterator2 + "){" +
  54526. "return " + ((altGen || genElement)(el, state)) +
  54527. '})'
  54528. }
  54529. function genData$2 (el, state) {
  54530. var data = '{';
  54531. // directives first.
  54532. // directives may mutate the el's other properties before they are generated.
  54533. var dirs = genDirectives(el, state);
  54534. if (dirs) { data += dirs + ','; }
  54535. // key
  54536. if (el.key) {
  54537. data += "key:" + (el.key) + ",";
  54538. }
  54539. // ref
  54540. if (el.ref) {
  54541. data += "ref:" + (el.ref) + ",";
  54542. }
  54543. if (el.refInFor) {
  54544. data += "refInFor:true,";
  54545. }
  54546. // pre
  54547. if (el.pre) {
  54548. data += "pre:true,";
  54549. }
  54550. // record original tag name for components using "is" attribute
  54551. if (el.component) {
  54552. data += "tag:\"" + (el.tag) + "\",";
  54553. }
  54554. // module data generation functions
  54555. for (var i = 0; i < state.dataGenFns.length; i++) {
  54556. data += state.dataGenFns[i](el);
  54557. }
  54558. // attributes
  54559. if (el.attrs) {
  54560. data += "attrs:" + (genProps(el.attrs)) + ",";
  54561. }
  54562. // DOM props
  54563. if (el.props) {
  54564. data += "domProps:" + (genProps(el.props)) + ",";
  54565. }
  54566. // event handlers
  54567. if (el.events) {
  54568. data += (genHandlers(el.events, false)) + ",";
  54569. }
  54570. if (el.nativeEvents) {
  54571. data += (genHandlers(el.nativeEvents, true)) + ",";
  54572. }
  54573. // slot target
  54574. // only for non-scoped slots
  54575. if (el.slotTarget && !el.slotScope) {
  54576. data += "slot:" + (el.slotTarget) + ",";
  54577. }
  54578. // scoped slots
  54579. if (el.scopedSlots) {
  54580. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54581. }
  54582. // component v-model
  54583. if (el.model) {
  54584. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54585. }
  54586. // inline-template
  54587. if (el.inlineTemplate) {
  54588. var inlineTemplate = genInlineTemplate(el, state);
  54589. if (inlineTemplate) {
  54590. data += inlineTemplate + ",";
  54591. }
  54592. }
  54593. data = data.replace(/,$/, '') + '}';
  54594. // v-bind dynamic argument wrap
  54595. // v-bind with dynamic arguments must be applied using the same v-bind object
  54596. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54597. if (el.dynamicAttrs) {
  54598. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54599. }
  54600. // v-bind data wrap
  54601. if (el.wrapData) {
  54602. data = el.wrapData(data);
  54603. }
  54604. // v-on data wrap
  54605. if (el.wrapListeners) {
  54606. data = el.wrapListeners(data);
  54607. }
  54608. return data
  54609. }
  54610. function genDirectives (el, state) {
  54611. var dirs = el.directives;
  54612. if (!dirs) { return }
  54613. var res = 'directives:[';
  54614. var hasRuntime = false;
  54615. var i, l, dir, needRuntime;
  54616. for (i = 0, l = dirs.length; i < l; i++) {
  54617. dir = dirs[i];
  54618. needRuntime = true;
  54619. var gen = state.directives[dir.name];
  54620. if (gen) {
  54621. // compile-time directive that manipulates AST.
  54622. // returns true if it also needs a runtime counterpart.
  54623. needRuntime = !!gen(el, dir, state.warn);
  54624. }
  54625. if (needRuntime) {
  54626. hasRuntime = true;
  54627. 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))) : '') + "},";
  54628. }
  54629. }
  54630. if (hasRuntime) {
  54631. return res.slice(0, -1) + ']'
  54632. }
  54633. }
  54634. function genInlineTemplate (el, state) {
  54635. var ast = el.children[0];
  54636. if (el.children.length !== 1 || ast.type !== 1) {
  54637. state.warn(
  54638. 'Inline-template components must have exactly one child element.',
  54639. { start: el.start }
  54640. );
  54641. }
  54642. if (ast && ast.type === 1) {
  54643. var inlineRenderFns = generate(ast, state.options);
  54644. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54645. }
  54646. }
  54647. function genScopedSlots (
  54648. el,
  54649. slots,
  54650. state
  54651. ) {
  54652. // by default scoped slots are considered "stable", this allows child
  54653. // components with only scoped slots to skip forced updates from parent.
  54654. // but in some cases we have to bail-out of this optimization
  54655. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54656. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54657. var slot = slots[key];
  54658. return (
  54659. slot.slotTargetDynamic ||
  54660. slot.if ||
  54661. slot.for ||
  54662. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54663. )
  54664. });
  54665. // #9534: if a component with scoped slots is inside a conditional branch,
  54666. // it's possible for the same component to be reused but with different
  54667. // compiled slot content. To avoid that, we generate a unique key based on
  54668. // the generated code of all the slot contents.
  54669. var needsKey = !!el.if;
  54670. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54671. // disconnected due to the intermediate scope variable)
  54672. // #9438, #9506
  54673. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54674. // and skip force updating ones that do not actually use scope variables.
  54675. if (!needsForceUpdate) {
  54676. var parent = el.parent;
  54677. while (parent) {
  54678. if (
  54679. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54680. parent.for
  54681. ) {
  54682. needsForceUpdate = true;
  54683. break
  54684. }
  54685. if (parent.if) {
  54686. needsKey = true;
  54687. }
  54688. parent = parent.parent;
  54689. }
  54690. }
  54691. var generatedSlots = Object.keys(slots)
  54692. .map(function (key) { return genScopedSlot(slots[key], state); })
  54693. .join(',');
  54694. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54695. }
  54696. function hash(str) {
  54697. var hash = 5381;
  54698. var i = str.length;
  54699. while(i) {
  54700. hash = (hash * 33) ^ str.charCodeAt(--i);
  54701. }
  54702. return hash >>> 0
  54703. }
  54704. function containsSlotChild (el) {
  54705. if (el.type === 1) {
  54706. if (el.tag === 'slot') {
  54707. return true
  54708. }
  54709. return el.children.some(containsSlotChild)
  54710. }
  54711. return false
  54712. }
  54713. function genScopedSlot (
  54714. el,
  54715. state
  54716. ) {
  54717. var isLegacySyntax = el.attrsMap['slot-scope'];
  54718. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54719. return genIf(el, state, genScopedSlot, "null")
  54720. }
  54721. if (el.for && !el.forProcessed) {
  54722. return genFor(el, state, genScopedSlot)
  54723. }
  54724. var slotScope = el.slotScope === emptySlotScopeToken
  54725. ? ""
  54726. : String(el.slotScope);
  54727. var fn = "function(" + slotScope + "){" +
  54728. "return " + (el.tag === 'template'
  54729. ? el.if && isLegacySyntax
  54730. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54731. : genChildren(el, state) || 'undefined'
  54732. : genElement(el, state)) + "}";
  54733. // reverse proxy v-slot without scope on this.$slots
  54734. var reverseProxy = slotScope ? "" : ",proxy:true";
  54735. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54736. }
  54737. function genChildren (
  54738. el,
  54739. state,
  54740. checkSkip,
  54741. altGenElement,
  54742. altGenNode
  54743. ) {
  54744. var children = el.children;
  54745. if (children.length) {
  54746. var el$1 = children[0];
  54747. // optimize single v-for
  54748. if (children.length === 1 &&
  54749. el$1.for &&
  54750. el$1.tag !== 'template' &&
  54751. el$1.tag !== 'slot'
  54752. ) {
  54753. var normalizationType = checkSkip
  54754. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54755. : "";
  54756. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54757. }
  54758. var normalizationType$1 = checkSkip
  54759. ? getNormalizationType(children, state.maybeComponent)
  54760. : 0;
  54761. var gen = altGenNode || genNode;
  54762. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  54763. }
  54764. }
  54765. // determine the normalization needed for the children array.
  54766. // 0: no normalization needed
  54767. // 1: simple normalization needed (possible 1-level deep nested array)
  54768. // 2: full normalization needed
  54769. function getNormalizationType (
  54770. children,
  54771. maybeComponent
  54772. ) {
  54773. var res = 0;
  54774. for (var i = 0; i < children.length; i++) {
  54775. var el = children[i];
  54776. if (el.type !== 1) {
  54777. continue
  54778. }
  54779. if (needsNormalization(el) ||
  54780. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  54781. res = 2;
  54782. break
  54783. }
  54784. if (maybeComponent(el) ||
  54785. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  54786. res = 1;
  54787. }
  54788. }
  54789. return res
  54790. }
  54791. function needsNormalization (el) {
  54792. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  54793. }
  54794. function genNode (node, state) {
  54795. if (node.type === 1) {
  54796. return genElement(node, state)
  54797. } else if (node.type === 3 && node.isComment) {
  54798. return genComment(node)
  54799. } else {
  54800. return genText(node)
  54801. }
  54802. }
  54803. function genText (text) {
  54804. return ("_v(" + (text.type === 2
  54805. ? text.expression // no need for () because already wrapped in _s()
  54806. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  54807. }
  54808. function genComment (comment) {
  54809. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  54810. }
  54811. function genSlot (el, state) {
  54812. var slotName = el.slotName || '"default"';
  54813. var children = genChildren(el, state);
  54814. var res = "_t(" + slotName + (children ? ("," + children) : '');
  54815. var attrs = el.attrs || el.dynamicAttrs
  54816. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  54817. // slot props are camelized
  54818. name: camelize(attr.name),
  54819. value: attr.value,
  54820. dynamic: attr.dynamic
  54821. }); }))
  54822. : null;
  54823. var bind$$1 = el.attrsMap['v-bind'];
  54824. if ((attrs || bind$$1) && !children) {
  54825. res += ",null";
  54826. }
  54827. if (attrs) {
  54828. res += "," + attrs;
  54829. }
  54830. if (bind$$1) {
  54831. res += (attrs ? '' : ',null') + "," + bind$$1;
  54832. }
  54833. return res + ')'
  54834. }
  54835. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  54836. function genComponent (
  54837. componentName,
  54838. el,
  54839. state
  54840. ) {
  54841. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54842. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  54843. }
  54844. function genProps (props) {
  54845. var staticProps = "";
  54846. var dynamicProps = "";
  54847. for (var i = 0; i < props.length; i++) {
  54848. var prop = props[i];
  54849. var value = transformSpecialNewlines(prop.value);
  54850. if (prop.dynamic) {
  54851. dynamicProps += (prop.name) + "," + value + ",";
  54852. } else {
  54853. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  54854. }
  54855. }
  54856. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  54857. if (dynamicProps) {
  54858. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  54859. } else {
  54860. return staticProps
  54861. }
  54862. }
  54863. // #3895, #4268
  54864. function transformSpecialNewlines (text) {
  54865. return text
  54866. .replace(/\u2028/g, '\\u2028')
  54867. .replace(/\u2029/g, '\\u2029')
  54868. }
  54869. /* */
  54870. // these keywords should not appear inside expressions, but operators like
  54871. // typeof, instanceof and in are allowed
  54872. var prohibitedKeywordRE = new RegExp('\\b' + (
  54873. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  54874. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  54875. 'extends,finally,continue,debugger,function,arguments'
  54876. ).split(',').join('\\b|\\b') + '\\b');
  54877. // these unary operators should not be used as property/method names
  54878. var unaryOperatorsRE = new RegExp('\\b' + (
  54879. 'delete,typeof,void'
  54880. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  54881. // strip strings in expressions
  54882. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  54883. // detect problematic expressions in a template
  54884. function detectErrors (ast, warn) {
  54885. if (ast) {
  54886. checkNode(ast, warn);
  54887. }
  54888. }
  54889. function checkNode (node, warn) {
  54890. if (node.type === 1) {
  54891. for (var name in node.attrsMap) {
  54892. if (dirRE.test(name)) {
  54893. var value = node.attrsMap[name];
  54894. if (value) {
  54895. var range = node.rawAttrsMap[name];
  54896. if (name === 'v-for') {
  54897. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  54898. } else if (name === 'v-slot' || name[0] === '#') {
  54899. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  54900. } else if (onRE.test(name)) {
  54901. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  54902. } else {
  54903. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  54904. }
  54905. }
  54906. }
  54907. }
  54908. if (node.children) {
  54909. for (var i = 0; i < node.children.length; i++) {
  54910. checkNode(node.children[i], warn);
  54911. }
  54912. }
  54913. } else if (node.type === 2) {
  54914. checkExpression(node.expression, node.text, warn, node);
  54915. }
  54916. }
  54917. function checkEvent (exp, text, warn, range) {
  54918. var stripped = exp.replace(stripStringRE, '');
  54919. var keywordMatch = stripped.match(unaryOperatorsRE);
  54920. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  54921. warn(
  54922. "avoid using JavaScript unary operator as property name: " +
  54923. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  54924. range
  54925. );
  54926. }
  54927. checkExpression(exp, text, warn, range);
  54928. }
  54929. function checkFor (node, text, warn, range) {
  54930. checkExpression(node.for || '', text, warn, range);
  54931. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  54932. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  54933. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  54934. }
  54935. function checkIdentifier (
  54936. ident,
  54937. type,
  54938. text,
  54939. warn,
  54940. range
  54941. ) {
  54942. if (typeof ident === 'string') {
  54943. try {
  54944. new Function(("var " + ident + "=_"));
  54945. } catch (e) {
  54946. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  54947. }
  54948. }
  54949. }
  54950. function checkExpression (exp, text, warn, range) {
  54951. try {
  54952. new Function(("return " + exp));
  54953. } catch (e) {
  54954. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  54955. if (keywordMatch) {
  54956. warn(
  54957. "avoid using JavaScript keyword as property name: " +
  54958. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  54959. range
  54960. );
  54961. } else {
  54962. warn(
  54963. "invalid expression: " + (e.message) + " in\n\n" +
  54964. " " + exp + "\n\n" +
  54965. " Raw expression: " + (text.trim()) + "\n",
  54966. range
  54967. );
  54968. }
  54969. }
  54970. }
  54971. function checkFunctionParameterExpression (exp, text, warn, range) {
  54972. try {
  54973. new Function(exp, '');
  54974. } catch (e) {
  54975. warn(
  54976. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  54977. " " + exp + "\n\n" +
  54978. " Raw expression: " + (text.trim()) + "\n",
  54979. range
  54980. );
  54981. }
  54982. }
  54983. /* */
  54984. var range = 2;
  54985. function generateCodeFrame (
  54986. source,
  54987. start,
  54988. end
  54989. ) {
  54990. if ( start === void 0 ) start = 0;
  54991. if ( end === void 0 ) end = source.length;
  54992. var lines = source.split(/\r?\n/);
  54993. var count = 0;
  54994. var res = [];
  54995. for (var i = 0; i < lines.length; i++) {
  54996. count += lines[i].length + 1;
  54997. if (count >= start) {
  54998. for (var j = i - range; j <= i + range || end > count; j++) {
  54999. if (j < 0 || j >= lines.length) { continue }
  55000. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  55001. var lineLength = lines[j].length;
  55002. if (j === i) {
  55003. // push underline
  55004. var pad = start - (count - lineLength) + 1;
  55005. var length = end > count ? lineLength - pad : end - start;
  55006. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  55007. } else if (j > i) {
  55008. if (end > count) {
  55009. var length$1 = Math.min(end - count, lineLength);
  55010. res.push(" | " + repeat$1("^", length$1));
  55011. }
  55012. count += lineLength + 1;
  55013. }
  55014. }
  55015. break
  55016. }
  55017. }
  55018. return res.join('\n')
  55019. }
  55020. function repeat$1 (str, n) {
  55021. var result = '';
  55022. if (n > 0) {
  55023. while (true) { // eslint-disable-line
  55024. if (n & 1) { result += str; }
  55025. n >>>= 1;
  55026. if (n <= 0) { break }
  55027. str += str;
  55028. }
  55029. }
  55030. return result
  55031. }
  55032. /* */
  55033. function createFunction (code, errors) {
  55034. try {
  55035. return new Function(code)
  55036. } catch (err) {
  55037. errors.push({ err: err, code: code });
  55038. return noop
  55039. }
  55040. }
  55041. function createCompileToFunctionFn (compile) {
  55042. var cache = Object.create(null);
  55043. return function compileToFunctions (
  55044. template,
  55045. options,
  55046. vm
  55047. ) {
  55048. options = extend({}, options);
  55049. var warn$$1 = options.warn || warn;
  55050. delete options.warn;
  55051. /* istanbul ignore if */
  55052. {
  55053. // detect possible CSP restriction
  55054. try {
  55055. new Function('return 1');
  55056. } catch (e) {
  55057. if (e.toString().match(/unsafe-eval|CSP/)) {
  55058. warn$$1(
  55059. 'It seems you are using the standalone build of Vue.js in an ' +
  55060. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  55061. 'The template compiler cannot work in this environment. Consider ' +
  55062. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  55063. 'templates into render functions.'
  55064. );
  55065. }
  55066. }
  55067. }
  55068. // check cache
  55069. var key = options.delimiters
  55070. ? String(options.delimiters) + template
  55071. : template;
  55072. if (cache[key]) {
  55073. return cache[key]
  55074. }
  55075. // compile
  55076. var compiled = compile(template, options);
  55077. // check compilation errors/tips
  55078. {
  55079. if (compiled.errors && compiled.errors.length) {
  55080. if (options.outputSourceRange) {
  55081. compiled.errors.forEach(function (e) {
  55082. warn$$1(
  55083. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  55084. generateCodeFrame(template, e.start, e.end),
  55085. vm
  55086. );
  55087. });
  55088. } else {
  55089. warn$$1(
  55090. "Error compiling template:\n\n" + template + "\n\n" +
  55091. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  55092. vm
  55093. );
  55094. }
  55095. }
  55096. if (compiled.tips && compiled.tips.length) {
  55097. if (options.outputSourceRange) {
  55098. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  55099. } else {
  55100. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  55101. }
  55102. }
  55103. }
  55104. // turn code into functions
  55105. var res = {};
  55106. var fnGenErrors = [];
  55107. res.render = createFunction(compiled.render, fnGenErrors);
  55108. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  55109. return createFunction(code, fnGenErrors)
  55110. });
  55111. // check function generation errors.
  55112. // this should only happen if there is a bug in the compiler itself.
  55113. // mostly for codegen development use
  55114. /* istanbul ignore if */
  55115. {
  55116. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  55117. warn$$1(
  55118. "Failed to generate render function:\n\n" +
  55119. fnGenErrors.map(function (ref) {
  55120. var err = ref.err;
  55121. var code = ref.code;
  55122. return ((err.toString()) + " in\n\n" + code + "\n");
  55123. }).join('\n'),
  55124. vm
  55125. );
  55126. }
  55127. }
  55128. return (cache[key] = res)
  55129. }
  55130. }
  55131. /* */
  55132. function createCompilerCreator (baseCompile) {
  55133. return function createCompiler (baseOptions) {
  55134. function compile (
  55135. template,
  55136. options
  55137. ) {
  55138. var finalOptions = Object.create(baseOptions);
  55139. var errors = [];
  55140. var tips = [];
  55141. var warn = function (msg, range, tip) {
  55142. (tip ? tips : errors).push(msg);
  55143. };
  55144. if (options) {
  55145. if (options.outputSourceRange) {
  55146. // $flow-disable-line
  55147. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  55148. warn = function (msg, range, tip) {
  55149. var data = { msg: msg };
  55150. if (range) {
  55151. if (range.start != null) {
  55152. data.start = range.start + leadingSpaceLength;
  55153. }
  55154. if (range.end != null) {
  55155. data.end = range.end + leadingSpaceLength;
  55156. }
  55157. }
  55158. (tip ? tips : errors).push(data);
  55159. };
  55160. }
  55161. // merge custom modules
  55162. if (options.modules) {
  55163. finalOptions.modules =
  55164. (baseOptions.modules || []).concat(options.modules);
  55165. }
  55166. // merge custom directives
  55167. if (options.directives) {
  55168. finalOptions.directives = extend(
  55169. Object.create(baseOptions.directives || null),
  55170. options.directives
  55171. );
  55172. }
  55173. // copy other options
  55174. for (var key in options) {
  55175. if (key !== 'modules' && key !== 'directives') {
  55176. finalOptions[key] = options[key];
  55177. }
  55178. }
  55179. }
  55180. finalOptions.warn = warn;
  55181. var compiled = baseCompile(template.trim(), finalOptions);
  55182. {
  55183. detectErrors(compiled.ast, warn);
  55184. }
  55185. compiled.errors = errors;
  55186. compiled.tips = tips;
  55187. return compiled
  55188. }
  55189. return {
  55190. compile: compile,
  55191. compileToFunctions: createCompileToFunctionFn(compile)
  55192. }
  55193. }
  55194. }
  55195. /* */
  55196. // `createCompilerCreator` allows creating compilers that use alternative
  55197. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  55198. // Here we just export a default compiler using the default parts.
  55199. var createCompiler = createCompilerCreator(function baseCompile (
  55200. template,
  55201. options
  55202. ) {
  55203. var ast = parse(template.trim(), options);
  55204. if (options.optimize !== false) {
  55205. optimize(ast, options);
  55206. }
  55207. var code = generate(ast, options);
  55208. return {
  55209. ast: ast,
  55210. render: code.render,
  55211. staticRenderFns: code.staticRenderFns
  55212. }
  55213. });
  55214. /* */
  55215. var ref$1 = createCompiler(baseOptions);
  55216. var compile = ref$1.compile;
  55217. var compileToFunctions = ref$1.compileToFunctions;
  55218. /* */
  55219. // check whether current browser encodes a char inside attribute values
  55220. var div;
  55221. function getShouldDecode (href) {
  55222. div = div || document.createElement('div');
  55223. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  55224. return div.innerHTML.indexOf('&#10;') > 0
  55225. }
  55226. // #3663: IE encodes newlines inside attribute values while other browsers don't
  55227. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  55228. // #6828: chrome encodes content in a[href]
  55229. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  55230. /* */
  55231. var idToTemplate = cached(function (id) {
  55232. var el = query(id);
  55233. return el && el.innerHTML
  55234. });
  55235. var mount = Vue.prototype.$mount;
  55236. Vue.prototype.$mount = function (
  55237. el,
  55238. hydrating
  55239. ) {
  55240. el = el && query(el);
  55241. /* istanbul ignore if */
  55242. if (el === document.body || el === document.documentElement) {
  55243. warn(
  55244. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  55245. );
  55246. return this
  55247. }
  55248. var options = this.$options;
  55249. // resolve template/el and convert to render function
  55250. if (!options.render) {
  55251. var template = options.template;
  55252. if (template) {
  55253. if (typeof template === 'string') {
  55254. if (template.charAt(0) === '#') {
  55255. template = idToTemplate(template);
  55256. /* istanbul ignore if */
  55257. if (!template) {
  55258. warn(
  55259. ("Template element not found or is empty: " + (options.template)),
  55260. this
  55261. );
  55262. }
  55263. }
  55264. } else if (template.nodeType) {
  55265. template = template.innerHTML;
  55266. } else {
  55267. {
  55268. warn('invalid template option:' + template, this);
  55269. }
  55270. return this
  55271. }
  55272. } else if (el) {
  55273. template = getOuterHTML(el);
  55274. }
  55275. if (template) {
  55276. /* istanbul ignore if */
  55277. if (config.performance && mark) {
  55278. mark('compile');
  55279. }
  55280. var ref = compileToFunctions(template, {
  55281. outputSourceRange: "development" !== 'production',
  55282. shouldDecodeNewlines: shouldDecodeNewlines,
  55283. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  55284. delimiters: options.delimiters,
  55285. comments: options.comments
  55286. }, this);
  55287. var render = ref.render;
  55288. var staticRenderFns = ref.staticRenderFns;
  55289. options.render = render;
  55290. options.staticRenderFns = staticRenderFns;
  55291. /* istanbul ignore if */
  55292. if (config.performance && mark) {
  55293. mark('compile end');
  55294. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  55295. }
  55296. }
  55297. }
  55298. return mount.call(this, el, hydrating)
  55299. };
  55300. /**
  55301. * Get outerHTML of elements, taking care
  55302. * of SVG elements in IE as well.
  55303. */
  55304. function getOuterHTML (el) {
  55305. if (el.outerHTML) {
  55306. return el.outerHTML
  55307. } else {
  55308. var container = document.createElement('div');
  55309. container.appendChild(el.cloneNode(true));
  55310. return container.innerHTML
  55311. }
  55312. }
  55313. Vue.compile = compileToFunctions;
  55314. module.exports = Vue;
  55315. /* 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))
  55316. /***/ }),
  55317. /***/ "./node_modules/vue/dist/vue.common.js":
  55318. /*!*********************************************!*\
  55319. !*** ./node_modules/vue/dist/vue.common.js ***!
  55320. \*********************************************/
  55321. /*! no static exports found */
  55322. /***/ (function(module, exports, __webpack_require__) {
  55323. if (false) {} else {
  55324. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  55325. }
  55326. /***/ }),
  55327. /***/ "./node_modules/webpack/buildin/global.js":
  55328. /*!***********************************!*\
  55329. !*** (webpack)/buildin/global.js ***!
  55330. \***********************************/
  55331. /*! no static exports found */
  55332. /***/ (function(module, exports) {
  55333. var g;
  55334. // This works in non-strict mode
  55335. g = (function() {
  55336. return this;
  55337. })();
  55338. try {
  55339. // This works if eval is allowed (see CSP)
  55340. g = g || new Function("return this")();
  55341. } catch (e) {
  55342. // This works if the window reference is available
  55343. if (typeof window === "object") g = window;
  55344. }
  55345. // g can still be undefined, but nothing to do about it...
  55346. // We return undefined, instead of nothing here, so it's
  55347. // easier to handle this case. if(!global) { ...}
  55348. module.exports = g;
  55349. /***/ }),
  55350. /***/ "./node_modules/webpack/buildin/module.js":
  55351. /*!***********************************!*\
  55352. !*** (webpack)/buildin/module.js ***!
  55353. \***********************************/
  55354. /*! no static exports found */
  55355. /***/ (function(module, exports) {
  55356. module.exports = function(module) {
  55357. if (!module.webpackPolyfill) {
  55358. module.deprecate = function() {};
  55359. module.paths = [];
  55360. // module.parent = undefined by default
  55361. if (!module.children) module.children = [];
  55362. Object.defineProperty(module, "loaded", {
  55363. enumerable: true,
  55364. get: function() {
  55365. return module.l;
  55366. }
  55367. });
  55368. Object.defineProperty(module, "id", {
  55369. enumerable: true,
  55370. get: function() {
  55371. return module.i;
  55372. }
  55373. });
  55374. module.webpackPolyfill = 1;
  55375. }
  55376. return module;
  55377. };
  55378. /***/ }),
  55379. /***/ "./resources/js/app.js":
  55380. /*!*****************************!*\
  55381. !*** ./resources/js/app.js ***!
  55382. \*****************************/
  55383. /*! no static exports found */
  55384. /***/ (function(module, exports, __webpack_require__) {
  55385. /**
  55386. * First we will load all of this project's JavaScript dependencies which
  55387. * includes Vue and other libraries. It is a great starting point when
  55388. * building robust, powerful web applications using Vue and Laravel.
  55389. */
  55390. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  55391. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  55392. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  55393. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  55394. /**
  55395. * The following block of code may be used to automatically register your
  55396. * Vue components. It will recursively scan this directory for the Vue
  55397. * components and automatically register them with their "basename".
  55398. *
  55399. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  55400. */
  55401. // const files = require.context('./', true, /\.vue$/i)
  55402. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  55403. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  55404. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  55405. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  55406. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  55407. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  55408. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  55409. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  55410. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  55411. Vue.component('credential-form-modal', __webpack_require__(/*! ./components/credential-form-modal.vue */ "./resources/js/components/credential-form-modal.vue")["default"]);
  55412. Vue.component('autocomplete-custom-dropdown', __webpack_require__(/*! ./components/autocomplete-custom-dropdown.vue */ "./resources/js/components/autocomplete-custom-dropdown.vue")["default"]);
  55413. Vue.component('credential-list', __webpack_require__(/*! ./components/credential-list.vue */ "./resources/js/components/credential-list.vue")["default"]);
  55414. /**
  55415. * Next, we will create a fresh Vue application instance and attach it to
  55416. * the page. Then, you may begin adding components to this application
  55417. * or customize the JavaScript scaffolding to fit your unique needs.
  55418. */
  55419. var app = new Vue({
  55420. el: '#app'
  55421. });
  55422. $(function () {
  55423. $('[data-toggle="tooltip"]').tooltip();
  55424. });
  55425. var clipboard = new Clipboard('.btn-clip');
  55426. clipboard.on('success', function (e) {
  55427. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  55428. position: "right",
  55429. className: 'success'
  55430. });
  55431. e.clearSelection();
  55432. });
  55433. /***/ }),
  55434. /***/ "./resources/js/bootstrap.js":
  55435. /*!***********************************!*\
  55436. !*** ./resources/js/bootstrap.js ***!
  55437. \***********************************/
  55438. /*! no exports provided */
  55439. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55440. "use strict";
  55441. __webpack_require__.r(__webpack_exports__);
  55442. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  55443. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  55444. /**
  55445. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  55446. * for JavaScript based Bootstrap features such as modals and tabs. This
  55447. * code may be modified to fit the specific needs of your application.
  55448. */
  55449. try {
  55450. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  55451. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  55452. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  55453. } catch (e) {}
  55454. /**
  55455. * We'll load the axios HTTP library which allows us to easily issue requests
  55456. * to our Laravel back-end. This library automatically handles sending the
  55457. * CSRF token as a header based on the value of the "XSRF" token cookie.
  55458. */
  55459. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  55460. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  55461. /**
  55462. * Echo exposes an expressive API for subscribing to channels and listening
  55463. * for events that are broadcast by Laravel. Echo and event broadcasting
  55464. * allows your team to easily build robust real-time web applications.
  55465. */
  55466. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  55467. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  55468. broadcaster: 'pusher',
  55469. key: "upccrt",
  55470. authEndpoint: '/broadcasting/auth',
  55471. wsHost: window.location.hostname,
  55472. wsPort: 6001,
  55473. disableStats: true
  55474. });
  55475. /***/ }),
  55476. /***/ "./resources/js/components/ExampleComponent.vue":
  55477. /*!******************************************************!*\
  55478. !*** ./resources/js/components/ExampleComponent.vue ***!
  55479. \******************************************************/
  55480. /*! exports provided: default */
  55481. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55482. "use strict";
  55483. __webpack_require__.r(__webpack_exports__);
  55484. /* harmony import */ var _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ExampleComponent.vue?vue&type=template&id=299e239e& */ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&");
  55485. /* harmony import */ var _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ExampleComponent.vue?vue&type=script&lang=js& */ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&");
  55486. /* 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");
  55487. /* normalize component */
  55488. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55489. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55490. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55491. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55492. false,
  55493. null,
  55494. null,
  55495. null
  55496. )
  55497. /* hot reload */
  55498. if (false) { var api; }
  55499. component.options.__file = "resources/js/components/ExampleComponent.vue"
  55500. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55501. /***/ }),
  55502. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  55503. /*!*******************************************************************************!*\
  55504. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55505. \*******************************************************************************/
  55506. /*! exports provided: default */
  55507. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55508. "use strict";
  55509. __webpack_require__.r(__webpack_exports__);
  55510. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_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!./ExampleComponent.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&");
  55511. /* 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_ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55512. /***/ }),
  55513. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55514. /*!*************************************************************************************!*\
  55515. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55516. \*************************************************************************************/
  55517. /*! exports provided: render, staticRenderFns */
  55518. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55519. "use strict";
  55520. __webpack_require__.r(__webpack_exports__);
  55521. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_ExampleComponent_vue_vue_type_template_id_299e239e___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!./ExampleComponent.vue?vue&type=template&id=299e239e& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&");
  55522. /* 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_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55523. /* 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_ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55524. /***/ }),
  55525. /***/ "./resources/js/components/assetinfo.vue":
  55526. /*!***********************************************!*\
  55527. !*** ./resources/js/components/assetinfo.vue ***!
  55528. \***********************************************/
  55529. /*! exports provided: default */
  55530. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55531. "use strict";
  55532. __webpack_require__.r(__webpack_exports__);
  55533. /* harmony import */ var _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./assetinfo.vue?vue&type=template&id=4fe1d2e3& */ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&");
  55534. /* 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&");
  55535. /* 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");
  55536. /* normalize component */
  55537. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55538. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55539. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55540. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55541. false,
  55542. null,
  55543. null,
  55544. null
  55545. )
  55546. /* hot reload */
  55547. if (false) { var api; }
  55548. component.options.__file = "resources/js/components/assetinfo.vue"
  55549. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55550. /***/ }),
  55551. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55552. /*!************************************************************************!*\
  55553. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55554. \************************************************************************/
  55555. /*! exports provided: default */
  55556. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55557. "use strict";
  55558. __webpack_require__.r(__webpack_exports__);
  55559. /* 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&");
  55560. /* 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"]);
  55561. /***/ }),
  55562. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55563. /*!******************************************************************************!*\
  55564. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55565. \******************************************************************************/
  55566. /*! exports provided: render, staticRenderFns */
  55567. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55568. "use strict";
  55569. __webpack_require__.r(__webpack_exports__);
  55570. /* 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_4fe1d2e3___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=4fe1d2e3& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&");
  55571. /* 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_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55572. /* 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_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55573. /***/ }),
  55574. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue":
  55575. /*!******************************************************************!*\
  55576. !*** ./resources/js/components/autocomplete-custom-dropdown.vue ***!
  55577. \******************************************************************/
  55578. /*! exports provided: default */
  55579. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55580. "use strict";
  55581. __webpack_require__.r(__webpack_exports__);
  55582. /* harmony import */ var _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& */ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&");
  55583. /* harmony import */ var _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./autocomplete-custom-dropdown.vue?vue&type=script&lang=js& */ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&");
  55584. /* 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");
  55585. /* normalize component */
  55586. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55587. _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55588. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"],
  55589. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55590. false,
  55591. null,
  55592. null,
  55593. null
  55594. )
  55595. /* hot reload */
  55596. if (false) { var api; }
  55597. component.options.__file = "resources/js/components/autocomplete-custom-dropdown.vue"
  55598. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55599. /***/ }),
  55600. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  55601. /*!*******************************************************************************************!*\
  55602. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  55603. \*******************************************************************************************/
  55604. /*! exports provided: default */
  55605. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55606. "use strict";
  55607. __webpack_require__.r(__webpack_exports__);
  55608. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_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!./autocomplete-custom-dropdown.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&");
  55609. /* 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_autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55610. /***/ }),
  55611. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  55612. /*!*************************************************************************************************!*\
  55613. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  55614. \*************************************************************************************************/
  55615. /*! exports provided: render, staticRenderFns */
  55616. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55617. "use strict";
  55618. __webpack_require__.r(__webpack_exports__);
  55619. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___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!./autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&");
  55620. /* 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_autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55621. /* 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_autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55622. /***/ }),
  55623. /***/ "./resources/js/components/credential-form-modal.vue":
  55624. /*!***********************************************************!*\
  55625. !*** ./resources/js/components/credential-form-modal.vue ***!
  55626. \***********************************************************/
  55627. /*! exports provided: default */
  55628. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55629. "use strict";
  55630. __webpack_require__.r(__webpack_exports__);
  55631. /* harmony import */ var _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./credential-form-modal.vue?vue&type=template&id=5ba19d42& */ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&");
  55632. /* harmony import */ var _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./credential-form-modal.vue?vue&type=script&lang=js& */ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&");
  55633. /* 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");
  55634. /* normalize component */
  55635. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55636. _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55637. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"],
  55638. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55639. false,
  55640. null,
  55641. null,
  55642. null
  55643. )
  55644. /* hot reload */
  55645. if (false) { var api; }
  55646. component.options.__file = "resources/js/components/credential-form-modal.vue"
  55647. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55648. /***/ }),
  55649. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  55650. /*!************************************************************************************!*\
  55651. !*** ./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  55652. \************************************************************************************/
  55653. /*! exports provided: default */
  55654. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55655. "use strict";
  55656. __webpack_require__.r(__webpack_exports__);
  55657. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_form_modal_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-form-modal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&");
  55658. /* 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_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55659. /***/ }),
  55660. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  55661. /*!******************************************************************************************!*\
  55662. !*** ./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  55663. \******************************************************************************************/
  55664. /*! exports provided: render, staticRenderFns */
  55665. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55666. "use strict";
  55667. __webpack_require__.r(__webpack_exports__);
  55668. /* 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_form_modal_vue_vue_type_template_id_5ba19d42___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-form-modal.vue?vue&type=template&id=5ba19d42& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&");
  55669. /* 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_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55670. /* 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_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55671. /***/ }),
  55672. /***/ "./resources/js/components/credential-list.vue":
  55673. /*!*****************************************************!*\
  55674. !*** ./resources/js/components/credential-list.vue ***!
  55675. \*****************************************************/
  55676. /*! exports provided: default */
  55677. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55678. "use strict";
  55679. __webpack_require__.r(__webpack_exports__);
  55680. /* harmony import */ var _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./credential-list.vue?vue&type=template&id=06d8fa4e& */ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&");
  55681. /* harmony import */ var _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./credential-list.vue?vue&type=script&lang=js& */ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&");
  55682. /* 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");
  55683. /* normalize component */
  55684. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55685. _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55686. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55687. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55688. false,
  55689. null,
  55690. null,
  55691. null
  55692. )
  55693. /* hot reload */
  55694. if (false) { var api; }
  55695. component.options.__file = "resources/js/components/credential-list.vue"
  55696. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55697. /***/ }),
  55698. /***/ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  55699. /*!******************************************************************************!*\
  55700. !*** ./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  55701. \******************************************************************************/
  55702. /*! exports provided: default */
  55703. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55704. "use strict";
  55705. __webpack_require__.r(__webpack_exports__);
  55706. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_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-list.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=script&lang=js&");
  55707. /* 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_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55708. /***/ }),
  55709. /***/ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  55710. /*!************************************************************************************!*\
  55711. !*** ./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  55712. \************************************************************************************/
  55713. /*! exports provided: render, staticRenderFns */
  55714. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55715. "use strict";
  55716. __webpack_require__.r(__webpack_exports__);
  55717. /* 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_list_vue_vue_type_template_id_06d8fa4e___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-list.vue?vue&type=template&id=06d8fa4e& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&");
  55718. /* 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_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55719. /* 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_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55720. /***/ }),
  55721. /***/ "./resources/js/components/credential.vue":
  55722. /*!************************************************!*\
  55723. !*** ./resources/js/components/credential.vue ***!
  55724. \************************************************/
  55725. /*! exports provided: default */
  55726. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55727. "use strict";
  55728. __webpack_require__.r(__webpack_exports__);
  55729. /* harmony import */ var _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./credential.vue?vue&type=template&id=0f5cc562& */ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&");
  55730. /* 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&");
  55731. /* 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");
  55732. /* normalize component */
  55733. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55734. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55735. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  55736. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55737. false,
  55738. null,
  55739. null,
  55740. null
  55741. )
  55742. /* hot reload */
  55743. if (false) { var api; }
  55744. component.options.__file = "resources/js/components/credential.vue"
  55745. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55746. /***/ }),
  55747. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  55748. /*!*************************************************************************!*\
  55749. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  55750. \*************************************************************************/
  55751. /*! exports provided: default */
  55752. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55753. "use strict";
  55754. __webpack_require__.r(__webpack_exports__);
  55755. /* 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&");
  55756. /* 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"]);
  55757. /***/ }),
  55758. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  55759. /*!*******************************************************************************!*\
  55760. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  55761. \*******************************************************************************/
  55762. /*! exports provided: render, staticRenderFns */
  55763. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55764. "use strict";
  55765. __webpack_require__.r(__webpack_exports__);
  55766. /* 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_0f5cc562___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=0f5cc562& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&");
  55767. /* 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_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55768. /* 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_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55769. /***/ }),
  55770. /***/ "./resources/js/components/errorlist.vue":
  55771. /*!***********************************************!*\
  55772. !*** ./resources/js/components/errorlist.vue ***!
  55773. \***********************************************/
  55774. /*! exports provided: default */
  55775. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55776. "use strict";
  55777. __webpack_require__.r(__webpack_exports__);
  55778. /* harmony import */ var _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./errorlist.vue?vue&type=template&id=1546f5eb& */ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&");
  55779. /* 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&");
  55780. /* 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");
  55781. /* normalize component */
  55782. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55783. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55784. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  55785. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55786. false,
  55787. null,
  55788. null,
  55789. null
  55790. )
  55791. /* hot reload */
  55792. if (false) { var api; }
  55793. component.options.__file = "resources/js/components/errorlist.vue"
  55794. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55795. /***/ }),
  55796. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  55797. /*!************************************************************************!*\
  55798. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  55799. \************************************************************************/
  55800. /*! exports provided: default */
  55801. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55802. "use strict";
  55803. __webpack_require__.r(__webpack_exports__);
  55804. /* 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&");
  55805. /* 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"]);
  55806. /***/ }),
  55807. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  55808. /*!******************************************************************************!*\
  55809. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  55810. \******************************************************************************/
  55811. /*! exports provided: render, staticRenderFns */
  55812. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55813. "use strict";
  55814. __webpack_require__.r(__webpack_exports__);
  55815. /* 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_1546f5eb___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=1546f5eb& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&");
  55816. /* 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_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55817. /* 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_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55818. /***/ }),
  55819. /***/ "./resources/js/components/modal.vue":
  55820. /*!*******************************************!*\
  55821. !*** ./resources/js/components/modal.vue ***!
  55822. \*******************************************/
  55823. /*! exports provided: default */
  55824. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55825. "use strict";
  55826. __webpack_require__.r(__webpack_exports__);
  55827. /* harmony import */ var _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modal.vue?vue&type=template&id=478d961c& */ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&");
  55828. /* 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");
  55829. var script = {}
  55830. /* normalize component */
  55831. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  55832. script,
  55833. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  55834. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55835. false,
  55836. null,
  55837. null,
  55838. null
  55839. )
  55840. /* hot reload */
  55841. if (false) { var api; }
  55842. component.options.__file = "resources/js/components/modal.vue"
  55843. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55844. /***/ }),
  55845. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  55846. /*!**************************************************************************!*\
  55847. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  55848. \**************************************************************************/
  55849. /*! exports provided: render, staticRenderFns */
  55850. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55851. "use strict";
  55852. __webpack_require__.r(__webpack_exports__);
  55853. /* 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_478d961c___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=478d961c& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/modal.vue?vue&type=template&id=478d961c&");
  55854. /* 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_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55855. /* 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_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55856. /***/ }),
  55857. /***/ "./resources/js/components/notes.vue":
  55858. /*!*******************************************!*\
  55859. !*** ./resources/js/components/notes.vue ***!
  55860. \*******************************************/
  55861. /*! exports provided: default */
  55862. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55863. "use strict";
  55864. __webpack_require__.r(__webpack_exports__);
  55865. /* harmony import */ var _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./notes.vue?vue&type=template&id=73d141f4& */ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&");
  55866. /* 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&");
  55867. /* 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");
  55868. /* normalize component */
  55869. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55870. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55871. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55872. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55873. false,
  55874. null,
  55875. null,
  55876. null
  55877. )
  55878. /* hot reload */
  55879. if (false) { var api; }
  55880. component.options.__file = "resources/js/components/notes.vue"
  55881. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55882. /***/ }),
  55883. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  55884. /*!********************************************************************!*\
  55885. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  55886. \********************************************************************/
  55887. /*! exports provided: default */
  55888. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55889. "use strict";
  55890. __webpack_require__.r(__webpack_exports__);
  55891. /* 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&");
  55892. /* 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"]);
  55893. /***/ }),
  55894. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  55895. /*!**************************************************************************!*\
  55896. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  55897. \**************************************************************************/
  55898. /*! exports provided: render, staticRenderFns */
  55899. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55900. "use strict";
  55901. __webpack_require__.r(__webpack_exports__);
  55902. /* 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_73d141f4___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=73d141f4& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=template&id=73d141f4&");
  55903. /* 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_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55904. /* 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_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55905. /***/ }),
  55906. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  55907. /*!*******************************************************!*\
  55908. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  55909. \*******************************************************/
  55910. /*! exports provided: default */
  55911. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55912. "use strict";
  55913. __webpack_require__.r(__webpack_exports__);
  55914. /* harmony import */ var _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& */ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&");
  55915. /* harmony import */ var _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./woinfo-edit-modal.vue?vue&type=script&lang=js& */ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&");
  55916. /* 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");
  55917. /* normalize component */
  55918. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55919. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55920. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55921. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55922. false,
  55923. null,
  55924. null,
  55925. null
  55926. )
  55927. /* hot reload */
  55928. if (false) { var api; }
  55929. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  55930. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55931. /***/ }),
  55932. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  55933. /*!********************************************************************************!*\
  55934. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  55935. \********************************************************************************/
  55936. /*! exports provided: default */
  55937. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55938. "use strict";
  55939. __webpack_require__.r(__webpack_exports__);
  55940. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_edit_modal_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!./woinfo-edit-modal.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&");
  55941. /* 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_woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55942. /***/ }),
  55943. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  55944. /*!**************************************************************************************!*\
  55945. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  55946. \**************************************************************************************/
  55947. /*! exports provided: render, staticRenderFns */
  55948. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55949. "use strict";
  55950. __webpack_require__.r(__webpack_exports__);
  55951. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___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!./woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&");
  55952. /* 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_woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55953. /* 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_woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55954. /***/ }),
  55955. /***/ "./resources/js/components/woinfo.vue":
  55956. /*!********************************************!*\
  55957. !*** ./resources/js/components/woinfo.vue ***!
  55958. \********************************************/
  55959. /*! exports provided: default */
  55960. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55961. "use strict";
  55962. __webpack_require__.r(__webpack_exports__);
  55963. /* harmony import */ var _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./woinfo.vue?vue&type=template&id=33ce32de& */ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&");
  55964. /* harmony import */ var _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./woinfo.vue?vue&type=script&lang=js& */ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&");
  55965. /* 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");
  55966. /* normalize component */
  55967. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55968. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55969. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  55970. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55971. false,
  55972. null,
  55973. null,
  55974. null
  55975. )
  55976. /* hot reload */
  55977. if (false) { var api; }
  55978. component.options.__file = "resources/js/components/woinfo.vue"
  55979. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55980. /***/ }),
  55981. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  55982. /*!*********************************************************************!*\
  55983. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  55984. \*********************************************************************/
  55985. /*! exports provided: default */
  55986. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55987. "use strict";
  55988. __webpack_require__.r(__webpack_exports__);
  55989. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_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!./woinfo.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&");
  55990. /* 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_woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55991. /***/ }),
  55992. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  55993. /*!***************************************************************************!*\
  55994. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  55995. \***************************************************************************/
  55996. /*! exports provided: render, staticRenderFns */
  55997. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55998. "use strict";
  55999. __webpack_require__.r(__webpack_exports__);
  56000. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_woinfo_vue_vue_type_template_id_33ce32de___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!./woinfo.vue?vue&type=template&id=33ce32de& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&");
  56001. /* 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_woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  56002. /* 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_woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  56003. /***/ }),
  56004. /***/ "./resources/js/mixins/dateMixin.js":
  56005. /*!******************************************!*\
  56006. !*** ./resources/js/mixins/dateMixin.js ***!
  56007. \******************************************/
  56008. /*! exports provided: default */
  56009. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56010. "use strict";
  56011. __webpack_require__.r(__webpack_exports__);
  56012. /* harmony default export */ __webpack_exports__["default"] = ({
  56013. methods: {
  56014. treatAsUTC: function treatAsUTC(date) {
  56015. var result = new Date(date);
  56016. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  56017. return result;
  56018. },
  56019. daysSinceToday: function daysSinceToday(date) {
  56020. var currentDate = new Date();
  56021. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  56022. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  56023. },
  56024. getHRDate: function getHRDate(dateString) {
  56025. var date = new Date(dateString);
  56026. return date.toLocaleString('default', {
  56027. month: 'short',
  56028. day: 'numeric',
  56029. year: 'numeric',
  56030. hour: 'numeric',
  56031. minute: 'numeric'
  56032. });
  56033. },
  56034. isZero: function isZero(dateString) {
  56035. return dateString === '0000-00-00 00:00:00';
  56036. }
  56037. }
  56038. });
  56039. /***/ }),
  56040. /***/ "./resources/js/notify.min.js":
  56041. /*!************************************!*\
  56042. !*** ./resources/js/notify.min.js ***!
  56043. \************************************/
  56044. /*! no static exports found */
  56045. /***/ (function(module, exports, __webpack_require__) {
  56046. 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); }
  56047. (function (e) {
  56048. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  56049. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  56050. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  56051. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  56052. })(function (e) {
  56053. function A(t, n, i) {
  56054. typeof i == "string" && (i = {
  56055. className: i
  56056. }), 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);
  56057. }
  56058. var t = [].indexOf || function (e) {
  56059. for (var t = 0, n = this.length; t < n; t++) {
  56060. if (t in this && this[t] === e) return t;
  56061. }
  56062. return -1;
  56063. },
  56064. n = "notify",
  56065. r = n + "js",
  56066. i = n + "!blank",
  56067. s = {
  56068. t: "top",
  56069. m: "middle",
  56070. b: "bottom",
  56071. l: "left",
  56072. c: "center",
  56073. r: "right"
  56074. },
  56075. o = ["l", "c", "r"],
  56076. u = ["t", "m", "b"],
  56077. a = ["t", "b", "l", "r"],
  56078. f = {
  56079. t: "b",
  56080. m: null,
  56081. b: "t",
  56082. l: "r",
  56083. c: null,
  56084. r: "l"
  56085. },
  56086. l = function l(t) {
  56087. var n;
  56088. return n = [], e.each(t.split(/\W+/), function (e, t) {
  56089. var r;
  56090. r = t.toLowerCase().charAt(0);
  56091. if (s[r]) return n.push(r);
  56092. }), n;
  56093. },
  56094. c = {},
  56095. h = {
  56096. name: "core",
  56097. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  56098. 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}"
  56099. },
  56100. p = {
  56101. "border-radius": ["-webkit-", "-moz-"]
  56102. },
  56103. d = function d(e) {
  56104. return c[e];
  56105. },
  56106. v = function v(e) {
  56107. if (!e) throw "Missing Style name";
  56108. c[e] && delete c[e];
  56109. },
  56110. m = function m(t, i) {
  56111. if (!t) throw "Missing Style name";
  56112. if (!i) throw "Missing Style definition";
  56113. if (!i.html) throw "Missing Style HTML";
  56114. var s = c[t];
  56115. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  56116. var o = "";
  56117. i.classes && e.each(i.classes, function (t, n) {
  56118. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  56119. return p[t] && e.each(p[t], function (e, r) {
  56120. return o += " " + r + t + ": " + n + ";\n";
  56121. }), o += " " + t + ": " + n + ";\n";
  56122. }), o += "}\n";
  56123. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  56124. var u = {},
  56125. a = e(i.html);
  56126. y("html", a, u), y("text", a, u), i.fields = u;
  56127. },
  56128. g = function g(t) {
  56129. var n, r, i;
  56130. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  56131. try {
  56132. r.html(t);
  56133. } catch (s) {
  56134. r[0].styleSheet.cssText = t;
  56135. }
  56136. return r;
  56137. },
  56138. y = function y(t, n, r) {
  56139. var s;
  56140. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  56141. var n;
  56142. n = e(this).attr(s), n || (n = i), r[n] = t;
  56143. });
  56144. },
  56145. b = function b(e, t) {
  56146. return e.is(t) ? e : e.find(t);
  56147. },
  56148. w = {
  56149. clickToHide: !0,
  56150. autoHide: !0,
  56151. autoHideDelay: 5e3,
  56152. arrowShow: !0,
  56153. arrowSize: 5,
  56154. breakNewLines: !0,
  56155. elementPosition: "bottom",
  56156. globalPosition: "top right",
  56157. style: "bootstrap",
  56158. className: "error",
  56159. showAnimation: "slideDown",
  56160. showDuration: 400,
  56161. hideAnimation: "slideUp",
  56162. hideDuration: 200,
  56163. gap: 5
  56164. },
  56165. E = function E(t, n) {
  56166. var r;
  56167. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  56168. },
  56169. S = function S(t) {
  56170. return e.extend(w, t);
  56171. },
  56172. x = function x(t) {
  56173. return e("<" + t + "></" + t + ">");
  56174. },
  56175. T = {},
  56176. N = function N(t) {
  56177. var n;
  56178. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  56179. return e(r).attr("name") === t.attr("name");
  56180. }), t = n.first()), t;
  56181. },
  56182. C = function C(e, t, n) {
  56183. var r, i;
  56184. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  56185. if (isNaN(n)) return;
  56186. 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;
  56187. },
  56188. k = function k(e, t, n) {
  56189. if (e === "l" || e === "t") return 0;
  56190. if (e === "c" || e === "m") return n / 2 - t / 2;
  56191. if (e === "r" || e === "b") return n - t;
  56192. throw "Invalid alignment";
  56193. },
  56194. L = function L(e) {
  56195. return L.e = L.e || x("div"), L.e.text(e).html();
  56196. };
  56197. A.prototype.loadHTML = function () {
  56198. var t;
  56199. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  56200. }, A.prototype.show = function (e, t) {
  56201. var n, r, i, s, o;
  56202. r = function (n) {
  56203. return function () {
  56204. !e && !n.elem && n.destroy();
  56205. if (t) return t();
  56206. };
  56207. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  56208. 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 {
  56209. if (!!o || !!e) return r();
  56210. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  56211. }
  56212. return n.push(r), i[s].apply(i, n);
  56213. }, A.prototype.setGlobalPosition = function () {
  56214. var t = this.getPosition(),
  56215. n = t[0],
  56216. i = t[1],
  56217. o = s[n],
  56218. u = s[i],
  56219. a = n + "|" + i,
  56220. f = T[a];
  56221. if (!f || !document.body.contains(f[0])) {
  56222. f = T[a] = x("div");
  56223. var l = {};
  56224. 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);
  56225. }
  56226. return f.prepend(this.wrapper);
  56227. }, A.prototype.setElementPosition = function () {
  56228. 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;
  56229. 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"];
  56230. for (w = 0, S = B.length; w < S; w++) {
  56231. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  56232. }
  56233. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  56234. if (!this.options.arrowShow) this.arrow.hide();else {
  56235. 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";
  56236. for (E = 0, x = a.length; E < x; E++) {
  56237. D = a[E], P = s[D];
  56238. if (D === L) continue;
  56239. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  56240. }
  56241. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  56242. }
  56243. 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);
  56244. if (r) return this.arrow.removeAttr("style").css(r);
  56245. }, A.prototype.getPosition = function () {
  56246. var e, n, r, i, s, f, c, h;
  56247. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  56248. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  56249. 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";
  56250. return e.length === 2 && (e[2] = e[1]), e;
  56251. }, A.prototype.getStyle = function (e) {
  56252. var t;
  56253. e || (e = this.options.style), e || (e = "default"), t = c[e];
  56254. if (!t) throw "Missing style: " + e;
  56255. return t;
  56256. }, A.prototype.updateClasses = function () {
  56257. var t, n;
  56258. 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) {
  56259. return r + "-" + n.name + "-" + e;
  56260. }).join(" "), this.userContainer.attr("class", t);
  56261. }, A.prototype.run = function (t, n) {
  56262. var r, s, o, u, a;
  56263. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  56264. if (this.container && !t) {
  56265. this.show(!1);
  56266. return;
  56267. }
  56268. if (!this.container && !t) return;
  56269. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  56270. for (o in s) {
  56271. r = s[o], u = this.userFields[o];
  56272. if (!u) continue;
  56273. 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);
  56274. }
  56275. 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));
  56276. }, A.prototype.destroy = function () {
  56277. this.wrapper.data(r, null), this.wrapper.remove();
  56278. }, e[n] = function (t, r, i) {
  56279. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  56280. }, e.fn[n] = function (t, n) {
  56281. return e(this).each(function () {
  56282. var i = N(e(this)).data(r);
  56283. i && i.destroy();
  56284. var s = new A(e(this), t, n);
  56285. }), this;
  56286. }, e.extend(e[n], {
  56287. defaults: S,
  56288. addStyle: m,
  56289. removeStyle: v,
  56290. pluginOptions: w,
  56291. getStyle: d,
  56292. insertCSS: g
  56293. }), m("bootstrap", {
  56294. html: "<div>\n<span data-notify-text></span>\n</div>",
  56295. classes: {
  56296. base: {
  56297. "font-weight": "bold",
  56298. padding: "8px 15px 8px 14px",
  56299. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  56300. "background-color": "#fcf8e3",
  56301. border: "1px solid #fbeed5",
  56302. "border-radius": "4px",
  56303. "white-space": "nowrap",
  56304. "padding-left": "25px",
  56305. "background-repeat": "no-repeat",
  56306. "background-position": "3px 7px"
  56307. },
  56308. error: {
  56309. color: "#B94A48",
  56310. "background-color": "#F2DEDE",
  56311. "border-color": "#EED3D7",
  56312. "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=)"
  56313. },
  56314. success: {
  56315. color: "#468847",
  56316. "background-color": "#DFF0D8",
  56317. "border-color": "#D6E9C6",
  56318. "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==)"
  56319. },
  56320. info: {
  56321. color: "#3A87AD",
  56322. "background-color": "#D9EDF7",
  56323. "border-color": "#BCE8F1",
  56324. "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=)"
  56325. },
  56326. warn: {
  56327. color: "#C09853",
  56328. "background-color": "#FCF8E3",
  56329. "border-color": "#FBEED5",
  56330. "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)"
  56331. }
  56332. }
  56333. }), e(function () {
  56334. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  56335. e(this).trigger("notify-hide");
  56336. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  56337. var n = e(this).data(r);
  56338. n && n.show(!1);
  56339. });
  56340. });
  56341. });
  56342. /***/ }),
  56343. /***/ "./resources/sass/app.scss":
  56344. /*!*********************************!*\
  56345. !*** ./resources/sass/app.scss ***!
  56346. \*********************************/
  56347. /*! no static exports found */
  56348. /***/ (function(module, exports) {
  56349. // removed by extract-text-webpack-plugin
  56350. /***/ }),
  56351. /***/ 0:
  56352. /*!*************************************************************!*\
  56353. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  56354. \*************************************************************/
  56355. /*! no static exports found */
  56356. /***/ (function(module, exports, __webpack_require__) {
  56357. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  56358. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  56359. /***/ })
  56360. /******/ });