app.js 1.8 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765
  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('asset.' + this.data.pcid).listen('AssetUpdated', function (e) {
  1678. _this.data = 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. methods: {
  1993. deleteCred: function deleteCred(index) {
  1994. this.credentials.splice(index, 1);
  1995. }
  1996. },
  1997. mounted: function mounted() {
  1998. var _this = this;
  1999. if (this.pcid) {
  2000. Echo.channel('credlist.pcid.' + this.pcid).listen('CredentialDeleted', function (e) {
  2001. var deletedCred = e.credential;
  2002. var index = _this.credentials.findIndex(function (credential) {
  2003. return credential.pcid === deletedCred['pcid'];
  2004. });
  2005. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2006. _this.deleteCred(index);
  2007. });
  2008. }
  2009. if (this.groupid) {
  2010. Echo.channel('credlist.groupid.' + this.groupid).listen('CredentialDeleted', function (e) {
  2011. var deletedCred = e.credential;
  2012. var index = _this.credentials.findIndex(function (credential) {
  2013. return credential.groupid === deletedCred['groupid'];
  2014. });
  2015. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2016. _this.deleteCred(index);
  2017. });
  2018. }
  2019. }
  2020. });
  2021. /***/ }),
  2022. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&":
  2023. /*!*********************************************************************************************************************************************************************!*\
  2024. !*** ./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& ***!
  2025. \*********************************************************************************************************************************************************************/
  2026. /*! exports provided: default */
  2027. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2028. "use strict";
  2029. __webpack_require__.r(__webpack_exports__);
  2030. //
  2031. //
  2032. //
  2033. //
  2034. //
  2035. //
  2036. //
  2037. //
  2038. //
  2039. //
  2040. //
  2041. //
  2042. //
  2043. //
  2044. //
  2045. //
  2046. //
  2047. //
  2048. //
  2049. //
  2050. //
  2051. //
  2052. //
  2053. //
  2054. //
  2055. //
  2056. //
  2057. //
  2058. //
  2059. //
  2060. //
  2061. //
  2062. //
  2063. //
  2064. //
  2065. //
  2066. //
  2067. //
  2068. //
  2069. //
  2070. //
  2071. //
  2072. //
  2073. /* harmony default export */ __webpack_exports__["default"] = ({
  2074. props: ['credential', 'descriptions'],
  2075. data: function data() {
  2076. return {
  2077. data: this.credential,
  2078. creddescList: this.descriptions
  2079. };
  2080. },
  2081. mounted: function mounted() {
  2082. var _this = this;
  2083. Echo.channel('credential.' + this.data.credid).listen('CredentialUpdated', function (e) {
  2084. _this.data = e.credential;
  2085. });
  2086. },
  2087. methods: {
  2088. deleteCredential: function deleteCredential() {
  2089. var _this2 = this;
  2090. axios["delete"]('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2091. $('#credential' + _this2.data.credid + 'deleteModal').modal('hide');
  2092. })["catch"](function (error) {
  2093. console.error(error);
  2094. });
  2095. }
  2096. }
  2097. });
  2098. /***/ }),
  2099. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  2100. /*!********************************************************************************************************************************************************************!*\
  2101. !*** ./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& ***!
  2102. \********************************************************************************************************************************************************************/
  2103. /*! exports provided: default */
  2104. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2105. "use strict";
  2106. __webpack_require__.r(__webpack_exports__);
  2107. //
  2108. //
  2109. //
  2110. //
  2111. //
  2112. /* harmony default export */ __webpack_exports__["default"] = ({
  2113. props: ['errors'],
  2114. data: function data() {
  2115. return {
  2116. errorList: this.errors
  2117. };
  2118. },
  2119. watch: {
  2120. errors: function errors(newErrors) {
  2121. this.errorList = newErrors;
  2122. }
  2123. }
  2124. });
  2125. /***/ }),
  2126. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  2127. /*!****************************************************************************************************************************************************************!*\
  2128. !*** ./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& ***!
  2129. \****************************************************************************************************************************************************************/
  2130. /*! exports provided: default */
  2131. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2132. "use strict";
  2133. __webpack_require__.r(__webpack_exports__);
  2134. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2135. //
  2136. //
  2137. //
  2138. //
  2139. //
  2140. //
  2141. //
  2142. //
  2143. //
  2144. //
  2145. //
  2146. //
  2147. //
  2148. //
  2149. //
  2150. //
  2151. //
  2152. //
  2153. //
  2154. //
  2155. //
  2156. //
  2157. //
  2158. //
  2159. //
  2160. //
  2161. //
  2162. //
  2163. //
  2164. //
  2165. //
  2166. //
  2167. //
  2168. //
  2169. //
  2170. //
  2171. //
  2172. //
  2173. //
  2174. /* harmony default export */ __webpack_exports__["default"] = ({
  2175. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2176. props: ['initialnotes', 'authusername'],
  2177. data: function data() {
  2178. return {
  2179. notes: this.initialnotes
  2180. };
  2181. }
  2182. });
  2183. /***/ }),
  2184. /***/ "./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&":
  2185. /*!****************************************************************************************************************************************************************************!*\
  2186. !*** ./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& ***!
  2187. \****************************************************************************************************************************************************************************/
  2188. /*! exports provided: default */
  2189. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2190. "use strict";
  2191. __webpack_require__.r(__webpack_exports__);
  2192. //
  2193. //
  2194. //
  2195. //
  2196. //
  2197. //
  2198. //
  2199. //
  2200. //
  2201. //
  2202. //
  2203. //
  2204. //
  2205. //
  2206. //
  2207. //
  2208. //
  2209. //
  2210. //
  2211. //
  2212. //
  2213. //
  2214. //
  2215. //
  2216. //
  2217. //
  2218. //
  2219. //
  2220. //
  2221. //
  2222. //
  2223. //
  2224. //
  2225. /* harmony default export */ __webpack_exports__["default"] = ({
  2226. props: ['populateWith', 'storeList', 'modalId'],
  2227. data: function data() {
  2228. return {
  2229. // Copies object from prop, so it doesn't mutate the object
  2230. // from the parent component. Parent component will be updated via
  2231. // Websocket if updateWorkOrder is successful.
  2232. data: JSON.parse(JSON.stringify(this.populateWith)),
  2233. id: this.modalId,
  2234. store: {},
  2235. errors: []
  2236. };
  2237. },
  2238. mounted: function mounted() {
  2239. this.store = {
  2240. 'id': this.data.storeid,
  2241. 'name': this.storeList[this.data.storeid]
  2242. };
  2243. },
  2244. methods: {
  2245. updateWorkOrder: function updateWorkOrder() {
  2246. var _this = this;
  2247. this.data.storeid = this.store.id;
  2248. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2249. $('#workordereditModal').modal('hide');
  2250. })["catch"](function (error) {
  2251. _this.errors = JSON.parse(error.response.request.response).errors;
  2252. });
  2253. }
  2254. }
  2255. });
  2256. /***/ }),
  2257. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  2258. /*!*****************************************************************************************************************************************************************!*\
  2259. !*** ./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& ***!
  2260. \*****************************************************************************************************************************************************************/
  2261. /*! exports provided: default */
  2262. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2263. "use strict";
  2264. __webpack_require__.r(__webpack_exports__);
  2265. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2266. //
  2267. //
  2268. //
  2269. //
  2270. //
  2271. //
  2272. //
  2273. //
  2274. //
  2275. //
  2276. //
  2277. //
  2278. //
  2279. //
  2280. //
  2281. //
  2282. //
  2283. //
  2284. //
  2285. //
  2286. /* harmony default export */ __webpack_exports__["default"] = ({
  2287. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2288. props: ['workOrder', 'stores'],
  2289. data: function data() {
  2290. return {
  2291. data: JSON.parse(this.workOrder)
  2292. };
  2293. },
  2294. computed: {
  2295. storeList: function storeList() {
  2296. var list = {};
  2297. JSON.parse(this.stores).map(function (val) {
  2298. list[val.storeid] = val.storesname;
  2299. });
  2300. return list;
  2301. }
  2302. },
  2303. mounted: function mounted() {
  2304. var _this = this;
  2305. Echo.channel('work-order.' + this.data.woid).listen('WorkOrderUpdated', function (e) {
  2306. _this.data = e.data;
  2307. });
  2308. }
  2309. });
  2310. /***/ }),
  2311. /***/ "./node_modules/base64-js/index.js":
  2312. /*!*****************************************!*\
  2313. !*** ./node_modules/base64-js/index.js ***!
  2314. \*****************************************/
  2315. /*! no static exports found */
  2316. /***/ (function(module, exports, __webpack_require__) {
  2317. "use strict";
  2318. exports.byteLength = byteLength
  2319. exports.toByteArray = toByteArray
  2320. exports.fromByteArray = fromByteArray
  2321. var lookup = []
  2322. var revLookup = []
  2323. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2324. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2325. for (var i = 0, len = code.length; i < len; ++i) {
  2326. lookup[i] = code[i]
  2327. revLookup[code.charCodeAt(i)] = i
  2328. }
  2329. // Support decoding URL-safe base64 strings, as Node.js does.
  2330. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2331. revLookup['-'.charCodeAt(0)] = 62
  2332. revLookup['_'.charCodeAt(0)] = 63
  2333. function getLens (b64) {
  2334. var len = b64.length
  2335. if (len % 4 > 0) {
  2336. throw new Error('Invalid string. Length must be a multiple of 4')
  2337. }
  2338. // Trim off extra bytes after placeholder bytes are found
  2339. // See: https://github.com/beatgammit/base64-js/issues/42
  2340. var validLen = b64.indexOf('=')
  2341. if (validLen === -1) validLen = len
  2342. var placeHoldersLen = validLen === len
  2343. ? 0
  2344. : 4 - (validLen % 4)
  2345. return [validLen, placeHoldersLen]
  2346. }
  2347. // base64 is 4/3 + up to two characters of the original data
  2348. function byteLength (b64) {
  2349. var lens = getLens(b64)
  2350. var validLen = lens[0]
  2351. var placeHoldersLen = lens[1]
  2352. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2353. }
  2354. function _byteLength (b64, validLen, placeHoldersLen) {
  2355. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2356. }
  2357. function toByteArray (b64) {
  2358. var tmp
  2359. var lens = getLens(b64)
  2360. var validLen = lens[0]
  2361. var placeHoldersLen = lens[1]
  2362. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2363. var curByte = 0
  2364. // if there are placeholders, only get up to the last complete 4 chars
  2365. var len = placeHoldersLen > 0
  2366. ? validLen - 4
  2367. : validLen
  2368. var i
  2369. for (i = 0; i < len; i += 4) {
  2370. tmp =
  2371. (revLookup[b64.charCodeAt(i)] << 18) |
  2372. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2373. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2374. revLookup[b64.charCodeAt(i + 3)]
  2375. arr[curByte++] = (tmp >> 16) & 0xFF
  2376. arr[curByte++] = (tmp >> 8) & 0xFF
  2377. arr[curByte++] = tmp & 0xFF
  2378. }
  2379. if (placeHoldersLen === 2) {
  2380. tmp =
  2381. (revLookup[b64.charCodeAt(i)] << 2) |
  2382. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2383. arr[curByte++] = tmp & 0xFF
  2384. }
  2385. if (placeHoldersLen === 1) {
  2386. tmp =
  2387. (revLookup[b64.charCodeAt(i)] << 10) |
  2388. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2389. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2390. arr[curByte++] = (tmp >> 8) & 0xFF
  2391. arr[curByte++] = tmp & 0xFF
  2392. }
  2393. return arr
  2394. }
  2395. function tripletToBase64 (num) {
  2396. return lookup[num >> 18 & 0x3F] +
  2397. lookup[num >> 12 & 0x3F] +
  2398. lookup[num >> 6 & 0x3F] +
  2399. lookup[num & 0x3F]
  2400. }
  2401. function encodeChunk (uint8, start, end) {
  2402. var tmp
  2403. var output = []
  2404. for (var i = start; i < end; i += 3) {
  2405. tmp =
  2406. ((uint8[i] << 16) & 0xFF0000) +
  2407. ((uint8[i + 1] << 8) & 0xFF00) +
  2408. (uint8[i + 2] & 0xFF)
  2409. output.push(tripletToBase64(tmp))
  2410. }
  2411. return output.join('')
  2412. }
  2413. function fromByteArray (uint8) {
  2414. var tmp
  2415. var len = uint8.length
  2416. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2417. var parts = []
  2418. var maxChunkLength = 16383 // must be multiple of 3
  2419. // go through the array every three bytes, we'll deal with trailing stuff later
  2420. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2421. parts.push(encodeChunk(
  2422. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2423. ))
  2424. }
  2425. // pad the end with zeros, but make sure to not forget the extra bytes
  2426. if (extraBytes === 1) {
  2427. tmp = uint8[len - 1]
  2428. parts.push(
  2429. lookup[tmp >> 2] +
  2430. lookup[(tmp << 4) & 0x3F] +
  2431. '=='
  2432. )
  2433. } else if (extraBytes === 2) {
  2434. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2435. parts.push(
  2436. lookup[tmp >> 10] +
  2437. lookup[(tmp >> 4) & 0x3F] +
  2438. lookup[(tmp << 2) & 0x3F] +
  2439. '='
  2440. )
  2441. }
  2442. return parts.join('')
  2443. }
  2444. /***/ }),
  2445. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2446. /*!*****************************************************!*\
  2447. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2448. \*****************************************************/
  2449. /*! no static exports found */
  2450. /***/ (function(module, exports, __webpack_require__) {
  2451. /*!
  2452. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2453. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2454. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2455. */
  2456. (function (global, factory) {
  2457. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2458. undefined;
  2459. }(this, (function (exports, $, Popper) { 'use strict';
  2460. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2461. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2462. function _defineProperties(target, props) {
  2463. for (var i = 0; i < props.length; i++) {
  2464. var descriptor = props[i];
  2465. descriptor.enumerable = descriptor.enumerable || false;
  2466. descriptor.configurable = true;
  2467. if ("value" in descriptor) descriptor.writable = true;
  2468. Object.defineProperty(target, descriptor.key, descriptor);
  2469. }
  2470. }
  2471. function _createClass(Constructor, protoProps, staticProps) {
  2472. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2473. if (staticProps) _defineProperties(Constructor, staticProps);
  2474. return Constructor;
  2475. }
  2476. function _defineProperty(obj, key, value) {
  2477. if (key in obj) {
  2478. Object.defineProperty(obj, key, {
  2479. value: value,
  2480. enumerable: true,
  2481. configurable: true,
  2482. writable: true
  2483. });
  2484. } else {
  2485. obj[key] = value;
  2486. }
  2487. return obj;
  2488. }
  2489. function ownKeys(object, enumerableOnly) {
  2490. var keys = Object.keys(object);
  2491. if (Object.getOwnPropertySymbols) {
  2492. var symbols = Object.getOwnPropertySymbols(object);
  2493. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2494. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2495. });
  2496. keys.push.apply(keys, symbols);
  2497. }
  2498. return keys;
  2499. }
  2500. function _objectSpread2(target) {
  2501. for (var i = 1; i < arguments.length; i++) {
  2502. var source = arguments[i] != null ? arguments[i] : {};
  2503. if (i % 2) {
  2504. ownKeys(Object(source), true).forEach(function (key) {
  2505. _defineProperty(target, key, source[key]);
  2506. });
  2507. } else if (Object.getOwnPropertyDescriptors) {
  2508. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2509. } else {
  2510. ownKeys(Object(source)).forEach(function (key) {
  2511. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2512. });
  2513. }
  2514. }
  2515. return target;
  2516. }
  2517. function _inheritsLoose(subClass, superClass) {
  2518. subClass.prototype = Object.create(superClass.prototype);
  2519. subClass.prototype.constructor = subClass;
  2520. subClass.__proto__ = superClass;
  2521. }
  2522. /**
  2523. * --------------------------------------------------------------------------
  2524. * Bootstrap (v4.4.1): util.js
  2525. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2526. * --------------------------------------------------------------------------
  2527. */
  2528. /**
  2529. * ------------------------------------------------------------------------
  2530. * Private TransitionEnd Helpers
  2531. * ------------------------------------------------------------------------
  2532. */
  2533. var TRANSITION_END = 'transitionend';
  2534. var MAX_UID = 1000000;
  2535. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2536. function toType(obj) {
  2537. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2538. }
  2539. function getSpecialTransitionEndEvent() {
  2540. return {
  2541. bindType: TRANSITION_END,
  2542. delegateType: TRANSITION_END,
  2543. handle: function handle(event) {
  2544. if ($(event.target).is(this)) {
  2545. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2546. }
  2547. return undefined; // eslint-disable-line no-undefined
  2548. }
  2549. };
  2550. }
  2551. function transitionEndEmulator(duration) {
  2552. var _this = this;
  2553. var called = false;
  2554. $(this).one(Util.TRANSITION_END, function () {
  2555. called = true;
  2556. });
  2557. setTimeout(function () {
  2558. if (!called) {
  2559. Util.triggerTransitionEnd(_this);
  2560. }
  2561. }, duration);
  2562. return this;
  2563. }
  2564. function setTransitionEndSupport() {
  2565. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2566. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2567. }
  2568. /**
  2569. * --------------------------------------------------------------------------
  2570. * Public Util Api
  2571. * --------------------------------------------------------------------------
  2572. */
  2573. var Util = {
  2574. TRANSITION_END: 'bsTransitionEnd',
  2575. getUID: function getUID(prefix) {
  2576. do {
  2577. // eslint-disable-next-line no-bitwise
  2578. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2579. } while (document.getElementById(prefix));
  2580. return prefix;
  2581. },
  2582. getSelectorFromElement: function getSelectorFromElement(element) {
  2583. var selector = element.getAttribute('data-target');
  2584. if (!selector || selector === '#') {
  2585. var hrefAttr = element.getAttribute('href');
  2586. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2587. }
  2588. try {
  2589. return document.querySelector(selector) ? selector : null;
  2590. } catch (err) {
  2591. return null;
  2592. }
  2593. },
  2594. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2595. if (!element) {
  2596. return 0;
  2597. } // Get transition-duration of the element
  2598. var transitionDuration = $(element).css('transition-duration');
  2599. var transitionDelay = $(element).css('transition-delay');
  2600. var floatTransitionDuration = parseFloat(transitionDuration);
  2601. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2602. if (!floatTransitionDuration && !floatTransitionDelay) {
  2603. return 0;
  2604. } // If multiple durations are defined, take the first
  2605. transitionDuration = transitionDuration.split(',')[0];
  2606. transitionDelay = transitionDelay.split(',')[0];
  2607. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2608. },
  2609. reflow: function reflow(element) {
  2610. return element.offsetHeight;
  2611. },
  2612. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2613. $(element).trigger(TRANSITION_END);
  2614. },
  2615. // TODO: Remove in v5
  2616. supportsTransitionEnd: function supportsTransitionEnd() {
  2617. return Boolean(TRANSITION_END);
  2618. },
  2619. isElement: function isElement(obj) {
  2620. return (obj[0] || obj).nodeType;
  2621. },
  2622. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2623. for (var property in configTypes) {
  2624. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2625. var expectedTypes = configTypes[property];
  2626. var value = config[property];
  2627. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2628. if (!new RegExp(expectedTypes).test(valueType)) {
  2629. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2630. }
  2631. }
  2632. }
  2633. },
  2634. findShadowRoot: function findShadowRoot(element) {
  2635. if (!document.documentElement.attachShadow) {
  2636. return null;
  2637. } // Can find the shadow root otherwise it'll return the document
  2638. if (typeof element.getRootNode === 'function') {
  2639. var root = element.getRootNode();
  2640. return root instanceof ShadowRoot ? root : null;
  2641. }
  2642. if (element instanceof ShadowRoot) {
  2643. return element;
  2644. } // when we don't find a shadow root
  2645. if (!element.parentNode) {
  2646. return null;
  2647. }
  2648. return Util.findShadowRoot(element.parentNode);
  2649. },
  2650. jQueryDetection: function jQueryDetection() {
  2651. if (typeof $ === 'undefined') {
  2652. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2653. }
  2654. var version = $.fn.jquery.split(' ')[0].split('.');
  2655. var minMajor = 1;
  2656. var ltMajor = 2;
  2657. var minMinor = 9;
  2658. var minPatch = 1;
  2659. var maxMajor = 4;
  2660. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2661. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2662. }
  2663. }
  2664. };
  2665. Util.jQueryDetection();
  2666. setTransitionEndSupport();
  2667. /**
  2668. * ------------------------------------------------------------------------
  2669. * Constants
  2670. * ------------------------------------------------------------------------
  2671. */
  2672. var NAME = 'alert';
  2673. var VERSION = '4.4.1';
  2674. var DATA_KEY = 'bs.alert';
  2675. var EVENT_KEY = "." + DATA_KEY;
  2676. var DATA_API_KEY = '.data-api';
  2677. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2678. var Selector = {
  2679. DISMISS: '[data-dismiss="alert"]'
  2680. };
  2681. var Event = {
  2682. CLOSE: "close" + EVENT_KEY,
  2683. CLOSED: "closed" + EVENT_KEY,
  2684. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2685. };
  2686. var ClassName = {
  2687. ALERT: 'alert',
  2688. FADE: 'fade',
  2689. SHOW: 'show'
  2690. };
  2691. /**
  2692. * ------------------------------------------------------------------------
  2693. * Class Definition
  2694. * ------------------------------------------------------------------------
  2695. */
  2696. var Alert =
  2697. /*#__PURE__*/
  2698. function () {
  2699. function Alert(element) {
  2700. this._element = element;
  2701. } // Getters
  2702. var _proto = Alert.prototype;
  2703. // Public
  2704. _proto.close = function close(element) {
  2705. var rootElement = this._element;
  2706. if (element) {
  2707. rootElement = this._getRootElement(element);
  2708. }
  2709. var customEvent = this._triggerCloseEvent(rootElement);
  2710. if (customEvent.isDefaultPrevented()) {
  2711. return;
  2712. }
  2713. this._removeElement(rootElement);
  2714. };
  2715. _proto.dispose = function dispose() {
  2716. $.removeData(this._element, DATA_KEY);
  2717. this._element = null;
  2718. } // Private
  2719. ;
  2720. _proto._getRootElement = function _getRootElement(element) {
  2721. var selector = Util.getSelectorFromElement(element);
  2722. var parent = false;
  2723. if (selector) {
  2724. parent = document.querySelector(selector);
  2725. }
  2726. if (!parent) {
  2727. parent = $(element).closest("." + ClassName.ALERT)[0];
  2728. }
  2729. return parent;
  2730. };
  2731. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2732. var closeEvent = $.Event(Event.CLOSE);
  2733. $(element).trigger(closeEvent);
  2734. return closeEvent;
  2735. };
  2736. _proto._removeElement = function _removeElement(element) {
  2737. var _this = this;
  2738. $(element).removeClass(ClassName.SHOW);
  2739. if (!$(element).hasClass(ClassName.FADE)) {
  2740. this._destroyElement(element);
  2741. return;
  2742. }
  2743. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2744. $(element).one(Util.TRANSITION_END, function (event) {
  2745. return _this._destroyElement(element, event);
  2746. }).emulateTransitionEnd(transitionDuration);
  2747. };
  2748. _proto._destroyElement = function _destroyElement(element) {
  2749. $(element).detach().trigger(Event.CLOSED).remove();
  2750. } // Static
  2751. ;
  2752. Alert._jQueryInterface = function _jQueryInterface(config) {
  2753. return this.each(function () {
  2754. var $element = $(this);
  2755. var data = $element.data(DATA_KEY);
  2756. if (!data) {
  2757. data = new Alert(this);
  2758. $element.data(DATA_KEY, data);
  2759. }
  2760. if (config === 'close') {
  2761. data[config](this);
  2762. }
  2763. });
  2764. };
  2765. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2766. return function (event) {
  2767. if (event) {
  2768. event.preventDefault();
  2769. }
  2770. alertInstance.close(this);
  2771. };
  2772. };
  2773. _createClass(Alert, null, [{
  2774. key: "VERSION",
  2775. get: function get() {
  2776. return VERSION;
  2777. }
  2778. }]);
  2779. return Alert;
  2780. }();
  2781. /**
  2782. * ------------------------------------------------------------------------
  2783. * Data Api implementation
  2784. * ------------------------------------------------------------------------
  2785. */
  2786. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2787. /**
  2788. * ------------------------------------------------------------------------
  2789. * jQuery
  2790. * ------------------------------------------------------------------------
  2791. */
  2792. $.fn[NAME] = Alert._jQueryInterface;
  2793. $.fn[NAME].Constructor = Alert;
  2794. $.fn[NAME].noConflict = function () {
  2795. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2796. return Alert._jQueryInterface;
  2797. };
  2798. /**
  2799. * ------------------------------------------------------------------------
  2800. * Constants
  2801. * ------------------------------------------------------------------------
  2802. */
  2803. var NAME$1 = 'button';
  2804. var VERSION$1 = '4.4.1';
  2805. var DATA_KEY$1 = 'bs.button';
  2806. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2807. var DATA_API_KEY$1 = '.data-api';
  2808. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2809. var ClassName$1 = {
  2810. ACTIVE: 'active',
  2811. BUTTON: 'btn',
  2812. FOCUS: 'focus'
  2813. };
  2814. var Selector$1 = {
  2815. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2816. DATA_TOGGLES: '[data-toggle="buttons"]',
  2817. DATA_TOGGLE: '[data-toggle="button"]',
  2818. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2819. INPUT: 'input:not([type="hidden"])',
  2820. ACTIVE: '.active',
  2821. BUTTON: '.btn'
  2822. };
  2823. var Event$1 = {
  2824. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2825. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2826. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2827. };
  2828. /**
  2829. * ------------------------------------------------------------------------
  2830. * Class Definition
  2831. * ------------------------------------------------------------------------
  2832. */
  2833. var Button =
  2834. /*#__PURE__*/
  2835. function () {
  2836. function Button(element) {
  2837. this._element = element;
  2838. } // Getters
  2839. var _proto = Button.prototype;
  2840. // Public
  2841. _proto.toggle = function toggle() {
  2842. var triggerChangeEvent = true;
  2843. var addAriaPressed = true;
  2844. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2845. if (rootElement) {
  2846. var input = this._element.querySelector(Selector$1.INPUT);
  2847. if (input) {
  2848. if (input.type === 'radio') {
  2849. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2850. triggerChangeEvent = false;
  2851. } else {
  2852. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2853. if (activeElement) {
  2854. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2855. }
  2856. }
  2857. } else if (input.type === 'checkbox') {
  2858. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2859. triggerChangeEvent = false;
  2860. }
  2861. } else {
  2862. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2863. triggerChangeEvent = false;
  2864. }
  2865. if (triggerChangeEvent) {
  2866. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2867. $(input).trigger('change');
  2868. }
  2869. input.focus();
  2870. addAriaPressed = false;
  2871. }
  2872. }
  2873. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2874. if (addAriaPressed) {
  2875. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2876. }
  2877. if (triggerChangeEvent) {
  2878. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2879. }
  2880. }
  2881. };
  2882. _proto.dispose = function dispose() {
  2883. $.removeData(this._element, DATA_KEY$1);
  2884. this._element = null;
  2885. } // Static
  2886. ;
  2887. Button._jQueryInterface = function _jQueryInterface(config) {
  2888. return this.each(function () {
  2889. var data = $(this).data(DATA_KEY$1);
  2890. if (!data) {
  2891. data = new Button(this);
  2892. $(this).data(DATA_KEY$1, data);
  2893. }
  2894. if (config === 'toggle') {
  2895. data[config]();
  2896. }
  2897. });
  2898. };
  2899. _createClass(Button, null, [{
  2900. key: "VERSION",
  2901. get: function get() {
  2902. return VERSION$1;
  2903. }
  2904. }]);
  2905. return Button;
  2906. }();
  2907. /**
  2908. * ------------------------------------------------------------------------
  2909. * Data Api implementation
  2910. * ------------------------------------------------------------------------
  2911. */
  2912. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2913. var button = event.target;
  2914. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  2915. button = $(button).closest(Selector$1.BUTTON)[0];
  2916. }
  2917. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  2918. event.preventDefault(); // work around Firefox bug #1540995
  2919. } else {
  2920. var inputBtn = button.querySelector(Selector$1.INPUT);
  2921. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  2922. event.preventDefault(); // work around Firefox bug #1540995
  2923. return;
  2924. }
  2925. Button._jQueryInterface.call($(button), 'toggle');
  2926. }
  2927. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  2928. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  2929. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  2930. });
  2931. $(window).on(Event$1.LOAD_DATA_API, function () {
  2932. // ensure correct active class is set to match the controls' actual values/states
  2933. // find all checkboxes/readio buttons inside data-toggle groups
  2934. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  2935. for (var i = 0, len = buttons.length; i < len; i++) {
  2936. var button = buttons[i];
  2937. var input = button.querySelector(Selector$1.INPUT);
  2938. if (input.checked || input.hasAttribute('checked')) {
  2939. button.classList.add(ClassName$1.ACTIVE);
  2940. } else {
  2941. button.classList.remove(ClassName$1.ACTIVE);
  2942. }
  2943. } // find all button toggles
  2944. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  2945. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  2946. var _button = buttons[_i];
  2947. if (_button.getAttribute('aria-pressed') === 'true') {
  2948. _button.classList.add(ClassName$1.ACTIVE);
  2949. } else {
  2950. _button.classList.remove(ClassName$1.ACTIVE);
  2951. }
  2952. }
  2953. });
  2954. /**
  2955. * ------------------------------------------------------------------------
  2956. * jQuery
  2957. * ------------------------------------------------------------------------
  2958. */
  2959. $.fn[NAME$1] = Button._jQueryInterface;
  2960. $.fn[NAME$1].Constructor = Button;
  2961. $.fn[NAME$1].noConflict = function () {
  2962. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  2963. return Button._jQueryInterface;
  2964. };
  2965. /**
  2966. * ------------------------------------------------------------------------
  2967. * Constants
  2968. * ------------------------------------------------------------------------
  2969. */
  2970. var NAME$2 = 'carousel';
  2971. var VERSION$2 = '4.4.1';
  2972. var DATA_KEY$2 = 'bs.carousel';
  2973. var EVENT_KEY$2 = "." + DATA_KEY$2;
  2974. var DATA_API_KEY$2 = '.data-api';
  2975. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  2976. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  2977. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  2978. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  2979. var SWIPE_THRESHOLD = 40;
  2980. var Default = {
  2981. interval: 5000,
  2982. keyboard: true,
  2983. slide: false,
  2984. pause: 'hover',
  2985. wrap: true,
  2986. touch: true
  2987. };
  2988. var DefaultType = {
  2989. interval: '(number|boolean)',
  2990. keyboard: 'boolean',
  2991. slide: '(boolean|string)',
  2992. pause: '(string|boolean)',
  2993. wrap: 'boolean',
  2994. touch: 'boolean'
  2995. };
  2996. var Direction = {
  2997. NEXT: 'next',
  2998. PREV: 'prev',
  2999. LEFT: 'left',
  3000. RIGHT: 'right'
  3001. };
  3002. var Event$2 = {
  3003. SLIDE: "slide" + EVENT_KEY$2,
  3004. SLID: "slid" + EVENT_KEY$2,
  3005. KEYDOWN: "keydown" + EVENT_KEY$2,
  3006. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3007. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3008. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3009. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3010. TOUCHEND: "touchend" + EVENT_KEY$2,
  3011. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3012. POINTERUP: "pointerup" + EVENT_KEY$2,
  3013. DRAG_START: "dragstart" + EVENT_KEY$2,
  3014. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3015. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3016. };
  3017. var ClassName$2 = {
  3018. CAROUSEL: 'carousel',
  3019. ACTIVE: 'active',
  3020. SLIDE: 'slide',
  3021. RIGHT: 'carousel-item-right',
  3022. LEFT: 'carousel-item-left',
  3023. NEXT: 'carousel-item-next',
  3024. PREV: 'carousel-item-prev',
  3025. ITEM: 'carousel-item',
  3026. POINTER_EVENT: 'pointer-event'
  3027. };
  3028. var Selector$2 = {
  3029. ACTIVE: '.active',
  3030. ACTIVE_ITEM: '.active.carousel-item',
  3031. ITEM: '.carousel-item',
  3032. ITEM_IMG: '.carousel-item img',
  3033. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3034. INDICATORS: '.carousel-indicators',
  3035. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3036. DATA_RIDE: '[data-ride="carousel"]'
  3037. };
  3038. var PointerType = {
  3039. TOUCH: 'touch',
  3040. PEN: 'pen'
  3041. };
  3042. /**
  3043. * ------------------------------------------------------------------------
  3044. * Class Definition
  3045. * ------------------------------------------------------------------------
  3046. */
  3047. var Carousel =
  3048. /*#__PURE__*/
  3049. function () {
  3050. function Carousel(element, config) {
  3051. this._items = null;
  3052. this._interval = null;
  3053. this._activeElement = null;
  3054. this._isPaused = false;
  3055. this._isSliding = false;
  3056. this.touchTimeout = null;
  3057. this.touchStartX = 0;
  3058. this.touchDeltaX = 0;
  3059. this._config = this._getConfig(config);
  3060. this._element = element;
  3061. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3062. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3063. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3064. this._addEventListeners();
  3065. } // Getters
  3066. var _proto = Carousel.prototype;
  3067. // Public
  3068. _proto.next = function next() {
  3069. if (!this._isSliding) {
  3070. this._slide(Direction.NEXT);
  3071. }
  3072. };
  3073. _proto.nextWhenVisible = function nextWhenVisible() {
  3074. // Don't call next when the page isn't visible
  3075. // or the carousel or its parent isn't visible
  3076. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3077. this.next();
  3078. }
  3079. };
  3080. _proto.prev = function prev() {
  3081. if (!this._isSliding) {
  3082. this._slide(Direction.PREV);
  3083. }
  3084. };
  3085. _proto.pause = function pause(event) {
  3086. if (!event) {
  3087. this._isPaused = true;
  3088. }
  3089. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3090. Util.triggerTransitionEnd(this._element);
  3091. this.cycle(true);
  3092. }
  3093. clearInterval(this._interval);
  3094. this._interval = null;
  3095. };
  3096. _proto.cycle = function cycle(event) {
  3097. if (!event) {
  3098. this._isPaused = false;
  3099. }
  3100. if (this._interval) {
  3101. clearInterval(this._interval);
  3102. this._interval = null;
  3103. }
  3104. if (this._config.interval && !this._isPaused) {
  3105. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3106. }
  3107. };
  3108. _proto.to = function to(index) {
  3109. var _this = this;
  3110. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3111. var activeIndex = this._getItemIndex(this._activeElement);
  3112. if (index > this._items.length - 1 || index < 0) {
  3113. return;
  3114. }
  3115. if (this._isSliding) {
  3116. $(this._element).one(Event$2.SLID, function () {
  3117. return _this.to(index);
  3118. });
  3119. return;
  3120. }
  3121. if (activeIndex === index) {
  3122. this.pause();
  3123. this.cycle();
  3124. return;
  3125. }
  3126. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3127. this._slide(direction, this._items[index]);
  3128. };
  3129. _proto.dispose = function dispose() {
  3130. $(this._element).off(EVENT_KEY$2);
  3131. $.removeData(this._element, DATA_KEY$2);
  3132. this._items = null;
  3133. this._config = null;
  3134. this._element = null;
  3135. this._interval = null;
  3136. this._isPaused = null;
  3137. this._isSliding = null;
  3138. this._activeElement = null;
  3139. this._indicatorsElement = null;
  3140. } // Private
  3141. ;
  3142. _proto._getConfig = function _getConfig(config) {
  3143. config = _objectSpread2({}, Default, {}, config);
  3144. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3145. return config;
  3146. };
  3147. _proto._handleSwipe = function _handleSwipe() {
  3148. var absDeltax = Math.abs(this.touchDeltaX);
  3149. if (absDeltax <= SWIPE_THRESHOLD) {
  3150. return;
  3151. }
  3152. var direction = absDeltax / this.touchDeltaX;
  3153. this.touchDeltaX = 0; // swipe left
  3154. if (direction > 0) {
  3155. this.prev();
  3156. } // swipe right
  3157. if (direction < 0) {
  3158. this.next();
  3159. }
  3160. };
  3161. _proto._addEventListeners = function _addEventListeners() {
  3162. var _this2 = this;
  3163. if (this._config.keyboard) {
  3164. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3165. return _this2._keydown(event);
  3166. });
  3167. }
  3168. if (this._config.pause === 'hover') {
  3169. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3170. return _this2.pause(event);
  3171. }).on(Event$2.MOUSELEAVE, function (event) {
  3172. return _this2.cycle(event);
  3173. });
  3174. }
  3175. if (this._config.touch) {
  3176. this._addTouchEventListeners();
  3177. }
  3178. };
  3179. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3180. var _this3 = this;
  3181. if (!this._touchSupported) {
  3182. return;
  3183. }
  3184. var start = function start(event) {
  3185. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3186. _this3.touchStartX = event.originalEvent.clientX;
  3187. } else if (!_this3._pointerEvent) {
  3188. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3189. }
  3190. };
  3191. var move = function move(event) {
  3192. // ensure swiping with one touch and not pinching
  3193. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3194. _this3.touchDeltaX = 0;
  3195. } else {
  3196. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3197. }
  3198. };
  3199. var end = function end(event) {
  3200. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3201. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3202. }
  3203. _this3._handleSwipe();
  3204. if (_this3._config.pause === 'hover') {
  3205. // If it's a touch-enabled device, mouseenter/leave are fired as
  3206. // part of the mouse compatibility events on first tap - the carousel
  3207. // would stop cycling until user tapped out of it;
  3208. // here, we listen for touchend, explicitly pause the carousel
  3209. // (as if it's the second time we tap on it, mouseenter compat event
  3210. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3211. // events to fire) we explicitly restart cycling
  3212. _this3.pause();
  3213. if (_this3.touchTimeout) {
  3214. clearTimeout(_this3.touchTimeout);
  3215. }
  3216. _this3.touchTimeout = setTimeout(function (event) {
  3217. return _this3.cycle(event);
  3218. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3219. }
  3220. };
  3221. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3222. return e.preventDefault();
  3223. });
  3224. if (this._pointerEvent) {
  3225. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3226. return start(event);
  3227. });
  3228. $(this._element).on(Event$2.POINTERUP, function (event) {
  3229. return end(event);
  3230. });
  3231. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3232. } else {
  3233. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3234. return start(event);
  3235. });
  3236. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3237. return move(event);
  3238. });
  3239. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3240. return end(event);
  3241. });
  3242. }
  3243. };
  3244. _proto._keydown = function _keydown(event) {
  3245. if (/input|textarea/i.test(event.target.tagName)) {
  3246. return;
  3247. }
  3248. switch (event.which) {
  3249. case ARROW_LEFT_KEYCODE:
  3250. event.preventDefault();
  3251. this.prev();
  3252. break;
  3253. case ARROW_RIGHT_KEYCODE:
  3254. event.preventDefault();
  3255. this.next();
  3256. break;
  3257. }
  3258. };
  3259. _proto._getItemIndex = function _getItemIndex(element) {
  3260. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3261. return this._items.indexOf(element);
  3262. };
  3263. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3264. var isNextDirection = direction === Direction.NEXT;
  3265. var isPrevDirection = direction === Direction.PREV;
  3266. var activeIndex = this._getItemIndex(activeElement);
  3267. var lastItemIndex = this._items.length - 1;
  3268. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3269. if (isGoingToWrap && !this._config.wrap) {
  3270. return activeElement;
  3271. }
  3272. var delta = direction === Direction.PREV ? -1 : 1;
  3273. var itemIndex = (activeIndex + delta) % this._items.length;
  3274. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3275. };
  3276. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3277. var targetIndex = this._getItemIndex(relatedTarget);
  3278. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3279. var slideEvent = $.Event(Event$2.SLIDE, {
  3280. relatedTarget: relatedTarget,
  3281. direction: eventDirectionName,
  3282. from: fromIndex,
  3283. to: targetIndex
  3284. });
  3285. $(this._element).trigger(slideEvent);
  3286. return slideEvent;
  3287. };
  3288. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3289. if (this._indicatorsElement) {
  3290. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3291. $(indicators).removeClass(ClassName$2.ACTIVE);
  3292. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3293. if (nextIndicator) {
  3294. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3295. }
  3296. }
  3297. };
  3298. _proto._slide = function _slide(direction, element) {
  3299. var _this4 = this;
  3300. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3301. var activeElementIndex = this._getItemIndex(activeElement);
  3302. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3303. var nextElementIndex = this._getItemIndex(nextElement);
  3304. var isCycling = Boolean(this._interval);
  3305. var directionalClassName;
  3306. var orderClassName;
  3307. var eventDirectionName;
  3308. if (direction === Direction.NEXT) {
  3309. directionalClassName = ClassName$2.LEFT;
  3310. orderClassName = ClassName$2.NEXT;
  3311. eventDirectionName = Direction.LEFT;
  3312. } else {
  3313. directionalClassName = ClassName$2.RIGHT;
  3314. orderClassName = ClassName$2.PREV;
  3315. eventDirectionName = Direction.RIGHT;
  3316. }
  3317. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3318. this._isSliding = false;
  3319. return;
  3320. }
  3321. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3322. if (slideEvent.isDefaultPrevented()) {
  3323. return;
  3324. }
  3325. if (!activeElement || !nextElement) {
  3326. // Some weirdness is happening, so we bail
  3327. return;
  3328. }
  3329. this._isSliding = true;
  3330. if (isCycling) {
  3331. this.pause();
  3332. }
  3333. this._setActiveIndicatorElement(nextElement);
  3334. var slidEvent = $.Event(Event$2.SLID, {
  3335. relatedTarget: nextElement,
  3336. direction: eventDirectionName,
  3337. from: activeElementIndex,
  3338. to: nextElementIndex
  3339. });
  3340. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3341. $(nextElement).addClass(orderClassName);
  3342. Util.reflow(nextElement);
  3343. $(activeElement).addClass(directionalClassName);
  3344. $(nextElement).addClass(directionalClassName);
  3345. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3346. if (nextElementInterval) {
  3347. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3348. this._config.interval = nextElementInterval;
  3349. } else {
  3350. this._config.interval = this._config.defaultInterval || this._config.interval;
  3351. }
  3352. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3353. $(activeElement).one(Util.TRANSITION_END, function () {
  3354. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3355. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3356. _this4._isSliding = false;
  3357. setTimeout(function () {
  3358. return $(_this4._element).trigger(slidEvent);
  3359. }, 0);
  3360. }).emulateTransitionEnd(transitionDuration);
  3361. } else {
  3362. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3363. $(nextElement).addClass(ClassName$2.ACTIVE);
  3364. this._isSliding = false;
  3365. $(this._element).trigger(slidEvent);
  3366. }
  3367. if (isCycling) {
  3368. this.cycle();
  3369. }
  3370. } // Static
  3371. ;
  3372. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3373. return this.each(function () {
  3374. var data = $(this).data(DATA_KEY$2);
  3375. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3376. if (typeof config === 'object') {
  3377. _config = _objectSpread2({}, _config, {}, config);
  3378. }
  3379. var action = typeof config === 'string' ? config : _config.slide;
  3380. if (!data) {
  3381. data = new Carousel(this, _config);
  3382. $(this).data(DATA_KEY$2, data);
  3383. }
  3384. if (typeof config === 'number') {
  3385. data.to(config);
  3386. } else if (typeof action === 'string') {
  3387. if (typeof data[action] === 'undefined') {
  3388. throw new TypeError("No method named \"" + action + "\"");
  3389. }
  3390. data[action]();
  3391. } else if (_config.interval && _config.ride) {
  3392. data.pause();
  3393. data.cycle();
  3394. }
  3395. });
  3396. };
  3397. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3398. var selector = Util.getSelectorFromElement(this);
  3399. if (!selector) {
  3400. return;
  3401. }
  3402. var target = $(selector)[0];
  3403. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3404. return;
  3405. }
  3406. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3407. var slideIndex = this.getAttribute('data-slide-to');
  3408. if (slideIndex) {
  3409. config.interval = false;
  3410. }
  3411. Carousel._jQueryInterface.call($(target), config);
  3412. if (slideIndex) {
  3413. $(target).data(DATA_KEY$2).to(slideIndex);
  3414. }
  3415. event.preventDefault();
  3416. };
  3417. _createClass(Carousel, null, [{
  3418. key: "VERSION",
  3419. get: function get() {
  3420. return VERSION$2;
  3421. }
  3422. }, {
  3423. key: "Default",
  3424. get: function get() {
  3425. return Default;
  3426. }
  3427. }]);
  3428. return Carousel;
  3429. }();
  3430. /**
  3431. * ------------------------------------------------------------------------
  3432. * Data Api implementation
  3433. * ------------------------------------------------------------------------
  3434. */
  3435. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3436. $(window).on(Event$2.LOAD_DATA_API, function () {
  3437. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3438. for (var i = 0, len = carousels.length; i < len; i++) {
  3439. var $carousel = $(carousels[i]);
  3440. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3441. }
  3442. });
  3443. /**
  3444. * ------------------------------------------------------------------------
  3445. * jQuery
  3446. * ------------------------------------------------------------------------
  3447. */
  3448. $.fn[NAME$2] = Carousel._jQueryInterface;
  3449. $.fn[NAME$2].Constructor = Carousel;
  3450. $.fn[NAME$2].noConflict = function () {
  3451. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3452. return Carousel._jQueryInterface;
  3453. };
  3454. /**
  3455. * ------------------------------------------------------------------------
  3456. * Constants
  3457. * ------------------------------------------------------------------------
  3458. */
  3459. var NAME$3 = 'collapse';
  3460. var VERSION$3 = '4.4.1';
  3461. var DATA_KEY$3 = 'bs.collapse';
  3462. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3463. var DATA_API_KEY$3 = '.data-api';
  3464. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3465. var Default$1 = {
  3466. toggle: true,
  3467. parent: ''
  3468. };
  3469. var DefaultType$1 = {
  3470. toggle: 'boolean',
  3471. parent: '(string|element)'
  3472. };
  3473. var Event$3 = {
  3474. SHOW: "show" + EVENT_KEY$3,
  3475. SHOWN: "shown" + EVENT_KEY$3,
  3476. HIDE: "hide" + EVENT_KEY$3,
  3477. HIDDEN: "hidden" + EVENT_KEY$3,
  3478. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3479. };
  3480. var ClassName$3 = {
  3481. SHOW: 'show',
  3482. COLLAPSE: 'collapse',
  3483. COLLAPSING: 'collapsing',
  3484. COLLAPSED: 'collapsed'
  3485. };
  3486. var Dimension = {
  3487. WIDTH: 'width',
  3488. HEIGHT: 'height'
  3489. };
  3490. var Selector$3 = {
  3491. ACTIVES: '.show, .collapsing',
  3492. DATA_TOGGLE: '[data-toggle="collapse"]'
  3493. };
  3494. /**
  3495. * ------------------------------------------------------------------------
  3496. * Class Definition
  3497. * ------------------------------------------------------------------------
  3498. */
  3499. var Collapse =
  3500. /*#__PURE__*/
  3501. function () {
  3502. function Collapse(element, config) {
  3503. this._isTransitioning = false;
  3504. this._element = element;
  3505. this._config = this._getConfig(config);
  3506. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3507. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3508. for (var i = 0, len = toggleList.length; i < len; i++) {
  3509. var elem = toggleList[i];
  3510. var selector = Util.getSelectorFromElement(elem);
  3511. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3512. return foundElem === element;
  3513. });
  3514. if (selector !== null && filterElement.length > 0) {
  3515. this._selector = selector;
  3516. this._triggerArray.push(elem);
  3517. }
  3518. }
  3519. this._parent = this._config.parent ? this._getParent() : null;
  3520. if (!this._config.parent) {
  3521. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3522. }
  3523. if (this._config.toggle) {
  3524. this.toggle();
  3525. }
  3526. } // Getters
  3527. var _proto = Collapse.prototype;
  3528. // Public
  3529. _proto.toggle = function toggle() {
  3530. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3531. this.hide();
  3532. } else {
  3533. this.show();
  3534. }
  3535. };
  3536. _proto.show = function show() {
  3537. var _this = this;
  3538. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3539. return;
  3540. }
  3541. var actives;
  3542. var activesData;
  3543. if (this._parent) {
  3544. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3545. if (typeof _this._config.parent === 'string') {
  3546. return elem.getAttribute('data-parent') === _this._config.parent;
  3547. }
  3548. return elem.classList.contains(ClassName$3.COLLAPSE);
  3549. });
  3550. if (actives.length === 0) {
  3551. actives = null;
  3552. }
  3553. }
  3554. if (actives) {
  3555. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3556. if (activesData && activesData._isTransitioning) {
  3557. return;
  3558. }
  3559. }
  3560. var startEvent = $.Event(Event$3.SHOW);
  3561. $(this._element).trigger(startEvent);
  3562. if (startEvent.isDefaultPrevented()) {
  3563. return;
  3564. }
  3565. if (actives) {
  3566. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3567. if (!activesData) {
  3568. $(actives).data(DATA_KEY$3, null);
  3569. }
  3570. }
  3571. var dimension = this._getDimension();
  3572. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3573. this._element.style[dimension] = 0;
  3574. if (this._triggerArray.length) {
  3575. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3576. }
  3577. this.setTransitioning(true);
  3578. var complete = function complete() {
  3579. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3580. _this._element.style[dimension] = '';
  3581. _this.setTransitioning(false);
  3582. $(_this._element).trigger(Event$3.SHOWN);
  3583. };
  3584. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3585. var scrollSize = "scroll" + capitalizedDimension;
  3586. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3587. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3588. this._element.style[dimension] = this._element[scrollSize] + "px";
  3589. };
  3590. _proto.hide = function hide() {
  3591. var _this2 = this;
  3592. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3593. return;
  3594. }
  3595. var startEvent = $.Event(Event$3.HIDE);
  3596. $(this._element).trigger(startEvent);
  3597. if (startEvent.isDefaultPrevented()) {
  3598. return;
  3599. }
  3600. var dimension = this._getDimension();
  3601. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3602. Util.reflow(this._element);
  3603. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3604. var triggerArrayLength = this._triggerArray.length;
  3605. if (triggerArrayLength > 0) {
  3606. for (var i = 0; i < triggerArrayLength; i++) {
  3607. var trigger = this._triggerArray[i];
  3608. var selector = Util.getSelectorFromElement(trigger);
  3609. if (selector !== null) {
  3610. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3611. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3612. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3613. }
  3614. }
  3615. }
  3616. }
  3617. this.setTransitioning(true);
  3618. var complete = function complete() {
  3619. _this2.setTransitioning(false);
  3620. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3621. };
  3622. this._element.style[dimension] = '';
  3623. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3624. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3625. };
  3626. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3627. this._isTransitioning = isTransitioning;
  3628. };
  3629. _proto.dispose = function dispose() {
  3630. $.removeData(this._element, DATA_KEY$3);
  3631. this._config = null;
  3632. this._parent = null;
  3633. this._element = null;
  3634. this._triggerArray = null;
  3635. this._isTransitioning = null;
  3636. } // Private
  3637. ;
  3638. _proto._getConfig = function _getConfig(config) {
  3639. config = _objectSpread2({}, Default$1, {}, config);
  3640. config.toggle = Boolean(config.toggle); // Coerce string values
  3641. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3642. return config;
  3643. };
  3644. _proto._getDimension = function _getDimension() {
  3645. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3646. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3647. };
  3648. _proto._getParent = function _getParent() {
  3649. var _this3 = this;
  3650. var parent;
  3651. if (Util.isElement(this._config.parent)) {
  3652. parent = this._config.parent; // It's a jQuery object
  3653. if (typeof this._config.parent.jquery !== 'undefined') {
  3654. parent = this._config.parent[0];
  3655. }
  3656. } else {
  3657. parent = document.querySelector(this._config.parent);
  3658. }
  3659. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3660. var children = [].slice.call(parent.querySelectorAll(selector));
  3661. $(children).each(function (i, element) {
  3662. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3663. });
  3664. return parent;
  3665. };
  3666. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3667. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3668. if (triggerArray.length) {
  3669. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3670. }
  3671. } // Static
  3672. ;
  3673. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3674. var selector = Util.getSelectorFromElement(element);
  3675. return selector ? document.querySelector(selector) : null;
  3676. };
  3677. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3678. return this.each(function () {
  3679. var $this = $(this);
  3680. var data = $this.data(DATA_KEY$3);
  3681. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3682. if (!data && _config.toggle && /show|hide/.test(config)) {
  3683. _config.toggle = false;
  3684. }
  3685. if (!data) {
  3686. data = new Collapse(this, _config);
  3687. $this.data(DATA_KEY$3, data);
  3688. }
  3689. if (typeof config === 'string') {
  3690. if (typeof data[config] === 'undefined') {
  3691. throw new TypeError("No method named \"" + config + "\"");
  3692. }
  3693. data[config]();
  3694. }
  3695. });
  3696. };
  3697. _createClass(Collapse, null, [{
  3698. key: "VERSION",
  3699. get: function get() {
  3700. return VERSION$3;
  3701. }
  3702. }, {
  3703. key: "Default",
  3704. get: function get() {
  3705. return Default$1;
  3706. }
  3707. }]);
  3708. return Collapse;
  3709. }();
  3710. /**
  3711. * ------------------------------------------------------------------------
  3712. * Data Api implementation
  3713. * ------------------------------------------------------------------------
  3714. */
  3715. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3716. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3717. if (event.currentTarget.tagName === 'A') {
  3718. event.preventDefault();
  3719. }
  3720. var $trigger = $(this);
  3721. var selector = Util.getSelectorFromElement(this);
  3722. var selectors = [].slice.call(document.querySelectorAll(selector));
  3723. $(selectors).each(function () {
  3724. var $target = $(this);
  3725. var data = $target.data(DATA_KEY$3);
  3726. var config = data ? 'toggle' : $trigger.data();
  3727. Collapse._jQueryInterface.call($target, config);
  3728. });
  3729. });
  3730. /**
  3731. * ------------------------------------------------------------------------
  3732. * jQuery
  3733. * ------------------------------------------------------------------------
  3734. */
  3735. $.fn[NAME$3] = Collapse._jQueryInterface;
  3736. $.fn[NAME$3].Constructor = Collapse;
  3737. $.fn[NAME$3].noConflict = function () {
  3738. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3739. return Collapse._jQueryInterface;
  3740. };
  3741. /**
  3742. * ------------------------------------------------------------------------
  3743. * Constants
  3744. * ------------------------------------------------------------------------
  3745. */
  3746. var NAME$4 = 'dropdown';
  3747. var VERSION$4 = '4.4.1';
  3748. var DATA_KEY$4 = 'bs.dropdown';
  3749. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3750. var DATA_API_KEY$4 = '.data-api';
  3751. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3752. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3753. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3754. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3755. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3756. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3757. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3758. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3759. var Event$4 = {
  3760. HIDE: "hide" + EVENT_KEY$4,
  3761. HIDDEN: "hidden" + EVENT_KEY$4,
  3762. SHOW: "show" + EVENT_KEY$4,
  3763. SHOWN: "shown" + EVENT_KEY$4,
  3764. CLICK: "click" + EVENT_KEY$4,
  3765. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3766. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3767. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3768. };
  3769. var ClassName$4 = {
  3770. DISABLED: 'disabled',
  3771. SHOW: 'show',
  3772. DROPUP: 'dropup',
  3773. DROPRIGHT: 'dropright',
  3774. DROPLEFT: 'dropleft',
  3775. MENURIGHT: 'dropdown-menu-right',
  3776. MENULEFT: 'dropdown-menu-left',
  3777. POSITION_STATIC: 'position-static'
  3778. };
  3779. var Selector$4 = {
  3780. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3781. FORM_CHILD: '.dropdown form',
  3782. MENU: '.dropdown-menu',
  3783. NAVBAR_NAV: '.navbar-nav',
  3784. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3785. };
  3786. var AttachmentMap = {
  3787. TOP: 'top-start',
  3788. TOPEND: 'top-end',
  3789. BOTTOM: 'bottom-start',
  3790. BOTTOMEND: 'bottom-end',
  3791. RIGHT: 'right-start',
  3792. RIGHTEND: 'right-end',
  3793. LEFT: 'left-start',
  3794. LEFTEND: 'left-end'
  3795. };
  3796. var Default$2 = {
  3797. offset: 0,
  3798. flip: true,
  3799. boundary: 'scrollParent',
  3800. reference: 'toggle',
  3801. display: 'dynamic',
  3802. popperConfig: null
  3803. };
  3804. var DefaultType$2 = {
  3805. offset: '(number|string|function)',
  3806. flip: 'boolean',
  3807. boundary: '(string|element)',
  3808. reference: '(string|element)',
  3809. display: 'string',
  3810. popperConfig: '(null|object)'
  3811. };
  3812. /**
  3813. * ------------------------------------------------------------------------
  3814. * Class Definition
  3815. * ------------------------------------------------------------------------
  3816. */
  3817. var Dropdown =
  3818. /*#__PURE__*/
  3819. function () {
  3820. function Dropdown(element, config) {
  3821. this._element = element;
  3822. this._popper = null;
  3823. this._config = this._getConfig(config);
  3824. this._menu = this._getMenuElement();
  3825. this._inNavbar = this._detectNavbar();
  3826. this._addEventListeners();
  3827. } // Getters
  3828. var _proto = Dropdown.prototype;
  3829. // Public
  3830. _proto.toggle = function toggle() {
  3831. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3832. return;
  3833. }
  3834. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3835. Dropdown._clearMenus();
  3836. if (isActive) {
  3837. return;
  3838. }
  3839. this.show(true);
  3840. };
  3841. _proto.show = function show(usePopper) {
  3842. if (usePopper === void 0) {
  3843. usePopper = false;
  3844. }
  3845. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3846. return;
  3847. }
  3848. var relatedTarget = {
  3849. relatedTarget: this._element
  3850. };
  3851. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3852. var parent = Dropdown._getParentFromElement(this._element);
  3853. $(parent).trigger(showEvent);
  3854. if (showEvent.isDefaultPrevented()) {
  3855. return;
  3856. } // Disable totally Popper.js for Dropdown in Navbar
  3857. if (!this._inNavbar && usePopper) {
  3858. /**
  3859. * Check for Popper dependency
  3860. * Popper - https://popper.js.org
  3861. */
  3862. if (typeof Popper === 'undefined') {
  3863. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3864. }
  3865. var referenceElement = this._element;
  3866. if (this._config.reference === 'parent') {
  3867. referenceElement = parent;
  3868. } else if (Util.isElement(this._config.reference)) {
  3869. referenceElement = this._config.reference; // Check if it's jQuery element
  3870. if (typeof this._config.reference.jquery !== 'undefined') {
  3871. referenceElement = this._config.reference[0];
  3872. }
  3873. } // If boundary is not `scrollParent`, then set position to `static`
  3874. // to allow the menu to "escape" the scroll parent's boundaries
  3875. // https://github.com/twbs/bootstrap/issues/24251
  3876. if (this._config.boundary !== 'scrollParent') {
  3877. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3878. }
  3879. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3880. } // If this is a touch-enabled device we add extra
  3881. // empty mouseover listeners to the body's immediate children;
  3882. // only needed because of broken event delegation on iOS
  3883. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3884. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3885. $(document.body).children().on('mouseover', null, $.noop);
  3886. }
  3887. this._element.focus();
  3888. this._element.setAttribute('aria-expanded', true);
  3889. $(this._menu).toggleClass(ClassName$4.SHOW);
  3890. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3891. };
  3892. _proto.hide = function hide() {
  3893. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3894. return;
  3895. }
  3896. var relatedTarget = {
  3897. relatedTarget: this._element
  3898. };
  3899. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3900. var parent = Dropdown._getParentFromElement(this._element);
  3901. $(parent).trigger(hideEvent);
  3902. if (hideEvent.isDefaultPrevented()) {
  3903. return;
  3904. }
  3905. if (this._popper) {
  3906. this._popper.destroy();
  3907. }
  3908. $(this._menu).toggleClass(ClassName$4.SHOW);
  3909. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  3910. };
  3911. _proto.dispose = function dispose() {
  3912. $.removeData(this._element, DATA_KEY$4);
  3913. $(this._element).off(EVENT_KEY$4);
  3914. this._element = null;
  3915. this._menu = null;
  3916. if (this._popper !== null) {
  3917. this._popper.destroy();
  3918. this._popper = null;
  3919. }
  3920. };
  3921. _proto.update = function update() {
  3922. this._inNavbar = this._detectNavbar();
  3923. if (this._popper !== null) {
  3924. this._popper.scheduleUpdate();
  3925. }
  3926. } // Private
  3927. ;
  3928. _proto._addEventListeners = function _addEventListeners() {
  3929. var _this = this;
  3930. $(this._element).on(Event$4.CLICK, function (event) {
  3931. event.preventDefault();
  3932. event.stopPropagation();
  3933. _this.toggle();
  3934. });
  3935. };
  3936. _proto._getConfig = function _getConfig(config) {
  3937. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  3938. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3939. return config;
  3940. };
  3941. _proto._getMenuElement = function _getMenuElement() {
  3942. if (!this._menu) {
  3943. var parent = Dropdown._getParentFromElement(this._element);
  3944. if (parent) {
  3945. this._menu = parent.querySelector(Selector$4.MENU);
  3946. }
  3947. }
  3948. return this._menu;
  3949. };
  3950. _proto._getPlacement = function _getPlacement() {
  3951. var $parentDropdown = $(this._element.parentNode);
  3952. var placement = AttachmentMap.BOTTOM; // Handle dropup
  3953. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  3954. placement = AttachmentMap.TOP;
  3955. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3956. placement = AttachmentMap.TOPEND;
  3957. }
  3958. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  3959. placement = AttachmentMap.RIGHT;
  3960. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  3961. placement = AttachmentMap.LEFT;
  3962. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  3963. placement = AttachmentMap.BOTTOMEND;
  3964. }
  3965. return placement;
  3966. };
  3967. _proto._detectNavbar = function _detectNavbar() {
  3968. return $(this._element).closest('.navbar').length > 0;
  3969. };
  3970. _proto._getOffset = function _getOffset() {
  3971. var _this2 = this;
  3972. var offset = {};
  3973. if (typeof this._config.offset === 'function') {
  3974. offset.fn = function (data) {
  3975. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  3976. return data;
  3977. };
  3978. } else {
  3979. offset.offset = this._config.offset;
  3980. }
  3981. return offset;
  3982. };
  3983. _proto._getPopperConfig = function _getPopperConfig() {
  3984. var popperConfig = {
  3985. placement: this._getPlacement(),
  3986. modifiers: {
  3987. offset: this._getOffset(),
  3988. flip: {
  3989. enabled: this._config.flip
  3990. },
  3991. preventOverflow: {
  3992. boundariesElement: this._config.boundary
  3993. }
  3994. }
  3995. }; // Disable Popper.js if we have a static display
  3996. if (this._config.display === 'static') {
  3997. popperConfig.modifiers.applyStyle = {
  3998. enabled: false
  3999. };
  4000. }
  4001. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4002. } // Static
  4003. ;
  4004. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4005. return this.each(function () {
  4006. var data = $(this).data(DATA_KEY$4);
  4007. var _config = typeof config === 'object' ? config : null;
  4008. if (!data) {
  4009. data = new Dropdown(this, _config);
  4010. $(this).data(DATA_KEY$4, data);
  4011. }
  4012. if (typeof config === 'string') {
  4013. if (typeof data[config] === 'undefined') {
  4014. throw new TypeError("No method named \"" + config + "\"");
  4015. }
  4016. data[config]();
  4017. }
  4018. });
  4019. };
  4020. Dropdown._clearMenus = function _clearMenus(event) {
  4021. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4022. return;
  4023. }
  4024. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4025. for (var i = 0, len = toggles.length; i < len; i++) {
  4026. var parent = Dropdown._getParentFromElement(toggles[i]);
  4027. var context = $(toggles[i]).data(DATA_KEY$4);
  4028. var relatedTarget = {
  4029. relatedTarget: toggles[i]
  4030. };
  4031. if (event && event.type === 'click') {
  4032. relatedTarget.clickEvent = event;
  4033. }
  4034. if (!context) {
  4035. continue;
  4036. }
  4037. var dropdownMenu = context._menu;
  4038. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4039. continue;
  4040. }
  4041. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4042. continue;
  4043. }
  4044. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4045. $(parent).trigger(hideEvent);
  4046. if (hideEvent.isDefaultPrevented()) {
  4047. continue;
  4048. } // If this is a touch-enabled device we remove the extra
  4049. // empty mouseover listeners we added for iOS support
  4050. if ('ontouchstart' in document.documentElement) {
  4051. $(document.body).children().off('mouseover', null, $.noop);
  4052. }
  4053. toggles[i].setAttribute('aria-expanded', 'false');
  4054. if (context._popper) {
  4055. context._popper.destroy();
  4056. }
  4057. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4058. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4059. }
  4060. };
  4061. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4062. var parent;
  4063. var selector = Util.getSelectorFromElement(element);
  4064. if (selector) {
  4065. parent = document.querySelector(selector);
  4066. }
  4067. return parent || element.parentNode;
  4068. } // eslint-disable-next-line complexity
  4069. ;
  4070. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4071. // If not input/textarea:
  4072. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4073. // If input/textarea:
  4074. // - If space key => not a dropdown command
  4075. // - If key is other than escape
  4076. // - If key is not up or down => not a dropdown command
  4077. // - If trigger inside the menu => not a dropdown command
  4078. 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)) {
  4079. return;
  4080. }
  4081. event.preventDefault();
  4082. event.stopPropagation();
  4083. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4084. return;
  4085. }
  4086. var parent = Dropdown._getParentFromElement(this);
  4087. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4088. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4089. return;
  4090. }
  4091. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4092. if (event.which === ESCAPE_KEYCODE) {
  4093. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4094. $(toggle).trigger('focus');
  4095. }
  4096. $(this).trigger('click');
  4097. return;
  4098. }
  4099. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4100. return $(item).is(':visible');
  4101. });
  4102. if (items.length === 0) {
  4103. return;
  4104. }
  4105. var index = items.indexOf(event.target);
  4106. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4107. // Up
  4108. index--;
  4109. }
  4110. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4111. // Down
  4112. index++;
  4113. }
  4114. if (index < 0) {
  4115. index = 0;
  4116. }
  4117. items[index].focus();
  4118. };
  4119. _createClass(Dropdown, null, [{
  4120. key: "VERSION",
  4121. get: function get() {
  4122. return VERSION$4;
  4123. }
  4124. }, {
  4125. key: "Default",
  4126. get: function get() {
  4127. return Default$2;
  4128. }
  4129. }, {
  4130. key: "DefaultType",
  4131. get: function get() {
  4132. return DefaultType$2;
  4133. }
  4134. }]);
  4135. return Dropdown;
  4136. }();
  4137. /**
  4138. * ------------------------------------------------------------------------
  4139. * Data Api implementation
  4140. * ------------------------------------------------------------------------
  4141. */
  4142. $(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) {
  4143. event.preventDefault();
  4144. event.stopPropagation();
  4145. Dropdown._jQueryInterface.call($(this), 'toggle');
  4146. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4147. e.stopPropagation();
  4148. });
  4149. /**
  4150. * ------------------------------------------------------------------------
  4151. * jQuery
  4152. * ------------------------------------------------------------------------
  4153. */
  4154. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4155. $.fn[NAME$4].Constructor = Dropdown;
  4156. $.fn[NAME$4].noConflict = function () {
  4157. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4158. return Dropdown._jQueryInterface;
  4159. };
  4160. /**
  4161. * ------------------------------------------------------------------------
  4162. * Constants
  4163. * ------------------------------------------------------------------------
  4164. */
  4165. var NAME$5 = 'modal';
  4166. var VERSION$5 = '4.4.1';
  4167. var DATA_KEY$5 = 'bs.modal';
  4168. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4169. var DATA_API_KEY$5 = '.data-api';
  4170. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4171. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4172. var Default$3 = {
  4173. backdrop: true,
  4174. keyboard: true,
  4175. focus: true,
  4176. show: true
  4177. };
  4178. var DefaultType$3 = {
  4179. backdrop: '(boolean|string)',
  4180. keyboard: 'boolean',
  4181. focus: 'boolean',
  4182. show: 'boolean'
  4183. };
  4184. var Event$5 = {
  4185. HIDE: "hide" + EVENT_KEY$5,
  4186. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4187. HIDDEN: "hidden" + EVENT_KEY$5,
  4188. SHOW: "show" + EVENT_KEY$5,
  4189. SHOWN: "shown" + EVENT_KEY$5,
  4190. FOCUSIN: "focusin" + EVENT_KEY$5,
  4191. RESIZE: "resize" + EVENT_KEY$5,
  4192. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4193. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4194. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4195. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4196. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4197. };
  4198. var ClassName$5 = {
  4199. SCROLLABLE: 'modal-dialog-scrollable',
  4200. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4201. BACKDROP: 'modal-backdrop',
  4202. OPEN: 'modal-open',
  4203. FADE: 'fade',
  4204. SHOW: 'show',
  4205. STATIC: 'modal-static'
  4206. };
  4207. var Selector$5 = {
  4208. DIALOG: '.modal-dialog',
  4209. MODAL_BODY: '.modal-body',
  4210. DATA_TOGGLE: '[data-toggle="modal"]',
  4211. DATA_DISMISS: '[data-dismiss="modal"]',
  4212. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4213. STICKY_CONTENT: '.sticky-top'
  4214. };
  4215. /**
  4216. * ------------------------------------------------------------------------
  4217. * Class Definition
  4218. * ------------------------------------------------------------------------
  4219. */
  4220. var Modal =
  4221. /*#__PURE__*/
  4222. function () {
  4223. function Modal(element, config) {
  4224. this._config = this._getConfig(config);
  4225. this._element = element;
  4226. this._dialog = element.querySelector(Selector$5.DIALOG);
  4227. this._backdrop = null;
  4228. this._isShown = false;
  4229. this._isBodyOverflowing = false;
  4230. this._ignoreBackdropClick = false;
  4231. this._isTransitioning = false;
  4232. this._scrollbarWidth = 0;
  4233. } // Getters
  4234. var _proto = Modal.prototype;
  4235. // Public
  4236. _proto.toggle = function toggle(relatedTarget) {
  4237. return this._isShown ? this.hide() : this.show(relatedTarget);
  4238. };
  4239. _proto.show = function show(relatedTarget) {
  4240. var _this = this;
  4241. if (this._isShown || this._isTransitioning) {
  4242. return;
  4243. }
  4244. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4245. this._isTransitioning = true;
  4246. }
  4247. var showEvent = $.Event(Event$5.SHOW, {
  4248. relatedTarget: relatedTarget
  4249. });
  4250. $(this._element).trigger(showEvent);
  4251. if (this._isShown || showEvent.isDefaultPrevented()) {
  4252. return;
  4253. }
  4254. this._isShown = true;
  4255. this._checkScrollbar();
  4256. this._setScrollbar();
  4257. this._adjustDialog();
  4258. this._setEscapeEvent();
  4259. this._setResizeEvent();
  4260. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4261. return _this.hide(event);
  4262. });
  4263. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4264. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4265. if ($(event.target).is(_this._element)) {
  4266. _this._ignoreBackdropClick = true;
  4267. }
  4268. });
  4269. });
  4270. this._showBackdrop(function () {
  4271. return _this._showElement(relatedTarget);
  4272. });
  4273. };
  4274. _proto.hide = function hide(event) {
  4275. var _this2 = this;
  4276. if (event) {
  4277. event.preventDefault();
  4278. }
  4279. if (!this._isShown || this._isTransitioning) {
  4280. return;
  4281. }
  4282. var hideEvent = $.Event(Event$5.HIDE);
  4283. $(this._element).trigger(hideEvent);
  4284. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4285. return;
  4286. }
  4287. this._isShown = false;
  4288. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4289. if (transition) {
  4290. this._isTransitioning = true;
  4291. }
  4292. this._setEscapeEvent();
  4293. this._setResizeEvent();
  4294. $(document).off(Event$5.FOCUSIN);
  4295. $(this._element).removeClass(ClassName$5.SHOW);
  4296. $(this._element).off(Event$5.CLICK_DISMISS);
  4297. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4298. if (transition) {
  4299. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4300. $(this._element).one(Util.TRANSITION_END, function (event) {
  4301. return _this2._hideModal(event);
  4302. }).emulateTransitionEnd(transitionDuration);
  4303. } else {
  4304. this._hideModal();
  4305. }
  4306. };
  4307. _proto.dispose = function dispose() {
  4308. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4309. return $(htmlElement).off(EVENT_KEY$5);
  4310. });
  4311. /**
  4312. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4313. * Do not move `document` in `htmlElements` array
  4314. * It will remove `Event.CLICK_DATA_API` event that should remain
  4315. */
  4316. $(document).off(Event$5.FOCUSIN);
  4317. $.removeData(this._element, DATA_KEY$5);
  4318. this._config = null;
  4319. this._element = null;
  4320. this._dialog = null;
  4321. this._backdrop = null;
  4322. this._isShown = null;
  4323. this._isBodyOverflowing = null;
  4324. this._ignoreBackdropClick = null;
  4325. this._isTransitioning = null;
  4326. this._scrollbarWidth = null;
  4327. };
  4328. _proto.handleUpdate = function handleUpdate() {
  4329. this._adjustDialog();
  4330. } // Private
  4331. ;
  4332. _proto._getConfig = function _getConfig(config) {
  4333. config = _objectSpread2({}, Default$3, {}, config);
  4334. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4335. return config;
  4336. };
  4337. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4338. var _this3 = this;
  4339. if (this._config.backdrop === 'static') {
  4340. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4341. $(this._element).trigger(hideEventPrevented);
  4342. if (hideEventPrevented.defaultPrevented) {
  4343. return;
  4344. }
  4345. this._element.classList.add(ClassName$5.STATIC);
  4346. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4347. $(this._element).one(Util.TRANSITION_END, function () {
  4348. _this3._element.classList.remove(ClassName$5.STATIC);
  4349. }).emulateTransitionEnd(modalTransitionDuration);
  4350. this._element.focus();
  4351. } else {
  4352. this.hide();
  4353. }
  4354. };
  4355. _proto._showElement = function _showElement(relatedTarget) {
  4356. var _this4 = this;
  4357. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4358. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4359. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4360. // Don't move modal's DOM position
  4361. document.body.appendChild(this._element);
  4362. }
  4363. this._element.style.display = 'block';
  4364. this._element.removeAttribute('aria-hidden');
  4365. this._element.setAttribute('aria-modal', true);
  4366. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4367. modalBody.scrollTop = 0;
  4368. } else {
  4369. this._element.scrollTop = 0;
  4370. }
  4371. if (transition) {
  4372. Util.reflow(this._element);
  4373. }
  4374. $(this._element).addClass(ClassName$5.SHOW);
  4375. if (this._config.focus) {
  4376. this._enforceFocus();
  4377. }
  4378. var shownEvent = $.Event(Event$5.SHOWN, {
  4379. relatedTarget: relatedTarget
  4380. });
  4381. var transitionComplete = function transitionComplete() {
  4382. if (_this4._config.focus) {
  4383. _this4._element.focus();
  4384. }
  4385. _this4._isTransitioning = false;
  4386. $(_this4._element).trigger(shownEvent);
  4387. };
  4388. if (transition) {
  4389. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4390. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4391. } else {
  4392. transitionComplete();
  4393. }
  4394. };
  4395. _proto._enforceFocus = function _enforceFocus() {
  4396. var _this5 = this;
  4397. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4398. .on(Event$5.FOCUSIN, function (event) {
  4399. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4400. _this5._element.focus();
  4401. }
  4402. });
  4403. };
  4404. _proto._setEscapeEvent = function _setEscapeEvent() {
  4405. var _this6 = this;
  4406. if (this._isShown && this._config.keyboard) {
  4407. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4408. if (event.which === ESCAPE_KEYCODE$1) {
  4409. _this6._triggerBackdropTransition();
  4410. }
  4411. });
  4412. } else if (!this._isShown) {
  4413. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4414. }
  4415. };
  4416. _proto._setResizeEvent = function _setResizeEvent() {
  4417. var _this7 = this;
  4418. if (this._isShown) {
  4419. $(window).on(Event$5.RESIZE, function (event) {
  4420. return _this7.handleUpdate(event);
  4421. });
  4422. } else {
  4423. $(window).off(Event$5.RESIZE);
  4424. }
  4425. };
  4426. _proto._hideModal = function _hideModal() {
  4427. var _this8 = this;
  4428. this._element.style.display = 'none';
  4429. this._element.setAttribute('aria-hidden', true);
  4430. this._element.removeAttribute('aria-modal');
  4431. this._isTransitioning = false;
  4432. this._showBackdrop(function () {
  4433. $(document.body).removeClass(ClassName$5.OPEN);
  4434. _this8._resetAdjustments();
  4435. _this8._resetScrollbar();
  4436. $(_this8._element).trigger(Event$5.HIDDEN);
  4437. });
  4438. };
  4439. _proto._removeBackdrop = function _removeBackdrop() {
  4440. if (this._backdrop) {
  4441. $(this._backdrop).remove();
  4442. this._backdrop = null;
  4443. }
  4444. };
  4445. _proto._showBackdrop = function _showBackdrop(callback) {
  4446. var _this9 = this;
  4447. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4448. if (this._isShown && this._config.backdrop) {
  4449. this._backdrop = document.createElement('div');
  4450. this._backdrop.className = ClassName$5.BACKDROP;
  4451. if (animate) {
  4452. this._backdrop.classList.add(animate);
  4453. }
  4454. $(this._backdrop).appendTo(document.body);
  4455. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4456. if (_this9._ignoreBackdropClick) {
  4457. _this9._ignoreBackdropClick = false;
  4458. return;
  4459. }
  4460. if (event.target !== event.currentTarget) {
  4461. return;
  4462. }
  4463. _this9._triggerBackdropTransition();
  4464. });
  4465. if (animate) {
  4466. Util.reflow(this._backdrop);
  4467. }
  4468. $(this._backdrop).addClass(ClassName$5.SHOW);
  4469. if (!callback) {
  4470. return;
  4471. }
  4472. if (!animate) {
  4473. callback();
  4474. return;
  4475. }
  4476. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4477. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4478. } else if (!this._isShown && this._backdrop) {
  4479. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4480. var callbackRemove = function callbackRemove() {
  4481. _this9._removeBackdrop();
  4482. if (callback) {
  4483. callback();
  4484. }
  4485. };
  4486. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4487. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4488. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4489. } else {
  4490. callbackRemove();
  4491. }
  4492. } else if (callback) {
  4493. callback();
  4494. }
  4495. } // ----------------------------------------------------------------------
  4496. // the following methods are used to handle overflowing modals
  4497. // todo (fat): these should probably be refactored out of modal.js
  4498. // ----------------------------------------------------------------------
  4499. ;
  4500. _proto._adjustDialog = function _adjustDialog() {
  4501. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4502. if (!this._isBodyOverflowing && isModalOverflowing) {
  4503. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4504. }
  4505. if (this._isBodyOverflowing && !isModalOverflowing) {
  4506. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4507. }
  4508. };
  4509. _proto._resetAdjustments = function _resetAdjustments() {
  4510. this._element.style.paddingLeft = '';
  4511. this._element.style.paddingRight = '';
  4512. };
  4513. _proto._checkScrollbar = function _checkScrollbar() {
  4514. var rect = document.body.getBoundingClientRect();
  4515. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4516. this._scrollbarWidth = this._getScrollbarWidth();
  4517. };
  4518. _proto._setScrollbar = function _setScrollbar() {
  4519. var _this10 = this;
  4520. if (this._isBodyOverflowing) {
  4521. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4522. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4523. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4524. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4525. $(fixedContent).each(function (index, element) {
  4526. var actualPadding = element.style.paddingRight;
  4527. var calculatedPadding = $(element).css('padding-right');
  4528. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4529. }); // Adjust sticky content margin
  4530. $(stickyContent).each(function (index, element) {
  4531. var actualMargin = element.style.marginRight;
  4532. var calculatedMargin = $(element).css('margin-right');
  4533. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4534. }); // Adjust body padding
  4535. var actualPadding = document.body.style.paddingRight;
  4536. var calculatedPadding = $(document.body).css('padding-right');
  4537. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4538. }
  4539. $(document.body).addClass(ClassName$5.OPEN);
  4540. };
  4541. _proto._resetScrollbar = function _resetScrollbar() {
  4542. // Restore fixed content padding
  4543. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4544. $(fixedContent).each(function (index, element) {
  4545. var padding = $(element).data('padding-right');
  4546. $(element).removeData('padding-right');
  4547. element.style.paddingRight = padding ? padding : '';
  4548. }); // Restore sticky content
  4549. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4550. $(elements).each(function (index, element) {
  4551. var margin = $(element).data('margin-right');
  4552. if (typeof margin !== 'undefined') {
  4553. $(element).css('margin-right', margin).removeData('margin-right');
  4554. }
  4555. }); // Restore body padding
  4556. var padding = $(document.body).data('padding-right');
  4557. $(document.body).removeData('padding-right');
  4558. document.body.style.paddingRight = padding ? padding : '';
  4559. };
  4560. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4561. // thx d.walsh
  4562. var scrollDiv = document.createElement('div');
  4563. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4564. document.body.appendChild(scrollDiv);
  4565. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4566. document.body.removeChild(scrollDiv);
  4567. return scrollbarWidth;
  4568. } // Static
  4569. ;
  4570. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4571. return this.each(function () {
  4572. var data = $(this).data(DATA_KEY$5);
  4573. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4574. if (!data) {
  4575. data = new Modal(this, _config);
  4576. $(this).data(DATA_KEY$5, data);
  4577. }
  4578. if (typeof config === 'string') {
  4579. if (typeof data[config] === 'undefined') {
  4580. throw new TypeError("No method named \"" + config + "\"");
  4581. }
  4582. data[config](relatedTarget);
  4583. } else if (_config.show) {
  4584. data.show(relatedTarget);
  4585. }
  4586. });
  4587. };
  4588. _createClass(Modal, null, [{
  4589. key: "VERSION",
  4590. get: function get() {
  4591. return VERSION$5;
  4592. }
  4593. }, {
  4594. key: "Default",
  4595. get: function get() {
  4596. return Default$3;
  4597. }
  4598. }]);
  4599. return Modal;
  4600. }();
  4601. /**
  4602. * ------------------------------------------------------------------------
  4603. * Data Api implementation
  4604. * ------------------------------------------------------------------------
  4605. */
  4606. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4607. var _this11 = this;
  4608. var target;
  4609. var selector = Util.getSelectorFromElement(this);
  4610. if (selector) {
  4611. target = document.querySelector(selector);
  4612. }
  4613. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4614. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4615. event.preventDefault();
  4616. }
  4617. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4618. if (showEvent.isDefaultPrevented()) {
  4619. // Only register focus restorer if modal will actually get shown
  4620. return;
  4621. }
  4622. $target.one(Event$5.HIDDEN, function () {
  4623. if ($(_this11).is(':visible')) {
  4624. _this11.focus();
  4625. }
  4626. });
  4627. });
  4628. Modal._jQueryInterface.call($(target), config, this);
  4629. });
  4630. /**
  4631. * ------------------------------------------------------------------------
  4632. * jQuery
  4633. * ------------------------------------------------------------------------
  4634. */
  4635. $.fn[NAME$5] = Modal._jQueryInterface;
  4636. $.fn[NAME$5].Constructor = Modal;
  4637. $.fn[NAME$5].noConflict = function () {
  4638. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4639. return Modal._jQueryInterface;
  4640. };
  4641. /**
  4642. * --------------------------------------------------------------------------
  4643. * Bootstrap (v4.4.1): tools/sanitizer.js
  4644. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4645. * --------------------------------------------------------------------------
  4646. */
  4647. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4648. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4649. var DefaultWhitelist = {
  4650. // Global attributes allowed on any supplied element below.
  4651. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4652. a: ['target', 'href', 'title', 'rel'],
  4653. area: [],
  4654. b: [],
  4655. br: [],
  4656. col: [],
  4657. code: [],
  4658. div: [],
  4659. em: [],
  4660. hr: [],
  4661. h1: [],
  4662. h2: [],
  4663. h3: [],
  4664. h4: [],
  4665. h5: [],
  4666. h6: [],
  4667. i: [],
  4668. img: ['src', 'alt', 'title', 'width', 'height'],
  4669. li: [],
  4670. ol: [],
  4671. p: [],
  4672. pre: [],
  4673. s: [],
  4674. small: [],
  4675. span: [],
  4676. sub: [],
  4677. sup: [],
  4678. strong: [],
  4679. u: [],
  4680. ul: []
  4681. };
  4682. /**
  4683. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4684. *
  4685. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4686. */
  4687. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4688. /**
  4689. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4690. *
  4691. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4692. */
  4693. 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;
  4694. function allowedAttribute(attr, allowedAttributeList) {
  4695. var attrName = attr.nodeName.toLowerCase();
  4696. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4697. if (uriAttrs.indexOf(attrName) !== -1) {
  4698. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4699. }
  4700. return true;
  4701. }
  4702. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4703. return attrRegex instanceof RegExp;
  4704. }); // Check if a regular expression validates the attribute.
  4705. for (var i = 0, l = regExp.length; i < l; i++) {
  4706. if (attrName.match(regExp[i])) {
  4707. return true;
  4708. }
  4709. }
  4710. return false;
  4711. }
  4712. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4713. if (unsafeHtml.length === 0) {
  4714. return unsafeHtml;
  4715. }
  4716. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4717. return sanitizeFn(unsafeHtml);
  4718. }
  4719. var domParser = new window.DOMParser();
  4720. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4721. var whitelistKeys = Object.keys(whiteList);
  4722. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4723. var _loop = function _loop(i, len) {
  4724. var el = elements[i];
  4725. var elName = el.nodeName.toLowerCase();
  4726. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4727. el.parentNode.removeChild(el);
  4728. return "continue";
  4729. }
  4730. var attributeList = [].slice.call(el.attributes);
  4731. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4732. attributeList.forEach(function (attr) {
  4733. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4734. el.removeAttribute(attr.nodeName);
  4735. }
  4736. });
  4737. };
  4738. for (var i = 0, len = elements.length; i < len; i++) {
  4739. var _ret = _loop(i);
  4740. if (_ret === "continue") continue;
  4741. }
  4742. return createdDocument.body.innerHTML;
  4743. }
  4744. /**
  4745. * ------------------------------------------------------------------------
  4746. * Constants
  4747. * ------------------------------------------------------------------------
  4748. */
  4749. var NAME$6 = 'tooltip';
  4750. var VERSION$6 = '4.4.1';
  4751. var DATA_KEY$6 = 'bs.tooltip';
  4752. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4753. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4754. var CLASS_PREFIX = 'bs-tooltip';
  4755. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4756. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4757. var DefaultType$4 = {
  4758. animation: 'boolean',
  4759. template: 'string',
  4760. title: '(string|element|function)',
  4761. trigger: 'string',
  4762. delay: '(number|object)',
  4763. html: 'boolean',
  4764. selector: '(string|boolean)',
  4765. placement: '(string|function)',
  4766. offset: '(number|string|function)',
  4767. container: '(string|element|boolean)',
  4768. fallbackPlacement: '(string|array)',
  4769. boundary: '(string|element)',
  4770. sanitize: 'boolean',
  4771. sanitizeFn: '(null|function)',
  4772. whiteList: 'object',
  4773. popperConfig: '(null|object)'
  4774. };
  4775. var AttachmentMap$1 = {
  4776. AUTO: 'auto',
  4777. TOP: 'top',
  4778. RIGHT: 'right',
  4779. BOTTOM: 'bottom',
  4780. LEFT: 'left'
  4781. };
  4782. var Default$4 = {
  4783. animation: true,
  4784. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4785. trigger: 'hover focus',
  4786. title: '',
  4787. delay: 0,
  4788. html: false,
  4789. selector: false,
  4790. placement: 'top',
  4791. offset: 0,
  4792. container: false,
  4793. fallbackPlacement: 'flip',
  4794. boundary: 'scrollParent',
  4795. sanitize: true,
  4796. sanitizeFn: null,
  4797. whiteList: DefaultWhitelist,
  4798. popperConfig: null
  4799. };
  4800. var HoverState = {
  4801. SHOW: 'show',
  4802. OUT: 'out'
  4803. };
  4804. var Event$6 = {
  4805. HIDE: "hide" + EVENT_KEY$6,
  4806. HIDDEN: "hidden" + EVENT_KEY$6,
  4807. SHOW: "show" + EVENT_KEY$6,
  4808. SHOWN: "shown" + EVENT_KEY$6,
  4809. INSERTED: "inserted" + EVENT_KEY$6,
  4810. CLICK: "click" + EVENT_KEY$6,
  4811. FOCUSIN: "focusin" + EVENT_KEY$6,
  4812. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4813. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4814. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4815. };
  4816. var ClassName$6 = {
  4817. FADE: 'fade',
  4818. SHOW: 'show'
  4819. };
  4820. var Selector$6 = {
  4821. TOOLTIP: '.tooltip',
  4822. TOOLTIP_INNER: '.tooltip-inner',
  4823. ARROW: '.arrow'
  4824. };
  4825. var Trigger = {
  4826. HOVER: 'hover',
  4827. FOCUS: 'focus',
  4828. CLICK: 'click',
  4829. MANUAL: 'manual'
  4830. };
  4831. /**
  4832. * ------------------------------------------------------------------------
  4833. * Class Definition
  4834. * ------------------------------------------------------------------------
  4835. */
  4836. var Tooltip =
  4837. /*#__PURE__*/
  4838. function () {
  4839. function Tooltip(element, config) {
  4840. if (typeof Popper === 'undefined') {
  4841. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4842. } // private
  4843. this._isEnabled = true;
  4844. this._timeout = 0;
  4845. this._hoverState = '';
  4846. this._activeTrigger = {};
  4847. this._popper = null; // Protected
  4848. this.element = element;
  4849. this.config = this._getConfig(config);
  4850. this.tip = null;
  4851. this._setListeners();
  4852. } // Getters
  4853. var _proto = Tooltip.prototype;
  4854. // Public
  4855. _proto.enable = function enable() {
  4856. this._isEnabled = true;
  4857. };
  4858. _proto.disable = function disable() {
  4859. this._isEnabled = false;
  4860. };
  4861. _proto.toggleEnabled = function toggleEnabled() {
  4862. this._isEnabled = !this._isEnabled;
  4863. };
  4864. _proto.toggle = function toggle(event) {
  4865. if (!this._isEnabled) {
  4866. return;
  4867. }
  4868. if (event) {
  4869. var dataKey = this.constructor.DATA_KEY;
  4870. var context = $(event.currentTarget).data(dataKey);
  4871. if (!context) {
  4872. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4873. $(event.currentTarget).data(dataKey, context);
  4874. }
  4875. context._activeTrigger.click = !context._activeTrigger.click;
  4876. if (context._isWithActiveTrigger()) {
  4877. context._enter(null, context);
  4878. } else {
  4879. context._leave(null, context);
  4880. }
  4881. } else {
  4882. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4883. this._leave(null, this);
  4884. return;
  4885. }
  4886. this._enter(null, this);
  4887. }
  4888. };
  4889. _proto.dispose = function dispose() {
  4890. clearTimeout(this._timeout);
  4891. $.removeData(this.element, this.constructor.DATA_KEY);
  4892. $(this.element).off(this.constructor.EVENT_KEY);
  4893. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4894. if (this.tip) {
  4895. $(this.tip).remove();
  4896. }
  4897. this._isEnabled = null;
  4898. this._timeout = null;
  4899. this._hoverState = null;
  4900. this._activeTrigger = null;
  4901. if (this._popper) {
  4902. this._popper.destroy();
  4903. }
  4904. this._popper = null;
  4905. this.element = null;
  4906. this.config = null;
  4907. this.tip = null;
  4908. };
  4909. _proto.show = function show() {
  4910. var _this = this;
  4911. if ($(this.element).css('display') === 'none') {
  4912. throw new Error('Please use show on visible elements');
  4913. }
  4914. var showEvent = $.Event(this.constructor.Event.SHOW);
  4915. if (this.isWithContent() && this._isEnabled) {
  4916. $(this.element).trigger(showEvent);
  4917. var shadowRoot = Util.findShadowRoot(this.element);
  4918. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  4919. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  4920. return;
  4921. }
  4922. var tip = this.getTipElement();
  4923. var tipId = Util.getUID(this.constructor.NAME);
  4924. tip.setAttribute('id', tipId);
  4925. this.element.setAttribute('aria-describedby', tipId);
  4926. this.setContent();
  4927. if (this.config.animation) {
  4928. $(tip).addClass(ClassName$6.FADE);
  4929. }
  4930. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  4931. var attachment = this._getAttachment(placement);
  4932. this.addAttachmentClass(attachment);
  4933. var container = this._getContainer();
  4934. $(tip).data(this.constructor.DATA_KEY, this);
  4935. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  4936. $(tip).appendTo(container);
  4937. }
  4938. $(this.element).trigger(this.constructor.Event.INSERTED);
  4939. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  4940. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  4941. // empty mouseover listeners to the body's immediate children;
  4942. // only needed because of broken event delegation on iOS
  4943. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4944. if ('ontouchstart' in document.documentElement) {
  4945. $(document.body).children().on('mouseover', null, $.noop);
  4946. }
  4947. var complete = function complete() {
  4948. if (_this.config.animation) {
  4949. _this._fixTransition();
  4950. }
  4951. var prevHoverState = _this._hoverState;
  4952. _this._hoverState = null;
  4953. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  4954. if (prevHoverState === HoverState.OUT) {
  4955. _this._leave(null, _this);
  4956. }
  4957. };
  4958. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4959. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  4960. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4961. } else {
  4962. complete();
  4963. }
  4964. }
  4965. };
  4966. _proto.hide = function hide(callback) {
  4967. var _this2 = this;
  4968. var tip = this.getTipElement();
  4969. var hideEvent = $.Event(this.constructor.Event.HIDE);
  4970. var complete = function complete() {
  4971. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  4972. tip.parentNode.removeChild(tip);
  4973. }
  4974. _this2._cleanTipClass();
  4975. _this2.element.removeAttribute('aria-describedby');
  4976. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  4977. if (_this2._popper !== null) {
  4978. _this2._popper.destroy();
  4979. }
  4980. if (callback) {
  4981. callback();
  4982. }
  4983. };
  4984. $(this.element).trigger(hideEvent);
  4985. if (hideEvent.isDefaultPrevented()) {
  4986. return;
  4987. }
  4988. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  4989. // empty mouseover listeners we added for iOS support
  4990. if ('ontouchstart' in document.documentElement) {
  4991. $(document.body).children().off('mouseover', null, $.noop);
  4992. }
  4993. this._activeTrigger[Trigger.CLICK] = false;
  4994. this._activeTrigger[Trigger.FOCUS] = false;
  4995. this._activeTrigger[Trigger.HOVER] = false;
  4996. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  4997. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  4998. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  4999. } else {
  5000. complete();
  5001. }
  5002. this._hoverState = '';
  5003. };
  5004. _proto.update = function update() {
  5005. if (this._popper !== null) {
  5006. this._popper.scheduleUpdate();
  5007. }
  5008. } // Protected
  5009. ;
  5010. _proto.isWithContent = function isWithContent() {
  5011. return Boolean(this.getTitle());
  5012. };
  5013. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5014. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5015. };
  5016. _proto.getTipElement = function getTipElement() {
  5017. this.tip = this.tip || $(this.config.template)[0];
  5018. return this.tip;
  5019. };
  5020. _proto.setContent = function setContent() {
  5021. var tip = this.getTipElement();
  5022. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5023. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5024. };
  5025. _proto.setElementContent = function setElementContent($element, content) {
  5026. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5027. // Content is a DOM node or a jQuery
  5028. if (this.config.html) {
  5029. if (!$(content).parent().is($element)) {
  5030. $element.empty().append(content);
  5031. }
  5032. } else {
  5033. $element.text($(content).text());
  5034. }
  5035. return;
  5036. }
  5037. if (this.config.html) {
  5038. if (this.config.sanitize) {
  5039. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5040. }
  5041. $element.html(content);
  5042. } else {
  5043. $element.text(content);
  5044. }
  5045. };
  5046. _proto.getTitle = function getTitle() {
  5047. var title = this.element.getAttribute('data-original-title');
  5048. if (!title) {
  5049. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5050. }
  5051. return title;
  5052. } // Private
  5053. ;
  5054. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5055. var _this3 = this;
  5056. var defaultBsConfig = {
  5057. placement: attachment,
  5058. modifiers: {
  5059. offset: this._getOffset(),
  5060. flip: {
  5061. behavior: this.config.fallbackPlacement
  5062. },
  5063. arrow: {
  5064. element: Selector$6.ARROW
  5065. },
  5066. preventOverflow: {
  5067. boundariesElement: this.config.boundary
  5068. }
  5069. },
  5070. onCreate: function onCreate(data) {
  5071. if (data.originalPlacement !== data.placement) {
  5072. _this3._handlePopperPlacementChange(data);
  5073. }
  5074. },
  5075. onUpdate: function onUpdate(data) {
  5076. return _this3._handlePopperPlacementChange(data);
  5077. }
  5078. };
  5079. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5080. };
  5081. _proto._getOffset = function _getOffset() {
  5082. var _this4 = this;
  5083. var offset = {};
  5084. if (typeof this.config.offset === 'function') {
  5085. offset.fn = function (data) {
  5086. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5087. return data;
  5088. };
  5089. } else {
  5090. offset.offset = this.config.offset;
  5091. }
  5092. return offset;
  5093. };
  5094. _proto._getContainer = function _getContainer() {
  5095. if (this.config.container === false) {
  5096. return document.body;
  5097. }
  5098. if (Util.isElement(this.config.container)) {
  5099. return $(this.config.container);
  5100. }
  5101. return $(document).find(this.config.container);
  5102. };
  5103. _proto._getAttachment = function _getAttachment(placement) {
  5104. return AttachmentMap$1[placement.toUpperCase()];
  5105. };
  5106. _proto._setListeners = function _setListeners() {
  5107. var _this5 = this;
  5108. var triggers = this.config.trigger.split(' ');
  5109. triggers.forEach(function (trigger) {
  5110. if (trigger === 'click') {
  5111. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5112. return _this5.toggle(event);
  5113. });
  5114. } else if (trigger !== Trigger.MANUAL) {
  5115. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5116. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5117. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5118. return _this5._enter(event);
  5119. }).on(eventOut, _this5.config.selector, function (event) {
  5120. return _this5._leave(event);
  5121. });
  5122. }
  5123. });
  5124. this._hideModalHandler = function () {
  5125. if (_this5.element) {
  5126. _this5.hide();
  5127. }
  5128. };
  5129. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5130. if (this.config.selector) {
  5131. this.config = _objectSpread2({}, this.config, {
  5132. trigger: 'manual',
  5133. selector: ''
  5134. });
  5135. } else {
  5136. this._fixTitle();
  5137. }
  5138. };
  5139. _proto._fixTitle = function _fixTitle() {
  5140. var titleType = typeof this.element.getAttribute('data-original-title');
  5141. if (this.element.getAttribute('title') || titleType !== 'string') {
  5142. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5143. this.element.setAttribute('title', '');
  5144. }
  5145. };
  5146. _proto._enter = function _enter(event, context) {
  5147. var dataKey = this.constructor.DATA_KEY;
  5148. context = context || $(event.currentTarget).data(dataKey);
  5149. if (!context) {
  5150. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5151. $(event.currentTarget).data(dataKey, context);
  5152. }
  5153. if (event) {
  5154. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5155. }
  5156. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5157. context._hoverState = HoverState.SHOW;
  5158. return;
  5159. }
  5160. clearTimeout(context._timeout);
  5161. context._hoverState = HoverState.SHOW;
  5162. if (!context.config.delay || !context.config.delay.show) {
  5163. context.show();
  5164. return;
  5165. }
  5166. context._timeout = setTimeout(function () {
  5167. if (context._hoverState === HoverState.SHOW) {
  5168. context.show();
  5169. }
  5170. }, context.config.delay.show);
  5171. };
  5172. _proto._leave = function _leave(event, context) {
  5173. var dataKey = this.constructor.DATA_KEY;
  5174. context = context || $(event.currentTarget).data(dataKey);
  5175. if (!context) {
  5176. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5177. $(event.currentTarget).data(dataKey, context);
  5178. }
  5179. if (event) {
  5180. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5181. }
  5182. if (context._isWithActiveTrigger()) {
  5183. return;
  5184. }
  5185. clearTimeout(context._timeout);
  5186. context._hoverState = HoverState.OUT;
  5187. if (!context.config.delay || !context.config.delay.hide) {
  5188. context.hide();
  5189. return;
  5190. }
  5191. context._timeout = setTimeout(function () {
  5192. if (context._hoverState === HoverState.OUT) {
  5193. context.hide();
  5194. }
  5195. }, context.config.delay.hide);
  5196. };
  5197. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5198. for (var trigger in this._activeTrigger) {
  5199. if (this._activeTrigger[trigger]) {
  5200. return true;
  5201. }
  5202. }
  5203. return false;
  5204. };
  5205. _proto._getConfig = function _getConfig(config) {
  5206. var dataAttributes = $(this.element).data();
  5207. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5208. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5209. delete dataAttributes[dataAttr];
  5210. }
  5211. });
  5212. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5213. if (typeof config.delay === 'number') {
  5214. config.delay = {
  5215. show: config.delay,
  5216. hide: config.delay
  5217. };
  5218. }
  5219. if (typeof config.title === 'number') {
  5220. config.title = config.title.toString();
  5221. }
  5222. if (typeof config.content === 'number') {
  5223. config.content = config.content.toString();
  5224. }
  5225. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5226. if (config.sanitize) {
  5227. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5228. }
  5229. return config;
  5230. };
  5231. _proto._getDelegateConfig = function _getDelegateConfig() {
  5232. var config = {};
  5233. if (this.config) {
  5234. for (var key in this.config) {
  5235. if (this.constructor.Default[key] !== this.config[key]) {
  5236. config[key] = this.config[key];
  5237. }
  5238. }
  5239. }
  5240. return config;
  5241. };
  5242. _proto._cleanTipClass = function _cleanTipClass() {
  5243. var $tip = $(this.getTipElement());
  5244. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5245. if (tabClass !== null && tabClass.length) {
  5246. $tip.removeClass(tabClass.join(''));
  5247. }
  5248. };
  5249. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5250. var popperInstance = popperData.instance;
  5251. this.tip = popperInstance.popper;
  5252. this._cleanTipClass();
  5253. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5254. };
  5255. _proto._fixTransition = function _fixTransition() {
  5256. var tip = this.getTipElement();
  5257. var initConfigAnimation = this.config.animation;
  5258. if (tip.getAttribute('x-placement') !== null) {
  5259. return;
  5260. }
  5261. $(tip).removeClass(ClassName$6.FADE);
  5262. this.config.animation = false;
  5263. this.hide();
  5264. this.show();
  5265. this.config.animation = initConfigAnimation;
  5266. } // Static
  5267. ;
  5268. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5269. return this.each(function () {
  5270. var data = $(this).data(DATA_KEY$6);
  5271. var _config = typeof config === 'object' && config;
  5272. if (!data && /dispose|hide/.test(config)) {
  5273. return;
  5274. }
  5275. if (!data) {
  5276. data = new Tooltip(this, _config);
  5277. $(this).data(DATA_KEY$6, data);
  5278. }
  5279. if (typeof config === 'string') {
  5280. if (typeof data[config] === 'undefined') {
  5281. throw new TypeError("No method named \"" + config + "\"");
  5282. }
  5283. data[config]();
  5284. }
  5285. });
  5286. };
  5287. _createClass(Tooltip, null, [{
  5288. key: "VERSION",
  5289. get: function get() {
  5290. return VERSION$6;
  5291. }
  5292. }, {
  5293. key: "Default",
  5294. get: function get() {
  5295. return Default$4;
  5296. }
  5297. }, {
  5298. key: "NAME",
  5299. get: function get() {
  5300. return NAME$6;
  5301. }
  5302. }, {
  5303. key: "DATA_KEY",
  5304. get: function get() {
  5305. return DATA_KEY$6;
  5306. }
  5307. }, {
  5308. key: "Event",
  5309. get: function get() {
  5310. return Event$6;
  5311. }
  5312. }, {
  5313. key: "EVENT_KEY",
  5314. get: function get() {
  5315. return EVENT_KEY$6;
  5316. }
  5317. }, {
  5318. key: "DefaultType",
  5319. get: function get() {
  5320. return DefaultType$4;
  5321. }
  5322. }]);
  5323. return Tooltip;
  5324. }();
  5325. /**
  5326. * ------------------------------------------------------------------------
  5327. * jQuery
  5328. * ------------------------------------------------------------------------
  5329. */
  5330. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5331. $.fn[NAME$6].Constructor = Tooltip;
  5332. $.fn[NAME$6].noConflict = function () {
  5333. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5334. return Tooltip._jQueryInterface;
  5335. };
  5336. /**
  5337. * ------------------------------------------------------------------------
  5338. * Constants
  5339. * ------------------------------------------------------------------------
  5340. */
  5341. var NAME$7 = 'popover';
  5342. var VERSION$7 = '4.4.1';
  5343. var DATA_KEY$7 = 'bs.popover';
  5344. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5345. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5346. var CLASS_PREFIX$1 = 'bs-popover';
  5347. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5348. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5349. placement: 'right',
  5350. trigger: 'click',
  5351. content: '',
  5352. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5353. });
  5354. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5355. content: '(string|element|function)'
  5356. });
  5357. var ClassName$7 = {
  5358. FADE: 'fade',
  5359. SHOW: 'show'
  5360. };
  5361. var Selector$7 = {
  5362. TITLE: '.popover-header',
  5363. CONTENT: '.popover-body'
  5364. };
  5365. var Event$7 = {
  5366. HIDE: "hide" + EVENT_KEY$7,
  5367. HIDDEN: "hidden" + EVENT_KEY$7,
  5368. SHOW: "show" + EVENT_KEY$7,
  5369. SHOWN: "shown" + EVENT_KEY$7,
  5370. INSERTED: "inserted" + EVENT_KEY$7,
  5371. CLICK: "click" + EVENT_KEY$7,
  5372. FOCUSIN: "focusin" + EVENT_KEY$7,
  5373. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5374. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5375. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5376. };
  5377. /**
  5378. * ------------------------------------------------------------------------
  5379. * Class Definition
  5380. * ------------------------------------------------------------------------
  5381. */
  5382. var Popover =
  5383. /*#__PURE__*/
  5384. function (_Tooltip) {
  5385. _inheritsLoose(Popover, _Tooltip);
  5386. function Popover() {
  5387. return _Tooltip.apply(this, arguments) || this;
  5388. }
  5389. var _proto = Popover.prototype;
  5390. // Overrides
  5391. _proto.isWithContent = function isWithContent() {
  5392. return this.getTitle() || this._getContent();
  5393. };
  5394. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5395. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5396. };
  5397. _proto.getTipElement = function getTipElement() {
  5398. this.tip = this.tip || $(this.config.template)[0];
  5399. return this.tip;
  5400. };
  5401. _proto.setContent = function setContent() {
  5402. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5403. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5404. var content = this._getContent();
  5405. if (typeof content === 'function') {
  5406. content = content.call(this.element);
  5407. }
  5408. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5409. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5410. } // Private
  5411. ;
  5412. _proto._getContent = function _getContent() {
  5413. return this.element.getAttribute('data-content') || this.config.content;
  5414. };
  5415. _proto._cleanTipClass = function _cleanTipClass() {
  5416. var $tip = $(this.getTipElement());
  5417. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5418. if (tabClass !== null && tabClass.length > 0) {
  5419. $tip.removeClass(tabClass.join(''));
  5420. }
  5421. } // Static
  5422. ;
  5423. Popover._jQueryInterface = function _jQueryInterface(config) {
  5424. return this.each(function () {
  5425. var data = $(this).data(DATA_KEY$7);
  5426. var _config = typeof config === 'object' ? config : null;
  5427. if (!data && /dispose|hide/.test(config)) {
  5428. return;
  5429. }
  5430. if (!data) {
  5431. data = new Popover(this, _config);
  5432. $(this).data(DATA_KEY$7, data);
  5433. }
  5434. if (typeof config === 'string') {
  5435. if (typeof data[config] === 'undefined') {
  5436. throw new TypeError("No method named \"" + config + "\"");
  5437. }
  5438. data[config]();
  5439. }
  5440. });
  5441. };
  5442. _createClass(Popover, null, [{
  5443. key: "VERSION",
  5444. // Getters
  5445. get: function get() {
  5446. return VERSION$7;
  5447. }
  5448. }, {
  5449. key: "Default",
  5450. get: function get() {
  5451. return Default$5;
  5452. }
  5453. }, {
  5454. key: "NAME",
  5455. get: function get() {
  5456. return NAME$7;
  5457. }
  5458. }, {
  5459. key: "DATA_KEY",
  5460. get: function get() {
  5461. return DATA_KEY$7;
  5462. }
  5463. }, {
  5464. key: "Event",
  5465. get: function get() {
  5466. return Event$7;
  5467. }
  5468. }, {
  5469. key: "EVENT_KEY",
  5470. get: function get() {
  5471. return EVENT_KEY$7;
  5472. }
  5473. }, {
  5474. key: "DefaultType",
  5475. get: function get() {
  5476. return DefaultType$5;
  5477. }
  5478. }]);
  5479. return Popover;
  5480. }(Tooltip);
  5481. /**
  5482. * ------------------------------------------------------------------------
  5483. * jQuery
  5484. * ------------------------------------------------------------------------
  5485. */
  5486. $.fn[NAME$7] = Popover._jQueryInterface;
  5487. $.fn[NAME$7].Constructor = Popover;
  5488. $.fn[NAME$7].noConflict = function () {
  5489. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5490. return Popover._jQueryInterface;
  5491. };
  5492. /**
  5493. * ------------------------------------------------------------------------
  5494. * Constants
  5495. * ------------------------------------------------------------------------
  5496. */
  5497. var NAME$8 = 'scrollspy';
  5498. var VERSION$8 = '4.4.1';
  5499. var DATA_KEY$8 = 'bs.scrollspy';
  5500. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5501. var DATA_API_KEY$6 = '.data-api';
  5502. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5503. var Default$6 = {
  5504. offset: 10,
  5505. method: 'auto',
  5506. target: ''
  5507. };
  5508. var DefaultType$6 = {
  5509. offset: 'number',
  5510. method: 'string',
  5511. target: '(string|element)'
  5512. };
  5513. var Event$8 = {
  5514. ACTIVATE: "activate" + EVENT_KEY$8,
  5515. SCROLL: "scroll" + EVENT_KEY$8,
  5516. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5517. };
  5518. var ClassName$8 = {
  5519. DROPDOWN_ITEM: 'dropdown-item',
  5520. DROPDOWN_MENU: 'dropdown-menu',
  5521. ACTIVE: 'active'
  5522. };
  5523. var Selector$8 = {
  5524. DATA_SPY: '[data-spy="scroll"]',
  5525. ACTIVE: '.active',
  5526. NAV_LIST_GROUP: '.nav, .list-group',
  5527. NAV_LINKS: '.nav-link',
  5528. NAV_ITEMS: '.nav-item',
  5529. LIST_ITEMS: '.list-group-item',
  5530. DROPDOWN: '.dropdown',
  5531. DROPDOWN_ITEMS: '.dropdown-item',
  5532. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5533. };
  5534. var OffsetMethod = {
  5535. OFFSET: 'offset',
  5536. POSITION: 'position'
  5537. };
  5538. /**
  5539. * ------------------------------------------------------------------------
  5540. * Class Definition
  5541. * ------------------------------------------------------------------------
  5542. */
  5543. var ScrollSpy =
  5544. /*#__PURE__*/
  5545. function () {
  5546. function ScrollSpy(element, config) {
  5547. var _this = this;
  5548. this._element = element;
  5549. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5550. this._config = this._getConfig(config);
  5551. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5552. this._offsets = [];
  5553. this._targets = [];
  5554. this._activeTarget = null;
  5555. this._scrollHeight = 0;
  5556. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5557. return _this._process(event);
  5558. });
  5559. this.refresh();
  5560. this._process();
  5561. } // Getters
  5562. var _proto = ScrollSpy.prototype;
  5563. // Public
  5564. _proto.refresh = function refresh() {
  5565. var _this2 = this;
  5566. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5567. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5568. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5569. this._offsets = [];
  5570. this._targets = [];
  5571. this._scrollHeight = this._getScrollHeight();
  5572. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5573. targets.map(function (element) {
  5574. var target;
  5575. var targetSelector = Util.getSelectorFromElement(element);
  5576. if (targetSelector) {
  5577. target = document.querySelector(targetSelector);
  5578. }
  5579. if (target) {
  5580. var targetBCR = target.getBoundingClientRect();
  5581. if (targetBCR.width || targetBCR.height) {
  5582. // TODO (fat): remove sketch reliance on jQuery position/offset
  5583. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5584. }
  5585. }
  5586. return null;
  5587. }).filter(function (item) {
  5588. return item;
  5589. }).sort(function (a, b) {
  5590. return a[0] - b[0];
  5591. }).forEach(function (item) {
  5592. _this2._offsets.push(item[0]);
  5593. _this2._targets.push(item[1]);
  5594. });
  5595. };
  5596. _proto.dispose = function dispose() {
  5597. $.removeData(this._element, DATA_KEY$8);
  5598. $(this._scrollElement).off(EVENT_KEY$8);
  5599. this._element = null;
  5600. this._scrollElement = null;
  5601. this._config = null;
  5602. this._selector = null;
  5603. this._offsets = null;
  5604. this._targets = null;
  5605. this._activeTarget = null;
  5606. this._scrollHeight = null;
  5607. } // Private
  5608. ;
  5609. _proto._getConfig = function _getConfig(config) {
  5610. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5611. if (typeof config.target !== 'string') {
  5612. var id = $(config.target).attr('id');
  5613. if (!id) {
  5614. id = Util.getUID(NAME$8);
  5615. $(config.target).attr('id', id);
  5616. }
  5617. config.target = "#" + id;
  5618. }
  5619. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5620. return config;
  5621. };
  5622. _proto._getScrollTop = function _getScrollTop() {
  5623. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5624. };
  5625. _proto._getScrollHeight = function _getScrollHeight() {
  5626. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5627. };
  5628. _proto._getOffsetHeight = function _getOffsetHeight() {
  5629. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5630. };
  5631. _proto._process = function _process() {
  5632. var scrollTop = this._getScrollTop() + this._config.offset;
  5633. var scrollHeight = this._getScrollHeight();
  5634. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5635. if (this._scrollHeight !== scrollHeight) {
  5636. this.refresh();
  5637. }
  5638. if (scrollTop >= maxScroll) {
  5639. var target = this._targets[this._targets.length - 1];
  5640. if (this._activeTarget !== target) {
  5641. this._activate(target);
  5642. }
  5643. return;
  5644. }
  5645. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5646. this._activeTarget = null;
  5647. this._clear();
  5648. return;
  5649. }
  5650. var offsetLength = this._offsets.length;
  5651. for (var i = offsetLength; i--;) {
  5652. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5653. if (isActiveTarget) {
  5654. this._activate(this._targets[i]);
  5655. }
  5656. }
  5657. };
  5658. _proto._activate = function _activate(target) {
  5659. this._activeTarget = target;
  5660. this._clear();
  5661. var queries = this._selector.split(',').map(function (selector) {
  5662. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5663. });
  5664. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5665. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5666. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5667. $link.addClass(ClassName$8.ACTIVE);
  5668. } else {
  5669. // Set triggered link as active
  5670. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5671. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5672. $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
  5673. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5674. }
  5675. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5676. relatedTarget: target
  5677. });
  5678. };
  5679. _proto._clear = function _clear() {
  5680. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5681. return node.classList.contains(ClassName$8.ACTIVE);
  5682. }).forEach(function (node) {
  5683. return node.classList.remove(ClassName$8.ACTIVE);
  5684. });
  5685. } // Static
  5686. ;
  5687. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5688. return this.each(function () {
  5689. var data = $(this).data(DATA_KEY$8);
  5690. var _config = typeof config === 'object' && config;
  5691. if (!data) {
  5692. data = new ScrollSpy(this, _config);
  5693. $(this).data(DATA_KEY$8, data);
  5694. }
  5695. if (typeof config === 'string') {
  5696. if (typeof data[config] === 'undefined') {
  5697. throw new TypeError("No method named \"" + config + "\"");
  5698. }
  5699. data[config]();
  5700. }
  5701. });
  5702. };
  5703. _createClass(ScrollSpy, null, [{
  5704. key: "VERSION",
  5705. get: function get() {
  5706. return VERSION$8;
  5707. }
  5708. }, {
  5709. key: "Default",
  5710. get: function get() {
  5711. return Default$6;
  5712. }
  5713. }]);
  5714. return ScrollSpy;
  5715. }();
  5716. /**
  5717. * ------------------------------------------------------------------------
  5718. * Data Api implementation
  5719. * ------------------------------------------------------------------------
  5720. */
  5721. $(window).on(Event$8.LOAD_DATA_API, function () {
  5722. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5723. var scrollSpysLength = scrollSpys.length;
  5724. for (var i = scrollSpysLength; i--;) {
  5725. var $spy = $(scrollSpys[i]);
  5726. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5727. }
  5728. });
  5729. /**
  5730. * ------------------------------------------------------------------------
  5731. * jQuery
  5732. * ------------------------------------------------------------------------
  5733. */
  5734. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5735. $.fn[NAME$8].Constructor = ScrollSpy;
  5736. $.fn[NAME$8].noConflict = function () {
  5737. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5738. return ScrollSpy._jQueryInterface;
  5739. };
  5740. /**
  5741. * ------------------------------------------------------------------------
  5742. * Constants
  5743. * ------------------------------------------------------------------------
  5744. */
  5745. var NAME$9 = 'tab';
  5746. var VERSION$9 = '4.4.1';
  5747. var DATA_KEY$9 = 'bs.tab';
  5748. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5749. var DATA_API_KEY$7 = '.data-api';
  5750. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5751. var Event$9 = {
  5752. HIDE: "hide" + EVENT_KEY$9,
  5753. HIDDEN: "hidden" + EVENT_KEY$9,
  5754. SHOW: "show" + EVENT_KEY$9,
  5755. SHOWN: "shown" + EVENT_KEY$9,
  5756. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5757. };
  5758. var ClassName$9 = {
  5759. DROPDOWN_MENU: 'dropdown-menu',
  5760. ACTIVE: 'active',
  5761. DISABLED: 'disabled',
  5762. FADE: 'fade',
  5763. SHOW: 'show'
  5764. };
  5765. var Selector$9 = {
  5766. DROPDOWN: '.dropdown',
  5767. NAV_LIST_GROUP: '.nav, .list-group',
  5768. ACTIVE: '.active',
  5769. ACTIVE_UL: '> li > .active',
  5770. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5771. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5772. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5773. };
  5774. /**
  5775. * ------------------------------------------------------------------------
  5776. * Class Definition
  5777. * ------------------------------------------------------------------------
  5778. */
  5779. var Tab =
  5780. /*#__PURE__*/
  5781. function () {
  5782. function Tab(element) {
  5783. this._element = element;
  5784. } // Getters
  5785. var _proto = Tab.prototype;
  5786. // Public
  5787. _proto.show = function show() {
  5788. var _this = this;
  5789. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5790. return;
  5791. }
  5792. var target;
  5793. var previous;
  5794. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5795. var selector = Util.getSelectorFromElement(this._element);
  5796. if (listElement) {
  5797. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5798. previous = $.makeArray($(listElement).find(itemSelector));
  5799. previous = previous[previous.length - 1];
  5800. }
  5801. var hideEvent = $.Event(Event$9.HIDE, {
  5802. relatedTarget: this._element
  5803. });
  5804. var showEvent = $.Event(Event$9.SHOW, {
  5805. relatedTarget: previous
  5806. });
  5807. if (previous) {
  5808. $(previous).trigger(hideEvent);
  5809. }
  5810. $(this._element).trigger(showEvent);
  5811. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5812. return;
  5813. }
  5814. if (selector) {
  5815. target = document.querySelector(selector);
  5816. }
  5817. this._activate(this._element, listElement);
  5818. var complete = function complete() {
  5819. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5820. relatedTarget: _this._element
  5821. });
  5822. var shownEvent = $.Event(Event$9.SHOWN, {
  5823. relatedTarget: previous
  5824. });
  5825. $(previous).trigger(hiddenEvent);
  5826. $(_this._element).trigger(shownEvent);
  5827. };
  5828. if (target) {
  5829. this._activate(target, target.parentNode, complete);
  5830. } else {
  5831. complete();
  5832. }
  5833. };
  5834. _proto.dispose = function dispose() {
  5835. $.removeData(this._element, DATA_KEY$9);
  5836. this._element = null;
  5837. } // Private
  5838. ;
  5839. _proto._activate = function _activate(element, container, callback) {
  5840. var _this2 = this;
  5841. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5842. var active = activeElements[0];
  5843. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5844. var complete = function complete() {
  5845. return _this2._transitionComplete(element, active, callback);
  5846. };
  5847. if (active && isTransitioning) {
  5848. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5849. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5850. } else {
  5851. complete();
  5852. }
  5853. };
  5854. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5855. if (active) {
  5856. $(active).removeClass(ClassName$9.ACTIVE);
  5857. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5858. if (dropdownChild) {
  5859. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5860. }
  5861. if (active.getAttribute('role') === 'tab') {
  5862. active.setAttribute('aria-selected', false);
  5863. }
  5864. }
  5865. $(element).addClass(ClassName$9.ACTIVE);
  5866. if (element.getAttribute('role') === 'tab') {
  5867. element.setAttribute('aria-selected', true);
  5868. }
  5869. Util.reflow(element);
  5870. if (element.classList.contains(ClassName$9.FADE)) {
  5871. element.classList.add(ClassName$9.SHOW);
  5872. }
  5873. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5874. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5875. if (dropdownElement) {
  5876. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5877. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5878. }
  5879. element.setAttribute('aria-expanded', true);
  5880. }
  5881. if (callback) {
  5882. callback();
  5883. }
  5884. } // Static
  5885. ;
  5886. Tab._jQueryInterface = function _jQueryInterface(config) {
  5887. return this.each(function () {
  5888. var $this = $(this);
  5889. var data = $this.data(DATA_KEY$9);
  5890. if (!data) {
  5891. data = new Tab(this);
  5892. $this.data(DATA_KEY$9, data);
  5893. }
  5894. if (typeof config === 'string') {
  5895. if (typeof data[config] === 'undefined') {
  5896. throw new TypeError("No method named \"" + config + "\"");
  5897. }
  5898. data[config]();
  5899. }
  5900. });
  5901. };
  5902. _createClass(Tab, null, [{
  5903. key: "VERSION",
  5904. get: function get() {
  5905. return VERSION$9;
  5906. }
  5907. }]);
  5908. return Tab;
  5909. }();
  5910. /**
  5911. * ------------------------------------------------------------------------
  5912. * Data Api implementation
  5913. * ------------------------------------------------------------------------
  5914. */
  5915. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  5916. event.preventDefault();
  5917. Tab._jQueryInterface.call($(this), 'show');
  5918. });
  5919. /**
  5920. * ------------------------------------------------------------------------
  5921. * jQuery
  5922. * ------------------------------------------------------------------------
  5923. */
  5924. $.fn[NAME$9] = Tab._jQueryInterface;
  5925. $.fn[NAME$9].Constructor = Tab;
  5926. $.fn[NAME$9].noConflict = function () {
  5927. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  5928. return Tab._jQueryInterface;
  5929. };
  5930. /**
  5931. * ------------------------------------------------------------------------
  5932. * Constants
  5933. * ------------------------------------------------------------------------
  5934. */
  5935. var NAME$a = 'toast';
  5936. var VERSION$a = '4.4.1';
  5937. var DATA_KEY$a = 'bs.toast';
  5938. var EVENT_KEY$a = "." + DATA_KEY$a;
  5939. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  5940. var Event$a = {
  5941. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  5942. HIDE: "hide" + EVENT_KEY$a,
  5943. HIDDEN: "hidden" + EVENT_KEY$a,
  5944. SHOW: "show" + EVENT_KEY$a,
  5945. SHOWN: "shown" + EVENT_KEY$a
  5946. };
  5947. var ClassName$a = {
  5948. FADE: 'fade',
  5949. HIDE: 'hide',
  5950. SHOW: 'show',
  5951. SHOWING: 'showing'
  5952. };
  5953. var DefaultType$7 = {
  5954. animation: 'boolean',
  5955. autohide: 'boolean',
  5956. delay: 'number'
  5957. };
  5958. var Default$7 = {
  5959. animation: true,
  5960. autohide: true,
  5961. delay: 500
  5962. };
  5963. var Selector$a = {
  5964. DATA_DISMISS: '[data-dismiss="toast"]'
  5965. };
  5966. /**
  5967. * ------------------------------------------------------------------------
  5968. * Class Definition
  5969. * ------------------------------------------------------------------------
  5970. */
  5971. var Toast =
  5972. /*#__PURE__*/
  5973. function () {
  5974. function Toast(element, config) {
  5975. this._element = element;
  5976. this._config = this._getConfig(config);
  5977. this._timeout = null;
  5978. this._setListeners();
  5979. } // Getters
  5980. var _proto = Toast.prototype;
  5981. // Public
  5982. _proto.show = function show() {
  5983. var _this = this;
  5984. var showEvent = $.Event(Event$a.SHOW);
  5985. $(this._element).trigger(showEvent);
  5986. if (showEvent.isDefaultPrevented()) {
  5987. return;
  5988. }
  5989. if (this._config.animation) {
  5990. this._element.classList.add(ClassName$a.FADE);
  5991. }
  5992. var complete = function complete() {
  5993. _this._element.classList.remove(ClassName$a.SHOWING);
  5994. _this._element.classList.add(ClassName$a.SHOW);
  5995. $(_this._element).trigger(Event$a.SHOWN);
  5996. if (_this._config.autohide) {
  5997. _this._timeout = setTimeout(function () {
  5998. _this.hide();
  5999. }, _this._config.delay);
  6000. }
  6001. };
  6002. this._element.classList.remove(ClassName$a.HIDE);
  6003. Util.reflow(this._element);
  6004. this._element.classList.add(ClassName$a.SHOWING);
  6005. if (this._config.animation) {
  6006. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6007. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6008. } else {
  6009. complete();
  6010. }
  6011. };
  6012. _proto.hide = function hide() {
  6013. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6014. return;
  6015. }
  6016. var hideEvent = $.Event(Event$a.HIDE);
  6017. $(this._element).trigger(hideEvent);
  6018. if (hideEvent.isDefaultPrevented()) {
  6019. return;
  6020. }
  6021. this._close();
  6022. };
  6023. _proto.dispose = function dispose() {
  6024. clearTimeout(this._timeout);
  6025. this._timeout = null;
  6026. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6027. this._element.classList.remove(ClassName$a.SHOW);
  6028. }
  6029. $(this._element).off(Event$a.CLICK_DISMISS);
  6030. $.removeData(this._element, DATA_KEY$a);
  6031. this._element = null;
  6032. this._config = null;
  6033. } // Private
  6034. ;
  6035. _proto._getConfig = function _getConfig(config) {
  6036. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6037. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6038. return config;
  6039. };
  6040. _proto._setListeners = function _setListeners() {
  6041. var _this2 = this;
  6042. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6043. return _this2.hide();
  6044. });
  6045. };
  6046. _proto._close = function _close() {
  6047. var _this3 = this;
  6048. var complete = function complete() {
  6049. _this3._element.classList.add(ClassName$a.HIDE);
  6050. $(_this3._element).trigger(Event$a.HIDDEN);
  6051. };
  6052. this._element.classList.remove(ClassName$a.SHOW);
  6053. if (this._config.animation) {
  6054. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6055. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6056. } else {
  6057. complete();
  6058. }
  6059. } // Static
  6060. ;
  6061. Toast._jQueryInterface = function _jQueryInterface(config) {
  6062. return this.each(function () {
  6063. var $element = $(this);
  6064. var data = $element.data(DATA_KEY$a);
  6065. var _config = typeof config === 'object' && config;
  6066. if (!data) {
  6067. data = new Toast(this, _config);
  6068. $element.data(DATA_KEY$a, data);
  6069. }
  6070. if (typeof config === 'string') {
  6071. if (typeof data[config] === 'undefined') {
  6072. throw new TypeError("No method named \"" + config + "\"");
  6073. }
  6074. data[config](this);
  6075. }
  6076. });
  6077. };
  6078. _createClass(Toast, null, [{
  6079. key: "VERSION",
  6080. get: function get() {
  6081. return VERSION$a;
  6082. }
  6083. }, {
  6084. key: "DefaultType",
  6085. get: function get() {
  6086. return DefaultType$7;
  6087. }
  6088. }, {
  6089. key: "Default",
  6090. get: function get() {
  6091. return Default$7;
  6092. }
  6093. }]);
  6094. return Toast;
  6095. }();
  6096. /**
  6097. * ------------------------------------------------------------------------
  6098. * jQuery
  6099. * ------------------------------------------------------------------------
  6100. */
  6101. $.fn[NAME$a] = Toast._jQueryInterface;
  6102. $.fn[NAME$a].Constructor = Toast;
  6103. $.fn[NAME$a].noConflict = function () {
  6104. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6105. return Toast._jQueryInterface;
  6106. };
  6107. exports.Alert = Alert;
  6108. exports.Button = Button;
  6109. exports.Carousel = Carousel;
  6110. exports.Collapse = Collapse;
  6111. exports.Dropdown = Dropdown;
  6112. exports.Modal = Modal;
  6113. exports.Popover = Popover;
  6114. exports.Scrollspy = ScrollSpy;
  6115. exports.Tab = Tab;
  6116. exports.Toast = Toast;
  6117. exports.Tooltip = Tooltip;
  6118. exports.Util = Util;
  6119. Object.defineProperty(exports, '__esModule', { value: true });
  6120. })));
  6121. //# sourceMappingURL=bootstrap.js.map
  6122. /***/ }),
  6123. /***/ "./node_modules/buffer/index.js":
  6124. /*!**************************************!*\
  6125. !*** ./node_modules/buffer/index.js ***!
  6126. \**************************************/
  6127. /*! no static exports found */
  6128. /***/ (function(module, exports, __webpack_require__) {
  6129. "use strict";
  6130. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6131. * The buffer module from node.js, for the browser.
  6132. *
  6133. * @author Feross Aboukhadijeh <http://feross.org>
  6134. * @license MIT
  6135. */
  6136. /* eslint-disable no-proto */
  6137. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6138. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6139. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6140. exports.Buffer = Buffer
  6141. exports.SlowBuffer = SlowBuffer
  6142. exports.INSPECT_MAX_BYTES = 50
  6143. /**
  6144. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6145. * === true Use Uint8Array implementation (fastest)
  6146. * === false Use Object implementation (most compatible, even IE6)
  6147. *
  6148. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6149. * Opera 11.6+, iOS 4.2+.
  6150. *
  6151. * Due to various browser bugs, sometimes the Object implementation will be used even
  6152. * when the browser supports typed arrays.
  6153. *
  6154. * Note:
  6155. *
  6156. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6157. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6158. *
  6159. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6160. *
  6161. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6162. * incorrect length in some situations.
  6163. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6164. * get the Object implementation, which is slower but behaves correctly.
  6165. */
  6166. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6167. ? global.TYPED_ARRAY_SUPPORT
  6168. : typedArraySupport()
  6169. /*
  6170. * Export kMaxLength after typed array support is determined.
  6171. */
  6172. exports.kMaxLength = kMaxLength()
  6173. function typedArraySupport () {
  6174. try {
  6175. var arr = new Uint8Array(1)
  6176. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6177. return arr.foo() === 42 && // typed array instances can be augmented
  6178. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6179. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6180. } catch (e) {
  6181. return false
  6182. }
  6183. }
  6184. function kMaxLength () {
  6185. return Buffer.TYPED_ARRAY_SUPPORT
  6186. ? 0x7fffffff
  6187. : 0x3fffffff
  6188. }
  6189. function createBuffer (that, length) {
  6190. if (kMaxLength() < length) {
  6191. throw new RangeError('Invalid typed array length')
  6192. }
  6193. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6194. // Return an augmented `Uint8Array` instance, for best performance
  6195. that = new Uint8Array(length)
  6196. that.__proto__ = Buffer.prototype
  6197. } else {
  6198. // Fallback: Return an object instance of the Buffer class
  6199. if (that === null) {
  6200. that = new Buffer(length)
  6201. }
  6202. that.length = length
  6203. }
  6204. return that
  6205. }
  6206. /**
  6207. * The Buffer constructor returns instances of `Uint8Array` that have their
  6208. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6209. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6210. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6211. * returns a single octet.
  6212. *
  6213. * The `Uint8Array` prototype remains unmodified.
  6214. */
  6215. function Buffer (arg, encodingOrOffset, length) {
  6216. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6217. return new Buffer(arg, encodingOrOffset, length)
  6218. }
  6219. // Common case.
  6220. if (typeof arg === 'number') {
  6221. if (typeof encodingOrOffset === 'string') {
  6222. throw new Error(
  6223. 'If encoding is specified then the first argument must be a string'
  6224. )
  6225. }
  6226. return allocUnsafe(this, arg)
  6227. }
  6228. return from(this, arg, encodingOrOffset, length)
  6229. }
  6230. Buffer.poolSize = 8192 // not used by this implementation
  6231. // TODO: Legacy, not needed anymore. Remove in next major version.
  6232. Buffer._augment = function (arr) {
  6233. arr.__proto__ = Buffer.prototype
  6234. return arr
  6235. }
  6236. function from (that, value, encodingOrOffset, length) {
  6237. if (typeof value === 'number') {
  6238. throw new TypeError('"value" argument must not be a number')
  6239. }
  6240. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6241. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6242. }
  6243. if (typeof value === 'string') {
  6244. return fromString(that, value, encodingOrOffset)
  6245. }
  6246. return fromObject(that, value)
  6247. }
  6248. /**
  6249. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6250. * if value is a number.
  6251. * Buffer.from(str[, encoding])
  6252. * Buffer.from(array)
  6253. * Buffer.from(buffer)
  6254. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6255. **/
  6256. Buffer.from = function (value, encodingOrOffset, length) {
  6257. return from(null, value, encodingOrOffset, length)
  6258. }
  6259. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6260. Buffer.prototype.__proto__ = Uint8Array.prototype
  6261. Buffer.__proto__ = Uint8Array
  6262. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6263. Buffer[Symbol.species] === Buffer) {
  6264. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6265. Object.defineProperty(Buffer, Symbol.species, {
  6266. value: null,
  6267. configurable: true
  6268. })
  6269. }
  6270. }
  6271. function assertSize (size) {
  6272. if (typeof size !== 'number') {
  6273. throw new TypeError('"size" argument must be a number')
  6274. } else if (size < 0) {
  6275. throw new RangeError('"size" argument must not be negative')
  6276. }
  6277. }
  6278. function alloc (that, size, fill, encoding) {
  6279. assertSize(size)
  6280. if (size <= 0) {
  6281. return createBuffer(that, size)
  6282. }
  6283. if (fill !== undefined) {
  6284. // Only pay attention to encoding if it's a string. This
  6285. // prevents accidentally sending in a number that would
  6286. // be interpretted as a start offset.
  6287. return typeof encoding === 'string'
  6288. ? createBuffer(that, size).fill(fill, encoding)
  6289. : createBuffer(that, size).fill(fill)
  6290. }
  6291. return createBuffer(that, size)
  6292. }
  6293. /**
  6294. * Creates a new filled Buffer instance.
  6295. * alloc(size[, fill[, encoding]])
  6296. **/
  6297. Buffer.alloc = function (size, fill, encoding) {
  6298. return alloc(null, size, fill, encoding)
  6299. }
  6300. function allocUnsafe (that, size) {
  6301. assertSize(size)
  6302. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6303. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6304. for (var i = 0; i < size; ++i) {
  6305. that[i] = 0
  6306. }
  6307. }
  6308. return that
  6309. }
  6310. /**
  6311. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6312. * */
  6313. Buffer.allocUnsafe = function (size) {
  6314. return allocUnsafe(null, size)
  6315. }
  6316. /**
  6317. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6318. */
  6319. Buffer.allocUnsafeSlow = function (size) {
  6320. return allocUnsafe(null, size)
  6321. }
  6322. function fromString (that, string, encoding) {
  6323. if (typeof encoding !== 'string' || encoding === '') {
  6324. encoding = 'utf8'
  6325. }
  6326. if (!Buffer.isEncoding(encoding)) {
  6327. throw new TypeError('"encoding" must be a valid string encoding')
  6328. }
  6329. var length = byteLength(string, encoding) | 0
  6330. that = createBuffer(that, length)
  6331. var actual = that.write(string, encoding)
  6332. if (actual !== length) {
  6333. // Writing a hex string, for example, that contains invalid characters will
  6334. // cause everything after the first invalid character to be ignored. (e.g.
  6335. // 'abxxcd' will be treated as 'ab')
  6336. that = that.slice(0, actual)
  6337. }
  6338. return that
  6339. }
  6340. function fromArrayLike (that, array) {
  6341. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6342. that = createBuffer(that, length)
  6343. for (var i = 0; i < length; i += 1) {
  6344. that[i] = array[i] & 255
  6345. }
  6346. return that
  6347. }
  6348. function fromArrayBuffer (that, array, byteOffset, length) {
  6349. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6350. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6351. throw new RangeError('\'offset\' is out of bounds')
  6352. }
  6353. if (array.byteLength < byteOffset + (length || 0)) {
  6354. throw new RangeError('\'length\' is out of bounds')
  6355. }
  6356. if (byteOffset === undefined && length === undefined) {
  6357. array = new Uint8Array(array)
  6358. } else if (length === undefined) {
  6359. array = new Uint8Array(array, byteOffset)
  6360. } else {
  6361. array = new Uint8Array(array, byteOffset, length)
  6362. }
  6363. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6364. // Return an augmented `Uint8Array` instance, for best performance
  6365. that = array
  6366. that.__proto__ = Buffer.prototype
  6367. } else {
  6368. // Fallback: Return an object instance of the Buffer class
  6369. that = fromArrayLike(that, array)
  6370. }
  6371. return that
  6372. }
  6373. function fromObject (that, obj) {
  6374. if (Buffer.isBuffer(obj)) {
  6375. var len = checked(obj.length) | 0
  6376. that = createBuffer(that, len)
  6377. if (that.length === 0) {
  6378. return that
  6379. }
  6380. obj.copy(that, 0, 0, len)
  6381. return that
  6382. }
  6383. if (obj) {
  6384. if ((typeof ArrayBuffer !== 'undefined' &&
  6385. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6386. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6387. return createBuffer(that, 0)
  6388. }
  6389. return fromArrayLike(that, obj)
  6390. }
  6391. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6392. return fromArrayLike(that, obj.data)
  6393. }
  6394. }
  6395. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6396. }
  6397. function checked (length) {
  6398. // Note: cannot use `length < kMaxLength()` here because that fails when
  6399. // length is NaN (which is otherwise coerced to zero.)
  6400. if (length >= kMaxLength()) {
  6401. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6402. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6403. }
  6404. return length | 0
  6405. }
  6406. function SlowBuffer (length) {
  6407. if (+length != length) { // eslint-disable-line eqeqeq
  6408. length = 0
  6409. }
  6410. return Buffer.alloc(+length)
  6411. }
  6412. Buffer.isBuffer = function isBuffer (b) {
  6413. return !!(b != null && b._isBuffer)
  6414. }
  6415. Buffer.compare = function compare (a, b) {
  6416. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6417. throw new TypeError('Arguments must be Buffers')
  6418. }
  6419. if (a === b) return 0
  6420. var x = a.length
  6421. var y = b.length
  6422. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6423. if (a[i] !== b[i]) {
  6424. x = a[i]
  6425. y = b[i]
  6426. break
  6427. }
  6428. }
  6429. if (x < y) return -1
  6430. if (y < x) return 1
  6431. return 0
  6432. }
  6433. Buffer.isEncoding = function isEncoding (encoding) {
  6434. switch (String(encoding).toLowerCase()) {
  6435. case 'hex':
  6436. case 'utf8':
  6437. case 'utf-8':
  6438. case 'ascii':
  6439. case 'latin1':
  6440. case 'binary':
  6441. case 'base64':
  6442. case 'ucs2':
  6443. case 'ucs-2':
  6444. case 'utf16le':
  6445. case 'utf-16le':
  6446. return true
  6447. default:
  6448. return false
  6449. }
  6450. }
  6451. Buffer.concat = function concat (list, length) {
  6452. if (!isArray(list)) {
  6453. throw new TypeError('"list" argument must be an Array of Buffers')
  6454. }
  6455. if (list.length === 0) {
  6456. return Buffer.alloc(0)
  6457. }
  6458. var i
  6459. if (length === undefined) {
  6460. length = 0
  6461. for (i = 0; i < list.length; ++i) {
  6462. length += list[i].length
  6463. }
  6464. }
  6465. var buffer = Buffer.allocUnsafe(length)
  6466. var pos = 0
  6467. for (i = 0; i < list.length; ++i) {
  6468. var buf = list[i]
  6469. if (!Buffer.isBuffer(buf)) {
  6470. throw new TypeError('"list" argument must be an Array of Buffers')
  6471. }
  6472. buf.copy(buffer, pos)
  6473. pos += buf.length
  6474. }
  6475. return buffer
  6476. }
  6477. function byteLength (string, encoding) {
  6478. if (Buffer.isBuffer(string)) {
  6479. return string.length
  6480. }
  6481. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6482. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6483. return string.byteLength
  6484. }
  6485. if (typeof string !== 'string') {
  6486. string = '' + string
  6487. }
  6488. var len = string.length
  6489. if (len === 0) return 0
  6490. // Use a for loop to avoid recursion
  6491. var loweredCase = false
  6492. for (;;) {
  6493. switch (encoding) {
  6494. case 'ascii':
  6495. case 'latin1':
  6496. case 'binary':
  6497. return len
  6498. case 'utf8':
  6499. case 'utf-8':
  6500. case undefined:
  6501. return utf8ToBytes(string).length
  6502. case 'ucs2':
  6503. case 'ucs-2':
  6504. case 'utf16le':
  6505. case 'utf-16le':
  6506. return len * 2
  6507. case 'hex':
  6508. return len >>> 1
  6509. case 'base64':
  6510. return base64ToBytes(string).length
  6511. default:
  6512. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6513. encoding = ('' + encoding).toLowerCase()
  6514. loweredCase = true
  6515. }
  6516. }
  6517. }
  6518. Buffer.byteLength = byteLength
  6519. function slowToString (encoding, start, end) {
  6520. var loweredCase = false
  6521. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6522. // property of a typed array.
  6523. // This behaves neither like String nor Uint8Array in that we set start/end
  6524. // to their upper/lower bounds if the value passed is out of range.
  6525. // undefined is handled specially as per ECMA-262 6th Edition,
  6526. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6527. if (start === undefined || start < 0) {
  6528. start = 0
  6529. }
  6530. // Return early if start > this.length. Done here to prevent potential uint32
  6531. // coercion fail below.
  6532. if (start > this.length) {
  6533. return ''
  6534. }
  6535. if (end === undefined || end > this.length) {
  6536. end = this.length
  6537. }
  6538. if (end <= 0) {
  6539. return ''
  6540. }
  6541. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6542. end >>>= 0
  6543. start >>>= 0
  6544. if (end <= start) {
  6545. return ''
  6546. }
  6547. if (!encoding) encoding = 'utf8'
  6548. while (true) {
  6549. switch (encoding) {
  6550. case 'hex':
  6551. return hexSlice(this, start, end)
  6552. case 'utf8':
  6553. case 'utf-8':
  6554. return utf8Slice(this, start, end)
  6555. case 'ascii':
  6556. return asciiSlice(this, start, end)
  6557. case 'latin1':
  6558. case 'binary':
  6559. return latin1Slice(this, start, end)
  6560. case 'base64':
  6561. return base64Slice(this, start, end)
  6562. case 'ucs2':
  6563. case 'ucs-2':
  6564. case 'utf16le':
  6565. case 'utf-16le':
  6566. return utf16leSlice(this, start, end)
  6567. default:
  6568. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6569. encoding = (encoding + '').toLowerCase()
  6570. loweredCase = true
  6571. }
  6572. }
  6573. }
  6574. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6575. // Buffer instances.
  6576. Buffer.prototype._isBuffer = true
  6577. function swap (b, n, m) {
  6578. var i = b[n]
  6579. b[n] = b[m]
  6580. b[m] = i
  6581. }
  6582. Buffer.prototype.swap16 = function swap16 () {
  6583. var len = this.length
  6584. if (len % 2 !== 0) {
  6585. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6586. }
  6587. for (var i = 0; i < len; i += 2) {
  6588. swap(this, i, i + 1)
  6589. }
  6590. return this
  6591. }
  6592. Buffer.prototype.swap32 = function swap32 () {
  6593. var len = this.length
  6594. if (len % 4 !== 0) {
  6595. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6596. }
  6597. for (var i = 0; i < len; i += 4) {
  6598. swap(this, i, i + 3)
  6599. swap(this, i + 1, i + 2)
  6600. }
  6601. return this
  6602. }
  6603. Buffer.prototype.swap64 = function swap64 () {
  6604. var len = this.length
  6605. if (len % 8 !== 0) {
  6606. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6607. }
  6608. for (var i = 0; i < len; i += 8) {
  6609. swap(this, i, i + 7)
  6610. swap(this, i + 1, i + 6)
  6611. swap(this, i + 2, i + 5)
  6612. swap(this, i + 3, i + 4)
  6613. }
  6614. return this
  6615. }
  6616. Buffer.prototype.toString = function toString () {
  6617. var length = this.length | 0
  6618. if (length === 0) return ''
  6619. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6620. return slowToString.apply(this, arguments)
  6621. }
  6622. Buffer.prototype.equals = function equals (b) {
  6623. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6624. if (this === b) return true
  6625. return Buffer.compare(this, b) === 0
  6626. }
  6627. Buffer.prototype.inspect = function inspect () {
  6628. var str = ''
  6629. var max = exports.INSPECT_MAX_BYTES
  6630. if (this.length > 0) {
  6631. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6632. if (this.length > max) str += ' ... '
  6633. }
  6634. return '<Buffer ' + str + '>'
  6635. }
  6636. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6637. if (!Buffer.isBuffer(target)) {
  6638. throw new TypeError('Argument must be a Buffer')
  6639. }
  6640. if (start === undefined) {
  6641. start = 0
  6642. }
  6643. if (end === undefined) {
  6644. end = target ? target.length : 0
  6645. }
  6646. if (thisStart === undefined) {
  6647. thisStart = 0
  6648. }
  6649. if (thisEnd === undefined) {
  6650. thisEnd = this.length
  6651. }
  6652. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6653. throw new RangeError('out of range index')
  6654. }
  6655. if (thisStart >= thisEnd && start >= end) {
  6656. return 0
  6657. }
  6658. if (thisStart >= thisEnd) {
  6659. return -1
  6660. }
  6661. if (start >= end) {
  6662. return 1
  6663. }
  6664. start >>>= 0
  6665. end >>>= 0
  6666. thisStart >>>= 0
  6667. thisEnd >>>= 0
  6668. if (this === target) return 0
  6669. var x = thisEnd - thisStart
  6670. var y = end - start
  6671. var len = Math.min(x, y)
  6672. var thisCopy = this.slice(thisStart, thisEnd)
  6673. var targetCopy = target.slice(start, end)
  6674. for (var i = 0; i < len; ++i) {
  6675. if (thisCopy[i] !== targetCopy[i]) {
  6676. x = thisCopy[i]
  6677. y = targetCopy[i]
  6678. break
  6679. }
  6680. }
  6681. if (x < y) return -1
  6682. if (y < x) return 1
  6683. return 0
  6684. }
  6685. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6686. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6687. //
  6688. // Arguments:
  6689. // - buffer - a Buffer to search
  6690. // - val - a string, Buffer, or number
  6691. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6692. // - encoding - an optional encoding, relevant is val is a string
  6693. // - dir - true for indexOf, false for lastIndexOf
  6694. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6695. // Empty buffer means no match
  6696. if (buffer.length === 0) return -1
  6697. // Normalize byteOffset
  6698. if (typeof byteOffset === 'string') {
  6699. encoding = byteOffset
  6700. byteOffset = 0
  6701. } else if (byteOffset > 0x7fffffff) {
  6702. byteOffset = 0x7fffffff
  6703. } else if (byteOffset < -0x80000000) {
  6704. byteOffset = -0x80000000
  6705. }
  6706. byteOffset = +byteOffset // Coerce to Number.
  6707. if (isNaN(byteOffset)) {
  6708. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6709. byteOffset = dir ? 0 : (buffer.length - 1)
  6710. }
  6711. // Normalize byteOffset: negative offsets start from the end of the buffer
  6712. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6713. if (byteOffset >= buffer.length) {
  6714. if (dir) return -1
  6715. else byteOffset = buffer.length - 1
  6716. } else if (byteOffset < 0) {
  6717. if (dir) byteOffset = 0
  6718. else return -1
  6719. }
  6720. // Normalize val
  6721. if (typeof val === 'string') {
  6722. val = Buffer.from(val, encoding)
  6723. }
  6724. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6725. if (Buffer.isBuffer(val)) {
  6726. // Special case: looking for empty string/buffer always fails
  6727. if (val.length === 0) {
  6728. return -1
  6729. }
  6730. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6731. } else if (typeof val === 'number') {
  6732. val = val & 0xFF // Search for a byte value [0-255]
  6733. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6734. typeof Uint8Array.prototype.indexOf === 'function') {
  6735. if (dir) {
  6736. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6737. } else {
  6738. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6739. }
  6740. }
  6741. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6742. }
  6743. throw new TypeError('val must be string, number or Buffer')
  6744. }
  6745. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6746. var indexSize = 1
  6747. var arrLength = arr.length
  6748. var valLength = val.length
  6749. if (encoding !== undefined) {
  6750. encoding = String(encoding).toLowerCase()
  6751. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6752. encoding === 'utf16le' || encoding === 'utf-16le') {
  6753. if (arr.length < 2 || val.length < 2) {
  6754. return -1
  6755. }
  6756. indexSize = 2
  6757. arrLength /= 2
  6758. valLength /= 2
  6759. byteOffset /= 2
  6760. }
  6761. }
  6762. function read (buf, i) {
  6763. if (indexSize === 1) {
  6764. return buf[i]
  6765. } else {
  6766. return buf.readUInt16BE(i * indexSize)
  6767. }
  6768. }
  6769. var i
  6770. if (dir) {
  6771. var foundIndex = -1
  6772. for (i = byteOffset; i < arrLength; i++) {
  6773. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6774. if (foundIndex === -1) foundIndex = i
  6775. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6776. } else {
  6777. if (foundIndex !== -1) i -= i - foundIndex
  6778. foundIndex = -1
  6779. }
  6780. }
  6781. } else {
  6782. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6783. for (i = byteOffset; i >= 0; i--) {
  6784. var found = true
  6785. for (var j = 0; j < valLength; j++) {
  6786. if (read(arr, i + j) !== read(val, j)) {
  6787. found = false
  6788. break
  6789. }
  6790. }
  6791. if (found) return i
  6792. }
  6793. }
  6794. return -1
  6795. }
  6796. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6797. return this.indexOf(val, byteOffset, encoding) !== -1
  6798. }
  6799. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6800. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6801. }
  6802. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6803. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6804. }
  6805. function hexWrite (buf, string, offset, length) {
  6806. offset = Number(offset) || 0
  6807. var remaining = buf.length - offset
  6808. if (!length) {
  6809. length = remaining
  6810. } else {
  6811. length = Number(length)
  6812. if (length > remaining) {
  6813. length = remaining
  6814. }
  6815. }
  6816. // must be an even number of digits
  6817. var strLen = string.length
  6818. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6819. if (length > strLen / 2) {
  6820. length = strLen / 2
  6821. }
  6822. for (var i = 0; i < length; ++i) {
  6823. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6824. if (isNaN(parsed)) return i
  6825. buf[offset + i] = parsed
  6826. }
  6827. return i
  6828. }
  6829. function utf8Write (buf, string, offset, length) {
  6830. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6831. }
  6832. function asciiWrite (buf, string, offset, length) {
  6833. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6834. }
  6835. function latin1Write (buf, string, offset, length) {
  6836. return asciiWrite(buf, string, offset, length)
  6837. }
  6838. function base64Write (buf, string, offset, length) {
  6839. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6840. }
  6841. function ucs2Write (buf, string, offset, length) {
  6842. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6843. }
  6844. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6845. // Buffer#write(string)
  6846. if (offset === undefined) {
  6847. encoding = 'utf8'
  6848. length = this.length
  6849. offset = 0
  6850. // Buffer#write(string, encoding)
  6851. } else if (length === undefined && typeof offset === 'string') {
  6852. encoding = offset
  6853. length = this.length
  6854. offset = 0
  6855. // Buffer#write(string, offset[, length][, encoding])
  6856. } else if (isFinite(offset)) {
  6857. offset = offset | 0
  6858. if (isFinite(length)) {
  6859. length = length | 0
  6860. if (encoding === undefined) encoding = 'utf8'
  6861. } else {
  6862. encoding = length
  6863. length = undefined
  6864. }
  6865. // legacy write(string, encoding, offset, length) - remove in v0.13
  6866. } else {
  6867. throw new Error(
  6868. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6869. )
  6870. }
  6871. var remaining = this.length - offset
  6872. if (length === undefined || length > remaining) length = remaining
  6873. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6874. throw new RangeError('Attempt to write outside buffer bounds')
  6875. }
  6876. if (!encoding) encoding = 'utf8'
  6877. var loweredCase = false
  6878. for (;;) {
  6879. switch (encoding) {
  6880. case 'hex':
  6881. return hexWrite(this, string, offset, length)
  6882. case 'utf8':
  6883. case 'utf-8':
  6884. return utf8Write(this, string, offset, length)
  6885. case 'ascii':
  6886. return asciiWrite(this, string, offset, length)
  6887. case 'latin1':
  6888. case 'binary':
  6889. return latin1Write(this, string, offset, length)
  6890. case 'base64':
  6891. // Warning: maxLength not taken into account in base64Write
  6892. return base64Write(this, string, offset, length)
  6893. case 'ucs2':
  6894. case 'ucs-2':
  6895. case 'utf16le':
  6896. case 'utf-16le':
  6897. return ucs2Write(this, string, offset, length)
  6898. default:
  6899. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6900. encoding = ('' + encoding).toLowerCase()
  6901. loweredCase = true
  6902. }
  6903. }
  6904. }
  6905. Buffer.prototype.toJSON = function toJSON () {
  6906. return {
  6907. type: 'Buffer',
  6908. data: Array.prototype.slice.call(this._arr || this, 0)
  6909. }
  6910. }
  6911. function base64Slice (buf, start, end) {
  6912. if (start === 0 && end === buf.length) {
  6913. return base64.fromByteArray(buf)
  6914. } else {
  6915. return base64.fromByteArray(buf.slice(start, end))
  6916. }
  6917. }
  6918. function utf8Slice (buf, start, end) {
  6919. end = Math.min(buf.length, end)
  6920. var res = []
  6921. var i = start
  6922. while (i < end) {
  6923. var firstByte = buf[i]
  6924. var codePoint = null
  6925. var bytesPerSequence = (firstByte > 0xEF) ? 4
  6926. : (firstByte > 0xDF) ? 3
  6927. : (firstByte > 0xBF) ? 2
  6928. : 1
  6929. if (i + bytesPerSequence <= end) {
  6930. var secondByte, thirdByte, fourthByte, tempCodePoint
  6931. switch (bytesPerSequence) {
  6932. case 1:
  6933. if (firstByte < 0x80) {
  6934. codePoint = firstByte
  6935. }
  6936. break
  6937. case 2:
  6938. secondByte = buf[i + 1]
  6939. if ((secondByte & 0xC0) === 0x80) {
  6940. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  6941. if (tempCodePoint > 0x7F) {
  6942. codePoint = tempCodePoint
  6943. }
  6944. }
  6945. break
  6946. case 3:
  6947. secondByte = buf[i + 1]
  6948. thirdByte = buf[i + 2]
  6949. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  6950. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  6951. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  6952. codePoint = tempCodePoint
  6953. }
  6954. }
  6955. break
  6956. case 4:
  6957. secondByte = buf[i + 1]
  6958. thirdByte = buf[i + 2]
  6959. fourthByte = buf[i + 3]
  6960. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  6961. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  6962. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  6963. codePoint = tempCodePoint
  6964. }
  6965. }
  6966. }
  6967. }
  6968. if (codePoint === null) {
  6969. // we did not generate a valid codePoint so insert a
  6970. // replacement char (U+FFFD) and advance only 1 byte
  6971. codePoint = 0xFFFD
  6972. bytesPerSequence = 1
  6973. } else if (codePoint > 0xFFFF) {
  6974. // encode to utf16 (surrogate pair dance)
  6975. codePoint -= 0x10000
  6976. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  6977. codePoint = 0xDC00 | codePoint & 0x3FF
  6978. }
  6979. res.push(codePoint)
  6980. i += bytesPerSequence
  6981. }
  6982. return decodeCodePointsArray(res)
  6983. }
  6984. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  6985. // the lowest limit is Chrome, with 0x10000 args.
  6986. // We go 1 magnitude less, for safety
  6987. var MAX_ARGUMENTS_LENGTH = 0x1000
  6988. function decodeCodePointsArray (codePoints) {
  6989. var len = codePoints.length
  6990. if (len <= MAX_ARGUMENTS_LENGTH) {
  6991. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  6992. }
  6993. // Decode in chunks to avoid "call stack size exceeded".
  6994. var res = ''
  6995. var i = 0
  6996. while (i < len) {
  6997. res += String.fromCharCode.apply(
  6998. String,
  6999. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7000. )
  7001. }
  7002. return res
  7003. }
  7004. function asciiSlice (buf, start, end) {
  7005. var ret = ''
  7006. end = Math.min(buf.length, end)
  7007. for (var i = start; i < end; ++i) {
  7008. ret += String.fromCharCode(buf[i] & 0x7F)
  7009. }
  7010. return ret
  7011. }
  7012. function latin1Slice (buf, start, end) {
  7013. var ret = ''
  7014. end = Math.min(buf.length, end)
  7015. for (var i = start; i < end; ++i) {
  7016. ret += String.fromCharCode(buf[i])
  7017. }
  7018. return ret
  7019. }
  7020. function hexSlice (buf, start, end) {
  7021. var len = buf.length
  7022. if (!start || start < 0) start = 0
  7023. if (!end || end < 0 || end > len) end = len
  7024. var out = ''
  7025. for (var i = start; i < end; ++i) {
  7026. out += toHex(buf[i])
  7027. }
  7028. return out
  7029. }
  7030. function utf16leSlice (buf, start, end) {
  7031. var bytes = buf.slice(start, end)
  7032. var res = ''
  7033. for (var i = 0; i < bytes.length; i += 2) {
  7034. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7035. }
  7036. return res
  7037. }
  7038. Buffer.prototype.slice = function slice (start, end) {
  7039. var len = this.length
  7040. start = ~~start
  7041. end = end === undefined ? len : ~~end
  7042. if (start < 0) {
  7043. start += len
  7044. if (start < 0) start = 0
  7045. } else if (start > len) {
  7046. start = len
  7047. }
  7048. if (end < 0) {
  7049. end += len
  7050. if (end < 0) end = 0
  7051. } else if (end > len) {
  7052. end = len
  7053. }
  7054. if (end < start) end = start
  7055. var newBuf
  7056. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7057. newBuf = this.subarray(start, end)
  7058. newBuf.__proto__ = Buffer.prototype
  7059. } else {
  7060. var sliceLen = end - start
  7061. newBuf = new Buffer(sliceLen, undefined)
  7062. for (var i = 0; i < sliceLen; ++i) {
  7063. newBuf[i] = this[i + start]
  7064. }
  7065. }
  7066. return newBuf
  7067. }
  7068. /*
  7069. * Need to make sure that buffer isn't trying to write out of bounds.
  7070. */
  7071. function checkOffset (offset, ext, length) {
  7072. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7073. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7074. }
  7075. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7076. offset = offset | 0
  7077. byteLength = byteLength | 0
  7078. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7079. var val = this[offset]
  7080. var mul = 1
  7081. var i = 0
  7082. while (++i < byteLength && (mul *= 0x100)) {
  7083. val += this[offset + i] * mul
  7084. }
  7085. return val
  7086. }
  7087. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7088. offset = offset | 0
  7089. byteLength = byteLength | 0
  7090. if (!noAssert) {
  7091. checkOffset(offset, byteLength, this.length)
  7092. }
  7093. var val = this[offset + --byteLength]
  7094. var mul = 1
  7095. while (byteLength > 0 && (mul *= 0x100)) {
  7096. val += this[offset + --byteLength] * mul
  7097. }
  7098. return val
  7099. }
  7100. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7101. if (!noAssert) checkOffset(offset, 1, this.length)
  7102. return this[offset]
  7103. }
  7104. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7105. if (!noAssert) checkOffset(offset, 2, this.length)
  7106. return this[offset] | (this[offset + 1] << 8)
  7107. }
  7108. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7109. if (!noAssert) checkOffset(offset, 2, this.length)
  7110. return (this[offset] << 8) | this[offset + 1]
  7111. }
  7112. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7113. if (!noAssert) checkOffset(offset, 4, this.length)
  7114. return ((this[offset]) |
  7115. (this[offset + 1] << 8) |
  7116. (this[offset + 2] << 16)) +
  7117. (this[offset + 3] * 0x1000000)
  7118. }
  7119. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7120. if (!noAssert) checkOffset(offset, 4, this.length)
  7121. return (this[offset] * 0x1000000) +
  7122. ((this[offset + 1] << 16) |
  7123. (this[offset + 2] << 8) |
  7124. this[offset + 3])
  7125. }
  7126. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7127. offset = offset | 0
  7128. byteLength = byteLength | 0
  7129. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7130. var val = this[offset]
  7131. var mul = 1
  7132. var i = 0
  7133. while (++i < byteLength && (mul *= 0x100)) {
  7134. val += this[offset + i] * mul
  7135. }
  7136. mul *= 0x80
  7137. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7138. return val
  7139. }
  7140. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7141. offset = offset | 0
  7142. byteLength = byteLength | 0
  7143. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7144. var i = byteLength
  7145. var mul = 1
  7146. var val = this[offset + --i]
  7147. while (i > 0 && (mul *= 0x100)) {
  7148. val += this[offset + --i] * mul
  7149. }
  7150. mul *= 0x80
  7151. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7152. return val
  7153. }
  7154. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7155. if (!noAssert) checkOffset(offset, 1, this.length)
  7156. if (!(this[offset] & 0x80)) return (this[offset])
  7157. return ((0xff - this[offset] + 1) * -1)
  7158. }
  7159. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7160. if (!noAssert) checkOffset(offset, 2, this.length)
  7161. var val = this[offset] | (this[offset + 1] << 8)
  7162. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7163. }
  7164. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7165. if (!noAssert) checkOffset(offset, 2, this.length)
  7166. var val = this[offset + 1] | (this[offset] << 8)
  7167. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7168. }
  7169. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7170. if (!noAssert) checkOffset(offset, 4, this.length)
  7171. return (this[offset]) |
  7172. (this[offset + 1] << 8) |
  7173. (this[offset + 2] << 16) |
  7174. (this[offset + 3] << 24)
  7175. }
  7176. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7177. if (!noAssert) checkOffset(offset, 4, this.length)
  7178. return (this[offset] << 24) |
  7179. (this[offset + 1] << 16) |
  7180. (this[offset + 2] << 8) |
  7181. (this[offset + 3])
  7182. }
  7183. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7184. if (!noAssert) checkOffset(offset, 4, this.length)
  7185. return ieee754.read(this, offset, true, 23, 4)
  7186. }
  7187. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7188. if (!noAssert) checkOffset(offset, 4, this.length)
  7189. return ieee754.read(this, offset, false, 23, 4)
  7190. }
  7191. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7192. if (!noAssert) checkOffset(offset, 8, this.length)
  7193. return ieee754.read(this, offset, true, 52, 8)
  7194. }
  7195. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7196. if (!noAssert) checkOffset(offset, 8, this.length)
  7197. return ieee754.read(this, offset, false, 52, 8)
  7198. }
  7199. function checkInt (buf, value, offset, ext, max, min) {
  7200. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7201. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7202. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7203. }
  7204. Buffer.prototype.writeUIntLE = function writeUIntLE (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 mul = 1
  7213. var i = 0
  7214. this[offset] = value & 0xFF
  7215. while (++i < byteLength && (mul *= 0x100)) {
  7216. this[offset + i] = (value / mul) & 0xFF
  7217. }
  7218. return offset + byteLength
  7219. }
  7220. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7221. value = +value
  7222. offset = offset | 0
  7223. byteLength = byteLength | 0
  7224. if (!noAssert) {
  7225. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7226. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7227. }
  7228. var i = byteLength - 1
  7229. var mul = 1
  7230. this[offset + i] = value & 0xFF
  7231. while (--i >= 0 && (mul *= 0x100)) {
  7232. this[offset + i] = (value / mul) & 0xFF
  7233. }
  7234. return offset + byteLength
  7235. }
  7236. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7237. value = +value
  7238. offset = offset | 0
  7239. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7240. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7241. this[offset] = (value & 0xff)
  7242. return offset + 1
  7243. }
  7244. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7245. if (value < 0) value = 0xffff + value + 1
  7246. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7247. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7248. (littleEndian ? i : 1 - i) * 8
  7249. }
  7250. }
  7251. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7252. value = +value
  7253. offset = offset | 0
  7254. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7255. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7256. this[offset] = (value & 0xff)
  7257. this[offset + 1] = (value >>> 8)
  7258. } else {
  7259. objectWriteUInt16(this, value, offset, true)
  7260. }
  7261. return offset + 2
  7262. }
  7263. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7264. value = +value
  7265. offset = offset | 0
  7266. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7267. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7268. this[offset] = (value >>> 8)
  7269. this[offset + 1] = (value & 0xff)
  7270. } else {
  7271. objectWriteUInt16(this, value, offset, false)
  7272. }
  7273. return offset + 2
  7274. }
  7275. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7276. if (value < 0) value = 0xffffffff + value + 1
  7277. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7278. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7279. }
  7280. }
  7281. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7282. value = +value
  7283. offset = offset | 0
  7284. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7285. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7286. this[offset + 3] = (value >>> 24)
  7287. this[offset + 2] = (value >>> 16)
  7288. this[offset + 1] = (value >>> 8)
  7289. this[offset] = (value & 0xff)
  7290. } else {
  7291. objectWriteUInt32(this, value, offset, true)
  7292. }
  7293. return offset + 4
  7294. }
  7295. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7296. value = +value
  7297. offset = offset | 0
  7298. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7299. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7300. this[offset] = (value >>> 24)
  7301. this[offset + 1] = (value >>> 16)
  7302. this[offset + 2] = (value >>> 8)
  7303. this[offset + 3] = (value & 0xff)
  7304. } else {
  7305. objectWriteUInt32(this, value, offset, false)
  7306. }
  7307. return offset + 4
  7308. }
  7309. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7310. value = +value
  7311. offset = offset | 0
  7312. if (!noAssert) {
  7313. var limit = Math.pow(2, 8 * byteLength - 1)
  7314. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7315. }
  7316. var i = 0
  7317. var mul = 1
  7318. var sub = 0
  7319. this[offset] = value & 0xFF
  7320. while (++i < byteLength && (mul *= 0x100)) {
  7321. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7322. sub = 1
  7323. }
  7324. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7325. }
  7326. return offset + byteLength
  7327. }
  7328. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7329. value = +value
  7330. offset = offset | 0
  7331. if (!noAssert) {
  7332. var limit = Math.pow(2, 8 * byteLength - 1)
  7333. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7334. }
  7335. var i = byteLength - 1
  7336. var mul = 1
  7337. var sub = 0
  7338. this[offset + i] = value & 0xFF
  7339. while (--i >= 0 && (mul *= 0x100)) {
  7340. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7341. sub = 1
  7342. }
  7343. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7344. }
  7345. return offset + byteLength
  7346. }
  7347. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7348. value = +value
  7349. offset = offset | 0
  7350. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7351. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7352. if (value < 0) value = 0xff + value + 1
  7353. this[offset] = (value & 0xff)
  7354. return offset + 1
  7355. }
  7356. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7357. value = +value
  7358. offset = offset | 0
  7359. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7360. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7361. this[offset] = (value & 0xff)
  7362. this[offset + 1] = (value >>> 8)
  7363. } else {
  7364. objectWriteUInt16(this, value, offset, true)
  7365. }
  7366. return offset + 2
  7367. }
  7368. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7369. value = +value
  7370. offset = offset | 0
  7371. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7372. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7373. this[offset] = (value >>> 8)
  7374. this[offset + 1] = (value & 0xff)
  7375. } else {
  7376. objectWriteUInt16(this, value, offset, false)
  7377. }
  7378. return offset + 2
  7379. }
  7380. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7381. value = +value
  7382. offset = offset | 0
  7383. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7384. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7385. this[offset] = (value & 0xff)
  7386. this[offset + 1] = (value >>> 8)
  7387. this[offset + 2] = (value >>> 16)
  7388. this[offset + 3] = (value >>> 24)
  7389. } else {
  7390. objectWriteUInt32(this, value, offset, true)
  7391. }
  7392. return offset + 4
  7393. }
  7394. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7395. value = +value
  7396. offset = offset | 0
  7397. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7398. if (value < 0) value = 0xffffffff + value + 1
  7399. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7400. this[offset] = (value >>> 24)
  7401. this[offset + 1] = (value >>> 16)
  7402. this[offset + 2] = (value >>> 8)
  7403. this[offset + 3] = (value & 0xff)
  7404. } else {
  7405. objectWriteUInt32(this, value, offset, false)
  7406. }
  7407. return offset + 4
  7408. }
  7409. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7410. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7411. if (offset < 0) throw new RangeError('Index out of range')
  7412. }
  7413. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7414. if (!noAssert) {
  7415. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7416. }
  7417. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7418. return offset + 4
  7419. }
  7420. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7421. return writeFloat(this, value, offset, true, noAssert)
  7422. }
  7423. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7424. return writeFloat(this, value, offset, false, noAssert)
  7425. }
  7426. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7427. if (!noAssert) {
  7428. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7429. }
  7430. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7431. return offset + 8
  7432. }
  7433. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7434. return writeDouble(this, value, offset, true, noAssert)
  7435. }
  7436. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7437. return writeDouble(this, value, offset, false, noAssert)
  7438. }
  7439. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7440. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7441. if (!start) start = 0
  7442. if (!end && end !== 0) end = this.length
  7443. if (targetStart >= target.length) targetStart = target.length
  7444. if (!targetStart) targetStart = 0
  7445. if (end > 0 && end < start) end = start
  7446. // Copy 0 bytes; we're done
  7447. if (end === start) return 0
  7448. if (target.length === 0 || this.length === 0) return 0
  7449. // Fatal error conditions
  7450. if (targetStart < 0) {
  7451. throw new RangeError('targetStart out of bounds')
  7452. }
  7453. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7454. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7455. // Are we oob?
  7456. if (end > this.length) end = this.length
  7457. if (target.length - targetStart < end - start) {
  7458. end = target.length - targetStart + start
  7459. }
  7460. var len = end - start
  7461. var i
  7462. if (this === target && start < targetStart && targetStart < end) {
  7463. // descending copy from end
  7464. for (i = len - 1; i >= 0; --i) {
  7465. target[i + targetStart] = this[i + start]
  7466. }
  7467. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7468. // ascending copy from start
  7469. for (i = 0; i < len; ++i) {
  7470. target[i + targetStart] = this[i + start]
  7471. }
  7472. } else {
  7473. Uint8Array.prototype.set.call(
  7474. target,
  7475. this.subarray(start, start + len),
  7476. targetStart
  7477. )
  7478. }
  7479. return len
  7480. }
  7481. // Usage:
  7482. // buffer.fill(number[, offset[, end]])
  7483. // buffer.fill(buffer[, offset[, end]])
  7484. // buffer.fill(string[, offset[, end]][, encoding])
  7485. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7486. // Handle string cases:
  7487. if (typeof val === 'string') {
  7488. if (typeof start === 'string') {
  7489. encoding = start
  7490. start = 0
  7491. end = this.length
  7492. } else if (typeof end === 'string') {
  7493. encoding = end
  7494. end = this.length
  7495. }
  7496. if (val.length === 1) {
  7497. var code = val.charCodeAt(0)
  7498. if (code < 256) {
  7499. val = code
  7500. }
  7501. }
  7502. if (encoding !== undefined && typeof encoding !== 'string') {
  7503. throw new TypeError('encoding must be a string')
  7504. }
  7505. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7506. throw new TypeError('Unknown encoding: ' + encoding)
  7507. }
  7508. } else if (typeof val === 'number') {
  7509. val = val & 255
  7510. }
  7511. // Invalid ranges are not set to a default, so can range check early.
  7512. if (start < 0 || this.length < start || this.length < end) {
  7513. throw new RangeError('Out of range index')
  7514. }
  7515. if (end <= start) {
  7516. return this
  7517. }
  7518. start = start >>> 0
  7519. end = end === undefined ? this.length : end >>> 0
  7520. if (!val) val = 0
  7521. var i
  7522. if (typeof val === 'number') {
  7523. for (i = start; i < end; ++i) {
  7524. this[i] = val
  7525. }
  7526. } else {
  7527. var bytes = Buffer.isBuffer(val)
  7528. ? val
  7529. : utf8ToBytes(new Buffer(val, encoding).toString())
  7530. var len = bytes.length
  7531. for (i = 0; i < end - start; ++i) {
  7532. this[i + start] = bytes[i % len]
  7533. }
  7534. }
  7535. return this
  7536. }
  7537. // HELPER FUNCTIONS
  7538. // ================
  7539. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7540. function base64clean (str) {
  7541. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7542. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7543. // Node converts strings with length < 2 to ''
  7544. if (str.length < 2) return ''
  7545. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7546. while (str.length % 4 !== 0) {
  7547. str = str + '='
  7548. }
  7549. return str
  7550. }
  7551. function stringtrim (str) {
  7552. if (str.trim) return str.trim()
  7553. return str.replace(/^\s+|\s+$/g, '')
  7554. }
  7555. function toHex (n) {
  7556. if (n < 16) return '0' + n.toString(16)
  7557. return n.toString(16)
  7558. }
  7559. function utf8ToBytes (string, units) {
  7560. units = units || Infinity
  7561. var codePoint
  7562. var length = string.length
  7563. var leadSurrogate = null
  7564. var bytes = []
  7565. for (var i = 0; i < length; ++i) {
  7566. codePoint = string.charCodeAt(i)
  7567. // is surrogate component
  7568. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7569. // last char was a lead
  7570. if (!leadSurrogate) {
  7571. // no lead yet
  7572. if (codePoint > 0xDBFF) {
  7573. // unexpected trail
  7574. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7575. continue
  7576. } else if (i + 1 === length) {
  7577. // unpaired lead
  7578. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7579. continue
  7580. }
  7581. // valid lead
  7582. leadSurrogate = codePoint
  7583. continue
  7584. }
  7585. // 2 leads in a row
  7586. if (codePoint < 0xDC00) {
  7587. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7588. leadSurrogate = codePoint
  7589. continue
  7590. }
  7591. // valid surrogate pair
  7592. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7593. } else if (leadSurrogate) {
  7594. // valid bmp char, but last char was a lead
  7595. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7596. }
  7597. leadSurrogate = null
  7598. // encode utf8
  7599. if (codePoint < 0x80) {
  7600. if ((units -= 1) < 0) break
  7601. bytes.push(codePoint)
  7602. } else if (codePoint < 0x800) {
  7603. if ((units -= 2) < 0) break
  7604. bytes.push(
  7605. codePoint >> 0x6 | 0xC0,
  7606. codePoint & 0x3F | 0x80
  7607. )
  7608. } else if (codePoint < 0x10000) {
  7609. if ((units -= 3) < 0) break
  7610. bytes.push(
  7611. codePoint >> 0xC | 0xE0,
  7612. codePoint >> 0x6 & 0x3F | 0x80,
  7613. codePoint & 0x3F | 0x80
  7614. )
  7615. } else if (codePoint < 0x110000) {
  7616. if ((units -= 4) < 0) break
  7617. bytes.push(
  7618. codePoint >> 0x12 | 0xF0,
  7619. codePoint >> 0xC & 0x3F | 0x80,
  7620. codePoint >> 0x6 & 0x3F | 0x80,
  7621. codePoint & 0x3F | 0x80
  7622. )
  7623. } else {
  7624. throw new Error('Invalid code point')
  7625. }
  7626. }
  7627. return bytes
  7628. }
  7629. function asciiToBytes (str) {
  7630. var byteArray = []
  7631. for (var i = 0; i < str.length; ++i) {
  7632. // Node's code seems to be doing this and not & 0x7F..
  7633. byteArray.push(str.charCodeAt(i) & 0xFF)
  7634. }
  7635. return byteArray
  7636. }
  7637. function utf16leToBytes (str, units) {
  7638. var c, hi, lo
  7639. var byteArray = []
  7640. for (var i = 0; i < str.length; ++i) {
  7641. if ((units -= 2) < 0) break
  7642. c = str.charCodeAt(i)
  7643. hi = c >> 8
  7644. lo = c % 256
  7645. byteArray.push(lo)
  7646. byteArray.push(hi)
  7647. }
  7648. return byteArray
  7649. }
  7650. function base64ToBytes (str) {
  7651. return base64.toByteArray(base64clean(str))
  7652. }
  7653. function blitBuffer (src, dst, offset, length) {
  7654. for (var i = 0; i < length; ++i) {
  7655. if ((i + offset >= dst.length) || (i >= src.length)) break
  7656. dst[i + offset] = src[i]
  7657. }
  7658. return i
  7659. }
  7660. function isnan (val) {
  7661. return val !== val // eslint-disable-line no-self-compare
  7662. }
  7663. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7664. /***/ }),
  7665. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7666. /*!**************************************************!*\
  7667. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7668. \**************************************************/
  7669. /*! no static exports found */
  7670. /***/ (function(module, exports, __webpack_require__) {
  7671. /*!
  7672. * clipboard.js v2.0.4
  7673. * https://zenorocha.github.io/clipboard.js
  7674. *
  7675. * Licensed MIT © Zeno Rocha
  7676. */
  7677. (function webpackUniversalModuleDefinition(root, factory) {
  7678. if(true)
  7679. module.exports = factory();
  7680. else {}
  7681. })(this, function() {
  7682. return /******/ (function(modules) { // webpackBootstrap
  7683. /******/ // The module cache
  7684. /******/ var installedModules = {};
  7685. /******/
  7686. /******/ // The require function
  7687. /******/ function __webpack_require__(moduleId) {
  7688. /******/
  7689. /******/ // Check if module is in cache
  7690. /******/ if(installedModules[moduleId]) {
  7691. /******/ return installedModules[moduleId].exports;
  7692. /******/ }
  7693. /******/ // Create a new module (and put it into the cache)
  7694. /******/ var module = installedModules[moduleId] = {
  7695. /******/ i: moduleId,
  7696. /******/ l: false,
  7697. /******/ exports: {}
  7698. /******/ };
  7699. /******/
  7700. /******/ // Execute the module function
  7701. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7702. /******/
  7703. /******/ // Flag the module as loaded
  7704. /******/ module.l = true;
  7705. /******/
  7706. /******/ // Return the exports of the module
  7707. /******/ return module.exports;
  7708. /******/ }
  7709. /******/
  7710. /******/
  7711. /******/ // expose the modules object (__webpack_modules__)
  7712. /******/ __webpack_require__.m = modules;
  7713. /******/
  7714. /******/ // expose the module cache
  7715. /******/ __webpack_require__.c = installedModules;
  7716. /******/
  7717. /******/ // define getter function for harmony exports
  7718. /******/ __webpack_require__.d = function(exports, name, getter) {
  7719. /******/ if(!__webpack_require__.o(exports, name)) {
  7720. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7721. /******/ }
  7722. /******/ };
  7723. /******/
  7724. /******/ // define __esModule on exports
  7725. /******/ __webpack_require__.r = function(exports) {
  7726. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7727. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7728. /******/ }
  7729. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7730. /******/ };
  7731. /******/
  7732. /******/ // create a fake namespace object
  7733. /******/ // mode & 1: value is a module id, require it
  7734. /******/ // mode & 2: merge all properties of value into the ns
  7735. /******/ // mode & 4: return value when already ns object
  7736. /******/ // mode & 8|1: behave like require
  7737. /******/ __webpack_require__.t = function(value, mode) {
  7738. /******/ if(mode & 1) value = __webpack_require__(value);
  7739. /******/ if(mode & 8) return value;
  7740. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7741. /******/ var ns = Object.create(null);
  7742. /******/ __webpack_require__.r(ns);
  7743. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7744. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7745. /******/ return ns;
  7746. /******/ };
  7747. /******/
  7748. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7749. /******/ __webpack_require__.n = function(module) {
  7750. /******/ var getter = module && module.__esModule ?
  7751. /******/ function getDefault() { return module['default']; } :
  7752. /******/ function getModuleExports() { return module; };
  7753. /******/ __webpack_require__.d(getter, 'a', getter);
  7754. /******/ return getter;
  7755. /******/ };
  7756. /******/
  7757. /******/ // Object.prototype.hasOwnProperty.call
  7758. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7759. /******/
  7760. /******/ // __webpack_public_path__
  7761. /******/ __webpack_require__.p = "";
  7762. /******/
  7763. /******/
  7764. /******/ // Load entry module and return exports
  7765. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7766. /******/ })
  7767. /************************************************************************/
  7768. /******/ ([
  7769. /* 0 */
  7770. /***/ (function(module, exports, __webpack_require__) {
  7771. "use strict";
  7772. 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; };
  7773. 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; }; }();
  7774. var _clipboardAction = __webpack_require__(1);
  7775. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7776. var _tinyEmitter = __webpack_require__(3);
  7777. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7778. var _goodListener = __webpack_require__(4);
  7779. var _goodListener2 = _interopRequireDefault(_goodListener);
  7780. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7781. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7782. 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; }
  7783. 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; }
  7784. /**
  7785. * Base class which takes one or more elements, adds event listeners to them,
  7786. * and instantiates a new `ClipboardAction` on each click.
  7787. */
  7788. var Clipboard = function (_Emitter) {
  7789. _inherits(Clipboard, _Emitter);
  7790. /**
  7791. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7792. * @param {Object} options
  7793. */
  7794. function Clipboard(trigger, options) {
  7795. _classCallCheck(this, Clipboard);
  7796. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7797. _this.resolveOptions(options);
  7798. _this.listenClick(trigger);
  7799. return _this;
  7800. }
  7801. /**
  7802. * Defines if attributes would be resolved using internal setter functions
  7803. * or custom functions that were passed in the constructor.
  7804. * @param {Object} options
  7805. */
  7806. _createClass(Clipboard, [{
  7807. key: 'resolveOptions',
  7808. value: function resolveOptions() {
  7809. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7810. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7811. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7812. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7813. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7814. }
  7815. /**
  7816. * Adds a click event listener to the passed trigger.
  7817. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7818. */
  7819. }, {
  7820. key: 'listenClick',
  7821. value: function listenClick(trigger) {
  7822. var _this2 = this;
  7823. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7824. return _this2.onClick(e);
  7825. });
  7826. }
  7827. /**
  7828. * Defines a new `ClipboardAction` on each click event.
  7829. * @param {Event} e
  7830. */
  7831. }, {
  7832. key: 'onClick',
  7833. value: function onClick(e) {
  7834. var trigger = e.delegateTarget || e.currentTarget;
  7835. if (this.clipboardAction) {
  7836. this.clipboardAction = null;
  7837. }
  7838. this.clipboardAction = new _clipboardAction2.default({
  7839. action: this.action(trigger),
  7840. target: this.target(trigger),
  7841. text: this.text(trigger),
  7842. container: this.container,
  7843. trigger: trigger,
  7844. emitter: this
  7845. });
  7846. }
  7847. /**
  7848. * Default `action` lookup function.
  7849. * @param {Element} trigger
  7850. */
  7851. }, {
  7852. key: 'defaultAction',
  7853. value: function defaultAction(trigger) {
  7854. return getAttributeValue('action', trigger);
  7855. }
  7856. /**
  7857. * Default `target` lookup function.
  7858. * @param {Element} trigger
  7859. */
  7860. }, {
  7861. key: 'defaultTarget',
  7862. value: function defaultTarget(trigger) {
  7863. var selector = getAttributeValue('target', trigger);
  7864. if (selector) {
  7865. return document.querySelector(selector);
  7866. }
  7867. }
  7868. /**
  7869. * Returns the support of the given action, or all actions if no action is
  7870. * given.
  7871. * @param {String} [action]
  7872. */
  7873. }, {
  7874. key: 'defaultText',
  7875. /**
  7876. * Default `text` lookup function.
  7877. * @param {Element} trigger
  7878. */
  7879. value: function defaultText(trigger) {
  7880. return getAttributeValue('text', trigger);
  7881. }
  7882. /**
  7883. * Destroy lifecycle.
  7884. */
  7885. }, {
  7886. key: 'destroy',
  7887. value: function destroy() {
  7888. this.listener.destroy();
  7889. if (this.clipboardAction) {
  7890. this.clipboardAction.destroy();
  7891. this.clipboardAction = null;
  7892. }
  7893. }
  7894. }], [{
  7895. key: 'isSupported',
  7896. value: function isSupported() {
  7897. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7898. var actions = typeof action === 'string' ? [action] : action;
  7899. var support = !!document.queryCommandSupported;
  7900. actions.forEach(function (action) {
  7901. support = support && !!document.queryCommandSupported(action);
  7902. });
  7903. return support;
  7904. }
  7905. }]);
  7906. return Clipboard;
  7907. }(_tinyEmitter2.default);
  7908. /**
  7909. * Helper function to retrieve attribute value.
  7910. * @param {String} suffix
  7911. * @param {Element} element
  7912. */
  7913. function getAttributeValue(suffix, element) {
  7914. var attribute = 'data-clipboard-' + suffix;
  7915. if (!element.hasAttribute(attribute)) {
  7916. return;
  7917. }
  7918. return element.getAttribute(attribute);
  7919. }
  7920. module.exports = Clipboard;
  7921. /***/ }),
  7922. /* 1 */
  7923. /***/ (function(module, exports, __webpack_require__) {
  7924. "use strict";
  7925. 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; };
  7926. 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; }; }();
  7927. var _select = __webpack_require__(2);
  7928. var _select2 = _interopRequireDefault(_select);
  7929. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7930. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7931. /**
  7932. * Inner class which performs selection from either `text` or `target`
  7933. * properties and then executes copy or cut operations.
  7934. */
  7935. var ClipboardAction = function () {
  7936. /**
  7937. * @param {Object} options
  7938. */
  7939. function ClipboardAction(options) {
  7940. _classCallCheck(this, ClipboardAction);
  7941. this.resolveOptions(options);
  7942. this.initSelection();
  7943. }
  7944. /**
  7945. * Defines base properties passed from constructor.
  7946. * @param {Object} options
  7947. */
  7948. _createClass(ClipboardAction, [{
  7949. key: 'resolveOptions',
  7950. value: function resolveOptions() {
  7951. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7952. this.action = options.action;
  7953. this.container = options.container;
  7954. this.emitter = options.emitter;
  7955. this.target = options.target;
  7956. this.text = options.text;
  7957. this.trigger = options.trigger;
  7958. this.selectedText = '';
  7959. }
  7960. /**
  7961. * Decides which selection strategy is going to be applied based
  7962. * on the existence of `text` and `target` properties.
  7963. */
  7964. }, {
  7965. key: 'initSelection',
  7966. value: function initSelection() {
  7967. if (this.text) {
  7968. this.selectFake();
  7969. } else if (this.target) {
  7970. this.selectTarget();
  7971. }
  7972. }
  7973. /**
  7974. * Creates a fake textarea element, sets its value from `text` property,
  7975. * and makes a selection on it.
  7976. */
  7977. }, {
  7978. key: 'selectFake',
  7979. value: function selectFake() {
  7980. var _this = this;
  7981. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  7982. this.removeFake();
  7983. this.fakeHandlerCallback = function () {
  7984. return _this.removeFake();
  7985. };
  7986. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  7987. this.fakeElem = document.createElement('textarea');
  7988. // Prevent zooming on iOS
  7989. this.fakeElem.style.fontSize = '12pt';
  7990. // Reset box model
  7991. this.fakeElem.style.border = '0';
  7992. this.fakeElem.style.padding = '0';
  7993. this.fakeElem.style.margin = '0';
  7994. // Move element out of screen horizontally
  7995. this.fakeElem.style.position = 'absolute';
  7996. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  7997. // Move element to the same position vertically
  7998. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  7999. this.fakeElem.style.top = yPosition + 'px';
  8000. this.fakeElem.setAttribute('readonly', '');
  8001. this.fakeElem.value = this.text;
  8002. this.container.appendChild(this.fakeElem);
  8003. this.selectedText = (0, _select2.default)(this.fakeElem);
  8004. this.copyText();
  8005. }
  8006. /**
  8007. * Only removes the fake element after another click event, that way
  8008. * a user can hit `Ctrl+C` to copy because selection still exists.
  8009. */
  8010. }, {
  8011. key: 'removeFake',
  8012. value: function removeFake() {
  8013. if (this.fakeHandler) {
  8014. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8015. this.fakeHandler = null;
  8016. this.fakeHandlerCallback = null;
  8017. }
  8018. if (this.fakeElem) {
  8019. this.container.removeChild(this.fakeElem);
  8020. this.fakeElem = null;
  8021. }
  8022. }
  8023. /**
  8024. * Selects the content from element passed on `target` property.
  8025. */
  8026. }, {
  8027. key: 'selectTarget',
  8028. value: function selectTarget() {
  8029. this.selectedText = (0, _select2.default)(this.target);
  8030. this.copyText();
  8031. }
  8032. /**
  8033. * Executes the copy operation based on the current selection.
  8034. */
  8035. }, {
  8036. key: 'copyText',
  8037. value: function copyText() {
  8038. var succeeded = void 0;
  8039. try {
  8040. succeeded = document.execCommand(this.action);
  8041. } catch (err) {
  8042. succeeded = false;
  8043. }
  8044. this.handleResult(succeeded);
  8045. }
  8046. /**
  8047. * Fires an event based on the copy operation result.
  8048. * @param {Boolean} succeeded
  8049. */
  8050. }, {
  8051. key: 'handleResult',
  8052. value: function handleResult(succeeded) {
  8053. this.emitter.emit(succeeded ? 'success' : 'error', {
  8054. action: this.action,
  8055. text: this.selectedText,
  8056. trigger: this.trigger,
  8057. clearSelection: this.clearSelection.bind(this)
  8058. });
  8059. }
  8060. /**
  8061. * Moves focus away from `target` and back to the trigger, removes current selection.
  8062. */
  8063. }, {
  8064. key: 'clearSelection',
  8065. value: function clearSelection() {
  8066. if (this.trigger) {
  8067. this.trigger.focus();
  8068. }
  8069. window.getSelection().removeAllRanges();
  8070. }
  8071. /**
  8072. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8073. * @param {String} action
  8074. */
  8075. }, {
  8076. key: 'destroy',
  8077. /**
  8078. * Destroy lifecycle.
  8079. */
  8080. value: function destroy() {
  8081. this.removeFake();
  8082. }
  8083. }, {
  8084. key: 'action',
  8085. set: function set() {
  8086. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8087. this._action = action;
  8088. if (this._action !== 'copy' && this._action !== 'cut') {
  8089. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8090. }
  8091. }
  8092. /**
  8093. * Gets the `action` property.
  8094. * @return {String}
  8095. */
  8096. ,
  8097. get: function get() {
  8098. return this._action;
  8099. }
  8100. /**
  8101. * Sets the `target` property using an element
  8102. * that will be have its content copied.
  8103. * @param {Element} target
  8104. */
  8105. }, {
  8106. key: 'target',
  8107. set: function set(target) {
  8108. if (target !== undefined) {
  8109. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8110. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8111. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8112. }
  8113. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8114. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8115. }
  8116. this._target = target;
  8117. } else {
  8118. throw new Error('Invalid "target" value, use a valid Element');
  8119. }
  8120. }
  8121. }
  8122. /**
  8123. * Gets the `target` property.
  8124. * @return {String|HTMLElement}
  8125. */
  8126. ,
  8127. get: function get() {
  8128. return this._target;
  8129. }
  8130. }]);
  8131. return ClipboardAction;
  8132. }();
  8133. module.exports = ClipboardAction;
  8134. /***/ }),
  8135. /* 2 */
  8136. /***/ (function(module, exports) {
  8137. function select(element) {
  8138. var selectedText;
  8139. if (element.nodeName === 'SELECT') {
  8140. element.focus();
  8141. selectedText = element.value;
  8142. }
  8143. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8144. var isReadOnly = element.hasAttribute('readonly');
  8145. if (!isReadOnly) {
  8146. element.setAttribute('readonly', '');
  8147. }
  8148. element.select();
  8149. element.setSelectionRange(0, element.value.length);
  8150. if (!isReadOnly) {
  8151. element.removeAttribute('readonly');
  8152. }
  8153. selectedText = element.value;
  8154. }
  8155. else {
  8156. if (element.hasAttribute('contenteditable')) {
  8157. element.focus();
  8158. }
  8159. var selection = window.getSelection();
  8160. var range = document.createRange();
  8161. range.selectNodeContents(element);
  8162. selection.removeAllRanges();
  8163. selection.addRange(range);
  8164. selectedText = selection.toString();
  8165. }
  8166. return selectedText;
  8167. }
  8168. module.exports = select;
  8169. /***/ }),
  8170. /* 3 */
  8171. /***/ (function(module, exports) {
  8172. function E () {
  8173. // Keep this empty so it's easier to inherit from
  8174. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8175. }
  8176. E.prototype = {
  8177. on: function (name, callback, ctx) {
  8178. var e = this.e || (this.e = {});
  8179. (e[name] || (e[name] = [])).push({
  8180. fn: callback,
  8181. ctx: ctx
  8182. });
  8183. return this;
  8184. },
  8185. once: function (name, callback, ctx) {
  8186. var self = this;
  8187. function listener () {
  8188. self.off(name, listener);
  8189. callback.apply(ctx, arguments);
  8190. };
  8191. listener._ = callback
  8192. return this.on(name, listener, ctx);
  8193. },
  8194. emit: function (name) {
  8195. var data = [].slice.call(arguments, 1);
  8196. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8197. var i = 0;
  8198. var len = evtArr.length;
  8199. for (i; i < len; i++) {
  8200. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8201. }
  8202. return this;
  8203. },
  8204. off: function (name, callback) {
  8205. var e = this.e || (this.e = {});
  8206. var evts = e[name];
  8207. var liveEvents = [];
  8208. if (evts && callback) {
  8209. for (var i = 0, len = evts.length; i < len; i++) {
  8210. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8211. liveEvents.push(evts[i]);
  8212. }
  8213. }
  8214. // Remove event from queue to prevent memory leak
  8215. // Suggested by https://github.com/lazd
  8216. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8217. (liveEvents.length)
  8218. ? e[name] = liveEvents
  8219. : delete e[name];
  8220. return this;
  8221. }
  8222. };
  8223. module.exports = E;
  8224. /***/ }),
  8225. /* 4 */
  8226. /***/ (function(module, exports, __webpack_require__) {
  8227. var is = __webpack_require__(5);
  8228. var delegate = __webpack_require__(6);
  8229. /**
  8230. * Validates all params and calls the right
  8231. * listener function based on its target type.
  8232. *
  8233. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8234. * @param {String} type
  8235. * @param {Function} callback
  8236. * @return {Object}
  8237. */
  8238. function listen(target, type, callback) {
  8239. if (!target && !type && !callback) {
  8240. throw new Error('Missing required arguments');
  8241. }
  8242. if (!is.string(type)) {
  8243. throw new TypeError('Second argument must be a String');
  8244. }
  8245. if (!is.fn(callback)) {
  8246. throw new TypeError('Third argument must be a Function');
  8247. }
  8248. if (is.node(target)) {
  8249. return listenNode(target, type, callback);
  8250. }
  8251. else if (is.nodeList(target)) {
  8252. return listenNodeList(target, type, callback);
  8253. }
  8254. else if (is.string(target)) {
  8255. return listenSelector(target, type, callback);
  8256. }
  8257. else {
  8258. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8259. }
  8260. }
  8261. /**
  8262. * Adds an event listener to a HTML element
  8263. * and returns a remove listener function.
  8264. *
  8265. * @param {HTMLElement} node
  8266. * @param {String} type
  8267. * @param {Function} callback
  8268. * @return {Object}
  8269. */
  8270. function listenNode(node, type, callback) {
  8271. node.addEventListener(type, callback);
  8272. return {
  8273. destroy: function() {
  8274. node.removeEventListener(type, callback);
  8275. }
  8276. }
  8277. }
  8278. /**
  8279. * Add an event listener to a list of HTML elements
  8280. * and returns a remove listener function.
  8281. *
  8282. * @param {NodeList|HTMLCollection} nodeList
  8283. * @param {String} type
  8284. * @param {Function} callback
  8285. * @return {Object}
  8286. */
  8287. function listenNodeList(nodeList, type, callback) {
  8288. Array.prototype.forEach.call(nodeList, function(node) {
  8289. node.addEventListener(type, callback);
  8290. });
  8291. return {
  8292. destroy: function() {
  8293. Array.prototype.forEach.call(nodeList, function(node) {
  8294. node.removeEventListener(type, callback);
  8295. });
  8296. }
  8297. }
  8298. }
  8299. /**
  8300. * Add an event listener to a selector
  8301. * and returns a remove listener function.
  8302. *
  8303. * @param {String} selector
  8304. * @param {String} type
  8305. * @param {Function} callback
  8306. * @return {Object}
  8307. */
  8308. function listenSelector(selector, type, callback) {
  8309. return delegate(document.body, selector, type, callback);
  8310. }
  8311. module.exports = listen;
  8312. /***/ }),
  8313. /* 5 */
  8314. /***/ (function(module, exports) {
  8315. /**
  8316. * Check if argument is a HTML element.
  8317. *
  8318. * @param {Object} value
  8319. * @return {Boolean}
  8320. */
  8321. exports.node = function(value) {
  8322. return value !== undefined
  8323. && value instanceof HTMLElement
  8324. && value.nodeType === 1;
  8325. };
  8326. /**
  8327. * Check if argument is a list of HTML elements.
  8328. *
  8329. * @param {Object} value
  8330. * @return {Boolean}
  8331. */
  8332. exports.nodeList = function(value) {
  8333. var type = Object.prototype.toString.call(value);
  8334. return value !== undefined
  8335. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8336. && ('length' in value)
  8337. && (value.length === 0 || exports.node(value[0]));
  8338. };
  8339. /**
  8340. * Check if argument is a string.
  8341. *
  8342. * @param {Object} value
  8343. * @return {Boolean}
  8344. */
  8345. exports.string = function(value) {
  8346. return typeof value === 'string'
  8347. || value instanceof String;
  8348. };
  8349. /**
  8350. * Check if argument is a function.
  8351. *
  8352. * @param {Object} value
  8353. * @return {Boolean}
  8354. */
  8355. exports.fn = function(value) {
  8356. var type = Object.prototype.toString.call(value);
  8357. return type === '[object Function]';
  8358. };
  8359. /***/ }),
  8360. /* 6 */
  8361. /***/ (function(module, exports, __webpack_require__) {
  8362. var closest = __webpack_require__(7);
  8363. /**
  8364. * Delegates event to a selector.
  8365. *
  8366. * @param {Element} element
  8367. * @param {String} selector
  8368. * @param {String} type
  8369. * @param {Function} callback
  8370. * @param {Boolean} useCapture
  8371. * @return {Object}
  8372. */
  8373. function _delegate(element, selector, type, callback, useCapture) {
  8374. var listenerFn = listener.apply(this, arguments);
  8375. element.addEventListener(type, listenerFn, useCapture);
  8376. return {
  8377. destroy: function() {
  8378. element.removeEventListener(type, listenerFn, useCapture);
  8379. }
  8380. }
  8381. }
  8382. /**
  8383. * Delegates event to a selector.
  8384. *
  8385. * @param {Element|String|Array} [elements]
  8386. * @param {String} selector
  8387. * @param {String} type
  8388. * @param {Function} callback
  8389. * @param {Boolean} useCapture
  8390. * @return {Object}
  8391. */
  8392. function delegate(elements, selector, type, callback, useCapture) {
  8393. // Handle the regular Element usage
  8394. if (typeof elements.addEventListener === 'function') {
  8395. return _delegate.apply(null, arguments);
  8396. }
  8397. // Handle Element-less usage, it defaults to global delegation
  8398. if (typeof type === 'function') {
  8399. // Use `document` as the first parameter, then apply arguments
  8400. // This is a short way to .unshift `arguments` without running into deoptimizations
  8401. return _delegate.bind(null, document).apply(null, arguments);
  8402. }
  8403. // Handle Selector-based usage
  8404. if (typeof elements === 'string') {
  8405. elements = document.querySelectorAll(elements);
  8406. }
  8407. // Handle Array-like based usage
  8408. return Array.prototype.map.call(elements, function (element) {
  8409. return _delegate(element, selector, type, callback, useCapture);
  8410. });
  8411. }
  8412. /**
  8413. * Finds closest match and invokes callback.
  8414. *
  8415. * @param {Element} element
  8416. * @param {String} selector
  8417. * @param {String} type
  8418. * @param {Function} callback
  8419. * @return {Function}
  8420. */
  8421. function listener(element, selector, type, callback) {
  8422. return function(e) {
  8423. e.delegateTarget = closest(e.target, selector);
  8424. if (e.delegateTarget) {
  8425. callback.call(element, e);
  8426. }
  8427. }
  8428. }
  8429. module.exports = delegate;
  8430. /***/ }),
  8431. /* 7 */
  8432. /***/ (function(module, exports) {
  8433. var DOCUMENT_NODE_TYPE = 9;
  8434. /**
  8435. * A polyfill for Element.matches()
  8436. */
  8437. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8438. var proto = Element.prototype;
  8439. proto.matches = proto.matchesSelector ||
  8440. proto.mozMatchesSelector ||
  8441. proto.msMatchesSelector ||
  8442. proto.oMatchesSelector ||
  8443. proto.webkitMatchesSelector;
  8444. }
  8445. /**
  8446. * Finds the closest parent that matches a selector.
  8447. *
  8448. * @param {Element} element
  8449. * @param {String} selector
  8450. * @return {Function}
  8451. */
  8452. function closest (element, selector) {
  8453. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8454. if (typeof element.matches === 'function' &&
  8455. element.matches(selector)) {
  8456. return element;
  8457. }
  8458. element = element.parentNode;
  8459. }
  8460. }
  8461. module.exports = closest;
  8462. /***/ })
  8463. /******/ ]);
  8464. });
  8465. /***/ }),
  8466. /***/ "./node_modules/ieee754/index.js":
  8467. /*!***************************************!*\
  8468. !*** ./node_modules/ieee754/index.js ***!
  8469. \***************************************/
  8470. /*! no static exports found */
  8471. /***/ (function(module, exports) {
  8472. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8473. var e, m
  8474. var eLen = (nBytes * 8) - mLen - 1
  8475. var eMax = (1 << eLen) - 1
  8476. var eBias = eMax >> 1
  8477. var nBits = -7
  8478. var i = isLE ? (nBytes - 1) : 0
  8479. var d = isLE ? -1 : 1
  8480. var s = buffer[offset + i]
  8481. i += d
  8482. e = s & ((1 << (-nBits)) - 1)
  8483. s >>= (-nBits)
  8484. nBits += eLen
  8485. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8486. m = e & ((1 << (-nBits)) - 1)
  8487. e >>= (-nBits)
  8488. nBits += mLen
  8489. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8490. if (e === 0) {
  8491. e = 1 - eBias
  8492. } else if (e === eMax) {
  8493. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8494. } else {
  8495. m = m + Math.pow(2, mLen)
  8496. e = e - eBias
  8497. }
  8498. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8499. }
  8500. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8501. var e, m, c
  8502. var eLen = (nBytes * 8) - mLen - 1
  8503. var eMax = (1 << eLen) - 1
  8504. var eBias = eMax >> 1
  8505. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8506. var i = isLE ? 0 : (nBytes - 1)
  8507. var d = isLE ? 1 : -1
  8508. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8509. value = Math.abs(value)
  8510. if (isNaN(value) || value === Infinity) {
  8511. m = isNaN(value) ? 1 : 0
  8512. e = eMax
  8513. } else {
  8514. e = Math.floor(Math.log(value) / Math.LN2)
  8515. if (value * (c = Math.pow(2, -e)) < 1) {
  8516. e--
  8517. c *= 2
  8518. }
  8519. if (e + eBias >= 1) {
  8520. value += rt / c
  8521. } else {
  8522. value += rt * Math.pow(2, 1 - eBias)
  8523. }
  8524. if (value * c >= 2) {
  8525. e++
  8526. c /= 2
  8527. }
  8528. if (e + eBias >= eMax) {
  8529. m = 0
  8530. e = eMax
  8531. } else if (e + eBias >= 1) {
  8532. m = ((value * c) - 1) * Math.pow(2, mLen)
  8533. e = e + eBias
  8534. } else {
  8535. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8536. e = 0
  8537. }
  8538. }
  8539. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8540. e = (e << mLen) | m
  8541. eLen += mLen
  8542. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8543. buffer[offset + i - d] |= s * 128
  8544. }
  8545. /***/ }),
  8546. /***/ "./node_modules/isarray/index.js":
  8547. /*!***************************************!*\
  8548. !*** ./node_modules/isarray/index.js ***!
  8549. \***************************************/
  8550. /*! no static exports found */
  8551. /***/ (function(module, exports) {
  8552. var toString = {}.toString;
  8553. module.exports = Array.isArray || function (arr) {
  8554. return toString.call(arr) == '[object Array]';
  8555. };
  8556. /***/ }),
  8557. /***/ "./node_modules/jquery/dist/jquery.js":
  8558. /*!********************************************!*\
  8559. !*** ./node_modules/jquery/dist/jquery.js ***!
  8560. \********************************************/
  8561. /*! no static exports found */
  8562. /***/ (function(module, exports, __webpack_require__) {
  8563. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8564. * jQuery JavaScript Library v3.4.1
  8565. * https://jquery.com/
  8566. *
  8567. * Includes Sizzle.js
  8568. * https://sizzlejs.com/
  8569. *
  8570. * Copyright JS Foundation and other contributors
  8571. * Released under the MIT license
  8572. * https://jquery.org/license
  8573. *
  8574. * Date: 2019-05-01T21:04Z
  8575. */
  8576. ( function( global, factory ) {
  8577. "use strict";
  8578. if ( true && typeof module.exports === "object" ) {
  8579. // For CommonJS and CommonJS-like environments where a proper `window`
  8580. // is present, execute the factory and get jQuery.
  8581. // For environments that do not have a `window` with a `document`
  8582. // (such as Node.js), expose a factory as module.exports.
  8583. // This accentuates the need for the creation of a real `window`.
  8584. // e.g. var jQuery = require("jquery")(window);
  8585. // See ticket #14549 for more info.
  8586. module.exports = global.document ?
  8587. factory( global, true ) :
  8588. function( w ) {
  8589. if ( !w.document ) {
  8590. throw new Error( "jQuery requires a window with a document" );
  8591. }
  8592. return factory( w );
  8593. };
  8594. } else {
  8595. factory( global );
  8596. }
  8597. // Pass this if window is not defined yet
  8598. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8599. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8600. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8601. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8602. // enough that all such attempts are guarded in a try block.
  8603. "use strict";
  8604. var arr = [];
  8605. var document = window.document;
  8606. var getProto = Object.getPrototypeOf;
  8607. var slice = arr.slice;
  8608. var concat = arr.concat;
  8609. var push = arr.push;
  8610. var indexOf = arr.indexOf;
  8611. var class2type = {};
  8612. var toString = class2type.toString;
  8613. var hasOwn = class2type.hasOwnProperty;
  8614. var fnToString = hasOwn.toString;
  8615. var ObjectFunctionString = fnToString.call( Object );
  8616. var support = {};
  8617. var isFunction = function isFunction( obj ) {
  8618. // Support: Chrome <=57, Firefox <=52
  8619. // In some browsers, typeof returns "function" for HTML <object> elements
  8620. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8621. // We don't want to classify *any* DOM node as a function.
  8622. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8623. };
  8624. var isWindow = function isWindow( obj ) {
  8625. return obj != null && obj === obj.window;
  8626. };
  8627. var preservedScriptAttributes = {
  8628. type: true,
  8629. src: true,
  8630. nonce: true,
  8631. noModule: true
  8632. };
  8633. function DOMEval( code, node, doc ) {
  8634. doc = doc || document;
  8635. var i, val,
  8636. script = doc.createElement( "script" );
  8637. script.text = code;
  8638. if ( node ) {
  8639. for ( i in preservedScriptAttributes ) {
  8640. // Support: Firefox 64+, Edge 18+
  8641. // Some browsers don't support the "nonce" property on scripts.
  8642. // On the other hand, just using `getAttribute` is not enough as
  8643. // the `nonce` attribute is reset to an empty string whenever it
  8644. // becomes browsing-context connected.
  8645. // See https://github.com/whatwg/html/issues/2369
  8646. // See https://html.spec.whatwg.org/#nonce-attributes
  8647. // The `node.getAttribute` check was added for the sake of
  8648. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8649. // via an object.
  8650. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8651. if ( val ) {
  8652. script.setAttribute( i, val );
  8653. }
  8654. }
  8655. }
  8656. doc.head.appendChild( script ).parentNode.removeChild( script );
  8657. }
  8658. function toType( obj ) {
  8659. if ( obj == null ) {
  8660. return obj + "";
  8661. }
  8662. // Support: Android <=2.3 only (functionish RegExp)
  8663. return typeof obj === "object" || typeof obj === "function" ?
  8664. class2type[ toString.call( obj ) ] || "object" :
  8665. typeof obj;
  8666. }
  8667. /* global Symbol */
  8668. // Defining this global in .eslintrc.json would create a danger of using the global
  8669. // unguarded in another place, it seems safer to define global only for this module
  8670. var
  8671. version = "3.4.1",
  8672. // Define a local copy of jQuery
  8673. jQuery = function( selector, context ) {
  8674. // The jQuery object is actually just the init constructor 'enhanced'
  8675. // Need init if jQuery is called (just allow error to be thrown if not included)
  8676. return new jQuery.fn.init( selector, context );
  8677. },
  8678. // Support: Android <=4.0 only
  8679. // Make sure we trim BOM and NBSP
  8680. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8681. jQuery.fn = jQuery.prototype = {
  8682. // The current version of jQuery being used
  8683. jquery: version,
  8684. constructor: jQuery,
  8685. // The default length of a jQuery object is 0
  8686. length: 0,
  8687. toArray: function() {
  8688. return slice.call( this );
  8689. },
  8690. // Get the Nth element in the matched element set OR
  8691. // Get the whole matched element set as a clean array
  8692. get: function( num ) {
  8693. // Return all the elements in a clean array
  8694. if ( num == null ) {
  8695. return slice.call( this );
  8696. }
  8697. // Return just the one element from the set
  8698. return num < 0 ? this[ num + this.length ] : this[ num ];
  8699. },
  8700. // Take an array of elements and push it onto the stack
  8701. // (returning the new matched element set)
  8702. pushStack: function( elems ) {
  8703. // Build a new jQuery matched element set
  8704. var ret = jQuery.merge( this.constructor(), elems );
  8705. // Add the old object onto the stack (as a reference)
  8706. ret.prevObject = this;
  8707. // Return the newly-formed element set
  8708. return ret;
  8709. },
  8710. // Execute a callback for every element in the matched set.
  8711. each: function( callback ) {
  8712. return jQuery.each( this, callback );
  8713. },
  8714. map: function( callback ) {
  8715. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8716. return callback.call( elem, i, elem );
  8717. } ) );
  8718. },
  8719. slice: function() {
  8720. return this.pushStack( slice.apply( this, arguments ) );
  8721. },
  8722. first: function() {
  8723. return this.eq( 0 );
  8724. },
  8725. last: function() {
  8726. return this.eq( -1 );
  8727. },
  8728. eq: function( i ) {
  8729. var len = this.length,
  8730. j = +i + ( i < 0 ? len : 0 );
  8731. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8732. },
  8733. end: function() {
  8734. return this.prevObject || this.constructor();
  8735. },
  8736. // For internal use only.
  8737. // Behaves like an Array's method, not like a jQuery method.
  8738. push: push,
  8739. sort: arr.sort,
  8740. splice: arr.splice
  8741. };
  8742. jQuery.extend = jQuery.fn.extend = function() {
  8743. var options, name, src, copy, copyIsArray, clone,
  8744. target = arguments[ 0 ] || {},
  8745. i = 1,
  8746. length = arguments.length,
  8747. deep = false;
  8748. // Handle a deep copy situation
  8749. if ( typeof target === "boolean" ) {
  8750. deep = target;
  8751. // Skip the boolean and the target
  8752. target = arguments[ i ] || {};
  8753. i++;
  8754. }
  8755. // Handle case when target is a string or something (possible in deep copy)
  8756. if ( typeof target !== "object" && !isFunction( target ) ) {
  8757. target = {};
  8758. }
  8759. // Extend jQuery itself if only one argument is passed
  8760. if ( i === length ) {
  8761. target = this;
  8762. i--;
  8763. }
  8764. for ( ; i < length; i++ ) {
  8765. // Only deal with non-null/undefined values
  8766. if ( ( options = arguments[ i ] ) != null ) {
  8767. // Extend the base object
  8768. for ( name in options ) {
  8769. copy = options[ name ];
  8770. // Prevent Object.prototype pollution
  8771. // Prevent never-ending loop
  8772. if ( name === "__proto__" || target === copy ) {
  8773. continue;
  8774. }
  8775. // Recurse if we're merging plain objects or arrays
  8776. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8777. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8778. src = target[ name ];
  8779. // Ensure proper type for the source value
  8780. if ( copyIsArray && !Array.isArray( src ) ) {
  8781. clone = [];
  8782. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8783. clone = {};
  8784. } else {
  8785. clone = src;
  8786. }
  8787. copyIsArray = false;
  8788. // Never move original objects, clone them
  8789. target[ name ] = jQuery.extend( deep, clone, copy );
  8790. // Don't bring in undefined values
  8791. } else if ( copy !== undefined ) {
  8792. target[ name ] = copy;
  8793. }
  8794. }
  8795. }
  8796. }
  8797. // Return the modified object
  8798. return target;
  8799. };
  8800. jQuery.extend( {
  8801. // Unique for each copy of jQuery on the page
  8802. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8803. // Assume jQuery is ready without the ready module
  8804. isReady: true,
  8805. error: function( msg ) {
  8806. throw new Error( msg );
  8807. },
  8808. noop: function() {},
  8809. isPlainObject: function( obj ) {
  8810. var proto, Ctor;
  8811. // Detect obvious negatives
  8812. // Use toString instead of jQuery.type to catch host objects
  8813. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8814. return false;
  8815. }
  8816. proto = getProto( obj );
  8817. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8818. if ( !proto ) {
  8819. return true;
  8820. }
  8821. // Objects with prototype are plain iff they were constructed by a global Object function
  8822. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8823. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8824. },
  8825. isEmptyObject: function( obj ) {
  8826. var name;
  8827. for ( name in obj ) {
  8828. return false;
  8829. }
  8830. return true;
  8831. },
  8832. // Evaluates a script in a global context
  8833. globalEval: function( code, options ) {
  8834. DOMEval( code, { nonce: options && options.nonce } );
  8835. },
  8836. each: function( obj, callback ) {
  8837. var length, i = 0;
  8838. if ( isArrayLike( obj ) ) {
  8839. length = obj.length;
  8840. for ( ; i < length; i++ ) {
  8841. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8842. break;
  8843. }
  8844. }
  8845. } else {
  8846. for ( i in obj ) {
  8847. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8848. break;
  8849. }
  8850. }
  8851. }
  8852. return obj;
  8853. },
  8854. // Support: Android <=4.0 only
  8855. trim: function( text ) {
  8856. return text == null ?
  8857. "" :
  8858. ( text + "" ).replace( rtrim, "" );
  8859. },
  8860. // results is for internal usage only
  8861. makeArray: function( arr, results ) {
  8862. var ret = results || [];
  8863. if ( arr != null ) {
  8864. if ( isArrayLike( Object( arr ) ) ) {
  8865. jQuery.merge( ret,
  8866. typeof arr === "string" ?
  8867. [ arr ] : arr
  8868. );
  8869. } else {
  8870. push.call( ret, arr );
  8871. }
  8872. }
  8873. return ret;
  8874. },
  8875. inArray: function( elem, arr, i ) {
  8876. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8877. },
  8878. // Support: Android <=4.0 only, PhantomJS 1 only
  8879. // push.apply(_, arraylike) throws on ancient WebKit
  8880. merge: function( first, second ) {
  8881. var len = +second.length,
  8882. j = 0,
  8883. i = first.length;
  8884. for ( ; j < len; j++ ) {
  8885. first[ i++ ] = second[ j ];
  8886. }
  8887. first.length = i;
  8888. return first;
  8889. },
  8890. grep: function( elems, callback, invert ) {
  8891. var callbackInverse,
  8892. matches = [],
  8893. i = 0,
  8894. length = elems.length,
  8895. callbackExpect = !invert;
  8896. // Go through the array, only saving the items
  8897. // that pass the validator function
  8898. for ( ; i < length; i++ ) {
  8899. callbackInverse = !callback( elems[ i ], i );
  8900. if ( callbackInverse !== callbackExpect ) {
  8901. matches.push( elems[ i ] );
  8902. }
  8903. }
  8904. return matches;
  8905. },
  8906. // arg is for internal usage only
  8907. map: function( elems, callback, arg ) {
  8908. var length, value,
  8909. i = 0,
  8910. ret = [];
  8911. // Go through the array, translating each of the items to their new values
  8912. if ( isArrayLike( elems ) ) {
  8913. length = elems.length;
  8914. for ( ; i < length; i++ ) {
  8915. value = callback( elems[ i ], i, arg );
  8916. if ( value != null ) {
  8917. ret.push( value );
  8918. }
  8919. }
  8920. // Go through every key on the object,
  8921. } else {
  8922. for ( i in elems ) {
  8923. value = callback( elems[ i ], i, arg );
  8924. if ( value != null ) {
  8925. ret.push( value );
  8926. }
  8927. }
  8928. }
  8929. // Flatten any nested arrays
  8930. return concat.apply( [], ret );
  8931. },
  8932. // A global GUID counter for objects
  8933. guid: 1,
  8934. // jQuery.support is not used in Core but other projects attach their
  8935. // properties to it so it needs to exist.
  8936. support: support
  8937. } );
  8938. if ( typeof Symbol === "function" ) {
  8939. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  8940. }
  8941. // Populate the class2type map
  8942. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  8943. function( i, name ) {
  8944. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  8945. } );
  8946. function isArrayLike( obj ) {
  8947. // Support: real iOS 8.2 only (not reproducible in simulator)
  8948. // `in` check used to prevent JIT error (gh-2145)
  8949. // hasOwn isn't used here due to false negatives
  8950. // regarding Nodelist length in IE
  8951. var length = !!obj && "length" in obj && obj.length,
  8952. type = toType( obj );
  8953. if ( isFunction( obj ) || isWindow( obj ) ) {
  8954. return false;
  8955. }
  8956. return type === "array" || length === 0 ||
  8957. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  8958. }
  8959. var Sizzle =
  8960. /*!
  8961. * Sizzle CSS Selector Engine v2.3.4
  8962. * https://sizzlejs.com/
  8963. *
  8964. * Copyright JS Foundation and other contributors
  8965. * Released under the MIT license
  8966. * https://js.foundation/
  8967. *
  8968. * Date: 2019-04-08
  8969. */
  8970. (function( window ) {
  8971. var i,
  8972. support,
  8973. Expr,
  8974. getText,
  8975. isXML,
  8976. tokenize,
  8977. compile,
  8978. select,
  8979. outermostContext,
  8980. sortInput,
  8981. hasDuplicate,
  8982. // Local document vars
  8983. setDocument,
  8984. document,
  8985. docElem,
  8986. documentIsHTML,
  8987. rbuggyQSA,
  8988. rbuggyMatches,
  8989. matches,
  8990. contains,
  8991. // Instance-specific data
  8992. expando = "sizzle" + 1 * new Date(),
  8993. preferredDoc = window.document,
  8994. dirruns = 0,
  8995. done = 0,
  8996. classCache = createCache(),
  8997. tokenCache = createCache(),
  8998. compilerCache = createCache(),
  8999. nonnativeSelectorCache = createCache(),
  9000. sortOrder = function( a, b ) {
  9001. if ( a === b ) {
  9002. hasDuplicate = true;
  9003. }
  9004. return 0;
  9005. },
  9006. // Instance methods
  9007. hasOwn = ({}).hasOwnProperty,
  9008. arr = [],
  9009. pop = arr.pop,
  9010. push_native = arr.push,
  9011. push = arr.push,
  9012. slice = arr.slice,
  9013. // Use a stripped-down indexOf as it's faster than native
  9014. // https://jsperf.com/thor-indexof-vs-for/5
  9015. indexOf = function( list, elem ) {
  9016. var i = 0,
  9017. len = list.length;
  9018. for ( ; i < len; i++ ) {
  9019. if ( list[i] === elem ) {
  9020. return i;
  9021. }
  9022. }
  9023. return -1;
  9024. },
  9025. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9026. // Regular expressions
  9027. // http://www.w3.org/TR/css3-selectors/#whitespace
  9028. whitespace = "[\\x20\\t\\r\\n\\f]",
  9029. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9030. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9031. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9032. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9033. // Operator (capture 2)
  9034. "*([*^$|!~]?=)" + whitespace +
  9035. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9036. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9037. "*\\]",
  9038. pseudos = ":(" + identifier + ")(?:\\((" +
  9039. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9040. // 1. quoted (capture 3; capture 4 or capture 5)
  9041. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9042. // 2. simple (capture 6)
  9043. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9044. // 3. anything else (capture 2)
  9045. ".*" +
  9046. ")\\)|)",
  9047. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9048. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9049. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9050. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9051. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9052. rdescend = new RegExp( whitespace + "|>" ),
  9053. rpseudo = new RegExp( pseudos ),
  9054. ridentifier = new RegExp( "^" + identifier + "$" ),
  9055. matchExpr = {
  9056. "ID": new RegExp( "^#(" + identifier + ")" ),
  9057. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9058. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9059. "ATTR": new RegExp( "^" + attributes ),
  9060. "PSEUDO": new RegExp( "^" + pseudos ),
  9061. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9062. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9063. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9064. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9065. // For use in libraries implementing .is()
  9066. // We use this for POS matching in `select`
  9067. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9068. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9069. },
  9070. rhtml = /HTML$/i,
  9071. rinputs = /^(?:input|select|textarea|button)$/i,
  9072. rheader = /^h\d$/i,
  9073. rnative = /^[^{]+\{\s*\[native \w/,
  9074. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9075. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9076. rsibling = /[+~]/,
  9077. // CSS escapes
  9078. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9079. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9080. funescape = function( _, escaped, escapedWhitespace ) {
  9081. var high = "0x" + escaped - 0x10000;
  9082. // NaN means non-codepoint
  9083. // Support: Firefox<24
  9084. // Workaround erroneous numeric interpretation of +"0x"
  9085. return high !== high || escapedWhitespace ?
  9086. escaped :
  9087. high < 0 ?
  9088. // BMP codepoint
  9089. String.fromCharCode( high + 0x10000 ) :
  9090. // Supplemental Plane codepoint (surrogate pair)
  9091. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9092. },
  9093. // CSS string/identifier serialization
  9094. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9095. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9096. fcssescape = function( ch, asCodePoint ) {
  9097. if ( asCodePoint ) {
  9098. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9099. if ( ch === "\0" ) {
  9100. return "\uFFFD";
  9101. }
  9102. // Control characters and (dependent upon position) numbers get escaped as code points
  9103. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9104. }
  9105. // Other potentially-special ASCII characters get backslash-escaped
  9106. return "\\" + ch;
  9107. },
  9108. // Used for iframes
  9109. // See setDocument()
  9110. // Removing the function wrapper causes a "Permission Denied"
  9111. // error in IE
  9112. unloadHandler = function() {
  9113. setDocument();
  9114. },
  9115. inDisabledFieldset = addCombinator(
  9116. function( elem ) {
  9117. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9118. },
  9119. { dir: "parentNode", next: "legend" }
  9120. );
  9121. // Optimize for push.apply( _, NodeList )
  9122. try {
  9123. push.apply(
  9124. (arr = slice.call( preferredDoc.childNodes )),
  9125. preferredDoc.childNodes
  9126. );
  9127. // Support: Android<4.0
  9128. // Detect silently failing push.apply
  9129. arr[ preferredDoc.childNodes.length ].nodeType;
  9130. } catch ( e ) {
  9131. push = { apply: arr.length ?
  9132. // Leverage slice if possible
  9133. function( target, els ) {
  9134. push_native.apply( target, slice.call(els) );
  9135. } :
  9136. // Support: IE<9
  9137. // Otherwise append directly
  9138. function( target, els ) {
  9139. var j = target.length,
  9140. i = 0;
  9141. // Can't trust NodeList.length
  9142. while ( (target[j++] = els[i++]) ) {}
  9143. target.length = j - 1;
  9144. }
  9145. };
  9146. }
  9147. function Sizzle( selector, context, results, seed ) {
  9148. var m, i, elem, nid, match, groups, newSelector,
  9149. newContext = context && context.ownerDocument,
  9150. // nodeType defaults to 9, since context defaults to document
  9151. nodeType = context ? context.nodeType : 9;
  9152. results = results || [];
  9153. // Return early from calls with invalid selector or context
  9154. if ( typeof selector !== "string" || !selector ||
  9155. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9156. return results;
  9157. }
  9158. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9159. if ( !seed ) {
  9160. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9161. setDocument( context );
  9162. }
  9163. context = context || document;
  9164. if ( documentIsHTML ) {
  9165. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9166. // (excepting DocumentFragment context, where the methods don't exist)
  9167. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9168. // ID selector
  9169. if ( (m = match[1]) ) {
  9170. // Document context
  9171. if ( nodeType === 9 ) {
  9172. if ( (elem = context.getElementById( m )) ) {
  9173. // Support: IE, Opera, Webkit
  9174. // TODO: identify versions
  9175. // getElementById can match elements by name instead of ID
  9176. if ( elem.id === m ) {
  9177. results.push( elem );
  9178. return results;
  9179. }
  9180. } else {
  9181. return results;
  9182. }
  9183. // Element context
  9184. } else {
  9185. // Support: IE, Opera, Webkit
  9186. // TODO: identify versions
  9187. // getElementById can match elements by name instead of ID
  9188. if ( newContext && (elem = newContext.getElementById( m )) &&
  9189. contains( context, elem ) &&
  9190. elem.id === m ) {
  9191. results.push( elem );
  9192. return results;
  9193. }
  9194. }
  9195. // Type selector
  9196. } else if ( match[2] ) {
  9197. push.apply( results, context.getElementsByTagName( selector ) );
  9198. return results;
  9199. // Class selector
  9200. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9201. context.getElementsByClassName ) {
  9202. push.apply( results, context.getElementsByClassName( m ) );
  9203. return results;
  9204. }
  9205. }
  9206. // Take advantage of querySelectorAll
  9207. if ( support.qsa &&
  9208. !nonnativeSelectorCache[ selector + " " ] &&
  9209. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9210. // Support: IE 8 only
  9211. // Exclude object elements
  9212. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9213. newSelector = selector;
  9214. newContext = context;
  9215. // qSA considers elements outside a scoping root when evaluating child or
  9216. // descendant combinators, which is not what we want.
  9217. // In such cases, we work around the behavior by prefixing every selector in the
  9218. // list with an ID selector referencing the scope context.
  9219. // Thanks to Andrew Dupont for this technique.
  9220. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9221. // Capture the context ID, setting it first if necessary
  9222. if ( (nid = context.getAttribute( "id" )) ) {
  9223. nid = nid.replace( rcssescape, fcssescape );
  9224. } else {
  9225. context.setAttribute( "id", (nid = expando) );
  9226. }
  9227. // Prefix every selector in the list
  9228. groups = tokenize( selector );
  9229. i = groups.length;
  9230. while ( i-- ) {
  9231. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9232. }
  9233. newSelector = groups.join( "," );
  9234. // Expand context for sibling selectors
  9235. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9236. context;
  9237. }
  9238. try {
  9239. push.apply( results,
  9240. newContext.querySelectorAll( newSelector )
  9241. );
  9242. return results;
  9243. } catch ( qsaError ) {
  9244. nonnativeSelectorCache( selector, true );
  9245. } finally {
  9246. if ( nid === expando ) {
  9247. context.removeAttribute( "id" );
  9248. }
  9249. }
  9250. }
  9251. }
  9252. }
  9253. // All others
  9254. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9255. }
  9256. /**
  9257. * Create key-value caches of limited size
  9258. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9259. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9260. * deleting the oldest entry
  9261. */
  9262. function createCache() {
  9263. var keys = [];
  9264. function cache( key, value ) {
  9265. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9266. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9267. // Only keep the most recent entries
  9268. delete cache[ keys.shift() ];
  9269. }
  9270. return (cache[ key + " " ] = value);
  9271. }
  9272. return cache;
  9273. }
  9274. /**
  9275. * Mark a function for special use by Sizzle
  9276. * @param {Function} fn The function to mark
  9277. */
  9278. function markFunction( fn ) {
  9279. fn[ expando ] = true;
  9280. return fn;
  9281. }
  9282. /**
  9283. * Support testing using an element
  9284. * @param {Function} fn Passed the created element and returns a boolean result
  9285. */
  9286. function assert( fn ) {
  9287. var el = document.createElement("fieldset");
  9288. try {
  9289. return !!fn( el );
  9290. } catch (e) {
  9291. return false;
  9292. } finally {
  9293. // Remove from its parent by default
  9294. if ( el.parentNode ) {
  9295. el.parentNode.removeChild( el );
  9296. }
  9297. // release memory in IE
  9298. el = null;
  9299. }
  9300. }
  9301. /**
  9302. * Adds the same handler for all of the specified attrs
  9303. * @param {String} attrs Pipe-separated list of attributes
  9304. * @param {Function} handler The method that will be applied
  9305. */
  9306. function addHandle( attrs, handler ) {
  9307. var arr = attrs.split("|"),
  9308. i = arr.length;
  9309. while ( i-- ) {
  9310. Expr.attrHandle[ arr[i] ] = handler;
  9311. }
  9312. }
  9313. /**
  9314. * Checks document order of two siblings
  9315. * @param {Element} a
  9316. * @param {Element} b
  9317. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9318. */
  9319. function siblingCheck( a, b ) {
  9320. var cur = b && a,
  9321. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9322. a.sourceIndex - b.sourceIndex;
  9323. // Use IE sourceIndex if available on both nodes
  9324. if ( diff ) {
  9325. return diff;
  9326. }
  9327. // Check if b follows a
  9328. if ( cur ) {
  9329. while ( (cur = cur.nextSibling) ) {
  9330. if ( cur === b ) {
  9331. return -1;
  9332. }
  9333. }
  9334. }
  9335. return a ? 1 : -1;
  9336. }
  9337. /**
  9338. * Returns a function to use in pseudos for input types
  9339. * @param {String} type
  9340. */
  9341. function createInputPseudo( type ) {
  9342. return function( elem ) {
  9343. var name = elem.nodeName.toLowerCase();
  9344. return name === "input" && elem.type === type;
  9345. };
  9346. }
  9347. /**
  9348. * Returns a function to use in pseudos for buttons
  9349. * @param {String} type
  9350. */
  9351. function createButtonPseudo( type ) {
  9352. return function( elem ) {
  9353. var name = elem.nodeName.toLowerCase();
  9354. return (name === "input" || name === "button") && elem.type === type;
  9355. };
  9356. }
  9357. /**
  9358. * Returns a function to use in pseudos for :enabled/:disabled
  9359. * @param {Boolean} disabled true for :disabled; false for :enabled
  9360. */
  9361. function createDisabledPseudo( disabled ) {
  9362. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9363. return function( elem ) {
  9364. // Only certain elements can match :enabled or :disabled
  9365. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9366. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9367. if ( "form" in elem ) {
  9368. // Check for inherited disabledness on relevant non-disabled elements:
  9369. // * listed form-associated elements in a disabled fieldset
  9370. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9371. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9372. // * option elements in a disabled optgroup
  9373. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9374. // All such elements have a "form" property.
  9375. if ( elem.parentNode && elem.disabled === false ) {
  9376. // Option elements defer to a parent optgroup if present
  9377. if ( "label" in elem ) {
  9378. if ( "label" in elem.parentNode ) {
  9379. return elem.parentNode.disabled === disabled;
  9380. } else {
  9381. return elem.disabled === disabled;
  9382. }
  9383. }
  9384. // Support: IE 6 - 11
  9385. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9386. return elem.isDisabled === disabled ||
  9387. // Where there is no isDisabled, check manually
  9388. /* jshint -W018 */
  9389. elem.isDisabled !== !disabled &&
  9390. inDisabledFieldset( elem ) === disabled;
  9391. }
  9392. return elem.disabled === disabled;
  9393. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9394. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9395. // even exist on them, let alone have a boolean value.
  9396. } else if ( "label" in elem ) {
  9397. return elem.disabled === disabled;
  9398. }
  9399. // Remaining elements are neither :enabled nor :disabled
  9400. return false;
  9401. };
  9402. }
  9403. /**
  9404. * Returns a function to use in pseudos for positionals
  9405. * @param {Function} fn
  9406. */
  9407. function createPositionalPseudo( fn ) {
  9408. return markFunction(function( argument ) {
  9409. argument = +argument;
  9410. return markFunction(function( seed, matches ) {
  9411. var j,
  9412. matchIndexes = fn( [], seed.length, argument ),
  9413. i = matchIndexes.length;
  9414. // Match elements found at the specified indexes
  9415. while ( i-- ) {
  9416. if ( seed[ (j = matchIndexes[i]) ] ) {
  9417. seed[j] = !(matches[j] = seed[j]);
  9418. }
  9419. }
  9420. });
  9421. });
  9422. }
  9423. /**
  9424. * Checks a node for validity as a Sizzle context
  9425. * @param {Element|Object=} context
  9426. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9427. */
  9428. function testContext( context ) {
  9429. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9430. }
  9431. // Expose support vars for convenience
  9432. support = Sizzle.support = {};
  9433. /**
  9434. * Detects XML nodes
  9435. * @param {Element|Object} elem An element or a document
  9436. * @returns {Boolean} True iff elem is a non-HTML XML node
  9437. */
  9438. isXML = Sizzle.isXML = function( elem ) {
  9439. var namespace = elem.namespaceURI,
  9440. docElem = (elem.ownerDocument || elem).documentElement;
  9441. // Support: IE <=8
  9442. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9443. // https://bugs.jquery.com/ticket/4833
  9444. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9445. };
  9446. /**
  9447. * Sets document-related variables once based on the current document
  9448. * @param {Element|Object} [doc] An element or document object to use to set the document
  9449. * @returns {Object} Returns the current document
  9450. */
  9451. setDocument = Sizzle.setDocument = function( node ) {
  9452. var hasCompare, subWindow,
  9453. doc = node ? node.ownerDocument || node : preferredDoc;
  9454. // Return early if doc is invalid or already selected
  9455. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9456. return document;
  9457. }
  9458. // Update global variables
  9459. document = doc;
  9460. docElem = document.documentElement;
  9461. documentIsHTML = !isXML( document );
  9462. // Support: IE 9-11, Edge
  9463. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9464. if ( preferredDoc !== document &&
  9465. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9466. // Support: IE 11, Edge
  9467. if ( subWindow.addEventListener ) {
  9468. subWindow.addEventListener( "unload", unloadHandler, false );
  9469. // Support: IE 9 - 10 only
  9470. } else if ( subWindow.attachEvent ) {
  9471. subWindow.attachEvent( "onunload", unloadHandler );
  9472. }
  9473. }
  9474. /* Attributes
  9475. ---------------------------------------------------------------------- */
  9476. // Support: IE<8
  9477. // Verify that getAttribute really returns attributes and not properties
  9478. // (excepting IE8 booleans)
  9479. support.attributes = assert(function( el ) {
  9480. el.className = "i";
  9481. return !el.getAttribute("className");
  9482. });
  9483. /* getElement(s)By*
  9484. ---------------------------------------------------------------------- */
  9485. // Check if getElementsByTagName("*") returns only elements
  9486. support.getElementsByTagName = assert(function( el ) {
  9487. el.appendChild( document.createComment("") );
  9488. return !el.getElementsByTagName("*").length;
  9489. });
  9490. // Support: IE<9
  9491. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9492. // Support: IE<10
  9493. // Check if getElementById returns elements by name
  9494. // The broken getElementById methods don't pick up programmatically-set names,
  9495. // so use a roundabout getElementsByName test
  9496. support.getById = assert(function( el ) {
  9497. docElem.appendChild( el ).id = expando;
  9498. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9499. });
  9500. // ID filter and find
  9501. if ( support.getById ) {
  9502. Expr.filter["ID"] = function( id ) {
  9503. var attrId = id.replace( runescape, funescape );
  9504. return function( elem ) {
  9505. return elem.getAttribute("id") === attrId;
  9506. };
  9507. };
  9508. Expr.find["ID"] = function( id, context ) {
  9509. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9510. var elem = context.getElementById( id );
  9511. return elem ? [ elem ] : [];
  9512. }
  9513. };
  9514. } else {
  9515. Expr.filter["ID"] = function( id ) {
  9516. var attrId = id.replace( runescape, funescape );
  9517. return function( elem ) {
  9518. var node = typeof elem.getAttributeNode !== "undefined" &&
  9519. elem.getAttributeNode("id");
  9520. return node && node.value === attrId;
  9521. };
  9522. };
  9523. // Support: IE 6 - 7 only
  9524. // getElementById is not reliable as a find shortcut
  9525. Expr.find["ID"] = function( id, context ) {
  9526. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9527. var node, i, elems,
  9528. elem = context.getElementById( id );
  9529. if ( elem ) {
  9530. // Verify the id attribute
  9531. node = elem.getAttributeNode("id");
  9532. if ( node && node.value === id ) {
  9533. return [ elem ];
  9534. }
  9535. // Fall back on getElementsByName
  9536. elems = context.getElementsByName( id );
  9537. i = 0;
  9538. while ( (elem = elems[i++]) ) {
  9539. node = elem.getAttributeNode("id");
  9540. if ( node && node.value === id ) {
  9541. return [ elem ];
  9542. }
  9543. }
  9544. }
  9545. return [];
  9546. }
  9547. };
  9548. }
  9549. // Tag
  9550. Expr.find["TAG"] = support.getElementsByTagName ?
  9551. function( tag, context ) {
  9552. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9553. return context.getElementsByTagName( tag );
  9554. // DocumentFragment nodes don't have gEBTN
  9555. } else if ( support.qsa ) {
  9556. return context.querySelectorAll( tag );
  9557. }
  9558. } :
  9559. function( tag, context ) {
  9560. var elem,
  9561. tmp = [],
  9562. i = 0,
  9563. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9564. results = context.getElementsByTagName( tag );
  9565. // Filter out possible comments
  9566. if ( tag === "*" ) {
  9567. while ( (elem = results[i++]) ) {
  9568. if ( elem.nodeType === 1 ) {
  9569. tmp.push( elem );
  9570. }
  9571. }
  9572. return tmp;
  9573. }
  9574. return results;
  9575. };
  9576. // Class
  9577. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9578. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9579. return context.getElementsByClassName( className );
  9580. }
  9581. };
  9582. /* QSA/matchesSelector
  9583. ---------------------------------------------------------------------- */
  9584. // QSA and matchesSelector support
  9585. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9586. rbuggyMatches = [];
  9587. // qSa(:focus) reports false when true (Chrome 21)
  9588. // We allow this because of a bug in IE8/9 that throws an error
  9589. // whenever `document.activeElement` is accessed on an iframe
  9590. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9591. // See https://bugs.jquery.com/ticket/13378
  9592. rbuggyQSA = [];
  9593. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9594. // Build QSA regex
  9595. // Regex strategy adopted from Diego Perini
  9596. assert(function( el ) {
  9597. // Select is set to empty string on purpose
  9598. // This is to test IE's treatment of not explicitly
  9599. // setting a boolean content attribute,
  9600. // since its presence should be enough
  9601. // https://bugs.jquery.com/ticket/12359
  9602. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9603. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9604. "<option selected=''></option></select>";
  9605. // Support: IE8, Opera 11-12.16
  9606. // Nothing should be selected when empty strings follow ^= or $= or *=
  9607. // The test attribute must be unknown in Opera but "safe" for WinRT
  9608. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9609. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9610. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9611. }
  9612. // Support: IE8
  9613. // Boolean attributes and "value" are not treated correctly
  9614. if ( !el.querySelectorAll("[selected]").length ) {
  9615. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9616. }
  9617. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9618. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9619. rbuggyQSA.push("~=");
  9620. }
  9621. // Webkit/Opera - :checked should return selected option elements
  9622. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9623. // IE8 throws error here and will not see later tests
  9624. if ( !el.querySelectorAll(":checked").length ) {
  9625. rbuggyQSA.push(":checked");
  9626. }
  9627. // Support: Safari 8+, iOS 8+
  9628. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9629. // In-page `selector#id sibling-combinator selector` fails
  9630. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9631. rbuggyQSA.push(".#.+[+~]");
  9632. }
  9633. });
  9634. assert(function( el ) {
  9635. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9636. "<select disabled='disabled'><option/></select>";
  9637. // Support: Windows 8 Native Apps
  9638. // The type and name attributes are restricted during .innerHTML assignment
  9639. var input = document.createElement("input");
  9640. input.setAttribute( "type", "hidden" );
  9641. el.appendChild( input ).setAttribute( "name", "D" );
  9642. // Support: IE8
  9643. // Enforce case-sensitivity of name attribute
  9644. if ( el.querySelectorAll("[name=d]").length ) {
  9645. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9646. }
  9647. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9648. // IE8 throws error here and will not see later tests
  9649. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9650. rbuggyQSA.push( ":enabled", ":disabled" );
  9651. }
  9652. // Support: IE9-11+
  9653. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9654. docElem.appendChild( el ).disabled = true;
  9655. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9656. rbuggyQSA.push( ":enabled", ":disabled" );
  9657. }
  9658. // Opera 10-11 does not throw on post-comma invalid pseudos
  9659. el.querySelectorAll("*,:x");
  9660. rbuggyQSA.push(",.*:");
  9661. });
  9662. }
  9663. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9664. docElem.webkitMatchesSelector ||
  9665. docElem.mozMatchesSelector ||
  9666. docElem.oMatchesSelector ||
  9667. docElem.msMatchesSelector) )) ) {
  9668. assert(function( el ) {
  9669. // Check to see if it's possible to do matchesSelector
  9670. // on a disconnected node (IE 9)
  9671. support.disconnectedMatch = matches.call( el, "*" );
  9672. // This should fail with an exception
  9673. // Gecko does not error, returns false instead
  9674. matches.call( el, "[s!='']:x" );
  9675. rbuggyMatches.push( "!=", pseudos );
  9676. });
  9677. }
  9678. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9679. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9680. /* Contains
  9681. ---------------------------------------------------------------------- */
  9682. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9683. // Element contains another
  9684. // Purposefully self-exclusive
  9685. // As in, an element does not contain itself
  9686. contains = hasCompare || rnative.test( docElem.contains ) ?
  9687. function( a, b ) {
  9688. var adown = a.nodeType === 9 ? a.documentElement : a,
  9689. bup = b && b.parentNode;
  9690. return a === bup || !!( bup && bup.nodeType === 1 && (
  9691. adown.contains ?
  9692. adown.contains( bup ) :
  9693. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9694. ));
  9695. } :
  9696. function( a, b ) {
  9697. if ( b ) {
  9698. while ( (b = b.parentNode) ) {
  9699. if ( b === a ) {
  9700. return true;
  9701. }
  9702. }
  9703. }
  9704. return false;
  9705. };
  9706. /* Sorting
  9707. ---------------------------------------------------------------------- */
  9708. // Document order sorting
  9709. sortOrder = hasCompare ?
  9710. function( a, b ) {
  9711. // Flag for duplicate removal
  9712. if ( a === b ) {
  9713. hasDuplicate = true;
  9714. return 0;
  9715. }
  9716. // Sort on method existence if only one input has compareDocumentPosition
  9717. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9718. if ( compare ) {
  9719. return compare;
  9720. }
  9721. // Calculate position if both inputs belong to the same document
  9722. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9723. a.compareDocumentPosition( b ) :
  9724. // Otherwise we know they are disconnected
  9725. 1;
  9726. // Disconnected nodes
  9727. if ( compare & 1 ||
  9728. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9729. // Choose the first element that is related to our preferred document
  9730. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9731. return -1;
  9732. }
  9733. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9734. return 1;
  9735. }
  9736. // Maintain original order
  9737. return sortInput ?
  9738. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9739. 0;
  9740. }
  9741. return compare & 4 ? -1 : 1;
  9742. } :
  9743. function( a, b ) {
  9744. // Exit early if the nodes are identical
  9745. if ( a === b ) {
  9746. hasDuplicate = true;
  9747. return 0;
  9748. }
  9749. var cur,
  9750. i = 0,
  9751. aup = a.parentNode,
  9752. bup = b.parentNode,
  9753. ap = [ a ],
  9754. bp = [ b ];
  9755. // Parentless nodes are either documents or disconnected
  9756. if ( !aup || !bup ) {
  9757. return a === document ? -1 :
  9758. b === document ? 1 :
  9759. aup ? -1 :
  9760. bup ? 1 :
  9761. sortInput ?
  9762. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9763. 0;
  9764. // If the nodes are siblings, we can do a quick check
  9765. } else if ( aup === bup ) {
  9766. return siblingCheck( a, b );
  9767. }
  9768. // Otherwise we need full lists of their ancestors for comparison
  9769. cur = a;
  9770. while ( (cur = cur.parentNode) ) {
  9771. ap.unshift( cur );
  9772. }
  9773. cur = b;
  9774. while ( (cur = cur.parentNode) ) {
  9775. bp.unshift( cur );
  9776. }
  9777. // Walk down the tree looking for a discrepancy
  9778. while ( ap[i] === bp[i] ) {
  9779. i++;
  9780. }
  9781. return i ?
  9782. // Do a sibling check if the nodes have a common ancestor
  9783. siblingCheck( ap[i], bp[i] ) :
  9784. // Otherwise nodes in our document sort first
  9785. ap[i] === preferredDoc ? -1 :
  9786. bp[i] === preferredDoc ? 1 :
  9787. 0;
  9788. };
  9789. return document;
  9790. };
  9791. Sizzle.matches = function( expr, elements ) {
  9792. return Sizzle( expr, null, null, elements );
  9793. };
  9794. Sizzle.matchesSelector = function( elem, expr ) {
  9795. // Set document vars if needed
  9796. if ( ( elem.ownerDocument || elem ) !== document ) {
  9797. setDocument( elem );
  9798. }
  9799. if ( support.matchesSelector && documentIsHTML &&
  9800. !nonnativeSelectorCache[ expr + " " ] &&
  9801. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9802. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9803. try {
  9804. var ret = matches.call( elem, expr );
  9805. // IE 9's matchesSelector returns false on disconnected nodes
  9806. if ( ret || support.disconnectedMatch ||
  9807. // As well, disconnected nodes are said to be in a document
  9808. // fragment in IE 9
  9809. elem.document && elem.document.nodeType !== 11 ) {
  9810. return ret;
  9811. }
  9812. } catch (e) {
  9813. nonnativeSelectorCache( expr, true );
  9814. }
  9815. }
  9816. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9817. };
  9818. Sizzle.contains = function( context, elem ) {
  9819. // Set document vars if needed
  9820. if ( ( context.ownerDocument || context ) !== document ) {
  9821. setDocument( context );
  9822. }
  9823. return contains( context, elem );
  9824. };
  9825. Sizzle.attr = function( elem, name ) {
  9826. // Set document vars if needed
  9827. if ( ( elem.ownerDocument || elem ) !== document ) {
  9828. setDocument( elem );
  9829. }
  9830. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9831. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9832. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9833. fn( elem, name, !documentIsHTML ) :
  9834. undefined;
  9835. return val !== undefined ?
  9836. val :
  9837. support.attributes || !documentIsHTML ?
  9838. elem.getAttribute( name ) :
  9839. (val = elem.getAttributeNode(name)) && val.specified ?
  9840. val.value :
  9841. null;
  9842. };
  9843. Sizzle.escape = function( sel ) {
  9844. return (sel + "").replace( rcssescape, fcssescape );
  9845. };
  9846. Sizzle.error = function( msg ) {
  9847. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9848. };
  9849. /**
  9850. * Document sorting and removing duplicates
  9851. * @param {ArrayLike} results
  9852. */
  9853. Sizzle.uniqueSort = function( results ) {
  9854. var elem,
  9855. duplicates = [],
  9856. j = 0,
  9857. i = 0;
  9858. // Unless we *know* we can detect duplicates, assume their presence
  9859. hasDuplicate = !support.detectDuplicates;
  9860. sortInput = !support.sortStable && results.slice( 0 );
  9861. results.sort( sortOrder );
  9862. if ( hasDuplicate ) {
  9863. while ( (elem = results[i++]) ) {
  9864. if ( elem === results[ i ] ) {
  9865. j = duplicates.push( i );
  9866. }
  9867. }
  9868. while ( j-- ) {
  9869. results.splice( duplicates[ j ], 1 );
  9870. }
  9871. }
  9872. // Clear input after sorting to release objects
  9873. // See https://github.com/jquery/sizzle/pull/225
  9874. sortInput = null;
  9875. return results;
  9876. };
  9877. /**
  9878. * Utility function for retrieving the text value of an array of DOM nodes
  9879. * @param {Array|Element} elem
  9880. */
  9881. getText = Sizzle.getText = function( elem ) {
  9882. var node,
  9883. ret = "",
  9884. i = 0,
  9885. nodeType = elem.nodeType;
  9886. if ( !nodeType ) {
  9887. // If no nodeType, this is expected to be an array
  9888. while ( (node = elem[i++]) ) {
  9889. // Do not traverse comment nodes
  9890. ret += getText( node );
  9891. }
  9892. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9893. // Use textContent for elements
  9894. // innerText usage removed for consistency of new lines (jQuery #11153)
  9895. if ( typeof elem.textContent === "string" ) {
  9896. return elem.textContent;
  9897. } else {
  9898. // Traverse its children
  9899. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9900. ret += getText( elem );
  9901. }
  9902. }
  9903. } else if ( nodeType === 3 || nodeType === 4 ) {
  9904. return elem.nodeValue;
  9905. }
  9906. // Do not include comment or processing instruction nodes
  9907. return ret;
  9908. };
  9909. Expr = Sizzle.selectors = {
  9910. // Can be adjusted by the user
  9911. cacheLength: 50,
  9912. createPseudo: markFunction,
  9913. match: matchExpr,
  9914. attrHandle: {},
  9915. find: {},
  9916. relative: {
  9917. ">": { dir: "parentNode", first: true },
  9918. " ": { dir: "parentNode" },
  9919. "+": { dir: "previousSibling", first: true },
  9920. "~": { dir: "previousSibling" }
  9921. },
  9922. preFilter: {
  9923. "ATTR": function( match ) {
  9924. match[1] = match[1].replace( runescape, funescape );
  9925. // Move the given value to match[3] whether quoted or unquoted
  9926. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  9927. if ( match[2] === "~=" ) {
  9928. match[3] = " " + match[3] + " ";
  9929. }
  9930. return match.slice( 0, 4 );
  9931. },
  9932. "CHILD": function( match ) {
  9933. /* matches from matchExpr["CHILD"]
  9934. 1 type (only|nth|...)
  9935. 2 what (child|of-type)
  9936. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  9937. 4 xn-component of xn+y argument ([+-]?\d*n|)
  9938. 5 sign of xn-component
  9939. 6 x of xn-component
  9940. 7 sign of y-component
  9941. 8 y of y-component
  9942. */
  9943. match[1] = match[1].toLowerCase();
  9944. if ( match[1].slice( 0, 3 ) === "nth" ) {
  9945. // nth-* requires argument
  9946. if ( !match[3] ) {
  9947. Sizzle.error( match[0] );
  9948. }
  9949. // numeric x and y parameters for Expr.filter.CHILD
  9950. // remember that false/true cast respectively to 0/1
  9951. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  9952. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  9953. // other types prohibit arguments
  9954. } else if ( match[3] ) {
  9955. Sizzle.error( match[0] );
  9956. }
  9957. return match;
  9958. },
  9959. "PSEUDO": function( match ) {
  9960. var excess,
  9961. unquoted = !match[6] && match[2];
  9962. if ( matchExpr["CHILD"].test( match[0] ) ) {
  9963. return null;
  9964. }
  9965. // Accept quoted arguments as-is
  9966. if ( match[3] ) {
  9967. match[2] = match[4] || match[5] || "";
  9968. // Strip excess characters from unquoted arguments
  9969. } else if ( unquoted && rpseudo.test( unquoted ) &&
  9970. // Get excess from tokenize (recursively)
  9971. (excess = tokenize( unquoted, true )) &&
  9972. // advance to the next closing parenthesis
  9973. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  9974. // excess is a negative index
  9975. match[0] = match[0].slice( 0, excess );
  9976. match[2] = unquoted.slice( 0, excess );
  9977. }
  9978. // Return only captures needed by the pseudo filter method (type and argument)
  9979. return match.slice( 0, 3 );
  9980. }
  9981. },
  9982. filter: {
  9983. "TAG": function( nodeNameSelector ) {
  9984. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  9985. return nodeNameSelector === "*" ?
  9986. function() { return true; } :
  9987. function( elem ) {
  9988. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  9989. };
  9990. },
  9991. "CLASS": function( className ) {
  9992. var pattern = classCache[ className + " " ];
  9993. return pattern ||
  9994. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  9995. classCache( className, function( elem ) {
  9996. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  9997. });
  9998. },
  9999. "ATTR": function( name, operator, check ) {
  10000. return function( elem ) {
  10001. var result = Sizzle.attr( elem, name );
  10002. if ( result == null ) {
  10003. return operator === "!=";
  10004. }
  10005. if ( !operator ) {
  10006. return true;
  10007. }
  10008. result += "";
  10009. return operator === "=" ? result === check :
  10010. operator === "!=" ? result !== check :
  10011. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10012. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10013. operator === "$=" ? check && result.slice( -check.length ) === check :
  10014. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10015. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10016. false;
  10017. };
  10018. },
  10019. "CHILD": function( type, what, argument, first, last ) {
  10020. var simple = type.slice( 0, 3 ) !== "nth",
  10021. forward = type.slice( -4 ) !== "last",
  10022. ofType = what === "of-type";
  10023. return first === 1 && last === 0 ?
  10024. // Shortcut for :nth-*(n)
  10025. function( elem ) {
  10026. return !!elem.parentNode;
  10027. } :
  10028. function( elem, context, xml ) {
  10029. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10030. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10031. parent = elem.parentNode,
  10032. name = ofType && elem.nodeName.toLowerCase(),
  10033. useCache = !xml && !ofType,
  10034. diff = false;
  10035. if ( parent ) {
  10036. // :(first|last|only)-(child|of-type)
  10037. if ( simple ) {
  10038. while ( dir ) {
  10039. node = elem;
  10040. while ( (node = node[ dir ]) ) {
  10041. if ( ofType ?
  10042. node.nodeName.toLowerCase() === name :
  10043. node.nodeType === 1 ) {
  10044. return false;
  10045. }
  10046. }
  10047. // Reverse direction for :only-* (if we haven't yet done so)
  10048. start = dir = type === "only" && !start && "nextSibling";
  10049. }
  10050. return true;
  10051. }
  10052. start = [ forward ? parent.firstChild : parent.lastChild ];
  10053. // non-xml :nth-child(...) stores cache data on `parent`
  10054. if ( forward && useCache ) {
  10055. // Seek `elem` from a previously-cached index
  10056. // ...in a gzip-friendly way
  10057. node = parent;
  10058. outerCache = node[ expando ] || (node[ expando ] = {});
  10059. // Support: IE <9 only
  10060. // Defend against cloned attroperties (jQuery gh-1709)
  10061. uniqueCache = outerCache[ node.uniqueID ] ||
  10062. (outerCache[ node.uniqueID ] = {});
  10063. cache = uniqueCache[ type ] || [];
  10064. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10065. diff = nodeIndex && cache[ 2 ];
  10066. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10067. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10068. // Fallback to seeking `elem` from the start
  10069. (diff = nodeIndex = 0) || start.pop()) ) {
  10070. // When found, cache indexes on `parent` and break
  10071. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10072. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10073. break;
  10074. }
  10075. }
  10076. } else {
  10077. // Use previously-cached element index if available
  10078. if ( useCache ) {
  10079. // ...in a gzip-friendly way
  10080. node = elem;
  10081. outerCache = node[ expando ] || (node[ expando ] = {});
  10082. // Support: IE <9 only
  10083. // Defend against cloned attroperties (jQuery gh-1709)
  10084. uniqueCache = outerCache[ node.uniqueID ] ||
  10085. (outerCache[ node.uniqueID ] = {});
  10086. cache = uniqueCache[ type ] || [];
  10087. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10088. diff = nodeIndex;
  10089. }
  10090. // xml :nth-child(...)
  10091. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10092. if ( diff === false ) {
  10093. // Use the same loop as above to seek `elem` from the start
  10094. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10095. (diff = nodeIndex = 0) || start.pop()) ) {
  10096. if ( ( ofType ?
  10097. node.nodeName.toLowerCase() === name :
  10098. node.nodeType === 1 ) &&
  10099. ++diff ) {
  10100. // Cache the index of each encountered element
  10101. if ( useCache ) {
  10102. outerCache = node[ expando ] || (node[ expando ] = {});
  10103. // Support: IE <9 only
  10104. // Defend against cloned attroperties (jQuery gh-1709)
  10105. uniqueCache = outerCache[ node.uniqueID ] ||
  10106. (outerCache[ node.uniqueID ] = {});
  10107. uniqueCache[ type ] = [ dirruns, diff ];
  10108. }
  10109. if ( node === elem ) {
  10110. break;
  10111. }
  10112. }
  10113. }
  10114. }
  10115. }
  10116. // Incorporate the offset, then check against cycle size
  10117. diff -= last;
  10118. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10119. }
  10120. };
  10121. },
  10122. "PSEUDO": function( pseudo, argument ) {
  10123. // pseudo-class names are case-insensitive
  10124. // http://www.w3.org/TR/selectors/#pseudo-classes
  10125. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10126. // Remember that setFilters inherits from pseudos
  10127. var args,
  10128. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10129. Sizzle.error( "unsupported pseudo: " + pseudo );
  10130. // The user may use createPseudo to indicate that
  10131. // arguments are needed to create the filter function
  10132. // just as Sizzle does
  10133. if ( fn[ expando ] ) {
  10134. return fn( argument );
  10135. }
  10136. // But maintain support for old signatures
  10137. if ( fn.length > 1 ) {
  10138. args = [ pseudo, pseudo, "", argument ];
  10139. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10140. markFunction(function( seed, matches ) {
  10141. var idx,
  10142. matched = fn( seed, argument ),
  10143. i = matched.length;
  10144. while ( i-- ) {
  10145. idx = indexOf( seed, matched[i] );
  10146. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10147. }
  10148. }) :
  10149. function( elem ) {
  10150. return fn( elem, 0, args );
  10151. };
  10152. }
  10153. return fn;
  10154. }
  10155. },
  10156. pseudos: {
  10157. // Potentially complex pseudos
  10158. "not": markFunction(function( selector ) {
  10159. // Trim the selector passed to compile
  10160. // to avoid treating leading and trailing
  10161. // spaces as combinators
  10162. var input = [],
  10163. results = [],
  10164. matcher = compile( selector.replace( rtrim, "$1" ) );
  10165. return matcher[ expando ] ?
  10166. markFunction(function( seed, matches, context, xml ) {
  10167. var elem,
  10168. unmatched = matcher( seed, null, xml, [] ),
  10169. i = seed.length;
  10170. // Match elements unmatched by `matcher`
  10171. while ( i-- ) {
  10172. if ( (elem = unmatched[i]) ) {
  10173. seed[i] = !(matches[i] = elem);
  10174. }
  10175. }
  10176. }) :
  10177. function( elem, context, xml ) {
  10178. input[0] = elem;
  10179. matcher( input, null, xml, results );
  10180. // Don't keep the element (issue #299)
  10181. input[0] = null;
  10182. return !results.pop();
  10183. };
  10184. }),
  10185. "has": markFunction(function( selector ) {
  10186. return function( elem ) {
  10187. return Sizzle( selector, elem ).length > 0;
  10188. };
  10189. }),
  10190. "contains": markFunction(function( text ) {
  10191. text = text.replace( runescape, funescape );
  10192. return function( elem ) {
  10193. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10194. };
  10195. }),
  10196. // "Whether an element is represented by a :lang() selector
  10197. // is based solely on the element's language value
  10198. // being equal to the identifier C,
  10199. // or beginning with the identifier C immediately followed by "-".
  10200. // The matching of C against the element's language value is performed case-insensitively.
  10201. // The identifier C does not have to be a valid language name."
  10202. // http://www.w3.org/TR/selectors/#lang-pseudo
  10203. "lang": markFunction( function( lang ) {
  10204. // lang value must be a valid identifier
  10205. if ( !ridentifier.test(lang || "") ) {
  10206. Sizzle.error( "unsupported lang: " + lang );
  10207. }
  10208. lang = lang.replace( runescape, funescape ).toLowerCase();
  10209. return function( elem ) {
  10210. var elemLang;
  10211. do {
  10212. if ( (elemLang = documentIsHTML ?
  10213. elem.lang :
  10214. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10215. elemLang = elemLang.toLowerCase();
  10216. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10217. }
  10218. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10219. return false;
  10220. };
  10221. }),
  10222. // Miscellaneous
  10223. "target": function( elem ) {
  10224. var hash = window.location && window.location.hash;
  10225. return hash && hash.slice( 1 ) === elem.id;
  10226. },
  10227. "root": function( elem ) {
  10228. return elem === docElem;
  10229. },
  10230. "focus": function( elem ) {
  10231. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10232. },
  10233. // Boolean properties
  10234. "enabled": createDisabledPseudo( false ),
  10235. "disabled": createDisabledPseudo( true ),
  10236. "checked": function( elem ) {
  10237. // In CSS3, :checked should return both checked and selected elements
  10238. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10239. var nodeName = elem.nodeName.toLowerCase();
  10240. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10241. },
  10242. "selected": function( elem ) {
  10243. // Accessing this property makes selected-by-default
  10244. // options in Safari work properly
  10245. if ( elem.parentNode ) {
  10246. elem.parentNode.selectedIndex;
  10247. }
  10248. return elem.selected === true;
  10249. },
  10250. // Contents
  10251. "empty": function( elem ) {
  10252. // http://www.w3.org/TR/selectors/#empty-pseudo
  10253. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10254. // but not by others (comment: 8; processing instruction: 7; etc.)
  10255. // nodeType < 6 works because attributes (2) do not appear as children
  10256. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10257. if ( elem.nodeType < 6 ) {
  10258. return false;
  10259. }
  10260. }
  10261. return true;
  10262. },
  10263. "parent": function( elem ) {
  10264. return !Expr.pseudos["empty"]( elem );
  10265. },
  10266. // Element/input types
  10267. "header": function( elem ) {
  10268. return rheader.test( elem.nodeName );
  10269. },
  10270. "input": function( elem ) {
  10271. return rinputs.test( elem.nodeName );
  10272. },
  10273. "button": function( elem ) {
  10274. var name = elem.nodeName.toLowerCase();
  10275. return name === "input" && elem.type === "button" || name === "button";
  10276. },
  10277. "text": function( elem ) {
  10278. var attr;
  10279. return elem.nodeName.toLowerCase() === "input" &&
  10280. elem.type === "text" &&
  10281. // Support: IE<8
  10282. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10283. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10284. },
  10285. // Position-in-collection
  10286. "first": createPositionalPseudo(function() {
  10287. return [ 0 ];
  10288. }),
  10289. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10290. return [ length - 1 ];
  10291. }),
  10292. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10293. return [ argument < 0 ? argument + length : argument ];
  10294. }),
  10295. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10296. var i = 0;
  10297. for ( ; i < length; i += 2 ) {
  10298. matchIndexes.push( i );
  10299. }
  10300. return matchIndexes;
  10301. }),
  10302. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10303. var i = 1;
  10304. for ( ; i < length; i += 2 ) {
  10305. matchIndexes.push( i );
  10306. }
  10307. return matchIndexes;
  10308. }),
  10309. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10310. var i = argument < 0 ?
  10311. argument + length :
  10312. argument > length ?
  10313. length :
  10314. argument;
  10315. for ( ; --i >= 0; ) {
  10316. matchIndexes.push( i );
  10317. }
  10318. return matchIndexes;
  10319. }),
  10320. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10321. var i = argument < 0 ? argument + length : argument;
  10322. for ( ; ++i < length; ) {
  10323. matchIndexes.push( i );
  10324. }
  10325. return matchIndexes;
  10326. })
  10327. }
  10328. };
  10329. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10330. // Add button/input type pseudos
  10331. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10332. Expr.pseudos[ i ] = createInputPseudo( i );
  10333. }
  10334. for ( i in { submit: true, reset: true } ) {
  10335. Expr.pseudos[ i ] = createButtonPseudo( i );
  10336. }
  10337. // Easy API for creating new setFilters
  10338. function setFilters() {}
  10339. setFilters.prototype = Expr.filters = Expr.pseudos;
  10340. Expr.setFilters = new setFilters();
  10341. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10342. var matched, match, tokens, type,
  10343. soFar, groups, preFilters,
  10344. cached = tokenCache[ selector + " " ];
  10345. if ( cached ) {
  10346. return parseOnly ? 0 : cached.slice( 0 );
  10347. }
  10348. soFar = selector;
  10349. groups = [];
  10350. preFilters = Expr.preFilter;
  10351. while ( soFar ) {
  10352. // Comma and first run
  10353. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10354. if ( match ) {
  10355. // Don't consume trailing commas as valid
  10356. soFar = soFar.slice( match[0].length ) || soFar;
  10357. }
  10358. groups.push( (tokens = []) );
  10359. }
  10360. matched = false;
  10361. // Combinators
  10362. if ( (match = rcombinators.exec( soFar )) ) {
  10363. matched = match.shift();
  10364. tokens.push({
  10365. value: matched,
  10366. // Cast descendant combinators to space
  10367. type: match[0].replace( rtrim, " " )
  10368. });
  10369. soFar = soFar.slice( matched.length );
  10370. }
  10371. // Filters
  10372. for ( type in Expr.filter ) {
  10373. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10374. (match = preFilters[ type ]( match ))) ) {
  10375. matched = match.shift();
  10376. tokens.push({
  10377. value: matched,
  10378. type: type,
  10379. matches: match
  10380. });
  10381. soFar = soFar.slice( matched.length );
  10382. }
  10383. }
  10384. if ( !matched ) {
  10385. break;
  10386. }
  10387. }
  10388. // Return the length of the invalid excess
  10389. // if we're just parsing
  10390. // Otherwise, throw an error or return tokens
  10391. return parseOnly ?
  10392. soFar.length :
  10393. soFar ?
  10394. Sizzle.error( selector ) :
  10395. // Cache the tokens
  10396. tokenCache( selector, groups ).slice( 0 );
  10397. };
  10398. function toSelector( tokens ) {
  10399. var i = 0,
  10400. len = tokens.length,
  10401. selector = "";
  10402. for ( ; i < len; i++ ) {
  10403. selector += tokens[i].value;
  10404. }
  10405. return selector;
  10406. }
  10407. function addCombinator( matcher, combinator, base ) {
  10408. var dir = combinator.dir,
  10409. skip = combinator.next,
  10410. key = skip || dir,
  10411. checkNonElements = base && key === "parentNode",
  10412. doneName = done++;
  10413. return combinator.first ?
  10414. // Check against closest ancestor/preceding element
  10415. function( elem, context, xml ) {
  10416. while ( (elem = elem[ dir ]) ) {
  10417. if ( elem.nodeType === 1 || checkNonElements ) {
  10418. return matcher( elem, context, xml );
  10419. }
  10420. }
  10421. return false;
  10422. } :
  10423. // Check against all ancestor/preceding elements
  10424. function( elem, context, xml ) {
  10425. var oldCache, uniqueCache, outerCache,
  10426. newCache = [ dirruns, doneName ];
  10427. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10428. if ( xml ) {
  10429. while ( (elem = elem[ dir ]) ) {
  10430. if ( elem.nodeType === 1 || checkNonElements ) {
  10431. if ( matcher( elem, context, xml ) ) {
  10432. return true;
  10433. }
  10434. }
  10435. }
  10436. } else {
  10437. while ( (elem = elem[ dir ]) ) {
  10438. if ( elem.nodeType === 1 || checkNonElements ) {
  10439. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10440. // Support: IE <9 only
  10441. // Defend against cloned attroperties (jQuery gh-1709)
  10442. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10443. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10444. elem = elem[ dir ] || elem;
  10445. } else if ( (oldCache = uniqueCache[ key ]) &&
  10446. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10447. // Assign to newCache so results back-propagate to previous elements
  10448. return (newCache[ 2 ] = oldCache[ 2 ]);
  10449. } else {
  10450. // Reuse newcache so results back-propagate to previous elements
  10451. uniqueCache[ key ] = newCache;
  10452. // A match means we're done; a fail means we have to keep checking
  10453. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10454. return true;
  10455. }
  10456. }
  10457. }
  10458. }
  10459. }
  10460. return false;
  10461. };
  10462. }
  10463. function elementMatcher( matchers ) {
  10464. return matchers.length > 1 ?
  10465. function( elem, context, xml ) {
  10466. var i = matchers.length;
  10467. while ( i-- ) {
  10468. if ( !matchers[i]( elem, context, xml ) ) {
  10469. return false;
  10470. }
  10471. }
  10472. return true;
  10473. } :
  10474. matchers[0];
  10475. }
  10476. function multipleContexts( selector, contexts, results ) {
  10477. var i = 0,
  10478. len = contexts.length;
  10479. for ( ; i < len; i++ ) {
  10480. Sizzle( selector, contexts[i], results );
  10481. }
  10482. return results;
  10483. }
  10484. function condense( unmatched, map, filter, context, xml ) {
  10485. var elem,
  10486. newUnmatched = [],
  10487. i = 0,
  10488. len = unmatched.length,
  10489. mapped = map != null;
  10490. for ( ; i < len; i++ ) {
  10491. if ( (elem = unmatched[i]) ) {
  10492. if ( !filter || filter( elem, context, xml ) ) {
  10493. newUnmatched.push( elem );
  10494. if ( mapped ) {
  10495. map.push( i );
  10496. }
  10497. }
  10498. }
  10499. }
  10500. return newUnmatched;
  10501. }
  10502. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10503. if ( postFilter && !postFilter[ expando ] ) {
  10504. postFilter = setMatcher( postFilter );
  10505. }
  10506. if ( postFinder && !postFinder[ expando ] ) {
  10507. postFinder = setMatcher( postFinder, postSelector );
  10508. }
  10509. return markFunction(function( seed, results, context, xml ) {
  10510. var temp, i, elem,
  10511. preMap = [],
  10512. postMap = [],
  10513. preexisting = results.length,
  10514. // Get initial elements from seed or context
  10515. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10516. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10517. matcherIn = preFilter && ( seed || !selector ) ?
  10518. condense( elems, preMap, preFilter, context, xml ) :
  10519. elems,
  10520. matcherOut = matcher ?
  10521. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10522. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10523. // ...intermediate processing is necessary
  10524. [] :
  10525. // ...otherwise use results directly
  10526. results :
  10527. matcherIn;
  10528. // Find primary matches
  10529. if ( matcher ) {
  10530. matcher( matcherIn, matcherOut, context, xml );
  10531. }
  10532. // Apply postFilter
  10533. if ( postFilter ) {
  10534. temp = condense( matcherOut, postMap );
  10535. postFilter( temp, [], context, xml );
  10536. // Un-match failing elements by moving them back to matcherIn
  10537. i = temp.length;
  10538. while ( i-- ) {
  10539. if ( (elem = temp[i]) ) {
  10540. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10541. }
  10542. }
  10543. }
  10544. if ( seed ) {
  10545. if ( postFinder || preFilter ) {
  10546. if ( postFinder ) {
  10547. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10548. temp = [];
  10549. i = matcherOut.length;
  10550. while ( i-- ) {
  10551. if ( (elem = matcherOut[i]) ) {
  10552. // Restore matcherIn since elem is not yet a final match
  10553. temp.push( (matcherIn[i] = elem) );
  10554. }
  10555. }
  10556. postFinder( null, (matcherOut = []), temp, xml );
  10557. }
  10558. // Move matched elements from seed to results to keep them synchronized
  10559. i = matcherOut.length;
  10560. while ( i-- ) {
  10561. if ( (elem = matcherOut[i]) &&
  10562. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10563. seed[temp] = !(results[temp] = elem);
  10564. }
  10565. }
  10566. }
  10567. // Add elements to results, through postFinder if defined
  10568. } else {
  10569. matcherOut = condense(
  10570. matcherOut === results ?
  10571. matcherOut.splice( preexisting, matcherOut.length ) :
  10572. matcherOut
  10573. );
  10574. if ( postFinder ) {
  10575. postFinder( null, results, matcherOut, xml );
  10576. } else {
  10577. push.apply( results, matcherOut );
  10578. }
  10579. }
  10580. });
  10581. }
  10582. function matcherFromTokens( tokens ) {
  10583. var checkContext, matcher, j,
  10584. len = tokens.length,
  10585. leadingRelative = Expr.relative[ tokens[0].type ],
  10586. implicitRelative = leadingRelative || Expr.relative[" "],
  10587. i = leadingRelative ? 1 : 0,
  10588. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10589. matchContext = addCombinator( function( elem ) {
  10590. return elem === checkContext;
  10591. }, implicitRelative, true ),
  10592. matchAnyContext = addCombinator( function( elem ) {
  10593. return indexOf( checkContext, elem ) > -1;
  10594. }, implicitRelative, true ),
  10595. matchers = [ function( elem, context, xml ) {
  10596. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10597. (checkContext = context).nodeType ?
  10598. matchContext( elem, context, xml ) :
  10599. matchAnyContext( elem, context, xml ) );
  10600. // Avoid hanging onto element (issue #299)
  10601. checkContext = null;
  10602. return ret;
  10603. } ];
  10604. for ( ; i < len; i++ ) {
  10605. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10606. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10607. } else {
  10608. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10609. // Return special upon seeing a positional matcher
  10610. if ( matcher[ expando ] ) {
  10611. // Find the next relative operator (if any) for proper handling
  10612. j = ++i;
  10613. for ( ; j < len; j++ ) {
  10614. if ( Expr.relative[ tokens[j].type ] ) {
  10615. break;
  10616. }
  10617. }
  10618. return setMatcher(
  10619. i > 1 && elementMatcher( matchers ),
  10620. i > 1 && toSelector(
  10621. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10622. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10623. ).replace( rtrim, "$1" ),
  10624. matcher,
  10625. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10626. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10627. j < len && toSelector( tokens )
  10628. );
  10629. }
  10630. matchers.push( matcher );
  10631. }
  10632. }
  10633. return elementMatcher( matchers );
  10634. }
  10635. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10636. var bySet = setMatchers.length > 0,
  10637. byElement = elementMatchers.length > 0,
  10638. superMatcher = function( seed, context, xml, results, outermost ) {
  10639. var elem, j, matcher,
  10640. matchedCount = 0,
  10641. i = "0",
  10642. unmatched = seed && [],
  10643. setMatched = [],
  10644. contextBackup = outermostContext,
  10645. // We must always have either seed elements or outermost context
  10646. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10647. // Use integer dirruns iff this is the outermost matcher
  10648. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10649. len = elems.length;
  10650. if ( outermost ) {
  10651. outermostContext = context === document || context || outermost;
  10652. }
  10653. // Add elements passing elementMatchers directly to results
  10654. // Support: IE<9, Safari
  10655. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10656. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10657. if ( byElement && elem ) {
  10658. j = 0;
  10659. if ( !context && elem.ownerDocument !== document ) {
  10660. setDocument( elem );
  10661. xml = !documentIsHTML;
  10662. }
  10663. while ( (matcher = elementMatchers[j++]) ) {
  10664. if ( matcher( elem, context || document, xml) ) {
  10665. results.push( elem );
  10666. break;
  10667. }
  10668. }
  10669. if ( outermost ) {
  10670. dirruns = dirrunsUnique;
  10671. }
  10672. }
  10673. // Track unmatched elements for set filters
  10674. if ( bySet ) {
  10675. // They will have gone through all possible matchers
  10676. if ( (elem = !matcher && elem) ) {
  10677. matchedCount--;
  10678. }
  10679. // Lengthen the array for every element, matched or not
  10680. if ( seed ) {
  10681. unmatched.push( elem );
  10682. }
  10683. }
  10684. }
  10685. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10686. // makes the latter nonnegative.
  10687. matchedCount += i;
  10688. // Apply set filters to unmatched elements
  10689. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10690. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10691. // no element matchers and no seed.
  10692. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10693. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10694. // numerically zero.
  10695. if ( bySet && i !== matchedCount ) {
  10696. j = 0;
  10697. while ( (matcher = setMatchers[j++]) ) {
  10698. matcher( unmatched, setMatched, context, xml );
  10699. }
  10700. if ( seed ) {
  10701. // Reintegrate element matches to eliminate the need for sorting
  10702. if ( matchedCount > 0 ) {
  10703. while ( i-- ) {
  10704. if ( !(unmatched[i] || setMatched[i]) ) {
  10705. setMatched[i] = pop.call( results );
  10706. }
  10707. }
  10708. }
  10709. // Discard index placeholder values to get only actual matches
  10710. setMatched = condense( setMatched );
  10711. }
  10712. // Add matches to results
  10713. push.apply( results, setMatched );
  10714. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10715. if ( outermost && !seed && setMatched.length > 0 &&
  10716. ( matchedCount + setMatchers.length ) > 1 ) {
  10717. Sizzle.uniqueSort( results );
  10718. }
  10719. }
  10720. // Override manipulation of globals by nested matchers
  10721. if ( outermost ) {
  10722. dirruns = dirrunsUnique;
  10723. outermostContext = contextBackup;
  10724. }
  10725. return unmatched;
  10726. };
  10727. return bySet ?
  10728. markFunction( superMatcher ) :
  10729. superMatcher;
  10730. }
  10731. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10732. var i,
  10733. setMatchers = [],
  10734. elementMatchers = [],
  10735. cached = compilerCache[ selector + " " ];
  10736. if ( !cached ) {
  10737. // Generate a function of recursive functions that can be used to check each element
  10738. if ( !match ) {
  10739. match = tokenize( selector );
  10740. }
  10741. i = match.length;
  10742. while ( i-- ) {
  10743. cached = matcherFromTokens( match[i] );
  10744. if ( cached[ expando ] ) {
  10745. setMatchers.push( cached );
  10746. } else {
  10747. elementMatchers.push( cached );
  10748. }
  10749. }
  10750. // Cache the compiled function
  10751. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10752. // Save selector and tokenization
  10753. cached.selector = selector;
  10754. }
  10755. return cached;
  10756. };
  10757. /**
  10758. * A low-level selection function that works with Sizzle's compiled
  10759. * selector functions
  10760. * @param {String|Function} selector A selector or a pre-compiled
  10761. * selector function built with Sizzle.compile
  10762. * @param {Element} context
  10763. * @param {Array} [results]
  10764. * @param {Array} [seed] A set of elements to match against
  10765. */
  10766. select = Sizzle.select = function( selector, context, results, seed ) {
  10767. var i, tokens, token, type, find,
  10768. compiled = typeof selector === "function" && selector,
  10769. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10770. results = results || [];
  10771. // Try to minimize operations if there is only one selector in the list and no seed
  10772. // (the latter of which guarantees us context)
  10773. if ( match.length === 1 ) {
  10774. // Reduce context if the leading compound selector is an ID
  10775. tokens = match[0] = match[0].slice( 0 );
  10776. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10777. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10778. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10779. if ( !context ) {
  10780. return results;
  10781. // Precompiled matchers will still verify ancestry, so step up a level
  10782. } else if ( compiled ) {
  10783. context = context.parentNode;
  10784. }
  10785. selector = selector.slice( tokens.shift().value.length );
  10786. }
  10787. // Fetch a seed set for right-to-left matching
  10788. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10789. while ( i-- ) {
  10790. token = tokens[i];
  10791. // Abort if we hit a combinator
  10792. if ( Expr.relative[ (type = token.type) ] ) {
  10793. break;
  10794. }
  10795. if ( (find = Expr.find[ type ]) ) {
  10796. // Search, expanding context for leading sibling combinators
  10797. if ( (seed = find(
  10798. token.matches[0].replace( runescape, funescape ),
  10799. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10800. )) ) {
  10801. // If seed is empty or no tokens remain, we can return early
  10802. tokens.splice( i, 1 );
  10803. selector = seed.length && toSelector( tokens );
  10804. if ( !selector ) {
  10805. push.apply( results, seed );
  10806. return results;
  10807. }
  10808. break;
  10809. }
  10810. }
  10811. }
  10812. }
  10813. // Compile and execute a filtering function if one is not provided
  10814. // Provide `match` to avoid retokenization if we modified the selector above
  10815. ( compiled || compile( selector, match ) )(
  10816. seed,
  10817. context,
  10818. !documentIsHTML,
  10819. results,
  10820. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10821. );
  10822. return results;
  10823. };
  10824. // One-time assignments
  10825. // Sort stability
  10826. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10827. // Support: Chrome 14-35+
  10828. // Always assume duplicates if they aren't passed to the comparison function
  10829. support.detectDuplicates = !!hasDuplicate;
  10830. // Initialize against the default document
  10831. setDocument();
  10832. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10833. // Detached nodes confoundingly follow *each other*
  10834. support.sortDetached = assert(function( el ) {
  10835. // Should return 1, but returns 4 (following)
  10836. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10837. });
  10838. // Support: IE<8
  10839. // Prevent attribute/property "interpolation"
  10840. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10841. if ( !assert(function( el ) {
  10842. el.innerHTML = "<a href='#'></a>";
  10843. return el.firstChild.getAttribute("href") === "#" ;
  10844. }) ) {
  10845. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10846. if ( !isXML ) {
  10847. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10848. }
  10849. });
  10850. }
  10851. // Support: IE<9
  10852. // Use defaultValue in place of getAttribute("value")
  10853. if ( !support.attributes || !assert(function( el ) {
  10854. el.innerHTML = "<input/>";
  10855. el.firstChild.setAttribute( "value", "" );
  10856. return el.firstChild.getAttribute( "value" ) === "";
  10857. }) ) {
  10858. addHandle( "value", function( elem, name, isXML ) {
  10859. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10860. return elem.defaultValue;
  10861. }
  10862. });
  10863. }
  10864. // Support: IE<9
  10865. // Use getAttributeNode to fetch booleans when getAttribute lies
  10866. if ( !assert(function( el ) {
  10867. return el.getAttribute("disabled") == null;
  10868. }) ) {
  10869. addHandle( booleans, function( elem, name, isXML ) {
  10870. var val;
  10871. if ( !isXML ) {
  10872. return elem[ name ] === true ? name.toLowerCase() :
  10873. (val = elem.getAttributeNode( name )) && val.specified ?
  10874. val.value :
  10875. null;
  10876. }
  10877. });
  10878. }
  10879. return Sizzle;
  10880. })( window );
  10881. jQuery.find = Sizzle;
  10882. jQuery.expr = Sizzle.selectors;
  10883. // Deprecated
  10884. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10885. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10886. jQuery.text = Sizzle.getText;
  10887. jQuery.isXMLDoc = Sizzle.isXML;
  10888. jQuery.contains = Sizzle.contains;
  10889. jQuery.escapeSelector = Sizzle.escape;
  10890. var dir = function( elem, dir, until ) {
  10891. var matched = [],
  10892. truncate = until !== undefined;
  10893. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10894. if ( elem.nodeType === 1 ) {
  10895. if ( truncate && jQuery( elem ).is( until ) ) {
  10896. break;
  10897. }
  10898. matched.push( elem );
  10899. }
  10900. }
  10901. return matched;
  10902. };
  10903. var siblings = function( n, elem ) {
  10904. var matched = [];
  10905. for ( ; n; n = n.nextSibling ) {
  10906. if ( n.nodeType === 1 && n !== elem ) {
  10907. matched.push( n );
  10908. }
  10909. }
  10910. return matched;
  10911. };
  10912. var rneedsContext = jQuery.expr.match.needsContext;
  10913. function nodeName( elem, name ) {
  10914. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  10915. };
  10916. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  10917. // Implement the identical functionality for filter and not
  10918. function winnow( elements, qualifier, not ) {
  10919. if ( isFunction( qualifier ) ) {
  10920. return jQuery.grep( elements, function( elem, i ) {
  10921. return !!qualifier.call( elem, i, elem ) !== not;
  10922. } );
  10923. }
  10924. // Single element
  10925. if ( qualifier.nodeType ) {
  10926. return jQuery.grep( elements, function( elem ) {
  10927. return ( elem === qualifier ) !== not;
  10928. } );
  10929. }
  10930. // Arraylike of elements (jQuery, arguments, Array)
  10931. if ( typeof qualifier !== "string" ) {
  10932. return jQuery.grep( elements, function( elem ) {
  10933. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  10934. } );
  10935. }
  10936. // Filtered directly for both simple and complex selectors
  10937. return jQuery.filter( qualifier, elements, not );
  10938. }
  10939. jQuery.filter = function( expr, elems, not ) {
  10940. var elem = elems[ 0 ];
  10941. if ( not ) {
  10942. expr = ":not(" + expr + ")";
  10943. }
  10944. if ( elems.length === 1 && elem.nodeType === 1 ) {
  10945. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  10946. }
  10947. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  10948. return elem.nodeType === 1;
  10949. } ) );
  10950. };
  10951. jQuery.fn.extend( {
  10952. find: function( selector ) {
  10953. var i, ret,
  10954. len = this.length,
  10955. self = this;
  10956. if ( typeof selector !== "string" ) {
  10957. return this.pushStack( jQuery( selector ).filter( function() {
  10958. for ( i = 0; i < len; i++ ) {
  10959. if ( jQuery.contains( self[ i ], this ) ) {
  10960. return true;
  10961. }
  10962. }
  10963. } ) );
  10964. }
  10965. ret = this.pushStack( [] );
  10966. for ( i = 0; i < len; i++ ) {
  10967. jQuery.find( selector, self[ i ], ret );
  10968. }
  10969. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  10970. },
  10971. filter: function( selector ) {
  10972. return this.pushStack( winnow( this, selector || [], false ) );
  10973. },
  10974. not: function( selector ) {
  10975. return this.pushStack( winnow( this, selector || [], true ) );
  10976. },
  10977. is: function( selector ) {
  10978. return !!winnow(
  10979. this,
  10980. // If this is a positional/relative selector, check membership in the returned set
  10981. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  10982. typeof selector === "string" && rneedsContext.test( selector ) ?
  10983. jQuery( selector ) :
  10984. selector || [],
  10985. false
  10986. ).length;
  10987. }
  10988. } );
  10989. // Initialize a jQuery object
  10990. // A central reference to the root jQuery(document)
  10991. var rootjQuery,
  10992. // A simple way to check for HTML strings
  10993. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  10994. // Strict HTML recognition (#11290: must start with <)
  10995. // Shortcut simple #id case for speed
  10996. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  10997. init = jQuery.fn.init = function( selector, context, root ) {
  10998. var match, elem;
  10999. // HANDLE: $(""), $(null), $(undefined), $(false)
  11000. if ( !selector ) {
  11001. return this;
  11002. }
  11003. // Method init() accepts an alternate rootjQuery
  11004. // so migrate can support jQuery.sub (gh-2101)
  11005. root = root || rootjQuery;
  11006. // Handle HTML strings
  11007. if ( typeof selector === "string" ) {
  11008. if ( selector[ 0 ] === "<" &&
  11009. selector[ selector.length - 1 ] === ">" &&
  11010. selector.length >= 3 ) {
  11011. // Assume that strings that start and end with <> are HTML and skip the regex check
  11012. match = [ null, selector, null ];
  11013. } else {
  11014. match = rquickExpr.exec( selector );
  11015. }
  11016. // Match html or make sure no context is specified for #id
  11017. if ( match && ( match[ 1 ] || !context ) ) {
  11018. // HANDLE: $(html) -> $(array)
  11019. if ( match[ 1 ] ) {
  11020. context = context instanceof jQuery ? context[ 0 ] : context;
  11021. // Option to run scripts is true for back-compat
  11022. // Intentionally let the error be thrown if parseHTML is not present
  11023. jQuery.merge( this, jQuery.parseHTML(
  11024. match[ 1 ],
  11025. context && context.nodeType ? context.ownerDocument || context : document,
  11026. true
  11027. ) );
  11028. // HANDLE: $(html, props)
  11029. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11030. for ( match in context ) {
  11031. // Properties of context are called as methods if possible
  11032. if ( isFunction( this[ match ] ) ) {
  11033. this[ match ]( context[ match ] );
  11034. // ...and otherwise set as attributes
  11035. } else {
  11036. this.attr( match, context[ match ] );
  11037. }
  11038. }
  11039. }
  11040. return this;
  11041. // HANDLE: $(#id)
  11042. } else {
  11043. elem = document.getElementById( match[ 2 ] );
  11044. if ( elem ) {
  11045. // Inject the element directly into the jQuery object
  11046. this[ 0 ] = elem;
  11047. this.length = 1;
  11048. }
  11049. return this;
  11050. }
  11051. // HANDLE: $(expr, $(...))
  11052. } else if ( !context || context.jquery ) {
  11053. return ( context || root ).find( selector );
  11054. // HANDLE: $(expr, context)
  11055. // (which is just equivalent to: $(context).find(expr)
  11056. } else {
  11057. return this.constructor( context ).find( selector );
  11058. }
  11059. // HANDLE: $(DOMElement)
  11060. } else if ( selector.nodeType ) {
  11061. this[ 0 ] = selector;
  11062. this.length = 1;
  11063. return this;
  11064. // HANDLE: $(function)
  11065. // Shortcut for document ready
  11066. } else if ( isFunction( selector ) ) {
  11067. return root.ready !== undefined ?
  11068. root.ready( selector ) :
  11069. // Execute immediately if ready is not present
  11070. selector( jQuery );
  11071. }
  11072. return jQuery.makeArray( selector, this );
  11073. };
  11074. // Give the init function the jQuery prototype for later instantiation
  11075. init.prototype = jQuery.fn;
  11076. // Initialize central reference
  11077. rootjQuery = jQuery( document );
  11078. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11079. // Methods guaranteed to produce a unique set when starting from a unique set
  11080. guaranteedUnique = {
  11081. children: true,
  11082. contents: true,
  11083. next: true,
  11084. prev: true
  11085. };
  11086. jQuery.fn.extend( {
  11087. has: function( target ) {
  11088. var targets = jQuery( target, this ),
  11089. l = targets.length;
  11090. return this.filter( function() {
  11091. var i = 0;
  11092. for ( ; i < l; i++ ) {
  11093. if ( jQuery.contains( this, targets[ i ] ) ) {
  11094. return true;
  11095. }
  11096. }
  11097. } );
  11098. },
  11099. closest: function( selectors, context ) {
  11100. var cur,
  11101. i = 0,
  11102. l = this.length,
  11103. matched = [],
  11104. targets = typeof selectors !== "string" && jQuery( selectors );
  11105. // Positional selectors never match, since there's no _selection_ context
  11106. if ( !rneedsContext.test( selectors ) ) {
  11107. for ( ; i < l; i++ ) {
  11108. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11109. // Always skip document fragments
  11110. if ( cur.nodeType < 11 && ( targets ?
  11111. targets.index( cur ) > -1 :
  11112. // Don't pass non-elements to Sizzle
  11113. cur.nodeType === 1 &&
  11114. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11115. matched.push( cur );
  11116. break;
  11117. }
  11118. }
  11119. }
  11120. }
  11121. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11122. },
  11123. // Determine the position of an element within the set
  11124. index: function( elem ) {
  11125. // No argument, return index in parent
  11126. if ( !elem ) {
  11127. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11128. }
  11129. // Index in selector
  11130. if ( typeof elem === "string" ) {
  11131. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11132. }
  11133. // Locate the position of the desired element
  11134. return indexOf.call( this,
  11135. // If it receives a jQuery object, the first element is used
  11136. elem.jquery ? elem[ 0 ] : elem
  11137. );
  11138. },
  11139. add: function( selector, context ) {
  11140. return this.pushStack(
  11141. jQuery.uniqueSort(
  11142. jQuery.merge( this.get(), jQuery( selector, context ) )
  11143. )
  11144. );
  11145. },
  11146. addBack: function( selector ) {
  11147. return this.add( selector == null ?
  11148. this.prevObject : this.prevObject.filter( selector )
  11149. );
  11150. }
  11151. } );
  11152. function sibling( cur, dir ) {
  11153. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11154. return cur;
  11155. }
  11156. jQuery.each( {
  11157. parent: function( elem ) {
  11158. var parent = elem.parentNode;
  11159. return parent && parent.nodeType !== 11 ? parent : null;
  11160. },
  11161. parents: function( elem ) {
  11162. return dir( elem, "parentNode" );
  11163. },
  11164. parentsUntil: function( elem, i, until ) {
  11165. return dir( elem, "parentNode", until );
  11166. },
  11167. next: function( elem ) {
  11168. return sibling( elem, "nextSibling" );
  11169. },
  11170. prev: function( elem ) {
  11171. return sibling( elem, "previousSibling" );
  11172. },
  11173. nextAll: function( elem ) {
  11174. return dir( elem, "nextSibling" );
  11175. },
  11176. prevAll: function( elem ) {
  11177. return dir( elem, "previousSibling" );
  11178. },
  11179. nextUntil: function( elem, i, until ) {
  11180. return dir( elem, "nextSibling", until );
  11181. },
  11182. prevUntil: function( elem, i, until ) {
  11183. return dir( elem, "previousSibling", until );
  11184. },
  11185. siblings: function( elem ) {
  11186. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11187. },
  11188. children: function( elem ) {
  11189. return siblings( elem.firstChild );
  11190. },
  11191. contents: function( elem ) {
  11192. if ( typeof elem.contentDocument !== "undefined" ) {
  11193. return elem.contentDocument;
  11194. }
  11195. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11196. // Treat the template element as a regular one in browsers that
  11197. // don't support it.
  11198. if ( nodeName( elem, "template" ) ) {
  11199. elem = elem.content || elem;
  11200. }
  11201. return jQuery.merge( [], elem.childNodes );
  11202. }
  11203. }, function( name, fn ) {
  11204. jQuery.fn[ name ] = function( until, selector ) {
  11205. var matched = jQuery.map( this, fn, until );
  11206. if ( name.slice( -5 ) !== "Until" ) {
  11207. selector = until;
  11208. }
  11209. if ( selector && typeof selector === "string" ) {
  11210. matched = jQuery.filter( selector, matched );
  11211. }
  11212. if ( this.length > 1 ) {
  11213. // Remove duplicates
  11214. if ( !guaranteedUnique[ name ] ) {
  11215. jQuery.uniqueSort( matched );
  11216. }
  11217. // Reverse order for parents* and prev-derivatives
  11218. if ( rparentsprev.test( name ) ) {
  11219. matched.reverse();
  11220. }
  11221. }
  11222. return this.pushStack( matched );
  11223. };
  11224. } );
  11225. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11226. // Convert String-formatted options into Object-formatted ones
  11227. function createOptions( options ) {
  11228. var object = {};
  11229. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11230. object[ flag ] = true;
  11231. } );
  11232. return object;
  11233. }
  11234. /*
  11235. * Create a callback list using the following parameters:
  11236. *
  11237. * options: an optional list of space-separated options that will change how
  11238. * the callback list behaves or a more traditional option object
  11239. *
  11240. * By default a callback list will act like an event callback list and can be
  11241. * "fired" multiple times.
  11242. *
  11243. * Possible options:
  11244. *
  11245. * once: will ensure the callback list can only be fired once (like a Deferred)
  11246. *
  11247. * memory: will keep track of previous values and will call any callback added
  11248. * after the list has been fired right away with the latest "memorized"
  11249. * values (like a Deferred)
  11250. *
  11251. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11252. *
  11253. * stopOnFalse: interrupt callings when a callback returns false
  11254. *
  11255. */
  11256. jQuery.Callbacks = function( options ) {
  11257. // Convert options from String-formatted to Object-formatted if needed
  11258. // (we check in cache first)
  11259. options = typeof options === "string" ?
  11260. createOptions( options ) :
  11261. jQuery.extend( {}, options );
  11262. var // Flag to know if list is currently firing
  11263. firing,
  11264. // Last fire value for non-forgettable lists
  11265. memory,
  11266. // Flag to know if list was already fired
  11267. fired,
  11268. // Flag to prevent firing
  11269. locked,
  11270. // Actual callback list
  11271. list = [],
  11272. // Queue of execution data for repeatable lists
  11273. queue = [],
  11274. // Index of currently firing callback (modified by add/remove as needed)
  11275. firingIndex = -1,
  11276. // Fire callbacks
  11277. fire = function() {
  11278. // Enforce single-firing
  11279. locked = locked || options.once;
  11280. // Execute callbacks for all pending executions,
  11281. // respecting firingIndex overrides and runtime changes
  11282. fired = firing = true;
  11283. for ( ; queue.length; firingIndex = -1 ) {
  11284. memory = queue.shift();
  11285. while ( ++firingIndex < list.length ) {
  11286. // Run callback and check for early termination
  11287. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11288. options.stopOnFalse ) {
  11289. // Jump to end and forget the data so .add doesn't re-fire
  11290. firingIndex = list.length;
  11291. memory = false;
  11292. }
  11293. }
  11294. }
  11295. // Forget the data if we're done with it
  11296. if ( !options.memory ) {
  11297. memory = false;
  11298. }
  11299. firing = false;
  11300. // Clean up if we're done firing for good
  11301. if ( locked ) {
  11302. // Keep an empty list if we have data for future add calls
  11303. if ( memory ) {
  11304. list = [];
  11305. // Otherwise, this object is spent
  11306. } else {
  11307. list = "";
  11308. }
  11309. }
  11310. },
  11311. // Actual Callbacks object
  11312. self = {
  11313. // Add a callback or a collection of callbacks to the list
  11314. add: function() {
  11315. if ( list ) {
  11316. // If we have memory from a past run, we should fire after adding
  11317. if ( memory && !firing ) {
  11318. firingIndex = list.length - 1;
  11319. queue.push( memory );
  11320. }
  11321. ( function add( args ) {
  11322. jQuery.each( args, function( _, arg ) {
  11323. if ( isFunction( arg ) ) {
  11324. if ( !options.unique || !self.has( arg ) ) {
  11325. list.push( arg );
  11326. }
  11327. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11328. // Inspect recursively
  11329. add( arg );
  11330. }
  11331. } );
  11332. } )( arguments );
  11333. if ( memory && !firing ) {
  11334. fire();
  11335. }
  11336. }
  11337. return this;
  11338. },
  11339. // Remove a callback from the list
  11340. remove: function() {
  11341. jQuery.each( arguments, function( _, arg ) {
  11342. var index;
  11343. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11344. list.splice( index, 1 );
  11345. // Handle firing indexes
  11346. if ( index <= firingIndex ) {
  11347. firingIndex--;
  11348. }
  11349. }
  11350. } );
  11351. return this;
  11352. },
  11353. // Check if a given callback is in the list.
  11354. // If no argument is given, return whether or not list has callbacks attached.
  11355. has: function( fn ) {
  11356. return fn ?
  11357. jQuery.inArray( fn, list ) > -1 :
  11358. list.length > 0;
  11359. },
  11360. // Remove all callbacks from the list
  11361. empty: function() {
  11362. if ( list ) {
  11363. list = [];
  11364. }
  11365. return this;
  11366. },
  11367. // Disable .fire and .add
  11368. // Abort any current/pending executions
  11369. // Clear all callbacks and values
  11370. disable: function() {
  11371. locked = queue = [];
  11372. list = memory = "";
  11373. return this;
  11374. },
  11375. disabled: function() {
  11376. return !list;
  11377. },
  11378. // Disable .fire
  11379. // Also disable .add unless we have memory (since it would have no effect)
  11380. // Abort any pending executions
  11381. lock: function() {
  11382. locked = queue = [];
  11383. if ( !memory && !firing ) {
  11384. list = memory = "";
  11385. }
  11386. return this;
  11387. },
  11388. locked: function() {
  11389. return !!locked;
  11390. },
  11391. // Call all callbacks with the given context and arguments
  11392. fireWith: function( context, args ) {
  11393. if ( !locked ) {
  11394. args = args || [];
  11395. args = [ context, args.slice ? args.slice() : args ];
  11396. queue.push( args );
  11397. if ( !firing ) {
  11398. fire();
  11399. }
  11400. }
  11401. return this;
  11402. },
  11403. // Call all the callbacks with the given arguments
  11404. fire: function() {
  11405. self.fireWith( this, arguments );
  11406. return this;
  11407. },
  11408. // To know if the callbacks have already been called at least once
  11409. fired: function() {
  11410. return !!fired;
  11411. }
  11412. };
  11413. return self;
  11414. };
  11415. function Identity( v ) {
  11416. return v;
  11417. }
  11418. function Thrower( ex ) {
  11419. throw ex;
  11420. }
  11421. function adoptValue( value, resolve, reject, noValue ) {
  11422. var method;
  11423. try {
  11424. // Check for promise aspect first to privilege synchronous behavior
  11425. if ( value && isFunction( ( method = value.promise ) ) ) {
  11426. method.call( value ).done( resolve ).fail( reject );
  11427. // Other thenables
  11428. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11429. method.call( value, resolve, reject );
  11430. // Other non-thenables
  11431. } else {
  11432. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11433. // * false: [ value ].slice( 0 ) => resolve( value )
  11434. // * true: [ value ].slice( 1 ) => resolve()
  11435. resolve.apply( undefined, [ value ].slice( noValue ) );
  11436. }
  11437. // For Promises/A+, convert exceptions into rejections
  11438. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11439. // Deferred#then to conditionally suppress rejection.
  11440. } catch ( value ) {
  11441. // Support: Android 4.0 only
  11442. // Strict mode functions invoked without .call/.apply get global-object context
  11443. reject.apply( undefined, [ value ] );
  11444. }
  11445. }
  11446. jQuery.extend( {
  11447. Deferred: function( func ) {
  11448. var tuples = [
  11449. // action, add listener, callbacks,
  11450. // ... .then handlers, argument index, [final state]
  11451. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11452. jQuery.Callbacks( "memory" ), 2 ],
  11453. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11454. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11455. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11456. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11457. ],
  11458. state = "pending",
  11459. promise = {
  11460. state: function() {
  11461. return state;
  11462. },
  11463. always: function() {
  11464. deferred.done( arguments ).fail( arguments );
  11465. return this;
  11466. },
  11467. "catch": function( fn ) {
  11468. return promise.then( null, fn );
  11469. },
  11470. // Keep pipe for back-compat
  11471. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11472. var fns = arguments;
  11473. return jQuery.Deferred( function( newDefer ) {
  11474. jQuery.each( tuples, function( i, tuple ) {
  11475. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11476. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11477. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11478. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11479. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11480. deferred[ tuple[ 1 ] ]( function() {
  11481. var returned = fn && fn.apply( this, arguments );
  11482. if ( returned && isFunction( returned.promise ) ) {
  11483. returned.promise()
  11484. .progress( newDefer.notify )
  11485. .done( newDefer.resolve )
  11486. .fail( newDefer.reject );
  11487. } else {
  11488. newDefer[ tuple[ 0 ] + "With" ](
  11489. this,
  11490. fn ? [ returned ] : arguments
  11491. );
  11492. }
  11493. } );
  11494. } );
  11495. fns = null;
  11496. } ).promise();
  11497. },
  11498. then: function( onFulfilled, onRejected, onProgress ) {
  11499. var maxDepth = 0;
  11500. function resolve( depth, deferred, handler, special ) {
  11501. return function() {
  11502. var that = this,
  11503. args = arguments,
  11504. mightThrow = function() {
  11505. var returned, then;
  11506. // Support: Promises/A+ section 2.3.3.3.3
  11507. // https://promisesaplus.com/#point-59
  11508. // Ignore double-resolution attempts
  11509. if ( depth < maxDepth ) {
  11510. return;
  11511. }
  11512. returned = handler.apply( that, args );
  11513. // Support: Promises/A+ section 2.3.1
  11514. // https://promisesaplus.com/#point-48
  11515. if ( returned === deferred.promise() ) {
  11516. throw new TypeError( "Thenable self-resolution" );
  11517. }
  11518. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11519. // https://promisesaplus.com/#point-54
  11520. // https://promisesaplus.com/#point-75
  11521. // Retrieve `then` only once
  11522. then = returned &&
  11523. // Support: Promises/A+ section 2.3.4
  11524. // https://promisesaplus.com/#point-64
  11525. // Only check objects and functions for thenability
  11526. ( typeof returned === "object" ||
  11527. typeof returned === "function" ) &&
  11528. returned.then;
  11529. // Handle a returned thenable
  11530. if ( isFunction( then ) ) {
  11531. // Special processors (notify) just wait for resolution
  11532. if ( special ) {
  11533. then.call(
  11534. returned,
  11535. resolve( maxDepth, deferred, Identity, special ),
  11536. resolve( maxDepth, deferred, Thrower, special )
  11537. );
  11538. // Normal processors (resolve) also hook into progress
  11539. } else {
  11540. // ...and disregard older resolution values
  11541. maxDepth++;
  11542. then.call(
  11543. returned,
  11544. resolve( maxDepth, deferred, Identity, special ),
  11545. resolve( maxDepth, deferred, Thrower, special ),
  11546. resolve( maxDepth, deferred, Identity,
  11547. deferred.notifyWith )
  11548. );
  11549. }
  11550. // Handle all other returned values
  11551. } else {
  11552. // Only substitute handlers pass on context
  11553. // and multiple values (non-spec behavior)
  11554. if ( handler !== Identity ) {
  11555. that = undefined;
  11556. args = [ returned ];
  11557. }
  11558. // Process the value(s)
  11559. // Default process is resolve
  11560. ( special || deferred.resolveWith )( that, args );
  11561. }
  11562. },
  11563. // Only normal processors (resolve) catch and reject exceptions
  11564. process = special ?
  11565. mightThrow :
  11566. function() {
  11567. try {
  11568. mightThrow();
  11569. } catch ( e ) {
  11570. if ( jQuery.Deferred.exceptionHook ) {
  11571. jQuery.Deferred.exceptionHook( e,
  11572. process.stackTrace );
  11573. }
  11574. // Support: Promises/A+ section 2.3.3.3.4.1
  11575. // https://promisesaplus.com/#point-61
  11576. // Ignore post-resolution exceptions
  11577. if ( depth + 1 >= maxDepth ) {
  11578. // Only substitute handlers pass on context
  11579. // and multiple values (non-spec behavior)
  11580. if ( handler !== Thrower ) {
  11581. that = undefined;
  11582. args = [ e ];
  11583. }
  11584. deferred.rejectWith( that, args );
  11585. }
  11586. }
  11587. };
  11588. // Support: Promises/A+ section 2.3.3.3.1
  11589. // https://promisesaplus.com/#point-57
  11590. // Re-resolve promises immediately to dodge false rejection from
  11591. // subsequent errors
  11592. if ( depth ) {
  11593. process();
  11594. } else {
  11595. // Call an optional hook to record the stack, in case of exception
  11596. // since it's otherwise lost when execution goes async
  11597. if ( jQuery.Deferred.getStackHook ) {
  11598. process.stackTrace = jQuery.Deferred.getStackHook();
  11599. }
  11600. window.setTimeout( process );
  11601. }
  11602. };
  11603. }
  11604. return jQuery.Deferred( function( newDefer ) {
  11605. // progress_handlers.add( ... )
  11606. tuples[ 0 ][ 3 ].add(
  11607. resolve(
  11608. 0,
  11609. newDefer,
  11610. isFunction( onProgress ) ?
  11611. onProgress :
  11612. Identity,
  11613. newDefer.notifyWith
  11614. )
  11615. );
  11616. // fulfilled_handlers.add( ... )
  11617. tuples[ 1 ][ 3 ].add(
  11618. resolve(
  11619. 0,
  11620. newDefer,
  11621. isFunction( onFulfilled ) ?
  11622. onFulfilled :
  11623. Identity
  11624. )
  11625. );
  11626. // rejected_handlers.add( ... )
  11627. tuples[ 2 ][ 3 ].add(
  11628. resolve(
  11629. 0,
  11630. newDefer,
  11631. isFunction( onRejected ) ?
  11632. onRejected :
  11633. Thrower
  11634. )
  11635. );
  11636. } ).promise();
  11637. },
  11638. // Get a promise for this deferred
  11639. // If obj is provided, the promise aspect is added to the object
  11640. promise: function( obj ) {
  11641. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11642. }
  11643. },
  11644. deferred = {};
  11645. // Add list-specific methods
  11646. jQuery.each( tuples, function( i, tuple ) {
  11647. var list = tuple[ 2 ],
  11648. stateString = tuple[ 5 ];
  11649. // promise.progress = list.add
  11650. // promise.done = list.add
  11651. // promise.fail = list.add
  11652. promise[ tuple[ 1 ] ] = list.add;
  11653. // Handle state
  11654. if ( stateString ) {
  11655. list.add(
  11656. function() {
  11657. // state = "resolved" (i.e., fulfilled)
  11658. // state = "rejected"
  11659. state = stateString;
  11660. },
  11661. // rejected_callbacks.disable
  11662. // fulfilled_callbacks.disable
  11663. tuples[ 3 - i ][ 2 ].disable,
  11664. // rejected_handlers.disable
  11665. // fulfilled_handlers.disable
  11666. tuples[ 3 - i ][ 3 ].disable,
  11667. // progress_callbacks.lock
  11668. tuples[ 0 ][ 2 ].lock,
  11669. // progress_handlers.lock
  11670. tuples[ 0 ][ 3 ].lock
  11671. );
  11672. }
  11673. // progress_handlers.fire
  11674. // fulfilled_handlers.fire
  11675. // rejected_handlers.fire
  11676. list.add( tuple[ 3 ].fire );
  11677. // deferred.notify = function() { deferred.notifyWith(...) }
  11678. // deferred.resolve = function() { deferred.resolveWith(...) }
  11679. // deferred.reject = function() { deferred.rejectWith(...) }
  11680. deferred[ tuple[ 0 ] ] = function() {
  11681. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11682. return this;
  11683. };
  11684. // deferred.notifyWith = list.fireWith
  11685. // deferred.resolveWith = list.fireWith
  11686. // deferred.rejectWith = list.fireWith
  11687. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11688. } );
  11689. // Make the deferred a promise
  11690. promise.promise( deferred );
  11691. // Call given func if any
  11692. if ( func ) {
  11693. func.call( deferred, deferred );
  11694. }
  11695. // All done!
  11696. return deferred;
  11697. },
  11698. // Deferred helper
  11699. when: function( singleValue ) {
  11700. var
  11701. // count of uncompleted subordinates
  11702. remaining = arguments.length,
  11703. // count of unprocessed arguments
  11704. i = remaining,
  11705. // subordinate fulfillment data
  11706. resolveContexts = Array( i ),
  11707. resolveValues = slice.call( arguments ),
  11708. // the master Deferred
  11709. master = jQuery.Deferred(),
  11710. // subordinate callback factory
  11711. updateFunc = function( i ) {
  11712. return function( value ) {
  11713. resolveContexts[ i ] = this;
  11714. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11715. if ( !( --remaining ) ) {
  11716. master.resolveWith( resolveContexts, resolveValues );
  11717. }
  11718. };
  11719. };
  11720. // Single- and empty arguments are adopted like Promise.resolve
  11721. if ( remaining <= 1 ) {
  11722. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11723. !remaining );
  11724. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11725. if ( master.state() === "pending" ||
  11726. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11727. return master.then();
  11728. }
  11729. }
  11730. // Multiple arguments are aggregated like Promise.all array elements
  11731. while ( i-- ) {
  11732. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11733. }
  11734. return master.promise();
  11735. }
  11736. } );
  11737. // These usually indicate a programmer mistake during development,
  11738. // warn about them ASAP rather than swallowing them by default.
  11739. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11740. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11741. // Support: IE 8 - 9 only
  11742. // Console exists when dev tools are open, which can happen at any time
  11743. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11744. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11745. }
  11746. };
  11747. jQuery.readyException = function( error ) {
  11748. window.setTimeout( function() {
  11749. throw error;
  11750. } );
  11751. };
  11752. // The deferred used on DOM ready
  11753. var readyList = jQuery.Deferred();
  11754. jQuery.fn.ready = function( fn ) {
  11755. readyList
  11756. .then( fn )
  11757. // Wrap jQuery.readyException in a function so that the lookup
  11758. // happens at the time of error handling instead of callback
  11759. // registration.
  11760. .catch( function( error ) {
  11761. jQuery.readyException( error );
  11762. } );
  11763. return this;
  11764. };
  11765. jQuery.extend( {
  11766. // Is the DOM ready to be used? Set to true once it occurs.
  11767. isReady: false,
  11768. // A counter to track how many items to wait for before
  11769. // the ready event fires. See #6781
  11770. readyWait: 1,
  11771. // Handle when the DOM is ready
  11772. ready: function( wait ) {
  11773. // Abort if there are pending holds or we're already ready
  11774. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11775. return;
  11776. }
  11777. // Remember that the DOM is ready
  11778. jQuery.isReady = true;
  11779. // If a normal DOM Ready event fired, decrement, and wait if need be
  11780. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11781. return;
  11782. }
  11783. // If there are functions bound, to execute
  11784. readyList.resolveWith( document, [ jQuery ] );
  11785. }
  11786. } );
  11787. jQuery.ready.then = readyList.then;
  11788. // The ready event handler and self cleanup method
  11789. function completed() {
  11790. document.removeEventListener( "DOMContentLoaded", completed );
  11791. window.removeEventListener( "load", completed );
  11792. jQuery.ready();
  11793. }
  11794. // Catch cases where $(document).ready() is called
  11795. // after the browser event has already occurred.
  11796. // Support: IE <=9 - 10 only
  11797. // Older IE sometimes signals "interactive" too soon
  11798. if ( document.readyState === "complete" ||
  11799. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11800. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11801. window.setTimeout( jQuery.ready );
  11802. } else {
  11803. // Use the handy event callback
  11804. document.addEventListener( "DOMContentLoaded", completed );
  11805. // A fallback to window.onload, that will always work
  11806. window.addEventListener( "load", completed );
  11807. }
  11808. // Multifunctional method to get and set values of a collection
  11809. // The value/s can optionally be executed if it's a function
  11810. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11811. var i = 0,
  11812. len = elems.length,
  11813. bulk = key == null;
  11814. // Sets many values
  11815. if ( toType( key ) === "object" ) {
  11816. chainable = true;
  11817. for ( i in key ) {
  11818. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11819. }
  11820. // Sets one value
  11821. } else if ( value !== undefined ) {
  11822. chainable = true;
  11823. if ( !isFunction( value ) ) {
  11824. raw = true;
  11825. }
  11826. if ( bulk ) {
  11827. // Bulk operations run against the entire set
  11828. if ( raw ) {
  11829. fn.call( elems, value );
  11830. fn = null;
  11831. // ...except when executing function values
  11832. } else {
  11833. bulk = fn;
  11834. fn = function( elem, key, value ) {
  11835. return bulk.call( jQuery( elem ), value );
  11836. };
  11837. }
  11838. }
  11839. if ( fn ) {
  11840. for ( ; i < len; i++ ) {
  11841. fn(
  11842. elems[ i ], key, raw ?
  11843. value :
  11844. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11845. );
  11846. }
  11847. }
  11848. }
  11849. if ( chainable ) {
  11850. return elems;
  11851. }
  11852. // Gets
  11853. if ( bulk ) {
  11854. return fn.call( elems );
  11855. }
  11856. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11857. };
  11858. // Matches dashed string for camelizing
  11859. var rmsPrefix = /^-ms-/,
  11860. rdashAlpha = /-([a-z])/g;
  11861. // Used by camelCase as callback to replace()
  11862. function fcamelCase( all, letter ) {
  11863. return letter.toUpperCase();
  11864. }
  11865. // Convert dashed to camelCase; used by the css and data modules
  11866. // Support: IE <=9 - 11, Edge 12 - 15
  11867. // Microsoft forgot to hump their vendor prefix (#9572)
  11868. function camelCase( string ) {
  11869. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11870. }
  11871. var acceptData = function( owner ) {
  11872. // Accepts only:
  11873. // - Node
  11874. // - Node.ELEMENT_NODE
  11875. // - Node.DOCUMENT_NODE
  11876. // - Object
  11877. // - Any
  11878. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11879. };
  11880. function Data() {
  11881. this.expando = jQuery.expando + Data.uid++;
  11882. }
  11883. Data.uid = 1;
  11884. Data.prototype = {
  11885. cache: function( owner ) {
  11886. // Check if the owner object already has a cache
  11887. var value = owner[ this.expando ];
  11888. // If not, create one
  11889. if ( !value ) {
  11890. value = {};
  11891. // We can accept data for non-element nodes in modern browsers,
  11892. // but we should not, see #8335.
  11893. // Always return an empty object.
  11894. if ( acceptData( owner ) ) {
  11895. // If it is a node unlikely to be stringify-ed or looped over
  11896. // use plain assignment
  11897. if ( owner.nodeType ) {
  11898. owner[ this.expando ] = value;
  11899. // Otherwise secure it in a non-enumerable property
  11900. // configurable must be true to allow the property to be
  11901. // deleted when data is removed
  11902. } else {
  11903. Object.defineProperty( owner, this.expando, {
  11904. value: value,
  11905. configurable: true
  11906. } );
  11907. }
  11908. }
  11909. }
  11910. return value;
  11911. },
  11912. set: function( owner, data, value ) {
  11913. var prop,
  11914. cache = this.cache( owner );
  11915. // Handle: [ owner, key, value ] args
  11916. // Always use camelCase key (gh-2257)
  11917. if ( typeof data === "string" ) {
  11918. cache[ camelCase( data ) ] = value;
  11919. // Handle: [ owner, { properties } ] args
  11920. } else {
  11921. // Copy the properties one-by-one to the cache object
  11922. for ( prop in data ) {
  11923. cache[ camelCase( prop ) ] = data[ prop ];
  11924. }
  11925. }
  11926. return cache;
  11927. },
  11928. get: function( owner, key ) {
  11929. return key === undefined ?
  11930. this.cache( owner ) :
  11931. // Always use camelCase key (gh-2257)
  11932. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  11933. },
  11934. access: function( owner, key, value ) {
  11935. // In cases where either:
  11936. //
  11937. // 1. No key was specified
  11938. // 2. A string key was specified, but no value provided
  11939. //
  11940. // Take the "read" path and allow the get method to determine
  11941. // which value to return, respectively either:
  11942. //
  11943. // 1. The entire cache object
  11944. // 2. The data stored at the key
  11945. //
  11946. if ( key === undefined ||
  11947. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  11948. return this.get( owner, key );
  11949. }
  11950. // When the key is not a string, or both a key and value
  11951. // are specified, set or extend (existing objects) with either:
  11952. //
  11953. // 1. An object of properties
  11954. // 2. A key and value
  11955. //
  11956. this.set( owner, key, value );
  11957. // Since the "set" path can have two possible entry points
  11958. // return the expected data based on which path was taken[*]
  11959. return value !== undefined ? value : key;
  11960. },
  11961. remove: function( owner, key ) {
  11962. var i,
  11963. cache = owner[ this.expando ];
  11964. if ( cache === undefined ) {
  11965. return;
  11966. }
  11967. if ( key !== undefined ) {
  11968. // Support array or space separated string of keys
  11969. if ( Array.isArray( key ) ) {
  11970. // If key is an array of keys...
  11971. // We always set camelCase keys, so remove that.
  11972. key = key.map( camelCase );
  11973. } else {
  11974. key = camelCase( key );
  11975. // If a key with the spaces exists, use it.
  11976. // Otherwise, create an array by matching non-whitespace
  11977. key = key in cache ?
  11978. [ key ] :
  11979. ( key.match( rnothtmlwhite ) || [] );
  11980. }
  11981. i = key.length;
  11982. while ( i-- ) {
  11983. delete cache[ key[ i ] ];
  11984. }
  11985. }
  11986. // Remove the expando if there's no more data
  11987. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  11988. // Support: Chrome <=35 - 45
  11989. // Webkit & Blink performance suffers when deleting properties
  11990. // from DOM nodes, so set to undefined instead
  11991. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  11992. if ( owner.nodeType ) {
  11993. owner[ this.expando ] = undefined;
  11994. } else {
  11995. delete owner[ this.expando ];
  11996. }
  11997. }
  11998. },
  11999. hasData: function( owner ) {
  12000. var cache = owner[ this.expando ];
  12001. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12002. }
  12003. };
  12004. var dataPriv = new Data();
  12005. var dataUser = new Data();
  12006. // Implementation Summary
  12007. //
  12008. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12009. // 2. Improve the module's maintainability by reducing the storage
  12010. // paths to a single mechanism.
  12011. // 3. Use the same single mechanism to support "private" and "user" data.
  12012. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12013. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12014. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12015. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12016. rmultiDash = /[A-Z]/g;
  12017. function getData( data ) {
  12018. if ( data === "true" ) {
  12019. return true;
  12020. }
  12021. if ( data === "false" ) {
  12022. return false;
  12023. }
  12024. if ( data === "null" ) {
  12025. return null;
  12026. }
  12027. // Only convert to a number if it doesn't change the string
  12028. if ( data === +data + "" ) {
  12029. return +data;
  12030. }
  12031. if ( rbrace.test( data ) ) {
  12032. return JSON.parse( data );
  12033. }
  12034. return data;
  12035. }
  12036. function dataAttr( elem, key, data ) {
  12037. var name;
  12038. // If nothing was found internally, try to fetch any
  12039. // data from the HTML5 data-* attribute
  12040. if ( data === undefined && elem.nodeType === 1 ) {
  12041. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12042. data = elem.getAttribute( name );
  12043. if ( typeof data === "string" ) {
  12044. try {
  12045. data = getData( data );
  12046. } catch ( e ) {}
  12047. // Make sure we set the data so it isn't changed later
  12048. dataUser.set( elem, key, data );
  12049. } else {
  12050. data = undefined;
  12051. }
  12052. }
  12053. return data;
  12054. }
  12055. jQuery.extend( {
  12056. hasData: function( elem ) {
  12057. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12058. },
  12059. data: function( elem, name, data ) {
  12060. return dataUser.access( elem, name, data );
  12061. },
  12062. removeData: function( elem, name ) {
  12063. dataUser.remove( elem, name );
  12064. },
  12065. // TODO: Now that all calls to _data and _removeData have been replaced
  12066. // with direct calls to dataPriv methods, these can be deprecated.
  12067. _data: function( elem, name, data ) {
  12068. return dataPriv.access( elem, name, data );
  12069. },
  12070. _removeData: function( elem, name ) {
  12071. dataPriv.remove( elem, name );
  12072. }
  12073. } );
  12074. jQuery.fn.extend( {
  12075. data: function( key, value ) {
  12076. var i, name, data,
  12077. elem = this[ 0 ],
  12078. attrs = elem && elem.attributes;
  12079. // Gets all values
  12080. if ( key === undefined ) {
  12081. if ( this.length ) {
  12082. data = dataUser.get( elem );
  12083. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12084. i = attrs.length;
  12085. while ( i-- ) {
  12086. // Support: IE 11 only
  12087. // The attrs elements can be null (#14894)
  12088. if ( attrs[ i ] ) {
  12089. name = attrs[ i ].name;
  12090. if ( name.indexOf( "data-" ) === 0 ) {
  12091. name = camelCase( name.slice( 5 ) );
  12092. dataAttr( elem, name, data[ name ] );
  12093. }
  12094. }
  12095. }
  12096. dataPriv.set( elem, "hasDataAttrs", true );
  12097. }
  12098. }
  12099. return data;
  12100. }
  12101. // Sets multiple values
  12102. if ( typeof key === "object" ) {
  12103. return this.each( function() {
  12104. dataUser.set( this, key );
  12105. } );
  12106. }
  12107. return access( this, function( value ) {
  12108. var data;
  12109. // The calling jQuery object (element matches) is not empty
  12110. // (and therefore has an element appears at this[ 0 ]) and the
  12111. // `value` parameter was not undefined. An empty jQuery object
  12112. // will result in `undefined` for elem = this[ 0 ] which will
  12113. // throw an exception if an attempt to read a data cache is made.
  12114. if ( elem && value === undefined ) {
  12115. // Attempt to get data from the cache
  12116. // The key will always be camelCased in Data
  12117. data = dataUser.get( elem, key );
  12118. if ( data !== undefined ) {
  12119. return data;
  12120. }
  12121. // Attempt to "discover" the data in
  12122. // HTML5 custom data-* attrs
  12123. data = dataAttr( elem, key );
  12124. if ( data !== undefined ) {
  12125. return data;
  12126. }
  12127. // We tried really hard, but the data doesn't exist.
  12128. return;
  12129. }
  12130. // Set the data...
  12131. this.each( function() {
  12132. // We always store the camelCased key
  12133. dataUser.set( this, key, value );
  12134. } );
  12135. }, null, value, arguments.length > 1, null, true );
  12136. },
  12137. removeData: function( key ) {
  12138. return this.each( function() {
  12139. dataUser.remove( this, key );
  12140. } );
  12141. }
  12142. } );
  12143. jQuery.extend( {
  12144. queue: function( elem, type, data ) {
  12145. var queue;
  12146. if ( elem ) {
  12147. type = ( type || "fx" ) + "queue";
  12148. queue = dataPriv.get( elem, type );
  12149. // Speed up dequeue by getting out quickly if this is just a lookup
  12150. if ( data ) {
  12151. if ( !queue || Array.isArray( data ) ) {
  12152. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12153. } else {
  12154. queue.push( data );
  12155. }
  12156. }
  12157. return queue || [];
  12158. }
  12159. },
  12160. dequeue: function( elem, type ) {
  12161. type = type || "fx";
  12162. var queue = jQuery.queue( elem, type ),
  12163. startLength = queue.length,
  12164. fn = queue.shift(),
  12165. hooks = jQuery._queueHooks( elem, type ),
  12166. next = function() {
  12167. jQuery.dequeue( elem, type );
  12168. };
  12169. // If the fx queue is dequeued, always remove the progress sentinel
  12170. if ( fn === "inprogress" ) {
  12171. fn = queue.shift();
  12172. startLength--;
  12173. }
  12174. if ( fn ) {
  12175. // Add a progress sentinel to prevent the fx queue from being
  12176. // automatically dequeued
  12177. if ( type === "fx" ) {
  12178. queue.unshift( "inprogress" );
  12179. }
  12180. // Clear up the last queue stop function
  12181. delete hooks.stop;
  12182. fn.call( elem, next, hooks );
  12183. }
  12184. if ( !startLength && hooks ) {
  12185. hooks.empty.fire();
  12186. }
  12187. },
  12188. // Not public - generate a queueHooks object, or return the current one
  12189. _queueHooks: function( elem, type ) {
  12190. var key = type + "queueHooks";
  12191. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12192. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12193. dataPriv.remove( elem, [ type + "queue", key ] );
  12194. } )
  12195. } );
  12196. }
  12197. } );
  12198. jQuery.fn.extend( {
  12199. queue: function( type, data ) {
  12200. var setter = 2;
  12201. if ( typeof type !== "string" ) {
  12202. data = type;
  12203. type = "fx";
  12204. setter--;
  12205. }
  12206. if ( arguments.length < setter ) {
  12207. return jQuery.queue( this[ 0 ], type );
  12208. }
  12209. return data === undefined ?
  12210. this :
  12211. this.each( function() {
  12212. var queue = jQuery.queue( this, type, data );
  12213. // Ensure a hooks for this queue
  12214. jQuery._queueHooks( this, type );
  12215. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12216. jQuery.dequeue( this, type );
  12217. }
  12218. } );
  12219. },
  12220. dequeue: function( type ) {
  12221. return this.each( function() {
  12222. jQuery.dequeue( this, type );
  12223. } );
  12224. },
  12225. clearQueue: function( type ) {
  12226. return this.queue( type || "fx", [] );
  12227. },
  12228. // Get a promise resolved when queues of a certain type
  12229. // are emptied (fx is the type by default)
  12230. promise: function( type, obj ) {
  12231. var tmp,
  12232. count = 1,
  12233. defer = jQuery.Deferred(),
  12234. elements = this,
  12235. i = this.length,
  12236. resolve = function() {
  12237. if ( !( --count ) ) {
  12238. defer.resolveWith( elements, [ elements ] );
  12239. }
  12240. };
  12241. if ( typeof type !== "string" ) {
  12242. obj = type;
  12243. type = undefined;
  12244. }
  12245. type = type || "fx";
  12246. while ( i-- ) {
  12247. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12248. if ( tmp && tmp.empty ) {
  12249. count++;
  12250. tmp.empty.add( resolve );
  12251. }
  12252. }
  12253. resolve();
  12254. return defer.promise( obj );
  12255. }
  12256. } );
  12257. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12258. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12259. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12260. var documentElement = document.documentElement;
  12261. var isAttached = function( elem ) {
  12262. return jQuery.contains( elem.ownerDocument, elem );
  12263. },
  12264. composed = { composed: true };
  12265. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12266. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12267. // Support: iOS 10.0-10.2 only
  12268. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12269. // leading to errors. We need to check for `getRootNode`.
  12270. if ( documentElement.getRootNode ) {
  12271. isAttached = function( elem ) {
  12272. return jQuery.contains( elem.ownerDocument, elem ) ||
  12273. elem.getRootNode( composed ) === elem.ownerDocument;
  12274. };
  12275. }
  12276. var isHiddenWithinTree = function( elem, el ) {
  12277. // isHiddenWithinTree might be called from jQuery#filter function;
  12278. // in that case, element will be second argument
  12279. elem = el || elem;
  12280. // Inline style trumps all
  12281. return elem.style.display === "none" ||
  12282. elem.style.display === "" &&
  12283. // Otherwise, check computed style
  12284. // Support: Firefox <=43 - 45
  12285. // Disconnected elements can have computed display: none, so first confirm that elem is
  12286. // in the document.
  12287. isAttached( elem ) &&
  12288. jQuery.css( elem, "display" ) === "none";
  12289. };
  12290. var swap = function( elem, options, callback, args ) {
  12291. var ret, name,
  12292. old = {};
  12293. // Remember the old values, and insert the new ones
  12294. for ( name in options ) {
  12295. old[ name ] = elem.style[ name ];
  12296. elem.style[ name ] = options[ name ];
  12297. }
  12298. ret = callback.apply( elem, args || [] );
  12299. // Revert the old values
  12300. for ( name in options ) {
  12301. elem.style[ name ] = old[ name ];
  12302. }
  12303. return ret;
  12304. };
  12305. function adjustCSS( elem, prop, valueParts, tween ) {
  12306. var adjusted, scale,
  12307. maxIterations = 20,
  12308. currentValue = tween ?
  12309. function() {
  12310. return tween.cur();
  12311. } :
  12312. function() {
  12313. return jQuery.css( elem, prop, "" );
  12314. },
  12315. initial = currentValue(),
  12316. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12317. // Starting value computation is required for potential unit mismatches
  12318. initialInUnit = elem.nodeType &&
  12319. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12320. rcssNum.exec( jQuery.css( elem, prop ) );
  12321. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12322. // Support: Firefox <=54
  12323. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12324. initial = initial / 2;
  12325. // Trust units reported by jQuery.css
  12326. unit = unit || initialInUnit[ 3 ];
  12327. // Iteratively approximate from a nonzero starting point
  12328. initialInUnit = +initial || 1;
  12329. while ( maxIterations-- ) {
  12330. // Evaluate and update our best guess (doubling guesses that zero out).
  12331. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12332. jQuery.style( elem, prop, initialInUnit + unit );
  12333. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12334. maxIterations = 0;
  12335. }
  12336. initialInUnit = initialInUnit / scale;
  12337. }
  12338. initialInUnit = initialInUnit * 2;
  12339. jQuery.style( elem, prop, initialInUnit + unit );
  12340. // Make sure we update the tween properties later on
  12341. valueParts = valueParts || [];
  12342. }
  12343. if ( valueParts ) {
  12344. initialInUnit = +initialInUnit || +initial || 0;
  12345. // Apply relative offset (+=/-=) if specified
  12346. adjusted = valueParts[ 1 ] ?
  12347. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12348. +valueParts[ 2 ];
  12349. if ( tween ) {
  12350. tween.unit = unit;
  12351. tween.start = initialInUnit;
  12352. tween.end = adjusted;
  12353. }
  12354. }
  12355. return adjusted;
  12356. }
  12357. var defaultDisplayMap = {};
  12358. function getDefaultDisplay( elem ) {
  12359. var temp,
  12360. doc = elem.ownerDocument,
  12361. nodeName = elem.nodeName,
  12362. display = defaultDisplayMap[ nodeName ];
  12363. if ( display ) {
  12364. return display;
  12365. }
  12366. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12367. display = jQuery.css( temp, "display" );
  12368. temp.parentNode.removeChild( temp );
  12369. if ( display === "none" ) {
  12370. display = "block";
  12371. }
  12372. defaultDisplayMap[ nodeName ] = display;
  12373. return display;
  12374. }
  12375. function showHide( elements, show ) {
  12376. var display, elem,
  12377. values = [],
  12378. index = 0,
  12379. length = elements.length;
  12380. // Determine new display value for elements that need to change
  12381. for ( ; index < length; index++ ) {
  12382. elem = elements[ index ];
  12383. if ( !elem.style ) {
  12384. continue;
  12385. }
  12386. display = elem.style.display;
  12387. if ( show ) {
  12388. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12389. // check is required in this first loop unless we have a nonempty display value (either
  12390. // inline or about-to-be-restored)
  12391. if ( display === "none" ) {
  12392. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12393. if ( !values[ index ] ) {
  12394. elem.style.display = "";
  12395. }
  12396. }
  12397. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12398. values[ index ] = getDefaultDisplay( elem );
  12399. }
  12400. } else {
  12401. if ( display !== "none" ) {
  12402. values[ index ] = "none";
  12403. // Remember what we're overwriting
  12404. dataPriv.set( elem, "display", display );
  12405. }
  12406. }
  12407. }
  12408. // Set the display of the elements in a second loop to avoid constant reflow
  12409. for ( index = 0; index < length; index++ ) {
  12410. if ( values[ index ] != null ) {
  12411. elements[ index ].style.display = values[ index ];
  12412. }
  12413. }
  12414. return elements;
  12415. }
  12416. jQuery.fn.extend( {
  12417. show: function() {
  12418. return showHide( this, true );
  12419. },
  12420. hide: function() {
  12421. return showHide( this );
  12422. },
  12423. toggle: function( state ) {
  12424. if ( typeof state === "boolean" ) {
  12425. return state ? this.show() : this.hide();
  12426. }
  12427. return this.each( function() {
  12428. if ( isHiddenWithinTree( this ) ) {
  12429. jQuery( this ).show();
  12430. } else {
  12431. jQuery( this ).hide();
  12432. }
  12433. } );
  12434. }
  12435. } );
  12436. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12437. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12438. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12439. // We have to close these tags to support XHTML (#13200)
  12440. var wrapMap = {
  12441. // Support: IE <=9 only
  12442. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12443. // XHTML parsers do not magically insert elements in the
  12444. // same way that tag soup parsers do. So we cannot shorten
  12445. // this by omitting <tbody> or other required elements.
  12446. thead: [ 1, "<table>", "</table>" ],
  12447. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12448. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12449. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12450. _default: [ 0, "", "" ]
  12451. };
  12452. // Support: IE <=9 only
  12453. wrapMap.optgroup = wrapMap.option;
  12454. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12455. wrapMap.th = wrapMap.td;
  12456. function getAll( context, tag ) {
  12457. // Support: IE <=9 - 11 only
  12458. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12459. var ret;
  12460. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12461. ret = context.getElementsByTagName( tag || "*" );
  12462. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12463. ret = context.querySelectorAll( tag || "*" );
  12464. } else {
  12465. ret = [];
  12466. }
  12467. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12468. return jQuery.merge( [ context ], ret );
  12469. }
  12470. return ret;
  12471. }
  12472. // Mark scripts as having already been evaluated
  12473. function setGlobalEval( elems, refElements ) {
  12474. var i = 0,
  12475. l = elems.length;
  12476. for ( ; i < l; i++ ) {
  12477. dataPriv.set(
  12478. elems[ i ],
  12479. "globalEval",
  12480. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12481. );
  12482. }
  12483. }
  12484. var rhtml = /<|&#?\w+;/;
  12485. function buildFragment( elems, context, scripts, selection, ignored ) {
  12486. var elem, tmp, tag, wrap, attached, j,
  12487. fragment = context.createDocumentFragment(),
  12488. nodes = [],
  12489. i = 0,
  12490. l = elems.length;
  12491. for ( ; i < l; i++ ) {
  12492. elem = elems[ i ];
  12493. if ( elem || elem === 0 ) {
  12494. // Add nodes directly
  12495. if ( toType( elem ) === "object" ) {
  12496. // Support: Android <=4.0 only, PhantomJS 1 only
  12497. // push.apply(_, arraylike) throws on ancient WebKit
  12498. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12499. // Convert non-html into a text node
  12500. } else if ( !rhtml.test( elem ) ) {
  12501. nodes.push( context.createTextNode( elem ) );
  12502. // Convert html into DOM nodes
  12503. } else {
  12504. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12505. // Deserialize a standard representation
  12506. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12507. wrap = wrapMap[ tag ] || wrapMap._default;
  12508. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12509. // Descend through wrappers to the right content
  12510. j = wrap[ 0 ];
  12511. while ( j-- ) {
  12512. tmp = tmp.lastChild;
  12513. }
  12514. // Support: Android <=4.0 only, PhantomJS 1 only
  12515. // push.apply(_, arraylike) throws on ancient WebKit
  12516. jQuery.merge( nodes, tmp.childNodes );
  12517. // Remember the top-level container
  12518. tmp = fragment.firstChild;
  12519. // Ensure the created nodes are orphaned (#12392)
  12520. tmp.textContent = "";
  12521. }
  12522. }
  12523. }
  12524. // Remove wrapper from fragment
  12525. fragment.textContent = "";
  12526. i = 0;
  12527. while ( ( elem = nodes[ i++ ] ) ) {
  12528. // Skip elements already in the context collection (trac-4087)
  12529. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12530. if ( ignored ) {
  12531. ignored.push( elem );
  12532. }
  12533. continue;
  12534. }
  12535. attached = isAttached( elem );
  12536. // Append to fragment
  12537. tmp = getAll( fragment.appendChild( elem ), "script" );
  12538. // Preserve script evaluation history
  12539. if ( attached ) {
  12540. setGlobalEval( tmp );
  12541. }
  12542. // Capture executables
  12543. if ( scripts ) {
  12544. j = 0;
  12545. while ( ( elem = tmp[ j++ ] ) ) {
  12546. if ( rscriptType.test( elem.type || "" ) ) {
  12547. scripts.push( elem );
  12548. }
  12549. }
  12550. }
  12551. }
  12552. return fragment;
  12553. }
  12554. ( function() {
  12555. var fragment = document.createDocumentFragment(),
  12556. div = fragment.appendChild( document.createElement( "div" ) ),
  12557. input = document.createElement( "input" );
  12558. // Support: Android 4.0 - 4.3 only
  12559. // Check state lost if the name is set (#11217)
  12560. // Support: Windows Web Apps (WWA)
  12561. // `name` and `type` must use .setAttribute for WWA (#14901)
  12562. input.setAttribute( "type", "radio" );
  12563. input.setAttribute( "checked", "checked" );
  12564. input.setAttribute( "name", "t" );
  12565. div.appendChild( input );
  12566. // Support: Android <=4.1 only
  12567. // Older WebKit doesn't clone checked state correctly in fragments
  12568. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12569. // Support: IE <=11 only
  12570. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12571. div.innerHTML = "<textarea>x</textarea>";
  12572. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12573. } )();
  12574. var
  12575. rkeyEvent = /^key/,
  12576. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12577. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12578. function returnTrue() {
  12579. return true;
  12580. }
  12581. function returnFalse() {
  12582. return false;
  12583. }
  12584. // Support: IE <=9 - 11+
  12585. // focus() and blur() are asynchronous, except when they are no-op.
  12586. // So expect focus to be synchronous when the element is already active,
  12587. // and blur to be synchronous when the element is not already active.
  12588. // (focus and blur are always synchronous in other supported browsers,
  12589. // this just defines when we can count on it).
  12590. function expectSync( elem, type ) {
  12591. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12592. }
  12593. // Support: IE <=9 only
  12594. // Accessing document.activeElement can throw unexpectedly
  12595. // https://bugs.jquery.com/ticket/13393
  12596. function safeActiveElement() {
  12597. try {
  12598. return document.activeElement;
  12599. } catch ( err ) { }
  12600. }
  12601. function on( elem, types, selector, data, fn, one ) {
  12602. var origFn, type;
  12603. // Types can be a map of types/handlers
  12604. if ( typeof types === "object" ) {
  12605. // ( types-Object, selector, data )
  12606. if ( typeof selector !== "string" ) {
  12607. // ( types-Object, data )
  12608. data = data || selector;
  12609. selector = undefined;
  12610. }
  12611. for ( type in types ) {
  12612. on( elem, type, selector, data, types[ type ], one );
  12613. }
  12614. return elem;
  12615. }
  12616. if ( data == null && fn == null ) {
  12617. // ( types, fn )
  12618. fn = selector;
  12619. data = selector = undefined;
  12620. } else if ( fn == null ) {
  12621. if ( typeof selector === "string" ) {
  12622. // ( types, selector, fn )
  12623. fn = data;
  12624. data = undefined;
  12625. } else {
  12626. // ( types, data, fn )
  12627. fn = data;
  12628. data = selector;
  12629. selector = undefined;
  12630. }
  12631. }
  12632. if ( fn === false ) {
  12633. fn = returnFalse;
  12634. } else if ( !fn ) {
  12635. return elem;
  12636. }
  12637. if ( one === 1 ) {
  12638. origFn = fn;
  12639. fn = function( event ) {
  12640. // Can use an empty set, since event contains the info
  12641. jQuery().off( event );
  12642. return origFn.apply( this, arguments );
  12643. };
  12644. // Use same guid so caller can remove using origFn
  12645. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12646. }
  12647. return elem.each( function() {
  12648. jQuery.event.add( this, types, fn, data, selector );
  12649. } );
  12650. }
  12651. /*
  12652. * Helper functions for managing events -- not part of the public interface.
  12653. * Props to Dean Edwards' addEvent library for many of the ideas.
  12654. */
  12655. jQuery.event = {
  12656. global: {},
  12657. add: function( elem, types, handler, data, selector ) {
  12658. var handleObjIn, eventHandle, tmp,
  12659. events, t, handleObj,
  12660. special, handlers, type, namespaces, origType,
  12661. elemData = dataPriv.get( elem );
  12662. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12663. if ( !elemData ) {
  12664. return;
  12665. }
  12666. // Caller can pass in an object of custom data in lieu of the handler
  12667. if ( handler.handler ) {
  12668. handleObjIn = handler;
  12669. handler = handleObjIn.handler;
  12670. selector = handleObjIn.selector;
  12671. }
  12672. // Ensure that invalid selectors throw exceptions at attach time
  12673. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12674. if ( selector ) {
  12675. jQuery.find.matchesSelector( documentElement, selector );
  12676. }
  12677. // Make sure that the handler has a unique ID, used to find/remove it later
  12678. if ( !handler.guid ) {
  12679. handler.guid = jQuery.guid++;
  12680. }
  12681. // Init the element's event structure and main handler, if this is the first
  12682. if ( !( events = elemData.events ) ) {
  12683. events = elemData.events = {};
  12684. }
  12685. if ( !( eventHandle = elemData.handle ) ) {
  12686. eventHandle = elemData.handle = function( e ) {
  12687. // Discard the second event of a jQuery.event.trigger() and
  12688. // when an event is called after a page has unloaded
  12689. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12690. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12691. };
  12692. }
  12693. // Handle multiple events separated by a space
  12694. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12695. t = types.length;
  12696. while ( t-- ) {
  12697. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12698. type = origType = tmp[ 1 ];
  12699. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12700. // There *must* be a type, no attaching namespace-only handlers
  12701. if ( !type ) {
  12702. continue;
  12703. }
  12704. // If event changes its type, use the special event handlers for the changed type
  12705. special = jQuery.event.special[ type ] || {};
  12706. // If selector defined, determine special event api type, otherwise given type
  12707. type = ( selector ? special.delegateType : special.bindType ) || type;
  12708. // Update special based on newly reset type
  12709. special = jQuery.event.special[ type ] || {};
  12710. // handleObj is passed to all event handlers
  12711. handleObj = jQuery.extend( {
  12712. type: type,
  12713. origType: origType,
  12714. data: data,
  12715. handler: handler,
  12716. guid: handler.guid,
  12717. selector: selector,
  12718. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12719. namespace: namespaces.join( "." )
  12720. }, handleObjIn );
  12721. // Init the event handler queue if we're the first
  12722. if ( !( handlers = events[ type ] ) ) {
  12723. handlers = events[ type ] = [];
  12724. handlers.delegateCount = 0;
  12725. // Only use addEventListener if the special events handler returns false
  12726. if ( !special.setup ||
  12727. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12728. if ( elem.addEventListener ) {
  12729. elem.addEventListener( type, eventHandle );
  12730. }
  12731. }
  12732. }
  12733. if ( special.add ) {
  12734. special.add.call( elem, handleObj );
  12735. if ( !handleObj.handler.guid ) {
  12736. handleObj.handler.guid = handler.guid;
  12737. }
  12738. }
  12739. // Add to the element's handler list, delegates in front
  12740. if ( selector ) {
  12741. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12742. } else {
  12743. handlers.push( handleObj );
  12744. }
  12745. // Keep track of which events have ever been used, for event optimization
  12746. jQuery.event.global[ type ] = true;
  12747. }
  12748. },
  12749. // Detach an event or set of events from an element
  12750. remove: function( elem, types, handler, selector, mappedTypes ) {
  12751. var j, origCount, tmp,
  12752. events, t, handleObj,
  12753. special, handlers, type, namespaces, origType,
  12754. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12755. if ( !elemData || !( events = elemData.events ) ) {
  12756. return;
  12757. }
  12758. // Once for each type.namespace in types; type may be omitted
  12759. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12760. t = types.length;
  12761. while ( t-- ) {
  12762. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12763. type = origType = tmp[ 1 ];
  12764. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12765. // Unbind all events (on this namespace, if provided) for the element
  12766. if ( !type ) {
  12767. for ( type in events ) {
  12768. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12769. }
  12770. continue;
  12771. }
  12772. special = jQuery.event.special[ type ] || {};
  12773. type = ( selector ? special.delegateType : special.bindType ) || type;
  12774. handlers = events[ type ] || [];
  12775. tmp = tmp[ 2 ] &&
  12776. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12777. // Remove matching events
  12778. origCount = j = handlers.length;
  12779. while ( j-- ) {
  12780. handleObj = handlers[ j ];
  12781. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12782. ( !handler || handler.guid === handleObj.guid ) &&
  12783. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12784. ( !selector || selector === handleObj.selector ||
  12785. selector === "**" && handleObj.selector ) ) {
  12786. handlers.splice( j, 1 );
  12787. if ( handleObj.selector ) {
  12788. handlers.delegateCount--;
  12789. }
  12790. if ( special.remove ) {
  12791. special.remove.call( elem, handleObj );
  12792. }
  12793. }
  12794. }
  12795. // Remove generic event handler if we removed something and no more handlers exist
  12796. // (avoids potential for endless recursion during removal of special event handlers)
  12797. if ( origCount && !handlers.length ) {
  12798. if ( !special.teardown ||
  12799. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12800. jQuery.removeEvent( elem, type, elemData.handle );
  12801. }
  12802. delete events[ type ];
  12803. }
  12804. }
  12805. // Remove data and the expando if it's no longer used
  12806. if ( jQuery.isEmptyObject( events ) ) {
  12807. dataPriv.remove( elem, "handle events" );
  12808. }
  12809. },
  12810. dispatch: function( nativeEvent ) {
  12811. // Make a writable jQuery.Event from the native event object
  12812. var event = jQuery.event.fix( nativeEvent );
  12813. var i, j, ret, matched, handleObj, handlerQueue,
  12814. args = new Array( arguments.length ),
  12815. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12816. special = jQuery.event.special[ event.type ] || {};
  12817. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12818. args[ 0 ] = event;
  12819. for ( i = 1; i < arguments.length; i++ ) {
  12820. args[ i ] = arguments[ i ];
  12821. }
  12822. event.delegateTarget = this;
  12823. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12824. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12825. return;
  12826. }
  12827. // Determine handlers
  12828. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12829. // Run delegates first; they may want to stop propagation beneath us
  12830. i = 0;
  12831. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12832. event.currentTarget = matched.elem;
  12833. j = 0;
  12834. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12835. !event.isImmediatePropagationStopped() ) {
  12836. // If the event is namespaced, then each handler is only invoked if it is
  12837. // specially universal or its namespaces are a superset of the event's.
  12838. if ( !event.rnamespace || handleObj.namespace === false ||
  12839. event.rnamespace.test( handleObj.namespace ) ) {
  12840. event.handleObj = handleObj;
  12841. event.data = handleObj.data;
  12842. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12843. handleObj.handler ).apply( matched.elem, args );
  12844. if ( ret !== undefined ) {
  12845. if ( ( event.result = ret ) === false ) {
  12846. event.preventDefault();
  12847. event.stopPropagation();
  12848. }
  12849. }
  12850. }
  12851. }
  12852. }
  12853. // Call the postDispatch hook for the mapped type
  12854. if ( special.postDispatch ) {
  12855. special.postDispatch.call( this, event );
  12856. }
  12857. return event.result;
  12858. },
  12859. handlers: function( event, handlers ) {
  12860. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12861. handlerQueue = [],
  12862. delegateCount = handlers.delegateCount,
  12863. cur = event.target;
  12864. // Find delegate handlers
  12865. if ( delegateCount &&
  12866. // Support: IE <=9
  12867. // Black-hole SVG <use> instance trees (trac-13180)
  12868. cur.nodeType &&
  12869. // Support: Firefox <=42
  12870. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12871. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12872. // Support: IE 11 only
  12873. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12874. !( event.type === "click" && event.button >= 1 ) ) {
  12875. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12876. // Don't check non-elements (#13208)
  12877. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12878. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12879. matchedHandlers = [];
  12880. matchedSelectors = {};
  12881. for ( i = 0; i < delegateCount; i++ ) {
  12882. handleObj = handlers[ i ];
  12883. // Don't conflict with Object.prototype properties (#13203)
  12884. sel = handleObj.selector + " ";
  12885. if ( matchedSelectors[ sel ] === undefined ) {
  12886. matchedSelectors[ sel ] = handleObj.needsContext ?
  12887. jQuery( sel, this ).index( cur ) > -1 :
  12888. jQuery.find( sel, this, null, [ cur ] ).length;
  12889. }
  12890. if ( matchedSelectors[ sel ] ) {
  12891. matchedHandlers.push( handleObj );
  12892. }
  12893. }
  12894. if ( matchedHandlers.length ) {
  12895. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12896. }
  12897. }
  12898. }
  12899. }
  12900. // Add the remaining (directly-bound) handlers
  12901. cur = this;
  12902. if ( delegateCount < handlers.length ) {
  12903. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  12904. }
  12905. return handlerQueue;
  12906. },
  12907. addProp: function( name, hook ) {
  12908. Object.defineProperty( jQuery.Event.prototype, name, {
  12909. enumerable: true,
  12910. configurable: true,
  12911. get: isFunction( hook ) ?
  12912. function() {
  12913. if ( this.originalEvent ) {
  12914. return hook( this.originalEvent );
  12915. }
  12916. } :
  12917. function() {
  12918. if ( this.originalEvent ) {
  12919. return this.originalEvent[ name ];
  12920. }
  12921. },
  12922. set: function( value ) {
  12923. Object.defineProperty( this, name, {
  12924. enumerable: true,
  12925. configurable: true,
  12926. writable: true,
  12927. value: value
  12928. } );
  12929. }
  12930. } );
  12931. },
  12932. fix: function( originalEvent ) {
  12933. return originalEvent[ jQuery.expando ] ?
  12934. originalEvent :
  12935. new jQuery.Event( originalEvent );
  12936. },
  12937. special: {
  12938. load: {
  12939. // Prevent triggered image.load events from bubbling to window.load
  12940. noBubble: true
  12941. },
  12942. click: {
  12943. // Utilize native event to ensure correct state for checkable inputs
  12944. setup: function( data ) {
  12945. // For mutual compressibility with _default, replace `this` access with a local var.
  12946. // `|| data` is dead code meant only to preserve the variable through minification.
  12947. var el = this || data;
  12948. // Claim the first handler
  12949. if ( rcheckableType.test( el.type ) &&
  12950. el.click && nodeName( el, "input" ) ) {
  12951. // dataPriv.set( el, "click", ... )
  12952. leverageNative( el, "click", returnTrue );
  12953. }
  12954. // Return false to allow normal processing in the caller
  12955. return false;
  12956. },
  12957. trigger: function( data ) {
  12958. // For mutual compressibility with _default, replace `this` access with a local var.
  12959. // `|| data` is dead code meant only to preserve the variable through minification.
  12960. var el = this || data;
  12961. // Force setup before triggering a click
  12962. if ( rcheckableType.test( el.type ) &&
  12963. el.click && nodeName( el, "input" ) ) {
  12964. leverageNative( el, "click" );
  12965. }
  12966. // Return non-false to allow normal event-path propagation
  12967. return true;
  12968. },
  12969. // For cross-browser consistency, suppress native .click() on links
  12970. // Also prevent it if we're currently inside a leveraged native-event stack
  12971. _default: function( event ) {
  12972. var target = event.target;
  12973. return rcheckableType.test( target.type ) &&
  12974. target.click && nodeName( target, "input" ) &&
  12975. dataPriv.get( target, "click" ) ||
  12976. nodeName( target, "a" );
  12977. }
  12978. },
  12979. beforeunload: {
  12980. postDispatch: function( event ) {
  12981. // Support: Firefox 20+
  12982. // Firefox doesn't alert if the returnValue field is not set.
  12983. if ( event.result !== undefined && event.originalEvent ) {
  12984. event.originalEvent.returnValue = event.result;
  12985. }
  12986. }
  12987. }
  12988. }
  12989. };
  12990. // Ensure the presence of an event listener that handles manually-triggered
  12991. // synthetic events by interrupting progress until reinvoked in response to
  12992. // *native* events that it fires directly, ensuring that state changes have
  12993. // already occurred before other listeners are invoked.
  12994. function leverageNative( el, type, expectSync ) {
  12995. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  12996. if ( !expectSync ) {
  12997. if ( dataPriv.get( el, type ) === undefined ) {
  12998. jQuery.event.add( el, type, returnTrue );
  12999. }
  13000. return;
  13001. }
  13002. // Register the controller as a special universal handler for all event namespaces
  13003. dataPriv.set( el, type, false );
  13004. jQuery.event.add( el, type, {
  13005. namespace: false,
  13006. handler: function( event ) {
  13007. var notAsync, result,
  13008. saved = dataPriv.get( this, type );
  13009. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13010. // Interrupt processing of the outer synthetic .trigger()ed event
  13011. // Saved data should be false in such cases, but might be a leftover capture object
  13012. // from an async native handler (gh-4350)
  13013. if ( !saved.length ) {
  13014. // Store arguments for use when handling the inner native event
  13015. // There will always be at least one argument (an event object), so this array
  13016. // will not be confused with a leftover capture object.
  13017. saved = slice.call( arguments );
  13018. dataPriv.set( this, type, saved );
  13019. // Trigger the native event and capture its result
  13020. // Support: IE <=9 - 11+
  13021. // focus() and blur() are asynchronous
  13022. notAsync = expectSync( this, type );
  13023. this[ type ]();
  13024. result = dataPriv.get( this, type );
  13025. if ( saved !== result || notAsync ) {
  13026. dataPriv.set( this, type, false );
  13027. } else {
  13028. result = {};
  13029. }
  13030. if ( saved !== result ) {
  13031. // Cancel the outer synthetic event
  13032. event.stopImmediatePropagation();
  13033. event.preventDefault();
  13034. return result.value;
  13035. }
  13036. // If this is an inner synthetic event for an event with a bubbling surrogate
  13037. // (focus or blur), assume that the surrogate already propagated from triggering the
  13038. // native event and prevent that from happening again here.
  13039. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13040. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13041. // less bad than duplication.
  13042. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13043. event.stopPropagation();
  13044. }
  13045. // If this is a native event triggered above, everything is now in order
  13046. // Fire an inner synthetic event with the original arguments
  13047. } else if ( saved.length ) {
  13048. // ...and capture the result
  13049. dataPriv.set( this, type, {
  13050. value: jQuery.event.trigger(
  13051. // Support: IE <=9 - 11+
  13052. // Extend with the prototype to reset the above stopImmediatePropagation()
  13053. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13054. saved.slice( 1 ),
  13055. this
  13056. )
  13057. } );
  13058. // Abort handling of the native event
  13059. event.stopImmediatePropagation();
  13060. }
  13061. }
  13062. } );
  13063. }
  13064. jQuery.removeEvent = function( elem, type, handle ) {
  13065. // This "if" is needed for plain objects
  13066. if ( elem.removeEventListener ) {
  13067. elem.removeEventListener( type, handle );
  13068. }
  13069. };
  13070. jQuery.Event = function( src, props ) {
  13071. // Allow instantiation without the 'new' keyword
  13072. if ( !( this instanceof jQuery.Event ) ) {
  13073. return new jQuery.Event( src, props );
  13074. }
  13075. // Event object
  13076. if ( src && src.type ) {
  13077. this.originalEvent = src;
  13078. this.type = src.type;
  13079. // Events bubbling up the document may have been marked as prevented
  13080. // by a handler lower down the tree; reflect the correct value.
  13081. this.isDefaultPrevented = src.defaultPrevented ||
  13082. src.defaultPrevented === undefined &&
  13083. // Support: Android <=2.3 only
  13084. src.returnValue === false ?
  13085. returnTrue :
  13086. returnFalse;
  13087. // Create target properties
  13088. // Support: Safari <=6 - 7 only
  13089. // Target should not be a text node (#504, #13143)
  13090. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13091. src.target.parentNode :
  13092. src.target;
  13093. this.currentTarget = src.currentTarget;
  13094. this.relatedTarget = src.relatedTarget;
  13095. // Event type
  13096. } else {
  13097. this.type = src;
  13098. }
  13099. // Put explicitly provided properties onto the event object
  13100. if ( props ) {
  13101. jQuery.extend( this, props );
  13102. }
  13103. // Create a timestamp if incoming event doesn't have one
  13104. this.timeStamp = src && src.timeStamp || Date.now();
  13105. // Mark it as fixed
  13106. this[ jQuery.expando ] = true;
  13107. };
  13108. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13109. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13110. jQuery.Event.prototype = {
  13111. constructor: jQuery.Event,
  13112. isDefaultPrevented: returnFalse,
  13113. isPropagationStopped: returnFalse,
  13114. isImmediatePropagationStopped: returnFalse,
  13115. isSimulated: false,
  13116. preventDefault: function() {
  13117. var e = this.originalEvent;
  13118. this.isDefaultPrevented = returnTrue;
  13119. if ( e && !this.isSimulated ) {
  13120. e.preventDefault();
  13121. }
  13122. },
  13123. stopPropagation: function() {
  13124. var e = this.originalEvent;
  13125. this.isPropagationStopped = returnTrue;
  13126. if ( e && !this.isSimulated ) {
  13127. e.stopPropagation();
  13128. }
  13129. },
  13130. stopImmediatePropagation: function() {
  13131. var e = this.originalEvent;
  13132. this.isImmediatePropagationStopped = returnTrue;
  13133. if ( e && !this.isSimulated ) {
  13134. e.stopImmediatePropagation();
  13135. }
  13136. this.stopPropagation();
  13137. }
  13138. };
  13139. // Includes all common event props including KeyEvent and MouseEvent specific props
  13140. jQuery.each( {
  13141. altKey: true,
  13142. bubbles: true,
  13143. cancelable: true,
  13144. changedTouches: true,
  13145. ctrlKey: true,
  13146. detail: true,
  13147. eventPhase: true,
  13148. metaKey: true,
  13149. pageX: true,
  13150. pageY: true,
  13151. shiftKey: true,
  13152. view: true,
  13153. "char": true,
  13154. code: true,
  13155. charCode: true,
  13156. key: true,
  13157. keyCode: true,
  13158. button: true,
  13159. buttons: true,
  13160. clientX: true,
  13161. clientY: true,
  13162. offsetX: true,
  13163. offsetY: true,
  13164. pointerId: true,
  13165. pointerType: true,
  13166. screenX: true,
  13167. screenY: true,
  13168. targetTouches: true,
  13169. toElement: true,
  13170. touches: true,
  13171. which: function( event ) {
  13172. var button = event.button;
  13173. // Add which for key events
  13174. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13175. return event.charCode != null ? event.charCode : event.keyCode;
  13176. }
  13177. // Add which for click: 1 === left; 2 === middle; 3 === right
  13178. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13179. if ( button & 1 ) {
  13180. return 1;
  13181. }
  13182. if ( button & 2 ) {
  13183. return 3;
  13184. }
  13185. if ( button & 4 ) {
  13186. return 2;
  13187. }
  13188. return 0;
  13189. }
  13190. return event.which;
  13191. }
  13192. }, jQuery.event.addProp );
  13193. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13194. jQuery.event.special[ type ] = {
  13195. // Utilize native event if possible so blur/focus sequence is correct
  13196. setup: function() {
  13197. // Claim the first handler
  13198. // dataPriv.set( this, "focus", ... )
  13199. // dataPriv.set( this, "blur", ... )
  13200. leverageNative( this, type, expectSync );
  13201. // Return false to allow normal processing in the caller
  13202. return false;
  13203. },
  13204. trigger: function() {
  13205. // Force setup before trigger
  13206. leverageNative( this, type );
  13207. // Return non-false to allow normal event-path propagation
  13208. return true;
  13209. },
  13210. delegateType: delegateType
  13211. };
  13212. } );
  13213. // Create mouseenter/leave events using mouseover/out and event-time checks
  13214. // so that event delegation works in jQuery.
  13215. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13216. //
  13217. // Support: Safari 7 only
  13218. // Safari sends mouseenter too often; see:
  13219. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13220. // for the description of the bug (it existed in older Chrome versions as well).
  13221. jQuery.each( {
  13222. mouseenter: "mouseover",
  13223. mouseleave: "mouseout",
  13224. pointerenter: "pointerover",
  13225. pointerleave: "pointerout"
  13226. }, function( orig, fix ) {
  13227. jQuery.event.special[ orig ] = {
  13228. delegateType: fix,
  13229. bindType: fix,
  13230. handle: function( event ) {
  13231. var ret,
  13232. target = this,
  13233. related = event.relatedTarget,
  13234. handleObj = event.handleObj;
  13235. // For mouseenter/leave call the handler if related is outside the target.
  13236. // NB: No relatedTarget if the mouse left/entered the browser window
  13237. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13238. event.type = handleObj.origType;
  13239. ret = handleObj.handler.apply( this, arguments );
  13240. event.type = fix;
  13241. }
  13242. return ret;
  13243. }
  13244. };
  13245. } );
  13246. jQuery.fn.extend( {
  13247. on: function( types, selector, data, fn ) {
  13248. return on( this, types, selector, data, fn );
  13249. },
  13250. one: function( types, selector, data, fn ) {
  13251. return on( this, types, selector, data, fn, 1 );
  13252. },
  13253. off: function( types, selector, fn ) {
  13254. var handleObj, type;
  13255. if ( types && types.preventDefault && types.handleObj ) {
  13256. // ( event ) dispatched jQuery.Event
  13257. handleObj = types.handleObj;
  13258. jQuery( types.delegateTarget ).off(
  13259. handleObj.namespace ?
  13260. handleObj.origType + "." + handleObj.namespace :
  13261. handleObj.origType,
  13262. handleObj.selector,
  13263. handleObj.handler
  13264. );
  13265. return this;
  13266. }
  13267. if ( typeof types === "object" ) {
  13268. // ( types-object [, selector] )
  13269. for ( type in types ) {
  13270. this.off( type, selector, types[ type ] );
  13271. }
  13272. return this;
  13273. }
  13274. if ( selector === false || typeof selector === "function" ) {
  13275. // ( types [, fn] )
  13276. fn = selector;
  13277. selector = undefined;
  13278. }
  13279. if ( fn === false ) {
  13280. fn = returnFalse;
  13281. }
  13282. return this.each( function() {
  13283. jQuery.event.remove( this, types, fn, selector );
  13284. } );
  13285. }
  13286. } );
  13287. var
  13288. /* eslint-disable max-len */
  13289. // See https://github.com/eslint/eslint/issues/3229
  13290. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13291. /* eslint-enable */
  13292. // Support: IE <=10 - 11, Edge 12 - 13 only
  13293. // In IE/Edge using regex groups here causes severe slowdowns.
  13294. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13295. rnoInnerhtml = /<script|<style|<link/i,
  13296. // checked="checked" or checked
  13297. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13298. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13299. // Prefer a tbody over its parent table for containing new rows
  13300. function manipulationTarget( elem, content ) {
  13301. if ( nodeName( elem, "table" ) &&
  13302. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13303. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13304. }
  13305. return elem;
  13306. }
  13307. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13308. function disableScript( elem ) {
  13309. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13310. return elem;
  13311. }
  13312. function restoreScript( elem ) {
  13313. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13314. elem.type = elem.type.slice( 5 );
  13315. } else {
  13316. elem.removeAttribute( "type" );
  13317. }
  13318. return elem;
  13319. }
  13320. function cloneCopyEvent( src, dest ) {
  13321. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13322. if ( dest.nodeType !== 1 ) {
  13323. return;
  13324. }
  13325. // 1. Copy private data: events, handlers, etc.
  13326. if ( dataPriv.hasData( src ) ) {
  13327. pdataOld = dataPriv.access( src );
  13328. pdataCur = dataPriv.set( dest, pdataOld );
  13329. events = pdataOld.events;
  13330. if ( events ) {
  13331. delete pdataCur.handle;
  13332. pdataCur.events = {};
  13333. for ( type in events ) {
  13334. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13335. jQuery.event.add( dest, type, events[ type ][ i ] );
  13336. }
  13337. }
  13338. }
  13339. }
  13340. // 2. Copy user data
  13341. if ( dataUser.hasData( src ) ) {
  13342. udataOld = dataUser.access( src );
  13343. udataCur = jQuery.extend( {}, udataOld );
  13344. dataUser.set( dest, udataCur );
  13345. }
  13346. }
  13347. // Fix IE bugs, see support tests
  13348. function fixInput( src, dest ) {
  13349. var nodeName = dest.nodeName.toLowerCase();
  13350. // Fails to persist the checked state of a cloned checkbox or radio button.
  13351. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13352. dest.checked = src.checked;
  13353. // Fails to return the selected option to the default selected state when cloning options
  13354. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13355. dest.defaultValue = src.defaultValue;
  13356. }
  13357. }
  13358. function domManip( collection, args, callback, ignored ) {
  13359. // Flatten any nested arrays
  13360. args = concat.apply( [], args );
  13361. var fragment, first, scripts, hasScripts, node, doc,
  13362. i = 0,
  13363. l = collection.length,
  13364. iNoClone = l - 1,
  13365. value = args[ 0 ],
  13366. valueIsFunction = isFunction( value );
  13367. // We can't cloneNode fragments that contain checked, in WebKit
  13368. if ( valueIsFunction ||
  13369. ( l > 1 && typeof value === "string" &&
  13370. !support.checkClone && rchecked.test( value ) ) ) {
  13371. return collection.each( function( index ) {
  13372. var self = collection.eq( index );
  13373. if ( valueIsFunction ) {
  13374. args[ 0 ] = value.call( this, index, self.html() );
  13375. }
  13376. domManip( self, args, callback, ignored );
  13377. } );
  13378. }
  13379. if ( l ) {
  13380. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13381. first = fragment.firstChild;
  13382. if ( fragment.childNodes.length === 1 ) {
  13383. fragment = first;
  13384. }
  13385. // Require either new content or an interest in ignored elements to invoke the callback
  13386. if ( first || ignored ) {
  13387. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13388. hasScripts = scripts.length;
  13389. // Use the original fragment for the last item
  13390. // instead of the first because it can end up
  13391. // being emptied incorrectly in certain situations (#8070).
  13392. for ( ; i < l; i++ ) {
  13393. node = fragment;
  13394. if ( i !== iNoClone ) {
  13395. node = jQuery.clone( node, true, true );
  13396. // Keep references to cloned scripts for later restoration
  13397. if ( hasScripts ) {
  13398. // Support: Android <=4.0 only, PhantomJS 1 only
  13399. // push.apply(_, arraylike) throws on ancient WebKit
  13400. jQuery.merge( scripts, getAll( node, "script" ) );
  13401. }
  13402. }
  13403. callback.call( collection[ i ], node, i );
  13404. }
  13405. if ( hasScripts ) {
  13406. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13407. // Reenable scripts
  13408. jQuery.map( scripts, restoreScript );
  13409. // Evaluate executable scripts on first document insertion
  13410. for ( i = 0; i < hasScripts; i++ ) {
  13411. node = scripts[ i ];
  13412. if ( rscriptType.test( node.type || "" ) &&
  13413. !dataPriv.access( node, "globalEval" ) &&
  13414. jQuery.contains( doc, node ) ) {
  13415. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13416. // Optional AJAX dependency, but won't run scripts if not present
  13417. if ( jQuery._evalUrl && !node.noModule ) {
  13418. jQuery._evalUrl( node.src, {
  13419. nonce: node.nonce || node.getAttribute( "nonce" )
  13420. } );
  13421. }
  13422. } else {
  13423. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13424. }
  13425. }
  13426. }
  13427. }
  13428. }
  13429. }
  13430. return collection;
  13431. }
  13432. function remove( elem, selector, keepData ) {
  13433. var node,
  13434. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13435. i = 0;
  13436. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13437. if ( !keepData && node.nodeType === 1 ) {
  13438. jQuery.cleanData( getAll( node ) );
  13439. }
  13440. if ( node.parentNode ) {
  13441. if ( keepData && isAttached( node ) ) {
  13442. setGlobalEval( getAll( node, "script" ) );
  13443. }
  13444. node.parentNode.removeChild( node );
  13445. }
  13446. }
  13447. return elem;
  13448. }
  13449. jQuery.extend( {
  13450. htmlPrefilter: function( html ) {
  13451. return html.replace( rxhtmlTag, "<$1></$2>" );
  13452. },
  13453. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13454. var i, l, srcElements, destElements,
  13455. clone = elem.cloneNode( true ),
  13456. inPage = isAttached( elem );
  13457. // Fix IE cloning issues
  13458. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13459. !jQuery.isXMLDoc( elem ) ) {
  13460. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13461. destElements = getAll( clone );
  13462. srcElements = getAll( elem );
  13463. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13464. fixInput( srcElements[ i ], destElements[ i ] );
  13465. }
  13466. }
  13467. // Copy the events from the original to the clone
  13468. if ( dataAndEvents ) {
  13469. if ( deepDataAndEvents ) {
  13470. srcElements = srcElements || getAll( elem );
  13471. destElements = destElements || getAll( clone );
  13472. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13473. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13474. }
  13475. } else {
  13476. cloneCopyEvent( elem, clone );
  13477. }
  13478. }
  13479. // Preserve script evaluation history
  13480. destElements = getAll( clone, "script" );
  13481. if ( destElements.length > 0 ) {
  13482. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13483. }
  13484. // Return the cloned set
  13485. return clone;
  13486. },
  13487. cleanData: function( elems ) {
  13488. var data, elem, type,
  13489. special = jQuery.event.special,
  13490. i = 0;
  13491. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13492. if ( acceptData( elem ) ) {
  13493. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13494. if ( data.events ) {
  13495. for ( type in data.events ) {
  13496. if ( special[ type ] ) {
  13497. jQuery.event.remove( elem, type );
  13498. // This is a shortcut to avoid jQuery.event.remove's overhead
  13499. } else {
  13500. jQuery.removeEvent( elem, type, data.handle );
  13501. }
  13502. }
  13503. }
  13504. // Support: Chrome <=35 - 45+
  13505. // Assign undefined instead of using delete, see Data#remove
  13506. elem[ dataPriv.expando ] = undefined;
  13507. }
  13508. if ( elem[ dataUser.expando ] ) {
  13509. // Support: Chrome <=35 - 45+
  13510. // Assign undefined instead of using delete, see Data#remove
  13511. elem[ dataUser.expando ] = undefined;
  13512. }
  13513. }
  13514. }
  13515. }
  13516. } );
  13517. jQuery.fn.extend( {
  13518. detach: function( selector ) {
  13519. return remove( this, selector, true );
  13520. },
  13521. remove: function( selector ) {
  13522. return remove( this, selector );
  13523. },
  13524. text: function( value ) {
  13525. return access( this, function( value ) {
  13526. return value === undefined ?
  13527. jQuery.text( this ) :
  13528. this.empty().each( function() {
  13529. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13530. this.textContent = value;
  13531. }
  13532. } );
  13533. }, null, value, arguments.length );
  13534. },
  13535. append: function() {
  13536. return domManip( this, arguments, function( elem ) {
  13537. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13538. var target = manipulationTarget( this, elem );
  13539. target.appendChild( elem );
  13540. }
  13541. } );
  13542. },
  13543. prepend: function() {
  13544. return domManip( this, arguments, function( elem ) {
  13545. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13546. var target = manipulationTarget( this, elem );
  13547. target.insertBefore( elem, target.firstChild );
  13548. }
  13549. } );
  13550. },
  13551. before: function() {
  13552. return domManip( this, arguments, function( elem ) {
  13553. if ( this.parentNode ) {
  13554. this.parentNode.insertBefore( elem, this );
  13555. }
  13556. } );
  13557. },
  13558. after: function() {
  13559. return domManip( this, arguments, function( elem ) {
  13560. if ( this.parentNode ) {
  13561. this.parentNode.insertBefore( elem, this.nextSibling );
  13562. }
  13563. } );
  13564. },
  13565. empty: function() {
  13566. var elem,
  13567. i = 0;
  13568. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13569. if ( elem.nodeType === 1 ) {
  13570. // Prevent memory leaks
  13571. jQuery.cleanData( getAll( elem, false ) );
  13572. // Remove any remaining nodes
  13573. elem.textContent = "";
  13574. }
  13575. }
  13576. return this;
  13577. },
  13578. clone: function( dataAndEvents, deepDataAndEvents ) {
  13579. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13580. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13581. return this.map( function() {
  13582. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13583. } );
  13584. },
  13585. html: function( value ) {
  13586. return access( this, function( value ) {
  13587. var elem = this[ 0 ] || {},
  13588. i = 0,
  13589. l = this.length;
  13590. if ( value === undefined && elem.nodeType === 1 ) {
  13591. return elem.innerHTML;
  13592. }
  13593. // See if we can take a shortcut and just use innerHTML
  13594. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13595. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13596. value = jQuery.htmlPrefilter( value );
  13597. try {
  13598. for ( ; i < l; i++ ) {
  13599. elem = this[ i ] || {};
  13600. // Remove element nodes and prevent memory leaks
  13601. if ( elem.nodeType === 1 ) {
  13602. jQuery.cleanData( getAll( elem, false ) );
  13603. elem.innerHTML = value;
  13604. }
  13605. }
  13606. elem = 0;
  13607. // If using innerHTML throws an exception, use the fallback method
  13608. } catch ( e ) {}
  13609. }
  13610. if ( elem ) {
  13611. this.empty().append( value );
  13612. }
  13613. }, null, value, arguments.length );
  13614. },
  13615. replaceWith: function() {
  13616. var ignored = [];
  13617. // Make the changes, replacing each non-ignored context element with the new content
  13618. return domManip( this, arguments, function( elem ) {
  13619. var parent = this.parentNode;
  13620. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13621. jQuery.cleanData( getAll( this ) );
  13622. if ( parent ) {
  13623. parent.replaceChild( elem, this );
  13624. }
  13625. }
  13626. // Force callback invocation
  13627. }, ignored );
  13628. }
  13629. } );
  13630. jQuery.each( {
  13631. appendTo: "append",
  13632. prependTo: "prepend",
  13633. insertBefore: "before",
  13634. insertAfter: "after",
  13635. replaceAll: "replaceWith"
  13636. }, function( name, original ) {
  13637. jQuery.fn[ name ] = function( selector ) {
  13638. var elems,
  13639. ret = [],
  13640. insert = jQuery( selector ),
  13641. last = insert.length - 1,
  13642. i = 0;
  13643. for ( ; i <= last; i++ ) {
  13644. elems = i === last ? this : this.clone( true );
  13645. jQuery( insert[ i ] )[ original ]( elems );
  13646. // Support: Android <=4.0 only, PhantomJS 1 only
  13647. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13648. push.apply( ret, elems.get() );
  13649. }
  13650. return this.pushStack( ret );
  13651. };
  13652. } );
  13653. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13654. var getStyles = function( elem ) {
  13655. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13656. // IE throws on elements created in popups
  13657. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13658. var view = elem.ownerDocument.defaultView;
  13659. if ( !view || !view.opener ) {
  13660. view = window;
  13661. }
  13662. return view.getComputedStyle( elem );
  13663. };
  13664. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13665. ( function() {
  13666. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13667. // so they're executed at the same time to save the second computation.
  13668. function computeStyleTests() {
  13669. // This is a singleton, we need to execute it only once
  13670. if ( !div ) {
  13671. return;
  13672. }
  13673. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13674. "margin-top:1px;padding:0;border:0";
  13675. div.style.cssText =
  13676. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13677. "margin:auto;border:1px;padding:1px;" +
  13678. "width:60%;top:1%";
  13679. documentElement.appendChild( container ).appendChild( div );
  13680. var divStyle = window.getComputedStyle( div );
  13681. pixelPositionVal = divStyle.top !== "1%";
  13682. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13683. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13684. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13685. // Some styles come back with percentage values, even though they shouldn't
  13686. div.style.right = "60%";
  13687. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13688. // Support: IE 9 - 11 only
  13689. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13690. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13691. // Support: IE 9 only
  13692. // Detect overflow:scroll screwiness (gh-3699)
  13693. // Support: Chrome <=64
  13694. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13695. div.style.position = "absolute";
  13696. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13697. documentElement.removeChild( container );
  13698. // Nullify the div so it wouldn't be stored in the memory and
  13699. // it will also be a sign that checks already performed
  13700. div = null;
  13701. }
  13702. function roundPixelMeasures( measure ) {
  13703. return Math.round( parseFloat( measure ) );
  13704. }
  13705. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13706. reliableMarginLeftVal,
  13707. container = document.createElement( "div" ),
  13708. div = document.createElement( "div" );
  13709. // Finish early in limited (non-browser) environments
  13710. if ( !div.style ) {
  13711. return;
  13712. }
  13713. // Support: IE <=9 - 11 only
  13714. // Style of cloned element affects source element cloned (#8908)
  13715. div.style.backgroundClip = "content-box";
  13716. div.cloneNode( true ).style.backgroundClip = "";
  13717. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13718. jQuery.extend( support, {
  13719. boxSizingReliable: function() {
  13720. computeStyleTests();
  13721. return boxSizingReliableVal;
  13722. },
  13723. pixelBoxStyles: function() {
  13724. computeStyleTests();
  13725. return pixelBoxStylesVal;
  13726. },
  13727. pixelPosition: function() {
  13728. computeStyleTests();
  13729. return pixelPositionVal;
  13730. },
  13731. reliableMarginLeft: function() {
  13732. computeStyleTests();
  13733. return reliableMarginLeftVal;
  13734. },
  13735. scrollboxSize: function() {
  13736. computeStyleTests();
  13737. return scrollboxSizeVal;
  13738. }
  13739. } );
  13740. } )();
  13741. function curCSS( elem, name, computed ) {
  13742. var width, minWidth, maxWidth, ret,
  13743. // Support: Firefox 51+
  13744. // Retrieving style before computed somehow
  13745. // fixes an issue with getting wrong values
  13746. // on detached elements
  13747. style = elem.style;
  13748. computed = computed || getStyles( elem );
  13749. // getPropertyValue is needed for:
  13750. // .css('filter') (IE 9 only, #12537)
  13751. // .css('--customProperty) (#3144)
  13752. if ( computed ) {
  13753. ret = computed.getPropertyValue( name ) || computed[ name ];
  13754. if ( ret === "" && !isAttached( elem ) ) {
  13755. ret = jQuery.style( elem, name );
  13756. }
  13757. // A tribute to the "awesome hack by Dean Edwards"
  13758. // Android Browser returns percentage for some values,
  13759. // but width seems to be reliably pixels.
  13760. // This is against the CSSOM draft spec:
  13761. // https://drafts.csswg.org/cssom/#resolved-values
  13762. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13763. // Remember the original values
  13764. width = style.width;
  13765. minWidth = style.minWidth;
  13766. maxWidth = style.maxWidth;
  13767. // Put in the new values to get a computed value out
  13768. style.minWidth = style.maxWidth = style.width = ret;
  13769. ret = computed.width;
  13770. // Revert the changed values
  13771. style.width = width;
  13772. style.minWidth = minWidth;
  13773. style.maxWidth = maxWidth;
  13774. }
  13775. }
  13776. return ret !== undefined ?
  13777. // Support: IE <=9 - 11 only
  13778. // IE returns zIndex value as an integer.
  13779. ret + "" :
  13780. ret;
  13781. }
  13782. function addGetHookIf( conditionFn, hookFn ) {
  13783. // Define the hook, we'll check on the first run if it's really needed.
  13784. return {
  13785. get: function() {
  13786. if ( conditionFn() ) {
  13787. // Hook not needed (or it's not possible to use it due
  13788. // to missing dependency), remove it.
  13789. delete this.get;
  13790. return;
  13791. }
  13792. // Hook needed; redefine it so that the support test is not executed again.
  13793. return ( this.get = hookFn ).apply( this, arguments );
  13794. }
  13795. };
  13796. }
  13797. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13798. emptyStyle = document.createElement( "div" ).style,
  13799. vendorProps = {};
  13800. // Return a vendor-prefixed property or undefined
  13801. function vendorPropName( name ) {
  13802. // Check for vendor prefixed names
  13803. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13804. i = cssPrefixes.length;
  13805. while ( i-- ) {
  13806. name = cssPrefixes[ i ] + capName;
  13807. if ( name in emptyStyle ) {
  13808. return name;
  13809. }
  13810. }
  13811. }
  13812. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13813. function finalPropName( name ) {
  13814. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13815. if ( final ) {
  13816. return final;
  13817. }
  13818. if ( name in emptyStyle ) {
  13819. return name;
  13820. }
  13821. return vendorProps[ name ] = vendorPropName( name ) || name;
  13822. }
  13823. var
  13824. // Swappable if display is none or starts with table
  13825. // except "table", "table-cell", or "table-caption"
  13826. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13827. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13828. rcustomProp = /^--/,
  13829. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13830. cssNormalTransform = {
  13831. letterSpacing: "0",
  13832. fontWeight: "400"
  13833. };
  13834. function setPositiveNumber( elem, value, subtract ) {
  13835. // Any relative (+/-) values have already been
  13836. // normalized at this point
  13837. var matches = rcssNum.exec( value );
  13838. return matches ?
  13839. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13840. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13841. value;
  13842. }
  13843. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13844. var i = dimension === "width" ? 1 : 0,
  13845. extra = 0,
  13846. delta = 0;
  13847. // Adjustment may not be necessary
  13848. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13849. return 0;
  13850. }
  13851. for ( ; i < 4; i += 2 ) {
  13852. // Both box models exclude margin
  13853. if ( box === "margin" ) {
  13854. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13855. }
  13856. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13857. if ( !isBorderBox ) {
  13858. // Add padding
  13859. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13860. // For "border" or "margin", add border
  13861. if ( box !== "padding" ) {
  13862. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13863. // But still keep track of it otherwise
  13864. } else {
  13865. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13866. }
  13867. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13868. // "padding" or "margin"
  13869. } else {
  13870. // For "content", subtract padding
  13871. if ( box === "content" ) {
  13872. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13873. }
  13874. // For "content" or "padding", subtract border
  13875. if ( box !== "margin" ) {
  13876. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13877. }
  13878. }
  13879. }
  13880. // Account for positive content-box scroll gutter when requested by providing computedVal
  13881. if ( !isBorderBox && computedVal >= 0 ) {
  13882. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13883. // Assuming integer scroll gutter, subtract the rest and round down
  13884. delta += Math.max( 0, Math.ceil(
  13885. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13886. computedVal -
  13887. delta -
  13888. extra -
  13889. 0.5
  13890. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13891. // Use an explicit zero to avoid NaN (gh-3964)
  13892. ) ) || 0;
  13893. }
  13894. return delta;
  13895. }
  13896. function getWidthOrHeight( elem, dimension, extra ) {
  13897. // Start with computed style
  13898. var styles = getStyles( elem ),
  13899. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13900. // Fake content-box until we know it's needed to know the true value.
  13901. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13902. isBorderBox = boxSizingNeeded &&
  13903. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  13904. valueIsBorderBox = isBorderBox,
  13905. val = curCSS( elem, dimension, styles ),
  13906. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  13907. // Support: Firefox <=54
  13908. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  13909. if ( rnumnonpx.test( val ) ) {
  13910. if ( !extra ) {
  13911. return val;
  13912. }
  13913. val = "auto";
  13914. }
  13915. // Fall back to offsetWidth/offsetHeight when value is "auto"
  13916. // This happens for inline elements with no explicit setting (gh-3571)
  13917. // Support: Android <=4.1 - 4.3 only
  13918. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  13919. // Support: IE 9-11 only
  13920. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  13921. // We use getClientRects() to check for hidden/disconnected.
  13922. // In those cases, the computed value can be trusted to be border-box
  13923. if ( ( !support.boxSizingReliable() && isBorderBox ||
  13924. val === "auto" ||
  13925. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  13926. elem.getClientRects().length ) {
  13927. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  13928. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  13929. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  13930. // retrieved value as a content box dimension.
  13931. valueIsBorderBox = offsetProp in elem;
  13932. if ( valueIsBorderBox ) {
  13933. val = elem[ offsetProp ];
  13934. }
  13935. }
  13936. // Normalize "" and auto
  13937. val = parseFloat( val ) || 0;
  13938. // Adjust for the element's box model
  13939. return ( val +
  13940. boxModelAdjustment(
  13941. elem,
  13942. dimension,
  13943. extra || ( isBorderBox ? "border" : "content" ),
  13944. valueIsBorderBox,
  13945. styles,
  13946. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  13947. val
  13948. )
  13949. ) + "px";
  13950. }
  13951. jQuery.extend( {
  13952. // Add in style property hooks for overriding the default
  13953. // behavior of getting and setting a style property
  13954. cssHooks: {
  13955. opacity: {
  13956. get: function( elem, computed ) {
  13957. if ( computed ) {
  13958. // We should always get a number back from opacity
  13959. var ret = curCSS( elem, "opacity" );
  13960. return ret === "" ? "1" : ret;
  13961. }
  13962. }
  13963. }
  13964. },
  13965. // Don't automatically add "px" to these possibly-unitless properties
  13966. cssNumber: {
  13967. "animationIterationCount": true,
  13968. "columnCount": true,
  13969. "fillOpacity": true,
  13970. "flexGrow": true,
  13971. "flexShrink": true,
  13972. "fontWeight": true,
  13973. "gridArea": true,
  13974. "gridColumn": true,
  13975. "gridColumnEnd": true,
  13976. "gridColumnStart": true,
  13977. "gridRow": true,
  13978. "gridRowEnd": true,
  13979. "gridRowStart": true,
  13980. "lineHeight": true,
  13981. "opacity": true,
  13982. "order": true,
  13983. "orphans": true,
  13984. "widows": true,
  13985. "zIndex": true,
  13986. "zoom": true
  13987. },
  13988. // Add in properties whose names you wish to fix before
  13989. // setting or getting the value
  13990. cssProps: {},
  13991. // Get and set the style property on a DOM Node
  13992. style: function( elem, name, value, extra ) {
  13993. // Don't set styles on text and comment nodes
  13994. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  13995. return;
  13996. }
  13997. // Make sure that we're working with the right name
  13998. var ret, type, hooks,
  13999. origName = camelCase( name ),
  14000. isCustomProp = rcustomProp.test( name ),
  14001. style = elem.style;
  14002. // Make sure that we're working with the right name. We don't
  14003. // want to query the value if it is a CSS custom property
  14004. // since they are user-defined.
  14005. if ( !isCustomProp ) {
  14006. name = finalPropName( origName );
  14007. }
  14008. // Gets hook for the prefixed version, then unprefixed version
  14009. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14010. // Check if we're setting a value
  14011. if ( value !== undefined ) {
  14012. type = typeof value;
  14013. // Convert "+=" or "-=" to relative numbers (#7345)
  14014. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14015. value = adjustCSS( elem, name, ret );
  14016. // Fixes bug #9237
  14017. type = "number";
  14018. }
  14019. // Make sure that null and NaN values aren't set (#7116)
  14020. if ( value == null || value !== value ) {
  14021. return;
  14022. }
  14023. // If a number was passed in, add the unit (except for certain CSS properties)
  14024. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14025. // "px" to a few hardcoded values.
  14026. if ( type === "number" && !isCustomProp ) {
  14027. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14028. }
  14029. // background-* props affect original clone's values
  14030. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14031. style[ name ] = "inherit";
  14032. }
  14033. // If a hook was provided, use that value, otherwise just set the specified value
  14034. if ( !hooks || !( "set" in hooks ) ||
  14035. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14036. if ( isCustomProp ) {
  14037. style.setProperty( name, value );
  14038. } else {
  14039. style[ name ] = value;
  14040. }
  14041. }
  14042. } else {
  14043. // If a hook was provided get the non-computed value from there
  14044. if ( hooks && "get" in hooks &&
  14045. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14046. return ret;
  14047. }
  14048. // Otherwise just get the value from the style object
  14049. return style[ name ];
  14050. }
  14051. },
  14052. css: function( elem, name, extra, styles ) {
  14053. var val, num, hooks,
  14054. origName = camelCase( name ),
  14055. isCustomProp = rcustomProp.test( name );
  14056. // Make sure that we're working with the right name. We don't
  14057. // want to modify the value if it is a CSS custom property
  14058. // since they are user-defined.
  14059. if ( !isCustomProp ) {
  14060. name = finalPropName( origName );
  14061. }
  14062. // Try prefixed name followed by the unprefixed name
  14063. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14064. // If a hook was provided get the computed value from there
  14065. if ( hooks && "get" in hooks ) {
  14066. val = hooks.get( elem, true, extra );
  14067. }
  14068. // Otherwise, if a way to get the computed value exists, use that
  14069. if ( val === undefined ) {
  14070. val = curCSS( elem, name, styles );
  14071. }
  14072. // Convert "normal" to computed value
  14073. if ( val === "normal" && name in cssNormalTransform ) {
  14074. val = cssNormalTransform[ name ];
  14075. }
  14076. // Make numeric if forced or a qualifier was provided and val looks numeric
  14077. if ( extra === "" || extra ) {
  14078. num = parseFloat( val );
  14079. return extra === true || isFinite( num ) ? num || 0 : val;
  14080. }
  14081. return val;
  14082. }
  14083. } );
  14084. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14085. jQuery.cssHooks[ dimension ] = {
  14086. get: function( elem, computed, extra ) {
  14087. if ( computed ) {
  14088. // Certain elements can have dimension info if we invisibly show them
  14089. // but it must have a current display style that would benefit
  14090. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14091. // Support: Safari 8+
  14092. // Table columns in Safari have non-zero offsetWidth & zero
  14093. // getBoundingClientRect().width unless display is changed.
  14094. // Support: IE <=11 only
  14095. // Running getBoundingClientRect on a disconnected node
  14096. // in IE throws an error.
  14097. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14098. swap( elem, cssShow, function() {
  14099. return getWidthOrHeight( elem, dimension, extra );
  14100. } ) :
  14101. getWidthOrHeight( elem, dimension, extra );
  14102. }
  14103. },
  14104. set: function( elem, value, extra ) {
  14105. var matches,
  14106. styles = getStyles( elem ),
  14107. // Only read styles.position if the test has a chance to fail
  14108. // to avoid forcing a reflow.
  14109. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14110. styles.position === "absolute",
  14111. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14112. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14113. isBorderBox = boxSizingNeeded &&
  14114. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14115. subtract = extra ?
  14116. boxModelAdjustment(
  14117. elem,
  14118. dimension,
  14119. extra,
  14120. isBorderBox,
  14121. styles
  14122. ) :
  14123. 0;
  14124. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14125. // faking a content-box to get border and padding (gh-3699)
  14126. if ( isBorderBox && scrollboxSizeBuggy ) {
  14127. subtract -= Math.ceil(
  14128. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14129. parseFloat( styles[ dimension ] ) -
  14130. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14131. 0.5
  14132. );
  14133. }
  14134. // Convert to pixels if value adjustment is needed
  14135. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14136. ( matches[ 3 ] || "px" ) !== "px" ) {
  14137. elem.style[ dimension ] = value;
  14138. value = jQuery.css( elem, dimension );
  14139. }
  14140. return setPositiveNumber( elem, value, subtract );
  14141. }
  14142. };
  14143. } );
  14144. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14145. function( elem, computed ) {
  14146. if ( computed ) {
  14147. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14148. elem.getBoundingClientRect().left -
  14149. swap( elem, { marginLeft: 0 }, function() {
  14150. return elem.getBoundingClientRect().left;
  14151. } )
  14152. ) + "px";
  14153. }
  14154. }
  14155. );
  14156. // These hooks are used by animate to expand properties
  14157. jQuery.each( {
  14158. margin: "",
  14159. padding: "",
  14160. border: "Width"
  14161. }, function( prefix, suffix ) {
  14162. jQuery.cssHooks[ prefix + suffix ] = {
  14163. expand: function( value ) {
  14164. var i = 0,
  14165. expanded = {},
  14166. // Assumes a single number if not a string
  14167. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14168. for ( ; i < 4; i++ ) {
  14169. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14170. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14171. }
  14172. return expanded;
  14173. }
  14174. };
  14175. if ( prefix !== "margin" ) {
  14176. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14177. }
  14178. } );
  14179. jQuery.fn.extend( {
  14180. css: function( name, value ) {
  14181. return access( this, function( elem, name, value ) {
  14182. var styles, len,
  14183. map = {},
  14184. i = 0;
  14185. if ( Array.isArray( name ) ) {
  14186. styles = getStyles( elem );
  14187. len = name.length;
  14188. for ( ; i < len; i++ ) {
  14189. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14190. }
  14191. return map;
  14192. }
  14193. return value !== undefined ?
  14194. jQuery.style( elem, name, value ) :
  14195. jQuery.css( elem, name );
  14196. }, name, value, arguments.length > 1 );
  14197. }
  14198. } );
  14199. function Tween( elem, options, prop, end, easing ) {
  14200. return new Tween.prototype.init( elem, options, prop, end, easing );
  14201. }
  14202. jQuery.Tween = Tween;
  14203. Tween.prototype = {
  14204. constructor: Tween,
  14205. init: function( elem, options, prop, end, easing, unit ) {
  14206. this.elem = elem;
  14207. this.prop = prop;
  14208. this.easing = easing || jQuery.easing._default;
  14209. this.options = options;
  14210. this.start = this.now = this.cur();
  14211. this.end = end;
  14212. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14213. },
  14214. cur: function() {
  14215. var hooks = Tween.propHooks[ this.prop ];
  14216. return hooks && hooks.get ?
  14217. hooks.get( this ) :
  14218. Tween.propHooks._default.get( this );
  14219. },
  14220. run: function( percent ) {
  14221. var eased,
  14222. hooks = Tween.propHooks[ this.prop ];
  14223. if ( this.options.duration ) {
  14224. this.pos = eased = jQuery.easing[ this.easing ](
  14225. percent, this.options.duration * percent, 0, 1, this.options.duration
  14226. );
  14227. } else {
  14228. this.pos = eased = percent;
  14229. }
  14230. this.now = ( this.end - this.start ) * eased + this.start;
  14231. if ( this.options.step ) {
  14232. this.options.step.call( this.elem, this.now, this );
  14233. }
  14234. if ( hooks && hooks.set ) {
  14235. hooks.set( this );
  14236. } else {
  14237. Tween.propHooks._default.set( this );
  14238. }
  14239. return this;
  14240. }
  14241. };
  14242. Tween.prototype.init.prototype = Tween.prototype;
  14243. Tween.propHooks = {
  14244. _default: {
  14245. get: function( tween ) {
  14246. var result;
  14247. // Use a property on the element directly when it is not a DOM element,
  14248. // or when there is no matching style property that exists.
  14249. if ( tween.elem.nodeType !== 1 ||
  14250. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14251. return tween.elem[ tween.prop ];
  14252. }
  14253. // Passing an empty string as a 3rd parameter to .css will automatically
  14254. // attempt a parseFloat and fallback to a string if the parse fails.
  14255. // Simple values such as "10px" are parsed to Float;
  14256. // complex values such as "rotate(1rad)" are returned as-is.
  14257. result = jQuery.css( tween.elem, tween.prop, "" );
  14258. // Empty strings, null, undefined and "auto" are converted to 0.
  14259. return !result || result === "auto" ? 0 : result;
  14260. },
  14261. set: function( tween ) {
  14262. // Use step hook for back compat.
  14263. // Use cssHook if its there.
  14264. // Use .style if available and use plain properties where available.
  14265. if ( jQuery.fx.step[ tween.prop ] ) {
  14266. jQuery.fx.step[ tween.prop ]( tween );
  14267. } else if ( tween.elem.nodeType === 1 && (
  14268. jQuery.cssHooks[ tween.prop ] ||
  14269. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14270. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14271. } else {
  14272. tween.elem[ tween.prop ] = tween.now;
  14273. }
  14274. }
  14275. }
  14276. };
  14277. // Support: IE <=9 only
  14278. // Panic based approach to setting things on disconnected nodes
  14279. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14280. set: function( tween ) {
  14281. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14282. tween.elem[ tween.prop ] = tween.now;
  14283. }
  14284. }
  14285. };
  14286. jQuery.easing = {
  14287. linear: function( p ) {
  14288. return p;
  14289. },
  14290. swing: function( p ) {
  14291. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14292. },
  14293. _default: "swing"
  14294. };
  14295. jQuery.fx = Tween.prototype.init;
  14296. // Back compat <1.8 extension point
  14297. jQuery.fx.step = {};
  14298. var
  14299. fxNow, inProgress,
  14300. rfxtypes = /^(?:toggle|show|hide)$/,
  14301. rrun = /queueHooks$/;
  14302. function schedule() {
  14303. if ( inProgress ) {
  14304. if ( document.hidden === false && window.requestAnimationFrame ) {
  14305. window.requestAnimationFrame( schedule );
  14306. } else {
  14307. window.setTimeout( schedule, jQuery.fx.interval );
  14308. }
  14309. jQuery.fx.tick();
  14310. }
  14311. }
  14312. // Animations created synchronously will run synchronously
  14313. function createFxNow() {
  14314. window.setTimeout( function() {
  14315. fxNow = undefined;
  14316. } );
  14317. return ( fxNow = Date.now() );
  14318. }
  14319. // Generate parameters to create a standard animation
  14320. function genFx( type, includeWidth ) {
  14321. var which,
  14322. i = 0,
  14323. attrs = { height: type };
  14324. // If we include width, step value is 1 to do all cssExpand values,
  14325. // otherwise step value is 2 to skip over Left and Right
  14326. includeWidth = includeWidth ? 1 : 0;
  14327. for ( ; i < 4; i += 2 - includeWidth ) {
  14328. which = cssExpand[ i ];
  14329. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14330. }
  14331. if ( includeWidth ) {
  14332. attrs.opacity = attrs.width = type;
  14333. }
  14334. return attrs;
  14335. }
  14336. function createTween( value, prop, animation ) {
  14337. var tween,
  14338. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14339. index = 0,
  14340. length = collection.length;
  14341. for ( ; index < length; index++ ) {
  14342. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14343. // We're done with this property
  14344. return tween;
  14345. }
  14346. }
  14347. }
  14348. function defaultPrefilter( elem, props, opts ) {
  14349. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14350. isBox = "width" in props || "height" in props,
  14351. anim = this,
  14352. orig = {},
  14353. style = elem.style,
  14354. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14355. dataShow = dataPriv.get( elem, "fxshow" );
  14356. // Queue-skipping animations hijack the fx hooks
  14357. if ( !opts.queue ) {
  14358. hooks = jQuery._queueHooks( elem, "fx" );
  14359. if ( hooks.unqueued == null ) {
  14360. hooks.unqueued = 0;
  14361. oldfire = hooks.empty.fire;
  14362. hooks.empty.fire = function() {
  14363. if ( !hooks.unqueued ) {
  14364. oldfire();
  14365. }
  14366. };
  14367. }
  14368. hooks.unqueued++;
  14369. anim.always( function() {
  14370. // Ensure the complete handler is called before this completes
  14371. anim.always( function() {
  14372. hooks.unqueued--;
  14373. if ( !jQuery.queue( elem, "fx" ).length ) {
  14374. hooks.empty.fire();
  14375. }
  14376. } );
  14377. } );
  14378. }
  14379. // Detect show/hide animations
  14380. for ( prop in props ) {
  14381. value = props[ prop ];
  14382. if ( rfxtypes.test( value ) ) {
  14383. delete props[ prop ];
  14384. toggle = toggle || value === "toggle";
  14385. if ( value === ( hidden ? "hide" : "show" ) ) {
  14386. // Pretend to be hidden if this is a "show" and
  14387. // there is still data from a stopped show/hide
  14388. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14389. hidden = true;
  14390. // Ignore all other no-op show/hide data
  14391. } else {
  14392. continue;
  14393. }
  14394. }
  14395. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14396. }
  14397. }
  14398. // Bail out if this is a no-op like .hide().hide()
  14399. propTween = !jQuery.isEmptyObject( props );
  14400. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14401. return;
  14402. }
  14403. // Restrict "overflow" and "display" styles during box animations
  14404. if ( isBox && elem.nodeType === 1 ) {
  14405. // Support: IE <=9 - 11, Edge 12 - 15
  14406. // Record all 3 overflow attributes because IE does not infer the shorthand
  14407. // from identically-valued overflowX and overflowY and Edge just mirrors
  14408. // the overflowX value there.
  14409. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14410. // Identify a display type, preferring old show/hide data over the CSS cascade
  14411. restoreDisplay = dataShow && dataShow.display;
  14412. if ( restoreDisplay == null ) {
  14413. restoreDisplay = dataPriv.get( elem, "display" );
  14414. }
  14415. display = jQuery.css( elem, "display" );
  14416. if ( display === "none" ) {
  14417. if ( restoreDisplay ) {
  14418. display = restoreDisplay;
  14419. } else {
  14420. // Get nonempty value(s) by temporarily forcing visibility
  14421. showHide( [ elem ], true );
  14422. restoreDisplay = elem.style.display || restoreDisplay;
  14423. display = jQuery.css( elem, "display" );
  14424. showHide( [ elem ] );
  14425. }
  14426. }
  14427. // Animate inline elements as inline-block
  14428. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14429. if ( jQuery.css( elem, "float" ) === "none" ) {
  14430. // Restore the original display value at the end of pure show/hide animations
  14431. if ( !propTween ) {
  14432. anim.done( function() {
  14433. style.display = restoreDisplay;
  14434. } );
  14435. if ( restoreDisplay == null ) {
  14436. display = style.display;
  14437. restoreDisplay = display === "none" ? "" : display;
  14438. }
  14439. }
  14440. style.display = "inline-block";
  14441. }
  14442. }
  14443. }
  14444. if ( opts.overflow ) {
  14445. style.overflow = "hidden";
  14446. anim.always( function() {
  14447. style.overflow = opts.overflow[ 0 ];
  14448. style.overflowX = opts.overflow[ 1 ];
  14449. style.overflowY = opts.overflow[ 2 ];
  14450. } );
  14451. }
  14452. // Implement show/hide animations
  14453. propTween = false;
  14454. for ( prop in orig ) {
  14455. // General show/hide setup for this element animation
  14456. if ( !propTween ) {
  14457. if ( dataShow ) {
  14458. if ( "hidden" in dataShow ) {
  14459. hidden = dataShow.hidden;
  14460. }
  14461. } else {
  14462. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14463. }
  14464. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14465. if ( toggle ) {
  14466. dataShow.hidden = !hidden;
  14467. }
  14468. // Show elements before animating them
  14469. if ( hidden ) {
  14470. showHide( [ elem ], true );
  14471. }
  14472. /* eslint-disable no-loop-func */
  14473. anim.done( function() {
  14474. /* eslint-enable no-loop-func */
  14475. // The final step of a "hide" animation is actually hiding the element
  14476. if ( !hidden ) {
  14477. showHide( [ elem ] );
  14478. }
  14479. dataPriv.remove( elem, "fxshow" );
  14480. for ( prop in orig ) {
  14481. jQuery.style( elem, prop, orig[ prop ] );
  14482. }
  14483. } );
  14484. }
  14485. // Per-property setup
  14486. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14487. if ( !( prop in dataShow ) ) {
  14488. dataShow[ prop ] = propTween.start;
  14489. if ( hidden ) {
  14490. propTween.end = propTween.start;
  14491. propTween.start = 0;
  14492. }
  14493. }
  14494. }
  14495. }
  14496. function propFilter( props, specialEasing ) {
  14497. var index, name, easing, value, hooks;
  14498. // camelCase, specialEasing and expand cssHook pass
  14499. for ( index in props ) {
  14500. name = camelCase( index );
  14501. easing = specialEasing[ name ];
  14502. value = props[ index ];
  14503. if ( Array.isArray( value ) ) {
  14504. easing = value[ 1 ];
  14505. value = props[ index ] = value[ 0 ];
  14506. }
  14507. if ( index !== name ) {
  14508. props[ name ] = value;
  14509. delete props[ index ];
  14510. }
  14511. hooks = jQuery.cssHooks[ name ];
  14512. if ( hooks && "expand" in hooks ) {
  14513. value = hooks.expand( value );
  14514. delete props[ name ];
  14515. // Not quite $.extend, this won't overwrite existing keys.
  14516. // Reusing 'index' because we have the correct "name"
  14517. for ( index in value ) {
  14518. if ( !( index in props ) ) {
  14519. props[ index ] = value[ index ];
  14520. specialEasing[ index ] = easing;
  14521. }
  14522. }
  14523. } else {
  14524. specialEasing[ name ] = easing;
  14525. }
  14526. }
  14527. }
  14528. function Animation( elem, properties, options ) {
  14529. var result,
  14530. stopped,
  14531. index = 0,
  14532. length = Animation.prefilters.length,
  14533. deferred = jQuery.Deferred().always( function() {
  14534. // Don't match elem in the :animated selector
  14535. delete tick.elem;
  14536. } ),
  14537. tick = function() {
  14538. if ( stopped ) {
  14539. return false;
  14540. }
  14541. var currentTime = fxNow || createFxNow(),
  14542. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14543. // Support: Android 2.3 only
  14544. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14545. temp = remaining / animation.duration || 0,
  14546. percent = 1 - temp,
  14547. index = 0,
  14548. length = animation.tweens.length;
  14549. for ( ; index < length; index++ ) {
  14550. animation.tweens[ index ].run( percent );
  14551. }
  14552. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14553. // If there's more to do, yield
  14554. if ( percent < 1 && length ) {
  14555. return remaining;
  14556. }
  14557. // If this was an empty animation, synthesize a final progress notification
  14558. if ( !length ) {
  14559. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14560. }
  14561. // Resolve the animation and report its conclusion
  14562. deferred.resolveWith( elem, [ animation ] );
  14563. return false;
  14564. },
  14565. animation = deferred.promise( {
  14566. elem: elem,
  14567. props: jQuery.extend( {}, properties ),
  14568. opts: jQuery.extend( true, {
  14569. specialEasing: {},
  14570. easing: jQuery.easing._default
  14571. }, options ),
  14572. originalProperties: properties,
  14573. originalOptions: options,
  14574. startTime: fxNow || createFxNow(),
  14575. duration: options.duration,
  14576. tweens: [],
  14577. createTween: function( prop, end ) {
  14578. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14579. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14580. animation.tweens.push( tween );
  14581. return tween;
  14582. },
  14583. stop: function( gotoEnd ) {
  14584. var index = 0,
  14585. // If we are going to the end, we want to run all the tweens
  14586. // otherwise we skip this part
  14587. length = gotoEnd ? animation.tweens.length : 0;
  14588. if ( stopped ) {
  14589. return this;
  14590. }
  14591. stopped = true;
  14592. for ( ; index < length; index++ ) {
  14593. animation.tweens[ index ].run( 1 );
  14594. }
  14595. // Resolve when we played the last frame; otherwise, reject
  14596. if ( gotoEnd ) {
  14597. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14598. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14599. } else {
  14600. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14601. }
  14602. return this;
  14603. }
  14604. } ),
  14605. props = animation.props;
  14606. propFilter( props, animation.opts.specialEasing );
  14607. for ( ; index < length; index++ ) {
  14608. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14609. if ( result ) {
  14610. if ( isFunction( result.stop ) ) {
  14611. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14612. result.stop.bind( result );
  14613. }
  14614. return result;
  14615. }
  14616. }
  14617. jQuery.map( props, createTween, animation );
  14618. if ( isFunction( animation.opts.start ) ) {
  14619. animation.opts.start.call( elem, animation );
  14620. }
  14621. // Attach callbacks from options
  14622. animation
  14623. .progress( animation.opts.progress )
  14624. .done( animation.opts.done, animation.opts.complete )
  14625. .fail( animation.opts.fail )
  14626. .always( animation.opts.always );
  14627. jQuery.fx.timer(
  14628. jQuery.extend( tick, {
  14629. elem: elem,
  14630. anim: animation,
  14631. queue: animation.opts.queue
  14632. } )
  14633. );
  14634. return animation;
  14635. }
  14636. jQuery.Animation = jQuery.extend( Animation, {
  14637. tweeners: {
  14638. "*": [ function( prop, value ) {
  14639. var tween = this.createTween( prop, value );
  14640. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14641. return tween;
  14642. } ]
  14643. },
  14644. tweener: function( props, callback ) {
  14645. if ( isFunction( props ) ) {
  14646. callback = props;
  14647. props = [ "*" ];
  14648. } else {
  14649. props = props.match( rnothtmlwhite );
  14650. }
  14651. var prop,
  14652. index = 0,
  14653. length = props.length;
  14654. for ( ; index < length; index++ ) {
  14655. prop = props[ index ];
  14656. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14657. Animation.tweeners[ prop ].unshift( callback );
  14658. }
  14659. },
  14660. prefilters: [ defaultPrefilter ],
  14661. prefilter: function( callback, prepend ) {
  14662. if ( prepend ) {
  14663. Animation.prefilters.unshift( callback );
  14664. } else {
  14665. Animation.prefilters.push( callback );
  14666. }
  14667. }
  14668. } );
  14669. jQuery.speed = function( speed, easing, fn ) {
  14670. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14671. complete: fn || !fn && easing ||
  14672. isFunction( speed ) && speed,
  14673. duration: speed,
  14674. easing: fn && easing || easing && !isFunction( easing ) && easing
  14675. };
  14676. // Go to the end state if fx are off
  14677. if ( jQuery.fx.off ) {
  14678. opt.duration = 0;
  14679. } else {
  14680. if ( typeof opt.duration !== "number" ) {
  14681. if ( opt.duration in jQuery.fx.speeds ) {
  14682. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14683. } else {
  14684. opt.duration = jQuery.fx.speeds._default;
  14685. }
  14686. }
  14687. }
  14688. // Normalize opt.queue - true/undefined/null -> "fx"
  14689. if ( opt.queue == null || opt.queue === true ) {
  14690. opt.queue = "fx";
  14691. }
  14692. // Queueing
  14693. opt.old = opt.complete;
  14694. opt.complete = function() {
  14695. if ( isFunction( opt.old ) ) {
  14696. opt.old.call( this );
  14697. }
  14698. if ( opt.queue ) {
  14699. jQuery.dequeue( this, opt.queue );
  14700. }
  14701. };
  14702. return opt;
  14703. };
  14704. jQuery.fn.extend( {
  14705. fadeTo: function( speed, to, easing, callback ) {
  14706. // Show any hidden elements after setting opacity to 0
  14707. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14708. // Animate to the value specified
  14709. .end().animate( { opacity: to }, speed, easing, callback );
  14710. },
  14711. animate: function( prop, speed, easing, callback ) {
  14712. var empty = jQuery.isEmptyObject( prop ),
  14713. optall = jQuery.speed( speed, easing, callback ),
  14714. doAnimation = function() {
  14715. // Operate on a copy of prop so per-property easing won't be lost
  14716. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14717. // Empty animations, or finishing resolves immediately
  14718. if ( empty || dataPriv.get( this, "finish" ) ) {
  14719. anim.stop( true );
  14720. }
  14721. };
  14722. doAnimation.finish = doAnimation;
  14723. return empty || optall.queue === false ?
  14724. this.each( doAnimation ) :
  14725. this.queue( optall.queue, doAnimation );
  14726. },
  14727. stop: function( type, clearQueue, gotoEnd ) {
  14728. var stopQueue = function( hooks ) {
  14729. var stop = hooks.stop;
  14730. delete hooks.stop;
  14731. stop( gotoEnd );
  14732. };
  14733. if ( typeof type !== "string" ) {
  14734. gotoEnd = clearQueue;
  14735. clearQueue = type;
  14736. type = undefined;
  14737. }
  14738. if ( clearQueue && type !== false ) {
  14739. this.queue( type || "fx", [] );
  14740. }
  14741. return this.each( function() {
  14742. var dequeue = true,
  14743. index = type != null && type + "queueHooks",
  14744. timers = jQuery.timers,
  14745. data = dataPriv.get( this );
  14746. if ( index ) {
  14747. if ( data[ index ] && data[ index ].stop ) {
  14748. stopQueue( data[ index ] );
  14749. }
  14750. } else {
  14751. for ( index in data ) {
  14752. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14753. stopQueue( data[ index ] );
  14754. }
  14755. }
  14756. }
  14757. for ( index = timers.length; index--; ) {
  14758. if ( timers[ index ].elem === this &&
  14759. ( type == null || timers[ index ].queue === type ) ) {
  14760. timers[ index ].anim.stop( gotoEnd );
  14761. dequeue = false;
  14762. timers.splice( index, 1 );
  14763. }
  14764. }
  14765. // Start the next in the queue if the last step wasn't forced.
  14766. // Timers currently will call their complete callbacks, which
  14767. // will dequeue but only if they were gotoEnd.
  14768. if ( dequeue || !gotoEnd ) {
  14769. jQuery.dequeue( this, type );
  14770. }
  14771. } );
  14772. },
  14773. finish: function( type ) {
  14774. if ( type !== false ) {
  14775. type = type || "fx";
  14776. }
  14777. return this.each( function() {
  14778. var index,
  14779. data = dataPriv.get( this ),
  14780. queue = data[ type + "queue" ],
  14781. hooks = data[ type + "queueHooks" ],
  14782. timers = jQuery.timers,
  14783. length = queue ? queue.length : 0;
  14784. // Enable finishing flag on private data
  14785. data.finish = true;
  14786. // Empty the queue first
  14787. jQuery.queue( this, type, [] );
  14788. if ( hooks && hooks.stop ) {
  14789. hooks.stop.call( this, true );
  14790. }
  14791. // Look for any active animations, and finish them
  14792. for ( index = timers.length; index--; ) {
  14793. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14794. timers[ index ].anim.stop( true );
  14795. timers.splice( index, 1 );
  14796. }
  14797. }
  14798. // Look for any animations in the old queue and finish them
  14799. for ( index = 0; index < length; index++ ) {
  14800. if ( queue[ index ] && queue[ index ].finish ) {
  14801. queue[ index ].finish.call( this );
  14802. }
  14803. }
  14804. // Turn off finishing flag
  14805. delete data.finish;
  14806. } );
  14807. }
  14808. } );
  14809. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14810. var cssFn = jQuery.fn[ name ];
  14811. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14812. return speed == null || typeof speed === "boolean" ?
  14813. cssFn.apply( this, arguments ) :
  14814. this.animate( genFx( name, true ), speed, easing, callback );
  14815. };
  14816. } );
  14817. // Generate shortcuts for custom animations
  14818. jQuery.each( {
  14819. slideDown: genFx( "show" ),
  14820. slideUp: genFx( "hide" ),
  14821. slideToggle: genFx( "toggle" ),
  14822. fadeIn: { opacity: "show" },
  14823. fadeOut: { opacity: "hide" },
  14824. fadeToggle: { opacity: "toggle" }
  14825. }, function( name, props ) {
  14826. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14827. return this.animate( props, speed, easing, callback );
  14828. };
  14829. } );
  14830. jQuery.timers = [];
  14831. jQuery.fx.tick = function() {
  14832. var timer,
  14833. i = 0,
  14834. timers = jQuery.timers;
  14835. fxNow = Date.now();
  14836. for ( ; i < timers.length; i++ ) {
  14837. timer = timers[ i ];
  14838. // Run the timer and safely remove it when done (allowing for external removal)
  14839. if ( !timer() && timers[ i ] === timer ) {
  14840. timers.splice( i--, 1 );
  14841. }
  14842. }
  14843. if ( !timers.length ) {
  14844. jQuery.fx.stop();
  14845. }
  14846. fxNow = undefined;
  14847. };
  14848. jQuery.fx.timer = function( timer ) {
  14849. jQuery.timers.push( timer );
  14850. jQuery.fx.start();
  14851. };
  14852. jQuery.fx.interval = 13;
  14853. jQuery.fx.start = function() {
  14854. if ( inProgress ) {
  14855. return;
  14856. }
  14857. inProgress = true;
  14858. schedule();
  14859. };
  14860. jQuery.fx.stop = function() {
  14861. inProgress = null;
  14862. };
  14863. jQuery.fx.speeds = {
  14864. slow: 600,
  14865. fast: 200,
  14866. // Default speed
  14867. _default: 400
  14868. };
  14869. // Based off of the plugin by Clint Helfers, with permission.
  14870. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14871. jQuery.fn.delay = function( time, type ) {
  14872. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14873. type = type || "fx";
  14874. return this.queue( type, function( next, hooks ) {
  14875. var timeout = window.setTimeout( next, time );
  14876. hooks.stop = function() {
  14877. window.clearTimeout( timeout );
  14878. };
  14879. } );
  14880. };
  14881. ( function() {
  14882. var input = document.createElement( "input" ),
  14883. select = document.createElement( "select" ),
  14884. opt = select.appendChild( document.createElement( "option" ) );
  14885. input.type = "checkbox";
  14886. // Support: Android <=4.3 only
  14887. // Default value for a checkbox should be "on"
  14888. support.checkOn = input.value !== "";
  14889. // Support: IE <=11 only
  14890. // Must access selectedIndex to make default options select
  14891. support.optSelected = opt.selected;
  14892. // Support: IE <=11 only
  14893. // An input loses its value after becoming a radio
  14894. input = document.createElement( "input" );
  14895. input.value = "t";
  14896. input.type = "radio";
  14897. support.radioValue = input.value === "t";
  14898. } )();
  14899. var boolHook,
  14900. attrHandle = jQuery.expr.attrHandle;
  14901. jQuery.fn.extend( {
  14902. attr: function( name, value ) {
  14903. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  14904. },
  14905. removeAttr: function( name ) {
  14906. return this.each( function() {
  14907. jQuery.removeAttr( this, name );
  14908. } );
  14909. }
  14910. } );
  14911. jQuery.extend( {
  14912. attr: function( elem, name, value ) {
  14913. var ret, hooks,
  14914. nType = elem.nodeType;
  14915. // Don't get/set attributes on text, comment and attribute nodes
  14916. if ( nType === 3 || nType === 8 || nType === 2 ) {
  14917. return;
  14918. }
  14919. // Fallback to prop when attributes are not supported
  14920. if ( typeof elem.getAttribute === "undefined" ) {
  14921. return jQuery.prop( elem, name, value );
  14922. }
  14923. // Attribute hooks are determined by the lowercase version
  14924. // Grab necessary hook if one is defined
  14925. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  14926. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  14927. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  14928. }
  14929. if ( value !== undefined ) {
  14930. if ( value === null ) {
  14931. jQuery.removeAttr( elem, name );
  14932. return;
  14933. }
  14934. if ( hooks && "set" in hooks &&
  14935. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  14936. return ret;
  14937. }
  14938. elem.setAttribute( name, value + "" );
  14939. return value;
  14940. }
  14941. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  14942. return ret;
  14943. }
  14944. ret = jQuery.find.attr( elem, name );
  14945. // Non-existent attributes return null, we normalize to undefined
  14946. return ret == null ? undefined : ret;
  14947. },
  14948. attrHooks: {
  14949. type: {
  14950. set: function( elem, value ) {
  14951. if ( !support.radioValue && value === "radio" &&
  14952. nodeName( elem, "input" ) ) {
  14953. var val = elem.value;
  14954. elem.setAttribute( "type", value );
  14955. if ( val ) {
  14956. elem.value = val;
  14957. }
  14958. return value;
  14959. }
  14960. }
  14961. }
  14962. },
  14963. removeAttr: function( elem, value ) {
  14964. var name,
  14965. i = 0,
  14966. // Attribute names can contain non-HTML whitespace characters
  14967. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  14968. attrNames = value && value.match( rnothtmlwhite );
  14969. if ( attrNames && elem.nodeType === 1 ) {
  14970. while ( ( name = attrNames[ i++ ] ) ) {
  14971. elem.removeAttribute( name );
  14972. }
  14973. }
  14974. }
  14975. } );
  14976. // Hooks for boolean attributes
  14977. boolHook = {
  14978. set: function( elem, value, name ) {
  14979. if ( value === false ) {
  14980. // Remove boolean attributes when set to false
  14981. jQuery.removeAttr( elem, name );
  14982. } else {
  14983. elem.setAttribute( name, name );
  14984. }
  14985. return name;
  14986. }
  14987. };
  14988. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  14989. var getter = attrHandle[ name ] || jQuery.find.attr;
  14990. attrHandle[ name ] = function( elem, name, isXML ) {
  14991. var ret, handle,
  14992. lowercaseName = name.toLowerCase();
  14993. if ( !isXML ) {
  14994. // Avoid an infinite loop by temporarily removing this function from the getter
  14995. handle = attrHandle[ lowercaseName ];
  14996. attrHandle[ lowercaseName ] = ret;
  14997. ret = getter( elem, name, isXML ) != null ?
  14998. lowercaseName :
  14999. null;
  15000. attrHandle[ lowercaseName ] = handle;
  15001. }
  15002. return ret;
  15003. };
  15004. } );
  15005. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15006. rclickable = /^(?:a|area)$/i;
  15007. jQuery.fn.extend( {
  15008. prop: function( name, value ) {
  15009. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15010. },
  15011. removeProp: function( name ) {
  15012. return this.each( function() {
  15013. delete this[ jQuery.propFix[ name ] || name ];
  15014. } );
  15015. }
  15016. } );
  15017. jQuery.extend( {
  15018. prop: function( elem, name, value ) {
  15019. var ret, hooks,
  15020. nType = elem.nodeType;
  15021. // Don't get/set properties on text, comment and attribute nodes
  15022. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15023. return;
  15024. }
  15025. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15026. // Fix name and attach hooks
  15027. name = jQuery.propFix[ name ] || name;
  15028. hooks = jQuery.propHooks[ name ];
  15029. }
  15030. if ( value !== undefined ) {
  15031. if ( hooks && "set" in hooks &&
  15032. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15033. return ret;
  15034. }
  15035. return ( elem[ name ] = value );
  15036. }
  15037. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15038. return ret;
  15039. }
  15040. return elem[ name ];
  15041. },
  15042. propHooks: {
  15043. tabIndex: {
  15044. get: function( elem ) {
  15045. // Support: IE <=9 - 11 only
  15046. // elem.tabIndex doesn't always return the
  15047. // correct value when it hasn't been explicitly set
  15048. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15049. // Use proper attribute retrieval(#12072)
  15050. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15051. if ( tabindex ) {
  15052. return parseInt( tabindex, 10 );
  15053. }
  15054. if (
  15055. rfocusable.test( elem.nodeName ) ||
  15056. rclickable.test( elem.nodeName ) &&
  15057. elem.href
  15058. ) {
  15059. return 0;
  15060. }
  15061. return -1;
  15062. }
  15063. }
  15064. },
  15065. propFix: {
  15066. "for": "htmlFor",
  15067. "class": "className"
  15068. }
  15069. } );
  15070. // Support: IE <=11 only
  15071. // Accessing the selectedIndex property
  15072. // forces the browser to respect setting selected
  15073. // on the option
  15074. // The getter ensures a default option is selected
  15075. // when in an optgroup
  15076. // eslint rule "no-unused-expressions" is disabled for this code
  15077. // since it considers such accessions noop
  15078. if ( !support.optSelected ) {
  15079. jQuery.propHooks.selected = {
  15080. get: function( elem ) {
  15081. /* eslint no-unused-expressions: "off" */
  15082. var parent = elem.parentNode;
  15083. if ( parent && parent.parentNode ) {
  15084. parent.parentNode.selectedIndex;
  15085. }
  15086. return null;
  15087. },
  15088. set: function( elem ) {
  15089. /* eslint no-unused-expressions: "off" */
  15090. var parent = elem.parentNode;
  15091. if ( parent ) {
  15092. parent.selectedIndex;
  15093. if ( parent.parentNode ) {
  15094. parent.parentNode.selectedIndex;
  15095. }
  15096. }
  15097. }
  15098. };
  15099. }
  15100. jQuery.each( [
  15101. "tabIndex",
  15102. "readOnly",
  15103. "maxLength",
  15104. "cellSpacing",
  15105. "cellPadding",
  15106. "rowSpan",
  15107. "colSpan",
  15108. "useMap",
  15109. "frameBorder",
  15110. "contentEditable"
  15111. ], function() {
  15112. jQuery.propFix[ this.toLowerCase() ] = this;
  15113. } );
  15114. // Strip and collapse whitespace according to HTML spec
  15115. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15116. function stripAndCollapse( value ) {
  15117. var tokens = value.match( rnothtmlwhite ) || [];
  15118. return tokens.join( " " );
  15119. }
  15120. function getClass( elem ) {
  15121. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15122. }
  15123. function classesToArray( value ) {
  15124. if ( Array.isArray( value ) ) {
  15125. return value;
  15126. }
  15127. if ( typeof value === "string" ) {
  15128. return value.match( rnothtmlwhite ) || [];
  15129. }
  15130. return [];
  15131. }
  15132. jQuery.fn.extend( {
  15133. addClass: function( value ) {
  15134. var classes, elem, cur, curValue, clazz, j, finalValue,
  15135. i = 0;
  15136. if ( isFunction( value ) ) {
  15137. return this.each( function( j ) {
  15138. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15139. } );
  15140. }
  15141. classes = classesToArray( value );
  15142. if ( classes.length ) {
  15143. while ( ( elem = this[ i++ ] ) ) {
  15144. curValue = getClass( elem );
  15145. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15146. if ( cur ) {
  15147. j = 0;
  15148. while ( ( clazz = classes[ j++ ] ) ) {
  15149. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15150. cur += clazz + " ";
  15151. }
  15152. }
  15153. // Only assign if different to avoid unneeded rendering.
  15154. finalValue = stripAndCollapse( cur );
  15155. if ( curValue !== finalValue ) {
  15156. elem.setAttribute( "class", finalValue );
  15157. }
  15158. }
  15159. }
  15160. }
  15161. return this;
  15162. },
  15163. removeClass: function( value ) {
  15164. var classes, elem, cur, curValue, clazz, j, finalValue,
  15165. i = 0;
  15166. if ( isFunction( value ) ) {
  15167. return this.each( function( j ) {
  15168. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15169. } );
  15170. }
  15171. if ( !arguments.length ) {
  15172. return this.attr( "class", "" );
  15173. }
  15174. classes = classesToArray( value );
  15175. if ( classes.length ) {
  15176. while ( ( elem = this[ i++ ] ) ) {
  15177. curValue = getClass( elem );
  15178. // This expression is here for better compressibility (see addClass)
  15179. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15180. if ( cur ) {
  15181. j = 0;
  15182. while ( ( clazz = classes[ j++ ] ) ) {
  15183. // Remove *all* instances
  15184. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15185. cur = cur.replace( " " + clazz + " ", " " );
  15186. }
  15187. }
  15188. // Only assign if different to avoid unneeded rendering.
  15189. finalValue = stripAndCollapse( cur );
  15190. if ( curValue !== finalValue ) {
  15191. elem.setAttribute( "class", finalValue );
  15192. }
  15193. }
  15194. }
  15195. }
  15196. return this;
  15197. },
  15198. toggleClass: function( value, stateVal ) {
  15199. var type = typeof value,
  15200. isValidValue = type === "string" || Array.isArray( value );
  15201. if ( typeof stateVal === "boolean" && isValidValue ) {
  15202. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15203. }
  15204. if ( isFunction( value ) ) {
  15205. return this.each( function( i ) {
  15206. jQuery( this ).toggleClass(
  15207. value.call( this, i, getClass( this ), stateVal ),
  15208. stateVal
  15209. );
  15210. } );
  15211. }
  15212. return this.each( function() {
  15213. var className, i, self, classNames;
  15214. if ( isValidValue ) {
  15215. // Toggle individual class names
  15216. i = 0;
  15217. self = jQuery( this );
  15218. classNames = classesToArray( value );
  15219. while ( ( className = classNames[ i++ ] ) ) {
  15220. // Check each className given, space separated list
  15221. if ( self.hasClass( className ) ) {
  15222. self.removeClass( className );
  15223. } else {
  15224. self.addClass( className );
  15225. }
  15226. }
  15227. // Toggle whole class name
  15228. } else if ( value === undefined || type === "boolean" ) {
  15229. className = getClass( this );
  15230. if ( className ) {
  15231. // Store className if set
  15232. dataPriv.set( this, "__className__", className );
  15233. }
  15234. // If the element has a class name or if we're passed `false`,
  15235. // then remove the whole classname (if there was one, the above saved it).
  15236. // Otherwise bring back whatever was previously saved (if anything),
  15237. // falling back to the empty string if nothing was stored.
  15238. if ( this.setAttribute ) {
  15239. this.setAttribute( "class",
  15240. className || value === false ?
  15241. "" :
  15242. dataPriv.get( this, "__className__" ) || ""
  15243. );
  15244. }
  15245. }
  15246. } );
  15247. },
  15248. hasClass: function( selector ) {
  15249. var className, elem,
  15250. i = 0;
  15251. className = " " + selector + " ";
  15252. while ( ( elem = this[ i++ ] ) ) {
  15253. if ( elem.nodeType === 1 &&
  15254. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15255. return true;
  15256. }
  15257. }
  15258. return false;
  15259. }
  15260. } );
  15261. var rreturn = /\r/g;
  15262. jQuery.fn.extend( {
  15263. val: function( value ) {
  15264. var hooks, ret, valueIsFunction,
  15265. elem = this[ 0 ];
  15266. if ( !arguments.length ) {
  15267. if ( elem ) {
  15268. hooks = jQuery.valHooks[ elem.type ] ||
  15269. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15270. if ( hooks &&
  15271. "get" in hooks &&
  15272. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15273. ) {
  15274. return ret;
  15275. }
  15276. ret = elem.value;
  15277. // Handle most common string cases
  15278. if ( typeof ret === "string" ) {
  15279. return ret.replace( rreturn, "" );
  15280. }
  15281. // Handle cases where value is null/undef or number
  15282. return ret == null ? "" : ret;
  15283. }
  15284. return;
  15285. }
  15286. valueIsFunction = isFunction( value );
  15287. return this.each( function( i ) {
  15288. var val;
  15289. if ( this.nodeType !== 1 ) {
  15290. return;
  15291. }
  15292. if ( valueIsFunction ) {
  15293. val = value.call( this, i, jQuery( this ).val() );
  15294. } else {
  15295. val = value;
  15296. }
  15297. // Treat null/undefined as ""; convert numbers to string
  15298. if ( val == null ) {
  15299. val = "";
  15300. } else if ( typeof val === "number" ) {
  15301. val += "";
  15302. } else if ( Array.isArray( val ) ) {
  15303. val = jQuery.map( val, function( value ) {
  15304. return value == null ? "" : value + "";
  15305. } );
  15306. }
  15307. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15308. // If set returns undefined, fall back to normal setting
  15309. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15310. this.value = val;
  15311. }
  15312. } );
  15313. }
  15314. } );
  15315. jQuery.extend( {
  15316. valHooks: {
  15317. option: {
  15318. get: function( elem ) {
  15319. var val = jQuery.find.attr( elem, "value" );
  15320. return val != null ?
  15321. val :
  15322. // Support: IE <=10 - 11 only
  15323. // option.text throws exceptions (#14686, #14858)
  15324. // Strip and collapse whitespace
  15325. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15326. stripAndCollapse( jQuery.text( elem ) );
  15327. }
  15328. },
  15329. select: {
  15330. get: function( elem ) {
  15331. var value, option, i,
  15332. options = elem.options,
  15333. index = elem.selectedIndex,
  15334. one = elem.type === "select-one",
  15335. values = one ? null : [],
  15336. max = one ? index + 1 : options.length;
  15337. if ( index < 0 ) {
  15338. i = max;
  15339. } else {
  15340. i = one ? index : 0;
  15341. }
  15342. // Loop through all the selected options
  15343. for ( ; i < max; i++ ) {
  15344. option = options[ i ];
  15345. // Support: IE <=9 only
  15346. // IE8-9 doesn't update selected after form reset (#2551)
  15347. if ( ( option.selected || i === index ) &&
  15348. // Don't return options that are disabled or in a disabled optgroup
  15349. !option.disabled &&
  15350. ( !option.parentNode.disabled ||
  15351. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15352. // Get the specific value for the option
  15353. value = jQuery( option ).val();
  15354. // We don't need an array for one selects
  15355. if ( one ) {
  15356. return value;
  15357. }
  15358. // Multi-Selects return an array
  15359. values.push( value );
  15360. }
  15361. }
  15362. return values;
  15363. },
  15364. set: function( elem, value ) {
  15365. var optionSet, option,
  15366. options = elem.options,
  15367. values = jQuery.makeArray( value ),
  15368. i = options.length;
  15369. while ( i-- ) {
  15370. option = options[ i ];
  15371. /* eslint-disable no-cond-assign */
  15372. if ( option.selected =
  15373. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15374. ) {
  15375. optionSet = true;
  15376. }
  15377. /* eslint-enable no-cond-assign */
  15378. }
  15379. // Force browsers to behave consistently when non-matching value is set
  15380. if ( !optionSet ) {
  15381. elem.selectedIndex = -1;
  15382. }
  15383. return values;
  15384. }
  15385. }
  15386. }
  15387. } );
  15388. // Radios and checkboxes getter/setter
  15389. jQuery.each( [ "radio", "checkbox" ], function() {
  15390. jQuery.valHooks[ this ] = {
  15391. set: function( elem, value ) {
  15392. if ( Array.isArray( value ) ) {
  15393. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15394. }
  15395. }
  15396. };
  15397. if ( !support.checkOn ) {
  15398. jQuery.valHooks[ this ].get = function( elem ) {
  15399. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15400. };
  15401. }
  15402. } );
  15403. // Return jQuery for attributes-only inclusion
  15404. support.focusin = "onfocusin" in window;
  15405. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15406. stopPropagationCallback = function( e ) {
  15407. e.stopPropagation();
  15408. };
  15409. jQuery.extend( jQuery.event, {
  15410. trigger: function( event, data, elem, onlyHandlers ) {
  15411. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15412. eventPath = [ elem || document ],
  15413. type = hasOwn.call( event, "type" ) ? event.type : event,
  15414. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15415. cur = lastElement = tmp = elem = elem || document;
  15416. // Don't do events on text and comment nodes
  15417. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15418. return;
  15419. }
  15420. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15421. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15422. return;
  15423. }
  15424. if ( type.indexOf( "." ) > -1 ) {
  15425. // Namespaced trigger; create a regexp to match event type in handle()
  15426. namespaces = type.split( "." );
  15427. type = namespaces.shift();
  15428. namespaces.sort();
  15429. }
  15430. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15431. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15432. event = event[ jQuery.expando ] ?
  15433. event :
  15434. new jQuery.Event( type, typeof event === "object" && event );
  15435. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15436. event.isTrigger = onlyHandlers ? 2 : 3;
  15437. event.namespace = namespaces.join( "." );
  15438. event.rnamespace = event.namespace ?
  15439. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15440. null;
  15441. // Clean up the event in case it is being reused
  15442. event.result = undefined;
  15443. if ( !event.target ) {
  15444. event.target = elem;
  15445. }
  15446. // Clone any incoming data and prepend the event, creating the handler arg list
  15447. data = data == null ?
  15448. [ event ] :
  15449. jQuery.makeArray( data, [ event ] );
  15450. // Allow special events to draw outside the lines
  15451. special = jQuery.event.special[ type ] || {};
  15452. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15453. return;
  15454. }
  15455. // Determine event propagation path in advance, per W3C events spec (#9951)
  15456. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15457. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15458. bubbleType = special.delegateType || type;
  15459. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15460. cur = cur.parentNode;
  15461. }
  15462. for ( ; cur; cur = cur.parentNode ) {
  15463. eventPath.push( cur );
  15464. tmp = cur;
  15465. }
  15466. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15467. if ( tmp === ( elem.ownerDocument || document ) ) {
  15468. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15469. }
  15470. }
  15471. // Fire handlers on the event path
  15472. i = 0;
  15473. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15474. lastElement = cur;
  15475. event.type = i > 1 ?
  15476. bubbleType :
  15477. special.bindType || type;
  15478. // jQuery handler
  15479. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15480. dataPriv.get( cur, "handle" );
  15481. if ( handle ) {
  15482. handle.apply( cur, data );
  15483. }
  15484. // Native handler
  15485. handle = ontype && cur[ ontype ];
  15486. if ( handle && handle.apply && acceptData( cur ) ) {
  15487. event.result = handle.apply( cur, data );
  15488. if ( event.result === false ) {
  15489. event.preventDefault();
  15490. }
  15491. }
  15492. }
  15493. event.type = type;
  15494. // If nobody prevented the default action, do it now
  15495. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15496. if ( ( !special._default ||
  15497. special._default.apply( eventPath.pop(), data ) === false ) &&
  15498. acceptData( elem ) ) {
  15499. // Call a native DOM method on the target with the same name as the event.
  15500. // Don't do default actions on window, that's where global variables be (#6170)
  15501. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15502. // Don't re-trigger an onFOO event when we call its FOO() method
  15503. tmp = elem[ ontype ];
  15504. if ( tmp ) {
  15505. elem[ ontype ] = null;
  15506. }
  15507. // Prevent re-triggering of the same event, since we already bubbled it above
  15508. jQuery.event.triggered = type;
  15509. if ( event.isPropagationStopped() ) {
  15510. lastElement.addEventListener( type, stopPropagationCallback );
  15511. }
  15512. elem[ type ]();
  15513. if ( event.isPropagationStopped() ) {
  15514. lastElement.removeEventListener( type, stopPropagationCallback );
  15515. }
  15516. jQuery.event.triggered = undefined;
  15517. if ( tmp ) {
  15518. elem[ ontype ] = tmp;
  15519. }
  15520. }
  15521. }
  15522. }
  15523. return event.result;
  15524. },
  15525. // Piggyback on a donor event to simulate a different one
  15526. // Used only for `focus(in | out)` events
  15527. simulate: function( type, elem, event ) {
  15528. var e = jQuery.extend(
  15529. new jQuery.Event(),
  15530. event,
  15531. {
  15532. type: type,
  15533. isSimulated: true
  15534. }
  15535. );
  15536. jQuery.event.trigger( e, null, elem );
  15537. }
  15538. } );
  15539. jQuery.fn.extend( {
  15540. trigger: function( type, data ) {
  15541. return this.each( function() {
  15542. jQuery.event.trigger( type, data, this );
  15543. } );
  15544. },
  15545. triggerHandler: function( type, data ) {
  15546. var elem = this[ 0 ];
  15547. if ( elem ) {
  15548. return jQuery.event.trigger( type, data, elem, true );
  15549. }
  15550. }
  15551. } );
  15552. // Support: Firefox <=44
  15553. // Firefox doesn't have focus(in | out) events
  15554. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15555. //
  15556. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15557. // focus(in | out) events fire after focus & blur events,
  15558. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15559. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15560. if ( !support.focusin ) {
  15561. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15562. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15563. var handler = function( event ) {
  15564. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15565. };
  15566. jQuery.event.special[ fix ] = {
  15567. setup: function() {
  15568. var doc = this.ownerDocument || this,
  15569. attaches = dataPriv.access( doc, fix );
  15570. if ( !attaches ) {
  15571. doc.addEventListener( orig, handler, true );
  15572. }
  15573. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15574. },
  15575. teardown: function() {
  15576. var doc = this.ownerDocument || this,
  15577. attaches = dataPriv.access( doc, fix ) - 1;
  15578. if ( !attaches ) {
  15579. doc.removeEventListener( orig, handler, true );
  15580. dataPriv.remove( doc, fix );
  15581. } else {
  15582. dataPriv.access( doc, fix, attaches );
  15583. }
  15584. }
  15585. };
  15586. } );
  15587. }
  15588. var location = window.location;
  15589. var nonce = Date.now();
  15590. var rquery = ( /\?/ );
  15591. // Cross-browser xml parsing
  15592. jQuery.parseXML = function( data ) {
  15593. var xml;
  15594. if ( !data || typeof data !== "string" ) {
  15595. return null;
  15596. }
  15597. // Support: IE 9 - 11 only
  15598. // IE throws on parseFromString with invalid input.
  15599. try {
  15600. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15601. } catch ( e ) {
  15602. xml = undefined;
  15603. }
  15604. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15605. jQuery.error( "Invalid XML: " + data );
  15606. }
  15607. return xml;
  15608. };
  15609. var
  15610. rbracket = /\[\]$/,
  15611. rCRLF = /\r?\n/g,
  15612. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15613. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15614. function buildParams( prefix, obj, traditional, add ) {
  15615. var name;
  15616. if ( Array.isArray( obj ) ) {
  15617. // Serialize array item.
  15618. jQuery.each( obj, function( i, v ) {
  15619. if ( traditional || rbracket.test( prefix ) ) {
  15620. // Treat each array item as a scalar.
  15621. add( prefix, v );
  15622. } else {
  15623. // Item is non-scalar (array or object), encode its numeric index.
  15624. buildParams(
  15625. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15626. v,
  15627. traditional,
  15628. add
  15629. );
  15630. }
  15631. } );
  15632. } else if ( !traditional && toType( obj ) === "object" ) {
  15633. // Serialize object item.
  15634. for ( name in obj ) {
  15635. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15636. }
  15637. } else {
  15638. // Serialize scalar item.
  15639. add( prefix, obj );
  15640. }
  15641. }
  15642. // Serialize an array of form elements or a set of
  15643. // key/values into a query string
  15644. jQuery.param = function( a, traditional ) {
  15645. var prefix,
  15646. s = [],
  15647. add = function( key, valueOrFunction ) {
  15648. // If value is a function, invoke it and use its return value
  15649. var value = isFunction( valueOrFunction ) ?
  15650. valueOrFunction() :
  15651. valueOrFunction;
  15652. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15653. encodeURIComponent( value == null ? "" : value );
  15654. };
  15655. if ( a == null ) {
  15656. return "";
  15657. }
  15658. // If an array was passed in, assume that it is an array of form elements.
  15659. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15660. // Serialize the form elements
  15661. jQuery.each( a, function() {
  15662. add( this.name, this.value );
  15663. } );
  15664. } else {
  15665. // If traditional, encode the "old" way (the way 1.3.2 or older
  15666. // did it), otherwise encode params recursively.
  15667. for ( prefix in a ) {
  15668. buildParams( prefix, a[ prefix ], traditional, add );
  15669. }
  15670. }
  15671. // Return the resulting serialization
  15672. return s.join( "&" );
  15673. };
  15674. jQuery.fn.extend( {
  15675. serialize: function() {
  15676. return jQuery.param( this.serializeArray() );
  15677. },
  15678. serializeArray: function() {
  15679. return this.map( function() {
  15680. // Can add propHook for "elements" to filter or add form elements
  15681. var elements = jQuery.prop( this, "elements" );
  15682. return elements ? jQuery.makeArray( elements ) : this;
  15683. } )
  15684. .filter( function() {
  15685. var type = this.type;
  15686. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15687. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15688. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15689. ( this.checked || !rcheckableType.test( type ) );
  15690. } )
  15691. .map( function( i, elem ) {
  15692. var val = jQuery( this ).val();
  15693. if ( val == null ) {
  15694. return null;
  15695. }
  15696. if ( Array.isArray( val ) ) {
  15697. return jQuery.map( val, function( val ) {
  15698. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15699. } );
  15700. }
  15701. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15702. } ).get();
  15703. }
  15704. } );
  15705. var
  15706. r20 = /%20/g,
  15707. rhash = /#.*$/,
  15708. rantiCache = /([?&])_=[^&]*/,
  15709. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15710. // #7653, #8125, #8152: local protocol detection
  15711. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15712. rnoContent = /^(?:GET|HEAD)$/,
  15713. rprotocol = /^\/\//,
  15714. /* Prefilters
  15715. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15716. * 2) These are called:
  15717. * - BEFORE asking for a transport
  15718. * - AFTER param serialization (s.data is a string if s.processData is true)
  15719. * 3) key is the dataType
  15720. * 4) the catchall symbol "*" can be used
  15721. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15722. */
  15723. prefilters = {},
  15724. /* Transports bindings
  15725. * 1) key is the dataType
  15726. * 2) the catchall symbol "*" can be used
  15727. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15728. */
  15729. transports = {},
  15730. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15731. allTypes = "*/".concat( "*" ),
  15732. // Anchor tag for parsing the document origin
  15733. originAnchor = document.createElement( "a" );
  15734. originAnchor.href = location.href;
  15735. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15736. function addToPrefiltersOrTransports( structure ) {
  15737. // dataTypeExpression is optional and defaults to "*"
  15738. return function( dataTypeExpression, func ) {
  15739. if ( typeof dataTypeExpression !== "string" ) {
  15740. func = dataTypeExpression;
  15741. dataTypeExpression = "*";
  15742. }
  15743. var dataType,
  15744. i = 0,
  15745. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15746. if ( isFunction( func ) ) {
  15747. // For each dataType in the dataTypeExpression
  15748. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15749. // Prepend if requested
  15750. if ( dataType[ 0 ] === "+" ) {
  15751. dataType = dataType.slice( 1 ) || "*";
  15752. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15753. // Otherwise append
  15754. } else {
  15755. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15756. }
  15757. }
  15758. }
  15759. };
  15760. }
  15761. // Base inspection function for prefilters and transports
  15762. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15763. var inspected = {},
  15764. seekingTransport = ( structure === transports );
  15765. function inspect( dataType ) {
  15766. var selected;
  15767. inspected[ dataType ] = true;
  15768. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15769. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15770. if ( typeof dataTypeOrTransport === "string" &&
  15771. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15772. options.dataTypes.unshift( dataTypeOrTransport );
  15773. inspect( dataTypeOrTransport );
  15774. return false;
  15775. } else if ( seekingTransport ) {
  15776. return !( selected = dataTypeOrTransport );
  15777. }
  15778. } );
  15779. return selected;
  15780. }
  15781. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15782. }
  15783. // A special extend for ajax options
  15784. // that takes "flat" options (not to be deep extended)
  15785. // Fixes #9887
  15786. function ajaxExtend( target, src ) {
  15787. var key, deep,
  15788. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15789. for ( key in src ) {
  15790. if ( src[ key ] !== undefined ) {
  15791. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15792. }
  15793. }
  15794. if ( deep ) {
  15795. jQuery.extend( true, target, deep );
  15796. }
  15797. return target;
  15798. }
  15799. /* Handles responses to an ajax request:
  15800. * - finds the right dataType (mediates between content-type and expected dataType)
  15801. * - returns the corresponding response
  15802. */
  15803. function ajaxHandleResponses( s, jqXHR, responses ) {
  15804. var ct, type, finalDataType, firstDataType,
  15805. contents = s.contents,
  15806. dataTypes = s.dataTypes;
  15807. // Remove auto dataType and get content-type in the process
  15808. while ( dataTypes[ 0 ] === "*" ) {
  15809. dataTypes.shift();
  15810. if ( ct === undefined ) {
  15811. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15812. }
  15813. }
  15814. // Check if we're dealing with a known content-type
  15815. if ( ct ) {
  15816. for ( type in contents ) {
  15817. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15818. dataTypes.unshift( type );
  15819. break;
  15820. }
  15821. }
  15822. }
  15823. // Check to see if we have a response for the expected dataType
  15824. if ( dataTypes[ 0 ] in responses ) {
  15825. finalDataType = dataTypes[ 0 ];
  15826. } else {
  15827. // Try convertible dataTypes
  15828. for ( type in responses ) {
  15829. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15830. finalDataType = type;
  15831. break;
  15832. }
  15833. if ( !firstDataType ) {
  15834. firstDataType = type;
  15835. }
  15836. }
  15837. // Or just use first one
  15838. finalDataType = finalDataType || firstDataType;
  15839. }
  15840. // If we found a dataType
  15841. // We add the dataType to the list if needed
  15842. // and return the corresponding response
  15843. if ( finalDataType ) {
  15844. if ( finalDataType !== dataTypes[ 0 ] ) {
  15845. dataTypes.unshift( finalDataType );
  15846. }
  15847. return responses[ finalDataType ];
  15848. }
  15849. }
  15850. /* Chain conversions given the request and the original response
  15851. * Also sets the responseXXX fields on the jqXHR instance
  15852. */
  15853. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15854. var conv2, current, conv, tmp, prev,
  15855. converters = {},
  15856. // Work with a copy of dataTypes in case we need to modify it for conversion
  15857. dataTypes = s.dataTypes.slice();
  15858. // Create converters map with lowercased keys
  15859. if ( dataTypes[ 1 ] ) {
  15860. for ( conv in s.converters ) {
  15861. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15862. }
  15863. }
  15864. current = dataTypes.shift();
  15865. // Convert to each sequential dataType
  15866. while ( current ) {
  15867. if ( s.responseFields[ current ] ) {
  15868. jqXHR[ s.responseFields[ current ] ] = response;
  15869. }
  15870. // Apply the dataFilter if provided
  15871. if ( !prev && isSuccess && s.dataFilter ) {
  15872. response = s.dataFilter( response, s.dataType );
  15873. }
  15874. prev = current;
  15875. current = dataTypes.shift();
  15876. if ( current ) {
  15877. // There's only work to do if current dataType is non-auto
  15878. if ( current === "*" ) {
  15879. current = prev;
  15880. // Convert response if prev dataType is non-auto and differs from current
  15881. } else if ( prev !== "*" && prev !== current ) {
  15882. // Seek a direct converter
  15883. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15884. // If none found, seek a pair
  15885. if ( !conv ) {
  15886. for ( conv2 in converters ) {
  15887. // If conv2 outputs current
  15888. tmp = conv2.split( " " );
  15889. if ( tmp[ 1 ] === current ) {
  15890. // If prev can be converted to accepted input
  15891. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15892. converters[ "* " + tmp[ 0 ] ];
  15893. if ( conv ) {
  15894. // Condense equivalence converters
  15895. if ( conv === true ) {
  15896. conv = converters[ conv2 ];
  15897. // Otherwise, insert the intermediate dataType
  15898. } else if ( converters[ conv2 ] !== true ) {
  15899. current = tmp[ 0 ];
  15900. dataTypes.unshift( tmp[ 1 ] );
  15901. }
  15902. break;
  15903. }
  15904. }
  15905. }
  15906. }
  15907. // Apply converter (if not an equivalence)
  15908. if ( conv !== true ) {
  15909. // Unless errors are allowed to bubble, catch and return them
  15910. if ( conv && s.throws ) {
  15911. response = conv( response );
  15912. } else {
  15913. try {
  15914. response = conv( response );
  15915. } catch ( e ) {
  15916. return {
  15917. state: "parsererror",
  15918. error: conv ? e : "No conversion from " + prev + " to " + current
  15919. };
  15920. }
  15921. }
  15922. }
  15923. }
  15924. }
  15925. }
  15926. return { state: "success", data: response };
  15927. }
  15928. jQuery.extend( {
  15929. // Counter for holding the number of active queries
  15930. active: 0,
  15931. // Last-Modified header cache for next request
  15932. lastModified: {},
  15933. etag: {},
  15934. ajaxSettings: {
  15935. url: location.href,
  15936. type: "GET",
  15937. isLocal: rlocalProtocol.test( location.protocol ),
  15938. global: true,
  15939. processData: true,
  15940. async: true,
  15941. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  15942. /*
  15943. timeout: 0,
  15944. data: null,
  15945. dataType: null,
  15946. username: null,
  15947. password: null,
  15948. cache: null,
  15949. throws: false,
  15950. traditional: false,
  15951. headers: {},
  15952. */
  15953. accepts: {
  15954. "*": allTypes,
  15955. text: "text/plain",
  15956. html: "text/html",
  15957. xml: "application/xml, text/xml",
  15958. json: "application/json, text/javascript"
  15959. },
  15960. contents: {
  15961. xml: /\bxml\b/,
  15962. html: /\bhtml/,
  15963. json: /\bjson\b/
  15964. },
  15965. responseFields: {
  15966. xml: "responseXML",
  15967. text: "responseText",
  15968. json: "responseJSON"
  15969. },
  15970. // Data converters
  15971. // Keys separate source (or catchall "*") and destination types with a single space
  15972. converters: {
  15973. // Convert anything to text
  15974. "* text": String,
  15975. // Text to html (true = no transformation)
  15976. "text html": true,
  15977. // Evaluate text as a json expression
  15978. "text json": JSON.parse,
  15979. // Parse text as xml
  15980. "text xml": jQuery.parseXML
  15981. },
  15982. // For options that shouldn't be deep extended:
  15983. // you can add your own custom options here if
  15984. // and when you create one that shouldn't be
  15985. // deep extended (see ajaxExtend)
  15986. flatOptions: {
  15987. url: true,
  15988. context: true
  15989. }
  15990. },
  15991. // Creates a full fledged settings object into target
  15992. // with both ajaxSettings and settings fields.
  15993. // If target is omitted, writes into ajaxSettings.
  15994. ajaxSetup: function( target, settings ) {
  15995. return settings ?
  15996. // Building a settings object
  15997. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  15998. // Extending ajaxSettings
  15999. ajaxExtend( jQuery.ajaxSettings, target );
  16000. },
  16001. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16002. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16003. // Main method
  16004. ajax: function( url, options ) {
  16005. // If url is an object, simulate pre-1.5 signature
  16006. if ( typeof url === "object" ) {
  16007. options = url;
  16008. url = undefined;
  16009. }
  16010. // Force options to be an object
  16011. options = options || {};
  16012. var transport,
  16013. // URL without anti-cache param
  16014. cacheURL,
  16015. // Response headers
  16016. responseHeadersString,
  16017. responseHeaders,
  16018. // timeout handle
  16019. timeoutTimer,
  16020. // Url cleanup var
  16021. urlAnchor,
  16022. // Request state (becomes false upon send and true upon completion)
  16023. completed,
  16024. // To know if global events are to be dispatched
  16025. fireGlobals,
  16026. // Loop variable
  16027. i,
  16028. // uncached part of the url
  16029. uncached,
  16030. // Create the final options object
  16031. s = jQuery.ajaxSetup( {}, options ),
  16032. // Callbacks context
  16033. callbackContext = s.context || s,
  16034. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16035. globalEventContext = s.context &&
  16036. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16037. jQuery( callbackContext ) :
  16038. jQuery.event,
  16039. // Deferreds
  16040. deferred = jQuery.Deferred(),
  16041. completeDeferred = jQuery.Callbacks( "once memory" ),
  16042. // Status-dependent callbacks
  16043. statusCode = s.statusCode || {},
  16044. // Headers (they are sent all at once)
  16045. requestHeaders = {},
  16046. requestHeadersNames = {},
  16047. // Default abort message
  16048. strAbort = "canceled",
  16049. // Fake xhr
  16050. jqXHR = {
  16051. readyState: 0,
  16052. // Builds headers hashtable if needed
  16053. getResponseHeader: function( key ) {
  16054. var match;
  16055. if ( completed ) {
  16056. if ( !responseHeaders ) {
  16057. responseHeaders = {};
  16058. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16059. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16060. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16061. .concat( match[ 2 ] );
  16062. }
  16063. }
  16064. match = responseHeaders[ key.toLowerCase() + " " ];
  16065. }
  16066. return match == null ? null : match.join( ", " );
  16067. },
  16068. // Raw string
  16069. getAllResponseHeaders: function() {
  16070. return completed ? responseHeadersString : null;
  16071. },
  16072. // Caches the header
  16073. setRequestHeader: function( name, value ) {
  16074. if ( completed == null ) {
  16075. name = requestHeadersNames[ name.toLowerCase() ] =
  16076. requestHeadersNames[ name.toLowerCase() ] || name;
  16077. requestHeaders[ name ] = value;
  16078. }
  16079. return this;
  16080. },
  16081. // Overrides response content-type header
  16082. overrideMimeType: function( type ) {
  16083. if ( completed == null ) {
  16084. s.mimeType = type;
  16085. }
  16086. return this;
  16087. },
  16088. // Status-dependent callbacks
  16089. statusCode: function( map ) {
  16090. var code;
  16091. if ( map ) {
  16092. if ( completed ) {
  16093. // Execute the appropriate callbacks
  16094. jqXHR.always( map[ jqXHR.status ] );
  16095. } else {
  16096. // Lazy-add the new callbacks in a way that preserves old ones
  16097. for ( code in map ) {
  16098. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16099. }
  16100. }
  16101. }
  16102. return this;
  16103. },
  16104. // Cancel the request
  16105. abort: function( statusText ) {
  16106. var finalText = statusText || strAbort;
  16107. if ( transport ) {
  16108. transport.abort( finalText );
  16109. }
  16110. done( 0, finalText );
  16111. return this;
  16112. }
  16113. };
  16114. // Attach deferreds
  16115. deferred.promise( jqXHR );
  16116. // Add protocol if not provided (prefilters might expect it)
  16117. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16118. // We also use the url parameter if available
  16119. s.url = ( ( url || s.url || location.href ) + "" )
  16120. .replace( rprotocol, location.protocol + "//" );
  16121. // Alias method option to type as per ticket #12004
  16122. s.type = options.method || options.type || s.method || s.type;
  16123. // Extract dataTypes list
  16124. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16125. // A cross-domain request is in order when the origin doesn't match the current origin.
  16126. if ( s.crossDomain == null ) {
  16127. urlAnchor = document.createElement( "a" );
  16128. // Support: IE <=8 - 11, Edge 12 - 15
  16129. // IE throws exception on accessing the href property if url is malformed,
  16130. // e.g. http://example.com:80x/
  16131. try {
  16132. urlAnchor.href = s.url;
  16133. // Support: IE <=8 - 11 only
  16134. // Anchor's host property isn't correctly set when s.url is relative
  16135. urlAnchor.href = urlAnchor.href;
  16136. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16137. urlAnchor.protocol + "//" + urlAnchor.host;
  16138. } catch ( e ) {
  16139. // If there is an error parsing the URL, assume it is crossDomain,
  16140. // it can be rejected by the transport if it is invalid
  16141. s.crossDomain = true;
  16142. }
  16143. }
  16144. // Convert data if not already a string
  16145. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16146. s.data = jQuery.param( s.data, s.traditional );
  16147. }
  16148. // Apply prefilters
  16149. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16150. // If request was aborted inside a prefilter, stop there
  16151. if ( completed ) {
  16152. return jqXHR;
  16153. }
  16154. // We can fire global events as of now if asked to
  16155. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16156. fireGlobals = jQuery.event && s.global;
  16157. // Watch for a new set of requests
  16158. if ( fireGlobals && jQuery.active++ === 0 ) {
  16159. jQuery.event.trigger( "ajaxStart" );
  16160. }
  16161. // Uppercase the type
  16162. s.type = s.type.toUpperCase();
  16163. // Determine if request has content
  16164. s.hasContent = !rnoContent.test( s.type );
  16165. // Save the URL in case we're toying with the If-Modified-Since
  16166. // and/or If-None-Match header later on
  16167. // Remove hash to simplify url manipulation
  16168. cacheURL = s.url.replace( rhash, "" );
  16169. // More options handling for requests with no content
  16170. if ( !s.hasContent ) {
  16171. // Remember the hash so we can put it back
  16172. uncached = s.url.slice( cacheURL.length );
  16173. // If data is available and should be processed, append data to url
  16174. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16175. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16176. // #9682: remove data so that it's not used in an eventual retry
  16177. delete s.data;
  16178. }
  16179. // Add or update anti-cache param if needed
  16180. if ( s.cache === false ) {
  16181. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16182. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16183. }
  16184. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16185. s.url = cacheURL + uncached;
  16186. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16187. } else if ( s.data && s.processData &&
  16188. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16189. s.data = s.data.replace( r20, "+" );
  16190. }
  16191. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16192. if ( s.ifModified ) {
  16193. if ( jQuery.lastModified[ cacheURL ] ) {
  16194. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16195. }
  16196. if ( jQuery.etag[ cacheURL ] ) {
  16197. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16198. }
  16199. }
  16200. // Set the correct header, if data is being sent
  16201. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16202. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16203. }
  16204. // Set the Accepts header for the server, depending on the dataType
  16205. jqXHR.setRequestHeader(
  16206. "Accept",
  16207. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16208. s.accepts[ s.dataTypes[ 0 ] ] +
  16209. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16210. s.accepts[ "*" ]
  16211. );
  16212. // Check for headers option
  16213. for ( i in s.headers ) {
  16214. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16215. }
  16216. // Allow custom headers/mimetypes and early abort
  16217. if ( s.beforeSend &&
  16218. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16219. // Abort if not done already and return
  16220. return jqXHR.abort();
  16221. }
  16222. // Aborting is no longer a cancellation
  16223. strAbort = "abort";
  16224. // Install callbacks on deferreds
  16225. completeDeferred.add( s.complete );
  16226. jqXHR.done( s.success );
  16227. jqXHR.fail( s.error );
  16228. // Get transport
  16229. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16230. // If no transport, we auto-abort
  16231. if ( !transport ) {
  16232. done( -1, "No Transport" );
  16233. } else {
  16234. jqXHR.readyState = 1;
  16235. // Send global event
  16236. if ( fireGlobals ) {
  16237. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16238. }
  16239. // If request was aborted inside ajaxSend, stop there
  16240. if ( completed ) {
  16241. return jqXHR;
  16242. }
  16243. // Timeout
  16244. if ( s.async && s.timeout > 0 ) {
  16245. timeoutTimer = window.setTimeout( function() {
  16246. jqXHR.abort( "timeout" );
  16247. }, s.timeout );
  16248. }
  16249. try {
  16250. completed = false;
  16251. transport.send( requestHeaders, done );
  16252. } catch ( e ) {
  16253. // Rethrow post-completion exceptions
  16254. if ( completed ) {
  16255. throw e;
  16256. }
  16257. // Propagate others as results
  16258. done( -1, e );
  16259. }
  16260. }
  16261. // Callback for when everything is done
  16262. function done( status, nativeStatusText, responses, headers ) {
  16263. var isSuccess, success, error, response, modified,
  16264. statusText = nativeStatusText;
  16265. // Ignore repeat invocations
  16266. if ( completed ) {
  16267. return;
  16268. }
  16269. completed = true;
  16270. // Clear timeout if it exists
  16271. if ( timeoutTimer ) {
  16272. window.clearTimeout( timeoutTimer );
  16273. }
  16274. // Dereference transport for early garbage collection
  16275. // (no matter how long the jqXHR object will be used)
  16276. transport = undefined;
  16277. // Cache response headers
  16278. responseHeadersString = headers || "";
  16279. // Set readyState
  16280. jqXHR.readyState = status > 0 ? 4 : 0;
  16281. // Determine if successful
  16282. isSuccess = status >= 200 && status < 300 || status === 304;
  16283. // Get response data
  16284. if ( responses ) {
  16285. response = ajaxHandleResponses( s, jqXHR, responses );
  16286. }
  16287. // Convert no matter what (that way responseXXX fields are always set)
  16288. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16289. // If successful, handle type chaining
  16290. if ( isSuccess ) {
  16291. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16292. if ( s.ifModified ) {
  16293. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16294. if ( modified ) {
  16295. jQuery.lastModified[ cacheURL ] = modified;
  16296. }
  16297. modified = jqXHR.getResponseHeader( "etag" );
  16298. if ( modified ) {
  16299. jQuery.etag[ cacheURL ] = modified;
  16300. }
  16301. }
  16302. // if no content
  16303. if ( status === 204 || s.type === "HEAD" ) {
  16304. statusText = "nocontent";
  16305. // if not modified
  16306. } else if ( status === 304 ) {
  16307. statusText = "notmodified";
  16308. // If we have data, let's convert it
  16309. } else {
  16310. statusText = response.state;
  16311. success = response.data;
  16312. error = response.error;
  16313. isSuccess = !error;
  16314. }
  16315. } else {
  16316. // Extract error from statusText and normalize for non-aborts
  16317. error = statusText;
  16318. if ( status || !statusText ) {
  16319. statusText = "error";
  16320. if ( status < 0 ) {
  16321. status = 0;
  16322. }
  16323. }
  16324. }
  16325. // Set data for the fake xhr object
  16326. jqXHR.status = status;
  16327. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16328. // Success/Error
  16329. if ( isSuccess ) {
  16330. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16331. } else {
  16332. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16333. }
  16334. // Status-dependent callbacks
  16335. jqXHR.statusCode( statusCode );
  16336. statusCode = undefined;
  16337. if ( fireGlobals ) {
  16338. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16339. [ jqXHR, s, isSuccess ? success : error ] );
  16340. }
  16341. // Complete
  16342. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16343. if ( fireGlobals ) {
  16344. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16345. // Handle the global AJAX counter
  16346. if ( !( --jQuery.active ) ) {
  16347. jQuery.event.trigger( "ajaxStop" );
  16348. }
  16349. }
  16350. }
  16351. return jqXHR;
  16352. },
  16353. getJSON: function( url, data, callback ) {
  16354. return jQuery.get( url, data, callback, "json" );
  16355. },
  16356. getScript: function( url, callback ) {
  16357. return jQuery.get( url, undefined, callback, "script" );
  16358. }
  16359. } );
  16360. jQuery.each( [ "get", "post" ], function( i, method ) {
  16361. jQuery[ method ] = function( url, data, callback, type ) {
  16362. // Shift arguments if data argument was omitted
  16363. if ( isFunction( data ) ) {
  16364. type = type || callback;
  16365. callback = data;
  16366. data = undefined;
  16367. }
  16368. // The url can be an options object (which then must have .url)
  16369. return jQuery.ajax( jQuery.extend( {
  16370. url: url,
  16371. type: method,
  16372. dataType: type,
  16373. data: data,
  16374. success: callback
  16375. }, jQuery.isPlainObject( url ) && url ) );
  16376. };
  16377. } );
  16378. jQuery._evalUrl = function( url, options ) {
  16379. return jQuery.ajax( {
  16380. url: url,
  16381. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16382. type: "GET",
  16383. dataType: "script",
  16384. cache: true,
  16385. async: false,
  16386. global: false,
  16387. // Only evaluate the response if it is successful (gh-4126)
  16388. // dataFilter is not invoked for failure responses, so using it instead
  16389. // of the default converter is kludgy but it works.
  16390. converters: {
  16391. "text script": function() {}
  16392. },
  16393. dataFilter: function( response ) {
  16394. jQuery.globalEval( response, options );
  16395. }
  16396. } );
  16397. };
  16398. jQuery.fn.extend( {
  16399. wrapAll: function( html ) {
  16400. var wrap;
  16401. if ( this[ 0 ] ) {
  16402. if ( isFunction( html ) ) {
  16403. html = html.call( this[ 0 ] );
  16404. }
  16405. // The elements to wrap the target around
  16406. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16407. if ( this[ 0 ].parentNode ) {
  16408. wrap.insertBefore( this[ 0 ] );
  16409. }
  16410. wrap.map( function() {
  16411. var elem = this;
  16412. while ( elem.firstElementChild ) {
  16413. elem = elem.firstElementChild;
  16414. }
  16415. return elem;
  16416. } ).append( this );
  16417. }
  16418. return this;
  16419. },
  16420. wrapInner: function( html ) {
  16421. if ( isFunction( html ) ) {
  16422. return this.each( function( i ) {
  16423. jQuery( this ).wrapInner( html.call( this, i ) );
  16424. } );
  16425. }
  16426. return this.each( function() {
  16427. var self = jQuery( this ),
  16428. contents = self.contents();
  16429. if ( contents.length ) {
  16430. contents.wrapAll( html );
  16431. } else {
  16432. self.append( html );
  16433. }
  16434. } );
  16435. },
  16436. wrap: function( html ) {
  16437. var htmlIsFunction = isFunction( html );
  16438. return this.each( function( i ) {
  16439. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16440. } );
  16441. },
  16442. unwrap: function( selector ) {
  16443. this.parent( selector ).not( "body" ).each( function() {
  16444. jQuery( this ).replaceWith( this.childNodes );
  16445. } );
  16446. return this;
  16447. }
  16448. } );
  16449. jQuery.expr.pseudos.hidden = function( elem ) {
  16450. return !jQuery.expr.pseudos.visible( elem );
  16451. };
  16452. jQuery.expr.pseudos.visible = function( elem ) {
  16453. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16454. };
  16455. jQuery.ajaxSettings.xhr = function() {
  16456. try {
  16457. return new window.XMLHttpRequest();
  16458. } catch ( e ) {}
  16459. };
  16460. var xhrSuccessStatus = {
  16461. // File protocol always yields status code 0, assume 200
  16462. 0: 200,
  16463. // Support: IE <=9 only
  16464. // #1450: sometimes IE returns 1223 when it should be 204
  16465. 1223: 204
  16466. },
  16467. xhrSupported = jQuery.ajaxSettings.xhr();
  16468. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16469. support.ajax = xhrSupported = !!xhrSupported;
  16470. jQuery.ajaxTransport( function( options ) {
  16471. var callback, errorCallback;
  16472. // Cross domain only allowed if supported through XMLHttpRequest
  16473. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16474. return {
  16475. send: function( headers, complete ) {
  16476. var i,
  16477. xhr = options.xhr();
  16478. xhr.open(
  16479. options.type,
  16480. options.url,
  16481. options.async,
  16482. options.username,
  16483. options.password
  16484. );
  16485. // Apply custom fields if provided
  16486. if ( options.xhrFields ) {
  16487. for ( i in options.xhrFields ) {
  16488. xhr[ i ] = options.xhrFields[ i ];
  16489. }
  16490. }
  16491. // Override mime type if needed
  16492. if ( options.mimeType && xhr.overrideMimeType ) {
  16493. xhr.overrideMimeType( options.mimeType );
  16494. }
  16495. // X-Requested-With header
  16496. // For cross-domain requests, seeing as conditions for a preflight are
  16497. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16498. // (it can always be set on a per-request basis or even using ajaxSetup)
  16499. // For same-domain requests, won't change header if already provided.
  16500. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16501. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16502. }
  16503. // Set headers
  16504. for ( i in headers ) {
  16505. xhr.setRequestHeader( i, headers[ i ] );
  16506. }
  16507. // Callback
  16508. callback = function( type ) {
  16509. return function() {
  16510. if ( callback ) {
  16511. callback = errorCallback = xhr.onload =
  16512. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16513. xhr.onreadystatechange = null;
  16514. if ( type === "abort" ) {
  16515. xhr.abort();
  16516. } else if ( type === "error" ) {
  16517. // Support: IE <=9 only
  16518. // On a manual native abort, IE9 throws
  16519. // errors on any property access that is not readyState
  16520. if ( typeof xhr.status !== "number" ) {
  16521. complete( 0, "error" );
  16522. } else {
  16523. complete(
  16524. // File: protocol always yields status 0; see #8605, #14207
  16525. xhr.status,
  16526. xhr.statusText
  16527. );
  16528. }
  16529. } else {
  16530. complete(
  16531. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16532. xhr.statusText,
  16533. // Support: IE <=9 only
  16534. // IE9 has no XHR2 but throws on binary (trac-11426)
  16535. // For XHR2 non-text, let the caller handle it (gh-2498)
  16536. ( xhr.responseType || "text" ) !== "text" ||
  16537. typeof xhr.responseText !== "string" ?
  16538. { binary: xhr.response } :
  16539. { text: xhr.responseText },
  16540. xhr.getAllResponseHeaders()
  16541. );
  16542. }
  16543. }
  16544. };
  16545. };
  16546. // Listen to events
  16547. xhr.onload = callback();
  16548. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16549. // Support: IE 9 only
  16550. // Use onreadystatechange to replace onabort
  16551. // to handle uncaught aborts
  16552. if ( xhr.onabort !== undefined ) {
  16553. xhr.onabort = errorCallback;
  16554. } else {
  16555. xhr.onreadystatechange = function() {
  16556. // Check readyState before timeout as it changes
  16557. if ( xhr.readyState === 4 ) {
  16558. // Allow onerror to be called first,
  16559. // but that will not handle a native abort
  16560. // Also, save errorCallback to a variable
  16561. // as xhr.onerror cannot be accessed
  16562. window.setTimeout( function() {
  16563. if ( callback ) {
  16564. errorCallback();
  16565. }
  16566. } );
  16567. }
  16568. };
  16569. }
  16570. // Create the abort callback
  16571. callback = callback( "abort" );
  16572. try {
  16573. // Do send the request (this may raise an exception)
  16574. xhr.send( options.hasContent && options.data || null );
  16575. } catch ( e ) {
  16576. // #14683: Only rethrow if this hasn't been notified as an error yet
  16577. if ( callback ) {
  16578. throw e;
  16579. }
  16580. }
  16581. },
  16582. abort: function() {
  16583. if ( callback ) {
  16584. callback();
  16585. }
  16586. }
  16587. };
  16588. }
  16589. } );
  16590. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16591. jQuery.ajaxPrefilter( function( s ) {
  16592. if ( s.crossDomain ) {
  16593. s.contents.script = false;
  16594. }
  16595. } );
  16596. // Install script dataType
  16597. jQuery.ajaxSetup( {
  16598. accepts: {
  16599. script: "text/javascript, application/javascript, " +
  16600. "application/ecmascript, application/x-ecmascript"
  16601. },
  16602. contents: {
  16603. script: /\b(?:java|ecma)script\b/
  16604. },
  16605. converters: {
  16606. "text script": function( text ) {
  16607. jQuery.globalEval( text );
  16608. return text;
  16609. }
  16610. }
  16611. } );
  16612. // Handle cache's special case and crossDomain
  16613. jQuery.ajaxPrefilter( "script", function( s ) {
  16614. if ( s.cache === undefined ) {
  16615. s.cache = false;
  16616. }
  16617. if ( s.crossDomain ) {
  16618. s.type = "GET";
  16619. }
  16620. } );
  16621. // Bind script tag hack transport
  16622. jQuery.ajaxTransport( "script", function( s ) {
  16623. // This transport only deals with cross domain or forced-by-attrs requests
  16624. if ( s.crossDomain || s.scriptAttrs ) {
  16625. var script, callback;
  16626. return {
  16627. send: function( _, complete ) {
  16628. script = jQuery( "<script>" )
  16629. .attr( s.scriptAttrs || {} )
  16630. .prop( { charset: s.scriptCharset, src: s.url } )
  16631. .on( "load error", callback = function( evt ) {
  16632. script.remove();
  16633. callback = null;
  16634. if ( evt ) {
  16635. complete( evt.type === "error" ? 404 : 200, evt.type );
  16636. }
  16637. } );
  16638. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16639. document.head.appendChild( script[ 0 ] );
  16640. },
  16641. abort: function() {
  16642. if ( callback ) {
  16643. callback();
  16644. }
  16645. }
  16646. };
  16647. }
  16648. } );
  16649. var oldCallbacks = [],
  16650. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16651. // Default jsonp settings
  16652. jQuery.ajaxSetup( {
  16653. jsonp: "callback",
  16654. jsonpCallback: function() {
  16655. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16656. this[ callback ] = true;
  16657. return callback;
  16658. }
  16659. } );
  16660. // Detect, normalize options and install callbacks for jsonp requests
  16661. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16662. var callbackName, overwritten, responseContainer,
  16663. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16664. "url" :
  16665. typeof s.data === "string" &&
  16666. ( s.contentType || "" )
  16667. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16668. rjsonp.test( s.data ) && "data"
  16669. );
  16670. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16671. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16672. // Get callback name, remembering preexisting value associated with it
  16673. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16674. s.jsonpCallback() :
  16675. s.jsonpCallback;
  16676. // Insert callback into url or form data
  16677. if ( jsonProp ) {
  16678. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16679. } else if ( s.jsonp !== false ) {
  16680. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16681. }
  16682. // Use data converter to retrieve json after script execution
  16683. s.converters[ "script json" ] = function() {
  16684. if ( !responseContainer ) {
  16685. jQuery.error( callbackName + " was not called" );
  16686. }
  16687. return responseContainer[ 0 ];
  16688. };
  16689. // Force json dataType
  16690. s.dataTypes[ 0 ] = "json";
  16691. // Install callback
  16692. overwritten = window[ callbackName ];
  16693. window[ callbackName ] = function() {
  16694. responseContainer = arguments;
  16695. };
  16696. // Clean-up function (fires after converters)
  16697. jqXHR.always( function() {
  16698. // If previous value didn't exist - remove it
  16699. if ( overwritten === undefined ) {
  16700. jQuery( window ).removeProp( callbackName );
  16701. // Otherwise restore preexisting value
  16702. } else {
  16703. window[ callbackName ] = overwritten;
  16704. }
  16705. // Save back as free
  16706. if ( s[ callbackName ] ) {
  16707. // Make sure that re-using the options doesn't screw things around
  16708. s.jsonpCallback = originalSettings.jsonpCallback;
  16709. // Save the callback name for future use
  16710. oldCallbacks.push( callbackName );
  16711. }
  16712. // Call if it was a function and we have a response
  16713. if ( responseContainer && isFunction( overwritten ) ) {
  16714. overwritten( responseContainer[ 0 ] );
  16715. }
  16716. responseContainer = overwritten = undefined;
  16717. } );
  16718. // Delegate to script
  16719. return "script";
  16720. }
  16721. } );
  16722. // Support: Safari 8 only
  16723. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16724. // collapse sibling forms: the second one becomes a child of the first one.
  16725. // Because of that, this security measure has to be disabled in Safari 8.
  16726. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16727. support.createHTMLDocument = ( function() {
  16728. var body = document.implementation.createHTMLDocument( "" ).body;
  16729. body.innerHTML = "<form></form><form></form>";
  16730. return body.childNodes.length === 2;
  16731. } )();
  16732. // Argument "data" should be string of html
  16733. // context (optional): If specified, the fragment will be created in this context,
  16734. // defaults to document
  16735. // keepScripts (optional): If true, will include scripts passed in the html string
  16736. jQuery.parseHTML = function( data, context, keepScripts ) {
  16737. if ( typeof data !== "string" ) {
  16738. return [];
  16739. }
  16740. if ( typeof context === "boolean" ) {
  16741. keepScripts = context;
  16742. context = false;
  16743. }
  16744. var base, parsed, scripts;
  16745. if ( !context ) {
  16746. // Stop scripts or inline event handlers from being executed immediately
  16747. // by using document.implementation
  16748. if ( support.createHTMLDocument ) {
  16749. context = document.implementation.createHTMLDocument( "" );
  16750. // Set the base href for the created document
  16751. // so any parsed elements with URLs
  16752. // are based on the document's URL (gh-2965)
  16753. base = context.createElement( "base" );
  16754. base.href = document.location.href;
  16755. context.head.appendChild( base );
  16756. } else {
  16757. context = document;
  16758. }
  16759. }
  16760. parsed = rsingleTag.exec( data );
  16761. scripts = !keepScripts && [];
  16762. // Single tag
  16763. if ( parsed ) {
  16764. return [ context.createElement( parsed[ 1 ] ) ];
  16765. }
  16766. parsed = buildFragment( [ data ], context, scripts );
  16767. if ( scripts && scripts.length ) {
  16768. jQuery( scripts ).remove();
  16769. }
  16770. return jQuery.merge( [], parsed.childNodes );
  16771. };
  16772. /**
  16773. * Load a url into a page
  16774. */
  16775. jQuery.fn.load = function( url, params, callback ) {
  16776. var selector, type, response,
  16777. self = this,
  16778. off = url.indexOf( " " );
  16779. if ( off > -1 ) {
  16780. selector = stripAndCollapse( url.slice( off ) );
  16781. url = url.slice( 0, off );
  16782. }
  16783. // If it's a function
  16784. if ( isFunction( params ) ) {
  16785. // We assume that it's the callback
  16786. callback = params;
  16787. params = undefined;
  16788. // Otherwise, build a param string
  16789. } else if ( params && typeof params === "object" ) {
  16790. type = "POST";
  16791. }
  16792. // If we have elements to modify, make the request
  16793. if ( self.length > 0 ) {
  16794. jQuery.ajax( {
  16795. url: url,
  16796. // If "type" variable is undefined, then "GET" method will be used.
  16797. // Make value of this field explicit since
  16798. // user can override it through ajaxSetup method
  16799. type: type || "GET",
  16800. dataType: "html",
  16801. data: params
  16802. } ).done( function( responseText ) {
  16803. // Save response for use in complete callback
  16804. response = arguments;
  16805. self.html( selector ?
  16806. // If a selector was specified, locate the right elements in a dummy div
  16807. // Exclude scripts to avoid IE 'Permission Denied' errors
  16808. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16809. // Otherwise use the full result
  16810. responseText );
  16811. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16812. // but they are ignored because response was set above.
  16813. // If it fails, this function gets "jqXHR", "status", "error"
  16814. } ).always( callback && function( jqXHR, status ) {
  16815. self.each( function() {
  16816. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16817. } );
  16818. } );
  16819. }
  16820. return this;
  16821. };
  16822. // Attach a bunch of functions for handling common AJAX events
  16823. jQuery.each( [
  16824. "ajaxStart",
  16825. "ajaxStop",
  16826. "ajaxComplete",
  16827. "ajaxError",
  16828. "ajaxSuccess",
  16829. "ajaxSend"
  16830. ], function( i, type ) {
  16831. jQuery.fn[ type ] = function( fn ) {
  16832. return this.on( type, fn );
  16833. };
  16834. } );
  16835. jQuery.expr.pseudos.animated = function( elem ) {
  16836. return jQuery.grep( jQuery.timers, function( fn ) {
  16837. return elem === fn.elem;
  16838. } ).length;
  16839. };
  16840. jQuery.offset = {
  16841. setOffset: function( elem, options, i ) {
  16842. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16843. position = jQuery.css( elem, "position" ),
  16844. curElem = jQuery( elem ),
  16845. props = {};
  16846. // Set position first, in-case top/left are set even on static elem
  16847. if ( position === "static" ) {
  16848. elem.style.position = "relative";
  16849. }
  16850. curOffset = curElem.offset();
  16851. curCSSTop = jQuery.css( elem, "top" );
  16852. curCSSLeft = jQuery.css( elem, "left" );
  16853. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16854. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16855. // Need to be able to calculate position if either
  16856. // top or left is auto and position is either absolute or fixed
  16857. if ( calculatePosition ) {
  16858. curPosition = curElem.position();
  16859. curTop = curPosition.top;
  16860. curLeft = curPosition.left;
  16861. } else {
  16862. curTop = parseFloat( curCSSTop ) || 0;
  16863. curLeft = parseFloat( curCSSLeft ) || 0;
  16864. }
  16865. if ( isFunction( options ) ) {
  16866. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16867. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16868. }
  16869. if ( options.top != null ) {
  16870. props.top = ( options.top - curOffset.top ) + curTop;
  16871. }
  16872. if ( options.left != null ) {
  16873. props.left = ( options.left - curOffset.left ) + curLeft;
  16874. }
  16875. if ( "using" in options ) {
  16876. options.using.call( elem, props );
  16877. } else {
  16878. curElem.css( props );
  16879. }
  16880. }
  16881. };
  16882. jQuery.fn.extend( {
  16883. // offset() relates an element's border box to the document origin
  16884. offset: function( options ) {
  16885. // Preserve chaining for setter
  16886. if ( arguments.length ) {
  16887. return options === undefined ?
  16888. this :
  16889. this.each( function( i ) {
  16890. jQuery.offset.setOffset( this, options, i );
  16891. } );
  16892. }
  16893. var rect, win,
  16894. elem = this[ 0 ];
  16895. if ( !elem ) {
  16896. return;
  16897. }
  16898. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16899. // Support: IE <=11 only
  16900. // Running getBoundingClientRect on a
  16901. // disconnected node in IE throws an error
  16902. if ( !elem.getClientRects().length ) {
  16903. return { top: 0, left: 0 };
  16904. }
  16905. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  16906. rect = elem.getBoundingClientRect();
  16907. win = elem.ownerDocument.defaultView;
  16908. return {
  16909. top: rect.top + win.pageYOffset,
  16910. left: rect.left + win.pageXOffset
  16911. };
  16912. },
  16913. // position() relates an element's margin box to its offset parent's padding box
  16914. // This corresponds to the behavior of CSS absolute positioning
  16915. position: function() {
  16916. if ( !this[ 0 ] ) {
  16917. return;
  16918. }
  16919. var offsetParent, offset, doc,
  16920. elem = this[ 0 ],
  16921. parentOffset = { top: 0, left: 0 };
  16922. // position:fixed elements are offset from the viewport, which itself always has zero offset
  16923. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  16924. // Assume position:fixed implies availability of getBoundingClientRect
  16925. offset = elem.getBoundingClientRect();
  16926. } else {
  16927. offset = this.offset();
  16928. // Account for the *real* offset parent, which can be the document or its root element
  16929. // when a statically positioned element is identified
  16930. doc = elem.ownerDocument;
  16931. offsetParent = elem.offsetParent || doc.documentElement;
  16932. while ( offsetParent &&
  16933. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  16934. jQuery.css( offsetParent, "position" ) === "static" ) {
  16935. offsetParent = offsetParent.parentNode;
  16936. }
  16937. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  16938. // Incorporate borders into its offset, since they are outside its content origin
  16939. parentOffset = jQuery( offsetParent ).offset();
  16940. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  16941. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  16942. }
  16943. }
  16944. // Subtract parent offsets and element margins
  16945. return {
  16946. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  16947. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  16948. };
  16949. },
  16950. // This method will return documentElement in the following cases:
  16951. // 1) For the element inside the iframe without offsetParent, this method will return
  16952. // documentElement of the parent window
  16953. // 2) For the hidden or detached element
  16954. // 3) For body or html element, i.e. in case of the html node - it will return itself
  16955. //
  16956. // but those exceptions were never presented as a real life use-cases
  16957. // and might be considered as more preferable results.
  16958. //
  16959. // This logic, however, is not guaranteed and can change at any point in the future
  16960. offsetParent: function() {
  16961. return this.map( function() {
  16962. var offsetParent = this.offsetParent;
  16963. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  16964. offsetParent = offsetParent.offsetParent;
  16965. }
  16966. return offsetParent || documentElement;
  16967. } );
  16968. }
  16969. } );
  16970. // Create scrollLeft and scrollTop methods
  16971. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  16972. var top = "pageYOffset" === prop;
  16973. jQuery.fn[ method ] = function( val ) {
  16974. return access( this, function( elem, method, val ) {
  16975. // Coalesce documents and windows
  16976. var win;
  16977. if ( isWindow( elem ) ) {
  16978. win = elem;
  16979. } else if ( elem.nodeType === 9 ) {
  16980. win = elem.defaultView;
  16981. }
  16982. if ( val === undefined ) {
  16983. return win ? win[ prop ] : elem[ method ];
  16984. }
  16985. if ( win ) {
  16986. win.scrollTo(
  16987. !top ? val : win.pageXOffset,
  16988. top ? val : win.pageYOffset
  16989. );
  16990. } else {
  16991. elem[ method ] = val;
  16992. }
  16993. }, method, val, arguments.length );
  16994. };
  16995. } );
  16996. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  16997. // Add the top/left cssHooks using jQuery.fn.position
  16998. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  16999. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17000. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17001. // rather than make the css module depend on the offset module, just check for it here
  17002. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17003. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17004. function( elem, computed ) {
  17005. if ( computed ) {
  17006. computed = curCSS( elem, prop );
  17007. // If curCSS returns percentage, fallback to offset
  17008. return rnumnonpx.test( computed ) ?
  17009. jQuery( elem ).position()[ prop ] + "px" :
  17010. computed;
  17011. }
  17012. }
  17013. );
  17014. } );
  17015. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17016. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17017. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17018. function( defaultExtra, funcName ) {
  17019. // Margin is only for outerHeight, outerWidth
  17020. jQuery.fn[ funcName ] = function( margin, value ) {
  17021. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17022. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17023. return access( this, function( elem, type, value ) {
  17024. var doc;
  17025. if ( isWindow( elem ) ) {
  17026. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17027. return funcName.indexOf( "outer" ) === 0 ?
  17028. elem[ "inner" + name ] :
  17029. elem.document.documentElement[ "client" + name ];
  17030. }
  17031. // Get document width or height
  17032. if ( elem.nodeType === 9 ) {
  17033. doc = elem.documentElement;
  17034. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17035. // whichever is greatest
  17036. return Math.max(
  17037. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17038. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17039. doc[ "client" + name ]
  17040. );
  17041. }
  17042. return value === undefined ?
  17043. // Get width or height on the element, requesting but not forcing parseFloat
  17044. jQuery.css( elem, type, extra ) :
  17045. // Set width or height on the element
  17046. jQuery.style( elem, type, value, extra );
  17047. }, type, chainable ? margin : undefined, chainable );
  17048. };
  17049. } );
  17050. } );
  17051. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17052. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17053. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17054. function( i, name ) {
  17055. // Handle event binding
  17056. jQuery.fn[ name ] = function( data, fn ) {
  17057. return arguments.length > 0 ?
  17058. this.on( name, null, data, fn ) :
  17059. this.trigger( name );
  17060. };
  17061. } );
  17062. jQuery.fn.extend( {
  17063. hover: function( fnOver, fnOut ) {
  17064. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17065. }
  17066. } );
  17067. jQuery.fn.extend( {
  17068. bind: function( types, data, fn ) {
  17069. return this.on( types, null, data, fn );
  17070. },
  17071. unbind: function( types, fn ) {
  17072. return this.off( types, null, fn );
  17073. },
  17074. delegate: function( selector, types, data, fn ) {
  17075. return this.on( types, selector, data, fn );
  17076. },
  17077. undelegate: function( selector, types, fn ) {
  17078. // ( namespace ) or ( selector, types [, fn] )
  17079. return arguments.length === 1 ?
  17080. this.off( selector, "**" ) :
  17081. this.off( types, selector || "**", fn );
  17082. }
  17083. } );
  17084. // Bind a function to a context, optionally partially applying any
  17085. // arguments.
  17086. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17087. // However, it is not slated for removal any time soon
  17088. jQuery.proxy = function( fn, context ) {
  17089. var tmp, args, proxy;
  17090. if ( typeof context === "string" ) {
  17091. tmp = fn[ context ];
  17092. context = fn;
  17093. fn = tmp;
  17094. }
  17095. // Quick check to determine if target is callable, in the spec
  17096. // this throws a TypeError, but we will just return undefined.
  17097. if ( !isFunction( fn ) ) {
  17098. return undefined;
  17099. }
  17100. // Simulated bind
  17101. args = slice.call( arguments, 2 );
  17102. proxy = function() {
  17103. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17104. };
  17105. // Set the guid of unique handler to the same of original handler, so it can be removed
  17106. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17107. return proxy;
  17108. };
  17109. jQuery.holdReady = function( hold ) {
  17110. if ( hold ) {
  17111. jQuery.readyWait++;
  17112. } else {
  17113. jQuery.ready( true );
  17114. }
  17115. };
  17116. jQuery.isArray = Array.isArray;
  17117. jQuery.parseJSON = JSON.parse;
  17118. jQuery.nodeName = nodeName;
  17119. jQuery.isFunction = isFunction;
  17120. jQuery.isWindow = isWindow;
  17121. jQuery.camelCase = camelCase;
  17122. jQuery.type = toType;
  17123. jQuery.now = Date.now;
  17124. jQuery.isNumeric = function( obj ) {
  17125. // As of jQuery 3.0, isNumeric is limited to
  17126. // strings and numbers (primitives or objects)
  17127. // that can be coerced to finite numbers (gh-2662)
  17128. var type = jQuery.type( obj );
  17129. return ( type === "number" || type === "string" ) &&
  17130. // parseFloat NaNs numeric-cast false positives ("")
  17131. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17132. // subtraction forces infinities to NaN
  17133. !isNaN( obj - parseFloat( obj ) );
  17134. };
  17135. // Register as a named AMD module, since jQuery can be concatenated with other
  17136. // files that may use define, but not via a proper concatenation script that
  17137. // understands anonymous AMD modules. A named AMD is safest and most robust
  17138. // way to register. Lowercase jquery is used because AMD module names are
  17139. // derived from file names, and jQuery is normally delivered in a lowercase
  17140. // file name. Do this after creating the global so that if an AMD module wants
  17141. // to call noConflict to hide this version of jQuery, it will work.
  17142. // Note that for maximum portability, libraries that are not jQuery should
  17143. // declare themselves as anonymous modules, and avoid setting a global if an
  17144. // AMD loader is present. jQuery is a special case. For more information, see
  17145. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17146. if ( true ) {
  17147. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17148. return jQuery;
  17149. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17150. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17151. }
  17152. var
  17153. // Map over jQuery in case of overwrite
  17154. _jQuery = window.jQuery,
  17155. // Map over the $ in case of overwrite
  17156. _$ = window.$;
  17157. jQuery.noConflict = function( deep ) {
  17158. if ( window.$ === jQuery ) {
  17159. window.$ = _$;
  17160. }
  17161. if ( deep && window.jQuery === jQuery ) {
  17162. window.jQuery = _jQuery;
  17163. }
  17164. return jQuery;
  17165. };
  17166. // Expose jQuery and $ identifiers, even in AMD
  17167. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17168. // and CommonJS for browser emulators (#13566)
  17169. if ( !noGlobal ) {
  17170. window.jQuery = window.$ = jQuery;
  17171. }
  17172. return jQuery;
  17173. } );
  17174. /***/ }),
  17175. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17176. /*!************************************************!*\
  17177. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17178. \************************************************/
  17179. /*! exports provided: default */
  17180. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17181. "use strict";
  17182. __webpack_require__.r(__webpack_exports__);
  17183. var classCallCheck = function (instance, Constructor) {
  17184. if (!(instance instanceof Constructor)) {
  17185. throw new TypeError("Cannot call a class as a function");
  17186. }
  17187. };
  17188. var createClass = function () {
  17189. function defineProperties(target, props) {
  17190. for (var i = 0; i < props.length; i++) {
  17191. var descriptor = props[i];
  17192. descriptor.enumerable = descriptor.enumerable || false;
  17193. descriptor.configurable = true;
  17194. if ("value" in descriptor) descriptor.writable = true;
  17195. Object.defineProperty(target, descriptor.key, descriptor);
  17196. }
  17197. }
  17198. return function (Constructor, protoProps, staticProps) {
  17199. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17200. if (staticProps) defineProperties(Constructor, staticProps);
  17201. return Constructor;
  17202. };
  17203. }();
  17204. var _extends = Object.assign || function (target) {
  17205. for (var i = 1; i < arguments.length; i++) {
  17206. var source = arguments[i];
  17207. for (var key in source) {
  17208. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17209. target[key] = source[key];
  17210. }
  17211. }
  17212. }
  17213. return target;
  17214. };
  17215. var inherits = function (subClass, superClass) {
  17216. if (typeof superClass !== "function" && superClass !== null) {
  17217. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17218. }
  17219. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17220. constructor: {
  17221. value: subClass,
  17222. enumerable: false,
  17223. writable: true,
  17224. configurable: true
  17225. }
  17226. });
  17227. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17228. };
  17229. var possibleConstructorReturn = function (self, call) {
  17230. if (!self) {
  17231. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17232. }
  17233. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17234. };
  17235. var Connector = function () {
  17236. /**
  17237. * Create a new class instance.
  17238. */
  17239. function Connector(options) {
  17240. classCallCheck(this, Connector);
  17241. /**
  17242. * Default connector options.
  17243. */
  17244. this._defaultOptions = {
  17245. auth: {
  17246. headers: {}
  17247. },
  17248. authEndpoint: '/broadcasting/auth',
  17249. broadcaster: 'pusher',
  17250. csrfToken: null,
  17251. host: null,
  17252. key: null,
  17253. namespace: 'App.Events'
  17254. };
  17255. this.setOptions(options);
  17256. this.connect();
  17257. }
  17258. /**
  17259. * Merge the custom options with the defaults.
  17260. */
  17261. createClass(Connector, [{
  17262. key: 'setOptions',
  17263. value: function setOptions(options) {
  17264. this.options = _extends(this._defaultOptions, options);
  17265. if (this.csrfToken()) {
  17266. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17267. }
  17268. return options;
  17269. }
  17270. /**
  17271. * Extract the CSRF token from the page.
  17272. */
  17273. }, {
  17274. key: 'csrfToken',
  17275. value: function csrfToken() {
  17276. var selector = void 0;
  17277. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17278. return window['Laravel'].csrfToken;
  17279. } else if (this.options.csrfToken) {
  17280. return this.options.csrfToken;
  17281. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17282. return selector.getAttribute('content');
  17283. }
  17284. return null;
  17285. }
  17286. }]);
  17287. return Connector;
  17288. }();
  17289. /**
  17290. * This class represents a basic channel.
  17291. */
  17292. var Channel = function () {
  17293. function Channel() {
  17294. classCallCheck(this, Channel);
  17295. }
  17296. createClass(Channel, [{
  17297. key: 'listenForWhisper',
  17298. /**
  17299. * Listen for a whisper event on the channel instance.
  17300. */
  17301. value: function listenForWhisper(event, callback) {
  17302. return this.listen('.client-' + event, callback);
  17303. }
  17304. /**
  17305. * Listen for an event on the channel instance.
  17306. */
  17307. }, {
  17308. key: 'notification',
  17309. value: function notification(callback) {
  17310. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17311. }
  17312. /**
  17313. * Stop listening for a whispser event on the channel instance.
  17314. */
  17315. }, {
  17316. key: 'stopListeningForWhisper',
  17317. value: function stopListeningForWhisper(event) {
  17318. return this.stopListening('.client-' + event);
  17319. }
  17320. }]);
  17321. return Channel;
  17322. }();
  17323. /**
  17324. * Event name formatter
  17325. */
  17326. var EventFormatter = function () {
  17327. /**
  17328. * Create a new class instance.
  17329. */
  17330. function EventFormatter(namespace) {
  17331. classCallCheck(this, EventFormatter);
  17332. this.setNamespace(namespace);
  17333. }
  17334. /**
  17335. * Format the given event name.
  17336. */
  17337. createClass(EventFormatter, [{
  17338. key: 'format',
  17339. value: function format(event) {
  17340. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17341. return event.substr(1);
  17342. } else if (this.namespace) {
  17343. event = this.namespace + '.' + event;
  17344. }
  17345. return event.replace(/\./g, '\\');
  17346. }
  17347. /**
  17348. * Set the event namespace.
  17349. */
  17350. }, {
  17351. key: 'setNamespace',
  17352. value: function setNamespace(value) {
  17353. this.namespace = value;
  17354. }
  17355. }]);
  17356. return EventFormatter;
  17357. }();
  17358. /**
  17359. * This class represents a Pusher channel.
  17360. */
  17361. var PusherChannel = function (_Channel) {
  17362. inherits(PusherChannel, _Channel);
  17363. /**
  17364. * Create a new class instance.
  17365. */
  17366. function PusherChannel(pusher, name, options) {
  17367. classCallCheck(this, PusherChannel);
  17368. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17369. _this.name = name;
  17370. _this.pusher = pusher;
  17371. _this.options = options;
  17372. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17373. _this.subscribe();
  17374. return _this;
  17375. }
  17376. /**
  17377. * Subscribe to a Pusher channel.
  17378. */
  17379. createClass(PusherChannel, [{
  17380. key: 'subscribe',
  17381. value: function subscribe() {
  17382. this.subscription = this.pusher.subscribe(this.name);
  17383. }
  17384. /**
  17385. * Unsubscribe from a Pusher channel.
  17386. */
  17387. }, {
  17388. key: 'unsubscribe',
  17389. value: function unsubscribe() {
  17390. this.pusher.unsubscribe(this.name);
  17391. }
  17392. /**
  17393. * Listen for an event on the channel instance.
  17394. */
  17395. }, {
  17396. key: 'listen',
  17397. value: function listen(event, callback) {
  17398. this.on(this.eventFormatter.format(event), callback);
  17399. return this;
  17400. }
  17401. /**
  17402. * Stop listening for an event on the channel instance.
  17403. */
  17404. }, {
  17405. key: 'stopListening',
  17406. value: function stopListening(event) {
  17407. this.subscription.unbind(this.eventFormatter.format(event));
  17408. return this;
  17409. }
  17410. /**
  17411. * Bind a channel to an event.
  17412. */
  17413. }, {
  17414. key: 'on',
  17415. value: function on(event, callback) {
  17416. this.subscription.bind(event, callback);
  17417. return this;
  17418. }
  17419. }]);
  17420. return PusherChannel;
  17421. }(Channel);
  17422. /**
  17423. * This class represents a Pusher private channel.
  17424. */
  17425. var PusherPrivateChannel = function (_PusherChannel) {
  17426. inherits(PusherPrivateChannel, _PusherChannel);
  17427. function PusherPrivateChannel() {
  17428. classCallCheck(this, PusherPrivateChannel);
  17429. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17430. }
  17431. createClass(PusherPrivateChannel, [{
  17432. key: 'whisper',
  17433. /**
  17434. * Trigger client event on the channel.
  17435. */
  17436. value: function whisper(eventName, data) {
  17437. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17438. return this;
  17439. }
  17440. }]);
  17441. return PusherPrivateChannel;
  17442. }(PusherChannel);
  17443. /**
  17444. * This class represents a Pusher presence channel.
  17445. */
  17446. var PusherPresenceChannel = function (_PusherChannel) {
  17447. inherits(PusherPresenceChannel, _PusherChannel);
  17448. function PusherPresenceChannel() {
  17449. classCallCheck(this, PusherPresenceChannel);
  17450. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17451. }
  17452. createClass(PusherPresenceChannel, [{
  17453. key: 'here',
  17454. /**
  17455. * Register a callback to be called anytime the member list changes.
  17456. */
  17457. value: function here(callback) {
  17458. this.on('pusher:subscription_succeeded', function (data) {
  17459. callback(Object.keys(data.members).map(function (k) {
  17460. return data.members[k];
  17461. }));
  17462. });
  17463. return this;
  17464. }
  17465. /**
  17466. * Listen for someone joining the channel.
  17467. */
  17468. }, {
  17469. key: 'joining',
  17470. value: function joining(callback) {
  17471. this.on('pusher:member_added', function (member) {
  17472. callback(member.info);
  17473. });
  17474. return this;
  17475. }
  17476. /**
  17477. * Listen for someone leaving the channel.
  17478. */
  17479. }, {
  17480. key: 'leaving',
  17481. value: function leaving(callback) {
  17482. this.on('pusher:member_removed', function (member) {
  17483. callback(member.info);
  17484. });
  17485. return this;
  17486. }
  17487. /**
  17488. * Trigger client event on the channel.
  17489. */
  17490. }, {
  17491. key: 'whisper',
  17492. value: function whisper(eventName, data) {
  17493. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17494. return this;
  17495. }
  17496. }]);
  17497. return PusherPresenceChannel;
  17498. }(PusherChannel);
  17499. /**
  17500. * This class represents a Socket.io channel.
  17501. */
  17502. var SocketIoChannel = function (_Channel) {
  17503. inherits(SocketIoChannel, _Channel);
  17504. /**
  17505. * Create a new class instance.
  17506. */
  17507. function SocketIoChannel(socket, name, options) {
  17508. classCallCheck(this, SocketIoChannel);
  17509. /**
  17510. * The event callbacks applied to the channel.
  17511. */
  17512. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17513. _this.events = {};
  17514. _this.name = name;
  17515. _this.socket = socket;
  17516. _this.options = options;
  17517. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17518. _this.subscribe();
  17519. _this.configureReconnector();
  17520. return _this;
  17521. }
  17522. /**
  17523. * Subscribe to a Socket.io channel.
  17524. */
  17525. createClass(SocketIoChannel, [{
  17526. key: 'subscribe',
  17527. value: function subscribe() {
  17528. this.socket.emit('subscribe', {
  17529. channel: this.name,
  17530. auth: this.options.auth || {}
  17531. });
  17532. }
  17533. /**
  17534. * Unsubscribe from channel and ubind event callbacks.
  17535. */
  17536. }, {
  17537. key: 'unsubscribe',
  17538. value: function unsubscribe() {
  17539. this.unbind();
  17540. this.socket.emit('unsubscribe', {
  17541. channel: this.name,
  17542. auth: this.options.auth || {}
  17543. });
  17544. }
  17545. /**
  17546. * Listen for an event on the channel instance.
  17547. */
  17548. }, {
  17549. key: 'listen',
  17550. value: function listen(event, callback) {
  17551. this.on(this.eventFormatter.format(event), callback);
  17552. return this;
  17553. }
  17554. /**
  17555. * Stop listening for an event on the channel instance.
  17556. */
  17557. }, {
  17558. key: 'stopListening',
  17559. value: function stopListening(event) {
  17560. var name = this.eventFormatter.format(event);
  17561. this.socket.removeListener(name);
  17562. delete this.events[name];
  17563. return this;
  17564. }
  17565. /**
  17566. * Bind the channel's socket to an event and store the callback.
  17567. */
  17568. }, {
  17569. key: 'on',
  17570. value: function on(event, callback) {
  17571. var _this2 = this;
  17572. var listener = function listener(channel, data) {
  17573. if (_this2.name == channel) {
  17574. callback(data);
  17575. }
  17576. };
  17577. this.socket.on(event, listener);
  17578. this.bind(event, listener);
  17579. }
  17580. /**
  17581. * Attach a 'reconnect' listener and bind the event.
  17582. */
  17583. }, {
  17584. key: 'configureReconnector',
  17585. value: function configureReconnector() {
  17586. var _this3 = this;
  17587. var listener = function listener() {
  17588. _this3.subscribe();
  17589. };
  17590. this.socket.on('reconnect', listener);
  17591. this.bind('reconnect', listener);
  17592. }
  17593. /**
  17594. * Bind the channel's socket to an event and store the callback.
  17595. */
  17596. }, {
  17597. key: 'bind',
  17598. value: function bind(event, callback) {
  17599. this.events[event] = this.events[event] || [];
  17600. this.events[event].push(callback);
  17601. }
  17602. /**
  17603. * Unbind the channel's socket from all stored event callbacks.
  17604. */
  17605. }, {
  17606. key: 'unbind',
  17607. value: function unbind() {
  17608. var _this4 = this;
  17609. Object.keys(this.events).forEach(function (event) {
  17610. _this4.events[event].forEach(function (callback) {
  17611. _this4.socket.removeListener(event, callback);
  17612. });
  17613. delete _this4.events[event];
  17614. });
  17615. }
  17616. }]);
  17617. return SocketIoChannel;
  17618. }(Channel);
  17619. /**
  17620. * This class represents a Socket.io presence channel.
  17621. */
  17622. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17623. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17624. function SocketIoPrivateChannel() {
  17625. classCallCheck(this, SocketIoPrivateChannel);
  17626. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17627. }
  17628. createClass(SocketIoPrivateChannel, [{
  17629. key: 'whisper',
  17630. /**
  17631. * Trigger client event on the channel.
  17632. */
  17633. value: function whisper(eventName, data) {
  17634. this.socket.emit('client event', {
  17635. channel: this.name,
  17636. event: 'client-' + eventName,
  17637. data: data
  17638. });
  17639. return this;
  17640. }
  17641. }]);
  17642. return SocketIoPrivateChannel;
  17643. }(SocketIoChannel);
  17644. /**
  17645. * This class represents a Socket.io presence channel.
  17646. */
  17647. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17648. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17649. function SocketIoPresenceChannel() {
  17650. classCallCheck(this, SocketIoPresenceChannel);
  17651. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17652. }
  17653. createClass(SocketIoPresenceChannel, [{
  17654. key: 'here',
  17655. /**
  17656. * Register a callback to be called anytime the member list changes.
  17657. */
  17658. value: function here(callback) {
  17659. this.on('presence:subscribed', function (members) {
  17660. callback(members.map(function (m) {
  17661. return m.user_info;
  17662. }));
  17663. });
  17664. return this;
  17665. }
  17666. /**
  17667. * Listen for someone joining the channel.
  17668. */
  17669. }, {
  17670. key: 'joining',
  17671. value: function joining(callback) {
  17672. this.on('presence:joining', function (member) {
  17673. return callback(member.user_info);
  17674. });
  17675. return this;
  17676. }
  17677. /**
  17678. * Listen for someone leaving the channel.
  17679. */
  17680. }, {
  17681. key: 'leaving',
  17682. value: function leaving(callback) {
  17683. this.on('presence:leaving', function (member) {
  17684. return callback(member.user_info);
  17685. });
  17686. return this;
  17687. }
  17688. }]);
  17689. return SocketIoPresenceChannel;
  17690. }(SocketIoPrivateChannel);
  17691. /**
  17692. * This class represents a null channel.
  17693. */
  17694. var NullChannel = function (_Channel) {
  17695. inherits(NullChannel, _Channel);
  17696. function NullChannel() {
  17697. classCallCheck(this, NullChannel);
  17698. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17699. }
  17700. createClass(NullChannel, [{
  17701. key: 'subscribe',
  17702. /**
  17703. * Subscribe to a channel.
  17704. */
  17705. value: function subscribe() {}
  17706. //
  17707. /**
  17708. * Unsubscribe from a channel.
  17709. */
  17710. }, {
  17711. key: 'unsubscribe',
  17712. value: function unsubscribe() {}
  17713. //
  17714. /**
  17715. * Listen for an event on the channel instance.
  17716. */
  17717. }, {
  17718. key: 'listen',
  17719. value: function listen(event, callback) {
  17720. return this;
  17721. }
  17722. /**
  17723. * Stop listening for an event on the channel instance.
  17724. */
  17725. }, {
  17726. key: 'stopListening',
  17727. value: function stopListening(event) {
  17728. return this;
  17729. }
  17730. /**
  17731. * Bind a channel to an event.
  17732. */
  17733. }, {
  17734. key: 'on',
  17735. value: function on(event, callback) {
  17736. return this;
  17737. }
  17738. }]);
  17739. return NullChannel;
  17740. }(Channel);
  17741. /**
  17742. * This class represents a null private channel.
  17743. */
  17744. var NullPrivateChannel = function (_NullChannel) {
  17745. inherits(NullPrivateChannel, _NullChannel);
  17746. function NullPrivateChannel() {
  17747. classCallCheck(this, NullPrivateChannel);
  17748. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17749. }
  17750. createClass(NullPrivateChannel, [{
  17751. key: 'whisper',
  17752. /**
  17753. * Trigger client event on the channel.
  17754. */
  17755. value: function whisper(eventName, data) {
  17756. return this;
  17757. }
  17758. }]);
  17759. return NullPrivateChannel;
  17760. }(NullChannel);
  17761. /**
  17762. * This class represents a null presence channel.
  17763. */
  17764. var NullPresenceChannel = function (_NullChannel) {
  17765. inherits(NullPresenceChannel, _NullChannel);
  17766. function NullPresenceChannel() {
  17767. classCallCheck(this, NullPresenceChannel);
  17768. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17769. }
  17770. createClass(NullPresenceChannel, [{
  17771. key: 'here',
  17772. /**
  17773. * Register a callback to be called anytime the member list changes.
  17774. */
  17775. value: function here(callback) {
  17776. return this;
  17777. }
  17778. /**
  17779. * Listen for someone joining the channel.
  17780. */
  17781. }, {
  17782. key: 'joining',
  17783. value: function joining(callback) {
  17784. return this;
  17785. }
  17786. /**
  17787. * Listen for someone leaving the channel.
  17788. */
  17789. }, {
  17790. key: 'leaving',
  17791. value: function leaving(callback) {
  17792. return this;
  17793. }
  17794. /**
  17795. * Trigger client event on the channel.
  17796. */
  17797. }, {
  17798. key: 'whisper',
  17799. value: function whisper(eventName, data) {
  17800. return this;
  17801. }
  17802. }]);
  17803. return NullPresenceChannel;
  17804. }(NullChannel);
  17805. /**
  17806. * This class creates a connector to Pusher.
  17807. */
  17808. var PusherConnector = function (_Connector) {
  17809. inherits(PusherConnector, _Connector);
  17810. function PusherConnector() {
  17811. classCallCheck(this, PusherConnector);
  17812. /**
  17813. * All of the subscribed channel names.
  17814. */
  17815. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17816. _this.channels = {};
  17817. return _this;
  17818. }
  17819. /**
  17820. * Create a fresh Pusher connection.
  17821. */
  17822. createClass(PusherConnector, [{
  17823. key: 'connect',
  17824. value: function connect() {
  17825. if (typeof this.options.client !== 'undefined') {
  17826. this.pusher = this.options.client;
  17827. } else {
  17828. this.pusher = new Pusher(this.options.key, this.options);
  17829. }
  17830. }
  17831. /**
  17832. * Listen for an event on a channel instance.
  17833. */
  17834. }, {
  17835. key: 'listen',
  17836. value: function listen(name, event, callback) {
  17837. return this.channel(name).listen(event, callback);
  17838. }
  17839. /**
  17840. * Get a channel instance by name.
  17841. */
  17842. }, {
  17843. key: 'channel',
  17844. value: function channel(name) {
  17845. if (!this.channels[name]) {
  17846. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17847. }
  17848. return this.channels[name];
  17849. }
  17850. /**
  17851. * Get a private channel instance by name.
  17852. */
  17853. }, {
  17854. key: 'privateChannel',
  17855. value: function privateChannel(name) {
  17856. if (!this.channels['private-' + name]) {
  17857. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17858. }
  17859. return this.channels['private-' + name];
  17860. }
  17861. /**
  17862. * Get a presence channel instance by name.
  17863. */
  17864. }, {
  17865. key: 'presenceChannel',
  17866. value: function presenceChannel(name) {
  17867. if (!this.channels['presence-' + name]) {
  17868. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17869. }
  17870. return this.channels['presence-' + name];
  17871. }
  17872. /**
  17873. * Leave the given channel, as well as its private and presence variants.
  17874. */
  17875. }, {
  17876. key: 'leave',
  17877. value: function leave(name) {
  17878. var _this2 = this;
  17879. var channels = [name, 'private-' + name, 'presence-' + name];
  17880. channels.forEach(function (name, index) {
  17881. _this2.leaveChannel(name);
  17882. });
  17883. }
  17884. /**
  17885. * Leave the given channel.
  17886. */
  17887. }, {
  17888. key: 'leaveChannel',
  17889. value: function leaveChannel(name) {
  17890. if (this.channels[name]) {
  17891. this.channels[name].unsubscribe();
  17892. delete this.channels[name];
  17893. }
  17894. }
  17895. /**
  17896. * Get the socket ID for the connection.
  17897. */
  17898. }, {
  17899. key: 'socketId',
  17900. value: function socketId() {
  17901. return this.pusher.connection.socket_id;
  17902. }
  17903. /**
  17904. * Disconnect Pusher connection.
  17905. */
  17906. }, {
  17907. key: 'disconnect',
  17908. value: function disconnect() {
  17909. this.pusher.disconnect();
  17910. }
  17911. }]);
  17912. return PusherConnector;
  17913. }(Connector);
  17914. /**
  17915. * This class creates a connnector to a Socket.io server.
  17916. */
  17917. var SocketIoConnector = function (_Connector) {
  17918. inherits(SocketIoConnector, _Connector);
  17919. function SocketIoConnector() {
  17920. classCallCheck(this, SocketIoConnector);
  17921. /**
  17922. * All of the subscribed channel names.
  17923. */
  17924. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  17925. _this.channels = {};
  17926. return _this;
  17927. }
  17928. /**
  17929. * Create a fresh Socket.io connection.
  17930. */
  17931. createClass(SocketIoConnector, [{
  17932. key: 'connect',
  17933. value: function connect() {
  17934. var io = this.getSocketIO();
  17935. this.socket = io(this.options.host, this.options);
  17936. return this.socket;
  17937. }
  17938. /**
  17939. * Get socket.io module from global scope or options.
  17940. */
  17941. }, {
  17942. key: 'getSocketIO',
  17943. value: function getSocketIO() {
  17944. if (typeof this.options.client !== 'undefined') {
  17945. return this.options.client;
  17946. }
  17947. if (typeof io !== 'undefined') {
  17948. return io;
  17949. }
  17950. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  17951. }
  17952. /**
  17953. * Listen for an event on a channel instance.
  17954. */
  17955. }, {
  17956. key: 'listen',
  17957. value: function listen(name, event, callback) {
  17958. return this.channel(name).listen(event, callback);
  17959. }
  17960. /**
  17961. * Get a channel instance by name.
  17962. */
  17963. }, {
  17964. key: 'channel',
  17965. value: function channel(name) {
  17966. if (!this.channels[name]) {
  17967. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  17968. }
  17969. return this.channels[name];
  17970. }
  17971. /**
  17972. * Get a private channel instance by name.
  17973. */
  17974. }, {
  17975. key: 'privateChannel',
  17976. value: function privateChannel(name) {
  17977. if (!this.channels['private-' + name]) {
  17978. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  17979. }
  17980. return this.channels['private-' + name];
  17981. }
  17982. /**
  17983. * Get a presence channel instance by name.
  17984. */
  17985. }, {
  17986. key: 'presenceChannel',
  17987. value: function presenceChannel(name) {
  17988. if (!this.channels['presence-' + name]) {
  17989. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  17990. }
  17991. return this.channels['presence-' + name];
  17992. }
  17993. /**
  17994. * Leave the given channel, as well as its private and presence variants.
  17995. */
  17996. }, {
  17997. key: 'leave',
  17998. value: function leave(name) {
  17999. var _this2 = this;
  18000. var channels = [name, 'private-' + name, 'presence-' + name];
  18001. channels.forEach(function (name) {
  18002. _this2.leaveChannel(name);
  18003. });
  18004. }
  18005. /**
  18006. * Leave the given channel.
  18007. */
  18008. }, {
  18009. key: 'leaveChannel',
  18010. value: function leaveChannel(name) {
  18011. if (this.channels[name]) {
  18012. this.channels[name].unsubscribe();
  18013. delete this.channels[name];
  18014. }
  18015. }
  18016. /**
  18017. * Get the socket ID for the connection.
  18018. */
  18019. }, {
  18020. key: 'socketId',
  18021. value: function socketId() {
  18022. return this.socket.id;
  18023. }
  18024. /**
  18025. * Disconnect Socketio connection.
  18026. */
  18027. }, {
  18028. key: 'disconnect',
  18029. value: function disconnect() {
  18030. this.socket.disconnect();
  18031. }
  18032. }]);
  18033. return SocketIoConnector;
  18034. }(Connector);
  18035. /**
  18036. * This class creates a null connector.
  18037. */
  18038. var NullConnector = function (_Connector) {
  18039. inherits(NullConnector, _Connector);
  18040. function NullConnector() {
  18041. classCallCheck(this, NullConnector);
  18042. /**
  18043. * All of the subscribed channel names.
  18044. */
  18045. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18046. _this.channels = {};
  18047. return _this;
  18048. }
  18049. /**
  18050. * Create a fresh connection.
  18051. */
  18052. createClass(NullConnector, [{
  18053. key: 'connect',
  18054. value: function connect() {}
  18055. //
  18056. /**
  18057. * Listen for an event on a channel instance.
  18058. */
  18059. }, {
  18060. key: 'listen',
  18061. value: function listen(name, event, callback) {
  18062. return new NullChannel();
  18063. }
  18064. /**
  18065. * Get a channel instance by name.
  18066. */
  18067. }, {
  18068. key: 'channel',
  18069. value: function channel(name) {
  18070. return new NullChannel();
  18071. }
  18072. /**
  18073. * Get a private channel instance by name.
  18074. */
  18075. }, {
  18076. key: 'privateChannel',
  18077. value: function privateChannel(name) {
  18078. return new NullPrivateChannel();
  18079. }
  18080. /**
  18081. * Get a presence channel instance by name.
  18082. */
  18083. }, {
  18084. key: 'presenceChannel',
  18085. value: function presenceChannel(name) {
  18086. return new NullPresenceChannel();
  18087. }
  18088. /**
  18089. * Leave the given channel, as well as its private and presence variants.
  18090. */
  18091. }, {
  18092. key: 'leave',
  18093. value: function leave(name) {}
  18094. //
  18095. /**
  18096. * Leave the given channel.
  18097. */
  18098. }, {
  18099. key: 'leaveChannel',
  18100. value: function leaveChannel(name) {}
  18101. //
  18102. /**
  18103. * Get the socket ID for the connection.
  18104. */
  18105. }, {
  18106. key: 'socketId',
  18107. value: function socketId() {
  18108. return 'fake-socket-id';
  18109. }
  18110. /**
  18111. * Disconnect the connection.
  18112. */
  18113. }, {
  18114. key: 'disconnect',
  18115. value: function disconnect() {
  18116. //
  18117. }
  18118. }]);
  18119. return NullConnector;
  18120. }(Connector);
  18121. /**
  18122. * This class is the primary API for interacting with broadcasting.
  18123. */
  18124. var Echo = function () {
  18125. /**
  18126. * Create a new class instance.
  18127. */
  18128. function Echo(options) {
  18129. classCallCheck(this, Echo);
  18130. this.options = options;
  18131. this.connect();
  18132. if (!this.options.withoutInterceptors) {
  18133. this.registerInterceptors();
  18134. }
  18135. }
  18136. /**
  18137. * Get a channel instance by name.
  18138. */
  18139. createClass(Echo, [{
  18140. key: 'channel',
  18141. value: function channel(_channel) {
  18142. return this.connector.channel(_channel);
  18143. }
  18144. /**
  18145. * Create a new connection.
  18146. */
  18147. }, {
  18148. key: 'connect',
  18149. value: function connect() {
  18150. if (this.options.broadcaster == 'pusher') {
  18151. this.connector = new PusherConnector(this.options);
  18152. } else if (this.options.broadcaster == 'socket.io') {
  18153. this.connector = new SocketIoConnector(this.options);
  18154. } else if (this.options.broadcaster == 'null') {
  18155. this.connector = new NullConnector(this.options);
  18156. } else if (typeof this.options.broadcaster == 'function') {
  18157. this.connector = new this.options.broadcaster(this.options);
  18158. }
  18159. }
  18160. /**
  18161. * Disconnect from the Echo server.
  18162. */
  18163. }, {
  18164. key: 'disconnect',
  18165. value: function disconnect() {
  18166. this.connector.disconnect();
  18167. }
  18168. /**
  18169. * Get a presence channel instance by name.
  18170. */
  18171. }, {
  18172. key: 'join',
  18173. value: function join(channel) {
  18174. return this.connector.presenceChannel(channel);
  18175. }
  18176. /**
  18177. * Leave the given channel, as well as its private and presence variants.
  18178. */
  18179. }, {
  18180. key: 'leave',
  18181. value: function leave(channel) {
  18182. this.connector.leave(channel);
  18183. }
  18184. /**
  18185. * Leave the given channel.
  18186. */
  18187. }, {
  18188. key: 'leaveChannel',
  18189. value: function leaveChannel(channel) {
  18190. this.connector.leaveChannel(channel);
  18191. }
  18192. /**
  18193. * Listen for an event on a channel instance.
  18194. */
  18195. }, {
  18196. key: 'listen',
  18197. value: function listen(channel, event, callback) {
  18198. return this.connector.listen(channel, event, callback);
  18199. }
  18200. /**
  18201. * Get a private channel instance by name.
  18202. */
  18203. }, {
  18204. key: 'private',
  18205. value: function _private(channel) {
  18206. return this.connector.privateChannel(channel);
  18207. }
  18208. /**
  18209. * Get the Socket ID for the connection.
  18210. */
  18211. }, {
  18212. key: 'socketId',
  18213. value: function socketId() {
  18214. return this.connector.socketId();
  18215. }
  18216. /**
  18217. * Register 3rd party request interceptiors. These are used to automatically
  18218. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18219. */
  18220. }, {
  18221. key: 'registerInterceptors',
  18222. value: function registerInterceptors() {
  18223. if (typeof Vue === 'function' && Vue.http) {
  18224. this.registerVueRequestInterceptor();
  18225. }
  18226. if (typeof axios === 'function') {
  18227. this.registerAxiosRequestInterceptor();
  18228. }
  18229. if (typeof jQuery === 'function') {
  18230. this.registerjQueryAjaxSetup();
  18231. }
  18232. }
  18233. /**
  18234. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18235. */
  18236. }, {
  18237. key: 'registerVueRequestInterceptor',
  18238. value: function registerVueRequestInterceptor() {
  18239. var _this = this;
  18240. Vue.http.interceptors.push(function (request, next) {
  18241. if (_this.socketId()) {
  18242. request.headers.set('X-Socket-ID', _this.socketId());
  18243. }
  18244. next();
  18245. });
  18246. }
  18247. /**
  18248. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18249. */
  18250. }, {
  18251. key: 'registerAxiosRequestInterceptor',
  18252. value: function registerAxiosRequestInterceptor() {
  18253. var _this2 = this;
  18254. axios.interceptors.request.use(function (config) {
  18255. if (_this2.socketId()) {
  18256. config.headers['X-Socket-Id'] = _this2.socketId();
  18257. }
  18258. return config;
  18259. });
  18260. }
  18261. /**
  18262. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18263. */
  18264. }, {
  18265. key: 'registerjQueryAjaxSetup',
  18266. value: function registerjQueryAjaxSetup() {
  18267. var _this3 = this;
  18268. if (typeof jQuery.ajax != 'undefined') {
  18269. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18270. if (_this3.socketId()) {
  18271. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18272. }
  18273. });
  18274. }
  18275. }
  18276. }]);
  18277. return Echo;
  18278. }();
  18279. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18280. /***/ }),
  18281. /***/ "./node_modules/lodash/lodash.js":
  18282. /*!***************************************!*\
  18283. !*** ./node_modules/lodash/lodash.js ***!
  18284. \***************************************/
  18285. /*! no static exports found */
  18286. /***/ (function(module, exports, __webpack_require__) {
  18287. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18288. * @license
  18289. * Lodash <https://lodash.com/>
  18290. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18291. * Released under MIT license <https://lodash.com/license>
  18292. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18293. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18294. */
  18295. ;(function() {
  18296. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18297. var undefined;
  18298. /** Used as the semantic version number. */
  18299. var VERSION = '4.17.15';
  18300. /** Used as the size to enable large array optimizations. */
  18301. var LARGE_ARRAY_SIZE = 200;
  18302. /** Error message constants. */
  18303. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18304. FUNC_ERROR_TEXT = 'Expected a function';
  18305. /** Used to stand-in for `undefined` hash values. */
  18306. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18307. /** Used as the maximum memoize cache size. */
  18308. var MAX_MEMOIZE_SIZE = 500;
  18309. /** Used as the internal argument placeholder. */
  18310. var PLACEHOLDER = '__lodash_placeholder__';
  18311. /** Used to compose bitmasks for cloning. */
  18312. var CLONE_DEEP_FLAG = 1,
  18313. CLONE_FLAT_FLAG = 2,
  18314. CLONE_SYMBOLS_FLAG = 4;
  18315. /** Used to compose bitmasks for value comparisons. */
  18316. var COMPARE_PARTIAL_FLAG = 1,
  18317. COMPARE_UNORDERED_FLAG = 2;
  18318. /** Used to compose bitmasks for function metadata. */
  18319. var WRAP_BIND_FLAG = 1,
  18320. WRAP_BIND_KEY_FLAG = 2,
  18321. WRAP_CURRY_BOUND_FLAG = 4,
  18322. WRAP_CURRY_FLAG = 8,
  18323. WRAP_CURRY_RIGHT_FLAG = 16,
  18324. WRAP_PARTIAL_FLAG = 32,
  18325. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18326. WRAP_ARY_FLAG = 128,
  18327. WRAP_REARG_FLAG = 256,
  18328. WRAP_FLIP_FLAG = 512;
  18329. /** Used as default options for `_.truncate`. */
  18330. var DEFAULT_TRUNC_LENGTH = 30,
  18331. DEFAULT_TRUNC_OMISSION = '...';
  18332. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18333. var HOT_COUNT = 800,
  18334. HOT_SPAN = 16;
  18335. /** Used to indicate the type of lazy iteratees. */
  18336. var LAZY_FILTER_FLAG = 1,
  18337. LAZY_MAP_FLAG = 2,
  18338. LAZY_WHILE_FLAG = 3;
  18339. /** Used as references for various `Number` constants. */
  18340. var INFINITY = 1 / 0,
  18341. MAX_SAFE_INTEGER = 9007199254740991,
  18342. MAX_INTEGER = 1.7976931348623157e+308,
  18343. NAN = 0 / 0;
  18344. /** Used as references for the maximum length and index of an array. */
  18345. var MAX_ARRAY_LENGTH = 4294967295,
  18346. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18347. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18348. /** Used to associate wrap methods with their bit flags. */
  18349. var wrapFlags = [
  18350. ['ary', WRAP_ARY_FLAG],
  18351. ['bind', WRAP_BIND_FLAG],
  18352. ['bindKey', WRAP_BIND_KEY_FLAG],
  18353. ['curry', WRAP_CURRY_FLAG],
  18354. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18355. ['flip', WRAP_FLIP_FLAG],
  18356. ['partial', WRAP_PARTIAL_FLAG],
  18357. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18358. ['rearg', WRAP_REARG_FLAG]
  18359. ];
  18360. /** `Object#toString` result references. */
  18361. var argsTag = '[object Arguments]',
  18362. arrayTag = '[object Array]',
  18363. asyncTag = '[object AsyncFunction]',
  18364. boolTag = '[object Boolean]',
  18365. dateTag = '[object Date]',
  18366. domExcTag = '[object DOMException]',
  18367. errorTag = '[object Error]',
  18368. funcTag = '[object Function]',
  18369. genTag = '[object GeneratorFunction]',
  18370. mapTag = '[object Map]',
  18371. numberTag = '[object Number]',
  18372. nullTag = '[object Null]',
  18373. objectTag = '[object Object]',
  18374. promiseTag = '[object Promise]',
  18375. proxyTag = '[object Proxy]',
  18376. regexpTag = '[object RegExp]',
  18377. setTag = '[object Set]',
  18378. stringTag = '[object String]',
  18379. symbolTag = '[object Symbol]',
  18380. undefinedTag = '[object Undefined]',
  18381. weakMapTag = '[object WeakMap]',
  18382. weakSetTag = '[object WeakSet]';
  18383. var arrayBufferTag = '[object ArrayBuffer]',
  18384. dataViewTag = '[object DataView]',
  18385. float32Tag = '[object Float32Array]',
  18386. float64Tag = '[object Float64Array]',
  18387. int8Tag = '[object Int8Array]',
  18388. int16Tag = '[object Int16Array]',
  18389. int32Tag = '[object Int32Array]',
  18390. uint8Tag = '[object Uint8Array]',
  18391. uint8ClampedTag = '[object Uint8ClampedArray]',
  18392. uint16Tag = '[object Uint16Array]',
  18393. uint32Tag = '[object Uint32Array]';
  18394. /** Used to match empty string literals in compiled template source. */
  18395. var reEmptyStringLeading = /\b__p \+= '';/g,
  18396. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18397. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18398. /** Used to match HTML entities and HTML characters. */
  18399. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18400. reUnescapedHtml = /[&<>"']/g,
  18401. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18402. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18403. /** Used to match template delimiters. */
  18404. var reEscape = /<%-([\s\S]+?)%>/g,
  18405. reEvaluate = /<%([\s\S]+?)%>/g,
  18406. reInterpolate = /<%=([\s\S]+?)%>/g;
  18407. /** Used to match property names within property paths. */
  18408. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18409. reIsPlainProp = /^\w*$/,
  18410. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18411. /**
  18412. * Used to match `RegExp`
  18413. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18414. */
  18415. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18416. reHasRegExpChar = RegExp(reRegExpChar.source);
  18417. /** Used to match leading and trailing whitespace. */
  18418. var reTrim = /^\s+|\s+$/g,
  18419. reTrimStart = /^\s+/,
  18420. reTrimEnd = /\s+$/;
  18421. /** Used to match wrap detail comments. */
  18422. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18423. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18424. reSplitDetails = /,? & /;
  18425. /** Used to match words composed of alphanumeric characters. */
  18426. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18427. /** Used to match backslashes in property paths. */
  18428. var reEscapeChar = /\\(\\)?/g;
  18429. /**
  18430. * Used to match
  18431. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18432. */
  18433. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18434. /** Used to match `RegExp` flags from their coerced string values. */
  18435. var reFlags = /\w*$/;
  18436. /** Used to detect bad signed hexadecimal string values. */
  18437. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18438. /** Used to detect binary string values. */
  18439. var reIsBinary = /^0b[01]+$/i;
  18440. /** Used to detect host constructors (Safari). */
  18441. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18442. /** Used to detect octal string values. */
  18443. var reIsOctal = /^0o[0-7]+$/i;
  18444. /** Used to detect unsigned integer values. */
  18445. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18446. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18447. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18448. /** Used to ensure capturing order of template delimiters. */
  18449. var reNoMatch = /($^)/;
  18450. /** Used to match unescaped characters in compiled string literals. */
  18451. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18452. /** Used to compose unicode character classes. */
  18453. var rsAstralRange = '\\ud800-\\udfff',
  18454. rsComboMarksRange = '\\u0300-\\u036f',
  18455. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18456. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18457. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18458. rsDingbatRange = '\\u2700-\\u27bf',
  18459. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18460. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18461. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18462. rsPunctuationRange = '\\u2000-\\u206f',
  18463. 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',
  18464. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18465. rsVarRange = '\\ufe0e\\ufe0f',
  18466. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18467. /** Used to compose unicode capture groups. */
  18468. var rsApos = "['\u2019]",
  18469. rsAstral = '[' + rsAstralRange + ']',
  18470. rsBreak = '[' + rsBreakRange + ']',
  18471. rsCombo = '[' + rsComboRange + ']',
  18472. rsDigits = '\\d+',
  18473. rsDingbat = '[' + rsDingbatRange + ']',
  18474. rsLower = '[' + rsLowerRange + ']',
  18475. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18476. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18477. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18478. rsNonAstral = '[^' + rsAstralRange + ']',
  18479. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18480. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18481. rsUpper = '[' + rsUpperRange + ']',
  18482. rsZWJ = '\\u200d';
  18483. /** Used to compose unicode regexes. */
  18484. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18485. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18486. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18487. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18488. reOptMod = rsModifier + '?',
  18489. rsOptVar = '[' + rsVarRange + ']?',
  18490. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18491. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18492. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18493. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18494. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18495. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18496. /** Used to match apostrophes. */
  18497. var reApos = RegExp(rsApos, 'g');
  18498. /**
  18499. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18500. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18501. */
  18502. var reComboMark = RegExp(rsCombo, 'g');
  18503. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18504. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18505. /** Used to match complex or compound words. */
  18506. var reUnicodeWord = RegExp([
  18507. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18508. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18509. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18510. rsUpper + '+' + rsOptContrUpper,
  18511. rsOrdUpper,
  18512. rsOrdLower,
  18513. rsDigits,
  18514. rsEmoji
  18515. ].join('|'), 'g');
  18516. /** 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/). */
  18517. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18518. /** Used to detect strings that need a more robust regexp to match words. */
  18519. 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 ]/;
  18520. /** Used to assign default `context` object properties. */
  18521. var contextProps = [
  18522. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18523. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18524. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18525. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18526. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18527. ];
  18528. /** Used to make template sourceURLs easier to identify. */
  18529. var templateCounter = -1;
  18530. /** Used to identify `toStringTag` values of typed arrays. */
  18531. var typedArrayTags = {};
  18532. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18533. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18534. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18535. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18536. typedArrayTags[uint32Tag] = true;
  18537. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18538. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18539. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18540. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18541. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18542. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18543. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18544. typedArrayTags[weakMapTag] = false;
  18545. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18546. var cloneableTags = {};
  18547. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18548. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18549. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18550. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18551. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18552. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18553. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18554. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18555. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18556. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18557. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18558. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18559. cloneableTags[weakMapTag] = false;
  18560. /** Used to map Latin Unicode letters to basic Latin letters. */
  18561. var deburredLetters = {
  18562. // Latin-1 Supplement block.
  18563. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18564. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18565. '\xc7': 'C', '\xe7': 'c',
  18566. '\xd0': 'D', '\xf0': 'd',
  18567. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18568. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18569. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18570. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18571. '\xd1': 'N', '\xf1': 'n',
  18572. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18573. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18574. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18575. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18576. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18577. '\xc6': 'Ae', '\xe6': 'ae',
  18578. '\xde': 'Th', '\xfe': 'th',
  18579. '\xdf': 'ss',
  18580. // Latin Extended-A block.
  18581. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18582. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18583. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18584. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18585. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18586. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18587. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18588. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18589. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18590. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18591. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18592. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18593. '\u0134': 'J', '\u0135': 'j',
  18594. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18595. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18596. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18597. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18598. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18599. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18600. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18601. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18602. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18603. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18604. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18605. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18606. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18607. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18608. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18609. '\u0174': 'W', '\u0175': 'w',
  18610. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18611. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18612. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18613. '\u0132': 'IJ', '\u0133': 'ij',
  18614. '\u0152': 'Oe', '\u0153': 'oe',
  18615. '\u0149': "'n", '\u017f': 's'
  18616. };
  18617. /** Used to map characters to HTML entities. */
  18618. var htmlEscapes = {
  18619. '&': '&amp;',
  18620. '<': '&lt;',
  18621. '>': '&gt;',
  18622. '"': '&quot;',
  18623. "'": '&#39;'
  18624. };
  18625. /** Used to map HTML entities to characters. */
  18626. var htmlUnescapes = {
  18627. '&amp;': '&',
  18628. '&lt;': '<',
  18629. '&gt;': '>',
  18630. '&quot;': '"',
  18631. '&#39;': "'"
  18632. };
  18633. /** Used to escape characters for inclusion in compiled string literals. */
  18634. var stringEscapes = {
  18635. '\\': '\\',
  18636. "'": "'",
  18637. '\n': 'n',
  18638. '\r': 'r',
  18639. '\u2028': 'u2028',
  18640. '\u2029': 'u2029'
  18641. };
  18642. /** Built-in method references without a dependency on `root`. */
  18643. var freeParseFloat = parseFloat,
  18644. freeParseInt = parseInt;
  18645. /** Detect free variable `global` from Node.js. */
  18646. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18647. /** Detect free variable `self`. */
  18648. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18649. /** Used as a reference to the global object. */
  18650. var root = freeGlobal || freeSelf || Function('return this')();
  18651. /** Detect free variable `exports`. */
  18652. var freeExports = true && exports && !exports.nodeType && exports;
  18653. /** Detect free variable `module`. */
  18654. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18655. /** Detect the popular CommonJS extension `module.exports`. */
  18656. var moduleExports = freeModule && freeModule.exports === freeExports;
  18657. /** Detect free variable `process` from Node.js. */
  18658. var freeProcess = moduleExports && freeGlobal.process;
  18659. /** Used to access faster Node.js helpers. */
  18660. var nodeUtil = (function() {
  18661. try {
  18662. // Use `util.types` for Node.js 10+.
  18663. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18664. if (types) {
  18665. return types;
  18666. }
  18667. // Legacy `process.binding('util')` for Node.js < 10.
  18668. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18669. } catch (e) {}
  18670. }());
  18671. /* Node.js helper references. */
  18672. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18673. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18674. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18675. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18676. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18677. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18678. /*--------------------------------------------------------------------------*/
  18679. /**
  18680. * A faster alternative to `Function#apply`, this function invokes `func`
  18681. * with the `this` binding of `thisArg` and the arguments of `args`.
  18682. *
  18683. * @private
  18684. * @param {Function} func The function to invoke.
  18685. * @param {*} thisArg The `this` binding of `func`.
  18686. * @param {Array} args The arguments to invoke `func` with.
  18687. * @returns {*} Returns the result of `func`.
  18688. */
  18689. function apply(func, thisArg, args) {
  18690. switch (args.length) {
  18691. case 0: return func.call(thisArg);
  18692. case 1: return func.call(thisArg, args[0]);
  18693. case 2: return func.call(thisArg, args[0], args[1]);
  18694. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18695. }
  18696. return func.apply(thisArg, args);
  18697. }
  18698. /**
  18699. * A specialized version of `baseAggregator` for arrays.
  18700. *
  18701. * @private
  18702. * @param {Array} [array] The array to iterate over.
  18703. * @param {Function} setter The function to set `accumulator` values.
  18704. * @param {Function} iteratee The iteratee to transform keys.
  18705. * @param {Object} accumulator The initial aggregated object.
  18706. * @returns {Function} Returns `accumulator`.
  18707. */
  18708. function arrayAggregator(array, setter, iteratee, accumulator) {
  18709. var index = -1,
  18710. length = array == null ? 0 : array.length;
  18711. while (++index < length) {
  18712. var value = array[index];
  18713. setter(accumulator, value, iteratee(value), array);
  18714. }
  18715. return accumulator;
  18716. }
  18717. /**
  18718. * A specialized version of `_.forEach` for arrays without support for
  18719. * iteratee shorthands.
  18720. *
  18721. * @private
  18722. * @param {Array} [array] The array to iterate over.
  18723. * @param {Function} iteratee The function invoked per iteration.
  18724. * @returns {Array} Returns `array`.
  18725. */
  18726. function arrayEach(array, iteratee) {
  18727. var index = -1,
  18728. length = array == null ? 0 : array.length;
  18729. while (++index < length) {
  18730. if (iteratee(array[index], index, array) === false) {
  18731. break;
  18732. }
  18733. }
  18734. return array;
  18735. }
  18736. /**
  18737. * A specialized version of `_.forEachRight` for arrays without support for
  18738. * iteratee shorthands.
  18739. *
  18740. * @private
  18741. * @param {Array} [array] The array to iterate over.
  18742. * @param {Function} iteratee The function invoked per iteration.
  18743. * @returns {Array} Returns `array`.
  18744. */
  18745. function arrayEachRight(array, iteratee) {
  18746. var length = array == null ? 0 : array.length;
  18747. while (length--) {
  18748. if (iteratee(array[length], length, array) === false) {
  18749. break;
  18750. }
  18751. }
  18752. return array;
  18753. }
  18754. /**
  18755. * A specialized version of `_.every` for arrays without support for
  18756. * iteratee shorthands.
  18757. *
  18758. * @private
  18759. * @param {Array} [array] The array to iterate over.
  18760. * @param {Function} predicate The function invoked per iteration.
  18761. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18762. * else `false`.
  18763. */
  18764. function arrayEvery(array, predicate) {
  18765. var index = -1,
  18766. length = array == null ? 0 : array.length;
  18767. while (++index < length) {
  18768. if (!predicate(array[index], index, array)) {
  18769. return false;
  18770. }
  18771. }
  18772. return true;
  18773. }
  18774. /**
  18775. * A specialized version of `_.filter` for arrays without support for
  18776. * iteratee shorthands.
  18777. *
  18778. * @private
  18779. * @param {Array} [array] The array to iterate over.
  18780. * @param {Function} predicate The function invoked per iteration.
  18781. * @returns {Array} Returns the new filtered array.
  18782. */
  18783. function arrayFilter(array, predicate) {
  18784. var index = -1,
  18785. length = array == null ? 0 : array.length,
  18786. resIndex = 0,
  18787. result = [];
  18788. while (++index < length) {
  18789. var value = array[index];
  18790. if (predicate(value, index, array)) {
  18791. result[resIndex++] = value;
  18792. }
  18793. }
  18794. return result;
  18795. }
  18796. /**
  18797. * A specialized version of `_.includes` for arrays without support for
  18798. * specifying an index to search from.
  18799. *
  18800. * @private
  18801. * @param {Array} [array] The array to inspect.
  18802. * @param {*} target The value to search for.
  18803. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18804. */
  18805. function arrayIncludes(array, value) {
  18806. var length = array == null ? 0 : array.length;
  18807. return !!length && baseIndexOf(array, value, 0) > -1;
  18808. }
  18809. /**
  18810. * This function is like `arrayIncludes` except that it accepts a comparator.
  18811. *
  18812. * @private
  18813. * @param {Array} [array] The array to inspect.
  18814. * @param {*} target The value to search for.
  18815. * @param {Function} comparator The comparator invoked per element.
  18816. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18817. */
  18818. function arrayIncludesWith(array, value, comparator) {
  18819. var index = -1,
  18820. length = array == null ? 0 : array.length;
  18821. while (++index < length) {
  18822. if (comparator(value, array[index])) {
  18823. return true;
  18824. }
  18825. }
  18826. return false;
  18827. }
  18828. /**
  18829. * A specialized version of `_.map` for arrays without support for iteratee
  18830. * shorthands.
  18831. *
  18832. * @private
  18833. * @param {Array} [array] The array to iterate over.
  18834. * @param {Function} iteratee The function invoked per iteration.
  18835. * @returns {Array} Returns the new mapped array.
  18836. */
  18837. function arrayMap(array, iteratee) {
  18838. var index = -1,
  18839. length = array == null ? 0 : array.length,
  18840. result = Array(length);
  18841. while (++index < length) {
  18842. result[index] = iteratee(array[index], index, array);
  18843. }
  18844. return result;
  18845. }
  18846. /**
  18847. * Appends the elements of `values` to `array`.
  18848. *
  18849. * @private
  18850. * @param {Array} array The array to modify.
  18851. * @param {Array} values The values to append.
  18852. * @returns {Array} Returns `array`.
  18853. */
  18854. function arrayPush(array, values) {
  18855. var index = -1,
  18856. length = values.length,
  18857. offset = array.length;
  18858. while (++index < length) {
  18859. array[offset + index] = values[index];
  18860. }
  18861. return array;
  18862. }
  18863. /**
  18864. * A specialized version of `_.reduce` for arrays without support for
  18865. * iteratee shorthands.
  18866. *
  18867. * @private
  18868. * @param {Array} [array] The array to iterate over.
  18869. * @param {Function} iteratee The function invoked per iteration.
  18870. * @param {*} [accumulator] The initial value.
  18871. * @param {boolean} [initAccum] Specify using the first element of `array` as
  18872. * the initial value.
  18873. * @returns {*} Returns the accumulated value.
  18874. */
  18875. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18876. var index = -1,
  18877. length = array == null ? 0 : array.length;
  18878. if (initAccum && length) {
  18879. accumulator = array[++index];
  18880. }
  18881. while (++index < length) {
  18882. accumulator = iteratee(accumulator, array[index], index, array);
  18883. }
  18884. return accumulator;
  18885. }
  18886. /**
  18887. * A specialized version of `_.reduceRight` for arrays without support for
  18888. * iteratee shorthands.
  18889. *
  18890. * @private
  18891. * @param {Array} [array] The array to iterate over.
  18892. * @param {Function} iteratee The function invoked per iteration.
  18893. * @param {*} [accumulator] The initial value.
  18894. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18895. * the initial value.
  18896. * @returns {*} Returns the accumulated value.
  18897. */
  18898. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18899. var length = array == null ? 0 : array.length;
  18900. if (initAccum && length) {
  18901. accumulator = array[--length];
  18902. }
  18903. while (length--) {
  18904. accumulator = iteratee(accumulator, array[length], length, array);
  18905. }
  18906. return accumulator;
  18907. }
  18908. /**
  18909. * A specialized version of `_.some` for arrays without support for iteratee
  18910. * shorthands.
  18911. *
  18912. * @private
  18913. * @param {Array} [array] The array to iterate over.
  18914. * @param {Function} predicate The function invoked per iteration.
  18915. * @returns {boolean} Returns `true` if any element passes the predicate check,
  18916. * else `false`.
  18917. */
  18918. function arraySome(array, predicate) {
  18919. var index = -1,
  18920. length = array == null ? 0 : array.length;
  18921. while (++index < length) {
  18922. if (predicate(array[index], index, array)) {
  18923. return true;
  18924. }
  18925. }
  18926. return false;
  18927. }
  18928. /**
  18929. * Gets the size of an ASCII `string`.
  18930. *
  18931. * @private
  18932. * @param {string} string The string inspect.
  18933. * @returns {number} Returns the string size.
  18934. */
  18935. var asciiSize = baseProperty('length');
  18936. /**
  18937. * Converts an ASCII `string` to an array.
  18938. *
  18939. * @private
  18940. * @param {string} string The string to convert.
  18941. * @returns {Array} Returns the converted array.
  18942. */
  18943. function asciiToArray(string) {
  18944. return string.split('');
  18945. }
  18946. /**
  18947. * Splits an ASCII `string` into an array of its words.
  18948. *
  18949. * @private
  18950. * @param {string} The string to inspect.
  18951. * @returns {Array} Returns the words of `string`.
  18952. */
  18953. function asciiWords(string) {
  18954. return string.match(reAsciiWord) || [];
  18955. }
  18956. /**
  18957. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  18958. * without support for iteratee shorthands, which iterates over `collection`
  18959. * using `eachFunc`.
  18960. *
  18961. * @private
  18962. * @param {Array|Object} collection The collection to inspect.
  18963. * @param {Function} predicate The function invoked per iteration.
  18964. * @param {Function} eachFunc The function to iterate over `collection`.
  18965. * @returns {*} Returns the found element or its key, else `undefined`.
  18966. */
  18967. function baseFindKey(collection, predicate, eachFunc) {
  18968. var result;
  18969. eachFunc(collection, function(value, key, collection) {
  18970. if (predicate(value, key, collection)) {
  18971. result = key;
  18972. return false;
  18973. }
  18974. });
  18975. return result;
  18976. }
  18977. /**
  18978. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  18979. * support for iteratee shorthands.
  18980. *
  18981. * @private
  18982. * @param {Array} array The array to inspect.
  18983. * @param {Function} predicate The function invoked per iteration.
  18984. * @param {number} fromIndex The index to search from.
  18985. * @param {boolean} [fromRight] Specify iterating from right to left.
  18986. * @returns {number} Returns the index of the matched value, else `-1`.
  18987. */
  18988. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  18989. var length = array.length,
  18990. index = fromIndex + (fromRight ? 1 : -1);
  18991. while ((fromRight ? index-- : ++index < length)) {
  18992. if (predicate(array[index], index, array)) {
  18993. return index;
  18994. }
  18995. }
  18996. return -1;
  18997. }
  18998. /**
  18999. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19000. *
  19001. * @private
  19002. * @param {Array} array The array to inspect.
  19003. * @param {*} value The value to search for.
  19004. * @param {number} fromIndex The index to search from.
  19005. * @returns {number} Returns the index of the matched value, else `-1`.
  19006. */
  19007. function baseIndexOf(array, value, fromIndex) {
  19008. return value === value
  19009. ? strictIndexOf(array, value, fromIndex)
  19010. : baseFindIndex(array, baseIsNaN, fromIndex);
  19011. }
  19012. /**
  19013. * This function is like `baseIndexOf` except that it accepts a comparator.
  19014. *
  19015. * @private
  19016. * @param {Array} array The array to inspect.
  19017. * @param {*} value The value to search for.
  19018. * @param {number} fromIndex The index to search from.
  19019. * @param {Function} comparator The comparator invoked per element.
  19020. * @returns {number} Returns the index of the matched value, else `-1`.
  19021. */
  19022. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19023. var index = fromIndex - 1,
  19024. length = array.length;
  19025. while (++index < length) {
  19026. if (comparator(array[index], value)) {
  19027. return index;
  19028. }
  19029. }
  19030. return -1;
  19031. }
  19032. /**
  19033. * The base implementation of `_.isNaN` without support for number objects.
  19034. *
  19035. * @private
  19036. * @param {*} value The value to check.
  19037. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19038. */
  19039. function baseIsNaN(value) {
  19040. return value !== value;
  19041. }
  19042. /**
  19043. * The base implementation of `_.mean` and `_.meanBy` without support for
  19044. * iteratee shorthands.
  19045. *
  19046. * @private
  19047. * @param {Array} array The array to iterate over.
  19048. * @param {Function} iteratee The function invoked per iteration.
  19049. * @returns {number} Returns the mean.
  19050. */
  19051. function baseMean(array, iteratee) {
  19052. var length = array == null ? 0 : array.length;
  19053. return length ? (baseSum(array, iteratee) / length) : NAN;
  19054. }
  19055. /**
  19056. * The base implementation of `_.property` without support for deep paths.
  19057. *
  19058. * @private
  19059. * @param {string} key The key of the property to get.
  19060. * @returns {Function} Returns the new accessor function.
  19061. */
  19062. function baseProperty(key) {
  19063. return function(object) {
  19064. return object == null ? undefined : object[key];
  19065. };
  19066. }
  19067. /**
  19068. * The base implementation of `_.propertyOf` without support for deep paths.
  19069. *
  19070. * @private
  19071. * @param {Object} object The object to query.
  19072. * @returns {Function} Returns the new accessor function.
  19073. */
  19074. function basePropertyOf(object) {
  19075. return function(key) {
  19076. return object == null ? undefined : object[key];
  19077. };
  19078. }
  19079. /**
  19080. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19081. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19082. *
  19083. * @private
  19084. * @param {Array|Object} collection The collection to iterate over.
  19085. * @param {Function} iteratee The function invoked per iteration.
  19086. * @param {*} accumulator The initial value.
  19087. * @param {boolean} initAccum Specify using the first or last element of
  19088. * `collection` as the initial value.
  19089. * @param {Function} eachFunc The function to iterate over `collection`.
  19090. * @returns {*} Returns the accumulated value.
  19091. */
  19092. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19093. eachFunc(collection, function(value, index, collection) {
  19094. accumulator = initAccum
  19095. ? (initAccum = false, value)
  19096. : iteratee(accumulator, value, index, collection);
  19097. });
  19098. return accumulator;
  19099. }
  19100. /**
  19101. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19102. * sort order of `array` and replaces criteria objects with their corresponding
  19103. * values.
  19104. *
  19105. * @private
  19106. * @param {Array} array The array to sort.
  19107. * @param {Function} comparer The function to define sort order.
  19108. * @returns {Array} Returns `array`.
  19109. */
  19110. function baseSortBy(array, comparer) {
  19111. var length = array.length;
  19112. array.sort(comparer);
  19113. while (length--) {
  19114. array[length] = array[length].value;
  19115. }
  19116. return array;
  19117. }
  19118. /**
  19119. * The base implementation of `_.sum` and `_.sumBy` without support for
  19120. * iteratee shorthands.
  19121. *
  19122. * @private
  19123. * @param {Array} array The array to iterate over.
  19124. * @param {Function} iteratee The function invoked per iteration.
  19125. * @returns {number} Returns the sum.
  19126. */
  19127. function baseSum(array, iteratee) {
  19128. var result,
  19129. index = -1,
  19130. length = array.length;
  19131. while (++index < length) {
  19132. var current = iteratee(array[index]);
  19133. if (current !== undefined) {
  19134. result = result === undefined ? current : (result + current);
  19135. }
  19136. }
  19137. return result;
  19138. }
  19139. /**
  19140. * The base implementation of `_.times` without support for iteratee shorthands
  19141. * or max array length checks.
  19142. *
  19143. * @private
  19144. * @param {number} n The number of times to invoke `iteratee`.
  19145. * @param {Function} iteratee The function invoked per iteration.
  19146. * @returns {Array} Returns the array of results.
  19147. */
  19148. function baseTimes(n, iteratee) {
  19149. var index = -1,
  19150. result = Array(n);
  19151. while (++index < n) {
  19152. result[index] = iteratee(index);
  19153. }
  19154. return result;
  19155. }
  19156. /**
  19157. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19158. * of key-value pairs for `object` corresponding to the property names of `props`.
  19159. *
  19160. * @private
  19161. * @param {Object} object The object to query.
  19162. * @param {Array} props The property names to get values for.
  19163. * @returns {Object} Returns the key-value pairs.
  19164. */
  19165. function baseToPairs(object, props) {
  19166. return arrayMap(props, function(key) {
  19167. return [key, object[key]];
  19168. });
  19169. }
  19170. /**
  19171. * The base implementation of `_.unary` without support for storing metadata.
  19172. *
  19173. * @private
  19174. * @param {Function} func The function to cap arguments for.
  19175. * @returns {Function} Returns the new capped function.
  19176. */
  19177. function baseUnary(func) {
  19178. return function(value) {
  19179. return func(value);
  19180. };
  19181. }
  19182. /**
  19183. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19184. * array of `object` property values corresponding to the property names
  19185. * of `props`.
  19186. *
  19187. * @private
  19188. * @param {Object} object The object to query.
  19189. * @param {Array} props The property names to get values for.
  19190. * @returns {Object} Returns the array of property values.
  19191. */
  19192. function baseValues(object, props) {
  19193. return arrayMap(props, function(key) {
  19194. return object[key];
  19195. });
  19196. }
  19197. /**
  19198. * Checks if a `cache` value for `key` exists.
  19199. *
  19200. * @private
  19201. * @param {Object} cache The cache to query.
  19202. * @param {string} key The key of the entry to check.
  19203. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19204. */
  19205. function cacheHas(cache, key) {
  19206. return cache.has(key);
  19207. }
  19208. /**
  19209. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19210. * that is not found in the character symbols.
  19211. *
  19212. * @private
  19213. * @param {Array} strSymbols The string symbols to inspect.
  19214. * @param {Array} chrSymbols The character symbols to find.
  19215. * @returns {number} Returns the index of the first unmatched string symbol.
  19216. */
  19217. function charsStartIndex(strSymbols, chrSymbols) {
  19218. var index = -1,
  19219. length = strSymbols.length;
  19220. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19221. return index;
  19222. }
  19223. /**
  19224. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19225. * that is not found in the character symbols.
  19226. *
  19227. * @private
  19228. * @param {Array} strSymbols The string symbols to inspect.
  19229. * @param {Array} chrSymbols The character symbols to find.
  19230. * @returns {number} Returns the index of the last unmatched string symbol.
  19231. */
  19232. function charsEndIndex(strSymbols, chrSymbols) {
  19233. var index = strSymbols.length;
  19234. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19235. return index;
  19236. }
  19237. /**
  19238. * Gets the number of `placeholder` occurrences in `array`.
  19239. *
  19240. * @private
  19241. * @param {Array} array The array to inspect.
  19242. * @param {*} placeholder The placeholder to search for.
  19243. * @returns {number} Returns the placeholder count.
  19244. */
  19245. function countHolders(array, placeholder) {
  19246. var length = array.length,
  19247. result = 0;
  19248. while (length--) {
  19249. if (array[length] === placeholder) {
  19250. ++result;
  19251. }
  19252. }
  19253. return result;
  19254. }
  19255. /**
  19256. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19257. * letters to basic Latin letters.
  19258. *
  19259. * @private
  19260. * @param {string} letter The matched letter to deburr.
  19261. * @returns {string} Returns the deburred letter.
  19262. */
  19263. var deburrLetter = basePropertyOf(deburredLetters);
  19264. /**
  19265. * Used by `_.escape` to convert characters to HTML entities.
  19266. *
  19267. * @private
  19268. * @param {string} chr The matched character to escape.
  19269. * @returns {string} Returns the escaped character.
  19270. */
  19271. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19272. /**
  19273. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19274. *
  19275. * @private
  19276. * @param {string} chr The matched character to escape.
  19277. * @returns {string} Returns the escaped character.
  19278. */
  19279. function escapeStringChar(chr) {
  19280. return '\\' + stringEscapes[chr];
  19281. }
  19282. /**
  19283. * Gets the value at `key` of `object`.
  19284. *
  19285. * @private
  19286. * @param {Object} [object] The object to query.
  19287. * @param {string} key The key of the property to get.
  19288. * @returns {*} Returns the property value.
  19289. */
  19290. function getValue(object, key) {
  19291. return object == null ? undefined : object[key];
  19292. }
  19293. /**
  19294. * Checks if `string` contains Unicode symbols.
  19295. *
  19296. * @private
  19297. * @param {string} string The string to inspect.
  19298. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19299. */
  19300. function hasUnicode(string) {
  19301. return reHasUnicode.test(string);
  19302. }
  19303. /**
  19304. * Checks if `string` contains a word composed of Unicode symbols.
  19305. *
  19306. * @private
  19307. * @param {string} string The string to inspect.
  19308. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19309. */
  19310. function hasUnicodeWord(string) {
  19311. return reHasUnicodeWord.test(string);
  19312. }
  19313. /**
  19314. * Converts `iterator` to an array.
  19315. *
  19316. * @private
  19317. * @param {Object} iterator The iterator to convert.
  19318. * @returns {Array} Returns the converted array.
  19319. */
  19320. function iteratorToArray(iterator) {
  19321. var data,
  19322. result = [];
  19323. while (!(data = iterator.next()).done) {
  19324. result.push(data.value);
  19325. }
  19326. return result;
  19327. }
  19328. /**
  19329. * Converts `map` to its key-value pairs.
  19330. *
  19331. * @private
  19332. * @param {Object} map The map to convert.
  19333. * @returns {Array} Returns the key-value pairs.
  19334. */
  19335. function mapToArray(map) {
  19336. var index = -1,
  19337. result = Array(map.size);
  19338. map.forEach(function(value, key) {
  19339. result[++index] = [key, value];
  19340. });
  19341. return result;
  19342. }
  19343. /**
  19344. * Creates a unary function that invokes `func` with its argument transformed.
  19345. *
  19346. * @private
  19347. * @param {Function} func The function to wrap.
  19348. * @param {Function} transform The argument transform.
  19349. * @returns {Function} Returns the new function.
  19350. */
  19351. function overArg(func, transform) {
  19352. return function(arg) {
  19353. return func(transform(arg));
  19354. };
  19355. }
  19356. /**
  19357. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19358. * and returns an array of their indexes.
  19359. *
  19360. * @private
  19361. * @param {Array} array The array to modify.
  19362. * @param {*} placeholder The placeholder to replace.
  19363. * @returns {Array} Returns the new array of placeholder indexes.
  19364. */
  19365. function replaceHolders(array, placeholder) {
  19366. var index = -1,
  19367. length = array.length,
  19368. resIndex = 0,
  19369. result = [];
  19370. while (++index < length) {
  19371. var value = array[index];
  19372. if (value === placeholder || value === PLACEHOLDER) {
  19373. array[index] = PLACEHOLDER;
  19374. result[resIndex++] = index;
  19375. }
  19376. }
  19377. return result;
  19378. }
  19379. /**
  19380. * Converts `set` to an array of its values.
  19381. *
  19382. * @private
  19383. * @param {Object} set The set to convert.
  19384. * @returns {Array} Returns the values.
  19385. */
  19386. function setToArray(set) {
  19387. var index = -1,
  19388. result = Array(set.size);
  19389. set.forEach(function(value) {
  19390. result[++index] = value;
  19391. });
  19392. return result;
  19393. }
  19394. /**
  19395. * Converts `set` to its value-value pairs.
  19396. *
  19397. * @private
  19398. * @param {Object} set The set to convert.
  19399. * @returns {Array} Returns the value-value pairs.
  19400. */
  19401. function setToPairs(set) {
  19402. var index = -1,
  19403. result = Array(set.size);
  19404. set.forEach(function(value) {
  19405. result[++index] = [value, value];
  19406. });
  19407. return result;
  19408. }
  19409. /**
  19410. * A specialized version of `_.indexOf` which performs strict equality
  19411. * comparisons of values, i.e. `===`.
  19412. *
  19413. * @private
  19414. * @param {Array} array The array to inspect.
  19415. * @param {*} value The value to search for.
  19416. * @param {number} fromIndex The index to search from.
  19417. * @returns {number} Returns the index of the matched value, else `-1`.
  19418. */
  19419. function strictIndexOf(array, value, fromIndex) {
  19420. var index = fromIndex - 1,
  19421. length = array.length;
  19422. while (++index < length) {
  19423. if (array[index] === value) {
  19424. return index;
  19425. }
  19426. }
  19427. return -1;
  19428. }
  19429. /**
  19430. * A specialized version of `_.lastIndexOf` which performs strict equality
  19431. * comparisons of values, i.e. `===`.
  19432. *
  19433. * @private
  19434. * @param {Array} array The array to inspect.
  19435. * @param {*} value The value to search for.
  19436. * @param {number} fromIndex The index to search from.
  19437. * @returns {number} Returns the index of the matched value, else `-1`.
  19438. */
  19439. function strictLastIndexOf(array, value, fromIndex) {
  19440. var index = fromIndex + 1;
  19441. while (index--) {
  19442. if (array[index] === value) {
  19443. return index;
  19444. }
  19445. }
  19446. return index;
  19447. }
  19448. /**
  19449. * Gets the number of symbols in `string`.
  19450. *
  19451. * @private
  19452. * @param {string} string The string to inspect.
  19453. * @returns {number} Returns the string size.
  19454. */
  19455. function stringSize(string) {
  19456. return hasUnicode(string)
  19457. ? unicodeSize(string)
  19458. : asciiSize(string);
  19459. }
  19460. /**
  19461. * Converts `string` to an array.
  19462. *
  19463. * @private
  19464. * @param {string} string The string to convert.
  19465. * @returns {Array} Returns the converted array.
  19466. */
  19467. function stringToArray(string) {
  19468. return hasUnicode(string)
  19469. ? unicodeToArray(string)
  19470. : asciiToArray(string);
  19471. }
  19472. /**
  19473. * Used by `_.unescape` to convert HTML entities to characters.
  19474. *
  19475. * @private
  19476. * @param {string} chr The matched character to unescape.
  19477. * @returns {string} Returns the unescaped character.
  19478. */
  19479. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19480. /**
  19481. * Gets the size of a Unicode `string`.
  19482. *
  19483. * @private
  19484. * @param {string} string The string inspect.
  19485. * @returns {number} Returns the string size.
  19486. */
  19487. function unicodeSize(string) {
  19488. var result = reUnicode.lastIndex = 0;
  19489. while (reUnicode.test(string)) {
  19490. ++result;
  19491. }
  19492. return result;
  19493. }
  19494. /**
  19495. * Converts a Unicode `string` to an array.
  19496. *
  19497. * @private
  19498. * @param {string} string The string to convert.
  19499. * @returns {Array} Returns the converted array.
  19500. */
  19501. function unicodeToArray(string) {
  19502. return string.match(reUnicode) || [];
  19503. }
  19504. /**
  19505. * Splits a Unicode `string` into an array of its words.
  19506. *
  19507. * @private
  19508. * @param {string} The string to inspect.
  19509. * @returns {Array} Returns the words of `string`.
  19510. */
  19511. function unicodeWords(string) {
  19512. return string.match(reUnicodeWord) || [];
  19513. }
  19514. /*--------------------------------------------------------------------------*/
  19515. /**
  19516. * Create a new pristine `lodash` function using the `context` object.
  19517. *
  19518. * @static
  19519. * @memberOf _
  19520. * @since 1.1.0
  19521. * @category Util
  19522. * @param {Object} [context=root] The context object.
  19523. * @returns {Function} Returns a new `lodash` function.
  19524. * @example
  19525. *
  19526. * _.mixin({ 'foo': _.constant('foo') });
  19527. *
  19528. * var lodash = _.runInContext();
  19529. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19530. *
  19531. * _.isFunction(_.foo);
  19532. * // => true
  19533. * _.isFunction(_.bar);
  19534. * // => false
  19535. *
  19536. * lodash.isFunction(lodash.foo);
  19537. * // => false
  19538. * lodash.isFunction(lodash.bar);
  19539. * // => true
  19540. *
  19541. * // Create a suped-up `defer` in Node.js.
  19542. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19543. */
  19544. var runInContext = (function runInContext(context) {
  19545. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19546. /** Built-in constructor references. */
  19547. var Array = context.Array,
  19548. Date = context.Date,
  19549. Error = context.Error,
  19550. Function = context.Function,
  19551. Math = context.Math,
  19552. Object = context.Object,
  19553. RegExp = context.RegExp,
  19554. String = context.String,
  19555. TypeError = context.TypeError;
  19556. /** Used for built-in method references. */
  19557. var arrayProto = Array.prototype,
  19558. funcProto = Function.prototype,
  19559. objectProto = Object.prototype;
  19560. /** Used to detect overreaching core-js shims. */
  19561. var coreJsData = context['__core-js_shared__'];
  19562. /** Used to resolve the decompiled source of functions. */
  19563. var funcToString = funcProto.toString;
  19564. /** Used to check objects for own properties. */
  19565. var hasOwnProperty = objectProto.hasOwnProperty;
  19566. /** Used to generate unique IDs. */
  19567. var idCounter = 0;
  19568. /** Used to detect methods masquerading as native. */
  19569. var maskSrcKey = (function() {
  19570. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19571. return uid ? ('Symbol(src)_1.' + uid) : '';
  19572. }());
  19573. /**
  19574. * Used to resolve the
  19575. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19576. * of values.
  19577. */
  19578. var nativeObjectToString = objectProto.toString;
  19579. /** Used to infer the `Object` constructor. */
  19580. var objectCtorString = funcToString.call(Object);
  19581. /** Used to restore the original `_` reference in `_.noConflict`. */
  19582. var oldDash = root._;
  19583. /** Used to detect if a method is native. */
  19584. var reIsNative = RegExp('^' +
  19585. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19586. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19587. );
  19588. /** Built-in value references. */
  19589. var Buffer = moduleExports ? context.Buffer : undefined,
  19590. Symbol = context.Symbol,
  19591. Uint8Array = context.Uint8Array,
  19592. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19593. getPrototype = overArg(Object.getPrototypeOf, Object),
  19594. objectCreate = Object.create,
  19595. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19596. splice = arrayProto.splice,
  19597. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19598. symIterator = Symbol ? Symbol.iterator : undefined,
  19599. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19600. var defineProperty = (function() {
  19601. try {
  19602. var func = getNative(Object, 'defineProperty');
  19603. func({}, '', {});
  19604. return func;
  19605. } catch (e) {}
  19606. }());
  19607. /** Mocked built-ins. */
  19608. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19609. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19610. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19611. /* Built-in method references for those with the same name as other `lodash` methods. */
  19612. var nativeCeil = Math.ceil,
  19613. nativeFloor = Math.floor,
  19614. nativeGetSymbols = Object.getOwnPropertySymbols,
  19615. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19616. nativeIsFinite = context.isFinite,
  19617. nativeJoin = arrayProto.join,
  19618. nativeKeys = overArg(Object.keys, Object),
  19619. nativeMax = Math.max,
  19620. nativeMin = Math.min,
  19621. nativeNow = Date.now,
  19622. nativeParseInt = context.parseInt,
  19623. nativeRandom = Math.random,
  19624. nativeReverse = arrayProto.reverse;
  19625. /* Built-in method references that are verified to be native. */
  19626. var DataView = getNative(context, 'DataView'),
  19627. Map = getNative(context, 'Map'),
  19628. Promise = getNative(context, 'Promise'),
  19629. Set = getNative(context, 'Set'),
  19630. WeakMap = getNative(context, 'WeakMap'),
  19631. nativeCreate = getNative(Object, 'create');
  19632. /** Used to store function metadata. */
  19633. var metaMap = WeakMap && new WeakMap;
  19634. /** Used to lookup unminified function names. */
  19635. var realNames = {};
  19636. /** Used to detect maps, sets, and weakmaps. */
  19637. var dataViewCtorString = toSource(DataView),
  19638. mapCtorString = toSource(Map),
  19639. promiseCtorString = toSource(Promise),
  19640. setCtorString = toSource(Set),
  19641. weakMapCtorString = toSource(WeakMap);
  19642. /** Used to convert symbols to primitives and strings. */
  19643. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19644. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19645. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19646. /*------------------------------------------------------------------------*/
  19647. /**
  19648. * Creates a `lodash` object which wraps `value` to enable implicit method
  19649. * chain sequences. Methods that operate on and return arrays, collections,
  19650. * and functions can be chained together. Methods that retrieve a single value
  19651. * or may return a primitive value will automatically end the chain sequence
  19652. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19653. * with `_#value`.
  19654. *
  19655. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19656. * enabled using `_.chain`.
  19657. *
  19658. * The execution of chained methods is lazy, that is, it's deferred until
  19659. * `_#value` is implicitly or explicitly called.
  19660. *
  19661. * Lazy evaluation allows several methods to support shortcut fusion.
  19662. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19663. * the creation of intermediate arrays and can greatly reduce the number of
  19664. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19665. * fusion if the section is applied to an array and iteratees accept only
  19666. * one argument. The heuristic for whether a section qualifies for shortcut
  19667. * fusion is subject to change.
  19668. *
  19669. * Chaining is supported in custom builds as long as the `_#value` method is
  19670. * directly or indirectly included in the build.
  19671. *
  19672. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19673. *
  19674. * The wrapper `Array` methods are:
  19675. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19676. *
  19677. * The wrapper `String` methods are:
  19678. * `replace` and `split`
  19679. *
  19680. * The wrapper methods that support shortcut fusion are:
  19681. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19682. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19683. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19684. *
  19685. * The chainable wrapper methods are:
  19686. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19687. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19688. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19689. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19690. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19691. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19692. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19693. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19694. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19695. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19696. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19697. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19698. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19699. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19700. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19701. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19702. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19703. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19704. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19705. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19706. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19707. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19708. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19709. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19710. *
  19711. * The wrapper methods that are **not** chainable by default are:
  19712. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19713. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19714. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19715. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19716. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19717. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19718. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19719. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19720. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19721. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19722. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19723. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19724. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19725. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19726. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19727. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19728. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19729. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19730. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19731. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19732. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19733. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19734. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19735. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19736. * `upperFirst`, `value`, and `words`
  19737. *
  19738. * @name _
  19739. * @constructor
  19740. * @category Seq
  19741. * @param {*} value The value to wrap in a `lodash` instance.
  19742. * @returns {Object} Returns the new `lodash` wrapper instance.
  19743. * @example
  19744. *
  19745. * function square(n) {
  19746. * return n * n;
  19747. * }
  19748. *
  19749. * var wrapped = _([1, 2, 3]);
  19750. *
  19751. * // Returns an unwrapped value.
  19752. * wrapped.reduce(_.add);
  19753. * // => 6
  19754. *
  19755. * // Returns a wrapped value.
  19756. * var squares = wrapped.map(square);
  19757. *
  19758. * _.isArray(squares);
  19759. * // => false
  19760. *
  19761. * _.isArray(squares.value());
  19762. * // => true
  19763. */
  19764. function lodash(value) {
  19765. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19766. if (value instanceof LodashWrapper) {
  19767. return value;
  19768. }
  19769. if (hasOwnProperty.call(value, '__wrapped__')) {
  19770. return wrapperClone(value);
  19771. }
  19772. }
  19773. return new LodashWrapper(value);
  19774. }
  19775. /**
  19776. * The base implementation of `_.create` without support for assigning
  19777. * properties to the created object.
  19778. *
  19779. * @private
  19780. * @param {Object} proto The object to inherit from.
  19781. * @returns {Object} Returns the new object.
  19782. */
  19783. var baseCreate = (function() {
  19784. function object() {}
  19785. return function(proto) {
  19786. if (!isObject(proto)) {
  19787. return {};
  19788. }
  19789. if (objectCreate) {
  19790. return objectCreate(proto);
  19791. }
  19792. object.prototype = proto;
  19793. var result = new object;
  19794. object.prototype = undefined;
  19795. return result;
  19796. };
  19797. }());
  19798. /**
  19799. * The function whose prototype chain sequence wrappers inherit from.
  19800. *
  19801. * @private
  19802. */
  19803. function baseLodash() {
  19804. // No operation performed.
  19805. }
  19806. /**
  19807. * The base constructor for creating `lodash` wrapper objects.
  19808. *
  19809. * @private
  19810. * @param {*} value The value to wrap.
  19811. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19812. */
  19813. function LodashWrapper(value, chainAll) {
  19814. this.__wrapped__ = value;
  19815. this.__actions__ = [];
  19816. this.__chain__ = !!chainAll;
  19817. this.__index__ = 0;
  19818. this.__values__ = undefined;
  19819. }
  19820. /**
  19821. * By default, the template delimiters used by lodash are like those in
  19822. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19823. * following template settings to use alternative delimiters.
  19824. *
  19825. * @static
  19826. * @memberOf _
  19827. * @type {Object}
  19828. */
  19829. lodash.templateSettings = {
  19830. /**
  19831. * Used to detect `data` property values to be HTML-escaped.
  19832. *
  19833. * @memberOf _.templateSettings
  19834. * @type {RegExp}
  19835. */
  19836. 'escape': reEscape,
  19837. /**
  19838. * Used to detect code to be evaluated.
  19839. *
  19840. * @memberOf _.templateSettings
  19841. * @type {RegExp}
  19842. */
  19843. 'evaluate': reEvaluate,
  19844. /**
  19845. * Used to detect `data` property values to inject.
  19846. *
  19847. * @memberOf _.templateSettings
  19848. * @type {RegExp}
  19849. */
  19850. 'interpolate': reInterpolate,
  19851. /**
  19852. * Used to reference the data object in the template text.
  19853. *
  19854. * @memberOf _.templateSettings
  19855. * @type {string}
  19856. */
  19857. 'variable': '',
  19858. /**
  19859. * Used to import variables into the compiled template.
  19860. *
  19861. * @memberOf _.templateSettings
  19862. * @type {Object}
  19863. */
  19864. 'imports': {
  19865. /**
  19866. * A reference to the `lodash` function.
  19867. *
  19868. * @memberOf _.templateSettings.imports
  19869. * @type {Function}
  19870. */
  19871. '_': lodash
  19872. }
  19873. };
  19874. // Ensure wrappers are instances of `baseLodash`.
  19875. lodash.prototype = baseLodash.prototype;
  19876. lodash.prototype.constructor = lodash;
  19877. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19878. LodashWrapper.prototype.constructor = LodashWrapper;
  19879. /*------------------------------------------------------------------------*/
  19880. /**
  19881. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19882. *
  19883. * @private
  19884. * @constructor
  19885. * @param {*} value The value to wrap.
  19886. */
  19887. function LazyWrapper(value) {
  19888. this.__wrapped__ = value;
  19889. this.__actions__ = [];
  19890. this.__dir__ = 1;
  19891. this.__filtered__ = false;
  19892. this.__iteratees__ = [];
  19893. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19894. this.__views__ = [];
  19895. }
  19896. /**
  19897. * Creates a clone of the lazy wrapper object.
  19898. *
  19899. * @private
  19900. * @name clone
  19901. * @memberOf LazyWrapper
  19902. * @returns {Object} Returns the cloned `LazyWrapper` object.
  19903. */
  19904. function lazyClone() {
  19905. var result = new LazyWrapper(this.__wrapped__);
  19906. result.__actions__ = copyArray(this.__actions__);
  19907. result.__dir__ = this.__dir__;
  19908. result.__filtered__ = this.__filtered__;
  19909. result.__iteratees__ = copyArray(this.__iteratees__);
  19910. result.__takeCount__ = this.__takeCount__;
  19911. result.__views__ = copyArray(this.__views__);
  19912. return result;
  19913. }
  19914. /**
  19915. * Reverses the direction of lazy iteration.
  19916. *
  19917. * @private
  19918. * @name reverse
  19919. * @memberOf LazyWrapper
  19920. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  19921. */
  19922. function lazyReverse() {
  19923. if (this.__filtered__) {
  19924. var result = new LazyWrapper(this);
  19925. result.__dir__ = -1;
  19926. result.__filtered__ = true;
  19927. } else {
  19928. result = this.clone();
  19929. result.__dir__ *= -1;
  19930. }
  19931. return result;
  19932. }
  19933. /**
  19934. * Extracts the unwrapped value from its lazy wrapper.
  19935. *
  19936. * @private
  19937. * @name value
  19938. * @memberOf LazyWrapper
  19939. * @returns {*} Returns the unwrapped value.
  19940. */
  19941. function lazyValue() {
  19942. var array = this.__wrapped__.value(),
  19943. dir = this.__dir__,
  19944. isArr = isArray(array),
  19945. isRight = dir < 0,
  19946. arrLength = isArr ? array.length : 0,
  19947. view = getView(0, arrLength, this.__views__),
  19948. start = view.start,
  19949. end = view.end,
  19950. length = end - start,
  19951. index = isRight ? end : (start - 1),
  19952. iteratees = this.__iteratees__,
  19953. iterLength = iteratees.length,
  19954. resIndex = 0,
  19955. takeCount = nativeMin(length, this.__takeCount__);
  19956. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  19957. return baseWrapperValue(array, this.__actions__);
  19958. }
  19959. var result = [];
  19960. outer:
  19961. while (length-- && resIndex < takeCount) {
  19962. index += dir;
  19963. var iterIndex = -1,
  19964. value = array[index];
  19965. while (++iterIndex < iterLength) {
  19966. var data = iteratees[iterIndex],
  19967. iteratee = data.iteratee,
  19968. type = data.type,
  19969. computed = iteratee(value);
  19970. if (type == LAZY_MAP_FLAG) {
  19971. value = computed;
  19972. } else if (!computed) {
  19973. if (type == LAZY_FILTER_FLAG) {
  19974. continue outer;
  19975. } else {
  19976. break outer;
  19977. }
  19978. }
  19979. }
  19980. result[resIndex++] = value;
  19981. }
  19982. return result;
  19983. }
  19984. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  19985. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  19986. LazyWrapper.prototype.constructor = LazyWrapper;
  19987. /*------------------------------------------------------------------------*/
  19988. /**
  19989. * Creates a hash object.
  19990. *
  19991. * @private
  19992. * @constructor
  19993. * @param {Array} [entries] The key-value pairs to cache.
  19994. */
  19995. function Hash(entries) {
  19996. var index = -1,
  19997. length = entries == null ? 0 : entries.length;
  19998. this.clear();
  19999. while (++index < length) {
  20000. var entry = entries[index];
  20001. this.set(entry[0], entry[1]);
  20002. }
  20003. }
  20004. /**
  20005. * Removes all key-value entries from the hash.
  20006. *
  20007. * @private
  20008. * @name clear
  20009. * @memberOf Hash
  20010. */
  20011. function hashClear() {
  20012. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20013. this.size = 0;
  20014. }
  20015. /**
  20016. * Removes `key` and its value from the hash.
  20017. *
  20018. * @private
  20019. * @name delete
  20020. * @memberOf Hash
  20021. * @param {Object} hash The hash to modify.
  20022. * @param {string} key The key of the value to remove.
  20023. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20024. */
  20025. function hashDelete(key) {
  20026. var result = this.has(key) && delete this.__data__[key];
  20027. this.size -= result ? 1 : 0;
  20028. return result;
  20029. }
  20030. /**
  20031. * Gets the hash value for `key`.
  20032. *
  20033. * @private
  20034. * @name get
  20035. * @memberOf Hash
  20036. * @param {string} key The key of the value to get.
  20037. * @returns {*} Returns the entry value.
  20038. */
  20039. function hashGet(key) {
  20040. var data = this.__data__;
  20041. if (nativeCreate) {
  20042. var result = data[key];
  20043. return result === HASH_UNDEFINED ? undefined : result;
  20044. }
  20045. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20046. }
  20047. /**
  20048. * Checks if a hash value for `key` exists.
  20049. *
  20050. * @private
  20051. * @name has
  20052. * @memberOf Hash
  20053. * @param {string} key The key of the entry to check.
  20054. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20055. */
  20056. function hashHas(key) {
  20057. var data = this.__data__;
  20058. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20059. }
  20060. /**
  20061. * Sets the hash `key` to `value`.
  20062. *
  20063. * @private
  20064. * @name set
  20065. * @memberOf Hash
  20066. * @param {string} key The key of the value to set.
  20067. * @param {*} value The value to set.
  20068. * @returns {Object} Returns the hash instance.
  20069. */
  20070. function hashSet(key, value) {
  20071. var data = this.__data__;
  20072. this.size += this.has(key) ? 0 : 1;
  20073. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20074. return this;
  20075. }
  20076. // Add methods to `Hash`.
  20077. Hash.prototype.clear = hashClear;
  20078. Hash.prototype['delete'] = hashDelete;
  20079. Hash.prototype.get = hashGet;
  20080. Hash.prototype.has = hashHas;
  20081. Hash.prototype.set = hashSet;
  20082. /*------------------------------------------------------------------------*/
  20083. /**
  20084. * Creates an list cache object.
  20085. *
  20086. * @private
  20087. * @constructor
  20088. * @param {Array} [entries] The key-value pairs to cache.
  20089. */
  20090. function ListCache(entries) {
  20091. var index = -1,
  20092. length = entries == null ? 0 : entries.length;
  20093. this.clear();
  20094. while (++index < length) {
  20095. var entry = entries[index];
  20096. this.set(entry[0], entry[1]);
  20097. }
  20098. }
  20099. /**
  20100. * Removes all key-value entries from the list cache.
  20101. *
  20102. * @private
  20103. * @name clear
  20104. * @memberOf ListCache
  20105. */
  20106. function listCacheClear() {
  20107. this.__data__ = [];
  20108. this.size = 0;
  20109. }
  20110. /**
  20111. * Removes `key` and its value from the list cache.
  20112. *
  20113. * @private
  20114. * @name delete
  20115. * @memberOf ListCache
  20116. * @param {string} key The key of the value to remove.
  20117. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20118. */
  20119. function listCacheDelete(key) {
  20120. var data = this.__data__,
  20121. index = assocIndexOf(data, key);
  20122. if (index < 0) {
  20123. return false;
  20124. }
  20125. var lastIndex = data.length - 1;
  20126. if (index == lastIndex) {
  20127. data.pop();
  20128. } else {
  20129. splice.call(data, index, 1);
  20130. }
  20131. --this.size;
  20132. return true;
  20133. }
  20134. /**
  20135. * Gets the list cache value for `key`.
  20136. *
  20137. * @private
  20138. * @name get
  20139. * @memberOf ListCache
  20140. * @param {string} key The key of the value to get.
  20141. * @returns {*} Returns the entry value.
  20142. */
  20143. function listCacheGet(key) {
  20144. var data = this.__data__,
  20145. index = assocIndexOf(data, key);
  20146. return index < 0 ? undefined : data[index][1];
  20147. }
  20148. /**
  20149. * Checks if a list cache value for `key` exists.
  20150. *
  20151. * @private
  20152. * @name has
  20153. * @memberOf ListCache
  20154. * @param {string} key The key of the entry to check.
  20155. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20156. */
  20157. function listCacheHas(key) {
  20158. return assocIndexOf(this.__data__, key) > -1;
  20159. }
  20160. /**
  20161. * Sets the list cache `key` to `value`.
  20162. *
  20163. * @private
  20164. * @name set
  20165. * @memberOf ListCache
  20166. * @param {string} key The key of the value to set.
  20167. * @param {*} value The value to set.
  20168. * @returns {Object} Returns the list cache instance.
  20169. */
  20170. function listCacheSet(key, value) {
  20171. var data = this.__data__,
  20172. index = assocIndexOf(data, key);
  20173. if (index < 0) {
  20174. ++this.size;
  20175. data.push([key, value]);
  20176. } else {
  20177. data[index][1] = value;
  20178. }
  20179. return this;
  20180. }
  20181. // Add methods to `ListCache`.
  20182. ListCache.prototype.clear = listCacheClear;
  20183. ListCache.prototype['delete'] = listCacheDelete;
  20184. ListCache.prototype.get = listCacheGet;
  20185. ListCache.prototype.has = listCacheHas;
  20186. ListCache.prototype.set = listCacheSet;
  20187. /*------------------------------------------------------------------------*/
  20188. /**
  20189. * Creates a map cache object to store key-value pairs.
  20190. *
  20191. * @private
  20192. * @constructor
  20193. * @param {Array} [entries] The key-value pairs to cache.
  20194. */
  20195. function MapCache(entries) {
  20196. var index = -1,
  20197. length = entries == null ? 0 : entries.length;
  20198. this.clear();
  20199. while (++index < length) {
  20200. var entry = entries[index];
  20201. this.set(entry[0], entry[1]);
  20202. }
  20203. }
  20204. /**
  20205. * Removes all key-value entries from the map.
  20206. *
  20207. * @private
  20208. * @name clear
  20209. * @memberOf MapCache
  20210. */
  20211. function mapCacheClear() {
  20212. this.size = 0;
  20213. this.__data__ = {
  20214. 'hash': new Hash,
  20215. 'map': new (Map || ListCache),
  20216. 'string': new Hash
  20217. };
  20218. }
  20219. /**
  20220. * Removes `key` and its value from the map.
  20221. *
  20222. * @private
  20223. * @name delete
  20224. * @memberOf MapCache
  20225. * @param {string} key The key of the value to remove.
  20226. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20227. */
  20228. function mapCacheDelete(key) {
  20229. var result = getMapData(this, key)['delete'](key);
  20230. this.size -= result ? 1 : 0;
  20231. return result;
  20232. }
  20233. /**
  20234. * Gets the map value for `key`.
  20235. *
  20236. * @private
  20237. * @name get
  20238. * @memberOf MapCache
  20239. * @param {string} key The key of the value to get.
  20240. * @returns {*} Returns the entry value.
  20241. */
  20242. function mapCacheGet(key) {
  20243. return getMapData(this, key).get(key);
  20244. }
  20245. /**
  20246. * Checks if a map value for `key` exists.
  20247. *
  20248. * @private
  20249. * @name has
  20250. * @memberOf MapCache
  20251. * @param {string} key The key of the entry to check.
  20252. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20253. */
  20254. function mapCacheHas(key) {
  20255. return getMapData(this, key).has(key);
  20256. }
  20257. /**
  20258. * Sets the map `key` to `value`.
  20259. *
  20260. * @private
  20261. * @name set
  20262. * @memberOf MapCache
  20263. * @param {string} key The key of the value to set.
  20264. * @param {*} value The value to set.
  20265. * @returns {Object} Returns the map cache instance.
  20266. */
  20267. function mapCacheSet(key, value) {
  20268. var data = getMapData(this, key),
  20269. size = data.size;
  20270. data.set(key, value);
  20271. this.size += data.size == size ? 0 : 1;
  20272. return this;
  20273. }
  20274. // Add methods to `MapCache`.
  20275. MapCache.prototype.clear = mapCacheClear;
  20276. MapCache.prototype['delete'] = mapCacheDelete;
  20277. MapCache.prototype.get = mapCacheGet;
  20278. MapCache.prototype.has = mapCacheHas;
  20279. MapCache.prototype.set = mapCacheSet;
  20280. /*------------------------------------------------------------------------*/
  20281. /**
  20282. *
  20283. * Creates an array cache object to store unique values.
  20284. *
  20285. * @private
  20286. * @constructor
  20287. * @param {Array} [values] The values to cache.
  20288. */
  20289. function SetCache(values) {
  20290. var index = -1,
  20291. length = values == null ? 0 : values.length;
  20292. this.__data__ = new MapCache;
  20293. while (++index < length) {
  20294. this.add(values[index]);
  20295. }
  20296. }
  20297. /**
  20298. * Adds `value` to the array cache.
  20299. *
  20300. * @private
  20301. * @name add
  20302. * @memberOf SetCache
  20303. * @alias push
  20304. * @param {*} value The value to cache.
  20305. * @returns {Object} Returns the cache instance.
  20306. */
  20307. function setCacheAdd(value) {
  20308. this.__data__.set(value, HASH_UNDEFINED);
  20309. return this;
  20310. }
  20311. /**
  20312. * Checks if `value` is in the array cache.
  20313. *
  20314. * @private
  20315. * @name has
  20316. * @memberOf SetCache
  20317. * @param {*} value The value to search for.
  20318. * @returns {number} Returns `true` if `value` is found, else `false`.
  20319. */
  20320. function setCacheHas(value) {
  20321. return this.__data__.has(value);
  20322. }
  20323. // Add methods to `SetCache`.
  20324. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20325. SetCache.prototype.has = setCacheHas;
  20326. /*------------------------------------------------------------------------*/
  20327. /**
  20328. * Creates a stack cache object to store key-value pairs.
  20329. *
  20330. * @private
  20331. * @constructor
  20332. * @param {Array} [entries] The key-value pairs to cache.
  20333. */
  20334. function Stack(entries) {
  20335. var data = this.__data__ = new ListCache(entries);
  20336. this.size = data.size;
  20337. }
  20338. /**
  20339. * Removes all key-value entries from the stack.
  20340. *
  20341. * @private
  20342. * @name clear
  20343. * @memberOf Stack
  20344. */
  20345. function stackClear() {
  20346. this.__data__ = new ListCache;
  20347. this.size = 0;
  20348. }
  20349. /**
  20350. * Removes `key` and its value from the stack.
  20351. *
  20352. * @private
  20353. * @name delete
  20354. * @memberOf Stack
  20355. * @param {string} key The key of the value to remove.
  20356. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20357. */
  20358. function stackDelete(key) {
  20359. var data = this.__data__,
  20360. result = data['delete'](key);
  20361. this.size = data.size;
  20362. return result;
  20363. }
  20364. /**
  20365. * Gets the stack value for `key`.
  20366. *
  20367. * @private
  20368. * @name get
  20369. * @memberOf Stack
  20370. * @param {string} key The key of the value to get.
  20371. * @returns {*} Returns the entry value.
  20372. */
  20373. function stackGet(key) {
  20374. return this.__data__.get(key);
  20375. }
  20376. /**
  20377. * Checks if a stack value for `key` exists.
  20378. *
  20379. * @private
  20380. * @name has
  20381. * @memberOf Stack
  20382. * @param {string} key The key of the entry to check.
  20383. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20384. */
  20385. function stackHas(key) {
  20386. return this.__data__.has(key);
  20387. }
  20388. /**
  20389. * Sets the stack `key` to `value`.
  20390. *
  20391. * @private
  20392. * @name set
  20393. * @memberOf Stack
  20394. * @param {string} key The key of the value to set.
  20395. * @param {*} value The value to set.
  20396. * @returns {Object} Returns the stack cache instance.
  20397. */
  20398. function stackSet(key, value) {
  20399. var data = this.__data__;
  20400. if (data instanceof ListCache) {
  20401. var pairs = data.__data__;
  20402. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20403. pairs.push([key, value]);
  20404. this.size = ++data.size;
  20405. return this;
  20406. }
  20407. data = this.__data__ = new MapCache(pairs);
  20408. }
  20409. data.set(key, value);
  20410. this.size = data.size;
  20411. return this;
  20412. }
  20413. // Add methods to `Stack`.
  20414. Stack.prototype.clear = stackClear;
  20415. Stack.prototype['delete'] = stackDelete;
  20416. Stack.prototype.get = stackGet;
  20417. Stack.prototype.has = stackHas;
  20418. Stack.prototype.set = stackSet;
  20419. /*------------------------------------------------------------------------*/
  20420. /**
  20421. * Creates an array of the enumerable property names of the array-like `value`.
  20422. *
  20423. * @private
  20424. * @param {*} value The value to query.
  20425. * @param {boolean} inherited Specify returning inherited property names.
  20426. * @returns {Array} Returns the array of property names.
  20427. */
  20428. function arrayLikeKeys(value, inherited) {
  20429. var isArr = isArray(value),
  20430. isArg = !isArr && isArguments(value),
  20431. isBuff = !isArr && !isArg && isBuffer(value),
  20432. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20433. skipIndexes = isArr || isArg || isBuff || isType,
  20434. result = skipIndexes ? baseTimes(value.length, String) : [],
  20435. length = result.length;
  20436. for (var key in value) {
  20437. if ((inherited || hasOwnProperty.call(value, key)) &&
  20438. !(skipIndexes && (
  20439. // Safari 9 has enumerable `arguments.length` in strict mode.
  20440. key == 'length' ||
  20441. // Node.js 0.10 has enumerable non-index properties on buffers.
  20442. (isBuff && (key == 'offset' || key == 'parent')) ||
  20443. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20444. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20445. // Skip index properties.
  20446. isIndex(key, length)
  20447. ))) {
  20448. result.push(key);
  20449. }
  20450. }
  20451. return result;
  20452. }
  20453. /**
  20454. * A specialized version of `_.sample` for arrays.
  20455. *
  20456. * @private
  20457. * @param {Array} array The array to sample.
  20458. * @returns {*} Returns the random element.
  20459. */
  20460. function arraySample(array) {
  20461. var length = array.length;
  20462. return length ? array[baseRandom(0, length - 1)] : undefined;
  20463. }
  20464. /**
  20465. * A specialized version of `_.sampleSize` for arrays.
  20466. *
  20467. * @private
  20468. * @param {Array} array The array to sample.
  20469. * @param {number} n The number of elements to sample.
  20470. * @returns {Array} Returns the random elements.
  20471. */
  20472. function arraySampleSize(array, n) {
  20473. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20474. }
  20475. /**
  20476. * A specialized version of `_.shuffle` for arrays.
  20477. *
  20478. * @private
  20479. * @param {Array} array The array to shuffle.
  20480. * @returns {Array} Returns the new shuffled array.
  20481. */
  20482. function arrayShuffle(array) {
  20483. return shuffleSelf(copyArray(array));
  20484. }
  20485. /**
  20486. * This function is like `assignValue` except that it doesn't assign
  20487. * `undefined` values.
  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 assignMergeValue(object, key, value) {
  20495. if ((value !== undefined && !eq(object[key], value)) ||
  20496. (value === undefined && !(key in object))) {
  20497. baseAssignValue(object, key, value);
  20498. }
  20499. }
  20500. /**
  20501. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20502. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20503. * for equality comparisons.
  20504. *
  20505. * @private
  20506. * @param {Object} object The object to modify.
  20507. * @param {string} key The key of the property to assign.
  20508. * @param {*} value The value to assign.
  20509. */
  20510. function assignValue(object, key, value) {
  20511. var objValue = object[key];
  20512. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20513. (value === undefined && !(key in object))) {
  20514. baseAssignValue(object, key, value);
  20515. }
  20516. }
  20517. /**
  20518. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20519. *
  20520. * @private
  20521. * @param {Array} array The array to inspect.
  20522. * @param {*} key The key to search for.
  20523. * @returns {number} Returns the index of the matched value, else `-1`.
  20524. */
  20525. function assocIndexOf(array, key) {
  20526. var length = array.length;
  20527. while (length--) {
  20528. if (eq(array[length][0], key)) {
  20529. return length;
  20530. }
  20531. }
  20532. return -1;
  20533. }
  20534. /**
  20535. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20536. * by `iteratee` and values set by `setter`.
  20537. *
  20538. * @private
  20539. * @param {Array|Object} collection The collection to iterate over.
  20540. * @param {Function} setter The function to set `accumulator` values.
  20541. * @param {Function} iteratee The iteratee to transform keys.
  20542. * @param {Object} accumulator The initial aggregated object.
  20543. * @returns {Function} Returns `accumulator`.
  20544. */
  20545. function baseAggregator(collection, setter, iteratee, accumulator) {
  20546. baseEach(collection, function(value, key, collection) {
  20547. setter(accumulator, value, iteratee(value), collection);
  20548. });
  20549. return accumulator;
  20550. }
  20551. /**
  20552. * The base implementation of `_.assign` without support for multiple sources
  20553. * or `customizer` functions.
  20554. *
  20555. * @private
  20556. * @param {Object} object The destination object.
  20557. * @param {Object} source The source object.
  20558. * @returns {Object} Returns `object`.
  20559. */
  20560. function baseAssign(object, source) {
  20561. return object && copyObject(source, keys(source), object);
  20562. }
  20563. /**
  20564. * The base implementation of `_.assignIn` without support for multiple sources
  20565. * or `customizer` functions.
  20566. *
  20567. * @private
  20568. * @param {Object} object The destination object.
  20569. * @param {Object} source The source object.
  20570. * @returns {Object} Returns `object`.
  20571. */
  20572. function baseAssignIn(object, source) {
  20573. return object && copyObject(source, keysIn(source), object);
  20574. }
  20575. /**
  20576. * The base implementation of `assignValue` and `assignMergeValue` without
  20577. * value checks.
  20578. *
  20579. * @private
  20580. * @param {Object} object The object to modify.
  20581. * @param {string} key The key of the property to assign.
  20582. * @param {*} value The value to assign.
  20583. */
  20584. function baseAssignValue(object, key, value) {
  20585. if (key == '__proto__' && defineProperty) {
  20586. defineProperty(object, key, {
  20587. 'configurable': true,
  20588. 'enumerable': true,
  20589. 'value': value,
  20590. 'writable': true
  20591. });
  20592. } else {
  20593. object[key] = value;
  20594. }
  20595. }
  20596. /**
  20597. * The base implementation of `_.at` without support for individual paths.
  20598. *
  20599. * @private
  20600. * @param {Object} object The object to iterate over.
  20601. * @param {string[]} paths The property paths to pick.
  20602. * @returns {Array} Returns the picked elements.
  20603. */
  20604. function baseAt(object, paths) {
  20605. var index = -1,
  20606. length = paths.length,
  20607. result = Array(length),
  20608. skip = object == null;
  20609. while (++index < length) {
  20610. result[index] = skip ? undefined : get(object, paths[index]);
  20611. }
  20612. return result;
  20613. }
  20614. /**
  20615. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20616. *
  20617. * @private
  20618. * @param {number} number The number to clamp.
  20619. * @param {number} [lower] The lower bound.
  20620. * @param {number} upper The upper bound.
  20621. * @returns {number} Returns the clamped number.
  20622. */
  20623. function baseClamp(number, lower, upper) {
  20624. if (number === number) {
  20625. if (upper !== undefined) {
  20626. number = number <= upper ? number : upper;
  20627. }
  20628. if (lower !== undefined) {
  20629. number = number >= lower ? number : lower;
  20630. }
  20631. }
  20632. return number;
  20633. }
  20634. /**
  20635. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20636. * traversed objects.
  20637. *
  20638. * @private
  20639. * @param {*} value The value to clone.
  20640. * @param {boolean} bitmask The bitmask flags.
  20641. * 1 - Deep clone
  20642. * 2 - Flatten inherited properties
  20643. * 4 - Clone symbols
  20644. * @param {Function} [customizer] The function to customize cloning.
  20645. * @param {string} [key] The key of `value`.
  20646. * @param {Object} [object] The parent object of `value`.
  20647. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20648. * @returns {*} Returns the cloned value.
  20649. */
  20650. function baseClone(value, bitmask, customizer, key, object, stack) {
  20651. var result,
  20652. isDeep = bitmask & CLONE_DEEP_FLAG,
  20653. isFlat = bitmask & CLONE_FLAT_FLAG,
  20654. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20655. if (customizer) {
  20656. result = object ? customizer(value, key, object, stack) : customizer(value);
  20657. }
  20658. if (result !== undefined) {
  20659. return result;
  20660. }
  20661. if (!isObject(value)) {
  20662. return value;
  20663. }
  20664. var isArr = isArray(value);
  20665. if (isArr) {
  20666. result = initCloneArray(value);
  20667. if (!isDeep) {
  20668. return copyArray(value, result);
  20669. }
  20670. } else {
  20671. var tag = getTag(value),
  20672. isFunc = tag == funcTag || tag == genTag;
  20673. if (isBuffer(value)) {
  20674. return cloneBuffer(value, isDeep);
  20675. }
  20676. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20677. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20678. if (!isDeep) {
  20679. return isFlat
  20680. ? copySymbolsIn(value, baseAssignIn(result, value))
  20681. : copySymbols(value, baseAssign(result, value));
  20682. }
  20683. } else {
  20684. if (!cloneableTags[tag]) {
  20685. return object ? value : {};
  20686. }
  20687. result = initCloneByTag(value, tag, isDeep);
  20688. }
  20689. }
  20690. // Check for circular references and return its corresponding clone.
  20691. stack || (stack = new Stack);
  20692. var stacked = stack.get(value);
  20693. if (stacked) {
  20694. return stacked;
  20695. }
  20696. stack.set(value, result);
  20697. if (isSet(value)) {
  20698. value.forEach(function(subValue) {
  20699. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20700. });
  20701. } else if (isMap(value)) {
  20702. value.forEach(function(subValue, key) {
  20703. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20704. });
  20705. }
  20706. var keysFunc = isFull
  20707. ? (isFlat ? getAllKeysIn : getAllKeys)
  20708. : (isFlat ? keysIn : keys);
  20709. var props = isArr ? undefined : keysFunc(value);
  20710. arrayEach(props || value, function(subValue, key) {
  20711. if (props) {
  20712. key = subValue;
  20713. subValue = value[key];
  20714. }
  20715. // Recursively populate clone (susceptible to call stack limits).
  20716. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20717. });
  20718. return result;
  20719. }
  20720. /**
  20721. * The base implementation of `_.conforms` which doesn't clone `source`.
  20722. *
  20723. * @private
  20724. * @param {Object} source The object of property predicates to conform to.
  20725. * @returns {Function} Returns the new spec function.
  20726. */
  20727. function baseConforms(source) {
  20728. var props = keys(source);
  20729. return function(object) {
  20730. return baseConformsTo(object, source, props);
  20731. };
  20732. }
  20733. /**
  20734. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20735. *
  20736. * @private
  20737. * @param {Object} object The object to inspect.
  20738. * @param {Object} source The object of property predicates to conform to.
  20739. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20740. */
  20741. function baseConformsTo(object, source, props) {
  20742. var length = props.length;
  20743. if (object == null) {
  20744. return !length;
  20745. }
  20746. object = Object(object);
  20747. while (length--) {
  20748. var key = props[length],
  20749. predicate = source[key],
  20750. value = object[key];
  20751. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20752. return false;
  20753. }
  20754. }
  20755. return true;
  20756. }
  20757. /**
  20758. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20759. * to provide to `func`.
  20760. *
  20761. * @private
  20762. * @param {Function} func The function to delay.
  20763. * @param {number} wait The number of milliseconds to delay invocation.
  20764. * @param {Array} args The arguments to provide to `func`.
  20765. * @returns {number|Object} Returns the timer id or timeout object.
  20766. */
  20767. function baseDelay(func, wait, args) {
  20768. if (typeof func != 'function') {
  20769. throw new TypeError(FUNC_ERROR_TEXT);
  20770. }
  20771. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20772. }
  20773. /**
  20774. * The base implementation of methods like `_.difference` without support
  20775. * for excluding multiple arrays or iteratee shorthands.
  20776. *
  20777. * @private
  20778. * @param {Array} array The array to inspect.
  20779. * @param {Array} values The values to exclude.
  20780. * @param {Function} [iteratee] The iteratee invoked per element.
  20781. * @param {Function} [comparator] The comparator invoked per element.
  20782. * @returns {Array} Returns the new array of filtered values.
  20783. */
  20784. function baseDifference(array, values, iteratee, comparator) {
  20785. var index = -1,
  20786. includes = arrayIncludes,
  20787. isCommon = true,
  20788. length = array.length,
  20789. result = [],
  20790. valuesLength = values.length;
  20791. if (!length) {
  20792. return result;
  20793. }
  20794. if (iteratee) {
  20795. values = arrayMap(values, baseUnary(iteratee));
  20796. }
  20797. if (comparator) {
  20798. includes = arrayIncludesWith;
  20799. isCommon = false;
  20800. }
  20801. else if (values.length >= LARGE_ARRAY_SIZE) {
  20802. includes = cacheHas;
  20803. isCommon = false;
  20804. values = new SetCache(values);
  20805. }
  20806. outer:
  20807. while (++index < length) {
  20808. var value = array[index],
  20809. computed = iteratee == null ? value : iteratee(value);
  20810. value = (comparator || value !== 0) ? value : 0;
  20811. if (isCommon && computed === computed) {
  20812. var valuesIndex = valuesLength;
  20813. while (valuesIndex--) {
  20814. if (values[valuesIndex] === computed) {
  20815. continue outer;
  20816. }
  20817. }
  20818. result.push(value);
  20819. }
  20820. else if (!includes(values, computed, comparator)) {
  20821. result.push(value);
  20822. }
  20823. }
  20824. return result;
  20825. }
  20826. /**
  20827. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20828. *
  20829. * @private
  20830. * @param {Array|Object} collection The collection to iterate over.
  20831. * @param {Function} iteratee The function invoked per iteration.
  20832. * @returns {Array|Object} Returns `collection`.
  20833. */
  20834. var baseEach = createBaseEach(baseForOwn);
  20835. /**
  20836. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20837. *
  20838. * @private
  20839. * @param {Array|Object} collection The collection to iterate over.
  20840. * @param {Function} iteratee The function invoked per iteration.
  20841. * @returns {Array|Object} Returns `collection`.
  20842. */
  20843. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20844. /**
  20845. * The base implementation of `_.every` without support for iteratee shorthands.
  20846. *
  20847. * @private
  20848. * @param {Array|Object} collection The collection to iterate over.
  20849. * @param {Function} predicate The function invoked per iteration.
  20850. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20851. * else `false`
  20852. */
  20853. function baseEvery(collection, predicate) {
  20854. var result = true;
  20855. baseEach(collection, function(value, index, collection) {
  20856. result = !!predicate(value, index, collection);
  20857. return result;
  20858. });
  20859. return result;
  20860. }
  20861. /**
  20862. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20863. * `comparator` to determine the extremum value.
  20864. *
  20865. * @private
  20866. * @param {Array} array The array to iterate over.
  20867. * @param {Function} iteratee The iteratee invoked per iteration.
  20868. * @param {Function} comparator The comparator used to compare values.
  20869. * @returns {*} Returns the extremum value.
  20870. */
  20871. function baseExtremum(array, iteratee, comparator) {
  20872. var index = -1,
  20873. length = array.length;
  20874. while (++index < length) {
  20875. var value = array[index],
  20876. current = iteratee(value);
  20877. if (current != null && (computed === undefined
  20878. ? (current === current && !isSymbol(current))
  20879. : comparator(current, computed)
  20880. )) {
  20881. var computed = current,
  20882. result = value;
  20883. }
  20884. }
  20885. return result;
  20886. }
  20887. /**
  20888. * The base implementation of `_.fill` without an iteratee call guard.
  20889. *
  20890. * @private
  20891. * @param {Array} array The array to fill.
  20892. * @param {*} value The value to fill `array` with.
  20893. * @param {number} [start=0] The start position.
  20894. * @param {number} [end=array.length] The end position.
  20895. * @returns {Array} Returns `array`.
  20896. */
  20897. function baseFill(array, value, start, end) {
  20898. var length = array.length;
  20899. start = toInteger(start);
  20900. if (start < 0) {
  20901. start = -start > length ? 0 : (length + start);
  20902. }
  20903. end = (end === undefined || end > length) ? length : toInteger(end);
  20904. if (end < 0) {
  20905. end += length;
  20906. }
  20907. end = start > end ? 0 : toLength(end);
  20908. while (start < end) {
  20909. array[start++] = value;
  20910. }
  20911. return array;
  20912. }
  20913. /**
  20914. * The base implementation of `_.filter` without support for iteratee shorthands.
  20915. *
  20916. * @private
  20917. * @param {Array|Object} collection The collection to iterate over.
  20918. * @param {Function} predicate The function invoked per iteration.
  20919. * @returns {Array} Returns the new filtered array.
  20920. */
  20921. function baseFilter(collection, predicate) {
  20922. var result = [];
  20923. baseEach(collection, function(value, index, collection) {
  20924. if (predicate(value, index, collection)) {
  20925. result.push(value);
  20926. }
  20927. });
  20928. return result;
  20929. }
  20930. /**
  20931. * The base implementation of `_.flatten` with support for restricting flattening.
  20932. *
  20933. * @private
  20934. * @param {Array} array The array to flatten.
  20935. * @param {number} depth The maximum recursion depth.
  20936. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  20937. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  20938. * @param {Array} [result=[]] The initial result value.
  20939. * @returns {Array} Returns the new flattened array.
  20940. */
  20941. function baseFlatten(array, depth, predicate, isStrict, result) {
  20942. var index = -1,
  20943. length = array.length;
  20944. predicate || (predicate = isFlattenable);
  20945. result || (result = []);
  20946. while (++index < length) {
  20947. var value = array[index];
  20948. if (depth > 0 && predicate(value)) {
  20949. if (depth > 1) {
  20950. // Recursively flatten arrays (susceptible to call stack limits).
  20951. baseFlatten(value, depth - 1, predicate, isStrict, result);
  20952. } else {
  20953. arrayPush(result, value);
  20954. }
  20955. } else if (!isStrict) {
  20956. result[result.length] = value;
  20957. }
  20958. }
  20959. return result;
  20960. }
  20961. /**
  20962. * The base implementation of `baseForOwn` which iterates over `object`
  20963. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  20964. * Iteratee functions may exit iteration early by explicitly returning `false`.
  20965. *
  20966. * @private
  20967. * @param {Object} object The object to iterate over.
  20968. * @param {Function} iteratee The function invoked per iteration.
  20969. * @param {Function} keysFunc The function to get the keys of `object`.
  20970. * @returns {Object} Returns `object`.
  20971. */
  20972. var baseFor = createBaseFor();
  20973. /**
  20974. * This function is like `baseFor` except that it iterates over properties
  20975. * in the opposite order.
  20976. *
  20977. * @private
  20978. * @param {Object} object The object to iterate over.
  20979. * @param {Function} iteratee The function invoked per iteration.
  20980. * @param {Function} keysFunc The function to get the keys of `object`.
  20981. * @returns {Object} Returns `object`.
  20982. */
  20983. var baseForRight = createBaseFor(true);
  20984. /**
  20985. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  20986. *
  20987. * @private
  20988. * @param {Object} object The object to iterate over.
  20989. * @param {Function} iteratee The function invoked per iteration.
  20990. * @returns {Object} Returns `object`.
  20991. */
  20992. function baseForOwn(object, iteratee) {
  20993. return object && baseFor(object, iteratee, keys);
  20994. }
  20995. /**
  20996. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  20997. *
  20998. * @private
  20999. * @param {Object} object The object to iterate over.
  21000. * @param {Function} iteratee The function invoked per iteration.
  21001. * @returns {Object} Returns `object`.
  21002. */
  21003. function baseForOwnRight(object, iteratee) {
  21004. return object && baseForRight(object, iteratee, keys);
  21005. }
  21006. /**
  21007. * The base implementation of `_.functions` which creates an array of
  21008. * `object` function property names filtered from `props`.
  21009. *
  21010. * @private
  21011. * @param {Object} object The object to inspect.
  21012. * @param {Array} props The property names to filter.
  21013. * @returns {Array} Returns the function names.
  21014. */
  21015. function baseFunctions(object, props) {
  21016. return arrayFilter(props, function(key) {
  21017. return isFunction(object[key]);
  21018. });
  21019. }
  21020. /**
  21021. * The base implementation of `_.get` without support for default values.
  21022. *
  21023. * @private
  21024. * @param {Object} object The object to query.
  21025. * @param {Array|string} path The path of the property to get.
  21026. * @returns {*} Returns the resolved value.
  21027. */
  21028. function baseGet(object, path) {
  21029. path = castPath(path, object);
  21030. var index = 0,
  21031. length = path.length;
  21032. while (object != null && index < length) {
  21033. object = object[toKey(path[index++])];
  21034. }
  21035. return (index && index == length) ? object : undefined;
  21036. }
  21037. /**
  21038. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21039. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21040. * symbols of `object`.
  21041. *
  21042. * @private
  21043. * @param {Object} object The object to query.
  21044. * @param {Function} keysFunc The function to get the keys of `object`.
  21045. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21046. * @returns {Array} Returns the array of property names and symbols.
  21047. */
  21048. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21049. var result = keysFunc(object);
  21050. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21051. }
  21052. /**
  21053. * The base implementation of `getTag` without fallbacks for buggy environments.
  21054. *
  21055. * @private
  21056. * @param {*} value The value to query.
  21057. * @returns {string} Returns the `toStringTag`.
  21058. */
  21059. function baseGetTag(value) {
  21060. if (value == null) {
  21061. return value === undefined ? undefinedTag : nullTag;
  21062. }
  21063. return (symToStringTag && symToStringTag in Object(value))
  21064. ? getRawTag(value)
  21065. : objectToString(value);
  21066. }
  21067. /**
  21068. * The base implementation of `_.gt` which doesn't coerce arguments.
  21069. *
  21070. * @private
  21071. * @param {*} value The value to compare.
  21072. * @param {*} other The other value to compare.
  21073. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21074. * else `false`.
  21075. */
  21076. function baseGt(value, other) {
  21077. return value > other;
  21078. }
  21079. /**
  21080. * The base implementation of `_.has` without support for deep paths.
  21081. *
  21082. * @private
  21083. * @param {Object} [object] The object to query.
  21084. * @param {Array|string} key The key to check.
  21085. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21086. */
  21087. function baseHas(object, key) {
  21088. return object != null && hasOwnProperty.call(object, key);
  21089. }
  21090. /**
  21091. * The base implementation of `_.hasIn` without support for deep paths.
  21092. *
  21093. * @private
  21094. * @param {Object} [object] The object to query.
  21095. * @param {Array|string} key The key to check.
  21096. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21097. */
  21098. function baseHasIn(object, key) {
  21099. return object != null && key in Object(object);
  21100. }
  21101. /**
  21102. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21103. *
  21104. * @private
  21105. * @param {number} number The number to check.
  21106. * @param {number} start The start of the range.
  21107. * @param {number} end The end of the range.
  21108. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21109. */
  21110. function baseInRange(number, start, end) {
  21111. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21112. }
  21113. /**
  21114. * The base implementation of methods like `_.intersection`, without support
  21115. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21116. *
  21117. * @private
  21118. * @param {Array} arrays The arrays to inspect.
  21119. * @param {Function} [iteratee] The iteratee invoked per element.
  21120. * @param {Function} [comparator] The comparator invoked per element.
  21121. * @returns {Array} Returns the new array of shared values.
  21122. */
  21123. function baseIntersection(arrays, iteratee, comparator) {
  21124. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21125. length = arrays[0].length,
  21126. othLength = arrays.length,
  21127. othIndex = othLength,
  21128. caches = Array(othLength),
  21129. maxLength = Infinity,
  21130. result = [];
  21131. while (othIndex--) {
  21132. var array = arrays[othIndex];
  21133. if (othIndex && iteratee) {
  21134. array = arrayMap(array, baseUnary(iteratee));
  21135. }
  21136. maxLength = nativeMin(array.length, maxLength);
  21137. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21138. ? new SetCache(othIndex && array)
  21139. : undefined;
  21140. }
  21141. array = arrays[0];
  21142. var index = -1,
  21143. seen = caches[0];
  21144. outer:
  21145. while (++index < length && result.length < maxLength) {
  21146. var value = array[index],
  21147. computed = iteratee ? iteratee(value) : value;
  21148. value = (comparator || value !== 0) ? value : 0;
  21149. if (!(seen
  21150. ? cacheHas(seen, computed)
  21151. : includes(result, computed, comparator)
  21152. )) {
  21153. othIndex = othLength;
  21154. while (--othIndex) {
  21155. var cache = caches[othIndex];
  21156. if (!(cache
  21157. ? cacheHas(cache, computed)
  21158. : includes(arrays[othIndex], computed, comparator))
  21159. ) {
  21160. continue outer;
  21161. }
  21162. }
  21163. if (seen) {
  21164. seen.push(computed);
  21165. }
  21166. result.push(value);
  21167. }
  21168. }
  21169. return result;
  21170. }
  21171. /**
  21172. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21173. * `object` with values transformed by `iteratee` and set by `setter`.
  21174. *
  21175. * @private
  21176. * @param {Object} object The object to iterate over.
  21177. * @param {Function} setter The function to set `accumulator` values.
  21178. * @param {Function} iteratee The iteratee to transform values.
  21179. * @param {Object} accumulator The initial inverted object.
  21180. * @returns {Function} Returns `accumulator`.
  21181. */
  21182. function baseInverter(object, setter, iteratee, accumulator) {
  21183. baseForOwn(object, function(value, key, object) {
  21184. setter(accumulator, iteratee(value), key, object);
  21185. });
  21186. return accumulator;
  21187. }
  21188. /**
  21189. * The base implementation of `_.invoke` without support for individual
  21190. * method arguments.
  21191. *
  21192. * @private
  21193. * @param {Object} object The object to query.
  21194. * @param {Array|string} path The path of the method to invoke.
  21195. * @param {Array} args The arguments to invoke the method with.
  21196. * @returns {*} Returns the result of the invoked method.
  21197. */
  21198. function baseInvoke(object, path, args) {
  21199. path = castPath(path, object);
  21200. object = parent(object, path);
  21201. var func = object == null ? object : object[toKey(last(path))];
  21202. return func == null ? undefined : apply(func, object, args);
  21203. }
  21204. /**
  21205. * The base implementation of `_.isArguments`.
  21206. *
  21207. * @private
  21208. * @param {*} value The value to check.
  21209. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21210. */
  21211. function baseIsArguments(value) {
  21212. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21213. }
  21214. /**
  21215. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21216. *
  21217. * @private
  21218. * @param {*} value The value to check.
  21219. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21220. */
  21221. function baseIsArrayBuffer(value) {
  21222. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21223. }
  21224. /**
  21225. * The base implementation of `_.isDate` without Node.js optimizations.
  21226. *
  21227. * @private
  21228. * @param {*} value The value to check.
  21229. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21230. */
  21231. function baseIsDate(value) {
  21232. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21233. }
  21234. /**
  21235. * The base implementation of `_.isEqual` which supports partial comparisons
  21236. * and tracks traversed objects.
  21237. *
  21238. * @private
  21239. * @param {*} value The value to compare.
  21240. * @param {*} other The other value to compare.
  21241. * @param {boolean} bitmask The bitmask flags.
  21242. * 1 - Unordered comparison
  21243. * 2 - Partial comparison
  21244. * @param {Function} [customizer] The function to customize comparisons.
  21245. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21246. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21247. */
  21248. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21249. if (value === other) {
  21250. return true;
  21251. }
  21252. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21253. return value !== value && other !== other;
  21254. }
  21255. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21256. }
  21257. /**
  21258. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21259. * deep comparisons and tracks traversed objects enabling objects with circular
  21260. * references to be compared.
  21261. *
  21262. * @private
  21263. * @param {Object} object The object to compare.
  21264. * @param {Object} other The other object to compare.
  21265. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21266. * @param {Function} customizer The function to customize comparisons.
  21267. * @param {Function} equalFunc The function to determine equivalents of values.
  21268. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21269. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21270. */
  21271. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21272. var objIsArr = isArray(object),
  21273. othIsArr = isArray(other),
  21274. objTag = objIsArr ? arrayTag : getTag(object),
  21275. othTag = othIsArr ? arrayTag : getTag(other);
  21276. objTag = objTag == argsTag ? objectTag : objTag;
  21277. othTag = othTag == argsTag ? objectTag : othTag;
  21278. var objIsObj = objTag == objectTag,
  21279. othIsObj = othTag == objectTag,
  21280. isSameTag = objTag == othTag;
  21281. if (isSameTag && isBuffer(object)) {
  21282. if (!isBuffer(other)) {
  21283. return false;
  21284. }
  21285. objIsArr = true;
  21286. objIsObj = false;
  21287. }
  21288. if (isSameTag && !objIsObj) {
  21289. stack || (stack = new Stack);
  21290. return (objIsArr || isTypedArray(object))
  21291. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21292. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21293. }
  21294. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21295. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21296. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21297. if (objIsWrapped || othIsWrapped) {
  21298. var objUnwrapped = objIsWrapped ? object.value() : object,
  21299. othUnwrapped = othIsWrapped ? other.value() : other;
  21300. stack || (stack = new Stack);
  21301. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21302. }
  21303. }
  21304. if (!isSameTag) {
  21305. return false;
  21306. }
  21307. stack || (stack = new Stack);
  21308. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21309. }
  21310. /**
  21311. * The base implementation of `_.isMap` without Node.js optimizations.
  21312. *
  21313. * @private
  21314. * @param {*} value The value to check.
  21315. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21316. */
  21317. function baseIsMap(value) {
  21318. return isObjectLike(value) && getTag(value) == mapTag;
  21319. }
  21320. /**
  21321. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21322. *
  21323. * @private
  21324. * @param {Object} object The object to inspect.
  21325. * @param {Object} source The object of property values to match.
  21326. * @param {Array} matchData The property names, values, and compare flags to match.
  21327. * @param {Function} [customizer] The function to customize comparisons.
  21328. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21329. */
  21330. function baseIsMatch(object, source, matchData, customizer) {
  21331. var index = matchData.length,
  21332. length = index,
  21333. noCustomizer = !customizer;
  21334. if (object == null) {
  21335. return !length;
  21336. }
  21337. object = Object(object);
  21338. while (index--) {
  21339. var data = matchData[index];
  21340. if ((noCustomizer && data[2])
  21341. ? data[1] !== object[data[0]]
  21342. : !(data[0] in object)
  21343. ) {
  21344. return false;
  21345. }
  21346. }
  21347. while (++index < length) {
  21348. data = matchData[index];
  21349. var key = data[0],
  21350. objValue = object[key],
  21351. srcValue = data[1];
  21352. if (noCustomizer && data[2]) {
  21353. if (objValue === undefined && !(key in object)) {
  21354. return false;
  21355. }
  21356. } else {
  21357. var stack = new Stack;
  21358. if (customizer) {
  21359. var result = customizer(objValue, srcValue, key, object, source, stack);
  21360. }
  21361. if (!(result === undefined
  21362. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21363. : result
  21364. )) {
  21365. return false;
  21366. }
  21367. }
  21368. }
  21369. return true;
  21370. }
  21371. /**
  21372. * The base implementation of `_.isNative` without bad shim checks.
  21373. *
  21374. * @private
  21375. * @param {*} value The value to check.
  21376. * @returns {boolean} Returns `true` if `value` is a native function,
  21377. * else `false`.
  21378. */
  21379. function baseIsNative(value) {
  21380. if (!isObject(value) || isMasked(value)) {
  21381. return false;
  21382. }
  21383. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21384. return pattern.test(toSource(value));
  21385. }
  21386. /**
  21387. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21388. *
  21389. * @private
  21390. * @param {*} value The value to check.
  21391. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21392. */
  21393. function baseIsRegExp(value) {
  21394. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21395. }
  21396. /**
  21397. * The base implementation of `_.isSet` without Node.js optimizations.
  21398. *
  21399. * @private
  21400. * @param {*} value The value to check.
  21401. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21402. */
  21403. function baseIsSet(value) {
  21404. return isObjectLike(value) && getTag(value) == setTag;
  21405. }
  21406. /**
  21407. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21408. *
  21409. * @private
  21410. * @param {*} value The value to check.
  21411. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21412. */
  21413. function baseIsTypedArray(value) {
  21414. return isObjectLike(value) &&
  21415. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21416. }
  21417. /**
  21418. * The base implementation of `_.iteratee`.
  21419. *
  21420. * @private
  21421. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21422. * @returns {Function} Returns the iteratee.
  21423. */
  21424. function baseIteratee(value) {
  21425. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21426. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21427. if (typeof value == 'function') {
  21428. return value;
  21429. }
  21430. if (value == null) {
  21431. return identity;
  21432. }
  21433. if (typeof value == 'object') {
  21434. return isArray(value)
  21435. ? baseMatchesProperty(value[0], value[1])
  21436. : baseMatches(value);
  21437. }
  21438. return property(value);
  21439. }
  21440. /**
  21441. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21442. *
  21443. * @private
  21444. * @param {Object} object The object to query.
  21445. * @returns {Array} Returns the array of property names.
  21446. */
  21447. function baseKeys(object) {
  21448. if (!isPrototype(object)) {
  21449. return nativeKeys(object);
  21450. }
  21451. var result = [];
  21452. for (var key in Object(object)) {
  21453. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21454. result.push(key);
  21455. }
  21456. }
  21457. return result;
  21458. }
  21459. /**
  21460. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21461. *
  21462. * @private
  21463. * @param {Object} object The object to query.
  21464. * @returns {Array} Returns the array of property names.
  21465. */
  21466. function baseKeysIn(object) {
  21467. if (!isObject(object)) {
  21468. return nativeKeysIn(object);
  21469. }
  21470. var isProto = isPrototype(object),
  21471. result = [];
  21472. for (var key in object) {
  21473. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21474. result.push(key);
  21475. }
  21476. }
  21477. return result;
  21478. }
  21479. /**
  21480. * The base implementation of `_.lt` which doesn't coerce arguments.
  21481. *
  21482. * @private
  21483. * @param {*} value The value to compare.
  21484. * @param {*} other The other value to compare.
  21485. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21486. * else `false`.
  21487. */
  21488. function baseLt(value, other) {
  21489. return value < other;
  21490. }
  21491. /**
  21492. * The base implementation of `_.map` without support for iteratee shorthands.
  21493. *
  21494. * @private
  21495. * @param {Array|Object} collection The collection to iterate over.
  21496. * @param {Function} iteratee The function invoked per iteration.
  21497. * @returns {Array} Returns the new mapped array.
  21498. */
  21499. function baseMap(collection, iteratee) {
  21500. var index = -1,
  21501. result = isArrayLike(collection) ? Array(collection.length) : [];
  21502. baseEach(collection, function(value, key, collection) {
  21503. result[++index] = iteratee(value, key, collection);
  21504. });
  21505. return result;
  21506. }
  21507. /**
  21508. * The base implementation of `_.matches` which doesn't clone `source`.
  21509. *
  21510. * @private
  21511. * @param {Object} source The object of property values to match.
  21512. * @returns {Function} Returns the new spec function.
  21513. */
  21514. function baseMatches(source) {
  21515. var matchData = getMatchData(source);
  21516. if (matchData.length == 1 && matchData[0][2]) {
  21517. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21518. }
  21519. return function(object) {
  21520. return object === source || baseIsMatch(object, source, matchData);
  21521. };
  21522. }
  21523. /**
  21524. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21525. *
  21526. * @private
  21527. * @param {string} path The path of the property to get.
  21528. * @param {*} srcValue The value to match.
  21529. * @returns {Function} Returns the new spec function.
  21530. */
  21531. function baseMatchesProperty(path, srcValue) {
  21532. if (isKey(path) && isStrictComparable(srcValue)) {
  21533. return matchesStrictComparable(toKey(path), srcValue);
  21534. }
  21535. return function(object) {
  21536. var objValue = get(object, path);
  21537. return (objValue === undefined && objValue === srcValue)
  21538. ? hasIn(object, path)
  21539. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21540. };
  21541. }
  21542. /**
  21543. * The base implementation of `_.merge` without support for multiple sources.
  21544. *
  21545. * @private
  21546. * @param {Object} object The destination object.
  21547. * @param {Object} source The source object.
  21548. * @param {number} srcIndex The index of `source`.
  21549. * @param {Function} [customizer] The function to customize merged values.
  21550. * @param {Object} [stack] Tracks traversed source values and their merged
  21551. * counterparts.
  21552. */
  21553. function baseMerge(object, source, srcIndex, customizer, stack) {
  21554. if (object === source) {
  21555. return;
  21556. }
  21557. baseFor(source, function(srcValue, key) {
  21558. stack || (stack = new Stack);
  21559. if (isObject(srcValue)) {
  21560. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21561. }
  21562. else {
  21563. var newValue = customizer
  21564. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21565. : undefined;
  21566. if (newValue === undefined) {
  21567. newValue = srcValue;
  21568. }
  21569. assignMergeValue(object, key, newValue);
  21570. }
  21571. }, keysIn);
  21572. }
  21573. /**
  21574. * A specialized version of `baseMerge` for arrays and objects which performs
  21575. * deep merges and tracks traversed objects enabling objects with circular
  21576. * references to be merged.
  21577. *
  21578. * @private
  21579. * @param {Object} object The destination object.
  21580. * @param {Object} source The source object.
  21581. * @param {string} key The key of the value to merge.
  21582. * @param {number} srcIndex The index of `source`.
  21583. * @param {Function} mergeFunc The function to merge values.
  21584. * @param {Function} [customizer] The function to customize assigned values.
  21585. * @param {Object} [stack] Tracks traversed source values and their merged
  21586. * counterparts.
  21587. */
  21588. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21589. var objValue = safeGet(object, key),
  21590. srcValue = safeGet(source, key),
  21591. stacked = stack.get(srcValue);
  21592. if (stacked) {
  21593. assignMergeValue(object, key, stacked);
  21594. return;
  21595. }
  21596. var newValue = customizer
  21597. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21598. : undefined;
  21599. var isCommon = newValue === undefined;
  21600. if (isCommon) {
  21601. var isArr = isArray(srcValue),
  21602. isBuff = !isArr && isBuffer(srcValue),
  21603. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21604. newValue = srcValue;
  21605. if (isArr || isBuff || isTyped) {
  21606. if (isArray(objValue)) {
  21607. newValue = objValue;
  21608. }
  21609. else if (isArrayLikeObject(objValue)) {
  21610. newValue = copyArray(objValue);
  21611. }
  21612. else if (isBuff) {
  21613. isCommon = false;
  21614. newValue = cloneBuffer(srcValue, true);
  21615. }
  21616. else if (isTyped) {
  21617. isCommon = false;
  21618. newValue = cloneTypedArray(srcValue, true);
  21619. }
  21620. else {
  21621. newValue = [];
  21622. }
  21623. }
  21624. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21625. newValue = objValue;
  21626. if (isArguments(objValue)) {
  21627. newValue = toPlainObject(objValue);
  21628. }
  21629. else if (!isObject(objValue) || isFunction(objValue)) {
  21630. newValue = initCloneObject(srcValue);
  21631. }
  21632. }
  21633. else {
  21634. isCommon = false;
  21635. }
  21636. }
  21637. if (isCommon) {
  21638. // Recursively merge objects and arrays (susceptible to call stack limits).
  21639. stack.set(srcValue, newValue);
  21640. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21641. stack['delete'](srcValue);
  21642. }
  21643. assignMergeValue(object, key, newValue);
  21644. }
  21645. /**
  21646. * The base implementation of `_.nth` which doesn't coerce arguments.
  21647. *
  21648. * @private
  21649. * @param {Array} array The array to query.
  21650. * @param {number} n The index of the element to return.
  21651. * @returns {*} Returns the nth element of `array`.
  21652. */
  21653. function baseNth(array, n) {
  21654. var length = array.length;
  21655. if (!length) {
  21656. return;
  21657. }
  21658. n += n < 0 ? length : 0;
  21659. return isIndex(n, length) ? array[n] : undefined;
  21660. }
  21661. /**
  21662. * The base implementation of `_.orderBy` without param guards.
  21663. *
  21664. * @private
  21665. * @param {Array|Object} collection The collection to iterate over.
  21666. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21667. * @param {string[]} orders The sort orders of `iteratees`.
  21668. * @returns {Array} Returns the new sorted array.
  21669. */
  21670. function baseOrderBy(collection, iteratees, orders) {
  21671. var index = -1;
  21672. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21673. var result = baseMap(collection, function(value, key, collection) {
  21674. var criteria = arrayMap(iteratees, function(iteratee) {
  21675. return iteratee(value);
  21676. });
  21677. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21678. });
  21679. return baseSortBy(result, function(object, other) {
  21680. return compareMultiple(object, other, orders);
  21681. });
  21682. }
  21683. /**
  21684. * The base implementation of `_.pick` without support for individual
  21685. * property identifiers.
  21686. *
  21687. * @private
  21688. * @param {Object} object The source object.
  21689. * @param {string[]} paths The property paths to pick.
  21690. * @returns {Object} Returns the new object.
  21691. */
  21692. function basePick(object, paths) {
  21693. return basePickBy(object, paths, function(value, path) {
  21694. return hasIn(object, path);
  21695. });
  21696. }
  21697. /**
  21698. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21699. *
  21700. * @private
  21701. * @param {Object} object The source object.
  21702. * @param {string[]} paths The property paths to pick.
  21703. * @param {Function} predicate The function invoked per property.
  21704. * @returns {Object} Returns the new object.
  21705. */
  21706. function basePickBy(object, paths, predicate) {
  21707. var index = -1,
  21708. length = paths.length,
  21709. result = {};
  21710. while (++index < length) {
  21711. var path = paths[index],
  21712. value = baseGet(object, path);
  21713. if (predicate(value, path)) {
  21714. baseSet(result, castPath(path, object), value);
  21715. }
  21716. }
  21717. return result;
  21718. }
  21719. /**
  21720. * A specialized version of `baseProperty` which supports deep paths.
  21721. *
  21722. * @private
  21723. * @param {Array|string} path The path of the property to get.
  21724. * @returns {Function} Returns the new accessor function.
  21725. */
  21726. function basePropertyDeep(path) {
  21727. return function(object) {
  21728. return baseGet(object, path);
  21729. };
  21730. }
  21731. /**
  21732. * The base implementation of `_.pullAllBy` without support for iteratee
  21733. * shorthands.
  21734. *
  21735. * @private
  21736. * @param {Array} array The array to modify.
  21737. * @param {Array} values The values to remove.
  21738. * @param {Function} [iteratee] The iteratee invoked per element.
  21739. * @param {Function} [comparator] The comparator invoked per element.
  21740. * @returns {Array} Returns `array`.
  21741. */
  21742. function basePullAll(array, values, iteratee, comparator) {
  21743. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21744. index = -1,
  21745. length = values.length,
  21746. seen = array;
  21747. if (array === values) {
  21748. values = copyArray(values);
  21749. }
  21750. if (iteratee) {
  21751. seen = arrayMap(array, baseUnary(iteratee));
  21752. }
  21753. while (++index < length) {
  21754. var fromIndex = 0,
  21755. value = values[index],
  21756. computed = iteratee ? iteratee(value) : value;
  21757. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21758. if (seen !== array) {
  21759. splice.call(seen, fromIndex, 1);
  21760. }
  21761. splice.call(array, fromIndex, 1);
  21762. }
  21763. }
  21764. return array;
  21765. }
  21766. /**
  21767. * The base implementation of `_.pullAt` without support for individual
  21768. * indexes or capturing the removed elements.
  21769. *
  21770. * @private
  21771. * @param {Array} array The array to modify.
  21772. * @param {number[]} indexes The indexes of elements to remove.
  21773. * @returns {Array} Returns `array`.
  21774. */
  21775. function basePullAt(array, indexes) {
  21776. var length = array ? indexes.length : 0,
  21777. lastIndex = length - 1;
  21778. while (length--) {
  21779. var index = indexes[length];
  21780. if (length == lastIndex || index !== previous) {
  21781. var previous = index;
  21782. if (isIndex(index)) {
  21783. splice.call(array, index, 1);
  21784. } else {
  21785. baseUnset(array, index);
  21786. }
  21787. }
  21788. }
  21789. return array;
  21790. }
  21791. /**
  21792. * The base implementation of `_.random` without support for returning
  21793. * floating-point numbers.
  21794. *
  21795. * @private
  21796. * @param {number} lower The lower bound.
  21797. * @param {number} upper The upper bound.
  21798. * @returns {number} Returns the random number.
  21799. */
  21800. function baseRandom(lower, upper) {
  21801. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21802. }
  21803. /**
  21804. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21805. * coerce arguments.
  21806. *
  21807. * @private
  21808. * @param {number} start The start of the range.
  21809. * @param {number} end The end of the range.
  21810. * @param {number} step The value to increment or decrement by.
  21811. * @param {boolean} [fromRight] Specify iterating from right to left.
  21812. * @returns {Array} Returns the range of numbers.
  21813. */
  21814. function baseRange(start, end, step, fromRight) {
  21815. var index = -1,
  21816. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21817. result = Array(length);
  21818. while (length--) {
  21819. result[fromRight ? length : ++index] = start;
  21820. start += step;
  21821. }
  21822. return result;
  21823. }
  21824. /**
  21825. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21826. *
  21827. * @private
  21828. * @param {string} string The string to repeat.
  21829. * @param {number} n The number of times to repeat the string.
  21830. * @returns {string} Returns the repeated string.
  21831. */
  21832. function baseRepeat(string, n) {
  21833. var result = '';
  21834. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21835. return result;
  21836. }
  21837. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21838. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21839. do {
  21840. if (n % 2) {
  21841. result += string;
  21842. }
  21843. n = nativeFloor(n / 2);
  21844. if (n) {
  21845. string += string;
  21846. }
  21847. } while (n);
  21848. return result;
  21849. }
  21850. /**
  21851. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21852. *
  21853. * @private
  21854. * @param {Function} func The function to apply a rest parameter to.
  21855. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21856. * @returns {Function} Returns the new function.
  21857. */
  21858. function baseRest(func, start) {
  21859. return setToString(overRest(func, start, identity), func + '');
  21860. }
  21861. /**
  21862. * The base implementation of `_.sample`.
  21863. *
  21864. * @private
  21865. * @param {Array|Object} collection The collection to sample.
  21866. * @returns {*} Returns the random element.
  21867. */
  21868. function baseSample(collection) {
  21869. return arraySample(values(collection));
  21870. }
  21871. /**
  21872. * The base implementation of `_.sampleSize` without param guards.
  21873. *
  21874. * @private
  21875. * @param {Array|Object} collection The collection to sample.
  21876. * @param {number} n The number of elements to sample.
  21877. * @returns {Array} Returns the random elements.
  21878. */
  21879. function baseSampleSize(collection, n) {
  21880. var array = values(collection);
  21881. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21882. }
  21883. /**
  21884. * The base implementation of `_.set`.
  21885. *
  21886. * @private
  21887. * @param {Object} object The object to modify.
  21888. * @param {Array|string} path The path of the property to set.
  21889. * @param {*} value The value to set.
  21890. * @param {Function} [customizer] The function to customize path creation.
  21891. * @returns {Object} Returns `object`.
  21892. */
  21893. function baseSet(object, path, value, customizer) {
  21894. if (!isObject(object)) {
  21895. return object;
  21896. }
  21897. path = castPath(path, object);
  21898. var index = -1,
  21899. length = path.length,
  21900. lastIndex = length - 1,
  21901. nested = object;
  21902. while (nested != null && ++index < length) {
  21903. var key = toKey(path[index]),
  21904. newValue = value;
  21905. if (index != lastIndex) {
  21906. var objValue = nested[key];
  21907. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  21908. if (newValue === undefined) {
  21909. newValue = isObject(objValue)
  21910. ? objValue
  21911. : (isIndex(path[index + 1]) ? [] : {});
  21912. }
  21913. }
  21914. assignValue(nested, key, newValue);
  21915. nested = nested[key];
  21916. }
  21917. return object;
  21918. }
  21919. /**
  21920. * The base implementation of `setData` without support for hot loop shorting.
  21921. *
  21922. * @private
  21923. * @param {Function} func The function to associate metadata with.
  21924. * @param {*} data The metadata.
  21925. * @returns {Function} Returns `func`.
  21926. */
  21927. var baseSetData = !metaMap ? identity : function(func, data) {
  21928. metaMap.set(func, data);
  21929. return func;
  21930. };
  21931. /**
  21932. * The base implementation of `setToString` without support for hot loop shorting.
  21933. *
  21934. * @private
  21935. * @param {Function} func The function to modify.
  21936. * @param {Function} string The `toString` result.
  21937. * @returns {Function} Returns `func`.
  21938. */
  21939. var baseSetToString = !defineProperty ? identity : function(func, string) {
  21940. return defineProperty(func, 'toString', {
  21941. 'configurable': true,
  21942. 'enumerable': false,
  21943. 'value': constant(string),
  21944. 'writable': true
  21945. });
  21946. };
  21947. /**
  21948. * The base implementation of `_.shuffle`.
  21949. *
  21950. * @private
  21951. * @param {Array|Object} collection The collection to shuffle.
  21952. * @returns {Array} Returns the new shuffled array.
  21953. */
  21954. function baseShuffle(collection) {
  21955. return shuffleSelf(values(collection));
  21956. }
  21957. /**
  21958. * The base implementation of `_.slice` without an iteratee call guard.
  21959. *
  21960. * @private
  21961. * @param {Array} array The array to slice.
  21962. * @param {number} [start=0] The start position.
  21963. * @param {number} [end=array.length] The end position.
  21964. * @returns {Array} Returns the slice of `array`.
  21965. */
  21966. function baseSlice(array, start, end) {
  21967. var index = -1,
  21968. length = array.length;
  21969. if (start < 0) {
  21970. start = -start > length ? 0 : (length + start);
  21971. }
  21972. end = end > length ? length : end;
  21973. if (end < 0) {
  21974. end += length;
  21975. }
  21976. length = start > end ? 0 : ((end - start) >>> 0);
  21977. start >>>= 0;
  21978. var result = Array(length);
  21979. while (++index < length) {
  21980. result[index] = array[index + start];
  21981. }
  21982. return result;
  21983. }
  21984. /**
  21985. * The base implementation of `_.some` without support for iteratee shorthands.
  21986. *
  21987. * @private
  21988. * @param {Array|Object} collection The collection to iterate over.
  21989. * @param {Function} predicate The function invoked per iteration.
  21990. * @returns {boolean} Returns `true` if any element passes the predicate check,
  21991. * else `false`.
  21992. */
  21993. function baseSome(collection, predicate) {
  21994. var result;
  21995. baseEach(collection, function(value, index, collection) {
  21996. result = predicate(value, index, collection);
  21997. return !result;
  21998. });
  21999. return !!result;
  22000. }
  22001. /**
  22002. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22003. * performs a binary search of `array` to determine the index at which `value`
  22004. * should be inserted into `array` in order to maintain its sort order.
  22005. *
  22006. * @private
  22007. * @param {Array} array The sorted array to inspect.
  22008. * @param {*} value The value to evaluate.
  22009. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22010. * @returns {number} Returns the index at which `value` should be inserted
  22011. * into `array`.
  22012. */
  22013. function baseSortedIndex(array, value, retHighest) {
  22014. var low = 0,
  22015. high = array == null ? low : array.length;
  22016. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22017. while (low < high) {
  22018. var mid = (low + high) >>> 1,
  22019. computed = array[mid];
  22020. if (computed !== null && !isSymbol(computed) &&
  22021. (retHighest ? (computed <= value) : (computed < value))) {
  22022. low = mid + 1;
  22023. } else {
  22024. high = mid;
  22025. }
  22026. }
  22027. return high;
  22028. }
  22029. return baseSortedIndexBy(array, value, identity, retHighest);
  22030. }
  22031. /**
  22032. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22033. * which invokes `iteratee` for `value` and each element of `array` to compute
  22034. * their sort ranking. The iteratee is invoked with one argument; (value).
  22035. *
  22036. * @private
  22037. * @param {Array} array The sorted array to inspect.
  22038. * @param {*} value The value to evaluate.
  22039. * @param {Function} iteratee The iteratee invoked per element.
  22040. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22041. * @returns {number} Returns the index at which `value` should be inserted
  22042. * into `array`.
  22043. */
  22044. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22045. value = iteratee(value);
  22046. var low = 0,
  22047. high = array == null ? 0 : array.length,
  22048. valIsNaN = value !== value,
  22049. valIsNull = value === null,
  22050. valIsSymbol = isSymbol(value),
  22051. valIsUndefined = value === undefined;
  22052. while (low < high) {
  22053. var mid = nativeFloor((low + high) / 2),
  22054. computed = iteratee(array[mid]),
  22055. othIsDefined = computed !== undefined,
  22056. othIsNull = computed === null,
  22057. othIsReflexive = computed === computed,
  22058. othIsSymbol = isSymbol(computed);
  22059. if (valIsNaN) {
  22060. var setLow = retHighest || othIsReflexive;
  22061. } else if (valIsUndefined) {
  22062. setLow = othIsReflexive && (retHighest || othIsDefined);
  22063. } else if (valIsNull) {
  22064. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22065. } else if (valIsSymbol) {
  22066. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22067. } else if (othIsNull || othIsSymbol) {
  22068. setLow = false;
  22069. } else {
  22070. setLow = retHighest ? (computed <= value) : (computed < value);
  22071. }
  22072. if (setLow) {
  22073. low = mid + 1;
  22074. } else {
  22075. high = mid;
  22076. }
  22077. }
  22078. return nativeMin(high, MAX_ARRAY_INDEX);
  22079. }
  22080. /**
  22081. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22082. * support for iteratee shorthands.
  22083. *
  22084. * @private
  22085. * @param {Array} array The array to inspect.
  22086. * @param {Function} [iteratee] The iteratee invoked per element.
  22087. * @returns {Array} Returns the new duplicate free array.
  22088. */
  22089. function baseSortedUniq(array, iteratee) {
  22090. var index = -1,
  22091. length = array.length,
  22092. resIndex = 0,
  22093. result = [];
  22094. while (++index < length) {
  22095. var value = array[index],
  22096. computed = iteratee ? iteratee(value) : value;
  22097. if (!index || !eq(computed, seen)) {
  22098. var seen = computed;
  22099. result[resIndex++] = value === 0 ? 0 : value;
  22100. }
  22101. }
  22102. return result;
  22103. }
  22104. /**
  22105. * The base implementation of `_.toNumber` which doesn't ensure correct
  22106. * conversions of binary, hexadecimal, or octal string values.
  22107. *
  22108. * @private
  22109. * @param {*} value The value to process.
  22110. * @returns {number} Returns the number.
  22111. */
  22112. function baseToNumber(value) {
  22113. if (typeof value == 'number') {
  22114. return value;
  22115. }
  22116. if (isSymbol(value)) {
  22117. return NAN;
  22118. }
  22119. return +value;
  22120. }
  22121. /**
  22122. * The base implementation of `_.toString` which doesn't convert nullish
  22123. * values to empty strings.
  22124. *
  22125. * @private
  22126. * @param {*} value The value to process.
  22127. * @returns {string} Returns the string.
  22128. */
  22129. function baseToString(value) {
  22130. // Exit early for strings to avoid a performance hit in some environments.
  22131. if (typeof value == 'string') {
  22132. return value;
  22133. }
  22134. if (isArray(value)) {
  22135. // Recursively convert values (susceptible to call stack limits).
  22136. return arrayMap(value, baseToString) + '';
  22137. }
  22138. if (isSymbol(value)) {
  22139. return symbolToString ? symbolToString.call(value) : '';
  22140. }
  22141. var result = (value + '');
  22142. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22143. }
  22144. /**
  22145. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22146. *
  22147. * @private
  22148. * @param {Array} array The array to inspect.
  22149. * @param {Function} [iteratee] The iteratee invoked per element.
  22150. * @param {Function} [comparator] The comparator invoked per element.
  22151. * @returns {Array} Returns the new duplicate free array.
  22152. */
  22153. function baseUniq(array, iteratee, comparator) {
  22154. var index = -1,
  22155. includes = arrayIncludes,
  22156. length = array.length,
  22157. isCommon = true,
  22158. result = [],
  22159. seen = result;
  22160. if (comparator) {
  22161. isCommon = false;
  22162. includes = arrayIncludesWith;
  22163. }
  22164. else if (length >= LARGE_ARRAY_SIZE) {
  22165. var set = iteratee ? null : createSet(array);
  22166. if (set) {
  22167. return setToArray(set);
  22168. }
  22169. isCommon = false;
  22170. includes = cacheHas;
  22171. seen = new SetCache;
  22172. }
  22173. else {
  22174. seen = iteratee ? [] : result;
  22175. }
  22176. outer:
  22177. while (++index < length) {
  22178. var value = array[index],
  22179. computed = iteratee ? iteratee(value) : value;
  22180. value = (comparator || value !== 0) ? value : 0;
  22181. if (isCommon && computed === computed) {
  22182. var seenIndex = seen.length;
  22183. while (seenIndex--) {
  22184. if (seen[seenIndex] === computed) {
  22185. continue outer;
  22186. }
  22187. }
  22188. if (iteratee) {
  22189. seen.push(computed);
  22190. }
  22191. result.push(value);
  22192. }
  22193. else if (!includes(seen, computed, comparator)) {
  22194. if (seen !== result) {
  22195. seen.push(computed);
  22196. }
  22197. result.push(value);
  22198. }
  22199. }
  22200. return result;
  22201. }
  22202. /**
  22203. * The base implementation of `_.unset`.
  22204. *
  22205. * @private
  22206. * @param {Object} object The object to modify.
  22207. * @param {Array|string} path The property path to unset.
  22208. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22209. */
  22210. function baseUnset(object, path) {
  22211. path = castPath(path, object);
  22212. object = parent(object, path);
  22213. return object == null || delete object[toKey(last(path))];
  22214. }
  22215. /**
  22216. * The base implementation of `_.update`.
  22217. *
  22218. * @private
  22219. * @param {Object} object The object to modify.
  22220. * @param {Array|string} path The path of the property to update.
  22221. * @param {Function} updater The function to produce the updated value.
  22222. * @param {Function} [customizer] The function to customize path creation.
  22223. * @returns {Object} Returns `object`.
  22224. */
  22225. function baseUpdate(object, path, updater, customizer) {
  22226. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22227. }
  22228. /**
  22229. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22230. * without support for iteratee shorthands.
  22231. *
  22232. * @private
  22233. * @param {Array} array The array to query.
  22234. * @param {Function} predicate The function invoked per iteration.
  22235. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22236. * @param {boolean} [fromRight] Specify iterating from right to left.
  22237. * @returns {Array} Returns the slice of `array`.
  22238. */
  22239. function baseWhile(array, predicate, isDrop, fromRight) {
  22240. var length = array.length,
  22241. index = fromRight ? length : -1;
  22242. while ((fromRight ? index-- : ++index < length) &&
  22243. predicate(array[index], index, array)) {}
  22244. return isDrop
  22245. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22246. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22247. }
  22248. /**
  22249. * The base implementation of `wrapperValue` which returns the result of
  22250. * performing a sequence of actions on the unwrapped `value`, where each
  22251. * successive action is supplied the return value of the previous.
  22252. *
  22253. * @private
  22254. * @param {*} value The unwrapped value.
  22255. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22256. * @returns {*} Returns the resolved value.
  22257. */
  22258. function baseWrapperValue(value, actions) {
  22259. var result = value;
  22260. if (result instanceof LazyWrapper) {
  22261. result = result.value();
  22262. }
  22263. return arrayReduce(actions, function(result, action) {
  22264. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22265. }, result);
  22266. }
  22267. /**
  22268. * The base implementation of methods like `_.xor`, without support for
  22269. * iteratee shorthands, that accepts an array of arrays to inspect.
  22270. *
  22271. * @private
  22272. * @param {Array} arrays The arrays to inspect.
  22273. * @param {Function} [iteratee] The iteratee invoked per element.
  22274. * @param {Function} [comparator] The comparator invoked per element.
  22275. * @returns {Array} Returns the new array of values.
  22276. */
  22277. function baseXor(arrays, iteratee, comparator) {
  22278. var length = arrays.length;
  22279. if (length < 2) {
  22280. return length ? baseUniq(arrays[0]) : [];
  22281. }
  22282. var index = -1,
  22283. result = Array(length);
  22284. while (++index < length) {
  22285. var array = arrays[index],
  22286. othIndex = -1;
  22287. while (++othIndex < length) {
  22288. if (othIndex != index) {
  22289. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22290. }
  22291. }
  22292. }
  22293. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22294. }
  22295. /**
  22296. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22297. *
  22298. * @private
  22299. * @param {Array} props The property identifiers.
  22300. * @param {Array} values The property values.
  22301. * @param {Function} assignFunc The function to assign values.
  22302. * @returns {Object} Returns the new object.
  22303. */
  22304. function baseZipObject(props, values, assignFunc) {
  22305. var index = -1,
  22306. length = props.length,
  22307. valsLength = values.length,
  22308. result = {};
  22309. while (++index < length) {
  22310. var value = index < valsLength ? values[index] : undefined;
  22311. assignFunc(result, props[index], value);
  22312. }
  22313. return result;
  22314. }
  22315. /**
  22316. * Casts `value` to an empty array if it's not an array like object.
  22317. *
  22318. * @private
  22319. * @param {*} value The value to inspect.
  22320. * @returns {Array|Object} Returns the cast array-like object.
  22321. */
  22322. function castArrayLikeObject(value) {
  22323. return isArrayLikeObject(value) ? value : [];
  22324. }
  22325. /**
  22326. * Casts `value` to `identity` if it's not a function.
  22327. *
  22328. * @private
  22329. * @param {*} value The value to inspect.
  22330. * @returns {Function} Returns cast function.
  22331. */
  22332. function castFunction(value) {
  22333. return typeof value == 'function' ? value : identity;
  22334. }
  22335. /**
  22336. * Casts `value` to a path array if it's not one.
  22337. *
  22338. * @private
  22339. * @param {*} value The value to inspect.
  22340. * @param {Object} [object] The object to query keys on.
  22341. * @returns {Array} Returns the cast property path array.
  22342. */
  22343. function castPath(value, object) {
  22344. if (isArray(value)) {
  22345. return value;
  22346. }
  22347. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22348. }
  22349. /**
  22350. * A `baseRest` alias which can be replaced with `identity` by module
  22351. * replacement plugins.
  22352. *
  22353. * @private
  22354. * @type {Function}
  22355. * @param {Function} func The function to apply a rest parameter to.
  22356. * @returns {Function} Returns the new function.
  22357. */
  22358. var castRest = baseRest;
  22359. /**
  22360. * Casts `array` to a slice if it's needed.
  22361. *
  22362. * @private
  22363. * @param {Array} array The array to inspect.
  22364. * @param {number} start The start position.
  22365. * @param {number} [end=array.length] The end position.
  22366. * @returns {Array} Returns the cast slice.
  22367. */
  22368. function castSlice(array, start, end) {
  22369. var length = array.length;
  22370. end = end === undefined ? length : end;
  22371. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22372. }
  22373. /**
  22374. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22375. *
  22376. * @private
  22377. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22378. */
  22379. var clearTimeout = ctxClearTimeout || function(id) {
  22380. return root.clearTimeout(id);
  22381. };
  22382. /**
  22383. * Creates a clone of `buffer`.
  22384. *
  22385. * @private
  22386. * @param {Buffer} buffer The buffer to clone.
  22387. * @param {boolean} [isDeep] Specify a deep clone.
  22388. * @returns {Buffer} Returns the cloned buffer.
  22389. */
  22390. function cloneBuffer(buffer, isDeep) {
  22391. if (isDeep) {
  22392. return buffer.slice();
  22393. }
  22394. var length = buffer.length,
  22395. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22396. buffer.copy(result);
  22397. return result;
  22398. }
  22399. /**
  22400. * Creates a clone of `arrayBuffer`.
  22401. *
  22402. * @private
  22403. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22404. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22405. */
  22406. function cloneArrayBuffer(arrayBuffer) {
  22407. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22408. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22409. return result;
  22410. }
  22411. /**
  22412. * Creates a clone of `dataView`.
  22413. *
  22414. * @private
  22415. * @param {Object} dataView The data view to clone.
  22416. * @param {boolean} [isDeep] Specify a deep clone.
  22417. * @returns {Object} Returns the cloned data view.
  22418. */
  22419. function cloneDataView(dataView, isDeep) {
  22420. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22421. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22422. }
  22423. /**
  22424. * Creates a clone of `regexp`.
  22425. *
  22426. * @private
  22427. * @param {Object} regexp The regexp to clone.
  22428. * @returns {Object} Returns the cloned regexp.
  22429. */
  22430. function cloneRegExp(regexp) {
  22431. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22432. result.lastIndex = regexp.lastIndex;
  22433. return result;
  22434. }
  22435. /**
  22436. * Creates a clone of the `symbol` object.
  22437. *
  22438. * @private
  22439. * @param {Object} symbol The symbol object to clone.
  22440. * @returns {Object} Returns the cloned symbol object.
  22441. */
  22442. function cloneSymbol(symbol) {
  22443. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22444. }
  22445. /**
  22446. * Creates a clone of `typedArray`.
  22447. *
  22448. * @private
  22449. * @param {Object} typedArray The typed array to clone.
  22450. * @param {boolean} [isDeep] Specify a deep clone.
  22451. * @returns {Object} Returns the cloned typed array.
  22452. */
  22453. function cloneTypedArray(typedArray, isDeep) {
  22454. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22455. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22456. }
  22457. /**
  22458. * Compares values to sort them in ascending order.
  22459. *
  22460. * @private
  22461. * @param {*} value The value to compare.
  22462. * @param {*} other The other value to compare.
  22463. * @returns {number} Returns the sort order indicator for `value`.
  22464. */
  22465. function compareAscending(value, other) {
  22466. if (value !== other) {
  22467. var valIsDefined = value !== undefined,
  22468. valIsNull = value === null,
  22469. valIsReflexive = value === value,
  22470. valIsSymbol = isSymbol(value);
  22471. var othIsDefined = other !== undefined,
  22472. othIsNull = other === null,
  22473. othIsReflexive = other === other,
  22474. othIsSymbol = isSymbol(other);
  22475. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22476. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22477. (valIsNull && othIsDefined && othIsReflexive) ||
  22478. (!valIsDefined && othIsReflexive) ||
  22479. !valIsReflexive) {
  22480. return 1;
  22481. }
  22482. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22483. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22484. (othIsNull && valIsDefined && valIsReflexive) ||
  22485. (!othIsDefined && valIsReflexive) ||
  22486. !othIsReflexive) {
  22487. return -1;
  22488. }
  22489. }
  22490. return 0;
  22491. }
  22492. /**
  22493. * Used by `_.orderBy` to compare multiple properties of a value to another
  22494. * and stable sort them.
  22495. *
  22496. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22497. * specify an order of "desc" for descending or "asc" for ascending sort order
  22498. * of corresponding values.
  22499. *
  22500. * @private
  22501. * @param {Object} object The object to compare.
  22502. * @param {Object} other The other object to compare.
  22503. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22504. * @returns {number} Returns the sort order indicator for `object`.
  22505. */
  22506. function compareMultiple(object, other, orders) {
  22507. var index = -1,
  22508. objCriteria = object.criteria,
  22509. othCriteria = other.criteria,
  22510. length = objCriteria.length,
  22511. ordersLength = orders.length;
  22512. while (++index < length) {
  22513. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22514. if (result) {
  22515. if (index >= ordersLength) {
  22516. return result;
  22517. }
  22518. var order = orders[index];
  22519. return result * (order == 'desc' ? -1 : 1);
  22520. }
  22521. }
  22522. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22523. // that causes it, under certain circumstances, to provide the same value for
  22524. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22525. // for more details.
  22526. //
  22527. // This also ensures a stable sort in V8 and other engines.
  22528. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22529. return object.index - other.index;
  22530. }
  22531. /**
  22532. * Creates an array that is the composition of partially applied arguments,
  22533. * placeholders, and provided arguments into a single array of arguments.
  22534. *
  22535. * @private
  22536. * @param {Array} args The provided arguments.
  22537. * @param {Array} partials The arguments to prepend to those provided.
  22538. * @param {Array} holders The `partials` placeholder indexes.
  22539. * @params {boolean} [isCurried] Specify composing for a curried function.
  22540. * @returns {Array} Returns the new array of composed arguments.
  22541. */
  22542. function composeArgs(args, partials, holders, isCurried) {
  22543. var argsIndex = -1,
  22544. argsLength = args.length,
  22545. holdersLength = holders.length,
  22546. leftIndex = -1,
  22547. leftLength = partials.length,
  22548. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22549. result = Array(leftLength + rangeLength),
  22550. isUncurried = !isCurried;
  22551. while (++leftIndex < leftLength) {
  22552. result[leftIndex] = partials[leftIndex];
  22553. }
  22554. while (++argsIndex < holdersLength) {
  22555. if (isUncurried || argsIndex < argsLength) {
  22556. result[holders[argsIndex]] = args[argsIndex];
  22557. }
  22558. }
  22559. while (rangeLength--) {
  22560. result[leftIndex++] = args[argsIndex++];
  22561. }
  22562. return result;
  22563. }
  22564. /**
  22565. * This function is like `composeArgs` except that the arguments composition
  22566. * is tailored for `_.partialRight`.
  22567. *
  22568. * @private
  22569. * @param {Array} args The provided arguments.
  22570. * @param {Array} partials The arguments to append to those provided.
  22571. * @param {Array} holders The `partials` placeholder indexes.
  22572. * @params {boolean} [isCurried] Specify composing for a curried function.
  22573. * @returns {Array} Returns the new array of composed arguments.
  22574. */
  22575. function composeArgsRight(args, partials, holders, isCurried) {
  22576. var argsIndex = -1,
  22577. argsLength = args.length,
  22578. holdersIndex = -1,
  22579. holdersLength = holders.length,
  22580. rightIndex = -1,
  22581. rightLength = partials.length,
  22582. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22583. result = Array(rangeLength + rightLength),
  22584. isUncurried = !isCurried;
  22585. while (++argsIndex < rangeLength) {
  22586. result[argsIndex] = args[argsIndex];
  22587. }
  22588. var offset = argsIndex;
  22589. while (++rightIndex < rightLength) {
  22590. result[offset + rightIndex] = partials[rightIndex];
  22591. }
  22592. while (++holdersIndex < holdersLength) {
  22593. if (isUncurried || argsIndex < argsLength) {
  22594. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22595. }
  22596. }
  22597. return result;
  22598. }
  22599. /**
  22600. * Copies the values of `source` to `array`.
  22601. *
  22602. * @private
  22603. * @param {Array} source The array to copy values from.
  22604. * @param {Array} [array=[]] The array to copy values to.
  22605. * @returns {Array} Returns `array`.
  22606. */
  22607. function copyArray(source, array) {
  22608. var index = -1,
  22609. length = source.length;
  22610. array || (array = Array(length));
  22611. while (++index < length) {
  22612. array[index] = source[index];
  22613. }
  22614. return array;
  22615. }
  22616. /**
  22617. * Copies properties of `source` to `object`.
  22618. *
  22619. * @private
  22620. * @param {Object} source The object to copy properties from.
  22621. * @param {Array} props The property identifiers to copy.
  22622. * @param {Object} [object={}] The object to copy properties to.
  22623. * @param {Function} [customizer] The function to customize copied values.
  22624. * @returns {Object} Returns `object`.
  22625. */
  22626. function copyObject(source, props, object, customizer) {
  22627. var isNew = !object;
  22628. object || (object = {});
  22629. var index = -1,
  22630. length = props.length;
  22631. while (++index < length) {
  22632. var key = props[index];
  22633. var newValue = customizer
  22634. ? customizer(object[key], source[key], key, object, source)
  22635. : undefined;
  22636. if (newValue === undefined) {
  22637. newValue = source[key];
  22638. }
  22639. if (isNew) {
  22640. baseAssignValue(object, key, newValue);
  22641. } else {
  22642. assignValue(object, key, newValue);
  22643. }
  22644. }
  22645. return object;
  22646. }
  22647. /**
  22648. * Copies own symbols of `source` to `object`.
  22649. *
  22650. * @private
  22651. * @param {Object} source The object to copy symbols from.
  22652. * @param {Object} [object={}] The object to copy symbols to.
  22653. * @returns {Object} Returns `object`.
  22654. */
  22655. function copySymbols(source, object) {
  22656. return copyObject(source, getSymbols(source), object);
  22657. }
  22658. /**
  22659. * Copies own and inherited symbols of `source` to `object`.
  22660. *
  22661. * @private
  22662. * @param {Object} source The object to copy symbols from.
  22663. * @param {Object} [object={}] The object to copy symbols to.
  22664. * @returns {Object} Returns `object`.
  22665. */
  22666. function copySymbolsIn(source, object) {
  22667. return copyObject(source, getSymbolsIn(source), object);
  22668. }
  22669. /**
  22670. * Creates a function like `_.groupBy`.
  22671. *
  22672. * @private
  22673. * @param {Function} setter The function to set accumulator values.
  22674. * @param {Function} [initializer] The accumulator object initializer.
  22675. * @returns {Function} Returns the new aggregator function.
  22676. */
  22677. function createAggregator(setter, initializer) {
  22678. return function(collection, iteratee) {
  22679. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22680. accumulator = initializer ? initializer() : {};
  22681. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22682. };
  22683. }
  22684. /**
  22685. * Creates a function like `_.assign`.
  22686. *
  22687. * @private
  22688. * @param {Function} assigner The function to assign values.
  22689. * @returns {Function} Returns the new assigner function.
  22690. */
  22691. function createAssigner(assigner) {
  22692. return baseRest(function(object, sources) {
  22693. var index = -1,
  22694. length = sources.length,
  22695. customizer = length > 1 ? sources[length - 1] : undefined,
  22696. guard = length > 2 ? sources[2] : undefined;
  22697. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22698. ? (length--, customizer)
  22699. : undefined;
  22700. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22701. customizer = length < 3 ? undefined : customizer;
  22702. length = 1;
  22703. }
  22704. object = Object(object);
  22705. while (++index < length) {
  22706. var source = sources[index];
  22707. if (source) {
  22708. assigner(object, source, index, customizer);
  22709. }
  22710. }
  22711. return object;
  22712. });
  22713. }
  22714. /**
  22715. * Creates a `baseEach` or `baseEachRight` function.
  22716. *
  22717. * @private
  22718. * @param {Function} eachFunc The function to iterate over a collection.
  22719. * @param {boolean} [fromRight] Specify iterating from right to left.
  22720. * @returns {Function} Returns the new base function.
  22721. */
  22722. function createBaseEach(eachFunc, fromRight) {
  22723. return function(collection, iteratee) {
  22724. if (collection == null) {
  22725. return collection;
  22726. }
  22727. if (!isArrayLike(collection)) {
  22728. return eachFunc(collection, iteratee);
  22729. }
  22730. var length = collection.length,
  22731. index = fromRight ? length : -1,
  22732. iterable = Object(collection);
  22733. while ((fromRight ? index-- : ++index < length)) {
  22734. if (iteratee(iterable[index], index, iterable) === false) {
  22735. break;
  22736. }
  22737. }
  22738. return collection;
  22739. };
  22740. }
  22741. /**
  22742. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22743. *
  22744. * @private
  22745. * @param {boolean} [fromRight] Specify iterating from right to left.
  22746. * @returns {Function} Returns the new base function.
  22747. */
  22748. function createBaseFor(fromRight) {
  22749. return function(object, iteratee, keysFunc) {
  22750. var index = -1,
  22751. iterable = Object(object),
  22752. props = keysFunc(object),
  22753. length = props.length;
  22754. while (length--) {
  22755. var key = props[fromRight ? length : ++index];
  22756. if (iteratee(iterable[key], key, iterable) === false) {
  22757. break;
  22758. }
  22759. }
  22760. return object;
  22761. };
  22762. }
  22763. /**
  22764. * Creates a function that wraps `func` to invoke it with the optional `this`
  22765. * binding of `thisArg`.
  22766. *
  22767. * @private
  22768. * @param {Function} func The function to wrap.
  22769. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22770. * @param {*} [thisArg] The `this` binding of `func`.
  22771. * @returns {Function} Returns the new wrapped function.
  22772. */
  22773. function createBind(func, bitmask, thisArg) {
  22774. var isBind = bitmask & WRAP_BIND_FLAG,
  22775. Ctor = createCtor(func);
  22776. function wrapper() {
  22777. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22778. return fn.apply(isBind ? thisArg : this, arguments);
  22779. }
  22780. return wrapper;
  22781. }
  22782. /**
  22783. * Creates a function like `_.lowerFirst`.
  22784. *
  22785. * @private
  22786. * @param {string} methodName The name of the `String` case method to use.
  22787. * @returns {Function} Returns the new case function.
  22788. */
  22789. function createCaseFirst(methodName) {
  22790. return function(string) {
  22791. string = toString(string);
  22792. var strSymbols = hasUnicode(string)
  22793. ? stringToArray(string)
  22794. : undefined;
  22795. var chr = strSymbols
  22796. ? strSymbols[0]
  22797. : string.charAt(0);
  22798. var trailing = strSymbols
  22799. ? castSlice(strSymbols, 1).join('')
  22800. : string.slice(1);
  22801. return chr[methodName]() + trailing;
  22802. };
  22803. }
  22804. /**
  22805. * Creates a function like `_.camelCase`.
  22806. *
  22807. * @private
  22808. * @param {Function} callback The function to combine each word.
  22809. * @returns {Function} Returns the new compounder function.
  22810. */
  22811. function createCompounder(callback) {
  22812. return function(string) {
  22813. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22814. };
  22815. }
  22816. /**
  22817. * Creates a function that produces an instance of `Ctor` regardless of
  22818. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22819. *
  22820. * @private
  22821. * @param {Function} Ctor The constructor to wrap.
  22822. * @returns {Function} Returns the new wrapped function.
  22823. */
  22824. function createCtor(Ctor) {
  22825. return function() {
  22826. // Use a `switch` statement to work with class constructors. See
  22827. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22828. // for more details.
  22829. var args = arguments;
  22830. switch (args.length) {
  22831. case 0: return new Ctor;
  22832. case 1: return new Ctor(args[0]);
  22833. case 2: return new Ctor(args[0], args[1]);
  22834. case 3: return new Ctor(args[0], args[1], args[2]);
  22835. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22836. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22837. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22838. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22839. }
  22840. var thisBinding = baseCreate(Ctor.prototype),
  22841. result = Ctor.apply(thisBinding, args);
  22842. // Mimic the constructor's `return` behavior.
  22843. // See https://es5.github.io/#x13.2.2 for more details.
  22844. return isObject(result) ? result : thisBinding;
  22845. };
  22846. }
  22847. /**
  22848. * Creates a function that wraps `func` to enable currying.
  22849. *
  22850. * @private
  22851. * @param {Function} func The function to wrap.
  22852. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22853. * @param {number} arity The arity of `func`.
  22854. * @returns {Function} Returns the new wrapped function.
  22855. */
  22856. function createCurry(func, bitmask, arity) {
  22857. var Ctor = createCtor(func);
  22858. function wrapper() {
  22859. var length = arguments.length,
  22860. args = Array(length),
  22861. index = length,
  22862. placeholder = getHolder(wrapper);
  22863. while (index--) {
  22864. args[index] = arguments[index];
  22865. }
  22866. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22867. ? []
  22868. : replaceHolders(args, placeholder);
  22869. length -= holders.length;
  22870. if (length < arity) {
  22871. return createRecurry(
  22872. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22873. args, holders, undefined, undefined, arity - length);
  22874. }
  22875. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22876. return apply(fn, this, args);
  22877. }
  22878. return wrapper;
  22879. }
  22880. /**
  22881. * Creates a `_.find` or `_.findLast` function.
  22882. *
  22883. * @private
  22884. * @param {Function} findIndexFunc The function to find the collection index.
  22885. * @returns {Function} Returns the new find function.
  22886. */
  22887. function createFind(findIndexFunc) {
  22888. return function(collection, predicate, fromIndex) {
  22889. var iterable = Object(collection);
  22890. if (!isArrayLike(collection)) {
  22891. var iteratee = getIteratee(predicate, 3);
  22892. collection = keys(collection);
  22893. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22894. }
  22895. var index = findIndexFunc(collection, predicate, fromIndex);
  22896. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22897. };
  22898. }
  22899. /**
  22900. * Creates a `_.flow` or `_.flowRight` function.
  22901. *
  22902. * @private
  22903. * @param {boolean} [fromRight] Specify iterating from right to left.
  22904. * @returns {Function} Returns the new flow function.
  22905. */
  22906. function createFlow(fromRight) {
  22907. return flatRest(function(funcs) {
  22908. var length = funcs.length,
  22909. index = length,
  22910. prereq = LodashWrapper.prototype.thru;
  22911. if (fromRight) {
  22912. funcs.reverse();
  22913. }
  22914. while (index--) {
  22915. var func = funcs[index];
  22916. if (typeof func != 'function') {
  22917. throw new TypeError(FUNC_ERROR_TEXT);
  22918. }
  22919. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  22920. var wrapper = new LodashWrapper([], true);
  22921. }
  22922. }
  22923. index = wrapper ? index : length;
  22924. while (++index < length) {
  22925. func = funcs[index];
  22926. var funcName = getFuncName(func),
  22927. data = funcName == 'wrapper' ? getData(func) : undefined;
  22928. if (data && isLaziable(data[0]) &&
  22929. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  22930. !data[4].length && data[9] == 1
  22931. ) {
  22932. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  22933. } else {
  22934. wrapper = (func.length == 1 && isLaziable(func))
  22935. ? wrapper[funcName]()
  22936. : wrapper.thru(func);
  22937. }
  22938. }
  22939. return function() {
  22940. var args = arguments,
  22941. value = args[0];
  22942. if (wrapper && args.length == 1 && isArray(value)) {
  22943. return wrapper.plant(value).value();
  22944. }
  22945. var index = 0,
  22946. result = length ? funcs[index].apply(this, args) : value;
  22947. while (++index < length) {
  22948. result = funcs[index].call(this, result);
  22949. }
  22950. return result;
  22951. };
  22952. });
  22953. }
  22954. /**
  22955. * Creates a function that wraps `func` to invoke it with optional `this`
  22956. * binding of `thisArg`, partial application, and currying.
  22957. *
  22958. * @private
  22959. * @param {Function|string} func The function or method name to wrap.
  22960. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22961. * @param {*} [thisArg] The `this` binding of `func`.
  22962. * @param {Array} [partials] The arguments to prepend to those provided to
  22963. * the new function.
  22964. * @param {Array} [holders] The `partials` placeholder indexes.
  22965. * @param {Array} [partialsRight] The arguments to append to those provided
  22966. * to the new function.
  22967. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  22968. * @param {Array} [argPos] The argument positions of the new function.
  22969. * @param {number} [ary] The arity cap of `func`.
  22970. * @param {number} [arity] The arity of `func`.
  22971. * @returns {Function} Returns the new wrapped function.
  22972. */
  22973. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  22974. var isAry = bitmask & WRAP_ARY_FLAG,
  22975. isBind = bitmask & WRAP_BIND_FLAG,
  22976. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  22977. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  22978. isFlip = bitmask & WRAP_FLIP_FLAG,
  22979. Ctor = isBindKey ? undefined : createCtor(func);
  22980. function wrapper() {
  22981. var length = arguments.length,
  22982. args = Array(length),
  22983. index = length;
  22984. while (index--) {
  22985. args[index] = arguments[index];
  22986. }
  22987. if (isCurried) {
  22988. var placeholder = getHolder(wrapper),
  22989. holdersCount = countHolders(args, placeholder);
  22990. }
  22991. if (partials) {
  22992. args = composeArgs(args, partials, holders, isCurried);
  22993. }
  22994. if (partialsRight) {
  22995. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  22996. }
  22997. length -= holdersCount;
  22998. if (isCurried && length < arity) {
  22999. var newHolders = replaceHolders(args, placeholder);
  23000. return createRecurry(
  23001. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23002. args, newHolders, argPos, ary, arity - length
  23003. );
  23004. }
  23005. var thisBinding = isBind ? thisArg : this,
  23006. fn = isBindKey ? thisBinding[func] : func;
  23007. length = args.length;
  23008. if (argPos) {
  23009. args = reorder(args, argPos);
  23010. } else if (isFlip && length > 1) {
  23011. args.reverse();
  23012. }
  23013. if (isAry && ary < length) {
  23014. args.length = ary;
  23015. }
  23016. if (this && this !== root && this instanceof wrapper) {
  23017. fn = Ctor || createCtor(fn);
  23018. }
  23019. return fn.apply(thisBinding, args);
  23020. }
  23021. return wrapper;
  23022. }
  23023. /**
  23024. * Creates a function like `_.invertBy`.
  23025. *
  23026. * @private
  23027. * @param {Function} setter The function to set accumulator values.
  23028. * @param {Function} toIteratee The function to resolve iteratees.
  23029. * @returns {Function} Returns the new inverter function.
  23030. */
  23031. function createInverter(setter, toIteratee) {
  23032. return function(object, iteratee) {
  23033. return baseInverter(object, setter, toIteratee(iteratee), {});
  23034. };
  23035. }
  23036. /**
  23037. * Creates a function that performs a mathematical operation on two values.
  23038. *
  23039. * @private
  23040. * @param {Function} operator The function to perform the operation.
  23041. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23042. * @returns {Function} Returns the new mathematical operation function.
  23043. */
  23044. function createMathOperation(operator, defaultValue) {
  23045. return function(value, other) {
  23046. var result;
  23047. if (value === undefined && other === undefined) {
  23048. return defaultValue;
  23049. }
  23050. if (value !== undefined) {
  23051. result = value;
  23052. }
  23053. if (other !== undefined) {
  23054. if (result === undefined) {
  23055. return other;
  23056. }
  23057. if (typeof value == 'string' || typeof other == 'string') {
  23058. value = baseToString(value);
  23059. other = baseToString(other);
  23060. } else {
  23061. value = baseToNumber(value);
  23062. other = baseToNumber(other);
  23063. }
  23064. result = operator(value, other);
  23065. }
  23066. return result;
  23067. };
  23068. }
  23069. /**
  23070. * Creates a function like `_.over`.
  23071. *
  23072. * @private
  23073. * @param {Function} arrayFunc The function to iterate over iteratees.
  23074. * @returns {Function} Returns the new over function.
  23075. */
  23076. function createOver(arrayFunc) {
  23077. return flatRest(function(iteratees) {
  23078. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23079. return baseRest(function(args) {
  23080. var thisArg = this;
  23081. return arrayFunc(iteratees, function(iteratee) {
  23082. return apply(iteratee, thisArg, args);
  23083. });
  23084. });
  23085. });
  23086. }
  23087. /**
  23088. * Creates the padding for `string` based on `length`. The `chars` string
  23089. * is truncated if the number of characters exceeds `length`.
  23090. *
  23091. * @private
  23092. * @param {number} length The padding length.
  23093. * @param {string} [chars=' '] The string used as padding.
  23094. * @returns {string} Returns the padding for `string`.
  23095. */
  23096. function createPadding(length, chars) {
  23097. chars = chars === undefined ? ' ' : baseToString(chars);
  23098. var charsLength = chars.length;
  23099. if (charsLength < 2) {
  23100. return charsLength ? baseRepeat(chars, length) : chars;
  23101. }
  23102. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23103. return hasUnicode(chars)
  23104. ? castSlice(stringToArray(result), 0, length).join('')
  23105. : result.slice(0, length);
  23106. }
  23107. /**
  23108. * Creates a function that wraps `func` to invoke it with the `this` binding
  23109. * of `thisArg` and `partials` prepended to the arguments it receives.
  23110. *
  23111. * @private
  23112. * @param {Function} func The function to wrap.
  23113. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23114. * @param {*} thisArg The `this` binding of `func`.
  23115. * @param {Array} partials The arguments to prepend to those provided to
  23116. * the new function.
  23117. * @returns {Function} Returns the new wrapped function.
  23118. */
  23119. function createPartial(func, bitmask, thisArg, partials) {
  23120. var isBind = bitmask & WRAP_BIND_FLAG,
  23121. Ctor = createCtor(func);
  23122. function wrapper() {
  23123. var argsIndex = -1,
  23124. argsLength = arguments.length,
  23125. leftIndex = -1,
  23126. leftLength = partials.length,
  23127. args = Array(leftLength + argsLength),
  23128. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23129. while (++leftIndex < leftLength) {
  23130. args[leftIndex] = partials[leftIndex];
  23131. }
  23132. while (argsLength--) {
  23133. args[leftIndex++] = arguments[++argsIndex];
  23134. }
  23135. return apply(fn, isBind ? thisArg : this, args);
  23136. }
  23137. return wrapper;
  23138. }
  23139. /**
  23140. * Creates a `_.range` or `_.rangeRight` function.
  23141. *
  23142. * @private
  23143. * @param {boolean} [fromRight] Specify iterating from right to left.
  23144. * @returns {Function} Returns the new range function.
  23145. */
  23146. function createRange(fromRight) {
  23147. return function(start, end, step) {
  23148. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23149. end = step = undefined;
  23150. }
  23151. // Ensure the sign of `-0` is preserved.
  23152. start = toFinite(start);
  23153. if (end === undefined) {
  23154. end = start;
  23155. start = 0;
  23156. } else {
  23157. end = toFinite(end);
  23158. }
  23159. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23160. return baseRange(start, end, step, fromRight);
  23161. };
  23162. }
  23163. /**
  23164. * Creates a function that performs a relational operation on two values.
  23165. *
  23166. * @private
  23167. * @param {Function} operator The function to perform the operation.
  23168. * @returns {Function} Returns the new relational operation function.
  23169. */
  23170. function createRelationalOperation(operator) {
  23171. return function(value, other) {
  23172. if (!(typeof value == 'string' && typeof other == 'string')) {
  23173. value = toNumber(value);
  23174. other = toNumber(other);
  23175. }
  23176. return operator(value, other);
  23177. };
  23178. }
  23179. /**
  23180. * Creates a function that wraps `func` to continue currying.
  23181. *
  23182. * @private
  23183. * @param {Function} func The function to wrap.
  23184. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23185. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23186. * @param {*} placeholder The placeholder value.
  23187. * @param {*} [thisArg] The `this` binding of `func`.
  23188. * @param {Array} [partials] The arguments to prepend to those provided to
  23189. * the new function.
  23190. * @param {Array} [holders] The `partials` placeholder indexes.
  23191. * @param {Array} [argPos] The argument positions of the new function.
  23192. * @param {number} [ary] The arity cap of `func`.
  23193. * @param {number} [arity] The arity of `func`.
  23194. * @returns {Function} Returns the new wrapped function.
  23195. */
  23196. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23197. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23198. newHolders = isCurry ? holders : undefined,
  23199. newHoldersRight = isCurry ? undefined : holders,
  23200. newPartials = isCurry ? partials : undefined,
  23201. newPartialsRight = isCurry ? undefined : partials;
  23202. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23203. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23204. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23205. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23206. }
  23207. var newData = [
  23208. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23209. newHoldersRight, argPos, ary, arity
  23210. ];
  23211. var result = wrapFunc.apply(undefined, newData);
  23212. if (isLaziable(func)) {
  23213. setData(result, newData);
  23214. }
  23215. result.placeholder = placeholder;
  23216. return setWrapToString(result, func, bitmask);
  23217. }
  23218. /**
  23219. * Creates a function like `_.round`.
  23220. *
  23221. * @private
  23222. * @param {string} methodName The name of the `Math` method to use when rounding.
  23223. * @returns {Function} Returns the new round function.
  23224. */
  23225. function createRound(methodName) {
  23226. var func = Math[methodName];
  23227. return function(number, precision) {
  23228. number = toNumber(number);
  23229. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23230. if (precision && nativeIsFinite(number)) {
  23231. // Shift with exponential notation to avoid floating-point issues.
  23232. // See [MDN](https://mdn.io/round#Examples) for more details.
  23233. var pair = (toString(number) + 'e').split('e'),
  23234. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23235. pair = (toString(value) + 'e').split('e');
  23236. return +(pair[0] + 'e' + (+pair[1] - precision));
  23237. }
  23238. return func(number);
  23239. };
  23240. }
  23241. /**
  23242. * Creates a set object of `values`.
  23243. *
  23244. * @private
  23245. * @param {Array} values The values to add to the set.
  23246. * @returns {Object} Returns the new set.
  23247. */
  23248. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23249. return new Set(values);
  23250. };
  23251. /**
  23252. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23253. *
  23254. * @private
  23255. * @param {Function} keysFunc The function to get the keys of a given object.
  23256. * @returns {Function} Returns the new pairs function.
  23257. */
  23258. function createToPairs(keysFunc) {
  23259. return function(object) {
  23260. var tag = getTag(object);
  23261. if (tag == mapTag) {
  23262. return mapToArray(object);
  23263. }
  23264. if (tag == setTag) {
  23265. return setToPairs(object);
  23266. }
  23267. return baseToPairs(object, keysFunc(object));
  23268. };
  23269. }
  23270. /**
  23271. * Creates a function that either curries or invokes `func` with optional
  23272. * `this` binding and partially applied arguments.
  23273. *
  23274. * @private
  23275. * @param {Function|string} func The function or method name to wrap.
  23276. * @param {number} bitmask The bitmask flags.
  23277. * 1 - `_.bind`
  23278. * 2 - `_.bindKey`
  23279. * 4 - `_.curry` or `_.curryRight` of a bound function
  23280. * 8 - `_.curry`
  23281. * 16 - `_.curryRight`
  23282. * 32 - `_.partial`
  23283. * 64 - `_.partialRight`
  23284. * 128 - `_.rearg`
  23285. * 256 - `_.ary`
  23286. * 512 - `_.flip`
  23287. * @param {*} [thisArg] The `this` binding of `func`.
  23288. * @param {Array} [partials] The arguments to be partially applied.
  23289. * @param {Array} [holders] The `partials` placeholder indexes.
  23290. * @param {Array} [argPos] The argument positions of the new function.
  23291. * @param {number} [ary] The arity cap of `func`.
  23292. * @param {number} [arity] The arity of `func`.
  23293. * @returns {Function} Returns the new wrapped function.
  23294. */
  23295. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23296. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23297. if (!isBindKey && typeof func != 'function') {
  23298. throw new TypeError(FUNC_ERROR_TEXT);
  23299. }
  23300. var length = partials ? partials.length : 0;
  23301. if (!length) {
  23302. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23303. partials = holders = undefined;
  23304. }
  23305. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23306. arity = arity === undefined ? arity : toInteger(arity);
  23307. length -= holders ? holders.length : 0;
  23308. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23309. var partialsRight = partials,
  23310. holdersRight = holders;
  23311. partials = holders = undefined;
  23312. }
  23313. var data = isBindKey ? undefined : getData(func);
  23314. var newData = [
  23315. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23316. argPos, ary, arity
  23317. ];
  23318. if (data) {
  23319. mergeData(newData, data);
  23320. }
  23321. func = newData[0];
  23322. bitmask = newData[1];
  23323. thisArg = newData[2];
  23324. partials = newData[3];
  23325. holders = newData[4];
  23326. arity = newData[9] = newData[9] === undefined
  23327. ? (isBindKey ? 0 : func.length)
  23328. : nativeMax(newData[9] - length, 0);
  23329. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23330. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23331. }
  23332. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23333. var result = createBind(func, bitmask, thisArg);
  23334. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23335. result = createCurry(func, bitmask, arity);
  23336. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23337. result = createPartial(func, bitmask, thisArg, partials);
  23338. } else {
  23339. result = createHybrid.apply(undefined, newData);
  23340. }
  23341. var setter = data ? baseSetData : setData;
  23342. return setWrapToString(setter(result, newData), func, bitmask);
  23343. }
  23344. /**
  23345. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23346. * of source objects to the destination object for all destination properties
  23347. * that resolve to `undefined`.
  23348. *
  23349. * @private
  23350. * @param {*} objValue The destination value.
  23351. * @param {*} srcValue The source value.
  23352. * @param {string} key The key of the property to assign.
  23353. * @param {Object} object The parent object of `objValue`.
  23354. * @returns {*} Returns the value to assign.
  23355. */
  23356. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23357. if (objValue === undefined ||
  23358. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23359. return srcValue;
  23360. }
  23361. return objValue;
  23362. }
  23363. /**
  23364. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23365. * objects into destination objects that are passed thru.
  23366. *
  23367. * @private
  23368. * @param {*} objValue The destination value.
  23369. * @param {*} srcValue The source value.
  23370. * @param {string} key The key of the property to merge.
  23371. * @param {Object} object The parent object of `objValue`.
  23372. * @param {Object} source The parent object of `srcValue`.
  23373. * @param {Object} [stack] Tracks traversed source values and their merged
  23374. * counterparts.
  23375. * @returns {*} Returns the value to assign.
  23376. */
  23377. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23378. if (isObject(objValue) && isObject(srcValue)) {
  23379. // Recursively merge objects and arrays (susceptible to call stack limits).
  23380. stack.set(srcValue, objValue);
  23381. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23382. stack['delete'](srcValue);
  23383. }
  23384. return objValue;
  23385. }
  23386. /**
  23387. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23388. * objects.
  23389. *
  23390. * @private
  23391. * @param {*} value The value to inspect.
  23392. * @param {string} key The key of the property to inspect.
  23393. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23394. */
  23395. function customOmitClone(value) {
  23396. return isPlainObject(value) ? undefined : value;
  23397. }
  23398. /**
  23399. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23400. * partial deep comparisons.
  23401. *
  23402. * @private
  23403. * @param {Array} array The array to compare.
  23404. * @param {Array} other The other array to compare.
  23405. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23406. * @param {Function} customizer The function to customize comparisons.
  23407. * @param {Function} equalFunc The function to determine equivalents of values.
  23408. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23409. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23410. */
  23411. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23412. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23413. arrLength = array.length,
  23414. othLength = other.length;
  23415. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23416. return false;
  23417. }
  23418. // Assume cyclic values are equal.
  23419. var stacked = stack.get(array);
  23420. if (stacked && stack.get(other)) {
  23421. return stacked == other;
  23422. }
  23423. var index = -1,
  23424. result = true,
  23425. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23426. stack.set(array, other);
  23427. stack.set(other, array);
  23428. // Ignore non-index properties.
  23429. while (++index < arrLength) {
  23430. var arrValue = array[index],
  23431. othValue = other[index];
  23432. if (customizer) {
  23433. var compared = isPartial
  23434. ? customizer(othValue, arrValue, index, other, array, stack)
  23435. : customizer(arrValue, othValue, index, array, other, stack);
  23436. }
  23437. if (compared !== undefined) {
  23438. if (compared) {
  23439. continue;
  23440. }
  23441. result = false;
  23442. break;
  23443. }
  23444. // Recursively compare arrays (susceptible to call stack limits).
  23445. if (seen) {
  23446. if (!arraySome(other, function(othValue, othIndex) {
  23447. if (!cacheHas(seen, othIndex) &&
  23448. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23449. return seen.push(othIndex);
  23450. }
  23451. })) {
  23452. result = false;
  23453. break;
  23454. }
  23455. } else if (!(
  23456. arrValue === othValue ||
  23457. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23458. )) {
  23459. result = false;
  23460. break;
  23461. }
  23462. }
  23463. stack['delete'](array);
  23464. stack['delete'](other);
  23465. return result;
  23466. }
  23467. /**
  23468. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23469. * the same `toStringTag`.
  23470. *
  23471. * **Note:** This function only supports comparing values with tags of
  23472. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23473. *
  23474. * @private
  23475. * @param {Object} object The object to compare.
  23476. * @param {Object} other The other object to compare.
  23477. * @param {string} tag The `toStringTag` of the objects to compare.
  23478. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23479. * @param {Function} customizer The function to customize comparisons.
  23480. * @param {Function} equalFunc The function to determine equivalents of values.
  23481. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23482. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23483. */
  23484. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23485. switch (tag) {
  23486. case dataViewTag:
  23487. if ((object.byteLength != other.byteLength) ||
  23488. (object.byteOffset != other.byteOffset)) {
  23489. return false;
  23490. }
  23491. object = object.buffer;
  23492. other = other.buffer;
  23493. case arrayBufferTag:
  23494. if ((object.byteLength != other.byteLength) ||
  23495. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23496. return false;
  23497. }
  23498. return true;
  23499. case boolTag:
  23500. case dateTag:
  23501. case numberTag:
  23502. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23503. // Invalid dates are coerced to `NaN`.
  23504. return eq(+object, +other);
  23505. case errorTag:
  23506. return object.name == other.name && object.message == other.message;
  23507. case regexpTag:
  23508. case stringTag:
  23509. // Coerce regexes to strings and treat strings, primitives and objects,
  23510. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23511. // for more details.
  23512. return object == (other + '');
  23513. case mapTag:
  23514. var convert = mapToArray;
  23515. case setTag:
  23516. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23517. convert || (convert = setToArray);
  23518. if (object.size != other.size && !isPartial) {
  23519. return false;
  23520. }
  23521. // Assume cyclic values are equal.
  23522. var stacked = stack.get(object);
  23523. if (stacked) {
  23524. return stacked == other;
  23525. }
  23526. bitmask |= COMPARE_UNORDERED_FLAG;
  23527. // Recursively compare objects (susceptible to call stack limits).
  23528. stack.set(object, other);
  23529. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23530. stack['delete'](object);
  23531. return result;
  23532. case symbolTag:
  23533. if (symbolValueOf) {
  23534. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23535. }
  23536. }
  23537. return false;
  23538. }
  23539. /**
  23540. * A specialized version of `baseIsEqualDeep` for objects with support for
  23541. * partial deep comparisons.
  23542. *
  23543. * @private
  23544. * @param {Object} object The object to compare.
  23545. * @param {Object} other The other object to compare.
  23546. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23547. * @param {Function} customizer The function to customize comparisons.
  23548. * @param {Function} equalFunc The function to determine equivalents of values.
  23549. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23550. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23551. */
  23552. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23553. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23554. objProps = getAllKeys(object),
  23555. objLength = objProps.length,
  23556. othProps = getAllKeys(other),
  23557. othLength = othProps.length;
  23558. if (objLength != othLength && !isPartial) {
  23559. return false;
  23560. }
  23561. var index = objLength;
  23562. while (index--) {
  23563. var key = objProps[index];
  23564. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23565. return false;
  23566. }
  23567. }
  23568. // Assume cyclic values are equal.
  23569. var stacked = stack.get(object);
  23570. if (stacked && stack.get(other)) {
  23571. return stacked == other;
  23572. }
  23573. var result = true;
  23574. stack.set(object, other);
  23575. stack.set(other, object);
  23576. var skipCtor = isPartial;
  23577. while (++index < objLength) {
  23578. key = objProps[index];
  23579. var objValue = object[key],
  23580. othValue = other[key];
  23581. if (customizer) {
  23582. var compared = isPartial
  23583. ? customizer(othValue, objValue, key, other, object, stack)
  23584. : customizer(objValue, othValue, key, object, other, stack);
  23585. }
  23586. // Recursively compare objects (susceptible to call stack limits).
  23587. if (!(compared === undefined
  23588. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23589. : compared
  23590. )) {
  23591. result = false;
  23592. break;
  23593. }
  23594. skipCtor || (skipCtor = key == 'constructor');
  23595. }
  23596. if (result && !skipCtor) {
  23597. var objCtor = object.constructor,
  23598. othCtor = other.constructor;
  23599. // Non `Object` object instances with different constructors are not equal.
  23600. if (objCtor != othCtor &&
  23601. ('constructor' in object && 'constructor' in other) &&
  23602. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23603. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23604. result = false;
  23605. }
  23606. }
  23607. stack['delete'](object);
  23608. stack['delete'](other);
  23609. return result;
  23610. }
  23611. /**
  23612. * A specialized version of `baseRest` which flattens the rest array.
  23613. *
  23614. * @private
  23615. * @param {Function} func The function to apply a rest parameter to.
  23616. * @returns {Function} Returns the new function.
  23617. */
  23618. function flatRest(func) {
  23619. return setToString(overRest(func, undefined, flatten), func + '');
  23620. }
  23621. /**
  23622. * Creates an array of own enumerable property names and symbols of `object`.
  23623. *
  23624. * @private
  23625. * @param {Object} object The object to query.
  23626. * @returns {Array} Returns the array of property names and symbols.
  23627. */
  23628. function getAllKeys(object) {
  23629. return baseGetAllKeys(object, keys, getSymbols);
  23630. }
  23631. /**
  23632. * Creates an array of own and inherited enumerable property names and
  23633. * symbols of `object`.
  23634. *
  23635. * @private
  23636. * @param {Object} object The object to query.
  23637. * @returns {Array} Returns the array of property names and symbols.
  23638. */
  23639. function getAllKeysIn(object) {
  23640. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23641. }
  23642. /**
  23643. * Gets metadata for `func`.
  23644. *
  23645. * @private
  23646. * @param {Function} func The function to query.
  23647. * @returns {*} Returns the metadata for `func`.
  23648. */
  23649. var getData = !metaMap ? noop : function(func) {
  23650. return metaMap.get(func);
  23651. };
  23652. /**
  23653. * Gets the name of `func`.
  23654. *
  23655. * @private
  23656. * @param {Function} func The function to query.
  23657. * @returns {string} Returns the function name.
  23658. */
  23659. function getFuncName(func) {
  23660. var result = (func.name + ''),
  23661. array = realNames[result],
  23662. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23663. while (length--) {
  23664. var data = array[length],
  23665. otherFunc = data.func;
  23666. if (otherFunc == null || otherFunc == func) {
  23667. return data.name;
  23668. }
  23669. }
  23670. return result;
  23671. }
  23672. /**
  23673. * Gets the argument placeholder value for `func`.
  23674. *
  23675. * @private
  23676. * @param {Function} func The function to inspect.
  23677. * @returns {*} Returns the placeholder value.
  23678. */
  23679. function getHolder(func) {
  23680. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23681. return object.placeholder;
  23682. }
  23683. /**
  23684. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23685. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23686. * If arguments are provided, the chosen function is invoked with them and
  23687. * its result is returned.
  23688. *
  23689. * @private
  23690. * @param {*} [value] The value to convert to an iteratee.
  23691. * @param {number} [arity] The arity of the created iteratee.
  23692. * @returns {Function} Returns the chosen function or its result.
  23693. */
  23694. function getIteratee() {
  23695. var result = lodash.iteratee || iteratee;
  23696. result = result === iteratee ? baseIteratee : result;
  23697. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23698. }
  23699. /**
  23700. * Gets the data for `map`.
  23701. *
  23702. * @private
  23703. * @param {Object} map The map to query.
  23704. * @param {string} key The reference key.
  23705. * @returns {*} Returns the map data.
  23706. */
  23707. function getMapData(map, key) {
  23708. var data = map.__data__;
  23709. return isKeyable(key)
  23710. ? data[typeof key == 'string' ? 'string' : 'hash']
  23711. : data.map;
  23712. }
  23713. /**
  23714. * Gets the property names, values, and compare flags of `object`.
  23715. *
  23716. * @private
  23717. * @param {Object} object The object to query.
  23718. * @returns {Array} Returns the match data of `object`.
  23719. */
  23720. function getMatchData(object) {
  23721. var result = keys(object),
  23722. length = result.length;
  23723. while (length--) {
  23724. var key = result[length],
  23725. value = object[key];
  23726. result[length] = [key, value, isStrictComparable(value)];
  23727. }
  23728. return result;
  23729. }
  23730. /**
  23731. * Gets the native function at `key` of `object`.
  23732. *
  23733. * @private
  23734. * @param {Object} object The object to query.
  23735. * @param {string} key The key of the method to get.
  23736. * @returns {*} Returns the function if it's native, else `undefined`.
  23737. */
  23738. function getNative(object, key) {
  23739. var value = getValue(object, key);
  23740. return baseIsNative(value) ? value : undefined;
  23741. }
  23742. /**
  23743. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23744. *
  23745. * @private
  23746. * @param {*} value The value to query.
  23747. * @returns {string} Returns the raw `toStringTag`.
  23748. */
  23749. function getRawTag(value) {
  23750. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23751. tag = value[symToStringTag];
  23752. try {
  23753. value[symToStringTag] = undefined;
  23754. var unmasked = true;
  23755. } catch (e) {}
  23756. var result = nativeObjectToString.call(value);
  23757. if (unmasked) {
  23758. if (isOwn) {
  23759. value[symToStringTag] = tag;
  23760. } else {
  23761. delete value[symToStringTag];
  23762. }
  23763. }
  23764. return result;
  23765. }
  23766. /**
  23767. * Creates an array of the own 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 getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23774. if (object == null) {
  23775. return [];
  23776. }
  23777. object = Object(object);
  23778. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23779. return propertyIsEnumerable.call(object, symbol);
  23780. });
  23781. };
  23782. /**
  23783. * Creates an array of the own and inherited enumerable symbols of `object`.
  23784. *
  23785. * @private
  23786. * @param {Object} object The object to query.
  23787. * @returns {Array} Returns the array of symbols.
  23788. */
  23789. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23790. var result = [];
  23791. while (object) {
  23792. arrayPush(result, getSymbols(object));
  23793. object = getPrototype(object);
  23794. }
  23795. return result;
  23796. };
  23797. /**
  23798. * Gets the `toStringTag` of `value`.
  23799. *
  23800. * @private
  23801. * @param {*} value The value to query.
  23802. * @returns {string} Returns the `toStringTag`.
  23803. */
  23804. var getTag = baseGetTag;
  23805. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23806. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23807. (Map && getTag(new Map) != mapTag) ||
  23808. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23809. (Set && getTag(new Set) != setTag) ||
  23810. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23811. getTag = function(value) {
  23812. var result = baseGetTag(value),
  23813. Ctor = result == objectTag ? value.constructor : undefined,
  23814. ctorString = Ctor ? toSource(Ctor) : '';
  23815. if (ctorString) {
  23816. switch (ctorString) {
  23817. case dataViewCtorString: return dataViewTag;
  23818. case mapCtorString: return mapTag;
  23819. case promiseCtorString: return promiseTag;
  23820. case setCtorString: return setTag;
  23821. case weakMapCtorString: return weakMapTag;
  23822. }
  23823. }
  23824. return result;
  23825. };
  23826. }
  23827. /**
  23828. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23829. *
  23830. * @private
  23831. * @param {number} start The start of the view.
  23832. * @param {number} end The end of the view.
  23833. * @param {Array} transforms The transformations to apply to the view.
  23834. * @returns {Object} Returns an object containing the `start` and `end`
  23835. * positions of the view.
  23836. */
  23837. function getView(start, end, transforms) {
  23838. var index = -1,
  23839. length = transforms.length;
  23840. while (++index < length) {
  23841. var data = transforms[index],
  23842. size = data.size;
  23843. switch (data.type) {
  23844. case 'drop': start += size; break;
  23845. case 'dropRight': end -= size; break;
  23846. case 'take': end = nativeMin(end, start + size); break;
  23847. case 'takeRight': start = nativeMax(start, end - size); break;
  23848. }
  23849. }
  23850. return { 'start': start, 'end': end };
  23851. }
  23852. /**
  23853. * Extracts wrapper details from the `source` body comment.
  23854. *
  23855. * @private
  23856. * @param {string} source The source to inspect.
  23857. * @returns {Array} Returns the wrapper details.
  23858. */
  23859. function getWrapDetails(source) {
  23860. var match = source.match(reWrapDetails);
  23861. return match ? match[1].split(reSplitDetails) : [];
  23862. }
  23863. /**
  23864. * Checks if `path` exists on `object`.
  23865. *
  23866. * @private
  23867. * @param {Object} object The object to query.
  23868. * @param {Array|string} path The path to check.
  23869. * @param {Function} hasFunc The function to check properties.
  23870. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23871. */
  23872. function hasPath(object, path, hasFunc) {
  23873. path = castPath(path, object);
  23874. var index = -1,
  23875. length = path.length,
  23876. result = false;
  23877. while (++index < length) {
  23878. var key = toKey(path[index]);
  23879. if (!(result = object != null && hasFunc(object, key))) {
  23880. break;
  23881. }
  23882. object = object[key];
  23883. }
  23884. if (result || ++index != length) {
  23885. return result;
  23886. }
  23887. length = object == null ? 0 : object.length;
  23888. return !!length && isLength(length) && isIndex(key, length) &&
  23889. (isArray(object) || isArguments(object));
  23890. }
  23891. /**
  23892. * Initializes an array clone.
  23893. *
  23894. * @private
  23895. * @param {Array} array The array to clone.
  23896. * @returns {Array} Returns the initialized clone.
  23897. */
  23898. function initCloneArray(array) {
  23899. var length = array.length,
  23900. result = new array.constructor(length);
  23901. // Add properties assigned by `RegExp#exec`.
  23902. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  23903. result.index = array.index;
  23904. result.input = array.input;
  23905. }
  23906. return result;
  23907. }
  23908. /**
  23909. * Initializes an object clone.
  23910. *
  23911. * @private
  23912. * @param {Object} object The object to clone.
  23913. * @returns {Object} Returns the initialized clone.
  23914. */
  23915. function initCloneObject(object) {
  23916. return (typeof object.constructor == 'function' && !isPrototype(object))
  23917. ? baseCreate(getPrototype(object))
  23918. : {};
  23919. }
  23920. /**
  23921. * Initializes an object clone based on its `toStringTag`.
  23922. *
  23923. * **Note:** This function only supports cloning values with tags of
  23924. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  23925. *
  23926. * @private
  23927. * @param {Object} object The object to clone.
  23928. * @param {string} tag The `toStringTag` of the object to clone.
  23929. * @param {boolean} [isDeep] Specify a deep clone.
  23930. * @returns {Object} Returns the initialized clone.
  23931. */
  23932. function initCloneByTag(object, tag, isDeep) {
  23933. var Ctor = object.constructor;
  23934. switch (tag) {
  23935. case arrayBufferTag:
  23936. return cloneArrayBuffer(object);
  23937. case boolTag:
  23938. case dateTag:
  23939. return new Ctor(+object);
  23940. case dataViewTag:
  23941. return cloneDataView(object, isDeep);
  23942. case float32Tag: case float64Tag:
  23943. case int8Tag: case int16Tag: case int32Tag:
  23944. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  23945. return cloneTypedArray(object, isDeep);
  23946. case mapTag:
  23947. return new Ctor;
  23948. case numberTag:
  23949. case stringTag:
  23950. return new Ctor(object);
  23951. case regexpTag:
  23952. return cloneRegExp(object);
  23953. case setTag:
  23954. return new Ctor;
  23955. case symbolTag:
  23956. return cloneSymbol(object);
  23957. }
  23958. }
  23959. /**
  23960. * Inserts wrapper `details` in a comment at the top of the `source` body.
  23961. *
  23962. * @private
  23963. * @param {string} source The source to modify.
  23964. * @returns {Array} details The details to insert.
  23965. * @returns {string} Returns the modified source.
  23966. */
  23967. function insertWrapDetails(source, details) {
  23968. var length = details.length;
  23969. if (!length) {
  23970. return source;
  23971. }
  23972. var lastIndex = length - 1;
  23973. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  23974. details = details.join(length > 2 ? ', ' : ' ');
  23975. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  23976. }
  23977. /**
  23978. * Checks if `value` is a flattenable `arguments` object or array.
  23979. *
  23980. * @private
  23981. * @param {*} value The value to check.
  23982. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  23983. */
  23984. function isFlattenable(value) {
  23985. return isArray(value) || isArguments(value) ||
  23986. !!(spreadableSymbol && value && value[spreadableSymbol]);
  23987. }
  23988. /**
  23989. * Checks if `value` is a valid array-like index.
  23990. *
  23991. * @private
  23992. * @param {*} value The value to check.
  23993. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  23994. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  23995. */
  23996. function isIndex(value, length) {
  23997. var type = typeof value;
  23998. length = length == null ? MAX_SAFE_INTEGER : length;
  23999. return !!length &&
  24000. (type == 'number' ||
  24001. (type != 'symbol' && reIsUint.test(value))) &&
  24002. (value > -1 && value % 1 == 0 && value < length);
  24003. }
  24004. /**
  24005. * Checks if the given arguments are from an iteratee call.
  24006. *
  24007. * @private
  24008. * @param {*} value The potential iteratee value argument.
  24009. * @param {*} index The potential iteratee index or key argument.
  24010. * @param {*} object The potential iteratee object argument.
  24011. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24012. * else `false`.
  24013. */
  24014. function isIterateeCall(value, index, object) {
  24015. if (!isObject(object)) {
  24016. return false;
  24017. }
  24018. var type = typeof index;
  24019. if (type == 'number'
  24020. ? (isArrayLike(object) && isIndex(index, object.length))
  24021. : (type == 'string' && index in object)
  24022. ) {
  24023. return eq(object[index], value);
  24024. }
  24025. return false;
  24026. }
  24027. /**
  24028. * Checks if `value` is a property name and not a property path.
  24029. *
  24030. * @private
  24031. * @param {*} value The value to check.
  24032. * @param {Object} [object] The object to query keys on.
  24033. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24034. */
  24035. function isKey(value, object) {
  24036. if (isArray(value)) {
  24037. return false;
  24038. }
  24039. var type = typeof value;
  24040. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24041. value == null || isSymbol(value)) {
  24042. return true;
  24043. }
  24044. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24045. (object != null && value in Object(object));
  24046. }
  24047. /**
  24048. * Checks if `value` is suitable for use as unique object key.
  24049. *
  24050. * @private
  24051. * @param {*} value The value to check.
  24052. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24053. */
  24054. function isKeyable(value) {
  24055. var type = typeof value;
  24056. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24057. ? (value !== '__proto__')
  24058. : (value === null);
  24059. }
  24060. /**
  24061. * Checks if `func` has a lazy counterpart.
  24062. *
  24063. * @private
  24064. * @param {Function} func The function to check.
  24065. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24066. * else `false`.
  24067. */
  24068. function isLaziable(func) {
  24069. var funcName = getFuncName(func),
  24070. other = lodash[funcName];
  24071. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24072. return false;
  24073. }
  24074. if (func === other) {
  24075. return true;
  24076. }
  24077. var data = getData(other);
  24078. return !!data && func === data[0];
  24079. }
  24080. /**
  24081. * Checks if `func` has its source masked.
  24082. *
  24083. * @private
  24084. * @param {Function} func The function to check.
  24085. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24086. */
  24087. function isMasked(func) {
  24088. return !!maskSrcKey && (maskSrcKey in func);
  24089. }
  24090. /**
  24091. * Checks if `func` is capable of being masked.
  24092. *
  24093. * @private
  24094. * @param {*} value The value to check.
  24095. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24096. */
  24097. var isMaskable = coreJsData ? isFunction : stubFalse;
  24098. /**
  24099. * Checks if `value` is likely a prototype object.
  24100. *
  24101. * @private
  24102. * @param {*} value The value to check.
  24103. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24104. */
  24105. function isPrototype(value) {
  24106. var Ctor = value && value.constructor,
  24107. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24108. return value === proto;
  24109. }
  24110. /**
  24111. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24112. *
  24113. * @private
  24114. * @param {*} value The value to check.
  24115. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24116. * equality comparisons, else `false`.
  24117. */
  24118. function isStrictComparable(value) {
  24119. return value === value && !isObject(value);
  24120. }
  24121. /**
  24122. * A specialized version of `matchesProperty` for source values suitable
  24123. * for strict equality comparisons, i.e. `===`.
  24124. *
  24125. * @private
  24126. * @param {string} key The key of the property to get.
  24127. * @param {*} srcValue The value to match.
  24128. * @returns {Function} Returns the new spec function.
  24129. */
  24130. function matchesStrictComparable(key, srcValue) {
  24131. return function(object) {
  24132. if (object == null) {
  24133. return false;
  24134. }
  24135. return object[key] === srcValue &&
  24136. (srcValue !== undefined || (key in Object(object)));
  24137. };
  24138. }
  24139. /**
  24140. * A specialized version of `_.memoize` which clears the memoized function's
  24141. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24142. *
  24143. * @private
  24144. * @param {Function} func The function to have its output memoized.
  24145. * @returns {Function} Returns the new memoized function.
  24146. */
  24147. function memoizeCapped(func) {
  24148. var result = memoize(func, function(key) {
  24149. if (cache.size === MAX_MEMOIZE_SIZE) {
  24150. cache.clear();
  24151. }
  24152. return key;
  24153. });
  24154. var cache = result.cache;
  24155. return result;
  24156. }
  24157. /**
  24158. * Merges the function metadata of `source` into `data`.
  24159. *
  24160. * Merging metadata reduces the number of wrappers used to invoke a function.
  24161. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24162. * may be applied regardless of execution order. Methods like `_.ary` and
  24163. * `_.rearg` modify function arguments, making the order in which they are
  24164. * executed important, preventing the merging of metadata. However, we make
  24165. * an exception for a safe combined case where curried functions have `_.ary`
  24166. * and or `_.rearg` applied.
  24167. *
  24168. * @private
  24169. * @param {Array} data The destination metadata.
  24170. * @param {Array} source The source metadata.
  24171. * @returns {Array} Returns `data`.
  24172. */
  24173. function mergeData(data, source) {
  24174. var bitmask = data[1],
  24175. srcBitmask = source[1],
  24176. newBitmask = bitmask | srcBitmask,
  24177. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24178. var isCombo =
  24179. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24180. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24181. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24182. // Exit early if metadata can't be merged.
  24183. if (!(isCommon || isCombo)) {
  24184. return data;
  24185. }
  24186. // Use source `thisArg` if available.
  24187. if (srcBitmask & WRAP_BIND_FLAG) {
  24188. data[2] = source[2];
  24189. // Set when currying a bound function.
  24190. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24191. }
  24192. // Compose partial arguments.
  24193. var value = source[3];
  24194. if (value) {
  24195. var partials = data[3];
  24196. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24197. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24198. }
  24199. // Compose partial right arguments.
  24200. value = source[5];
  24201. if (value) {
  24202. partials = data[5];
  24203. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24204. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24205. }
  24206. // Use source `argPos` if available.
  24207. value = source[7];
  24208. if (value) {
  24209. data[7] = value;
  24210. }
  24211. // Use source `ary` if it's smaller.
  24212. if (srcBitmask & WRAP_ARY_FLAG) {
  24213. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24214. }
  24215. // Use source `arity` if one is not provided.
  24216. if (data[9] == null) {
  24217. data[9] = source[9];
  24218. }
  24219. // Use source `func` and merge bitmasks.
  24220. data[0] = source[0];
  24221. data[1] = newBitmask;
  24222. return data;
  24223. }
  24224. /**
  24225. * This function is like
  24226. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24227. * except that it includes inherited enumerable properties.
  24228. *
  24229. * @private
  24230. * @param {Object} object The object to query.
  24231. * @returns {Array} Returns the array of property names.
  24232. */
  24233. function nativeKeysIn(object) {
  24234. var result = [];
  24235. if (object != null) {
  24236. for (var key in Object(object)) {
  24237. result.push(key);
  24238. }
  24239. }
  24240. return result;
  24241. }
  24242. /**
  24243. * Converts `value` to a string using `Object.prototype.toString`.
  24244. *
  24245. * @private
  24246. * @param {*} value The value to convert.
  24247. * @returns {string} Returns the converted string.
  24248. */
  24249. function objectToString(value) {
  24250. return nativeObjectToString.call(value);
  24251. }
  24252. /**
  24253. * A specialized version of `baseRest` which transforms the rest array.
  24254. *
  24255. * @private
  24256. * @param {Function} func The function to apply a rest parameter to.
  24257. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24258. * @param {Function} transform The rest array transform.
  24259. * @returns {Function} Returns the new function.
  24260. */
  24261. function overRest(func, start, transform) {
  24262. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24263. return function() {
  24264. var args = arguments,
  24265. index = -1,
  24266. length = nativeMax(args.length - start, 0),
  24267. array = Array(length);
  24268. while (++index < length) {
  24269. array[index] = args[start + index];
  24270. }
  24271. index = -1;
  24272. var otherArgs = Array(start + 1);
  24273. while (++index < start) {
  24274. otherArgs[index] = args[index];
  24275. }
  24276. otherArgs[start] = transform(array);
  24277. return apply(func, this, otherArgs);
  24278. };
  24279. }
  24280. /**
  24281. * Gets the parent value at `path` of `object`.
  24282. *
  24283. * @private
  24284. * @param {Object} object The object to query.
  24285. * @param {Array} path The path to get the parent value of.
  24286. * @returns {*} Returns the parent value.
  24287. */
  24288. function parent(object, path) {
  24289. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24290. }
  24291. /**
  24292. * Reorder `array` according to the specified indexes where the element at
  24293. * the first index is assigned as the first element, the element at
  24294. * the second index is assigned as the second element, and so on.
  24295. *
  24296. * @private
  24297. * @param {Array} array The array to reorder.
  24298. * @param {Array} indexes The arranged array indexes.
  24299. * @returns {Array} Returns `array`.
  24300. */
  24301. function reorder(array, indexes) {
  24302. var arrLength = array.length,
  24303. length = nativeMin(indexes.length, arrLength),
  24304. oldArray = copyArray(array);
  24305. while (length--) {
  24306. var index = indexes[length];
  24307. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24308. }
  24309. return array;
  24310. }
  24311. /**
  24312. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24313. *
  24314. * @private
  24315. * @param {Object} object The object to query.
  24316. * @param {string} key The key of the property to get.
  24317. * @returns {*} Returns the property value.
  24318. */
  24319. function safeGet(object, key) {
  24320. if (key === 'constructor' && typeof object[key] === 'function') {
  24321. return;
  24322. }
  24323. if (key == '__proto__') {
  24324. return;
  24325. }
  24326. return object[key];
  24327. }
  24328. /**
  24329. * Sets metadata for `func`.
  24330. *
  24331. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24332. * period of time, it will trip its breaker and transition to an identity
  24333. * function to avoid garbage collection pauses in V8. See
  24334. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24335. * for more details.
  24336. *
  24337. * @private
  24338. * @param {Function} func The function to associate metadata with.
  24339. * @param {*} data The metadata.
  24340. * @returns {Function} Returns `func`.
  24341. */
  24342. var setData = shortOut(baseSetData);
  24343. /**
  24344. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24345. *
  24346. * @private
  24347. * @param {Function} func The function to delay.
  24348. * @param {number} wait The number of milliseconds to delay invocation.
  24349. * @returns {number|Object} Returns the timer id or timeout object.
  24350. */
  24351. var setTimeout = ctxSetTimeout || function(func, wait) {
  24352. return root.setTimeout(func, wait);
  24353. };
  24354. /**
  24355. * Sets the `toString` method of `func` to return `string`.
  24356. *
  24357. * @private
  24358. * @param {Function} func The function to modify.
  24359. * @param {Function} string The `toString` result.
  24360. * @returns {Function} Returns `func`.
  24361. */
  24362. var setToString = shortOut(baseSetToString);
  24363. /**
  24364. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24365. * with wrapper details in a comment at the top of the source body.
  24366. *
  24367. * @private
  24368. * @param {Function} wrapper The function to modify.
  24369. * @param {Function} reference The reference function.
  24370. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24371. * @returns {Function} Returns `wrapper`.
  24372. */
  24373. function setWrapToString(wrapper, reference, bitmask) {
  24374. var source = (reference + '');
  24375. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24376. }
  24377. /**
  24378. * Creates a function that'll short out and invoke `identity` instead
  24379. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24380. * milliseconds.
  24381. *
  24382. * @private
  24383. * @param {Function} func The function to restrict.
  24384. * @returns {Function} Returns the new shortable function.
  24385. */
  24386. function shortOut(func) {
  24387. var count = 0,
  24388. lastCalled = 0;
  24389. return function() {
  24390. var stamp = nativeNow(),
  24391. remaining = HOT_SPAN - (stamp - lastCalled);
  24392. lastCalled = stamp;
  24393. if (remaining > 0) {
  24394. if (++count >= HOT_COUNT) {
  24395. return arguments[0];
  24396. }
  24397. } else {
  24398. count = 0;
  24399. }
  24400. return func.apply(undefined, arguments);
  24401. };
  24402. }
  24403. /**
  24404. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24405. *
  24406. * @private
  24407. * @param {Array} array The array to shuffle.
  24408. * @param {number} [size=array.length] The size of `array`.
  24409. * @returns {Array} Returns `array`.
  24410. */
  24411. function shuffleSelf(array, size) {
  24412. var index = -1,
  24413. length = array.length,
  24414. lastIndex = length - 1;
  24415. size = size === undefined ? length : size;
  24416. while (++index < size) {
  24417. var rand = baseRandom(index, lastIndex),
  24418. value = array[rand];
  24419. array[rand] = array[index];
  24420. array[index] = value;
  24421. }
  24422. array.length = size;
  24423. return array;
  24424. }
  24425. /**
  24426. * Converts `string` to a property path array.
  24427. *
  24428. * @private
  24429. * @param {string} string The string to convert.
  24430. * @returns {Array} Returns the property path array.
  24431. */
  24432. var stringToPath = memoizeCapped(function(string) {
  24433. var result = [];
  24434. if (string.charCodeAt(0) === 46 /* . */) {
  24435. result.push('');
  24436. }
  24437. string.replace(rePropName, function(match, number, quote, subString) {
  24438. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24439. });
  24440. return result;
  24441. });
  24442. /**
  24443. * Converts `value` to a string key if it's not a string or symbol.
  24444. *
  24445. * @private
  24446. * @param {*} value The value to inspect.
  24447. * @returns {string|symbol} Returns the key.
  24448. */
  24449. function toKey(value) {
  24450. if (typeof value == 'string' || isSymbol(value)) {
  24451. return value;
  24452. }
  24453. var result = (value + '');
  24454. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24455. }
  24456. /**
  24457. * Converts `func` to its source code.
  24458. *
  24459. * @private
  24460. * @param {Function} func The function to convert.
  24461. * @returns {string} Returns the source code.
  24462. */
  24463. function toSource(func) {
  24464. if (func != null) {
  24465. try {
  24466. return funcToString.call(func);
  24467. } catch (e) {}
  24468. try {
  24469. return (func + '');
  24470. } catch (e) {}
  24471. }
  24472. return '';
  24473. }
  24474. /**
  24475. * Updates wrapper `details` based on `bitmask` flags.
  24476. *
  24477. * @private
  24478. * @returns {Array} details The details to modify.
  24479. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24480. * @returns {Array} Returns `details`.
  24481. */
  24482. function updateWrapDetails(details, bitmask) {
  24483. arrayEach(wrapFlags, function(pair) {
  24484. var value = '_.' + pair[0];
  24485. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24486. details.push(value);
  24487. }
  24488. });
  24489. return details.sort();
  24490. }
  24491. /**
  24492. * Creates a clone of `wrapper`.
  24493. *
  24494. * @private
  24495. * @param {Object} wrapper The wrapper to clone.
  24496. * @returns {Object} Returns the cloned wrapper.
  24497. */
  24498. function wrapperClone(wrapper) {
  24499. if (wrapper instanceof LazyWrapper) {
  24500. return wrapper.clone();
  24501. }
  24502. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24503. result.__actions__ = copyArray(wrapper.__actions__);
  24504. result.__index__ = wrapper.__index__;
  24505. result.__values__ = wrapper.__values__;
  24506. return result;
  24507. }
  24508. /*------------------------------------------------------------------------*/
  24509. /**
  24510. * Creates an array of elements split into groups the length of `size`.
  24511. * If `array` can't be split evenly, the final chunk will be the remaining
  24512. * elements.
  24513. *
  24514. * @static
  24515. * @memberOf _
  24516. * @since 3.0.0
  24517. * @category Array
  24518. * @param {Array} array The array to process.
  24519. * @param {number} [size=1] The length of each chunk
  24520. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24521. * @returns {Array} Returns the new array of chunks.
  24522. * @example
  24523. *
  24524. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24525. * // => [['a', 'b'], ['c', 'd']]
  24526. *
  24527. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24528. * // => [['a', 'b', 'c'], ['d']]
  24529. */
  24530. function chunk(array, size, guard) {
  24531. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24532. size = 1;
  24533. } else {
  24534. size = nativeMax(toInteger(size), 0);
  24535. }
  24536. var length = array == null ? 0 : array.length;
  24537. if (!length || size < 1) {
  24538. return [];
  24539. }
  24540. var index = 0,
  24541. resIndex = 0,
  24542. result = Array(nativeCeil(length / size));
  24543. while (index < length) {
  24544. result[resIndex++] = baseSlice(array, index, (index += size));
  24545. }
  24546. return result;
  24547. }
  24548. /**
  24549. * Creates an array with all falsey values removed. The values `false`, `null`,
  24550. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24551. *
  24552. * @static
  24553. * @memberOf _
  24554. * @since 0.1.0
  24555. * @category Array
  24556. * @param {Array} array The array to compact.
  24557. * @returns {Array} Returns the new array of filtered values.
  24558. * @example
  24559. *
  24560. * _.compact([0, 1, false, 2, '', 3]);
  24561. * // => [1, 2, 3]
  24562. */
  24563. function compact(array) {
  24564. var index = -1,
  24565. length = array == null ? 0 : array.length,
  24566. resIndex = 0,
  24567. result = [];
  24568. while (++index < length) {
  24569. var value = array[index];
  24570. if (value) {
  24571. result[resIndex++] = value;
  24572. }
  24573. }
  24574. return result;
  24575. }
  24576. /**
  24577. * Creates a new array concatenating `array` with any additional arrays
  24578. * and/or values.
  24579. *
  24580. * @static
  24581. * @memberOf _
  24582. * @since 4.0.0
  24583. * @category Array
  24584. * @param {Array} array The array to concatenate.
  24585. * @param {...*} [values] The values to concatenate.
  24586. * @returns {Array} Returns the new concatenated array.
  24587. * @example
  24588. *
  24589. * var array = [1];
  24590. * var other = _.concat(array, 2, [3], [[4]]);
  24591. *
  24592. * console.log(other);
  24593. * // => [1, 2, 3, [4]]
  24594. *
  24595. * console.log(array);
  24596. * // => [1]
  24597. */
  24598. function concat() {
  24599. var length = arguments.length;
  24600. if (!length) {
  24601. return [];
  24602. }
  24603. var args = Array(length - 1),
  24604. array = arguments[0],
  24605. index = length;
  24606. while (index--) {
  24607. args[index - 1] = arguments[index];
  24608. }
  24609. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24610. }
  24611. /**
  24612. * Creates an array of `array` values not included in the other given arrays
  24613. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24614. * for equality comparisons. The order and references of result values are
  24615. * determined by the first array.
  24616. *
  24617. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24618. *
  24619. * @static
  24620. * @memberOf _
  24621. * @since 0.1.0
  24622. * @category Array
  24623. * @param {Array} array The array to inspect.
  24624. * @param {...Array} [values] The values to exclude.
  24625. * @returns {Array} Returns the new array of filtered values.
  24626. * @see _.without, _.xor
  24627. * @example
  24628. *
  24629. * _.difference([2, 1], [2, 3]);
  24630. * // => [1]
  24631. */
  24632. var difference = baseRest(function(array, values) {
  24633. return isArrayLikeObject(array)
  24634. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24635. : [];
  24636. });
  24637. /**
  24638. * This method is like `_.difference` except that it accepts `iteratee` which
  24639. * is invoked for each element of `array` and `values` to generate the criterion
  24640. * by which they're compared. The order and references of result values are
  24641. * determined by the first array. The iteratee is invoked with one argument:
  24642. * (value).
  24643. *
  24644. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24645. *
  24646. * @static
  24647. * @memberOf _
  24648. * @since 4.0.0
  24649. * @category Array
  24650. * @param {Array} array The array to inspect.
  24651. * @param {...Array} [values] The values to exclude.
  24652. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24653. * @returns {Array} Returns the new array of filtered values.
  24654. * @example
  24655. *
  24656. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24657. * // => [1.2]
  24658. *
  24659. * // The `_.property` iteratee shorthand.
  24660. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24661. * // => [{ 'x': 2 }]
  24662. */
  24663. var differenceBy = baseRest(function(array, values) {
  24664. var iteratee = last(values);
  24665. if (isArrayLikeObject(iteratee)) {
  24666. iteratee = undefined;
  24667. }
  24668. return isArrayLikeObject(array)
  24669. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24670. : [];
  24671. });
  24672. /**
  24673. * This method is like `_.difference` except that it accepts `comparator`
  24674. * which is invoked to compare elements of `array` to `values`. The order and
  24675. * references of result values are determined by the first array. The comparator
  24676. * is invoked with two arguments: (arrVal, othVal).
  24677. *
  24678. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24679. *
  24680. * @static
  24681. * @memberOf _
  24682. * @since 4.0.0
  24683. * @category Array
  24684. * @param {Array} array The array to inspect.
  24685. * @param {...Array} [values] The values to exclude.
  24686. * @param {Function} [comparator] The comparator invoked per element.
  24687. * @returns {Array} Returns the new array of filtered values.
  24688. * @example
  24689. *
  24690. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24691. *
  24692. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24693. * // => [{ 'x': 2, 'y': 1 }]
  24694. */
  24695. var differenceWith = baseRest(function(array, values) {
  24696. var comparator = last(values);
  24697. if (isArrayLikeObject(comparator)) {
  24698. comparator = undefined;
  24699. }
  24700. return isArrayLikeObject(array)
  24701. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24702. : [];
  24703. });
  24704. /**
  24705. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24706. *
  24707. * @static
  24708. * @memberOf _
  24709. * @since 0.5.0
  24710. * @category Array
  24711. * @param {Array} array The array to query.
  24712. * @param {number} [n=1] The number of elements to drop.
  24713. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24714. * @returns {Array} Returns the slice of `array`.
  24715. * @example
  24716. *
  24717. * _.drop([1, 2, 3]);
  24718. * // => [2, 3]
  24719. *
  24720. * _.drop([1, 2, 3], 2);
  24721. * // => [3]
  24722. *
  24723. * _.drop([1, 2, 3], 5);
  24724. * // => []
  24725. *
  24726. * _.drop([1, 2, 3], 0);
  24727. * // => [1, 2, 3]
  24728. */
  24729. function drop(array, n, guard) {
  24730. var length = array == null ? 0 : array.length;
  24731. if (!length) {
  24732. return [];
  24733. }
  24734. n = (guard || n === undefined) ? 1 : toInteger(n);
  24735. return baseSlice(array, n < 0 ? 0 : n, length);
  24736. }
  24737. /**
  24738. * Creates a slice of `array` with `n` elements dropped from the end.
  24739. *
  24740. * @static
  24741. * @memberOf _
  24742. * @since 3.0.0
  24743. * @category Array
  24744. * @param {Array} array The array to query.
  24745. * @param {number} [n=1] The number of elements to drop.
  24746. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24747. * @returns {Array} Returns the slice of `array`.
  24748. * @example
  24749. *
  24750. * _.dropRight([1, 2, 3]);
  24751. * // => [1, 2]
  24752. *
  24753. * _.dropRight([1, 2, 3], 2);
  24754. * // => [1]
  24755. *
  24756. * _.dropRight([1, 2, 3], 5);
  24757. * // => []
  24758. *
  24759. * _.dropRight([1, 2, 3], 0);
  24760. * // => [1, 2, 3]
  24761. */
  24762. function dropRight(array, n, guard) {
  24763. var length = array == null ? 0 : array.length;
  24764. if (!length) {
  24765. return [];
  24766. }
  24767. n = (guard || n === undefined) ? 1 : toInteger(n);
  24768. n = length - n;
  24769. return baseSlice(array, 0, n < 0 ? 0 : n);
  24770. }
  24771. /**
  24772. * Creates a slice of `array` excluding elements dropped from the end.
  24773. * Elements are dropped until `predicate` returns falsey. The predicate is
  24774. * invoked with three arguments: (value, index, array).
  24775. *
  24776. * @static
  24777. * @memberOf _
  24778. * @since 3.0.0
  24779. * @category Array
  24780. * @param {Array} array The array to query.
  24781. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24782. * @returns {Array} Returns the slice of `array`.
  24783. * @example
  24784. *
  24785. * var users = [
  24786. * { 'user': 'barney', 'active': true },
  24787. * { 'user': 'fred', 'active': false },
  24788. * { 'user': 'pebbles', 'active': false }
  24789. * ];
  24790. *
  24791. * _.dropRightWhile(users, function(o) { return !o.active; });
  24792. * // => objects for ['barney']
  24793. *
  24794. * // The `_.matches` iteratee shorthand.
  24795. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24796. * // => objects for ['barney', 'fred']
  24797. *
  24798. * // The `_.matchesProperty` iteratee shorthand.
  24799. * _.dropRightWhile(users, ['active', false]);
  24800. * // => objects for ['barney']
  24801. *
  24802. * // The `_.property` iteratee shorthand.
  24803. * _.dropRightWhile(users, 'active');
  24804. * // => objects for ['barney', 'fred', 'pebbles']
  24805. */
  24806. function dropRightWhile(array, predicate) {
  24807. return (array && array.length)
  24808. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24809. : [];
  24810. }
  24811. /**
  24812. * Creates a slice of `array` excluding elements dropped from the beginning.
  24813. * Elements are dropped until `predicate` returns falsey. The predicate is
  24814. * invoked with three arguments: (value, index, array).
  24815. *
  24816. * @static
  24817. * @memberOf _
  24818. * @since 3.0.0
  24819. * @category Array
  24820. * @param {Array} array The array to query.
  24821. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24822. * @returns {Array} Returns the slice of `array`.
  24823. * @example
  24824. *
  24825. * var users = [
  24826. * { 'user': 'barney', 'active': false },
  24827. * { 'user': 'fred', 'active': false },
  24828. * { 'user': 'pebbles', 'active': true }
  24829. * ];
  24830. *
  24831. * _.dropWhile(users, function(o) { return !o.active; });
  24832. * // => objects for ['pebbles']
  24833. *
  24834. * // The `_.matches` iteratee shorthand.
  24835. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24836. * // => objects for ['fred', 'pebbles']
  24837. *
  24838. * // The `_.matchesProperty` iteratee shorthand.
  24839. * _.dropWhile(users, ['active', false]);
  24840. * // => objects for ['pebbles']
  24841. *
  24842. * // The `_.property` iteratee shorthand.
  24843. * _.dropWhile(users, 'active');
  24844. * // => objects for ['barney', 'fred', 'pebbles']
  24845. */
  24846. function dropWhile(array, predicate) {
  24847. return (array && array.length)
  24848. ? baseWhile(array, getIteratee(predicate, 3), true)
  24849. : [];
  24850. }
  24851. /**
  24852. * Fills elements of `array` with `value` from `start` up to, but not
  24853. * including, `end`.
  24854. *
  24855. * **Note:** This method mutates `array`.
  24856. *
  24857. * @static
  24858. * @memberOf _
  24859. * @since 3.2.0
  24860. * @category Array
  24861. * @param {Array} array The array to fill.
  24862. * @param {*} value The value to fill `array` with.
  24863. * @param {number} [start=0] The start position.
  24864. * @param {number} [end=array.length] The end position.
  24865. * @returns {Array} Returns `array`.
  24866. * @example
  24867. *
  24868. * var array = [1, 2, 3];
  24869. *
  24870. * _.fill(array, 'a');
  24871. * console.log(array);
  24872. * // => ['a', 'a', 'a']
  24873. *
  24874. * _.fill(Array(3), 2);
  24875. * // => [2, 2, 2]
  24876. *
  24877. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24878. * // => [4, '*', '*', 10]
  24879. */
  24880. function fill(array, value, start, end) {
  24881. var length = array == null ? 0 : array.length;
  24882. if (!length) {
  24883. return [];
  24884. }
  24885. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24886. start = 0;
  24887. end = length;
  24888. }
  24889. return baseFill(array, value, start, end);
  24890. }
  24891. /**
  24892. * This method is like `_.find` except that it returns the index of the first
  24893. * element `predicate` returns truthy for instead of the element itself.
  24894. *
  24895. * @static
  24896. * @memberOf _
  24897. * @since 1.1.0
  24898. * @category Array
  24899. * @param {Array} array The array to inspect.
  24900. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24901. * @param {number} [fromIndex=0] The index to search from.
  24902. * @returns {number} Returns the index of the found element, else `-1`.
  24903. * @example
  24904. *
  24905. * var users = [
  24906. * { 'user': 'barney', 'active': false },
  24907. * { 'user': 'fred', 'active': false },
  24908. * { 'user': 'pebbles', 'active': true }
  24909. * ];
  24910. *
  24911. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  24912. * // => 0
  24913. *
  24914. * // The `_.matches` iteratee shorthand.
  24915. * _.findIndex(users, { 'user': 'fred', 'active': false });
  24916. * // => 1
  24917. *
  24918. * // The `_.matchesProperty` iteratee shorthand.
  24919. * _.findIndex(users, ['active', false]);
  24920. * // => 0
  24921. *
  24922. * // The `_.property` iteratee shorthand.
  24923. * _.findIndex(users, 'active');
  24924. * // => 2
  24925. */
  24926. function findIndex(array, predicate, fromIndex) {
  24927. var length = array == null ? 0 : array.length;
  24928. if (!length) {
  24929. return -1;
  24930. }
  24931. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  24932. if (index < 0) {
  24933. index = nativeMax(length + index, 0);
  24934. }
  24935. return baseFindIndex(array, getIteratee(predicate, 3), index);
  24936. }
  24937. /**
  24938. * This method is like `_.findIndex` except that it iterates over elements
  24939. * of `collection` from right to left.
  24940. *
  24941. * @static
  24942. * @memberOf _
  24943. * @since 2.0.0
  24944. * @category Array
  24945. * @param {Array} array The array to inspect.
  24946. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24947. * @param {number} [fromIndex=array.length-1] The index to search from.
  24948. * @returns {number} Returns the index of the found element, else `-1`.
  24949. * @example
  24950. *
  24951. * var users = [
  24952. * { 'user': 'barney', 'active': true },
  24953. * { 'user': 'fred', 'active': false },
  24954. * { 'user': 'pebbles', 'active': false }
  24955. * ];
  24956. *
  24957. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  24958. * // => 2
  24959. *
  24960. * // The `_.matches` iteratee shorthand.
  24961. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  24962. * // => 0
  24963. *
  24964. * // The `_.matchesProperty` iteratee shorthand.
  24965. * _.findLastIndex(users, ['active', false]);
  24966. * // => 2
  24967. *
  24968. * // The `_.property` iteratee shorthand.
  24969. * _.findLastIndex(users, 'active');
  24970. * // => 0
  24971. */
  24972. function findLastIndex(array, predicate, fromIndex) {
  24973. var length = array == null ? 0 : array.length;
  24974. if (!length) {
  24975. return -1;
  24976. }
  24977. var index = length - 1;
  24978. if (fromIndex !== undefined) {
  24979. index = toInteger(fromIndex);
  24980. index = fromIndex < 0
  24981. ? nativeMax(length + index, 0)
  24982. : nativeMin(index, length - 1);
  24983. }
  24984. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  24985. }
  24986. /**
  24987. * Flattens `array` a single level deep.
  24988. *
  24989. * @static
  24990. * @memberOf _
  24991. * @since 0.1.0
  24992. * @category Array
  24993. * @param {Array} array The array to flatten.
  24994. * @returns {Array} Returns the new flattened array.
  24995. * @example
  24996. *
  24997. * _.flatten([1, [2, [3, [4]], 5]]);
  24998. * // => [1, 2, [3, [4]], 5]
  24999. */
  25000. function flatten(array) {
  25001. var length = array == null ? 0 : array.length;
  25002. return length ? baseFlatten(array, 1) : [];
  25003. }
  25004. /**
  25005. * Recursively flattens `array`.
  25006. *
  25007. * @static
  25008. * @memberOf _
  25009. * @since 3.0.0
  25010. * @category Array
  25011. * @param {Array} array The array to flatten.
  25012. * @returns {Array} Returns the new flattened array.
  25013. * @example
  25014. *
  25015. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25016. * // => [1, 2, 3, 4, 5]
  25017. */
  25018. function flattenDeep(array) {
  25019. var length = array == null ? 0 : array.length;
  25020. return length ? baseFlatten(array, INFINITY) : [];
  25021. }
  25022. /**
  25023. * Recursively flatten `array` up to `depth` times.
  25024. *
  25025. * @static
  25026. * @memberOf _
  25027. * @since 4.4.0
  25028. * @category Array
  25029. * @param {Array} array The array to flatten.
  25030. * @param {number} [depth=1] The maximum recursion depth.
  25031. * @returns {Array} Returns the new flattened array.
  25032. * @example
  25033. *
  25034. * var array = [1, [2, [3, [4]], 5]];
  25035. *
  25036. * _.flattenDepth(array, 1);
  25037. * // => [1, 2, [3, [4]], 5]
  25038. *
  25039. * _.flattenDepth(array, 2);
  25040. * // => [1, 2, 3, [4], 5]
  25041. */
  25042. function flattenDepth(array, depth) {
  25043. var length = array == null ? 0 : array.length;
  25044. if (!length) {
  25045. return [];
  25046. }
  25047. depth = depth === undefined ? 1 : toInteger(depth);
  25048. return baseFlatten(array, depth);
  25049. }
  25050. /**
  25051. * The inverse of `_.toPairs`; this method returns an object composed
  25052. * from key-value `pairs`.
  25053. *
  25054. * @static
  25055. * @memberOf _
  25056. * @since 4.0.0
  25057. * @category Array
  25058. * @param {Array} pairs The key-value pairs.
  25059. * @returns {Object} Returns the new object.
  25060. * @example
  25061. *
  25062. * _.fromPairs([['a', 1], ['b', 2]]);
  25063. * // => { 'a': 1, 'b': 2 }
  25064. */
  25065. function fromPairs(pairs) {
  25066. var index = -1,
  25067. length = pairs == null ? 0 : pairs.length,
  25068. result = {};
  25069. while (++index < length) {
  25070. var pair = pairs[index];
  25071. result[pair[0]] = pair[1];
  25072. }
  25073. return result;
  25074. }
  25075. /**
  25076. * Gets the first element of `array`.
  25077. *
  25078. * @static
  25079. * @memberOf _
  25080. * @since 0.1.0
  25081. * @alias first
  25082. * @category Array
  25083. * @param {Array} array The array to query.
  25084. * @returns {*} Returns the first element of `array`.
  25085. * @example
  25086. *
  25087. * _.head([1, 2, 3]);
  25088. * // => 1
  25089. *
  25090. * _.head([]);
  25091. * // => undefined
  25092. */
  25093. function head(array) {
  25094. return (array && array.length) ? array[0] : undefined;
  25095. }
  25096. /**
  25097. * Gets the index at which the first occurrence of `value` is found in `array`
  25098. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25099. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25100. * offset from the end of `array`.
  25101. *
  25102. * @static
  25103. * @memberOf _
  25104. * @since 0.1.0
  25105. * @category Array
  25106. * @param {Array} array The array to inspect.
  25107. * @param {*} value The value to search for.
  25108. * @param {number} [fromIndex=0] The index to search from.
  25109. * @returns {number} Returns the index of the matched value, else `-1`.
  25110. * @example
  25111. *
  25112. * _.indexOf([1, 2, 1, 2], 2);
  25113. * // => 1
  25114. *
  25115. * // Search from the `fromIndex`.
  25116. * _.indexOf([1, 2, 1, 2], 2, 2);
  25117. * // => 3
  25118. */
  25119. function indexOf(array, value, fromIndex) {
  25120. var length = array == null ? 0 : array.length;
  25121. if (!length) {
  25122. return -1;
  25123. }
  25124. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25125. if (index < 0) {
  25126. index = nativeMax(length + index, 0);
  25127. }
  25128. return baseIndexOf(array, value, index);
  25129. }
  25130. /**
  25131. * Gets all but the last element of `array`.
  25132. *
  25133. * @static
  25134. * @memberOf _
  25135. * @since 0.1.0
  25136. * @category Array
  25137. * @param {Array} array The array to query.
  25138. * @returns {Array} Returns the slice of `array`.
  25139. * @example
  25140. *
  25141. * _.initial([1, 2, 3]);
  25142. * // => [1, 2]
  25143. */
  25144. function initial(array) {
  25145. var length = array == null ? 0 : array.length;
  25146. return length ? baseSlice(array, 0, -1) : [];
  25147. }
  25148. /**
  25149. * Creates an array of unique values that are included in all given arrays
  25150. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25151. * for equality comparisons. The order and references of result values are
  25152. * determined by the first array.
  25153. *
  25154. * @static
  25155. * @memberOf _
  25156. * @since 0.1.0
  25157. * @category Array
  25158. * @param {...Array} [arrays] The arrays to inspect.
  25159. * @returns {Array} Returns the new array of intersecting values.
  25160. * @example
  25161. *
  25162. * _.intersection([2, 1], [2, 3]);
  25163. * // => [2]
  25164. */
  25165. var intersection = baseRest(function(arrays) {
  25166. var mapped = arrayMap(arrays, castArrayLikeObject);
  25167. return (mapped.length && mapped[0] === arrays[0])
  25168. ? baseIntersection(mapped)
  25169. : [];
  25170. });
  25171. /**
  25172. * This method is like `_.intersection` except that it accepts `iteratee`
  25173. * which is invoked for each element of each `arrays` to generate the criterion
  25174. * by which they're compared. The order and references of result values are
  25175. * determined by the first array. The iteratee is invoked with one argument:
  25176. * (value).
  25177. *
  25178. * @static
  25179. * @memberOf _
  25180. * @since 4.0.0
  25181. * @category Array
  25182. * @param {...Array} [arrays] The arrays to inspect.
  25183. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25184. * @returns {Array} Returns the new array of intersecting values.
  25185. * @example
  25186. *
  25187. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25188. * // => [2.1]
  25189. *
  25190. * // The `_.property` iteratee shorthand.
  25191. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25192. * // => [{ 'x': 1 }]
  25193. */
  25194. var intersectionBy = baseRest(function(arrays) {
  25195. var iteratee = last(arrays),
  25196. mapped = arrayMap(arrays, castArrayLikeObject);
  25197. if (iteratee === last(mapped)) {
  25198. iteratee = undefined;
  25199. } else {
  25200. mapped.pop();
  25201. }
  25202. return (mapped.length && mapped[0] === arrays[0])
  25203. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25204. : [];
  25205. });
  25206. /**
  25207. * This method is like `_.intersection` except that it accepts `comparator`
  25208. * which is invoked to compare elements of `arrays`. The order and references
  25209. * of result values are determined by the first array. The comparator is
  25210. * invoked with two arguments: (arrVal, othVal).
  25211. *
  25212. * @static
  25213. * @memberOf _
  25214. * @since 4.0.0
  25215. * @category Array
  25216. * @param {...Array} [arrays] The arrays to inspect.
  25217. * @param {Function} [comparator] The comparator invoked per element.
  25218. * @returns {Array} Returns the new array of intersecting values.
  25219. * @example
  25220. *
  25221. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25222. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25223. *
  25224. * _.intersectionWith(objects, others, _.isEqual);
  25225. * // => [{ 'x': 1, 'y': 2 }]
  25226. */
  25227. var intersectionWith = baseRest(function(arrays) {
  25228. var comparator = last(arrays),
  25229. mapped = arrayMap(arrays, castArrayLikeObject);
  25230. comparator = typeof comparator == 'function' ? comparator : undefined;
  25231. if (comparator) {
  25232. mapped.pop();
  25233. }
  25234. return (mapped.length && mapped[0] === arrays[0])
  25235. ? baseIntersection(mapped, undefined, comparator)
  25236. : [];
  25237. });
  25238. /**
  25239. * Converts all elements in `array` into a string separated by `separator`.
  25240. *
  25241. * @static
  25242. * @memberOf _
  25243. * @since 4.0.0
  25244. * @category Array
  25245. * @param {Array} array The array to convert.
  25246. * @param {string} [separator=','] The element separator.
  25247. * @returns {string} Returns the joined string.
  25248. * @example
  25249. *
  25250. * _.join(['a', 'b', 'c'], '~');
  25251. * // => 'a~b~c'
  25252. */
  25253. function join(array, separator) {
  25254. return array == null ? '' : nativeJoin.call(array, separator);
  25255. }
  25256. /**
  25257. * Gets the last element of `array`.
  25258. *
  25259. * @static
  25260. * @memberOf _
  25261. * @since 0.1.0
  25262. * @category Array
  25263. * @param {Array} array The array to query.
  25264. * @returns {*} Returns the last element of `array`.
  25265. * @example
  25266. *
  25267. * _.last([1, 2, 3]);
  25268. * // => 3
  25269. */
  25270. function last(array) {
  25271. var length = array == null ? 0 : array.length;
  25272. return length ? array[length - 1] : undefined;
  25273. }
  25274. /**
  25275. * This method is like `_.indexOf` except that it iterates over elements of
  25276. * `array` from right to left.
  25277. *
  25278. * @static
  25279. * @memberOf _
  25280. * @since 0.1.0
  25281. * @category Array
  25282. * @param {Array} array The array to inspect.
  25283. * @param {*} value The value to search for.
  25284. * @param {number} [fromIndex=array.length-1] The index to search from.
  25285. * @returns {number} Returns the index of the matched value, else `-1`.
  25286. * @example
  25287. *
  25288. * _.lastIndexOf([1, 2, 1, 2], 2);
  25289. * // => 3
  25290. *
  25291. * // Search from the `fromIndex`.
  25292. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25293. * // => 1
  25294. */
  25295. function lastIndexOf(array, value, fromIndex) {
  25296. var length = array == null ? 0 : array.length;
  25297. if (!length) {
  25298. return -1;
  25299. }
  25300. var index = length;
  25301. if (fromIndex !== undefined) {
  25302. index = toInteger(fromIndex);
  25303. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25304. }
  25305. return value === value
  25306. ? strictLastIndexOf(array, value, index)
  25307. : baseFindIndex(array, baseIsNaN, index, true);
  25308. }
  25309. /**
  25310. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25311. * element from the end is returned.
  25312. *
  25313. * @static
  25314. * @memberOf _
  25315. * @since 4.11.0
  25316. * @category Array
  25317. * @param {Array} array The array to query.
  25318. * @param {number} [n=0] The index of the element to return.
  25319. * @returns {*} Returns the nth element of `array`.
  25320. * @example
  25321. *
  25322. * var array = ['a', 'b', 'c', 'd'];
  25323. *
  25324. * _.nth(array, 1);
  25325. * // => 'b'
  25326. *
  25327. * _.nth(array, -2);
  25328. * // => 'c';
  25329. */
  25330. function nth(array, n) {
  25331. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25332. }
  25333. /**
  25334. * Removes all given values from `array` using
  25335. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25336. * for equality comparisons.
  25337. *
  25338. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25339. * to remove elements from an array by predicate.
  25340. *
  25341. * @static
  25342. * @memberOf _
  25343. * @since 2.0.0
  25344. * @category Array
  25345. * @param {Array} array The array to modify.
  25346. * @param {...*} [values] The values to remove.
  25347. * @returns {Array} Returns `array`.
  25348. * @example
  25349. *
  25350. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25351. *
  25352. * _.pull(array, 'a', 'c');
  25353. * console.log(array);
  25354. * // => ['b', 'b']
  25355. */
  25356. var pull = baseRest(pullAll);
  25357. /**
  25358. * This method is like `_.pull` except that it accepts an array of values to remove.
  25359. *
  25360. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25361. *
  25362. * @static
  25363. * @memberOf _
  25364. * @since 4.0.0
  25365. * @category Array
  25366. * @param {Array} array The array to modify.
  25367. * @param {Array} values The values to remove.
  25368. * @returns {Array} Returns `array`.
  25369. * @example
  25370. *
  25371. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25372. *
  25373. * _.pullAll(array, ['a', 'c']);
  25374. * console.log(array);
  25375. * // => ['b', 'b']
  25376. */
  25377. function pullAll(array, values) {
  25378. return (array && array.length && values && values.length)
  25379. ? basePullAll(array, values)
  25380. : array;
  25381. }
  25382. /**
  25383. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25384. * invoked for each element of `array` and `values` to generate the criterion
  25385. * by which they're compared. The iteratee is invoked with one argument: (value).
  25386. *
  25387. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25388. *
  25389. * @static
  25390. * @memberOf _
  25391. * @since 4.0.0
  25392. * @category Array
  25393. * @param {Array} array The array to modify.
  25394. * @param {Array} values The values to remove.
  25395. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25396. * @returns {Array} Returns `array`.
  25397. * @example
  25398. *
  25399. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25400. *
  25401. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25402. * console.log(array);
  25403. * // => [{ 'x': 2 }]
  25404. */
  25405. function pullAllBy(array, values, iteratee) {
  25406. return (array && array.length && values && values.length)
  25407. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25408. : array;
  25409. }
  25410. /**
  25411. * This method is like `_.pullAll` except that it accepts `comparator` which
  25412. * is invoked to compare elements of `array` to `values`. The comparator is
  25413. * invoked with two arguments: (arrVal, othVal).
  25414. *
  25415. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25416. *
  25417. * @static
  25418. * @memberOf _
  25419. * @since 4.6.0
  25420. * @category Array
  25421. * @param {Array} array The array to modify.
  25422. * @param {Array} values The values to remove.
  25423. * @param {Function} [comparator] The comparator invoked per element.
  25424. * @returns {Array} Returns `array`.
  25425. * @example
  25426. *
  25427. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25428. *
  25429. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25430. * console.log(array);
  25431. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25432. */
  25433. function pullAllWith(array, values, comparator) {
  25434. return (array && array.length && values && values.length)
  25435. ? basePullAll(array, values, undefined, comparator)
  25436. : array;
  25437. }
  25438. /**
  25439. * Removes elements from `array` corresponding to `indexes` and returns an
  25440. * array of removed elements.
  25441. *
  25442. * **Note:** Unlike `_.at`, this method mutates `array`.
  25443. *
  25444. * @static
  25445. * @memberOf _
  25446. * @since 3.0.0
  25447. * @category Array
  25448. * @param {Array} array The array to modify.
  25449. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25450. * @returns {Array} Returns the new array of removed elements.
  25451. * @example
  25452. *
  25453. * var array = ['a', 'b', 'c', 'd'];
  25454. * var pulled = _.pullAt(array, [1, 3]);
  25455. *
  25456. * console.log(array);
  25457. * // => ['a', 'c']
  25458. *
  25459. * console.log(pulled);
  25460. * // => ['b', 'd']
  25461. */
  25462. var pullAt = flatRest(function(array, indexes) {
  25463. var length = array == null ? 0 : array.length,
  25464. result = baseAt(array, indexes);
  25465. basePullAt(array, arrayMap(indexes, function(index) {
  25466. return isIndex(index, length) ? +index : index;
  25467. }).sort(compareAscending));
  25468. return result;
  25469. });
  25470. /**
  25471. * Removes all elements from `array` that `predicate` returns truthy for
  25472. * and returns an array of the removed elements. The predicate is invoked
  25473. * with three arguments: (value, index, array).
  25474. *
  25475. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25476. * to pull elements from an array by value.
  25477. *
  25478. * @static
  25479. * @memberOf _
  25480. * @since 2.0.0
  25481. * @category Array
  25482. * @param {Array} array The array to modify.
  25483. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25484. * @returns {Array} Returns the new array of removed elements.
  25485. * @example
  25486. *
  25487. * var array = [1, 2, 3, 4];
  25488. * var evens = _.remove(array, function(n) {
  25489. * return n % 2 == 0;
  25490. * });
  25491. *
  25492. * console.log(array);
  25493. * // => [1, 3]
  25494. *
  25495. * console.log(evens);
  25496. * // => [2, 4]
  25497. */
  25498. function remove(array, predicate) {
  25499. var result = [];
  25500. if (!(array && array.length)) {
  25501. return result;
  25502. }
  25503. var index = -1,
  25504. indexes = [],
  25505. length = array.length;
  25506. predicate = getIteratee(predicate, 3);
  25507. while (++index < length) {
  25508. var value = array[index];
  25509. if (predicate(value, index, array)) {
  25510. result.push(value);
  25511. indexes.push(index);
  25512. }
  25513. }
  25514. basePullAt(array, indexes);
  25515. return result;
  25516. }
  25517. /**
  25518. * Reverses `array` so that the first element becomes the last, the second
  25519. * element becomes the second to last, and so on.
  25520. *
  25521. * **Note:** This method mutates `array` and is based on
  25522. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25523. *
  25524. * @static
  25525. * @memberOf _
  25526. * @since 4.0.0
  25527. * @category Array
  25528. * @param {Array} array The array to modify.
  25529. * @returns {Array} Returns `array`.
  25530. * @example
  25531. *
  25532. * var array = [1, 2, 3];
  25533. *
  25534. * _.reverse(array);
  25535. * // => [3, 2, 1]
  25536. *
  25537. * console.log(array);
  25538. * // => [3, 2, 1]
  25539. */
  25540. function reverse(array) {
  25541. return array == null ? array : nativeReverse.call(array);
  25542. }
  25543. /**
  25544. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25545. *
  25546. * **Note:** This method is used instead of
  25547. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25548. * returned.
  25549. *
  25550. * @static
  25551. * @memberOf _
  25552. * @since 3.0.0
  25553. * @category Array
  25554. * @param {Array} array The array to slice.
  25555. * @param {number} [start=0] The start position.
  25556. * @param {number} [end=array.length] The end position.
  25557. * @returns {Array} Returns the slice of `array`.
  25558. */
  25559. function slice(array, start, end) {
  25560. var length = array == null ? 0 : array.length;
  25561. if (!length) {
  25562. return [];
  25563. }
  25564. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25565. start = 0;
  25566. end = length;
  25567. }
  25568. else {
  25569. start = start == null ? 0 : toInteger(start);
  25570. end = end === undefined ? length : toInteger(end);
  25571. }
  25572. return baseSlice(array, start, end);
  25573. }
  25574. /**
  25575. * Uses a binary search to determine the lowest index at which `value`
  25576. * should be inserted into `array` in order to maintain its sort order.
  25577. *
  25578. * @static
  25579. * @memberOf _
  25580. * @since 0.1.0
  25581. * @category Array
  25582. * @param {Array} array The sorted array to inspect.
  25583. * @param {*} value The value to evaluate.
  25584. * @returns {number} Returns the index at which `value` should be inserted
  25585. * into `array`.
  25586. * @example
  25587. *
  25588. * _.sortedIndex([30, 50], 40);
  25589. * // => 1
  25590. */
  25591. function sortedIndex(array, value) {
  25592. return baseSortedIndex(array, value);
  25593. }
  25594. /**
  25595. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25596. * which is invoked for `value` and each element of `array` to compute their
  25597. * sort ranking. The iteratee is invoked with one argument: (value).
  25598. *
  25599. * @static
  25600. * @memberOf _
  25601. * @since 4.0.0
  25602. * @category Array
  25603. * @param {Array} array The sorted array to inspect.
  25604. * @param {*} value The value to evaluate.
  25605. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25606. * @returns {number} Returns the index at which `value` should be inserted
  25607. * into `array`.
  25608. * @example
  25609. *
  25610. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25611. *
  25612. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25613. * // => 0
  25614. *
  25615. * // The `_.property` iteratee shorthand.
  25616. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25617. * // => 0
  25618. */
  25619. function sortedIndexBy(array, value, iteratee) {
  25620. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25621. }
  25622. /**
  25623. * This method is like `_.indexOf` except that it performs a binary
  25624. * search on a sorted `array`.
  25625. *
  25626. * @static
  25627. * @memberOf _
  25628. * @since 4.0.0
  25629. * @category Array
  25630. * @param {Array} array The array to inspect.
  25631. * @param {*} value The value to search for.
  25632. * @returns {number} Returns the index of the matched value, else `-1`.
  25633. * @example
  25634. *
  25635. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25636. * // => 1
  25637. */
  25638. function sortedIndexOf(array, value) {
  25639. var length = array == null ? 0 : array.length;
  25640. if (length) {
  25641. var index = baseSortedIndex(array, value);
  25642. if (index < length && eq(array[index], value)) {
  25643. return index;
  25644. }
  25645. }
  25646. return -1;
  25647. }
  25648. /**
  25649. * This method is like `_.sortedIndex` except that it returns the highest
  25650. * index at which `value` should be inserted into `array` in order to
  25651. * maintain its sort order.
  25652. *
  25653. * @static
  25654. * @memberOf _
  25655. * @since 3.0.0
  25656. * @category Array
  25657. * @param {Array} array The sorted array to inspect.
  25658. * @param {*} value The value to evaluate.
  25659. * @returns {number} Returns the index at which `value` should be inserted
  25660. * into `array`.
  25661. * @example
  25662. *
  25663. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25664. * // => 4
  25665. */
  25666. function sortedLastIndex(array, value) {
  25667. return baseSortedIndex(array, value, true);
  25668. }
  25669. /**
  25670. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25671. * which is invoked for `value` and each element of `array` to compute their
  25672. * sort ranking. The iteratee is invoked with one argument: (value).
  25673. *
  25674. * @static
  25675. * @memberOf _
  25676. * @since 4.0.0
  25677. * @category Array
  25678. * @param {Array} array The sorted array to inspect.
  25679. * @param {*} value The value to evaluate.
  25680. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25681. * @returns {number} Returns the index at which `value` should be inserted
  25682. * into `array`.
  25683. * @example
  25684. *
  25685. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25686. *
  25687. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25688. * // => 1
  25689. *
  25690. * // The `_.property` iteratee shorthand.
  25691. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25692. * // => 1
  25693. */
  25694. function sortedLastIndexBy(array, value, iteratee) {
  25695. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25696. }
  25697. /**
  25698. * This method is like `_.lastIndexOf` except that it performs a binary
  25699. * search on a sorted `array`.
  25700. *
  25701. * @static
  25702. * @memberOf _
  25703. * @since 4.0.0
  25704. * @category Array
  25705. * @param {Array} array The array to inspect.
  25706. * @param {*} value The value to search for.
  25707. * @returns {number} Returns the index of the matched value, else `-1`.
  25708. * @example
  25709. *
  25710. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25711. * // => 3
  25712. */
  25713. function sortedLastIndexOf(array, value) {
  25714. var length = array == null ? 0 : array.length;
  25715. if (length) {
  25716. var index = baseSortedIndex(array, value, true) - 1;
  25717. if (eq(array[index], value)) {
  25718. return index;
  25719. }
  25720. }
  25721. return -1;
  25722. }
  25723. /**
  25724. * This method is like `_.uniq` except that it's designed and optimized
  25725. * for sorted arrays.
  25726. *
  25727. * @static
  25728. * @memberOf _
  25729. * @since 4.0.0
  25730. * @category Array
  25731. * @param {Array} array The array to inspect.
  25732. * @returns {Array} Returns the new duplicate free array.
  25733. * @example
  25734. *
  25735. * _.sortedUniq([1, 1, 2]);
  25736. * // => [1, 2]
  25737. */
  25738. function sortedUniq(array) {
  25739. return (array && array.length)
  25740. ? baseSortedUniq(array)
  25741. : [];
  25742. }
  25743. /**
  25744. * This method is like `_.uniqBy` except that it's designed and optimized
  25745. * for sorted arrays.
  25746. *
  25747. * @static
  25748. * @memberOf _
  25749. * @since 4.0.0
  25750. * @category Array
  25751. * @param {Array} array The array to inspect.
  25752. * @param {Function} [iteratee] The iteratee invoked per element.
  25753. * @returns {Array} Returns the new duplicate free array.
  25754. * @example
  25755. *
  25756. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25757. * // => [1.1, 2.3]
  25758. */
  25759. function sortedUniqBy(array, iteratee) {
  25760. return (array && array.length)
  25761. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25762. : [];
  25763. }
  25764. /**
  25765. * Gets all but the first element of `array`.
  25766. *
  25767. * @static
  25768. * @memberOf _
  25769. * @since 4.0.0
  25770. * @category Array
  25771. * @param {Array} array The array to query.
  25772. * @returns {Array} Returns the slice of `array`.
  25773. * @example
  25774. *
  25775. * _.tail([1, 2, 3]);
  25776. * // => [2, 3]
  25777. */
  25778. function tail(array) {
  25779. var length = array == null ? 0 : array.length;
  25780. return length ? baseSlice(array, 1, length) : [];
  25781. }
  25782. /**
  25783. * Creates a slice of `array` with `n` elements taken from the beginning.
  25784. *
  25785. * @static
  25786. * @memberOf _
  25787. * @since 0.1.0
  25788. * @category Array
  25789. * @param {Array} array The array to query.
  25790. * @param {number} [n=1] The number of elements to take.
  25791. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25792. * @returns {Array} Returns the slice of `array`.
  25793. * @example
  25794. *
  25795. * _.take([1, 2, 3]);
  25796. * // => [1]
  25797. *
  25798. * _.take([1, 2, 3], 2);
  25799. * // => [1, 2]
  25800. *
  25801. * _.take([1, 2, 3], 5);
  25802. * // => [1, 2, 3]
  25803. *
  25804. * _.take([1, 2, 3], 0);
  25805. * // => []
  25806. */
  25807. function take(array, n, guard) {
  25808. if (!(array && array.length)) {
  25809. return [];
  25810. }
  25811. n = (guard || n === undefined) ? 1 : toInteger(n);
  25812. return baseSlice(array, 0, n < 0 ? 0 : n);
  25813. }
  25814. /**
  25815. * Creates a slice of `array` with `n` elements taken from the end.
  25816. *
  25817. * @static
  25818. * @memberOf _
  25819. * @since 3.0.0
  25820. * @category Array
  25821. * @param {Array} array The array to query.
  25822. * @param {number} [n=1] The number of elements to take.
  25823. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25824. * @returns {Array} Returns the slice of `array`.
  25825. * @example
  25826. *
  25827. * _.takeRight([1, 2, 3]);
  25828. * // => [3]
  25829. *
  25830. * _.takeRight([1, 2, 3], 2);
  25831. * // => [2, 3]
  25832. *
  25833. * _.takeRight([1, 2, 3], 5);
  25834. * // => [1, 2, 3]
  25835. *
  25836. * _.takeRight([1, 2, 3], 0);
  25837. * // => []
  25838. */
  25839. function takeRight(array, n, guard) {
  25840. var length = array == null ? 0 : array.length;
  25841. if (!length) {
  25842. return [];
  25843. }
  25844. n = (guard || n === undefined) ? 1 : toInteger(n);
  25845. n = length - n;
  25846. return baseSlice(array, n < 0 ? 0 : n, length);
  25847. }
  25848. /**
  25849. * Creates a slice of `array` with elements taken from the end. Elements are
  25850. * taken until `predicate` returns falsey. The predicate is invoked with
  25851. * three arguments: (value, index, array).
  25852. *
  25853. * @static
  25854. * @memberOf _
  25855. * @since 3.0.0
  25856. * @category Array
  25857. * @param {Array} array The array to query.
  25858. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25859. * @returns {Array} Returns the slice of `array`.
  25860. * @example
  25861. *
  25862. * var users = [
  25863. * { 'user': 'barney', 'active': true },
  25864. * { 'user': 'fred', 'active': false },
  25865. * { 'user': 'pebbles', 'active': false }
  25866. * ];
  25867. *
  25868. * _.takeRightWhile(users, function(o) { return !o.active; });
  25869. * // => objects for ['fred', 'pebbles']
  25870. *
  25871. * // The `_.matches` iteratee shorthand.
  25872. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25873. * // => objects for ['pebbles']
  25874. *
  25875. * // The `_.matchesProperty` iteratee shorthand.
  25876. * _.takeRightWhile(users, ['active', false]);
  25877. * // => objects for ['fred', 'pebbles']
  25878. *
  25879. * // The `_.property` iteratee shorthand.
  25880. * _.takeRightWhile(users, 'active');
  25881. * // => []
  25882. */
  25883. function takeRightWhile(array, predicate) {
  25884. return (array && array.length)
  25885. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25886. : [];
  25887. }
  25888. /**
  25889. * Creates a slice of `array` with elements taken from the beginning. Elements
  25890. * are taken until `predicate` returns falsey. The predicate is invoked with
  25891. * three arguments: (value, index, array).
  25892. *
  25893. * @static
  25894. * @memberOf _
  25895. * @since 3.0.0
  25896. * @category Array
  25897. * @param {Array} array The array to query.
  25898. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25899. * @returns {Array} Returns the slice of `array`.
  25900. * @example
  25901. *
  25902. * var users = [
  25903. * { 'user': 'barney', 'active': false },
  25904. * { 'user': 'fred', 'active': false },
  25905. * { 'user': 'pebbles', 'active': true }
  25906. * ];
  25907. *
  25908. * _.takeWhile(users, function(o) { return !o.active; });
  25909. * // => objects for ['barney', 'fred']
  25910. *
  25911. * // The `_.matches` iteratee shorthand.
  25912. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  25913. * // => objects for ['barney']
  25914. *
  25915. * // The `_.matchesProperty` iteratee shorthand.
  25916. * _.takeWhile(users, ['active', false]);
  25917. * // => objects for ['barney', 'fred']
  25918. *
  25919. * // The `_.property` iteratee shorthand.
  25920. * _.takeWhile(users, 'active');
  25921. * // => []
  25922. */
  25923. function takeWhile(array, predicate) {
  25924. return (array && array.length)
  25925. ? baseWhile(array, getIteratee(predicate, 3))
  25926. : [];
  25927. }
  25928. /**
  25929. * Creates an array of unique values, in order, from all given arrays using
  25930. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25931. * for equality comparisons.
  25932. *
  25933. * @static
  25934. * @memberOf _
  25935. * @since 0.1.0
  25936. * @category Array
  25937. * @param {...Array} [arrays] The arrays to inspect.
  25938. * @returns {Array} Returns the new array of combined values.
  25939. * @example
  25940. *
  25941. * _.union([2], [1, 2]);
  25942. * // => [2, 1]
  25943. */
  25944. var union = baseRest(function(arrays) {
  25945. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  25946. });
  25947. /**
  25948. * This method is like `_.union` except that it accepts `iteratee` which is
  25949. * invoked for each element of each `arrays` to generate the criterion by
  25950. * which uniqueness is computed. Result values are chosen from the first
  25951. * array in which the value occurs. The iteratee is invoked with one argument:
  25952. * (value).
  25953. *
  25954. * @static
  25955. * @memberOf _
  25956. * @since 4.0.0
  25957. * @category Array
  25958. * @param {...Array} [arrays] The arrays to inspect.
  25959. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25960. * @returns {Array} Returns the new array of combined values.
  25961. * @example
  25962. *
  25963. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  25964. * // => [2.1, 1.2]
  25965. *
  25966. * // The `_.property` iteratee shorthand.
  25967. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25968. * // => [{ 'x': 1 }, { 'x': 2 }]
  25969. */
  25970. var unionBy = baseRest(function(arrays) {
  25971. var iteratee = last(arrays);
  25972. if (isArrayLikeObject(iteratee)) {
  25973. iteratee = undefined;
  25974. }
  25975. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  25976. });
  25977. /**
  25978. * This method is like `_.union` except that it accepts `comparator` which
  25979. * is invoked to compare elements of `arrays`. Result values are chosen from
  25980. * the first array in which the value occurs. The comparator is invoked
  25981. * with two arguments: (arrVal, othVal).
  25982. *
  25983. * @static
  25984. * @memberOf _
  25985. * @since 4.0.0
  25986. * @category Array
  25987. * @param {...Array} [arrays] The arrays to inspect.
  25988. * @param {Function} [comparator] The comparator invoked per element.
  25989. * @returns {Array} Returns the new array of combined values.
  25990. * @example
  25991. *
  25992. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25993. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25994. *
  25995. * _.unionWith(objects, others, _.isEqual);
  25996. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  25997. */
  25998. var unionWith = baseRest(function(arrays) {
  25999. var comparator = last(arrays);
  26000. comparator = typeof comparator == 'function' ? comparator : undefined;
  26001. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26002. });
  26003. /**
  26004. * Creates a duplicate-free version of an array, using
  26005. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26006. * for equality comparisons, in which only the first occurrence of each element
  26007. * is kept. The order of result values is determined by the order they occur
  26008. * in the array.
  26009. *
  26010. * @static
  26011. * @memberOf _
  26012. * @since 0.1.0
  26013. * @category Array
  26014. * @param {Array} array The array to inspect.
  26015. * @returns {Array} Returns the new duplicate free array.
  26016. * @example
  26017. *
  26018. * _.uniq([2, 1, 2]);
  26019. * // => [2, 1]
  26020. */
  26021. function uniq(array) {
  26022. return (array && array.length) ? baseUniq(array) : [];
  26023. }
  26024. /**
  26025. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26026. * invoked for each element in `array` to generate the criterion by which
  26027. * uniqueness is computed. The order of result values is determined by the
  26028. * order they occur in the array. The iteratee is invoked with one argument:
  26029. * (value).
  26030. *
  26031. * @static
  26032. * @memberOf _
  26033. * @since 4.0.0
  26034. * @category Array
  26035. * @param {Array} array The array to inspect.
  26036. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26037. * @returns {Array} Returns the new duplicate free array.
  26038. * @example
  26039. *
  26040. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26041. * // => [2.1, 1.2]
  26042. *
  26043. * // The `_.property` iteratee shorthand.
  26044. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26045. * // => [{ 'x': 1 }, { 'x': 2 }]
  26046. */
  26047. function uniqBy(array, iteratee) {
  26048. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26049. }
  26050. /**
  26051. * This method is like `_.uniq` except that it accepts `comparator` which
  26052. * is invoked to compare elements of `array`. The order of result values is
  26053. * determined by the order they occur in the array.The comparator is invoked
  26054. * with two arguments: (arrVal, othVal).
  26055. *
  26056. * @static
  26057. * @memberOf _
  26058. * @since 4.0.0
  26059. * @category Array
  26060. * @param {Array} array The array to inspect.
  26061. * @param {Function} [comparator] The comparator invoked per element.
  26062. * @returns {Array} Returns the new duplicate free array.
  26063. * @example
  26064. *
  26065. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26066. *
  26067. * _.uniqWith(objects, _.isEqual);
  26068. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26069. */
  26070. function uniqWith(array, comparator) {
  26071. comparator = typeof comparator == 'function' ? comparator : undefined;
  26072. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26073. }
  26074. /**
  26075. * This method is like `_.zip` except that it accepts an array of grouped
  26076. * elements and creates an array regrouping the elements to their pre-zip
  26077. * configuration.
  26078. *
  26079. * @static
  26080. * @memberOf _
  26081. * @since 1.2.0
  26082. * @category Array
  26083. * @param {Array} array The array of grouped elements to process.
  26084. * @returns {Array} Returns the new array of regrouped elements.
  26085. * @example
  26086. *
  26087. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26088. * // => [['a', 1, true], ['b', 2, false]]
  26089. *
  26090. * _.unzip(zipped);
  26091. * // => [['a', 'b'], [1, 2], [true, false]]
  26092. */
  26093. function unzip(array) {
  26094. if (!(array && array.length)) {
  26095. return [];
  26096. }
  26097. var length = 0;
  26098. array = arrayFilter(array, function(group) {
  26099. if (isArrayLikeObject(group)) {
  26100. length = nativeMax(group.length, length);
  26101. return true;
  26102. }
  26103. });
  26104. return baseTimes(length, function(index) {
  26105. return arrayMap(array, baseProperty(index));
  26106. });
  26107. }
  26108. /**
  26109. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26110. * how regrouped values should be combined. The iteratee is invoked with the
  26111. * elements of each group: (...group).
  26112. *
  26113. * @static
  26114. * @memberOf _
  26115. * @since 3.8.0
  26116. * @category Array
  26117. * @param {Array} array The array of grouped elements to process.
  26118. * @param {Function} [iteratee=_.identity] The function to combine
  26119. * regrouped values.
  26120. * @returns {Array} Returns the new array of regrouped elements.
  26121. * @example
  26122. *
  26123. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26124. * // => [[1, 10, 100], [2, 20, 200]]
  26125. *
  26126. * _.unzipWith(zipped, _.add);
  26127. * // => [3, 30, 300]
  26128. */
  26129. function unzipWith(array, iteratee) {
  26130. if (!(array && array.length)) {
  26131. return [];
  26132. }
  26133. var result = unzip(array);
  26134. if (iteratee == null) {
  26135. return result;
  26136. }
  26137. return arrayMap(result, function(group) {
  26138. return apply(iteratee, undefined, group);
  26139. });
  26140. }
  26141. /**
  26142. * Creates an array excluding all given values using
  26143. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26144. * for equality comparisons.
  26145. *
  26146. * **Note:** Unlike `_.pull`, this method returns a new array.
  26147. *
  26148. * @static
  26149. * @memberOf _
  26150. * @since 0.1.0
  26151. * @category Array
  26152. * @param {Array} array The array to inspect.
  26153. * @param {...*} [values] The values to exclude.
  26154. * @returns {Array} Returns the new array of filtered values.
  26155. * @see _.difference, _.xor
  26156. * @example
  26157. *
  26158. * _.without([2, 1, 2, 3], 1, 2);
  26159. * // => [3]
  26160. */
  26161. var without = baseRest(function(array, values) {
  26162. return isArrayLikeObject(array)
  26163. ? baseDifference(array, values)
  26164. : [];
  26165. });
  26166. /**
  26167. * Creates an array of unique values that is the
  26168. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26169. * of the given arrays. The order of result values is determined by the order
  26170. * they occur in the arrays.
  26171. *
  26172. * @static
  26173. * @memberOf _
  26174. * @since 2.4.0
  26175. * @category Array
  26176. * @param {...Array} [arrays] The arrays to inspect.
  26177. * @returns {Array} Returns the new array of filtered values.
  26178. * @see _.difference, _.without
  26179. * @example
  26180. *
  26181. * _.xor([2, 1], [2, 3]);
  26182. * // => [1, 3]
  26183. */
  26184. var xor = baseRest(function(arrays) {
  26185. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26186. });
  26187. /**
  26188. * This method is like `_.xor` except that it accepts `iteratee` which is
  26189. * invoked for each element of each `arrays` to generate the criterion by
  26190. * which by which they're compared. The order of result values is determined
  26191. * by the order they occur in the arrays. The iteratee is invoked with one
  26192. * argument: (value).
  26193. *
  26194. * @static
  26195. * @memberOf _
  26196. * @since 4.0.0
  26197. * @category Array
  26198. * @param {...Array} [arrays] The arrays to inspect.
  26199. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26200. * @returns {Array} Returns the new array of filtered values.
  26201. * @example
  26202. *
  26203. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26204. * // => [1.2, 3.4]
  26205. *
  26206. * // The `_.property` iteratee shorthand.
  26207. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26208. * // => [{ 'x': 2 }]
  26209. */
  26210. var xorBy = baseRest(function(arrays) {
  26211. var iteratee = last(arrays);
  26212. if (isArrayLikeObject(iteratee)) {
  26213. iteratee = undefined;
  26214. }
  26215. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26216. });
  26217. /**
  26218. * This method is like `_.xor` except that it accepts `comparator` which is
  26219. * invoked to compare elements of `arrays`. The order of result values is
  26220. * determined by the order they occur in the arrays. The comparator is invoked
  26221. * with two arguments: (arrVal, othVal).
  26222. *
  26223. * @static
  26224. * @memberOf _
  26225. * @since 4.0.0
  26226. * @category Array
  26227. * @param {...Array} [arrays] The arrays to inspect.
  26228. * @param {Function} [comparator] The comparator invoked per element.
  26229. * @returns {Array} Returns the new array of filtered values.
  26230. * @example
  26231. *
  26232. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26233. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26234. *
  26235. * _.xorWith(objects, others, _.isEqual);
  26236. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26237. */
  26238. var xorWith = baseRest(function(arrays) {
  26239. var comparator = last(arrays);
  26240. comparator = typeof comparator == 'function' ? comparator : undefined;
  26241. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26242. });
  26243. /**
  26244. * Creates an array of grouped elements, the first of which contains the
  26245. * first elements of the given arrays, the second of which contains the
  26246. * second elements of the given arrays, and so on.
  26247. *
  26248. * @static
  26249. * @memberOf _
  26250. * @since 0.1.0
  26251. * @category Array
  26252. * @param {...Array} [arrays] The arrays to process.
  26253. * @returns {Array} Returns the new array of grouped elements.
  26254. * @example
  26255. *
  26256. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26257. * // => [['a', 1, true], ['b', 2, false]]
  26258. */
  26259. var zip = baseRest(unzip);
  26260. /**
  26261. * This method is like `_.fromPairs` except that it accepts two arrays,
  26262. * one of property identifiers and one of corresponding values.
  26263. *
  26264. * @static
  26265. * @memberOf _
  26266. * @since 0.4.0
  26267. * @category Array
  26268. * @param {Array} [props=[]] The property identifiers.
  26269. * @param {Array} [values=[]] The property values.
  26270. * @returns {Object} Returns the new object.
  26271. * @example
  26272. *
  26273. * _.zipObject(['a', 'b'], [1, 2]);
  26274. * // => { 'a': 1, 'b': 2 }
  26275. */
  26276. function zipObject(props, values) {
  26277. return baseZipObject(props || [], values || [], assignValue);
  26278. }
  26279. /**
  26280. * This method is like `_.zipObject` except that it supports property paths.
  26281. *
  26282. * @static
  26283. * @memberOf _
  26284. * @since 4.1.0
  26285. * @category Array
  26286. * @param {Array} [props=[]] The property identifiers.
  26287. * @param {Array} [values=[]] The property values.
  26288. * @returns {Object} Returns the new object.
  26289. * @example
  26290. *
  26291. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26292. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26293. */
  26294. function zipObjectDeep(props, values) {
  26295. return baseZipObject(props || [], values || [], baseSet);
  26296. }
  26297. /**
  26298. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26299. * how grouped values should be combined. The iteratee is invoked with the
  26300. * elements of each group: (...group).
  26301. *
  26302. * @static
  26303. * @memberOf _
  26304. * @since 3.8.0
  26305. * @category Array
  26306. * @param {...Array} [arrays] The arrays to process.
  26307. * @param {Function} [iteratee=_.identity] The function to combine
  26308. * grouped values.
  26309. * @returns {Array} Returns the new array of grouped elements.
  26310. * @example
  26311. *
  26312. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26313. * return a + b + c;
  26314. * });
  26315. * // => [111, 222]
  26316. */
  26317. var zipWith = baseRest(function(arrays) {
  26318. var length = arrays.length,
  26319. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26320. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26321. return unzipWith(arrays, iteratee);
  26322. });
  26323. /*------------------------------------------------------------------------*/
  26324. /**
  26325. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26326. * chain sequences enabled. The result of such sequences must be unwrapped
  26327. * with `_#value`.
  26328. *
  26329. * @static
  26330. * @memberOf _
  26331. * @since 1.3.0
  26332. * @category Seq
  26333. * @param {*} value The value to wrap.
  26334. * @returns {Object} Returns the new `lodash` wrapper instance.
  26335. * @example
  26336. *
  26337. * var users = [
  26338. * { 'user': 'barney', 'age': 36 },
  26339. * { 'user': 'fred', 'age': 40 },
  26340. * { 'user': 'pebbles', 'age': 1 }
  26341. * ];
  26342. *
  26343. * var youngest = _
  26344. * .chain(users)
  26345. * .sortBy('age')
  26346. * .map(function(o) {
  26347. * return o.user + ' is ' + o.age;
  26348. * })
  26349. * .head()
  26350. * .value();
  26351. * // => 'pebbles is 1'
  26352. */
  26353. function chain(value) {
  26354. var result = lodash(value);
  26355. result.__chain__ = true;
  26356. return result;
  26357. }
  26358. /**
  26359. * This method invokes `interceptor` and returns `value`. The interceptor
  26360. * is invoked with one argument; (value). The purpose of this method is to
  26361. * "tap into" a method chain sequence in order to modify intermediate results.
  26362. *
  26363. * @static
  26364. * @memberOf _
  26365. * @since 0.1.0
  26366. * @category Seq
  26367. * @param {*} value The value to provide to `interceptor`.
  26368. * @param {Function} interceptor The function to invoke.
  26369. * @returns {*} Returns `value`.
  26370. * @example
  26371. *
  26372. * _([1, 2, 3])
  26373. * .tap(function(array) {
  26374. * // Mutate input array.
  26375. * array.pop();
  26376. * })
  26377. * .reverse()
  26378. * .value();
  26379. * // => [2, 1]
  26380. */
  26381. function tap(value, interceptor) {
  26382. interceptor(value);
  26383. return value;
  26384. }
  26385. /**
  26386. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26387. * The purpose of this method is to "pass thru" values replacing intermediate
  26388. * results in a method chain sequence.
  26389. *
  26390. * @static
  26391. * @memberOf _
  26392. * @since 3.0.0
  26393. * @category Seq
  26394. * @param {*} value The value to provide to `interceptor`.
  26395. * @param {Function} interceptor The function to invoke.
  26396. * @returns {*} Returns the result of `interceptor`.
  26397. * @example
  26398. *
  26399. * _(' abc ')
  26400. * .chain()
  26401. * .trim()
  26402. * .thru(function(value) {
  26403. * return [value];
  26404. * })
  26405. * .value();
  26406. * // => ['abc']
  26407. */
  26408. function thru(value, interceptor) {
  26409. return interceptor(value);
  26410. }
  26411. /**
  26412. * This method is the wrapper version of `_.at`.
  26413. *
  26414. * @name at
  26415. * @memberOf _
  26416. * @since 1.0.0
  26417. * @category Seq
  26418. * @param {...(string|string[])} [paths] The property paths to pick.
  26419. * @returns {Object} Returns the new `lodash` wrapper instance.
  26420. * @example
  26421. *
  26422. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26423. *
  26424. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26425. * // => [3, 4]
  26426. */
  26427. var wrapperAt = flatRest(function(paths) {
  26428. var length = paths.length,
  26429. start = length ? paths[0] : 0,
  26430. value = this.__wrapped__,
  26431. interceptor = function(object) { return baseAt(object, paths); };
  26432. if (length > 1 || this.__actions__.length ||
  26433. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26434. return this.thru(interceptor);
  26435. }
  26436. value = value.slice(start, +start + (length ? 1 : 0));
  26437. value.__actions__.push({
  26438. 'func': thru,
  26439. 'args': [interceptor],
  26440. 'thisArg': undefined
  26441. });
  26442. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26443. if (length && !array.length) {
  26444. array.push(undefined);
  26445. }
  26446. return array;
  26447. });
  26448. });
  26449. /**
  26450. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26451. *
  26452. * @name chain
  26453. * @memberOf _
  26454. * @since 0.1.0
  26455. * @category Seq
  26456. * @returns {Object} Returns the new `lodash` wrapper instance.
  26457. * @example
  26458. *
  26459. * var users = [
  26460. * { 'user': 'barney', 'age': 36 },
  26461. * { 'user': 'fred', 'age': 40 }
  26462. * ];
  26463. *
  26464. * // A sequence without explicit chaining.
  26465. * _(users).head();
  26466. * // => { 'user': 'barney', 'age': 36 }
  26467. *
  26468. * // A sequence with explicit chaining.
  26469. * _(users)
  26470. * .chain()
  26471. * .head()
  26472. * .pick('user')
  26473. * .value();
  26474. * // => { 'user': 'barney' }
  26475. */
  26476. function wrapperChain() {
  26477. return chain(this);
  26478. }
  26479. /**
  26480. * Executes the chain sequence and returns the wrapped result.
  26481. *
  26482. * @name commit
  26483. * @memberOf _
  26484. * @since 3.2.0
  26485. * @category Seq
  26486. * @returns {Object} Returns the new `lodash` wrapper instance.
  26487. * @example
  26488. *
  26489. * var array = [1, 2];
  26490. * var wrapped = _(array).push(3);
  26491. *
  26492. * console.log(array);
  26493. * // => [1, 2]
  26494. *
  26495. * wrapped = wrapped.commit();
  26496. * console.log(array);
  26497. * // => [1, 2, 3]
  26498. *
  26499. * wrapped.last();
  26500. * // => 3
  26501. *
  26502. * console.log(array);
  26503. * // => [1, 2, 3]
  26504. */
  26505. function wrapperCommit() {
  26506. return new LodashWrapper(this.value(), this.__chain__);
  26507. }
  26508. /**
  26509. * Gets the next value on a wrapped object following the
  26510. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26511. *
  26512. * @name next
  26513. * @memberOf _
  26514. * @since 4.0.0
  26515. * @category Seq
  26516. * @returns {Object} Returns the next iterator value.
  26517. * @example
  26518. *
  26519. * var wrapped = _([1, 2]);
  26520. *
  26521. * wrapped.next();
  26522. * // => { 'done': false, 'value': 1 }
  26523. *
  26524. * wrapped.next();
  26525. * // => { 'done': false, 'value': 2 }
  26526. *
  26527. * wrapped.next();
  26528. * // => { 'done': true, 'value': undefined }
  26529. */
  26530. function wrapperNext() {
  26531. if (this.__values__ === undefined) {
  26532. this.__values__ = toArray(this.value());
  26533. }
  26534. var done = this.__index__ >= this.__values__.length,
  26535. value = done ? undefined : this.__values__[this.__index__++];
  26536. return { 'done': done, 'value': value };
  26537. }
  26538. /**
  26539. * Enables the wrapper to be iterable.
  26540. *
  26541. * @name Symbol.iterator
  26542. * @memberOf _
  26543. * @since 4.0.0
  26544. * @category Seq
  26545. * @returns {Object} Returns the wrapper object.
  26546. * @example
  26547. *
  26548. * var wrapped = _([1, 2]);
  26549. *
  26550. * wrapped[Symbol.iterator]() === wrapped;
  26551. * // => true
  26552. *
  26553. * Array.from(wrapped);
  26554. * // => [1, 2]
  26555. */
  26556. function wrapperToIterator() {
  26557. return this;
  26558. }
  26559. /**
  26560. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26561. *
  26562. * @name plant
  26563. * @memberOf _
  26564. * @since 3.2.0
  26565. * @category Seq
  26566. * @param {*} value The value to plant.
  26567. * @returns {Object} Returns the new `lodash` wrapper instance.
  26568. * @example
  26569. *
  26570. * function square(n) {
  26571. * return n * n;
  26572. * }
  26573. *
  26574. * var wrapped = _([1, 2]).map(square);
  26575. * var other = wrapped.plant([3, 4]);
  26576. *
  26577. * other.value();
  26578. * // => [9, 16]
  26579. *
  26580. * wrapped.value();
  26581. * // => [1, 4]
  26582. */
  26583. function wrapperPlant(value) {
  26584. var result,
  26585. parent = this;
  26586. while (parent instanceof baseLodash) {
  26587. var clone = wrapperClone(parent);
  26588. clone.__index__ = 0;
  26589. clone.__values__ = undefined;
  26590. if (result) {
  26591. previous.__wrapped__ = clone;
  26592. } else {
  26593. result = clone;
  26594. }
  26595. var previous = clone;
  26596. parent = parent.__wrapped__;
  26597. }
  26598. previous.__wrapped__ = value;
  26599. return result;
  26600. }
  26601. /**
  26602. * This method is the wrapper version of `_.reverse`.
  26603. *
  26604. * **Note:** This method mutates the wrapped array.
  26605. *
  26606. * @name reverse
  26607. * @memberOf _
  26608. * @since 0.1.0
  26609. * @category Seq
  26610. * @returns {Object} Returns the new `lodash` wrapper instance.
  26611. * @example
  26612. *
  26613. * var array = [1, 2, 3];
  26614. *
  26615. * _(array).reverse().value()
  26616. * // => [3, 2, 1]
  26617. *
  26618. * console.log(array);
  26619. * // => [3, 2, 1]
  26620. */
  26621. function wrapperReverse() {
  26622. var value = this.__wrapped__;
  26623. if (value instanceof LazyWrapper) {
  26624. var wrapped = value;
  26625. if (this.__actions__.length) {
  26626. wrapped = new LazyWrapper(this);
  26627. }
  26628. wrapped = wrapped.reverse();
  26629. wrapped.__actions__.push({
  26630. 'func': thru,
  26631. 'args': [reverse],
  26632. 'thisArg': undefined
  26633. });
  26634. return new LodashWrapper(wrapped, this.__chain__);
  26635. }
  26636. return this.thru(reverse);
  26637. }
  26638. /**
  26639. * Executes the chain sequence to resolve the unwrapped value.
  26640. *
  26641. * @name value
  26642. * @memberOf _
  26643. * @since 0.1.0
  26644. * @alias toJSON, valueOf
  26645. * @category Seq
  26646. * @returns {*} Returns the resolved unwrapped value.
  26647. * @example
  26648. *
  26649. * _([1, 2, 3]).value();
  26650. * // => [1, 2, 3]
  26651. */
  26652. function wrapperValue() {
  26653. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26654. }
  26655. /*------------------------------------------------------------------------*/
  26656. /**
  26657. * Creates an object composed of keys generated from the results of running
  26658. * each element of `collection` thru `iteratee`. The corresponding value of
  26659. * each key is the number of times the key was returned by `iteratee`. The
  26660. * iteratee is invoked with one argument: (value).
  26661. *
  26662. * @static
  26663. * @memberOf _
  26664. * @since 0.5.0
  26665. * @category Collection
  26666. * @param {Array|Object} collection The collection to iterate over.
  26667. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26668. * @returns {Object} Returns the composed aggregate object.
  26669. * @example
  26670. *
  26671. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26672. * // => { '4': 1, '6': 2 }
  26673. *
  26674. * // The `_.property` iteratee shorthand.
  26675. * _.countBy(['one', 'two', 'three'], 'length');
  26676. * // => { '3': 2, '5': 1 }
  26677. */
  26678. var countBy = createAggregator(function(result, value, key) {
  26679. if (hasOwnProperty.call(result, key)) {
  26680. ++result[key];
  26681. } else {
  26682. baseAssignValue(result, key, 1);
  26683. }
  26684. });
  26685. /**
  26686. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26687. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26688. * invoked with three arguments: (value, index|key, collection).
  26689. *
  26690. * **Note:** This method returns `true` for
  26691. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26692. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26693. * elements of empty collections.
  26694. *
  26695. * @static
  26696. * @memberOf _
  26697. * @since 0.1.0
  26698. * @category Collection
  26699. * @param {Array|Object} collection The collection to iterate over.
  26700. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26701. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26702. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26703. * else `false`.
  26704. * @example
  26705. *
  26706. * _.every([true, 1, null, 'yes'], Boolean);
  26707. * // => false
  26708. *
  26709. * var users = [
  26710. * { 'user': 'barney', 'age': 36, 'active': false },
  26711. * { 'user': 'fred', 'age': 40, 'active': false }
  26712. * ];
  26713. *
  26714. * // The `_.matches` iteratee shorthand.
  26715. * _.every(users, { 'user': 'barney', 'active': false });
  26716. * // => false
  26717. *
  26718. * // The `_.matchesProperty` iteratee shorthand.
  26719. * _.every(users, ['active', false]);
  26720. * // => true
  26721. *
  26722. * // The `_.property` iteratee shorthand.
  26723. * _.every(users, 'active');
  26724. * // => false
  26725. */
  26726. function every(collection, predicate, guard) {
  26727. var func = isArray(collection) ? arrayEvery : baseEvery;
  26728. if (guard && isIterateeCall(collection, predicate, guard)) {
  26729. predicate = undefined;
  26730. }
  26731. return func(collection, getIteratee(predicate, 3));
  26732. }
  26733. /**
  26734. * Iterates over elements of `collection`, returning an array of all elements
  26735. * `predicate` returns truthy for. The predicate is invoked with three
  26736. * arguments: (value, index|key, collection).
  26737. *
  26738. * **Note:** Unlike `_.remove`, this method returns a new array.
  26739. *
  26740. * @static
  26741. * @memberOf _
  26742. * @since 0.1.0
  26743. * @category Collection
  26744. * @param {Array|Object} collection The collection to iterate over.
  26745. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26746. * @returns {Array} Returns the new filtered array.
  26747. * @see _.reject
  26748. * @example
  26749. *
  26750. * var users = [
  26751. * { 'user': 'barney', 'age': 36, 'active': true },
  26752. * { 'user': 'fred', 'age': 40, 'active': false }
  26753. * ];
  26754. *
  26755. * _.filter(users, function(o) { return !o.active; });
  26756. * // => objects for ['fred']
  26757. *
  26758. * // The `_.matches` iteratee shorthand.
  26759. * _.filter(users, { 'age': 36, 'active': true });
  26760. * // => objects for ['barney']
  26761. *
  26762. * // The `_.matchesProperty` iteratee shorthand.
  26763. * _.filter(users, ['active', false]);
  26764. * // => objects for ['fred']
  26765. *
  26766. * // The `_.property` iteratee shorthand.
  26767. * _.filter(users, 'active');
  26768. * // => objects for ['barney']
  26769. */
  26770. function filter(collection, predicate) {
  26771. var func = isArray(collection) ? arrayFilter : baseFilter;
  26772. return func(collection, getIteratee(predicate, 3));
  26773. }
  26774. /**
  26775. * Iterates over elements of `collection`, returning the first element
  26776. * `predicate` returns truthy for. The predicate is invoked with three
  26777. * arguments: (value, index|key, collection).
  26778. *
  26779. * @static
  26780. * @memberOf _
  26781. * @since 0.1.0
  26782. * @category Collection
  26783. * @param {Array|Object} collection The collection to inspect.
  26784. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26785. * @param {number} [fromIndex=0] The index to search from.
  26786. * @returns {*} Returns the matched element, else `undefined`.
  26787. * @example
  26788. *
  26789. * var users = [
  26790. * { 'user': 'barney', 'age': 36, 'active': true },
  26791. * { 'user': 'fred', 'age': 40, 'active': false },
  26792. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26793. * ];
  26794. *
  26795. * _.find(users, function(o) { return o.age < 40; });
  26796. * // => object for 'barney'
  26797. *
  26798. * // The `_.matches` iteratee shorthand.
  26799. * _.find(users, { 'age': 1, 'active': true });
  26800. * // => object for 'pebbles'
  26801. *
  26802. * // The `_.matchesProperty` iteratee shorthand.
  26803. * _.find(users, ['active', false]);
  26804. * // => object for 'fred'
  26805. *
  26806. * // The `_.property` iteratee shorthand.
  26807. * _.find(users, 'active');
  26808. * // => object for 'barney'
  26809. */
  26810. var find = createFind(findIndex);
  26811. /**
  26812. * This method is like `_.find` except that it iterates over elements of
  26813. * `collection` from right to left.
  26814. *
  26815. * @static
  26816. * @memberOf _
  26817. * @since 2.0.0
  26818. * @category Collection
  26819. * @param {Array|Object} collection The collection to inspect.
  26820. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26821. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26822. * @returns {*} Returns the matched element, else `undefined`.
  26823. * @example
  26824. *
  26825. * _.findLast([1, 2, 3, 4], function(n) {
  26826. * return n % 2 == 1;
  26827. * });
  26828. * // => 3
  26829. */
  26830. var findLast = createFind(findLastIndex);
  26831. /**
  26832. * Creates a flattened array of values by running each element in `collection`
  26833. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26834. * with three arguments: (value, index|key, collection).
  26835. *
  26836. * @static
  26837. * @memberOf _
  26838. * @since 4.0.0
  26839. * @category Collection
  26840. * @param {Array|Object} collection The collection to iterate over.
  26841. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26842. * @returns {Array} Returns the new flattened array.
  26843. * @example
  26844. *
  26845. * function duplicate(n) {
  26846. * return [n, n];
  26847. * }
  26848. *
  26849. * _.flatMap([1, 2], duplicate);
  26850. * // => [1, 1, 2, 2]
  26851. */
  26852. function flatMap(collection, iteratee) {
  26853. return baseFlatten(map(collection, iteratee), 1);
  26854. }
  26855. /**
  26856. * This method is like `_.flatMap` except that it recursively flattens the
  26857. * mapped results.
  26858. *
  26859. * @static
  26860. * @memberOf _
  26861. * @since 4.7.0
  26862. * @category Collection
  26863. * @param {Array|Object} collection The collection to iterate over.
  26864. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26865. * @returns {Array} Returns the new flattened array.
  26866. * @example
  26867. *
  26868. * function duplicate(n) {
  26869. * return [[[n, n]]];
  26870. * }
  26871. *
  26872. * _.flatMapDeep([1, 2], duplicate);
  26873. * // => [1, 1, 2, 2]
  26874. */
  26875. function flatMapDeep(collection, iteratee) {
  26876. return baseFlatten(map(collection, iteratee), INFINITY);
  26877. }
  26878. /**
  26879. * This method is like `_.flatMap` except that it recursively flattens the
  26880. * mapped results up to `depth` times.
  26881. *
  26882. * @static
  26883. * @memberOf _
  26884. * @since 4.7.0
  26885. * @category Collection
  26886. * @param {Array|Object} collection The collection to iterate over.
  26887. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26888. * @param {number} [depth=1] The maximum recursion depth.
  26889. * @returns {Array} Returns the new flattened array.
  26890. * @example
  26891. *
  26892. * function duplicate(n) {
  26893. * return [[[n, n]]];
  26894. * }
  26895. *
  26896. * _.flatMapDepth([1, 2], duplicate, 2);
  26897. * // => [[1, 1], [2, 2]]
  26898. */
  26899. function flatMapDepth(collection, iteratee, depth) {
  26900. depth = depth === undefined ? 1 : toInteger(depth);
  26901. return baseFlatten(map(collection, iteratee), depth);
  26902. }
  26903. /**
  26904. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  26905. * The iteratee is invoked with three arguments: (value, index|key, collection).
  26906. * Iteratee functions may exit iteration early by explicitly returning `false`.
  26907. *
  26908. * **Note:** As with other "Collections" methods, objects with a "length"
  26909. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  26910. * or `_.forOwn` for object iteration.
  26911. *
  26912. * @static
  26913. * @memberOf _
  26914. * @since 0.1.0
  26915. * @alias each
  26916. * @category Collection
  26917. * @param {Array|Object} collection The collection to iterate over.
  26918. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26919. * @returns {Array|Object} Returns `collection`.
  26920. * @see _.forEachRight
  26921. * @example
  26922. *
  26923. * _.forEach([1, 2], function(value) {
  26924. * console.log(value);
  26925. * });
  26926. * // => Logs `1` then `2`.
  26927. *
  26928. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  26929. * console.log(key);
  26930. * });
  26931. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  26932. */
  26933. function forEach(collection, iteratee) {
  26934. var func = isArray(collection) ? arrayEach : baseEach;
  26935. return func(collection, getIteratee(iteratee, 3));
  26936. }
  26937. /**
  26938. * This method is like `_.forEach` except that it iterates over elements of
  26939. * `collection` from right to left.
  26940. *
  26941. * @static
  26942. * @memberOf _
  26943. * @since 2.0.0
  26944. * @alias eachRight
  26945. * @category Collection
  26946. * @param {Array|Object} collection The collection to iterate over.
  26947. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26948. * @returns {Array|Object} Returns `collection`.
  26949. * @see _.forEach
  26950. * @example
  26951. *
  26952. * _.forEachRight([1, 2], function(value) {
  26953. * console.log(value);
  26954. * });
  26955. * // => Logs `2` then `1`.
  26956. */
  26957. function forEachRight(collection, iteratee) {
  26958. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  26959. return func(collection, getIteratee(iteratee, 3));
  26960. }
  26961. /**
  26962. * Creates an object composed of keys generated from the results of running
  26963. * each element of `collection` thru `iteratee`. The order of grouped values
  26964. * is determined by the order they occur in `collection`. The corresponding
  26965. * value of each key is an array of elements responsible for generating the
  26966. * key. The iteratee is invoked with one argument: (value).
  26967. *
  26968. * @static
  26969. * @memberOf _
  26970. * @since 0.1.0
  26971. * @category Collection
  26972. * @param {Array|Object} collection The collection to iterate over.
  26973. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26974. * @returns {Object} Returns the composed aggregate object.
  26975. * @example
  26976. *
  26977. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  26978. * // => { '4': [4.2], '6': [6.1, 6.3] }
  26979. *
  26980. * // The `_.property` iteratee shorthand.
  26981. * _.groupBy(['one', 'two', 'three'], 'length');
  26982. * // => { '3': ['one', 'two'], '5': ['three'] }
  26983. */
  26984. var groupBy = createAggregator(function(result, value, key) {
  26985. if (hasOwnProperty.call(result, key)) {
  26986. result[key].push(value);
  26987. } else {
  26988. baseAssignValue(result, key, [value]);
  26989. }
  26990. });
  26991. /**
  26992. * Checks if `value` is in `collection`. If `collection` is a string, it's
  26993. * checked for a substring of `value`, otherwise
  26994. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26995. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  26996. * the offset from the end of `collection`.
  26997. *
  26998. * @static
  26999. * @memberOf _
  27000. * @since 0.1.0
  27001. * @category Collection
  27002. * @param {Array|Object|string} collection The collection to inspect.
  27003. * @param {*} value The value to search for.
  27004. * @param {number} [fromIndex=0] The index to search from.
  27005. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27006. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27007. * @example
  27008. *
  27009. * _.includes([1, 2, 3], 1);
  27010. * // => true
  27011. *
  27012. * _.includes([1, 2, 3], 1, 2);
  27013. * // => false
  27014. *
  27015. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27016. * // => true
  27017. *
  27018. * _.includes('abcd', 'bc');
  27019. * // => true
  27020. */
  27021. function includes(collection, value, fromIndex, guard) {
  27022. collection = isArrayLike(collection) ? collection : values(collection);
  27023. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27024. var length = collection.length;
  27025. if (fromIndex < 0) {
  27026. fromIndex = nativeMax(length + fromIndex, 0);
  27027. }
  27028. return isString(collection)
  27029. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27030. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27031. }
  27032. /**
  27033. * Invokes the method at `path` of each element in `collection`, returning
  27034. * an array of the results of each invoked method. Any additional arguments
  27035. * are provided to each invoked method. If `path` is a function, it's invoked
  27036. * for, and `this` bound to, each element in `collection`.
  27037. *
  27038. * @static
  27039. * @memberOf _
  27040. * @since 4.0.0
  27041. * @category Collection
  27042. * @param {Array|Object} collection The collection to iterate over.
  27043. * @param {Array|Function|string} path The path of the method to invoke or
  27044. * the function invoked per iteration.
  27045. * @param {...*} [args] The arguments to invoke each method with.
  27046. * @returns {Array} Returns the array of results.
  27047. * @example
  27048. *
  27049. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27050. * // => [[1, 5, 7], [1, 2, 3]]
  27051. *
  27052. * _.invokeMap([123, 456], String.prototype.split, '');
  27053. * // => [['1', '2', '3'], ['4', '5', '6']]
  27054. */
  27055. var invokeMap = baseRest(function(collection, path, args) {
  27056. var index = -1,
  27057. isFunc = typeof path == 'function',
  27058. result = isArrayLike(collection) ? Array(collection.length) : [];
  27059. baseEach(collection, function(value) {
  27060. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27061. });
  27062. return result;
  27063. });
  27064. /**
  27065. * Creates an object composed of keys generated from the results of running
  27066. * each element of `collection` thru `iteratee`. The corresponding value of
  27067. * each key is the last element responsible for generating the key. The
  27068. * iteratee is invoked with one argument: (value).
  27069. *
  27070. * @static
  27071. * @memberOf _
  27072. * @since 4.0.0
  27073. * @category Collection
  27074. * @param {Array|Object} collection The collection to iterate over.
  27075. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27076. * @returns {Object} Returns the composed aggregate object.
  27077. * @example
  27078. *
  27079. * var array = [
  27080. * { 'dir': 'left', 'code': 97 },
  27081. * { 'dir': 'right', 'code': 100 }
  27082. * ];
  27083. *
  27084. * _.keyBy(array, function(o) {
  27085. * return String.fromCharCode(o.code);
  27086. * });
  27087. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27088. *
  27089. * _.keyBy(array, 'dir');
  27090. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27091. */
  27092. var keyBy = createAggregator(function(result, value, key) {
  27093. baseAssignValue(result, key, value);
  27094. });
  27095. /**
  27096. * Creates an array of values by running each element in `collection` thru
  27097. * `iteratee`. The iteratee is invoked with three arguments:
  27098. * (value, index|key, collection).
  27099. *
  27100. * Many lodash methods are guarded to work as iteratees for methods like
  27101. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27102. *
  27103. * The guarded methods are:
  27104. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27105. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27106. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27107. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27108. *
  27109. * @static
  27110. * @memberOf _
  27111. * @since 0.1.0
  27112. * @category Collection
  27113. * @param {Array|Object} collection The collection to iterate over.
  27114. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27115. * @returns {Array} Returns the new mapped array.
  27116. * @example
  27117. *
  27118. * function square(n) {
  27119. * return n * n;
  27120. * }
  27121. *
  27122. * _.map([4, 8], square);
  27123. * // => [16, 64]
  27124. *
  27125. * _.map({ 'a': 4, 'b': 8 }, square);
  27126. * // => [16, 64] (iteration order is not guaranteed)
  27127. *
  27128. * var users = [
  27129. * { 'user': 'barney' },
  27130. * { 'user': 'fred' }
  27131. * ];
  27132. *
  27133. * // The `_.property` iteratee shorthand.
  27134. * _.map(users, 'user');
  27135. * // => ['barney', 'fred']
  27136. */
  27137. function map(collection, iteratee) {
  27138. var func = isArray(collection) ? arrayMap : baseMap;
  27139. return func(collection, getIteratee(iteratee, 3));
  27140. }
  27141. /**
  27142. * This method is like `_.sortBy` except that it allows specifying the sort
  27143. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27144. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27145. * descending or "asc" for ascending sort order of corresponding values.
  27146. *
  27147. * @static
  27148. * @memberOf _
  27149. * @since 4.0.0
  27150. * @category Collection
  27151. * @param {Array|Object} collection The collection to iterate over.
  27152. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27153. * The iteratees to sort by.
  27154. * @param {string[]} [orders] The sort orders of `iteratees`.
  27155. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27156. * @returns {Array} Returns the new sorted array.
  27157. * @example
  27158. *
  27159. * var users = [
  27160. * { 'user': 'fred', 'age': 48 },
  27161. * { 'user': 'barney', 'age': 34 },
  27162. * { 'user': 'fred', 'age': 40 },
  27163. * { 'user': 'barney', 'age': 36 }
  27164. * ];
  27165. *
  27166. * // Sort by `user` in ascending order and by `age` in descending order.
  27167. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27168. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27169. */
  27170. function orderBy(collection, iteratees, orders, guard) {
  27171. if (collection == null) {
  27172. return [];
  27173. }
  27174. if (!isArray(iteratees)) {
  27175. iteratees = iteratees == null ? [] : [iteratees];
  27176. }
  27177. orders = guard ? undefined : orders;
  27178. if (!isArray(orders)) {
  27179. orders = orders == null ? [] : [orders];
  27180. }
  27181. return baseOrderBy(collection, iteratees, orders);
  27182. }
  27183. /**
  27184. * Creates an array of elements split into two groups, the first of which
  27185. * contains elements `predicate` returns truthy for, the second of which
  27186. * contains elements `predicate` returns falsey for. The predicate is
  27187. * invoked with one argument: (value).
  27188. *
  27189. * @static
  27190. * @memberOf _
  27191. * @since 3.0.0
  27192. * @category Collection
  27193. * @param {Array|Object} collection The collection to iterate over.
  27194. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27195. * @returns {Array} Returns the array of grouped elements.
  27196. * @example
  27197. *
  27198. * var users = [
  27199. * { 'user': 'barney', 'age': 36, 'active': false },
  27200. * { 'user': 'fred', 'age': 40, 'active': true },
  27201. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27202. * ];
  27203. *
  27204. * _.partition(users, function(o) { return o.active; });
  27205. * // => objects for [['fred'], ['barney', 'pebbles']]
  27206. *
  27207. * // The `_.matches` iteratee shorthand.
  27208. * _.partition(users, { 'age': 1, 'active': false });
  27209. * // => objects for [['pebbles'], ['barney', 'fred']]
  27210. *
  27211. * // The `_.matchesProperty` iteratee shorthand.
  27212. * _.partition(users, ['active', false]);
  27213. * // => objects for [['barney', 'pebbles'], ['fred']]
  27214. *
  27215. * // The `_.property` iteratee shorthand.
  27216. * _.partition(users, 'active');
  27217. * // => objects for [['fred'], ['barney', 'pebbles']]
  27218. */
  27219. var partition = createAggregator(function(result, value, key) {
  27220. result[key ? 0 : 1].push(value);
  27221. }, function() { return [[], []]; });
  27222. /**
  27223. * Reduces `collection` to a value which is the accumulated result of running
  27224. * each element in `collection` thru `iteratee`, where each successive
  27225. * invocation is supplied the return value of the previous. If `accumulator`
  27226. * is not given, the first element of `collection` is used as the initial
  27227. * value. The iteratee is invoked with four arguments:
  27228. * (accumulator, value, index|key, collection).
  27229. *
  27230. * Many lodash methods are guarded to work as iteratees for methods like
  27231. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27232. *
  27233. * The guarded methods are:
  27234. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27235. * and `sortBy`
  27236. *
  27237. * @static
  27238. * @memberOf _
  27239. * @since 0.1.0
  27240. * @category Collection
  27241. * @param {Array|Object} collection The collection to iterate over.
  27242. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27243. * @param {*} [accumulator] The initial value.
  27244. * @returns {*} Returns the accumulated value.
  27245. * @see _.reduceRight
  27246. * @example
  27247. *
  27248. * _.reduce([1, 2], function(sum, n) {
  27249. * return sum + n;
  27250. * }, 0);
  27251. * // => 3
  27252. *
  27253. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27254. * (result[value] || (result[value] = [])).push(key);
  27255. * return result;
  27256. * }, {});
  27257. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27258. */
  27259. function reduce(collection, iteratee, accumulator) {
  27260. var func = isArray(collection) ? arrayReduce : baseReduce,
  27261. initAccum = arguments.length < 3;
  27262. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27263. }
  27264. /**
  27265. * This method is like `_.reduce` except that it iterates over elements of
  27266. * `collection` from right to left.
  27267. *
  27268. * @static
  27269. * @memberOf _
  27270. * @since 0.1.0
  27271. * @category Collection
  27272. * @param {Array|Object} collection The collection to iterate over.
  27273. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27274. * @param {*} [accumulator] The initial value.
  27275. * @returns {*} Returns the accumulated value.
  27276. * @see _.reduce
  27277. * @example
  27278. *
  27279. * var array = [[0, 1], [2, 3], [4, 5]];
  27280. *
  27281. * _.reduceRight(array, function(flattened, other) {
  27282. * return flattened.concat(other);
  27283. * }, []);
  27284. * // => [4, 5, 2, 3, 0, 1]
  27285. */
  27286. function reduceRight(collection, iteratee, accumulator) {
  27287. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27288. initAccum = arguments.length < 3;
  27289. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27290. }
  27291. /**
  27292. * The opposite of `_.filter`; this method returns the elements of `collection`
  27293. * that `predicate` does **not** return truthy for.
  27294. *
  27295. * @static
  27296. * @memberOf _
  27297. * @since 0.1.0
  27298. * @category Collection
  27299. * @param {Array|Object} collection The collection to iterate over.
  27300. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27301. * @returns {Array} Returns the new filtered array.
  27302. * @see _.filter
  27303. * @example
  27304. *
  27305. * var users = [
  27306. * { 'user': 'barney', 'age': 36, 'active': false },
  27307. * { 'user': 'fred', 'age': 40, 'active': true }
  27308. * ];
  27309. *
  27310. * _.reject(users, function(o) { return !o.active; });
  27311. * // => objects for ['fred']
  27312. *
  27313. * // The `_.matches` iteratee shorthand.
  27314. * _.reject(users, { 'age': 40, 'active': true });
  27315. * // => objects for ['barney']
  27316. *
  27317. * // The `_.matchesProperty` iteratee shorthand.
  27318. * _.reject(users, ['active', false]);
  27319. * // => objects for ['fred']
  27320. *
  27321. * // The `_.property` iteratee shorthand.
  27322. * _.reject(users, 'active');
  27323. * // => objects for ['barney']
  27324. */
  27325. function reject(collection, predicate) {
  27326. var func = isArray(collection) ? arrayFilter : baseFilter;
  27327. return func(collection, negate(getIteratee(predicate, 3)));
  27328. }
  27329. /**
  27330. * Gets a random element from `collection`.
  27331. *
  27332. * @static
  27333. * @memberOf _
  27334. * @since 2.0.0
  27335. * @category Collection
  27336. * @param {Array|Object} collection The collection to sample.
  27337. * @returns {*} Returns the random element.
  27338. * @example
  27339. *
  27340. * _.sample([1, 2, 3, 4]);
  27341. * // => 2
  27342. */
  27343. function sample(collection) {
  27344. var func = isArray(collection) ? arraySample : baseSample;
  27345. return func(collection);
  27346. }
  27347. /**
  27348. * Gets `n` random elements at unique keys from `collection` up to the
  27349. * size of `collection`.
  27350. *
  27351. * @static
  27352. * @memberOf _
  27353. * @since 4.0.0
  27354. * @category Collection
  27355. * @param {Array|Object} collection The collection to sample.
  27356. * @param {number} [n=1] The number of elements to sample.
  27357. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27358. * @returns {Array} Returns the random elements.
  27359. * @example
  27360. *
  27361. * _.sampleSize([1, 2, 3], 2);
  27362. * // => [3, 1]
  27363. *
  27364. * _.sampleSize([1, 2, 3], 4);
  27365. * // => [2, 3, 1]
  27366. */
  27367. function sampleSize(collection, n, guard) {
  27368. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27369. n = 1;
  27370. } else {
  27371. n = toInteger(n);
  27372. }
  27373. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27374. return func(collection, n);
  27375. }
  27376. /**
  27377. * Creates an array of shuffled values, using a version of the
  27378. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27379. *
  27380. * @static
  27381. * @memberOf _
  27382. * @since 0.1.0
  27383. * @category Collection
  27384. * @param {Array|Object} collection The collection to shuffle.
  27385. * @returns {Array} Returns the new shuffled array.
  27386. * @example
  27387. *
  27388. * _.shuffle([1, 2, 3, 4]);
  27389. * // => [4, 1, 3, 2]
  27390. */
  27391. function shuffle(collection) {
  27392. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27393. return func(collection);
  27394. }
  27395. /**
  27396. * Gets the size of `collection` by returning its length for array-like
  27397. * values or the number of own enumerable string keyed properties for objects.
  27398. *
  27399. * @static
  27400. * @memberOf _
  27401. * @since 0.1.0
  27402. * @category Collection
  27403. * @param {Array|Object|string} collection The collection to inspect.
  27404. * @returns {number} Returns the collection size.
  27405. * @example
  27406. *
  27407. * _.size([1, 2, 3]);
  27408. * // => 3
  27409. *
  27410. * _.size({ 'a': 1, 'b': 2 });
  27411. * // => 2
  27412. *
  27413. * _.size('pebbles');
  27414. * // => 7
  27415. */
  27416. function size(collection) {
  27417. if (collection == null) {
  27418. return 0;
  27419. }
  27420. if (isArrayLike(collection)) {
  27421. return isString(collection) ? stringSize(collection) : collection.length;
  27422. }
  27423. var tag = getTag(collection);
  27424. if (tag == mapTag || tag == setTag) {
  27425. return collection.size;
  27426. }
  27427. return baseKeys(collection).length;
  27428. }
  27429. /**
  27430. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27431. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27432. * invoked with three arguments: (value, index|key, collection).
  27433. *
  27434. * @static
  27435. * @memberOf _
  27436. * @since 0.1.0
  27437. * @category Collection
  27438. * @param {Array|Object} collection The collection to iterate over.
  27439. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27440. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27441. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27442. * else `false`.
  27443. * @example
  27444. *
  27445. * _.some([null, 0, 'yes', false], Boolean);
  27446. * // => true
  27447. *
  27448. * var users = [
  27449. * { 'user': 'barney', 'active': true },
  27450. * { 'user': 'fred', 'active': false }
  27451. * ];
  27452. *
  27453. * // The `_.matches` iteratee shorthand.
  27454. * _.some(users, { 'user': 'barney', 'active': false });
  27455. * // => false
  27456. *
  27457. * // The `_.matchesProperty` iteratee shorthand.
  27458. * _.some(users, ['active', false]);
  27459. * // => true
  27460. *
  27461. * // The `_.property` iteratee shorthand.
  27462. * _.some(users, 'active');
  27463. * // => true
  27464. */
  27465. function some(collection, predicate, guard) {
  27466. var func = isArray(collection) ? arraySome : baseSome;
  27467. if (guard && isIterateeCall(collection, predicate, guard)) {
  27468. predicate = undefined;
  27469. }
  27470. return func(collection, getIteratee(predicate, 3));
  27471. }
  27472. /**
  27473. * Creates an array of elements, sorted in ascending order by the results of
  27474. * running each element in a collection thru each iteratee. This method
  27475. * performs a stable sort, that is, it preserves the original sort order of
  27476. * equal elements. The iteratees are invoked with one argument: (value).
  27477. *
  27478. * @static
  27479. * @memberOf _
  27480. * @since 0.1.0
  27481. * @category Collection
  27482. * @param {Array|Object} collection The collection to iterate over.
  27483. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27484. * The iteratees to sort by.
  27485. * @returns {Array} Returns the new sorted array.
  27486. * @example
  27487. *
  27488. * var users = [
  27489. * { 'user': 'fred', 'age': 48 },
  27490. * { 'user': 'barney', 'age': 36 },
  27491. * { 'user': 'fred', 'age': 40 },
  27492. * { 'user': 'barney', 'age': 34 }
  27493. * ];
  27494. *
  27495. * _.sortBy(users, [function(o) { return o.user; }]);
  27496. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27497. *
  27498. * _.sortBy(users, ['user', 'age']);
  27499. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27500. */
  27501. var sortBy = baseRest(function(collection, iteratees) {
  27502. if (collection == null) {
  27503. return [];
  27504. }
  27505. var length = iteratees.length;
  27506. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27507. iteratees = [];
  27508. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27509. iteratees = [iteratees[0]];
  27510. }
  27511. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27512. });
  27513. /*------------------------------------------------------------------------*/
  27514. /**
  27515. * Gets the timestamp of the number of milliseconds that have elapsed since
  27516. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27517. *
  27518. * @static
  27519. * @memberOf _
  27520. * @since 2.4.0
  27521. * @category Date
  27522. * @returns {number} Returns the timestamp.
  27523. * @example
  27524. *
  27525. * _.defer(function(stamp) {
  27526. * console.log(_.now() - stamp);
  27527. * }, _.now());
  27528. * // => Logs the number of milliseconds it took for the deferred invocation.
  27529. */
  27530. var now = ctxNow || function() {
  27531. return root.Date.now();
  27532. };
  27533. /*------------------------------------------------------------------------*/
  27534. /**
  27535. * The opposite of `_.before`; this method creates a function that invokes
  27536. * `func` once it's called `n` or more times.
  27537. *
  27538. * @static
  27539. * @memberOf _
  27540. * @since 0.1.0
  27541. * @category Function
  27542. * @param {number} n The number of calls before `func` is invoked.
  27543. * @param {Function} func The function to restrict.
  27544. * @returns {Function} Returns the new restricted function.
  27545. * @example
  27546. *
  27547. * var saves = ['profile', 'settings'];
  27548. *
  27549. * var done = _.after(saves.length, function() {
  27550. * console.log('done saving!');
  27551. * });
  27552. *
  27553. * _.forEach(saves, function(type) {
  27554. * asyncSave({ 'type': type, 'complete': done });
  27555. * });
  27556. * // => Logs 'done saving!' after the two async saves have completed.
  27557. */
  27558. function after(n, func) {
  27559. if (typeof func != 'function') {
  27560. throw new TypeError(FUNC_ERROR_TEXT);
  27561. }
  27562. n = toInteger(n);
  27563. return function() {
  27564. if (--n < 1) {
  27565. return func.apply(this, arguments);
  27566. }
  27567. };
  27568. }
  27569. /**
  27570. * Creates a function that invokes `func`, with up to `n` arguments,
  27571. * ignoring any additional arguments.
  27572. *
  27573. * @static
  27574. * @memberOf _
  27575. * @since 3.0.0
  27576. * @category Function
  27577. * @param {Function} func The function to cap arguments for.
  27578. * @param {number} [n=func.length] The arity cap.
  27579. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27580. * @returns {Function} Returns the new capped function.
  27581. * @example
  27582. *
  27583. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27584. * // => [6, 8, 10]
  27585. */
  27586. function ary(func, n, guard) {
  27587. n = guard ? undefined : n;
  27588. n = (func && n == null) ? func.length : n;
  27589. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27590. }
  27591. /**
  27592. * Creates a function that invokes `func`, with the `this` binding and arguments
  27593. * of the created function, while it's called less than `n` times. Subsequent
  27594. * calls to the created function return the result of the last `func` invocation.
  27595. *
  27596. * @static
  27597. * @memberOf _
  27598. * @since 3.0.0
  27599. * @category Function
  27600. * @param {number} n The number of calls at which `func` is no longer invoked.
  27601. * @param {Function} func The function to restrict.
  27602. * @returns {Function} Returns the new restricted function.
  27603. * @example
  27604. *
  27605. * jQuery(element).on('click', _.before(5, addContactToList));
  27606. * // => Allows adding up to 4 contacts to the list.
  27607. */
  27608. function before(n, func) {
  27609. var result;
  27610. if (typeof func != 'function') {
  27611. throw new TypeError(FUNC_ERROR_TEXT);
  27612. }
  27613. n = toInteger(n);
  27614. return function() {
  27615. if (--n > 0) {
  27616. result = func.apply(this, arguments);
  27617. }
  27618. if (n <= 1) {
  27619. func = undefined;
  27620. }
  27621. return result;
  27622. };
  27623. }
  27624. /**
  27625. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27626. * and `partials` prepended to the arguments it receives.
  27627. *
  27628. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27629. * may be used as a placeholder for partially applied arguments.
  27630. *
  27631. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27632. * property of bound functions.
  27633. *
  27634. * @static
  27635. * @memberOf _
  27636. * @since 0.1.0
  27637. * @category Function
  27638. * @param {Function} func The function to bind.
  27639. * @param {*} thisArg The `this` binding of `func`.
  27640. * @param {...*} [partials] The arguments to be partially applied.
  27641. * @returns {Function} Returns the new bound function.
  27642. * @example
  27643. *
  27644. * function greet(greeting, punctuation) {
  27645. * return greeting + ' ' + this.user + punctuation;
  27646. * }
  27647. *
  27648. * var object = { 'user': 'fred' };
  27649. *
  27650. * var bound = _.bind(greet, object, 'hi');
  27651. * bound('!');
  27652. * // => 'hi fred!'
  27653. *
  27654. * // Bound with placeholders.
  27655. * var bound = _.bind(greet, object, _, '!');
  27656. * bound('hi');
  27657. * // => 'hi fred!'
  27658. */
  27659. var bind = baseRest(function(func, thisArg, partials) {
  27660. var bitmask = WRAP_BIND_FLAG;
  27661. if (partials.length) {
  27662. var holders = replaceHolders(partials, getHolder(bind));
  27663. bitmask |= WRAP_PARTIAL_FLAG;
  27664. }
  27665. return createWrap(func, bitmask, thisArg, partials, holders);
  27666. });
  27667. /**
  27668. * Creates a function that invokes the method at `object[key]` with `partials`
  27669. * prepended to the arguments it receives.
  27670. *
  27671. * This method differs from `_.bind` by allowing bound functions to reference
  27672. * methods that may be redefined or don't yet exist. See
  27673. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27674. * for more details.
  27675. *
  27676. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27677. * builds, may be used as a placeholder for partially applied arguments.
  27678. *
  27679. * @static
  27680. * @memberOf _
  27681. * @since 0.10.0
  27682. * @category Function
  27683. * @param {Object} object The object to invoke the method on.
  27684. * @param {string} key The key of the method.
  27685. * @param {...*} [partials] The arguments to be partially applied.
  27686. * @returns {Function} Returns the new bound function.
  27687. * @example
  27688. *
  27689. * var object = {
  27690. * 'user': 'fred',
  27691. * 'greet': function(greeting, punctuation) {
  27692. * return greeting + ' ' + this.user + punctuation;
  27693. * }
  27694. * };
  27695. *
  27696. * var bound = _.bindKey(object, 'greet', 'hi');
  27697. * bound('!');
  27698. * // => 'hi fred!'
  27699. *
  27700. * object.greet = function(greeting, punctuation) {
  27701. * return greeting + 'ya ' + this.user + punctuation;
  27702. * };
  27703. *
  27704. * bound('!');
  27705. * // => 'hiya fred!'
  27706. *
  27707. * // Bound with placeholders.
  27708. * var bound = _.bindKey(object, 'greet', _, '!');
  27709. * bound('hi');
  27710. * // => 'hiya fred!'
  27711. */
  27712. var bindKey = baseRest(function(object, key, partials) {
  27713. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27714. if (partials.length) {
  27715. var holders = replaceHolders(partials, getHolder(bindKey));
  27716. bitmask |= WRAP_PARTIAL_FLAG;
  27717. }
  27718. return createWrap(key, bitmask, object, partials, holders);
  27719. });
  27720. /**
  27721. * Creates a function that accepts arguments of `func` and either invokes
  27722. * `func` returning its result, if at least `arity` number of arguments have
  27723. * been provided, or returns a function that accepts the remaining `func`
  27724. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27725. * is not sufficient.
  27726. *
  27727. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27728. * may be used as a placeholder for provided arguments.
  27729. *
  27730. * **Note:** This method doesn't set the "length" property of curried functions.
  27731. *
  27732. * @static
  27733. * @memberOf _
  27734. * @since 2.0.0
  27735. * @category Function
  27736. * @param {Function} func The function to curry.
  27737. * @param {number} [arity=func.length] The arity of `func`.
  27738. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27739. * @returns {Function} Returns the new curried function.
  27740. * @example
  27741. *
  27742. * var abc = function(a, b, c) {
  27743. * return [a, b, c];
  27744. * };
  27745. *
  27746. * var curried = _.curry(abc);
  27747. *
  27748. * curried(1)(2)(3);
  27749. * // => [1, 2, 3]
  27750. *
  27751. * curried(1, 2)(3);
  27752. * // => [1, 2, 3]
  27753. *
  27754. * curried(1, 2, 3);
  27755. * // => [1, 2, 3]
  27756. *
  27757. * // Curried with placeholders.
  27758. * curried(1)(_, 3)(2);
  27759. * // => [1, 2, 3]
  27760. */
  27761. function curry(func, arity, guard) {
  27762. arity = guard ? undefined : arity;
  27763. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27764. result.placeholder = curry.placeholder;
  27765. return result;
  27766. }
  27767. /**
  27768. * This method is like `_.curry` except that arguments are applied to `func`
  27769. * in the manner of `_.partialRight` instead of `_.partial`.
  27770. *
  27771. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27772. * builds, may be used as a placeholder for provided arguments.
  27773. *
  27774. * **Note:** This method doesn't set the "length" property of curried functions.
  27775. *
  27776. * @static
  27777. * @memberOf _
  27778. * @since 3.0.0
  27779. * @category Function
  27780. * @param {Function} func The function to curry.
  27781. * @param {number} [arity=func.length] The arity of `func`.
  27782. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27783. * @returns {Function} Returns the new curried function.
  27784. * @example
  27785. *
  27786. * var abc = function(a, b, c) {
  27787. * return [a, b, c];
  27788. * };
  27789. *
  27790. * var curried = _.curryRight(abc);
  27791. *
  27792. * curried(3)(2)(1);
  27793. * // => [1, 2, 3]
  27794. *
  27795. * curried(2, 3)(1);
  27796. * // => [1, 2, 3]
  27797. *
  27798. * curried(1, 2, 3);
  27799. * // => [1, 2, 3]
  27800. *
  27801. * // Curried with placeholders.
  27802. * curried(3)(1, _)(2);
  27803. * // => [1, 2, 3]
  27804. */
  27805. function curryRight(func, arity, guard) {
  27806. arity = guard ? undefined : arity;
  27807. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27808. result.placeholder = curryRight.placeholder;
  27809. return result;
  27810. }
  27811. /**
  27812. * Creates a debounced function that delays invoking `func` until after `wait`
  27813. * milliseconds have elapsed since the last time the debounced function was
  27814. * invoked. The debounced function comes with a `cancel` method to cancel
  27815. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27816. * Provide `options` to indicate whether `func` should be invoked on the
  27817. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27818. * with the last arguments provided to the debounced function. Subsequent
  27819. * calls to the debounced function return the result of the last `func`
  27820. * invocation.
  27821. *
  27822. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27823. * invoked on the trailing edge of the timeout only if the debounced function
  27824. * is invoked more than once during the `wait` timeout.
  27825. *
  27826. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27827. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27828. *
  27829. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27830. * for details over the differences between `_.debounce` and `_.throttle`.
  27831. *
  27832. * @static
  27833. * @memberOf _
  27834. * @since 0.1.0
  27835. * @category Function
  27836. * @param {Function} func The function to debounce.
  27837. * @param {number} [wait=0] The number of milliseconds to delay.
  27838. * @param {Object} [options={}] The options object.
  27839. * @param {boolean} [options.leading=false]
  27840. * Specify invoking on the leading edge of the timeout.
  27841. * @param {number} [options.maxWait]
  27842. * The maximum time `func` is allowed to be delayed before it's invoked.
  27843. * @param {boolean} [options.trailing=true]
  27844. * Specify invoking on the trailing edge of the timeout.
  27845. * @returns {Function} Returns the new debounced function.
  27846. * @example
  27847. *
  27848. * // Avoid costly calculations while the window size is in flux.
  27849. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27850. *
  27851. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27852. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27853. * 'leading': true,
  27854. * 'trailing': false
  27855. * }));
  27856. *
  27857. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27858. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27859. * var source = new EventSource('/stream');
  27860. * jQuery(source).on('message', debounced);
  27861. *
  27862. * // Cancel the trailing debounced invocation.
  27863. * jQuery(window).on('popstate', debounced.cancel);
  27864. */
  27865. function debounce(func, wait, options) {
  27866. var lastArgs,
  27867. lastThis,
  27868. maxWait,
  27869. result,
  27870. timerId,
  27871. lastCallTime,
  27872. lastInvokeTime = 0,
  27873. leading = false,
  27874. maxing = false,
  27875. trailing = true;
  27876. if (typeof func != 'function') {
  27877. throw new TypeError(FUNC_ERROR_TEXT);
  27878. }
  27879. wait = toNumber(wait) || 0;
  27880. if (isObject(options)) {
  27881. leading = !!options.leading;
  27882. maxing = 'maxWait' in options;
  27883. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27884. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27885. }
  27886. function invokeFunc(time) {
  27887. var args = lastArgs,
  27888. thisArg = lastThis;
  27889. lastArgs = lastThis = undefined;
  27890. lastInvokeTime = time;
  27891. result = func.apply(thisArg, args);
  27892. return result;
  27893. }
  27894. function leadingEdge(time) {
  27895. // Reset any `maxWait` timer.
  27896. lastInvokeTime = time;
  27897. // Start the timer for the trailing edge.
  27898. timerId = setTimeout(timerExpired, wait);
  27899. // Invoke the leading edge.
  27900. return leading ? invokeFunc(time) : result;
  27901. }
  27902. function remainingWait(time) {
  27903. var timeSinceLastCall = time - lastCallTime,
  27904. timeSinceLastInvoke = time - lastInvokeTime,
  27905. timeWaiting = wait - timeSinceLastCall;
  27906. return maxing
  27907. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  27908. : timeWaiting;
  27909. }
  27910. function shouldInvoke(time) {
  27911. var timeSinceLastCall = time - lastCallTime,
  27912. timeSinceLastInvoke = time - lastInvokeTime;
  27913. // Either this is the first call, activity has stopped and we're at the
  27914. // trailing edge, the system time has gone backwards and we're treating
  27915. // it as the trailing edge, or we've hit the `maxWait` limit.
  27916. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  27917. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  27918. }
  27919. function timerExpired() {
  27920. var time = now();
  27921. if (shouldInvoke(time)) {
  27922. return trailingEdge(time);
  27923. }
  27924. // Restart the timer.
  27925. timerId = setTimeout(timerExpired, remainingWait(time));
  27926. }
  27927. function trailingEdge(time) {
  27928. timerId = undefined;
  27929. // Only invoke if we have `lastArgs` which means `func` has been
  27930. // debounced at least once.
  27931. if (trailing && lastArgs) {
  27932. return invokeFunc(time);
  27933. }
  27934. lastArgs = lastThis = undefined;
  27935. return result;
  27936. }
  27937. function cancel() {
  27938. if (timerId !== undefined) {
  27939. clearTimeout(timerId);
  27940. }
  27941. lastInvokeTime = 0;
  27942. lastArgs = lastCallTime = lastThis = timerId = undefined;
  27943. }
  27944. function flush() {
  27945. return timerId === undefined ? result : trailingEdge(now());
  27946. }
  27947. function debounced() {
  27948. var time = now(),
  27949. isInvoking = shouldInvoke(time);
  27950. lastArgs = arguments;
  27951. lastThis = this;
  27952. lastCallTime = time;
  27953. if (isInvoking) {
  27954. if (timerId === undefined) {
  27955. return leadingEdge(lastCallTime);
  27956. }
  27957. if (maxing) {
  27958. // Handle invocations in a tight loop.
  27959. clearTimeout(timerId);
  27960. timerId = setTimeout(timerExpired, wait);
  27961. return invokeFunc(lastCallTime);
  27962. }
  27963. }
  27964. if (timerId === undefined) {
  27965. timerId = setTimeout(timerExpired, wait);
  27966. }
  27967. return result;
  27968. }
  27969. debounced.cancel = cancel;
  27970. debounced.flush = flush;
  27971. return debounced;
  27972. }
  27973. /**
  27974. * Defers invoking the `func` until the current call stack has cleared. Any
  27975. * additional arguments are provided to `func` when it's invoked.
  27976. *
  27977. * @static
  27978. * @memberOf _
  27979. * @since 0.1.0
  27980. * @category Function
  27981. * @param {Function} func The function to defer.
  27982. * @param {...*} [args] The arguments to invoke `func` with.
  27983. * @returns {number} Returns the timer id.
  27984. * @example
  27985. *
  27986. * _.defer(function(text) {
  27987. * console.log(text);
  27988. * }, 'deferred');
  27989. * // => Logs 'deferred' after one millisecond.
  27990. */
  27991. var defer = baseRest(function(func, args) {
  27992. return baseDelay(func, 1, args);
  27993. });
  27994. /**
  27995. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  27996. * provided to `func` when it's invoked.
  27997. *
  27998. * @static
  27999. * @memberOf _
  28000. * @since 0.1.0
  28001. * @category Function
  28002. * @param {Function} func The function to delay.
  28003. * @param {number} wait The number of milliseconds to delay invocation.
  28004. * @param {...*} [args] The arguments to invoke `func` with.
  28005. * @returns {number} Returns the timer id.
  28006. * @example
  28007. *
  28008. * _.delay(function(text) {
  28009. * console.log(text);
  28010. * }, 1000, 'later');
  28011. * // => Logs 'later' after one second.
  28012. */
  28013. var delay = baseRest(function(func, wait, args) {
  28014. return baseDelay(func, toNumber(wait) || 0, args);
  28015. });
  28016. /**
  28017. * Creates a function that invokes `func` with arguments reversed.
  28018. *
  28019. * @static
  28020. * @memberOf _
  28021. * @since 4.0.0
  28022. * @category Function
  28023. * @param {Function} func The function to flip arguments for.
  28024. * @returns {Function} Returns the new flipped function.
  28025. * @example
  28026. *
  28027. * var flipped = _.flip(function() {
  28028. * return _.toArray(arguments);
  28029. * });
  28030. *
  28031. * flipped('a', 'b', 'c', 'd');
  28032. * // => ['d', 'c', 'b', 'a']
  28033. */
  28034. function flip(func) {
  28035. return createWrap(func, WRAP_FLIP_FLAG);
  28036. }
  28037. /**
  28038. * Creates a function that memoizes the result of `func`. If `resolver` is
  28039. * provided, it determines the cache key for storing the result based on the
  28040. * arguments provided to the memoized function. By default, the first argument
  28041. * provided to the memoized function is used as the map cache key. The `func`
  28042. * is invoked with the `this` binding of the memoized function.
  28043. *
  28044. * **Note:** The cache is exposed as the `cache` property on the memoized
  28045. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28046. * constructor with one whose instances implement the
  28047. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28048. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28049. *
  28050. * @static
  28051. * @memberOf _
  28052. * @since 0.1.0
  28053. * @category Function
  28054. * @param {Function} func The function to have its output memoized.
  28055. * @param {Function} [resolver] The function to resolve the cache key.
  28056. * @returns {Function} Returns the new memoized function.
  28057. * @example
  28058. *
  28059. * var object = { 'a': 1, 'b': 2 };
  28060. * var other = { 'c': 3, 'd': 4 };
  28061. *
  28062. * var values = _.memoize(_.values);
  28063. * values(object);
  28064. * // => [1, 2]
  28065. *
  28066. * values(other);
  28067. * // => [3, 4]
  28068. *
  28069. * object.a = 2;
  28070. * values(object);
  28071. * // => [1, 2]
  28072. *
  28073. * // Modify the result cache.
  28074. * values.cache.set(object, ['a', 'b']);
  28075. * values(object);
  28076. * // => ['a', 'b']
  28077. *
  28078. * // Replace `_.memoize.Cache`.
  28079. * _.memoize.Cache = WeakMap;
  28080. */
  28081. function memoize(func, resolver) {
  28082. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28083. throw new TypeError(FUNC_ERROR_TEXT);
  28084. }
  28085. var memoized = function() {
  28086. var args = arguments,
  28087. key = resolver ? resolver.apply(this, args) : args[0],
  28088. cache = memoized.cache;
  28089. if (cache.has(key)) {
  28090. return cache.get(key);
  28091. }
  28092. var result = func.apply(this, args);
  28093. memoized.cache = cache.set(key, result) || cache;
  28094. return result;
  28095. };
  28096. memoized.cache = new (memoize.Cache || MapCache);
  28097. return memoized;
  28098. }
  28099. // Expose `MapCache`.
  28100. memoize.Cache = MapCache;
  28101. /**
  28102. * Creates a function that negates the result of the predicate `func`. The
  28103. * `func` predicate is invoked with the `this` binding and arguments of the
  28104. * created function.
  28105. *
  28106. * @static
  28107. * @memberOf _
  28108. * @since 3.0.0
  28109. * @category Function
  28110. * @param {Function} predicate The predicate to negate.
  28111. * @returns {Function} Returns the new negated function.
  28112. * @example
  28113. *
  28114. * function isEven(n) {
  28115. * return n % 2 == 0;
  28116. * }
  28117. *
  28118. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28119. * // => [1, 3, 5]
  28120. */
  28121. function negate(predicate) {
  28122. if (typeof predicate != 'function') {
  28123. throw new TypeError(FUNC_ERROR_TEXT);
  28124. }
  28125. return function() {
  28126. var args = arguments;
  28127. switch (args.length) {
  28128. case 0: return !predicate.call(this);
  28129. case 1: return !predicate.call(this, args[0]);
  28130. case 2: return !predicate.call(this, args[0], args[1]);
  28131. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28132. }
  28133. return !predicate.apply(this, args);
  28134. };
  28135. }
  28136. /**
  28137. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28138. * to the function return the value of the first invocation. The `func` is
  28139. * invoked with the `this` binding and arguments of the created function.
  28140. *
  28141. * @static
  28142. * @memberOf _
  28143. * @since 0.1.0
  28144. * @category Function
  28145. * @param {Function} func The function to restrict.
  28146. * @returns {Function} Returns the new restricted function.
  28147. * @example
  28148. *
  28149. * var initialize = _.once(createApplication);
  28150. * initialize();
  28151. * initialize();
  28152. * // => `createApplication` is invoked once
  28153. */
  28154. function once(func) {
  28155. return before(2, func);
  28156. }
  28157. /**
  28158. * Creates a function that invokes `func` with its arguments transformed.
  28159. *
  28160. * @static
  28161. * @since 4.0.0
  28162. * @memberOf _
  28163. * @category Function
  28164. * @param {Function} func The function to wrap.
  28165. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28166. * The argument transforms.
  28167. * @returns {Function} Returns the new function.
  28168. * @example
  28169. *
  28170. * function doubled(n) {
  28171. * return n * 2;
  28172. * }
  28173. *
  28174. * function square(n) {
  28175. * return n * n;
  28176. * }
  28177. *
  28178. * var func = _.overArgs(function(x, y) {
  28179. * return [x, y];
  28180. * }, [square, doubled]);
  28181. *
  28182. * func(9, 3);
  28183. * // => [81, 6]
  28184. *
  28185. * func(10, 5);
  28186. * // => [100, 10]
  28187. */
  28188. var overArgs = castRest(function(func, transforms) {
  28189. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28190. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28191. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28192. var funcsLength = transforms.length;
  28193. return baseRest(function(args) {
  28194. var index = -1,
  28195. length = nativeMin(args.length, funcsLength);
  28196. while (++index < length) {
  28197. args[index] = transforms[index].call(this, args[index]);
  28198. }
  28199. return apply(func, this, args);
  28200. });
  28201. });
  28202. /**
  28203. * Creates a function that invokes `func` with `partials` prepended to the
  28204. * arguments it receives. This method is like `_.bind` except it does **not**
  28205. * alter the `this` binding.
  28206. *
  28207. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28208. * builds, may be used as a placeholder for partially applied arguments.
  28209. *
  28210. * **Note:** This method doesn't set the "length" property of partially
  28211. * applied functions.
  28212. *
  28213. * @static
  28214. * @memberOf _
  28215. * @since 0.2.0
  28216. * @category Function
  28217. * @param {Function} func The function to partially apply arguments to.
  28218. * @param {...*} [partials] The arguments to be partially applied.
  28219. * @returns {Function} Returns the new partially applied function.
  28220. * @example
  28221. *
  28222. * function greet(greeting, name) {
  28223. * return greeting + ' ' + name;
  28224. * }
  28225. *
  28226. * var sayHelloTo = _.partial(greet, 'hello');
  28227. * sayHelloTo('fred');
  28228. * // => 'hello fred'
  28229. *
  28230. * // Partially applied with placeholders.
  28231. * var greetFred = _.partial(greet, _, 'fred');
  28232. * greetFred('hi');
  28233. * // => 'hi fred'
  28234. */
  28235. var partial = baseRest(function(func, partials) {
  28236. var holders = replaceHolders(partials, getHolder(partial));
  28237. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28238. });
  28239. /**
  28240. * This method is like `_.partial` except that partially applied arguments
  28241. * are appended to the arguments it receives.
  28242. *
  28243. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28244. * builds, may be used as a placeholder for partially applied arguments.
  28245. *
  28246. * **Note:** This method doesn't set the "length" property of partially
  28247. * applied functions.
  28248. *
  28249. * @static
  28250. * @memberOf _
  28251. * @since 1.0.0
  28252. * @category Function
  28253. * @param {Function} func The function to partially apply arguments to.
  28254. * @param {...*} [partials] The arguments to be partially applied.
  28255. * @returns {Function} Returns the new partially applied function.
  28256. * @example
  28257. *
  28258. * function greet(greeting, name) {
  28259. * return greeting + ' ' + name;
  28260. * }
  28261. *
  28262. * var greetFred = _.partialRight(greet, 'fred');
  28263. * greetFred('hi');
  28264. * // => 'hi fred'
  28265. *
  28266. * // Partially applied with placeholders.
  28267. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28268. * sayHelloTo('fred');
  28269. * // => 'hello fred'
  28270. */
  28271. var partialRight = baseRest(function(func, partials) {
  28272. var holders = replaceHolders(partials, getHolder(partialRight));
  28273. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28274. });
  28275. /**
  28276. * Creates a function that invokes `func` with arguments arranged according
  28277. * to the specified `indexes` where the argument value at the first index is
  28278. * provided as the first argument, the argument value at the second index is
  28279. * provided as the second argument, and so on.
  28280. *
  28281. * @static
  28282. * @memberOf _
  28283. * @since 3.0.0
  28284. * @category Function
  28285. * @param {Function} func The function to rearrange arguments for.
  28286. * @param {...(number|number[])} indexes The arranged argument indexes.
  28287. * @returns {Function} Returns the new function.
  28288. * @example
  28289. *
  28290. * var rearged = _.rearg(function(a, b, c) {
  28291. * return [a, b, c];
  28292. * }, [2, 0, 1]);
  28293. *
  28294. * rearged('b', 'c', 'a')
  28295. * // => ['a', 'b', 'c']
  28296. */
  28297. var rearg = flatRest(function(func, indexes) {
  28298. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28299. });
  28300. /**
  28301. * Creates a function that invokes `func` with the `this` binding of the
  28302. * created function and arguments from `start` and beyond provided as
  28303. * an array.
  28304. *
  28305. * **Note:** This method is based on the
  28306. * [rest parameter](https://mdn.io/rest_parameters).
  28307. *
  28308. * @static
  28309. * @memberOf _
  28310. * @since 4.0.0
  28311. * @category Function
  28312. * @param {Function} func The function to apply a rest parameter to.
  28313. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28314. * @returns {Function} Returns the new function.
  28315. * @example
  28316. *
  28317. * var say = _.rest(function(what, names) {
  28318. * return what + ' ' + _.initial(names).join(', ') +
  28319. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28320. * });
  28321. *
  28322. * say('hello', 'fred', 'barney', 'pebbles');
  28323. * // => 'hello fred, barney, & pebbles'
  28324. */
  28325. function rest(func, start) {
  28326. if (typeof func != 'function') {
  28327. throw new TypeError(FUNC_ERROR_TEXT);
  28328. }
  28329. start = start === undefined ? start : toInteger(start);
  28330. return baseRest(func, start);
  28331. }
  28332. /**
  28333. * Creates a function that invokes `func` with the `this` binding of the
  28334. * create function and an array of arguments much like
  28335. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28336. *
  28337. * **Note:** This method is based on the
  28338. * [spread operator](https://mdn.io/spread_operator).
  28339. *
  28340. * @static
  28341. * @memberOf _
  28342. * @since 3.2.0
  28343. * @category Function
  28344. * @param {Function} func The function to spread arguments over.
  28345. * @param {number} [start=0] The start position of the spread.
  28346. * @returns {Function} Returns the new function.
  28347. * @example
  28348. *
  28349. * var say = _.spread(function(who, what) {
  28350. * return who + ' says ' + what;
  28351. * });
  28352. *
  28353. * say(['fred', 'hello']);
  28354. * // => 'fred says hello'
  28355. *
  28356. * var numbers = Promise.all([
  28357. * Promise.resolve(40),
  28358. * Promise.resolve(36)
  28359. * ]);
  28360. *
  28361. * numbers.then(_.spread(function(x, y) {
  28362. * return x + y;
  28363. * }));
  28364. * // => a Promise of 76
  28365. */
  28366. function spread(func, start) {
  28367. if (typeof func != 'function') {
  28368. throw new TypeError(FUNC_ERROR_TEXT);
  28369. }
  28370. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28371. return baseRest(function(args) {
  28372. var array = args[start],
  28373. otherArgs = castSlice(args, 0, start);
  28374. if (array) {
  28375. arrayPush(otherArgs, array);
  28376. }
  28377. return apply(func, this, otherArgs);
  28378. });
  28379. }
  28380. /**
  28381. * Creates a throttled function that only invokes `func` at most once per
  28382. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28383. * method to cancel delayed `func` invocations and a `flush` method to
  28384. * immediately invoke them. Provide `options` to indicate whether `func`
  28385. * should be invoked on the leading and/or trailing edge of the `wait`
  28386. * timeout. The `func` is invoked with the last arguments provided to the
  28387. * throttled function. Subsequent calls to the throttled function return the
  28388. * result of the last `func` invocation.
  28389. *
  28390. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28391. * invoked on the trailing edge of the timeout only if the throttled function
  28392. * is invoked more than once during the `wait` timeout.
  28393. *
  28394. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28395. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28396. *
  28397. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28398. * for details over the differences between `_.throttle` and `_.debounce`.
  28399. *
  28400. * @static
  28401. * @memberOf _
  28402. * @since 0.1.0
  28403. * @category Function
  28404. * @param {Function} func The function to throttle.
  28405. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28406. * @param {Object} [options={}] The options object.
  28407. * @param {boolean} [options.leading=true]
  28408. * Specify invoking on the leading edge of the timeout.
  28409. * @param {boolean} [options.trailing=true]
  28410. * Specify invoking on the trailing edge of the timeout.
  28411. * @returns {Function} Returns the new throttled function.
  28412. * @example
  28413. *
  28414. * // Avoid excessively updating the position while scrolling.
  28415. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28416. *
  28417. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28418. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28419. * jQuery(element).on('click', throttled);
  28420. *
  28421. * // Cancel the trailing throttled invocation.
  28422. * jQuery(window).on('popstate', throttled.cancel);
  28423. */
  28424. function throttle(func, wait, options) {
  28425. var leading = true,
  28426. trailing = true;
  28427. if (typeof func != 'function') {
  28428. throw new TypeError(FUNC_ERROR_TEXT);
  28429. }
  28430. if (isObject(options)) {
  28431. leading = 'leading' in options ? !!options.leading : leading;
  28432. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28433. }
  28434. return debounce(func, wait, {
  28435. 'leading': leading,
  28436. 'maxWait': wait,
  28437. 'trailing': trailing
  28438. });
  28439. }
  28440. /**
  28441. * Creates a function that accepts up to one argument, ignoring any
  28442. * additional arguments.
  28443. *
  28444. * @static
  28445. * @memberOf _
  28446. * @since 4.0.0
  28447. * @category Function
  28448. * @param {Function} func The function to cap arguments for.
  28449. * @returns {Function} Returns the new capped function.
  28450. * @example
  28451. *
  28452. * _.map(['6', '8', '10'], _.unary(parseInt));
  28453. * // => [6, 8, 10]
  28454. */
  28455. function unary(func) {
  28456. return ary(func, 1);
  28457. }
  28458. /**
  28459. * Creates a function that provides `value` to `wrapper` as its first
  28460. * argument. Any additional arguments provided to the function are appended
  28461. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28462. * binding of the created function.
  28463. *
  28464. * @static
  28465. * @memberOf _
  28466. * @since 0.1.0
  28467. * @category Function
  28468. * @param {*} value The value to wrap.
  28469. * @param {Function} [wrapper=identity] The wrapper function.
  28470. * @returns {Function} Returns the new function.
  28471. * @example
  28472. *
  28473. * var p = _.wrap(_.escape, function(func, text) {
  28474. * return '<p>' + func(text) + '</p>';
  28475. * });
  28476. *
  28477. * p('fred, barney, & pebbles');
  28478. * // => '<p>fred, barney, &amp; pebbles</p>'
  28479. */
  28480. function wrap(value, wrapper) {
  28481. return partial(castFunction(wrapper), value);
  28482. }
  28483. /*------------------------------------------------------------------------*/
  28484. /**
  28485. * Casts `value` as an array if it's not one.
  28486. *
  28487. * @static
  28488. * @memberOf _
  28489. * @since 4.4.0
  28490. * @category Lang
  28491. * @param {*} value The value to inspect.
  28492. * @returns {Array} Returns the cast array.
  28493. * @example
  28494. *
  28495. * _.castArray(1);
  28496. * // => [1]
  28497. *
  28498. * _.castArray({ 'a': 1 });
  28499. * // => [{ 'a': 1 }]
  28500. *
  28501. * _.castArray('abc');
  28502. * // => ['abc']
  28503. *
  28504. * _.castArray(null);
  28505. * // => [null]
  28506. *
  28507. * _.castArray(undefined);
  28508. * // => [undefined]
  28509. *
  28510. * _.castArray();
  28511. * // => []
  28512. *
  28513. * var array = [1, 2, 3];
  28514. * console.log(_.castArray(array) === array);
  28515. * // => true
  28516. */
  28517. function castArray() {
  28518. if (!arguments.length) {
  28519. return [];
  28520. }
  28521. var value = arguments[0];
  28522. return isArray(value) ? value : [value];
  28523. }
  28524. /**
  28525. * Creates a shallow clone of `value`.
  28526. *
  28527. * **Note:** This method is loosely based on the
  28528. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28529. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28530. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28531. * arrays. The own enumerable properties of `arguments` objects are cloned
  28532. * as plain objects. An empty object is returned for uncloneable values such
  28533. * as error objects, functions, DOM nodes, and WeakMaps.
  28534. *
  28535. * @static
  28536. * @memberOf _
  28537. * @since 0.1.0
  28538. * @category Lang
  28539. * @param {*} value The value to clone.
  28540. * @returns {*} Returns the cloned value.
  28541. * @see _.cloneDeep
  28542. * @example
  28543. *
  28544. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28545. *
  28546. * var shallow = _.clone(objects);
  28547. * console.log(shallow[0] === objects[0]);
  28548. * // => true
  28549. */
  28550. function clone(value) {
  28551. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28552. }
  28553. /**
  28554. * This method is like `_.clone` except that it accepts `customizer` which
  28555. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28556. * cloning is handled by the method instead. The `customizer` is invoked with
  28557. * up to four arguments; (value [, index|key, object, stack]).
  28558. *
  28559. * @static
  28560. * @memberOf _
  28561. * @since 4.0.0
  28562. * @category Lang
  28563. * @param {*} value The value to clone.
  28564. * @param {Function} [customizer] The function to customize cloning.
  28565. * @returns {*} Returns the cloned value.
  28566. * @see _.cloneDeepWith
  28567. * @example
  28568. *
  28569. * function customizer(value) {
  28570. * if (_.isElement(value)) {
  28571. * return value.cloneNode(false);
  28572. * }
  28573. * }
  28574. *
  28575. * var el = _.cloneWith(document.body, customizer);
  28576. *
  28577. * console.log(el === document.body);
  28578. * // => false
  28579. * console.log(el.nodeName);
  28580. * // => 'BODY'
  28581. * console.log(el.childNodes.length);
  28582. * // => 0
  28583. */
  28584. function cloneWith(value, customizer) {
  28585. customizer = typeof customizer == 'function' ? customizer : undefined;
  28586. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28587. }
  28588. /**
  28589. * This method is like `_.clone` except that it recursively clones `value`.
  28590. *
  28591. * @static
  28592. * @memberOf _
  28593. * @since 1.0.0
  28594. * @category Lang
  28595. * @param {*} value The value to recursively clone.
  28596. * @returns {*} Returns the deep cloned value.
  28597. * @see _.clone
  28598. * @example
  28599. *
  28600. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28601. *
  28602. * var deep = _.cloneDeep(objects);
  28603. * console.log(deep[0] === objects[0]);
  28604. * // => false
  28605. */
  28606. function cloneDeep(value) {
  28607. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28608. }
  28609. /**
  28610. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28611. *
  28612. * @static
  28613. * @memberOf _
  28614. * @since 4.0.0
  28615. * @category Lang
  28616. * @param {*} value The value to recursively clone.
  28617. * @param {Function} [customizer] The function to customize cloning.
  28618. * @returns {*} Returns the deep cloned value.
  28619. * @see _.cloneWith
  28620. * @example
  28621. *
  28622. * function customizer(value) {
  28623. * if (_.isElement(value)) {
  28624. * return value.cloneNode(true);
  28625. * }
  28626. * }
  28627. *
  28628. * var el = _.cloneDeepWith(document.body, customizer);
  28629. *
  28630. * console.log(el === document.body);
  28631. * // => false
  28632. * console.log(el.nodeName);
  28633. * // => 'BODY'
  28634. * console.log(el.childNodes.length);
  28635. * // => 20
  28636. */
  28637. function cloneDeepWith(value, customizer) {
  28638. customizer = typeof customizer == 'function' ? customizer : undefined;
  28639. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28640. }
  28641. /**
  28642. * Checks if `object` conforms to `source` by invoking the predicate
  28643. * properties of `source` with the corresponding property values of `object`.
  28644. *
  28645. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28646. * partially applied.
  28647. *
  28648. * @static
  28649. * @memberOf _
  28650. * @since 4.14.0
  28651. * @category Lang
  28652. * @param {Object} object The object to inspect.
  28653. * @param {Object} source The object of property predicates to conform to.
  28654. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28655. * @example
  28656. *
  28657. * var object = { 'a': 1, 'b': 2 };
  28658. *
  28659. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28660. * // => true
  28661. *
  28662. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28663. * // => false
  28664. */
  28665. function conformsTo(object, source) {
  28666. return source == null || baseConformsTo(object, source, keys(source));
  28667. }
  28668. /**
  28669. * Performs a
  28670. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28671. * comparison between two values to determine if they are equivalent.
  28672. *
  28673. * @static
  28674. * @memberOf _
  28675. * @since 4.0.0
  28676. * @category Lang
  28677. * @param {*} value The value to compare.
  28678. * @param {*} other The other value to compare.
  28679. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28680. * @example
  28681. *
  28682. * var object = { 'a': 1 };
  28683. * var other = { 'a': 1 };
  28684. *
  28685. * _.eq(object, object);
  28686. * // => true
  28687. *
  28688. * _.eq(object, other);
  28689. * // => false
  28690. *
  28691. * _.eq('a', 'a');
  28692. * // => true
  28693. *
  28694. * _.eq('a', Object('a'));
  28695. * // => false
  28696. *
  28697. * _.eq(NaN, NaN);
  28698. * // => true
  28699. */
  28700. function eq(value, other) {
  28701. return value === other || (value !== value && other !== other);
  28702. }
  28703. /**
  28704. * Checks if `value` is greater than `other`.
  28705. *
  28706. * @static
  28707. * @memberOf _
  28708. * @since 3.9.0
  28709. * @category Lang
  28710. * @param {*} value The value to compare.
  28711. * @param {*} other The other value to compare.
  28712. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28713. * else `false`.
  28714. * @see _.lt
  28715. * @example
  28716. *
  28717. * _.gt(3, 1);
  28718. * // => true
  28719. *
  28720. * _.gt(3, 3);
  28721. * // => false
  28722. *
  28723. * _.gt(1, 3);
  28724. * // => false
  28725. */
  28726. var gt = createRelationalOperation(baseGt);
  28727. /**
  28728. * Checks if `value` is greater than or equal to `other`.
  28729. *
  28730. * @static
  28731. * @memberOf _
  28732. * @since 3.9.0
  28733. * @category Lang
  28734. * @param {*} value The value to compare.
  28735. * @param {*} other The other value to compare.
  28736. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28737. * `other`, else `false`.
  28738. * @see _.lte
  28739. * @example
  28740. *
  28741. * _.gte(3, 1);
  28742. * // => true
  28743. *
  28744. * _.gte(3, 3);
  28745. * // => true
  28746. *
  28747. * _.gte(1, 3);
  28748. * // => false
  28749. */
  28750. var gte = createRelationalOperation(function(value, other) {
  28751. return value >= other;
  28752. });
  28753. /**
  28754. * Checks if `value` is likely an `arguments` object.
  28755. *
  28756. * @static
  28757. * @memberOf _
  28758. * @since 0.1.0
  28759. * @category Lang
  28760. * @param {*} value The value to check.
  28761. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28762. * else `false`.
  28763. * @example
  28764. *
  28765. * _.isArguments(function() { return arguments; }());
  28766. * // => true
  28767. *
  28768. * _.isArguments([1, 2, 3]);
  28769. * // => false
  28770. */
  28771. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28772. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28773. !propertyIsEnumerable.call(value, 'callee');
  28774. };
  28775. /**
  28776. * Checks if `value` is classified as an `Array` object.
  28777. *
  28778. * @static
  28779. * @memberOf _
  28780. * @since 0.1.0
  28781. * @category Lang
  28782. * @param {*} value The value to check.
  28783. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28784. * @example
  28785. *
  28786. * _.isArray([1, 2, 3]);
  28787. * // => true
  28788. *
  28789. * _.isArray(document.body.children);
  28790. * // => false
  28791. *
  28792. * _.isArray('abc');
  28793. * // => false
  28794. *
  28795. * _.isArray(_.noop);
  28796. * // => false
  28797. */
  28798. var isArray = Array.isArray;
  28799. /**
  28800. * Checks if `value` is classified as an `ArrayBuffer` object.
  28801. *
  28802. * @static
  28803. * @memberOf _
  28804. * @since 4.3.0
  28805. * @category Lang
  28806. * @param {*} value The value to check.
  28807. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28808. * @example
  28809. *
  28810. * _.isArrayBuffer(new ArrayBuffer(2));
  28811. * // => true
  28812. *
  28813. * _.isArrayBuffer(new Array(2));
  28814. * // => false
  28815. */
  28816. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28817. /**
  28818. * Checks if `value` is array-like. A value is considered array-like if it's
  28819. * not a function and has a `value.length` that's an integer greater than or
  28820. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28821. *
  28822. * @static
  28823. * @memberOf _
  28824. * @since 4.0.0
  28825. * @category Lang
  28826. * @param {*} value The value to check.
  28827. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28828. * @example
  28829. *
  28830. * _.isArrayLike([1, 2, 3]);
  28831. * // => true
  28832. *
  28833. * _.isArrayLike(document.body.children);
  28834. * // => true
  28835. *
  28836. * _.isArrayLike('abc');
  28837. * // => true
  28838. *
  28839. * _.isArrayLike(_.noop);
  28840. * // => false
  28841. */
  28842. function isArrayLike(value) {
  28843. return value != null && isLength(value.length) && !isFunction(value);
  28844. }
  28845. /**
  28846. * This method is like `_.isArrayLike` except that it also checks if `value`
  28847. * is an object.
  28848. *
  28849. * @static
  28850. * @memberOf _
  28851. * @since 4.0.0
  28852. * @category Lang
  28853. * @param {*} value The value to check.
  28854. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28855. * else `false`.
  28856. * @example
  28857. *
  28858. * _.isArrayLikeObject([1, 2, 3]);
  28859. * // => true
  28860. *
  28861. * _.isArrayLikeObject(document.body.children);
  28862. * // => true
  28863. *
  28864. * _.isArrayLikeObject('abc');
  28865. * // => false
  28866. *
  28867. * _.isArrayLikeObject(_.noop);
  28868. * // => false
  28869. */
  28870. function isArrayLikeObject(value) {
  28871. return isObjectLike(value) && isArrayLike(value);
  28872. }
  28873. /**
  28874. * Checks if `value` is classified as a boolean primitive or object.
  28875. *
  28876. * @static
  28877. * @memberOf _
  28878. * @since 0.1.0
  28879. * @category Lang
  28880. * @param {*} value The value to check.
  28881. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28882. * @example
  28883. *
  28884. * _.isBoolean(false);
  28885. * // => true
  28886. *
  28887. * _.isBoolean(null);
  28888. * // => false
  28889. */
  28890. function isBoolean(value) {
  28891. return value === true || value === false ||
  28892. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28893. }
  28894. /**
  28895. * Checks if `value` is a buffer.
  28896. *
  28897. * @static
  28898. * @memberOf _
  28899. * @since 4.3.0
  28900. * @category Lang
  28901. * @param {*} value The value to check.
  28902. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  28903. * @example
  28904. *
  28905. * _.isBuffer(new Buffer(2));
  28906. * // => true
  28907. *
  28908. * _.isBuffer(new Uint8Array(2));
  28909. * // => false
  28910. */
  28911. var isBuffer = nativeIsBuffer || stubFalse;
  28912. /**
  28913. * Checks if `value` is classified as a `Date` object.
  28914. *
  28915. * @static
  28916. * @memberOf _
  28917. * @since 0.1.0
  28918. * @category Lang
  28919. * @param {*} value The value to check.
  28920. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  28921. * @example
  28922. *
  28923. * _.isDate(new Date);
  28924. * // => true
  28925. *
  28926. * _.isDate('Mon April 23 2012');
  28927. * // => false
  28928. */
  28929. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  28930. /**
  28931. * Checks if `value` is likely a DOM element.
  28932. *
  28933. * @static
  28934. * @memberOf _
  28935. * @since 0.1.0
  28936. * @category Lang
  28937. * @param {*} value The value to check.
  28938. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  28939. * @example
  28940. *
  28941. * _.isElement(document.body);
  28942. * // => true
  28943. *
  28944. * _.isElement('<body>');
  28945. * // => false
  28946. */
  28947. function isElement(value) {
  28948. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  28949. }
  28950. /**
  28951. * Checks if `value` is an empty object, collection, map, or set.
  28952. *
  28953. * Objects are considered empty if they have no own enumerable string keyed
  28954. * properties.
  28955. *
  28956. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  28957. * jQuery-like collections are considered empty if they have a `length` of `0`.
  28958. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  28959. *
  28960. * @static
  28961. * @memberOf _
  28962. * @since 0.1.0
  28963. * @category Lang
  28964. * @param {*} value The value to check.
  28965. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  28966. * @example
  28967. *
  28968. * _.isEmpty(null);
  28969. * // => true
  28970. *
  28971. * _.isEmpty(true);
  28972. * // => true
  28973. *
  28974. * _.isEmpty(1);
  28975. * // => true
  28976. *
  28977. * _.isEmpty([1, 2, 3]);
  28978. * // => false
  28979. *
  28980. * _.isEmpty({ 'a': 1 });
  28981. * // => false
  28982. */
  28983. function isEmpty(value) {
  28984. if (value == null) {
  28985. return true;
  28986. }
  28987. if (isArrayLike(value) &&
  28988. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  28989. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  28990. return !value.length;
  28991. }
  28992. var tag = getTag(value);
  28993. if (tag == mapTag || tag == setTag) {
  28994. return !value.size;
  28995. }
  28996. if (isPrototype(value)) {
  28997. return !baseKeys(value).length;
  28998. }
  28999. for (var key in value) {
  29000. if (hasOwnProperty.call(value, key)) {
  29001. return false;
  29002. }
  29003. }
  29004. return true;
  29005. }
  29006. /**
  29007. * Performs a deep comparison between two values to determine if they are
  29008. * equivalent.
  29009. *
  29010. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29011. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29012. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29013. * by their own, not inherited, enumerable properties. Functions and DOM
  29014. * nodes are compared by strict equality, i.e. `===`.
  29015. *
  29016. * @static
  29017. * @memberOf _
  29018. * @since 0.1.0
  29019. * @category Lang
  29020. * @param {*} value The value to compare.
  29021. * @param {*} other The other value to compare.
  29022. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29023. * @example
  29024. *
  29025. * var object = { 'a': 1 };
  29026. * var other = { 'a': 1 };
  29027. *
  29028. * _.isEqual(object, other);
  29029. * // => true
  29030. *
  29031. * object === other;
  29032. * // => false
  29033. */
  29034. function isEqual(value, other) {
  29035. return baseIsEqual(value, other);
  29036. }
  29037. /**
  29038. * This method is like `_.isEqual` except that it accepts `customizer` which
  29039. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29040. * are handled by the method instead. The `customizer` is invoked with up to
  29041. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29042. *
  29043. * @static
  29044. * @memberOf _
  29045. * @since 4.0.0
  29046. * @category Lang
  29047. * @param {*} value The value to compare.
  29048. * @param {*} other The other value to compare.
  29049. * @param {Function} [customizer] The function to customize comparisons.
  29050. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29051. * @example
  29052. *
  29053. * function isGreeting(value) {
  29054. * return /^h(?:i|ello)$/.test(value);
  29055. * }
  29056. *
  29057. * function customizer(objValue, othValue) {
  29058. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29059. * return true;
  29060. * }
  29061. * }
  29062. *
  29063. * var array = ['hello', 'goodbye'];
  29064. * var other = ['hi', 'goodbye'];
  29065. *
  29066. * _.isEqualWith(array, other, customizer);
  29067. * // => true
  29068. */
  29069. function isEqualWith(value, other, customizer) {
  29070. customizer = typeof customizer == 'function' ? customizer : undefined;
  29071. var result = customizer ? customizer(value, other) : undefined;
  29072. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29073. }
  29074. /**
  29075. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29076. * `SyntaxError`, `TypeError`, or `URIError` object.
  29077. *
  29078. * @static
  29079. * @memberOf _
  29080. * @since 3.0.0
  29081. * @category Lang
  29082. * @param {*} value The value to check.
  29083. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29084. * @example
  29085. *
  29086. * _.isError(new Error);
  29087. * // => true
  29088. *
  29089. * _.isError(Error);
  29090. * // => false
  29091. */
  29092. function isError(value) {
  29093. if (!isObjectLike(value)) {
  29094. return false;
  29095. }
  29096. var tag = baseGetTag(value);
  29097. return tag == errorTag || tag == domExcTag ||
  29098. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29099. }
  29100. /**
  29101. * Checks if `value` is a finite primitive number.
  29102. *
  29103. * **Note:** This method is based on
  29104. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29105. *
  29106. * @static
  29107. * @memberOf _
  29108. * @since 0.1.0
  29109. * @category Lang
  29110. * @param {*} value The value to check.
  29111. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29112. * @example
  29113. *
  29114. * _.isFinite(3);
  29115. * // => true
  29116. *
  29117. * _.isFinite(Number.MIN_VALUE);
  29118. * // => true
  29119. *
  29120. * _.isFinite(Infinity);
  29121. * // => false
  29122. *
  29123. * _.isFinite('3');
  29124. * // => false
  29125. */
  29126. function isFinite(value) {
  29127. return typeof value == 'number' && nativeIsFinite(value);
  29128. }
  29129. /**
  29130. * Checks if `value` is classified as a `Function` object.
  29131. *
  29132. * @static
  29133. * @memberOf _
  29134. * @since 0.1.0
  29135. * @category Lang
  29136. * @param {*} value The value to check.
  29137. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29138. * @example
  29139. *
  29140. * _.isFunction(_);
  29141. * // => true
  29142. *
  29143. * _.isFunction(/abc/);
  29144. * // => false
  29145. */
  29146. function isFunction(value) {
  29147. if (!isObject(value)) {
  29148. return false;
  29149. }
  29150. // The use of `Object#toString` avoids issues with the `typeof` operator
  29151. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29152. var tag = baseGetTag(value);
  29153. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29154. }
  29155. /**
  29156. * Checks if `value` is an integer.
  29157. *
  29158. * **Note:** This method is based on
  29159. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29160. *
  29161. * @static
  29162. * @memberOf _
  29163. * @since 4.0.0
  29164. * @category Lang
  29165. * @param {*} value The value to check.
  29166. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29167. * @example
  29168. *
  29169. * _.isInteger(3);
  29170. * // => true
  29171. *
  29172. * _.isInteger(Number.MIN_VALUE);
  29173. * // => false
  29174. *
  29175. * _.isInteger(Infinity);
  29176. * // => false
  29177. *
  29178. * _.isInteger('3');
  29179. * // => false
  29180. */
  29181. function isInteger(value) {
  29182. return typeof value == 'number' && value == toInteger(value);
  29183. }
  29184. /**
  29185. * Checks if `value` is a valid array-like length.
  29186. *
  29187. * **Note:** This method is loosely based on
  29188. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29189. *
  29190. * @static
  29191. * @memberOf _
  29192. * @since 4.0.0
  29193. * @category Lang
  29194. * @param {*} value The value to check.
  29195. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29196. * @example
  29197. *
  29198. * _.isLength(3);
  29199. * // => true
  29200. *
  29201. * _.isLength(Number.MIN_VALUE);
  29202. * // => false
  29203. *
  29204. * _.isLength(Infinity);
  29205. * // => false
  29206. *
  29207. * _.isLength('3');
  29208. * // => false
  29209. */
  29210. function isLength(value) {
  29211. return typeof value == 'number' &&
  29212. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29213. }
  29214. /**
  29215. * Checks if `value` is the
  29216. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29217. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29218. *
  29219. * @static
  29220. * @memberOf _
  29221. * @since 0.1.0
  29222. * @category Lang
  29223. * @param {*} value The value to check.
  29224. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29225. * @example
  29226. *
  29227. * _.isObject({});
  29228. * // => true
  29229. *
  29230. * _.isObject([1, 2, 3]);
  29231. * // => true
  29232. *
  29233. * _.isObject(_.noop);
  29234. * // => true
  29235. *
  29236. * _.isObject(null);
  29237. * // => false
  29238. */
  29239. function isObject(value) {
  29240. var type = typeof value;
  29241. return value != null && (type == 'object' || type == 'function');
  29242. }
  29243. /**
  29244. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29245. * and has a `typeof` result of "object".
  29246. *
  29247. * @static
  29248. * @memberOf _
  29249. * @since 4.0.0
  29250. * @category Lang
  29251. * @param {*} value The value to check.
  29252. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29253. * @example
  29254. *
  29255. * _.isObjectLike({});
  29256. * // => true
  29257. *
  29258. * _.isObjectLike([1, 2, 3]);
  29259. * // => true
  29260. *
  29261. * _.isObjectLike(_.noop);
  29262. * // => false
  29263. *
  29264. * _.isObjectLike(null);
  29265. * // => false
  29266. */
  29267. function isObjectLike(value) {
  29268. return value != null && typeof value == 'object';
  29269. }
  29270. /**
  29271. * Checks if `value` is classified as a `Map` object.
  29272. *
  29273. * @static
  29274. * @memberOf _
  29275. * @since 4.3.0
  29276. * @category Lang
  29277. * @param {*} value The value to check.
  29278. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29279. * @example
  29280. *
  29281. * _.isMap(new Map);
  29282. * // => true
  29283. *
  29284. * _.isMap(new WeakMap);
  29285. * // => false
  29286. */
  29287. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29288. /**
  29289. * Performs a partial deep comparison between `object` and `source` to
  29290. * determine if `object` contains equivalent property values.
  29291. *
  29292. * **Note:** This method is equivalent to `_.matches` when `source` is
  29293. * partially applied.
  29294. *
  29295. * Partial comparisons will match empty array and empty object `source`
  29296. * values against any array or object value, respectively. See `_.isEqual`
  29297. * for a list of supported value comparisons.
  29298. *
  29299. * @static
  29300. * @memberOf _
  29301. * @since 3.0.0
  29302. * @category Lang
  29303. * @param {Object} object The object to inspect.
  29304. * @param {Object} source The object of property values to match.
  29305. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29306. * @example
  29307. *
  29308. * var object = { 'a': 1, 'b': 2 };
  29309. *
  29310. * _.isMatch(object, { 'b': 2 });
  29311. * // => true
  29312. *
  29313. * _.isMatch(object, { 'b': 1 });
  29314. * // => false
  29315. */
  29316. function isMatch(object, source) {
  29317. return object === source || baseIsMatch(object, source, getMatchData(source));
  29318. }
  29319. /**
  29320. * This method is like `_.isMatch` except that it accepts `customizer` which
  29321. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29322. * are handled by the method instead. The `customizer` is invoked with five
  29323. * arguments: (objValue, srcValue, index|key, object, source).
  29324. *
  29325. * @static
  29326. * @memberOf _
  29327. * @since 4.0.0
  29328. * @category Lang
  29329. * @param {Object} object The object to inspect.
  29330. * @param {Object} source The object of property values to match.
  29331. * @param {Function} [customizer] The function to customize comparisons.
  29332. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29333. * @example
  29334. *
  29335. * function isGreeting(value) {
  29336. * return /^h(?:i|ello)$/.test(value);
  29337. * }
  29338. *
  29339. * function customizer(objValue, srcValue) {
  29340. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29341. * return true;
  29342. * }
  29343. * }
  29344. *
  29345. * var object = { 'greeting': 'hello' };
  29346. * var source = { 'greeting': 'hi' };
  29347. *
  29348. * _.isMatchWith(object, source, customizer);
  29349. * // => true
  29350. */
  29351. function isMatchWith(object, source, customizer) {
  29352. customizer = typeof customizer == 'function' ? customizer : undefined;
  29353. return baseIsMatch(object, source, getMatchData(source), customizer);
  29354. }
  29355. /**
  29356. * Checks if `value` is `NaN`.
  29357. *
  29358. * **Note:** This method is based on
  29359. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29360. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29361. * `undefined` and other non-number values.
  29362. *
  29363. * @static
  29364. * @memberOf _
  29365. * @since 0.1.0
  29366. * @category Lang
  29367. * @param {*} value The value to check.
  29368. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29369. * @example
  29370. *
  29371. * _.isNaN(NaN);
  29372. * // => true
  29373. *
  29374. * _.isNaN(new Number(NaN));
  29375. * // => true
  29376. *
  29377. * isNaN(undefined);
  29378. * // => true
  29379. *
  29380. * _.isNaN(undefined);
  29381. * // => false
  29382. */
  29383. function isNaN(value) {
  29384. // An `NaN` primitive is the only value that is not equal to itself.
  29385. // Perform the `toStringTag` check first to avoid errors with some
  29386. // ActiveX objects in IE.
  29387. return isNumber(value) && value != +value;
  29388. }
  29389. /**
  29390. * Checks if `value` is a pristine native function.
  29391. *
  29392. * **Note:** This method can't reliably detect native functions in the presence
  29393. * of the core-js package because core-js circumvents this kind of detection.
  29394. * Despite multiple requests, the core-js maintainer has made it clear: any
  29395. * attempt to fix the detection will be obstructed. As a result, we're left
  29396. * with little choice but to throw an error. Unfortunately, this also affects
  29397. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29398. * which rely on core-js.
  29399. *
  29400. * @static
  29401. * @memberOf _
  29402. * @since 3.0.0
  29403. * @category Lang
  29404. * @param {*} value The value to check.
  29405. * @returns {boolean} Returns `true` if `value` is a native function,
  29406. * else `false`.
  29407. * @example
  29408. *
  29409. * _.isNative(Array.prototype.push);
  29410. * // => true
  29411. *
  29412. * _.isNative(_);
  29413. * // => false
  29414. */
  29415. function isNative(value) {
  29416. if (isMaskable(value)) {
  29417. throw new Error(CORE_ERROR_TEXT);
  29418. }
  29419. return baseIsNative(value);
  29420. }
  29421. /**
  29422. * Checks if `value` is `null`.
  29423. *
  29424. * @static
  29425. * @memberOf _
  29426. * @since 0.1.0
  29427. * @category Lang
  29428. * @param {*} value The value to check.
  29429. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29430. * @example
  29431. *
  29432. * _.isNull(null);
  29433. * // => true
  29434. *
  29435. * _.isNull(void 0);
  29436. * // => false
  29437. */
  29438. function isNull(value) {
  29439. return value === null;
  29440. }
  29441. /**
  29442. * Checks if `value` is `null` or `undefined`.
  29443. *
  29444. * @static
  29445. * @memberOf _
  29446. * @since 4.0.0
  29447. * @category Lang
  29448. * @param {*} value The value to check.
  29449. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29450. * @example
  29451. *
  29452. * _.isNil(null);
  29453. * // => true
  29454. *
  29455. * _.isNil(void 0);
  29456. * // => true
  29457. *
  29458. * _.isNil(NaN);
  29459. * // => false
  29460. */
  29461. function isNil(value) {
  29462. return value == null;
  29463. }
  29464. /**
  29465. * Checks if `value` is classified as a `Number` primitive or object.
  29466. *
  29467. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29468. * classified as numbers, use the `_.isFinite` method.
  29469. *
  29470. * @static
  29471. * @memberOf _
  29472. * @since 0.1.0
  29473. * @category Lang
  29474. * @param {*} value The value to check.
  29475. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29476. * @example
  29477. *
  29478. * _.isNumber(3);
  29479. * // => true
  29480. *
  29481. * _.isNumber(Number.MIN_VALUE);
  29482. * // => true
  29483. *
  29484. * _.isNumber(Infinity);
  29485. * // => true
  29486. *
  29487. * _.isNumber('3');
  29488. * // => false
  29489. */
  29490. function isNumber(value) {
  29491. return typeof value == 'number' ||
  29492. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29493. }
  29494. /**
  29495. * Checks if `value` is a plain object, that is, an object created by the
  29496. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29497. *
  29498. * @static
  29499. * @memberOf _
  29500. * @since 0.8.0
  29501. * @category Lang
  29502. * @param {*} value The value to check.
  29503. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29504. * @example
  29505. *
  29506. * function Foo() {
  29507. * this.a = 1;
  29508. * }
  29509. *
  29510. * _.isPlainObject(new Foo);
  29511. * // => false
  29512. *
  29513. * _.isPlainObject([1, 2, 3]);
  29514. * // => false
  29515. *
  29516. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29517. * // => true
  29518. *
  29519. * _.isPlainObject(Object.create(null));
  29520. * // => true
  29521. */
  29522. function isPlainObject(value) {
  29523. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29524. return false;
  29525. }
  29526. var proto = getPrototype(value);
  29527. if (proto === null) {
  29528. return true;
  29529. }
  29530. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29531. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29532. funcToString.call(Ctor) == objectCtorString;
  29533. }
  29534. /**
  29535. * Checks if `value` is classified as a `RegExp` object.
  29536. *
  29537. * @static
  29538. * @memberOf _
  29539. * @since 0.1.0
  29540. * @category Lang
  29541. * @param {*} value The value to check.
  29542. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29543. * @example
  29544. *
  29545. * _.isRegExp(/abc/);
  29546. * // => true
  29547. *
  29548. * _.isRegExp('/abc/');
  29549. * // => false
  29550. */
  29551. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29552. /**
  29553. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29554. * double precision number which isn't the result of a rounded unsafe integer.
  29555. *
  29556. * **Note:** This method is based on
  29557. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29558. *
  29559. * @static
  29560. * @memberOf _
  29561. * @since 4.0.0
  29562. * @category Lang
  29563. * @param {*} value The value to check.
  29564. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29565. * @example
  29566. *
  29567. * _.isSafeInteger(3);
  29568. * // => true
  29569. *
  29570. * _.isSafeInteger(Number.MIN_VALUE);
  29571. * // => false
  29572. *
  29573. * _.isSafeInteger(Infinity);
  29574. * // => false
  29575. *
  29576. * _.isSafeInteger('3');
  29577. * // => false
  29578. */
  29579. function isSafeInteger(value) {
  29580. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29581. }
  29582. /**
  29583. * Checks if `value` is classified as a `Set` object.
  29584. *
  29585. * @static
  29586. * @memberOf _
  29587. * @since 4.3.0
  29588. * @category Lang
  29589. * @param {*} value The value to check.
  29590. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29591. * @example
  29592. *
  29593. * _.isSet(new Set);
  29594. * // => true
  29595. *
  29596. * _.isSet(new WeakSet);
  29597. * // => false
  29598. */
  29599. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29600. /**
  29601. * Checks if `value` is classified as a `String` primitive or object.
  29602. *
  29603. * @static
  29604. * @since 0.1.0
  29605. * @memberOf _
  29606. * @category Lang
  29607. * @param {*} value The value to check.
  29608. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29609. * @example
  29610. *
  29611. * _.isString('abc');
  29612. * // => true
  29613. *
  29614. * _.isString(1);
  29615. * // => false
  29616. */
  29617. function isString(value) {
  29618. return typeof value == 'string' ||
  29619. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29620. }
  29621. /**
  29622. * Checks if `value` is classified as a `Symbol` primitive or object.
  29623. *
  29624. * @static
  29625. * @memberOf _
  29626. * @since 4.0.0
  29627. * @category Lang
  29628. * @param {*} value The value to check.
  29629. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29630. * @example
  29631. *
  29632. * _.isSymbol(Symbol.iterator);
  29633. * // => true
  29634. *
  29635. * _.isSymbol('abc');
  29636. * // => false
  29637. */
  29638. function isSymbol(value) {
  29639. return typeof value == 'symbol' ||
  29640. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29641. }
  29642. /**
  29643. * Checks if `value` is classified as a typed array.
  29644. *
  29645. * @static
  29646. * @memberOf _
  29647. * @since 3.0.0
  29648. * @category Lang
  29649. * @param {*} value The value to check.
  29650. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29651. * @example
  29652. *
  29653. * _.isTypedArray(new Uint8Array);
  29654. * // => true
  29655. *
  29656. * _.isTypedArray([]);
  29657. * // => false
  29658. */
  29659. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29660. /**
  29661. * Checks if `value` is `undefined`.
  29662. *
  29663. * @static
  29664. * @since 0.1.0
  29665. * @memberOf _
  29666. * @category Lang
  29667. * @param {*} value The value to check.
  29668. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29669. * @example
  29670. *
  29671. * _.isUndefined(void 0);
  29672. * // => true
  29673. *
  29674. * _.isUndefined(null);
  29675. * // => false
  29676. */
  29677. function isUndefined(value) {
  29678. return value === undefined;
  29679. }
  29680. /**
  29681. * Checks if `value` is classified as a `WeakMap` object.
  29682. *
  29683. * @static
  29684. * @memberOf _
  29685. * @since 4.3.0
  29686. * @category Lang
  29687. * @param {*} value The value to check.
  29688. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29689. * @example
  29690. *
  29691. * _.isWeakMap(new WeakMap);
  29692. * // => true
  29693. *
  29694. * _.isWeakMap(new Map);
  29695. * // => false
  29696. */
  29697. function isWeakMap(value) {
  29698. return isObjectLike(value) && getTag(value) == weakMapTag;
  29699. }
  29700. /**
  29701. * Checks if `value` is classified as a `WeakSet` object.
  29702. *
  29703. * @static
  29704. * @memberOf _
  29705. * @since 4.3.0
  29706. * @category Lang
  29707. * @param {*} value The value to check.
  29708. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29709. * @example
  29710. *
  29711. * _.isWeakSet(new WeakSet);
  29712. * // => true
  29713. *
  29714. * _.isWeakSet(new Set);
  29715. * // => false
  29716. */
  29717. function isWeakSet(value) {
  29718. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29719. }
  29720. /**
  29721. * Checks if `value` is less than `other`.
  29722. *
  29723. * @static
  29724. * @memberOf _
  29725. * @since 3.9.0
  29726. * @category Lang
  29727. * @param {*} value The value to compare.
  29728. * @param {*} other The other value to compare.
  29729. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29730. * else `false`.
  29731. * @see _.gt
  29732. * @example
  29733. *
  29734. * _.lt(1, 3);
  29735. * // => true
  29736. *
  29737. * _.lt(3, 3);
  29738. * // => false
  29739. *
  29740. * _.lt(3, 1);
  29741. * // => false
  29742. */
  29743. var lt = createRelationalOperation(baseLt);
  29744. /**
  29745. * Checks if `value` is less than or equal to `other`.
  29746. *
  29747. * @static
  29748. * @memberOf _
  29749. * @since 3.9.0
  29750. * @category Lang
  29751. * @param {*} value The value to compare.
  29752. * @param {*} other The other value to compare.
  29753. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29754. * `other`, else `false`.
  29755. * @see _.gte
  29756. * @example
  29757. *
  29758. * _.lte(1, 3);
  29759. * // => true
  29760. *
  29761. * _.lte(3, 3);
  29762. * // => true
  29763. *
  29764. * _.lte(3, 1);
  29765. * // => false
  29766. */
  29767. var lte = createRelationalOperation(function(value, other) {
  29768. return value <= other;
  29769. });
  29770. /**
  29771. * Converts `value` to an array.
  29772. *
  29773. * @static
  29774. * @since 0.1.0
  29775. * @memberOf _
  29776. * @category Lang
  29777. * @param {*} value The value to convert.
  29778. * @returns {Array} Returns the converted array.
  29779. * @example
  29780. *
  29781. * _.toArray({ 'a': 1, 'b': 2 });
  29782. * // => [1, 2]
  29783. *
  29784. * _.toArray('abc');
  29785. * // => ['a', 'b', 'c']
  29786. *
  29787. * _.toArray(1);
  29788. * // => []
  29789. *
  29790. * _.toArray(null);
  29791. * // => []
  29792. */
  29793. function toArray(value) {
  29794. if (!value) {
  29795. return [];
  29796. }
  29797. if (isArrayLike(value)) {
  29798. return isString(value) ? stringToArray(value) : copyArray(value);
  29799. }
  29800. if (symIterator && value[symIterator]) {
  29801. return iteratorToArray(value[symIterator]());
  29802. }
  29803. var tag = getTag(value),
  29804. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29805. return func(value);
  29806. }
  29807. /**
  29808. * Converts `value` to a finite number.
  29809. *
  29810. * @static
  29811. * @memberOf _
  29812. * @since 4.12.0
  29813. * @category Lang
  29814. * @param {*} value The value to convert.
  29815. * @returns {number} Returns the converted number.
  29816. * @example
  29817. *
  29818. * _.toFinite(3.2);
  29819. * // => 3.2
  29820. *
  29821. * _.toFinite(Number.MIN_VALUE);
  29822. * // => 5e-324
  29823. *
  29824. * _.toFinite(Infinity);
  29825. * // => 1.7976931348623157e+308
  29826. *
  29827. * _.toFinite('3.2');
  29828. * // => 3.2
  29829. */
  29830. function toFinite(value) {
  29831. if (!value) {
  29832. return value === 0 ? value : 0;
  29833. }
  29834. value = toNumber(value);
  29835. if (value === INFINITY || value === -INFINITY) {
  29836. var sign = (value < 0 ? -1 : 1);
  29837. return sign * MAX_INTEGER;
  29838. }
  29839. return value === value ? value : 0;
  29840. }
  29841. /**
  29842. * Converts `value` to an integer.
  29843. *
  29844. * **Note:** This method is loosely based on
  29845. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29846. *
  29847. * @static
  29848. * @memberOf _
  29849. * @since 4.0.0
  29850. * @category Lang
  29851. * @param {*} value The value to convert.
  29852. * @returns {number} Returns the converted integer.
  29853. * @example
  29854. *
  29855. * _.toInteger(3.2);
  29856. * // => 3
  29857. *
  29858. * _.toInteger(Number.MIN_VALUE);
  29859. * // => 0
  29860. *
  29861. * _.toInteger(Infinity);
  29862. * // => 1.7976931348623157e+308
  29863. *
  29864. * _.toInteger('3.2');
  29865. * // => 3
  29866. */
  29867. function toInteger(value) {
  29868. var result = toFinite(value),
  29869. remainder = result % 1;
  29870. return result === result ? (remainder ? result - remainder : result) : 0;
  29871. }
  29872. /**
  29873. * Converts `value` to an integer suitable for use as the length of an
  29874. * array-like object.
  29875. *
  29876. * **Note:** This method is based on
  29877. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29878. *
  29879. * @static
  29880. * @memberOf _
  29881. * @since 4.0.0
  29882. * @category Lang
  29883. * @param {*} value The value to convert.
  29884. * @returns {number} Returns the converted integer.
  29885. * @example
  29886. *
  29887. * _.toLength(3.2);
  29888. * // => 3
  29889. *
  29890. * _.toLength(Number.MIN_VALUE);
  29891. * // => 0
  29892. *
  29893. * _.toLength(Infinity);
  29894. * // => 4294967295
  29895. *
  29896. * _.toLength('3.2');
  29897. * // => 3
  29898. */
  29899. function toLength(value) {
  29900. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29901. }
  29902. /**
  29903. * Converts `value` to a number.
  29904. *
  29905. * @static
  29906. * @memberOf _
  29907. * @since 4.0.0
  29908. * @category Lang
  29909. * @param {*} value The value to process.
  29910. * @returns {number} Returns the number.
  29911. * @example
  29912. *
  29913. * _.toNumber(3.2);
  29914. * // => 3.2
  29915. *
  29916. * _.toNumber(Number.MIN_VALUE);
  29917. * // => 5e-324
  29918. *
  29919. * _.toNumber(Infinity);
  29920. * // => Infinity
  29921. *
  29922. * _.toNumber('3.2');
  29923. * // => 3.2
  29924. */
  29925. function toNumber(value) {
  29926. if (typeof value == 'number') {
  29927. return value;
  29928. }
  29929. if (isSymbol(value)) {
  29930. return NAN;
  29931. }
  29932. if (isObject(value)) {
  29933. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  29934. value = isObject(other) ? (other + '') : other;
  29935. }
  29936. if (typeof value != 'string') {
  29937. return value === 0 ? value : +value;
  29938. }
  29939. value = value.replace(reTrim, '');
  29940. var isBinary = reIsBinary.test(value);
  29941. return (isBinary || reIsOctal.test(value))
  29942. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  29943. : (reIsBadHex.test(value) ? NAN : +value);
  29944. }
  29945. /**
  29946. * Converts `value` to a plain object flattening inherited enumerable string
  29947. * keyed properties of `value` to own properties of the plain object.
  29948. *
  29949. * @static
  29950. * @memberOf _
  29951. * @since 3.0.0
  29952. * @category Lang
  29953. * @param {*} value The value to convert.
  29954. * @returns {Object} Returns the converted plain object.
  29955. * @example
  29956. *
  29957. * function Foo() {
  29958. * this.b = 2;
  29959. * }
  29960. *
  29961. * Foo.prototype.c = 3;
  29962. *
  29963. * _.assign({ 'a': 1 }, new Foo);
  29964. * // => { 'a': 1, 'b': 2 }
  29965. *
  29966. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  29967. * // => { 'a': 1, 'b': 2, 'c': 3 }
  29968. */
  29969. function toPlainObject(value) {
  29970. return copyObject(value, keysIn(value));
  29971. }
  29972. /**
  29973. * Converts `value` to a safe integer. A safe integer can be compared and
  29974. * represented correctly.
  29975. *
  29976. * @static
  29977. * @memberOf _
  29978. * @since 4.0.0
  29979. * @category Lang
  29980. * @param {*} value The value to convert.
  29981. * @returns {number} Returns the converted integer.
  29982. * @example
  29983. *
  29984. * _.toSafeInteger(3.2);
  29985. * // => 3
  29986. *
  29987. * _.toSafeInteger(Number.MIN_VALUE);
  29988. * // => 0
  29989. *
  29990. * _.toSafeInteger(Infinity);
  29991. * // => 9007199254740991
  29992. *
  29993. * _.toSafeInteger('3.2');
  29994. * // => 3
  29995. */
  29996. function toSafeInteger(value) {
  29997. return value
  29998. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  29999. : (value === 0 ? value : 0);
  30000. }
  30001. /**
  30002. * Converts `value` to a string. An empty string is returned for `null`
  30003. * and `undefined` values. The sign of `-0` is preserved.
  30004. *
  30005. * @static
  30006. * @memberOf _
  30007. * @since 4.0.0
  30008. * @category Lang
  30009. * @param {*} value The value to convert.
  30010. * @returns {string} Returns the converted string.
  30011. * @example
  30012. *
  30013. * _.toString(null);
  30014. * // => ''
  30015. *
  30016. * _.toString(-0);
  30017. * // => '-0'
  30018. *
  30019. * _.toString([1, 2, 3]);
  30020. * // => '1,2,3'
  30021. */
  30022. function toString(value) {
  30023. return value == null ? '' : baseToString(value);
  30024. }
  30025. /*------------------------------------------------------------------------*/
  30026. /**
  30027. * Assigns own enumerable string keyed properties of source objects to the
  30028. * destination object. Source objects are applied from left to right.
  30029. * Subsequent sources overwrite property assignments of previous sources.
  30030. *
  30031. * **Note:** This method mutates `object` and is loosely based on
  30032. * [`Object.assign`](https://mdn.io/Object/assign).
  30033. *
  30034. * @static
  30035. * @memberOf _
  30036. * @since 0.10.0
  30037. * @category Object
  30038. * @param {Object} object The destination object.
  30039. * @param {...Object} [sources] The source objects.
  30040. * @returns {Object} Returns `object`.
  30041. * @see _.assignIn
  30042. * @example
  30043. *
  30044. * function Foo() {
  30045. * this.a = 1;
  30046. * }
  30047. *
  30048. * function Bar() {
  30049. * this.c = 3;
  30050. * }
  30051. *
  30052. * Foo.prototype.b = 2;
  30053. * Bar.prototype.d = 4;
  30054. *
  30055. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30056. * // => { 'a': 1, 'c': 3 }
  30057. */
  30058. var assign = createAssigner(function(object, source) {
  30059. if (isPrototype(source) || isArrayLike(source)) {
  30060. copyObject(source, keys(source), object);
  30061. return;
  30062. }
  30063. for (var key in source) {
  30064. if (hasOwnProperty.call(source, key)) {
  30065. assignValue(object, key, source[key]);
  30066. }
  30067. }
  30068. });
  30069. /**
  30070. * This method is like `_.assign` except that it iterates over own and
  30071. * inherited source properties.
  30072. *
  30073. * **Note:** This method mutates `object`.
  30074. *
  30075. * @static
  30076. * @memberOf _
  30077. * @since 4.0.0
  30078. * @alias extend
  30079. * @category Object
  30080. * @param {Object} object The destination object.
  30081. * @param {...Object} [sources] The source objects.
  30082. * @returns {Object} Returns `object`.
  30083. * @see _.assign
  30084. * @example
  30085. *
  30086. * function Foo() {
  30087. * this.a = 1;
  30088. * }
  30089. *
  30090. * function Bar() {
  30091. * this.c = 3;
  30092. * }
  30093. *
  30094. * Foo.prototype.b = 2;
  30095. * Bar.prototype.d = 4;
  30096. *
  30097. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30098. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30099. */
  30100. var assignIn = createAssigner(function(object, source) {
  30101. copyObject(source, keysIn(source), object);
  30102. });
  30103. /**
  30104. * This method is like `_.assignIn` except that it accepts `customizer`
  30105. * which is invoked to produce the assigned values. If `customizer` returns
  30106. * `undefined`, assignment is handled by the method instead. The `customizer`
  30107. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30108. *
  30109. * **Note:** This method mutates `object`.
  30110. *
  30111. * @static
  30112. * @memberOf _
  30113. * @since 4.0.0
  30114. * @alias extendWith
  30115. * @category Object
  30116. * @param {Object} object The destination object.
  30117. * @param {...Object} sources The source objects.
  30118. * @param {Function} [customizer] The function to customize assigned values.
  30119. * @returns {Object} Returns `object`.
  30120. * @see _.assignWith
  30121. * @example
  30122. *
  30123. * function customizer(objValue, srcValue) {
  30124. * return _.isUndefined(objValue) ? srcValue : objValue;
  30125. * }
  30126. *
  30127. * var defaults = _.partialRight(_.assignInWith, customizer);
  30128. *
  30129. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30130. * // => { 'a': 1, 'b': 2 }
  30131. */
  30132. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30133. copyObject(source, keysIn(source), object, customizer);
  30134. });
  30135. /**
  30136. * This method is like `_.assign` except that it accepts `customizer`
  30137. * which is invoked to produce the assigned values. If `customizer` returns
  30138. * `undefined`, assignment is handled by the method instead. The `customizer`
  30139. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30140. *
  30141. * **Note:** This method mutates `object`.
  30142. *
  30143. * @static
  30144. * @memberOf _
  30145. * @since 4.0.0
  30146. * @category Object
  30147. * @param {Object} object The destination object.
  30148. * @param {...Object} sources The source objects.
  30149. * @param {Function} [customizer] The function to customize assigned values.
  30150. * @returns {Object} Returns `object`.
  30151. * @see _.assignInWith
  30152. * @example
  30153. *
  30154. * function customizer(objValue, srcValue) {
  30155. * return _.isUndefined(objValue) ? srcValue : objValue;
  30156. * }
  30157. *
  30158. * var defaults = _.partialRight(_.assignWith, customizer);
  30159. *
  30160. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30161. * // => { 'a': 1, 'b': 2 }
  30162. */
  30163. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30164. copyObject(source, keys(source), object, customizer);
  30165. });
  30166. /**
  30167. * Creates an array of values corresponding to `paths` of `object`.
  30168. *
  30169. * @static
  30170. * @memberOf _
  30171. * @since 1.0.0
  30172. * @category Object
  30173. * @param {Object} object The object to iterate over.
  30174. * @param {...(string|string[])} [paths] The property paths to pick.
  30175. * @returns {Array} Returns the picked values.
  30176. * @example
  30177. *
  30178. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30179. *
  30180. * _.at(object, ['a[0].b.c', 'a[1]']);
  30181. * // => [3, 4]
  30182. */
  30183. var at = flatRest(baseAt);
  30184. /**
  30185. * Creates an object that inherits from the `prototype` object. If a
  30186. * `properties` object is given, its own enumerable string keyed properties
  30187. * are assigned to the created object.
  30188. *
  30189. * @static
  30190. * @memberOf _
  30191. * @since 2.3.0
  30192. * @category Object
  30193. * @param {Object} prototype The object to inherit from.
  30194. * @param {Object} [properties] The properties to assign to the object.
  30195. * @returns {Object} Returns the new object.
  30196. * @example
  30197. *
  30198. * function Shape() {
  30199. * this.x = 0;
  30200. * this.y = 0;
  30201. * }
  30202. *
  30203. * function Circle() {
  30204. * Shape.call(this);
  30205. * }
  30206. *
  30207. * Circle.prototype = _.create(Shape.prototype, {
  30208. * 'constructor': Circle
  30209. * });
  30210. *
  30211. * var circle = new Circle;
  30212. * circle instanceof Circle;
  30213. * // => true
  30214. *
  30215. * circle instanceof Shape;
  30216. * // => true
  30217. */
  30218. function create(prototype, properties) {
  30219. var result = baseCreate(prototype);
  30220. return properties == null ? result : baseAssign(result, properties);
  30221. }
  30222. /**
  30223. * Assigns own and inherited enumerable string keyed properties of source
  30224. * objects to the destination object for all destination properties that
  30225. * resolve to `undefined`. Source objects are applied from left to right.
  30226. * Once a property is set, additional values of the same property are ignored.
  30227. *
  30228. * **Note:** This method mutates `object`.
  30229. *
  30230. * @static
  30231. * @since 0.1.0
  30232. * @memberOf _
  30233. * @category Object
  30234. * @param {Object} object The destination object.
  30235. * @param {...Object} [sources] The source objects.
  30236. * @returns {Object} Returns `object`.
  30237. * @see _.defaultsDeep
  30238. * @example
  30239. *
  30240. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30241. * // => { 'a': 1, 'b': 2 }
  30242. */
  30243. var defaults = baseRest(function(object, sources) {
  30244. object = Object(object);
  30245. var index = -1;
  30246. var length = sources.length;
  30247. var guard = length > 2 ? sources[2] : undefined;
  30248. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30249. length = 1;
  30250. }
  30251. while (++index < length) {
  30252. var source = sources[index];
  30253. var props = keysIn(source);
  30254. var propsIndex = -1;
  30255. var propsLength = props.length;
  30256. while (++propsIndex < propsLength) {
  30257. var key = props[propsIndex];
  30258. var value = object[key];
  30259. if (value === undefined ||
  30260. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30261. object[key] = source[key];
  30262. }
  30263. }
  30264. }
  30265. return object;
  30266. });
  30267. /**
  30268. * This method is like `_.defaults` except that it recursively assigns
  30269. * default properties.
  30270. *
  30271. * **Note:** This method mutates `object`.
  30272. *
  30273. * @static
  30274. * @memberOf _
  30275. * @since 3.10.0
  30276. * @category Object
  30277. * @param {Object} object The destination object.
  30278. * @param {...Object} [sources] The source objects.
  30279. * @returns {Object} Returns `object`.
  30280. * @see _.defaults
  30281. * @example
  30282. *
  30283. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30284. * // => { 'a': { 'b': 2, 'c': 3 } }
  30285. */
  30286. var defaultsDeep = baseRest(function(args) {
  30287. args.push(undefined, customDefaultsMerge);
  30288. return apply(mergeWith, undefined, args);
  30289. });
  30290. /**
  30291. * This method is like `_.find` except that it returns the key of the first
  30292. * element `predicate` returns truthy for instead of the element itself.
  30293. *
  30294. * @static
  30295. * @memberOf _
  30296. * @since 1.1.0
  30297. * @category Object
  30298. * @param {Object} object The object to inspect.
  30299. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30300. * @returns {string|undefined} Returns the key of the matched element,
  30301. * else `undefined`.
  30302. * @example
  30303. *
  30304. * var users = {
  30305. * 'barney': { 'age': 36, 'active': true },
  30306. * 'fred': { 'age': 40, 'active': false },
  30307. * 'pebbles': { 'age': 1, 'active': true }
  30308. * };
  30309. *
  30310. * _.findKey(users, function(o) { return o.age < 40; });
  30311. * // => 'barney' (iteration order is not guaranteed)
  30312. *
  30313. * // The `_.matches` iteratee shorthand.
  30314. * _.findKey(users, { 'age': 1, 'active': true });
  30315. * // => 'pebbles'
  30316. *
  30317. * // The `_.matchesProperty` iteratee shorthand.
  30318. * _.findKey(users, ['active', false]);
  30319. * // => 'fred'
  30320. *
  30321. * // The `_.property` iteratee shorthand.
  30322. * _.findKey(users, 'active');
  30323. * // => 'barney'
  30324. */
  30325. function findKey(object, predicate) {
  30326. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30327. }
  30328. /**
  30329. * This method is like `_.findKey` except that it iterates over elements of
  30330. * a collection in the opposite order.
  30331. *
  30332. * @static
  30333. * @memberOf _
  30334. * @since 2.0.0
  30335. * @category Object
  30336. * @param {Object} object The object to inspect.
  30337. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30338. * @returns {string|undefined} Returns the key of the matched element,
  30339. * else `undefined`.
  30340. * @example
  30341. *
  30342. * var users = {
  30343. * 'barney': { 'age': 36, 'active': true },
  30344. * 'fred': { 'age': 40, 'active': false },
  30345. * 'pebbles': { 'age': 1, 'active': true }
  30346. * };
  30347. *
  30348. * _.findLastKey(users, function(o) { return o.age < 40; });
  30349. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30350. *
  30351. * // The `_.matches` iteratee shorthand.
  30352. * _.findLastKey(users, { 'age': 36, 'active': true });
  30353. * // => 'barney'
  30354. *
  30355. * // The `_.matchesProperty` iteratee shorthand.
  30356. * _.findLastKey(users, ['active', false]);
  30357. * // => 'fred'
  30358. *
  30359. * // The `_.property` iteratee shorthand.
  30360. * _.findLastKey(users, 'active');
  30361. * // => 'pebbles'
  30362. */
  30363. function findLastKey(object, predicate) {
  30364. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30365. }
  30366. /**
  30367. * Iterates over own and inherited enumerable string keyed properties of an
  30368. * object and invokes `iteratee` for each property. The iteratee is invoked
  30369. * with three arguments: (value, key, object). Iteratee functions may exit
  30370. * iteration early by explicitly returning `false`.
  30371. *
  30372. * @static
  30373. * @memberOf _
  30374. * @since 0.3.0
  30375. * @category Object
  30376. * @param {Object} object The object to iterate over.
  30377. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30378. * @returns {Object} Returns `object`.
  30379. * @see _.forInRight
  30380. * @example
  30381. *
  30382. * function Foo() {
  30383. * this.a = 1;
  30384. * this.b = 2;
  30385. * }
  30386. *
  30387. * Foo.prototype.c = 3;
  30388. *
  30389. * _.forIn(new Foo, function(value, key) {
  30390. * console.log(key);
  30391. * });
  30392. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30393. */
  30394. function forIn(object, iteratee) {
  30395. return object == null
  30396. ? object
  30397. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30398. }
  30399. /**
  30400. * This method is like `_.forIn` except that it iterates over properties of
  30401. * `object` in the opposite order.
  30402. *
  30403. * @static
  30404. * @memberOf _
  30405. * @since 2.0.0
  30406. * @category Object
  30407. * @param {Object} object The object to iterate over.
  30408. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30409. * @returns {Object} Returns `object`.
  30410. * @see _.forIn
  30411. * @example
  30412. *
  30413. * function Foo() {
  30414. * this.a = 1;
  30415. * this.b = 2;
  30416. * }
  30417. *
  30418. * Foo.prototype.c = 3;
  30419. *
  30420. * _.forInRight(new Foo, function(value, key) {
  30421. * console.log(key);
  30422. * });
  30423. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30424. */
  30425. function forInRight(object, iteratee) {
  30426. return object == null
  30427. ? object
  30428. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30429. }
  30430. /**
  30431. * Iterates over own enumerable string keyed properties of an object and
  30432. * invokes `iteratee` for each property. The iteratee is invoked with three
  30433. * arguments: (value, key, object). Iteratee functions may exit iteration
  30434. * early by explicitly returning `false`.
  30435. *
  30436. * @static
  30437. * @memberOf _
  30438. * @since 0.3.0
  30439. * @category Object
  30440. * @param {Object} object The object to iterate over.
  30441. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30442. * @returns {Object} Returns `object`.
  30443. * @see _.forOwnRight
  30444. * @example
  30445. *
  30446. * function Foo() {
  30447. * this.a = 1;
  30448. * this.b = 2;
  30449. * }
  30450. *
  30451. * Foo.prototype.c = 3;
  30452. *
  30453. * _.forOwn(new Foo, function(value, key) {
  30454. * console.log(key);
  30455. * });
  30456. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30457. */
  30458. function forOwn(object, iteratee) {
  30459. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30460. }
  30461. /**
  30462. * This method is like `_.forOwn` except that it iterates over properties of
  30463. * `object` in the opposite order.
  30464. *
  30465. * @static
  30466. * @memberOf _
  30467. * @since 2.0.0
  30468. * @category Object
  30469. * @param {Object} object The object to iterate over.
  30470. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30471. * @returns {Object} Returns `object`.
  30472. * @see _.forOwn
  30473. * @example
  30474. *
  30475. * function Foo() {
  30476. * this.a = 1;
  30477. * this.b = 2;
  30478. * }
  30479. *
  30480. * Foo.prototype.c = 3;
  30481. *
  30482. * _.forOwnRight(new Foo, function(value, key) {
  30483. * console.log(key);
  30484. * });
  30485. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30486. */
  30487. function forOwnRight(object, iteratee) {
  30488. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30489. }
  30490. /**
  30491. * Creates an array of function property names from own enumerable properties
  30492. * of `object`.
  30493. *
  30494. * @static
  30495. * @since 0.1.0
  30496. * @memberOf _
  30497. * @category Object
  30498. * @param {Object} object The object to inspect.
  30499. * @returns {Array} Returns the function names.
  30500. * @see _.functionsIn
  30501. * @example
  30502. *
  30503. * function Foo() {
  30504. * this.a = _.constant('a');
  30505. * this.b = _.constant('b');
  30506. * }
  30507. *
  30508. * Foo.prototype.c = _.constant('c');
  30509. *
  30510. * _.functions(new Foo);
  30511. * // => ['a', 'b']
  30512. */
  30513. function functions(object) {
  30514. return object == null ? [] : baseFunctions(object, keys(object));
  30515. }
  30516. /**
  30517. * Creates an array of function property names from own and inherited
  30518. * enumerable properties of `object`.
  30519. *
  30520. * @static
  30521. * @memberOf _
  30522. * @since 4.0.0
  30523. * @category Object
  30524. * @param {Object} object The object to inspect.
  30525. * @returns {Array} Returns the function names.
  30526. * @see _.functions
  30527. * @example
  30528. *
  30529. * function Foo() {
  30530. * this.a = _.constant('a');
  30531. * this.b = _.constant('b');
  30532. * }
  30533. *
  30534. * Foo.prototype.c = _.constant('c');
  30535. *
  30536. * _.functionsIn(new Foo);
  30537. * // => ['a', 'b', 'c']
  30538. */
  30539. function functionsIn(object) {
  30540. return object == null ? [] : baseFunctions(object, keysIn(object));
  30541. }
  30542. /**
  30543. * Gets the value at `path` of `object`. If the resolved value is
  30544. * `undefined`, the `defaultValue` is returned in its place.
  30545. *
  30546. * @static
  30547. * @memberOf _
  30548. * @since 3.7.0
  30549. * @category Object
  30550. * @param {Object} object The object to query.
  30551. * @param {Array|string} path The path of the property to get.
  30552. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30553. * @returns {*} Returns the resolved value.
  30554. * @example
  30555. *
  30556. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30557. *
  30558. * _.get(object, 'a[0].b.c');
  30559. * // => 3
  30560. *
  30561. * _.get(object, ['a', '0', 'b', 'c']);
  30562. * // => 3
  30563. *
  30564. * _.get(object, 'a.b.c', 'default');
  30565. * // => 'default'
  30566. */
  30567. function get(object, path, defaultValue) {
  30568. var result = object == null ? undefined : baseGet(object, path);
  30569. return result === undefined ? defaultValue : result;
  30570. }
  30571. /**
  30572. * Checks if `path` is a direct property of `object`.
  30573. *
  30574. * @static
  30575. * @since 0.1.0
  30576. * @memberOf _
  30577. * @category Object
  30578. * @param {Object} object The object to query.
  30579. * @param {Array|string} path The path to check.
  30580. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30581. * @example
  30582. *
  30583. * var object = { 'a': { 'b': 2 } };
  30584. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30585. *
  30586. * _.has(object, 'a');
  30587. * // => true
  30588. *
  30589. * _.has(object, 'a.b');
  30590. * // => true
  30591. *
  30592. * _.has(object, ['a', 'b']);
  30593. * // => true
  30594. *
  30595. * _.has(other, 'a');
  30596. * // => false
  30597. */
  30598. function has(object, path) {
  30599. return object != null && hasPath(object, path, baseHas);
  30600. }
  30601. /**
  30602. * Checks if `path` is a direct or inherited property of `object`.
  30603. *
  30604. * @static
  30605. * @memberOf _
  30606. * @since 4.0.0
  30607. * @category Object
  30608. * @param {Object} object The object to query.
  30609. * @param {Array|string} path The path to check.
  30610. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30611. * @example
  30612. *
  30613. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30614. *
  30615. * _.hasIn(object, 'a');
  30616. * // => true
  30617. *
  30618. * _.hasIn(object, 'a.b');
  30619. * // => true
  30620. *
  30621. * _.hasIn(object, ['a', 'b']);
  30622. * // => true
  30623. *
  30624. * _.hasIn(object, 'b');
  30625. * // => false
  30626. */
  30627. function hasIn(object, path) {
  30628. return object != null && hasPath(object, path, baseHasIn);
  30629. }
  30630. /**
  30631. * Creates an object composed of the inverted keys and values of `object`.
  30632. * If `object` contains duplicate values, subsequent values overwrite
  30633. * property assignments of previous values.
  30634. *
  30635. * @static
  30636. * @memberOf _
  30637. * @since 0.7.0
  30638. * @category Object
  30639. * @param {Object} object The object to invert.
  30640. * @returns {Object} Returns the new inverted object.
  30641. * @example
  30642. *
  30643. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30644. *
  30645. * _.invert(object);
  30646. * // => { '1': 'c', '2': 'b' }
  30647. */
  30648. var invert = createInverter(function(result, value, key) {
  30649. if (value != null &&
  30650. typeof value.toString != 'function') {
  30651. value = nativeObjectToString.call(value);
  30652. }
  30653. result[value] = key;
  30654. }, constant(identity));
  30655. /**
  30656. * This method is like `_.invert` except that the inverted object is generated
  30657. * from the results of running each element of `object` thru `iteratee`. The
  30658. * corresponding inverted value of each inverted key is an array of keys
  30659. * responsible for generating the inverted value. The iteratee is invoked
  30660. * with one argument: (value).
  30661. *
  30662. * @static
  30663. * @memberOf _
  30664. * @since 4.1.0
  30665. * @category Object
  30666. * @param {Object} object The object to invert.
  30667. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30668. * @returns {Object} Returns the new inverted object.
  30669. * @example
  30670. *
  30671. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30672. *
  30673. * _.invertBy(object);
  30674. * // => { '1': ['a', 'c'], '2': ['b'] }
  30675. *
  30676. * _.invertBy(object, function(value) {
  30677. * return 'group' + value;
  30678. * });
  30679. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30680. */
  30681. var invertBy = createInverter(function(result, value, key) {
  30682. if (value != null &&
  30683. typeof value.toString != 'function') {
  30684. value = nativeObjectToString.call(value);
  30685. }
  30686. if (hasOwnProperty.call(result, value)) {
  30687. result[value].push(key);
  30688. } else {
  30689. result[value] = [key];
  30690. }
  30691. }, getIteratee);
  30692. /**
  30693. * Invokes the method at `path` of `object`.
  30694. *
  30695. * @static
  30696. * @memberOf _
  30697. * @since 4.0.0
  30698. * @category Object
  30699. * @param {Object} object The object to query.
  30700. * @param {Array|string} path The path of the method to invoke.
  30701. * @param {...*} [args] The arguments to invoke the method with.
  30702. * @returns {*} Returns the result of the invoked method.
  30703. * @example
  30704. *
  30705. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30706. *
  30707. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30708. * // => [2, 3]
  30709. */
  30710. var invoke = baseRest(baseInvoke);
  30711. /**
  30712. * Creates an array of the own enumerable property names of `object`.
  30713. *
  30714. * **Note:** Non-object values are coerced to objects. See the
  30715. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30716. * for more details.
  30717. *
  30718. * @static
  30719. * @since 0.1.0
  30720. * @memberOf _
  30721. * @category Object
  30722. * @param {Object} object The object to query.
  30723. * @returns {Array} Returns the array of property names.
  30724. * @example
  30725. *
  30726. * function Foo() {
  30727. * this.a = 1;
  30728. * this.b = 2;
  30729. * }
  30730. *
  30731. * Foo.prototype.c = 3;
  30732. *
  30733. * _.keys(new Foo);
  30734. * // => ['a', 'b'] (iteration order is not guaranteed)
  30735. *
  30736. * _.keys('hi');
  30737. * // => ['0', '1']
  30738. */
  30739. function keys(object) {
  30740. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30741. }
  30742. /**
  30743. * Creates an array of the own and inherited enumerable property names of `object`.
  30744. *
  30745. * **Note:** Non-object values are coerced to objects.
  30746. *
  30747. * @static
  30748. * @memberOf _
  30749. * @since 3.0.0
  30750. * @category Object
  30751. * @param {Object} object The object to query.
  30752. * @returns {Array} Returns the array of property names.
  30753. * @example
  30754. *
  30755. * function Foo() {
  30756. * this.a = 1;
  30757. * this.b = 2;
  30758. * }
  30759. *
  30760. * Foo.prototype.c = 3;
  30761. *
  30762. * _.keysIn(new Foo);
  30763. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30764. */
  30765. function keysIn(object) {
  30766. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30767. }
  30768. /**
  30769. * The opposite of `_.mapValues`; this method creates an object with the
  30770. * same values as `object` and keys generated by running each own enumerable
  30771. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30772. * with three arguments: (value, key, object).
  30773. *
  30774. * @static
  30775. * @memberOf _
  30776. * @since 3.8.0
  30777. * @category Object
  30778. * @param {Object} object The object to iterate over.
  30779. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30780. * @returns {Object} Returns the new mapped object.
  30781. * @see _.mapValues
  30782. * @example
  30783. *
  30784. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30785. * return key + value;
  30786. * });
  30787. * // => { 'a1': 1, 'b2': 2 }
  30788. */
  30789. function mapKeys(object, iteratee) {
  30790. var result = {};
  30791. iteratee = getIteratee(iteratee, 3);
  30792. baseForOwn(object, function(value, key, object) {
  30793. baseAssignValue(result, iteratee(value, key, object), value);
  30794. });
  30795. return result;
  30796. }
  30797. /**
  30798. * Creates an object with the same keys as `object` and values generated
  30799. * by running each own enumerable string keyed property of `object` thru
  30800. * `iteratee`. The iteratee is invoked with three arguments:
  30801. * (value, key, object).
  30802. *
  30803. * @static
  30804. * @memberOf _
  30805. * @since 2.4.0
  30806. * @category Object
  30807. * @param {Object} object The object to iterate over.
  30808. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30809. * @returns {Object} Returns the new mapped object.
  30810. * @see _.mapKeys
  30811. * @example
  30812. *
  30813. * var users = {
  30814. * 'fred': { 'user': 'fred', 'age': 40 },
  30815. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30816. * };
  30817. *
  30818. * _.mapValues(users, function(o) { return o.age; });
  30819. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30820. *
  30821. * // The `_.property` iteratee shorthand.
  30822. * _.mapValues(users, 'age');
  30823. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30824. */
  30825. function mapValues(object, iteratee) {
  30826. var result = {};
  30827. iteratee = getIteratee(iteratee, 3);
  30828. baseForOwn(object, function(value, key, object) {
  30829. baseAssignValue(result, key, iteratee(value, key, object));
  30830. });
  30831. return result;
  30832. }
  30833. /**
  30834. * This method is like `_.assign` except that it recursively merges own and
  30835. * inherited enumerable string keyed properties of source objects into the
  30836. * destination object. Source properties that resolve to `undefined` are
  30837. * skipped if a destination value exists. Array and plain object properties
  30838. * are merged recursively. Other objects and value types are overridden by
  30839. * assignment. Source objects are applied from left to right. Subsequent
  30840. * sources overwrite property assignments of previous sources.
  30841. *
  30842. * **Note:** This method mutates `object`.
  30843. *
  30844. * @static
  30845. * @memberOf _
  30846. * @since 0.5.0
  30847. * @category Object
  30848. * @param {Object} object The destination object.
  30849. * @param {...Object} [sources] The source objects.
  30850. * @returns {Object} Returns `object`.
  30851. * @example
  30852. *
  30853. * var object = {
  30854. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30855. * };
  30856. *
  30857. * var other = {
  30858. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30859. * };
  30860. *
  30861. * _.merge(object, other);
  30862. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30863. */
  30864. var merge = createAssigner(function(object, source, srcIndex) {
  30865. baseMerge(object, source, srcIndex);
  30866. });
  30867. /**
  30868. * This method is like `_.merge` except that it accepts `customizer` which
  30869. * is invoked to produce the merged values of the destination and source
  30870. * properties. If `customizer` returns `undefined`, merging is handled by the
  30871. * method instead. The `customizer` is invoked with six arguments:
  30872. * (objValue, srcValue, key, object, source, stack).
  30873. *
  30874. * **Note:** This method mutates `object`.
  30875. *
  30876. * @static
  30877. * @memberOf _
  30878. * @since 4.0.0
  30879. * @category Object
  30880. * @param {Object} object The destination object.
  30881. * @param {...Object} sources The source objects.
  30882. * @param {Function} customizer The function to customize assigned values.
  30883. * @returns {Object} Returns `object`.
  30884. * @example
  30885. *
  30886. * function customizer(objValue, srcValue) {
  30887. * if (_.isArray(objValue)) {
  30888. * return objValue.concat(srcValue);
  30889. * }
  30890. * }
  30891. *
  30892. * var object = { 'a': [1], 'b': [2] };
  30893. * var other = { 'a': [3], 'b': [4] };
  30894. *
  30895. * _.mergeWith(object, other, customizer);
  30896. * // => { 'a': [1, 3], 'b': [2, 4] }
  30897. */
  30898. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30899. baseMerge(object, source, srcIndex, customizer);
  30900. });
  30901. /**
  30902. * The opposite of `_.pick`; this method creates an object composed of the
  30903. * own and inherited enumerable property paths of `object` that are not omitted.
  30904. *
  30905. * **Note:** This method is considerably slower than `_.pick`.
  30906. *
  30907. * @static
  30908. * @since 0.1.0
  30909. * @memberOf _
  30910. * @category Object
  30911. * @param {Object} object The source object.
  30912. * @param {...(string|string[])} [paths] The property paths to omit.
  30913. * @returns {Object} Returns the new object.
  30914. * @example
  30915. *
  30916. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30917. *
  30918. * _.omit(object, ['a', 'c']);
  30919. * // => { 'b': '2' }
  30920. */
  30921. var omit = flatRest(function(object, paths) {
  30922. var result = {};
  30923. if (object == null) {
  30924. return result;
  30925. }
  30926. var isDeep = false;
  30927. paths = arrayMap(paths, function(path) {
  30928. path = castPath(path, object);
  30929. isDeep || (isDeep = path.length > 1);
  30930. return path;
  30931. });
  30932. copyObject(object, getAllKeysIn(object), result);
  30933. if (isDeep) {
  30934. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  30935. }
  30936. var length = paths.length;
  30937. while (length--) {
  30938. baseUnset(result, paths[length]);
  30939. }
  30940. return result;
  30941. });
  30942. /**
  30943. * The opposite of `_.pickBy`; this method creates an object composed of
  30944. * the own and inherited enumerable string keyed properties of `object` that
  30945. * `predicate` doesn't return truthy for. The predicate is invoked with two
  30946. * arguments: (value, key).
  30947. *
  30948. * @static
  30949. * @memberOf _
  30950. * @since 4.0.0
  30951. * @category Object
  30952. * @param {Object} object The source object.
  30953. * @param {Function} [predicate=_.identity] The function invoked per property.
  30954. * @returns {Object} Returns the new object.
  30955. * @example
  30956. *
  30957. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30958. *
  30959. * _.omitBy(object, _.isNumber);
  30960. * // => { 'b': '2' }
  30961. */
  30962. function omitBy(object, predicate) {
  30963. return pickBy(object, negate(getIteratee(predicate)));
  30964. }
  30965. /**
  30966. * Creates an object composed of the picked `object` properties.
  30967. *
  30968. * @static
  30969. * @since 0.1.0
  30970. * @memberOf _
  30971. * @category Object
  30972. * @param {Object} object The source object.
  30973. * @param {...(string|string[])} [paths] The property paths to pick.
  30974. * @returns {Object} Returns the new object.
  30975. * @example
  30976. *
  30977. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30978. *
  30979. * _.pick(object, ['a', 'c']);
  30980. * // => { 'a': 1, 'c': 3 }
  30981. */
  30982. var pick = flatRest(function(object, paths) {
  30983. return object == null ? {} : basePick(object, paths);
  30984. });
  30985. /**
  30986. * Creates an object composed of the `object` properties `predicate` returns
  30987. * truthy for. The predicate is invoked with two arguments: (value, key).
  30988. *
  30989. * @static
  30990. * @memberOf _
  30991. * @since 4.0.0
  30992. * @category Object
  30993. * @param {Object} object The source object.
  30994. * @param {Function} [predicate=_.identity] The function invoked per property.
  30995. * @returns {Object} Returns the new object.
  30996. * @example
  30997. *
  30998. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  30999. *
  31000. * _.pickBy(object, _.isNumber);
  31001. * // => { 'a': 1, 'c': 3 }
  31002. */
  31003. function pickBy(object, predicate) {
  31004. if (object == null) {
  31005. return {};
  31006. }
  31007. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31008. return [prop];
  31009. });
  31010. predicate = getIteratee(predicate);
  31011. return basePickBy(object, props, function(value, path) {
  31012. return predicate(value, path[0]);
  31013. });
  31014. }
  31015. /**
  31016. * This method is like `_.get` except that if the resolved value is a
  31017. * function it's invoked with the `this` binding of its parent object and
  31018. * its result is returned.
  31019. *
  31020. * @static
  31021. * @since 0.1.0
  31022. * @memberOf _
  31023. * @category Object
  31024. * @param {Object} object The object to query.
  31025. * @param {Array|string} path The path of the property to resolve.
  31026. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31027. * @returns {*} Returns the resolved value.
  31028. * @example
  31029. *
  31030. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31031. *
  31032. * _.result(object, 'a[0].b.c1');
  31033. * // => 3
  31034. *
  31035. * _.result(object, 'a[0].b.c2');
  31036. * // => 4
  31037. *
  31038. * _.result(object, 'a[0].b.c3', 'default');
  31039. * // => 'default'
  31040. *
  31041. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31042. * // => 'default'
  31043. */
  31044. function result(object, path, defaultValue) {
  31045. path = castPath(path, object);
  31046. var index = -1,
  31047. length = path.length;
  31048. // Ensure the loop is entered when path is empty.
  31049. if (!length) {
  31050. length = 1;
  31051. object = undefined;
  31052. }
  31053. while (++index < length) {
  31054. var value = object == null ? undefined : object[toKey(path[index])];
  31055. if (value === undefined) {
  31056. index = length;
  31057. value = defaultValue;
  31058. }
  31059. object = isFunction(value) ? value.call(object) : value;
  31060. }
  31061. return object;
  31062. }
  31063. /**
  31064. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31065. * it's created. Arrays are created for missing index properties while objects
  31066. * are created for all other missing properties. Use `_.setWith` to customize
  31067. * `path` creation.
  31068. *
  31069. * **Note:** This method mutates `object`.
  31070. *
  31071. * @static
  31072. * @memberOf _
  31073. * @since 3.7.0
  31074. * @category Object
  31075. * @param {Object} object The object to modify.
  31076. * @param {Array|string} path The path of the property to set.
  31077. * @param {*} value The value to set.
  31078. * @returns {Object} Returns `object`.
  31079. * @example
  31080. *
  31081. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31082. *
  31083. * _.set(object, 'a[0].b.c', 4);
  31084. * console.log(object.a[0].b.c);
  31085. * // => 4
  31086. *
  31087. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31088. * console.log(object.x[0].y.z);
  31089. * // => 5
  31090. */
  31091. function set(object, path, value) {
  31092. return object == null ? object : baseSet(object, path, value);
  31093. }
  31094. /**
  31095. * This method is like `_.set` except that it accepts `customizer` which is
  31096. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31097. * path creation is handled by the method instead. The `customizer` is invoked
  31098. * with three arguments: (nsValue, key, nsObject).
  31099. *
  31100. * **Note:** This method mutates `object`.
  31101. *
  31102. * @static
  31103. * @memberOf _
  31104. * @since 4.0.0
  31105. * @category Object
  31106. * @param {Object} object The object to modify.
  31107. * @param {Array|string} path The path of the property to set.
  31108. * @param {*} value The value to set.
  31109. * @param {Function} [customizer] The function to customize assigned values.
  31110. * @returns {Object} Returns `object`.
  31111. * @example
  31112. *
  31113. * var object = {};
  31114. *
  31115. * _.setWith(object, '[0][1]', 'a', Object);
  31116. * // => { '0': { '1': 'a' } }
  31117. */
  31118. function setWith(object, path, value, customizer) {
  31119. customizer = typeof customizer == 'function' ? customizer : undefined;
  31120. return object == null ? object : baseSet(object, path, value, customizer);
  31121. }
  31122. /**
  31123. * Creates an array of own enumerable string keyed-value pairs for `object`
  31124. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31125. * entries are returned.
  31126. *
  31127. * @static
  31128. * @memberOf _
  31129. * @since 4.0.0
  31130. * @alias entries
  31131. * @category Object
  31132. * @param {Object} object The object to query.
  31133. * @returns {Array} Returns the key-value pairs.
  31134. * @example
  31135. *
  31136. * function Foo() {
  31137. * this.a = 1;
  31138. * this.b = 2;
  31139. * }
  31140. *
  31141. * Foo.prototype.c = 3;
  31142. *
  31143. * _.toPairs(new Foo);
  31144. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31145. */
  31146. var toPairs = createToPairs(keys);
  31147. /**
  31148. * Creates an array of own and inherited enumerable string keyed-value pairs
  31149. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31150. * or set, its entries are returned.
  31151. *
  31152. * @static
  31153. * @memberOf _
  31154. * @since 4.0.0
  31155. * @alias entriesIn
  31156. * @category Object
  31157. * @param {Object} object The object to query.
  31158. * @returns {Array} Returns the key-value pairs.
  31159. * @example
  31160. *
  31161. * function Foo() {
  31162. * this.a = 1;
  31163. * this.b = 2;
  31164. * }
  31165. *
  31166. * Foo.prototype.c = 3;
  31167. *
  31168. * _.toPairsIn(new Foo);
  31169. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31170. */
  31171. var toPairsIn = createToPairs(keysIn);
  31172. /**
  31173. * An alternative to `_.reduce`; this method transforms `object` to a new
  31174. * `accumulator` object which is the result of running each of its own
  31175. * enumerable string keyed properties thru `iteratee`, with each invocation
  31176. * potentially mutating the `accumulator` object. If `accumulator` is not
  31177. * provided, a new object with the same `[[Prototype]]` will be used. The
  31178. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31179. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31180. *
  31181. * @static
  31182. * @memberOf _
  31183. * @since 1.3.0
  31184. * @category Object
  31185. * @param {Object} object The object to iterate over.
  31186. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31187. * @param {*} [accumulator] The custom accumulator value.
  31188. * @returns {*} Returns the accumulated value.
  31189. * @example
  31190. *
  31191. * _.transform([2, 3, 4], function(result, n) {
  31192. * result.push(n *= n);
  31193. * return n % 2 == 0;
  31194. * }, []);
  31195. * // => [4, 9]
  31196. *
  31197. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31198. * (result[value] || (result[value] = [])).push(key);
  31199. * }, {});
  31200. * // => { '1': ['a', 'c'], '2': ['b'] }
  31201. */
  31202. function transform(object, iteratee, accumulator) {
  31203. var isArr = isArray(object),
  31204. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31205. iteratee = getIteratee(iteratee, 4);
  31206. if (accumulator == null) {
  31207. var Ctor = object && object.constructor;
  31208. if (isArrLike) {
  31209. accumulator = isArr ? new Ctor : [];
  31210. }
  31211. else if (isObject(object)) {
  31212. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31213. }
  31214. else {
  31215. accumulator = {};
  31216. }
  31217. }
  31218. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31219. return iteratee(accumulator, value, index, object);
  31220. });
  31221. return accumulator;
  31222. }
  31223. /**
  31224. * Removes the property at `path` of `object`.
  31225. *
  31226. * **Note:** This method mutates `object`.
  31227. *
  31228. * @static
  31229. * @memberOf _
  31230. * @since 4.0.0
  31231. * @category Object
  31232. * @param {Object} object The object to modify.
  31233. * @param {Array|string} path The path of the property to unset.
  31234. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31235. * @example
  31236. *
  31237. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31238. * _.unset(object, 'a[0].b.c');
  31239. * // => true
  31240. *
  31241. * console.log(object);
  31242. * // => { 'a': [{ 'b': {} }] };
  31243. *
  31244. * _.unset(object, ['a', '0', 'b', 'c']);
  31245. * // => true
  31246. *
  31247. * console.log(object);
  31248. * // => { 'a': [{ 'b': {} }] };
  31249. */
  31250. function unset(object, path) {
  31251. return object == null ? true : baseUnset(object, path);
  31252. }
  31253. /**
  31254. * This method is like `_.set` except that accepts `updater` to produce the
  31255. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31256. * is invoked with one argument: (value).
  31257. *
  31258. * **Note:** This method mutates `object`.
  31259. *
  31260. * @static
  31261. * @memberOf _
  31262. * @since 4.6.0
  31263. * @category Object
  31264. * @param {Object} object The object to modify.
  31265. * @param {Array|string} path The path of the property to set.
  31266. * @param {Function} updater The function to produce the updated value.
  31267. * @returns {Object} Returns `object`.
  31268. * @example
  31269. *
  31270. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31271. *
  31272. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31273. * console.log(object.a[0].b.c);
  31274. * // => 9
  31275. *
  31276. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31277. * console.log(object.x[0].y.z);
  31278. * // => 0
  31279. */
  31280. function update(object, path, updater) {
  31281. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31282. }
  31283. /**
  31284. * This method is like `_.update` except that it accepts `customizer` which is
  31285. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31286. * path creation is handled by the method instead. The `customizer` is invoked
  31287. * with three arguments: (nsValue, key, nsObject).
  31288. *
  31289. * **Note:** This method mutates `object`.
  31290. *
  31291. * @static
  31292. * @memberOf _
  31293. * @since 4.6.0
  31294. * @category Object
  31295. * @param {Object} object The object to modify.
  31296. * @param {Array|string} path The path of the property to set.
  31297. * @param {Function} updater The function to produce the updated value.
  31298. * @param {Function} [customizer] The function to customize assigned values.
  31299. * @returns {Object} Returns `object`.
  31300. * @example
  31301. *
  31302. * var object = {};
  31303. *
  31304. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31305. * // => { '0': { '1': 'a' } }
  31306. */
  31307. function updateWith(object, path, updater, customizer) {
  31308. customizer = typeof customizer == 'function' ? customizer : undefined;
  31309. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31310. }
  31311. /**
  31312. * Creates an array of the own enumerable string keyed property values of `object`.
  31313. *
  31314. * **Note:** Non-object values are coerced to objects.
  31315. *
  31316. * @static
  31317. * @since 0.1.0
  31318. * @memberOf _
  31319. * @category Object
  31320. * @param {Object} object The object to query.
  31321. * @returns {Array} Returns the array of property values.
  31322. * @example
  31323. *
  31324. * function Foo() {
  31325. * this.a = 1;
  31326. * this.b = 2;
  31327. * }
  31328. *
  31329. * Foo.prototype.c = 3;
  31330. *
  31331. * _.values(new Foo);
  31332. * // => [1, 2] (iteration order is not guaranteed)
  31333. *
  31334. * _.values('hi');
  31335. * // => ['h', 'i']
  31336. */
  31337. function values(object) {
  31338. return object == null ? [] : baseValues(object, keys(object));
  31339. }
  31340. /**
  31341. * Creates an array of the own and inherited enumerable string keyed property
  31342. * values of `object`.
  31343. *
  31344. * **Note:** Non-object values are coerced to objects.
  31345. *
  31346. * @static
  31347. * @memberOf _
  31348. * @since 3.0.0
  31349. * @category Object
  31350. * @param {Object} object The object to query.
  31351. * @returns {Array} Returns the array of property values.
  31352. * @example
  31353. *
  31354. * function Foo() {
  31355. * this.a = 1;
  31356. * this.b = 2;
  31357. * }
  31358. *
  31359. * Foo.prototype.c = 3;
  31360. *
  31361. * _.valuesIn(new Foo);
  31362. * // => [1, 2, 3] (iteration order is not guaranteed)
  31363. */
  31364. function valuesIn(object) {
  31365. return object == null ? [] : baseValues(object, keysIn(object));
  31366. }
  31367. /*------------------------------------------------------------------------*/
  31368. /**
  31369. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31370. *
  31371. * @static
  31372. * @memberOf _
  31373. * @since 4.0.0
  31374. * @category Number
  31375. * @param {number} number The number to clamp.
  31376. * @param {number} [lower] The lower bound.
  31377. * @param {number} upper The upper bound.
  31378. * @returns {number} Returns the clamped number.
  31379. * @example
  31380. *
  31381. * _.clamp(-10, -5, 5);
  31382. * // => -5
  31383. *
  31384. * _.clamp(10, -5, 5);
  31385. * // => 5
  31386. */
  31387. function clamp(number, lower, upper) {
  31388. if (upper === undefined) {
  31389. upper = lower;
  31390. lower = undefined;
  31391. }
  31392. if (upper !== undefined) {
  31393. upper = toNumber(upper);
  31394. upper = upper === upper ? upper : 0;
  31395. }
  31396. if (lower !== undefined) {
  31397. lower = toNumber(lower);
  31398. lower = lower === lower ? lower : 0;
  31399. }
  31400. return baseClamp(toNumber(number), lower, upper);
  31401. }
  31402. /**
  31403. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31404. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31405. * If `start` is greater than `end` the params are swapped to support
  31406. * negative ranges.
  31407. *
  31408. * @static
  31409. * @memberOf _
  31410. * @since 3.3.0
  31411. * @category Number
  31412. * @param {number} number The number to check.
  31413. * @param {number} [start=0] The start of the range.
  31414. * @param {number} end The end of the range.
  31415. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31416. * @see _.range, _.rangeRight
  31417. * @example
  31418. *
  31419. * _.inRange(3, 2, 4);
  31420. * // => true
  31421. *
  31422. * _.inRange(4, 8);
  31423. * // => true
  31424. *
  31425. * _.inRange(4, 2);
  31426. * // => false
  31427. *
  31428. * _.inRange(2, 2);
  31429. * // => false
  31430. *
  31431. * _.inRange(1.2, 2);
  31432. * // => true
  31433. *
  31434. * _.inRange(5.2, 4);
  31435. * // => false
  31436. *
  31437. * _.inRange(-3, -2, -6);
  31438. * // => true
  31439. */
  31440. function inRange(number, start, end) {
  31441. start = toFinite(start);
  31442. if (end === undefined) {
  31443. end = start;
  31444. start = 0;
  31445. } else {
  31446. end = toFinite(end);
  31447. }
  31448. number = toNumber(number);
  31449. return baseInRange(number, start, end);
  31450. }
  31451. /**
  31452. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31453. * If only one argument is provided a number between `0` and the given number
  31454. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31455. * floats, a floating-point number is returned instead of an integer.
  31456. *
  31457. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31458. * floating-point values which can produce unexpected results.
  31459. *
  31460. * @static
  31461. * @memberOf _
  31462. * @since 0.7.0
  31463. * @category Number
  31464. * @param {number} [lower=0] The lower bound.
  31465. * @param {number} [upper=1] The upper bound.
  31466. * @param {boolean} [floating] Specify returning a floating-point number.
  31467. * @returns {number} Returns the random number.
  31468. * @example
  31469. *
  31470. * _.random(0, 5);
  31471. * // => an integer between 0 and 5
  31472. *
  31473. * _.random(5);
  31474. * // => also an integer between 0 and 5
  31475. *
  31476. * _.random(5, true);
  31477. * // => a floating-point number between 0 and 5
  31478. *
  31479. * _.random(1.2, 5.2);
  31480. * // => a floating-point number between 1.2 and 5.2
  31481. */
  31482. function random(lower, upper, floating) {
  31483. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31484. upper = floating = undefined;
  31485. }
  31486. if (floating === undefined) {
  31487. if (typeof upper == 'boolean') {
  31488. floating = upper;
  31489. upper = undefined;
  31490. }
  31491. else if (typeof lower == 'boolean') {
  31492. floating = lower;
  31493. lower = undefined;
  31494. }
  31495. }
  31496. if (lower === undefined && upper === undefined) {
  31497. lower = 0;
  31498. upper = 1;
  31499. }
  31500. else {
  31501. lower = toFinite(lower);
  31502. if (upper === undefined) {
  31503. upper = lower;
  31504. lower = 0;
  31505. } else {
  31506. upper = toFinite(upper);
  31507. }
  31508. }
  31509. if (lower > upper) {
  31510. var temp = lower;
  31511. lower = upper;
  31512. upper = temp;
  31513. }
  31514. if (floating || lower % 1 || upper % 1) {
  31515. var rand = nativeRandom();
  31516. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31517. }
  31518. return baseRandom(lower, upper);
  31519. }
  31520. /*------------------------------------------------------------------------*/
  31521. /**
  31522. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31523. *
  31524. * @static
  31525. * @memberOf _
  31526. * @since 3.0.0
  31527. * @category String
  31528. * @param {string} [string=''] The string to convert.
  31529. * @returns {string} Returns the camel cased string.
  31530. * @example
  31531. *
  31532. * _.camelCase('Foo Bar');
  31533. * // => 'fooBar'
  31534. *
  31535. * _.camelCase('--foo-bar--');
  31536. * // => 'fooBar'
  31537. *
  31538. * _.camelCase('__FOO_BAR__');
  31539. * // => 'fooBar'
  31540. */
  31541. var camelCase = createCompounder(function(result, word, index) {
  31542. word = word.toLowerCase();
  31543. return result + (index ? capitalize(word) : word);
  31544. });
  31545. /**
  31546. * Converts the first character of `string` to upper case and the remaining
  31547. * to lower case.
  31548. *
  31549. * @static
  31550. * @memberOf _
  31551. * @since 3.0.0
  31552. * @category String
  31553. * @param {string} [string=''] The string to capitalize.
  31554. * @returns {string} Returns the capitalized string.
  31555. * @example
  31556. *
  31557. * _.capitalize('FRED');
  31558. * // => 'Fred'
  31559. */
  31560. function capitalize(string) {
  31561. return upperFirst(toString(string).toLowerCase());
  31562. }
  31563. /**
  31564. * Deburrs `string` by converting
  31565. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31566. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31567. * letters to basic Latin letters and removing
  31568. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31569. *
  31570. * @static
  31571. * @memberOf _
  31572. * @since 3.0.0
  31573. * @category String
  31574. * @param {string} [string=''] The string to deburr.
  31575. * @returns {string} Returns the deburred string.
  31576. * @example
  31577. *
  31578. * _.deburr('déjà vu');
  31579. * // => 'deja vu'
  31580. */
  31581. function deburr(string) {
  31582. string = toString(string);
  31583. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31584. }
  31585. /**
  31586. * Checks if `string` ends with the given target string.
  31587. *
  31588. * @static
  31589. * @memberOf _
  31590. * @since 3.0.0
  31591. * @category String
  31592. * @param {string} [string=''] The string to inspect.
  31593. * @param {string} [target] The string to search for.
  31594. * @param {number} [position=string.length] The position to search up to.
  31595. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31596. * else `false`.
  31597. * @example
  31598. *
  31599. * _.endsWith('abc', 'c');
  31600. * // => true
  31601. *
  31602. * _.endsWith('abc', 'b');
  31603. * // => false
  31604. *
  31605. * _.endsWith('abc', 'b', 2);
  31606. * // => true
  31607. */
  31608. function endsWith(string, target, position) {
  31609. string = toString(string);
  31610. target = baseToString(target);
  31611. var length = string.length;
  31612. position = position === undefined
  31613. ? length
  31614. : baseClamp(toInteger(position), 0, length);
  31615. var end = position;
  31616. position -= target.length;
  31617. return position >= 0 && string.slice(position, end) == target;
  31618. }
  31619. /**
  31620. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31621. * corresponding HTML entities.
  31622. *
  31623. * **Note:** No other characters are escaped. To escape additional
  31624. * characters use a third-party library like [_he_](https://mths.be/he).
  31625. *
  31626. * Though the ">" character is escaped for symmetry, characters like
  31627. * ">" and "/" don't need escaping in HTML and have no special meaning
  31628. * unless they're part of a tag or unquoted attribute value. See
  31629. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31630. * (under "semi-related fun fact") for more details.
  31631. *
  31632. * When working with HTML you should always
  31633. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31634. * XSS vectors.
  31635. *
  31636. * @static
  31637. * @since 0.1.0
  31638. * @memberOf _
  31639. * @category String
  31640. * @param {string} [string=''] The string to escape.
  31641. * @returns {string} Returns the escaped string.
  31642. * @example
  31643. *
  31644. * _.escape('fred, barney, & pebbles');
  31645. * // => 'fred, barney, &amp; pebbles'
  31646. */
  31647. function escape(string) {
  31648. string = toString(string);
  31649. return (string && reHasUnescapedHtml.test(string))
  31650. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31651. : string;
  31652. }
  31653. /**
  31654. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31655. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31656. *
  31657. * @static
  31658. * @memberOf _
  31659. * @since 3.0.0
  31660. * @category String
  31661. * @param {string} [string=''] The string to escape.
  31662. * @returns {string} Returns the escaped string.
  31663. * @example
  31664. *
  31665. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31666. * // => '\[lodash\]\(https://lodash\.com/\)'
  31667. */
  31668. function escapeRegExp(string) {
  31669. string = toString(string);
  31670. return (string && reHasRegExpChar.test(string))
  31671. ? string.replace(reRegExpChar, '\\$&')
  31672. : string;
  31673. }
  31674. /**
  31675. * Converts `string` to
  31676. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31677. *
  31678. * @static
  31679. * @memberOf _
  31680. * @since 3.0.0
  31681. * @category String
  31682. * @param {string} [string=''] The string to convert.
  31683. * @returns {string} Returns the kebab cased string.
  31684. * @example
  31685. *
  31686. * _.kebabCase('Foo Bar');
  31687. * // => 'foo-bar'
  31688. *
  31689. * _.kebabCase('fooBar');
  31690. * // => 'foo-bar'
  31691. *
  31692. * _.kebabCase('__FOO_BAR__');
  31693. * // => 'foo-bar'
  31694. */
  31695. var kebabCase = createCompounder(function(result, word, index) {
  31696. return result + (index ? '-' : '') + word.toLowerCase();
  31697. });
  31698. /**
  31699. * Converts `string`, as space separated words, to lower case.
  31700. *
  31701. * @static
  31702. * @memberOf _
  31703. * @since 4.0.0
  31704. * @category String
  31705. * @param {string} [string=''] The string to convert.
  31706. * @returns {string} Returns the lower cased string.
  31707. * @example
  31708. *
  31709. * _.lowerCase('--Foo-Bar--');
  31710. * // => 'foo bar'
  31711. *
  31712. * _.lowerCase('fooBar');
  31713. * // => 'foo bar'
  31714. *
  31715. * _.lowerCase('__FOO_BAR__');
  31716. * // => 'foo bar'
  31717. */
  31718. var lowerCase = createCompounder(function(result, word, index) {
  31719. return result + (index ? ' ' : '') + word.toLowerCase();
  31720. });
  31721. /**
  31722. * Converts the first character of `string` to lower case.
  31723. *
  31724. * @static
  31725. * @memberOf _
  31726. * @since 4.0.0
  31727. * @category String
  31728. * @param {string} [string=''] The string to convert.
  31729. * @returns {string} Returns the converted string.
  31730. * @example
  31731. *
  31732. * _.lowerFirst('Fred');
  31733. * // => 'fred'
  31734. *
  31735. * _.lowerFirst('FRED');
  31736. * // => 'fRED'
  31737. */
  31738. var lowerFirst = createCaseFirst('toLowerCase');
  31739. /**
  31740. * Pads `string` on the left and right sides if it's shorter than `length`.
  31741. * Padding characters are truncated if they can't be evenly divided by `length`.
  31742. *
  31743. * @static
  31744. * @memberOf _
  31745. * @since 3.0.0
  31746. * @category String
  31747. * @param {string} [string=''] The string to pad.
  31748. * @param {number} [length=0] The padding length.
  31749. * @param {string} [chars=' '] The string used as padding.
  31750. * @returns {string} Returns the padded string.
  31751. * @example
  31752. *
  31753. * _.pad('abc', 8);
  31754. * // => ' abc '
  31755. *
  31756. * _.pad('abc', 8, '_-');
  31757. * // => '_-abc_-_'
  31758. *
  31759. * _.pad('abc', 3);
  31760. * // => 'abc'
  31761. */
  31762. function pad(string, length, chars) {
  31763. string = toString(string);
  31764. length = toInteger(length);
  31765. var strLength = length ? stringSize(string) : 0;
  31766. if (!length || strLength >= length) {
  31767. return string;
  31768. }
  31769. var mid = (length - strLength) / 2;
  31770. return (
  31771. createPadding(nativeFloor(mid), chars) +
  31772. string +
  31773. createPadding(nativeCeil(mid), chars)
  31774. );
  31775. }
  31776. /**
  31777. * Pads `string` on the right side if it's shorter than `length`. Padding
  31778. * characters are truncated if they exceed `length`.
  31779. *
  31780. * @static
  31781. * @memberOf _
  31782. * @since 4.0.0
  31783. * @category String
  31784. * @param {string} [string=''] The string to pad.
  31785. * @param {number} [length=0] The padding length.
  31786. * @param {string} [chars=' '] The string used as padding.
  31787. * @returns {string} Returns the padded string.
  31788. * @example
  31789. *
  31790. * _.padEnd('abc', 6);
  31791. * // => 'abc '
  31792. *
  31793. * _.padEnd('abc', 6, '_-');
  31794. * // => 'abc_-_'
  31795. *
  31796. * _.padEnd('abc', 3);
  31797. * // => 'abc'
  31798. */
  31799. function padEnd(string, length, chars) {
  31800. string = toString(string);
  31801. length = toInteger(length);
  31802. var strLength = length ? stringSize(string) : 0;
  31803. return (length && strLength < length)
  31804. ? (string + createPadding(length - strLength, chars))
  31805. : string;
  31806. }
  31807. /**
  31808. * Pads `string` on the left side if it's shorter than `length`. Padding
  31809. * characters are truncated if they exceed `length`.
  31810. *
  31811. * @static
  31812. * @memberOf _
  31813. * @since 4.0.0
  31814. * @category String
  31815. * @param {string} [string=''] The string to pad.
  31816. * @param {number} [length=0] The padding length.
  31817. * @param {string} [chars=' '] The string used as padding.
  31818. * @returns {string} Returns the padded string.
  31819. * @example
  31820. *
  31821. * _.padStart('abc', 6);
  31822. * // => ' abc'
  31823. *
  31824. * _.padStart('abc', 6, '_-');
  31825. * // => '_-_abc'
  31826. *
  31827. * _.padStart('abc', 3);
  31828. * // => 'abc'
  31829. */
  31830. function padStart(string, length, chars) {
  31831. string = toString(string);
  31832. length = toInteger(length);
  31833. var strLength = length ? stringSize(string) : 0;
  31834. return (length && strLength < length)
  31835. ? (createPadding(length - strLength, chars) + string)
  31836. : string;
  31837. }
  31838. /**
  31839. * Converts `string` to an integer of the specified radix. If `radix` is
  31840. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31841. * hexadecimal, in which case a `radix` of `16` is used.
  31842. *
  31843. * **Note:** This method aligns with the
  31844. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31845. *
  31846. * @static
  31847. * @memberOf _
  31848. * @since 1.1.0
  31849. * @category String
  31850. * @param {string} string The string to convert.
  31851. * @param {number} [radix=10] The radix to interpret `value` by.
  31852. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31853. * @returns {number} Returns the converted integer.
  31854. * @example
  31855. *
  31856. * _.parseInt('08');
  31857. * // => 8
  31858. *
  31859. * _.map(['6', '08', '10'], _.parseInt);
  31860. * // => [6, 8, 10]
  31861. */
  31862. function parseInt(string, radix, guard) {
  31863. if (guard || radix == null) {
  31864. radix = 0;
  31865. } else if (radix) {
  31866. radix = +radix;
  31867. }
  31868. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31869. }
  31870. /**
  31871. * Repeats the given string `n` times.
  31872. *
  31873. * @static
  31874. * @memberOf _
  31875. * @since 3.0.0
  31876. * @category String
  31877. * @param {string} [string=''] The string to repeat.
  31878. * @param {number} [n=1] The number of times to repeat the string.
  31879. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31880. * @returns {string} Returns the repeated string.
  31881. * @example
  31882. *
  31883. * _.repeat('*', 3);
  31884. * // => '***'
  31885. *
  31886. * _.repeat('abc', 2);
  31887. * // => 'abcabc'
  31888. *
  31889. * _.repeat('abc', 0);
  31890. * // => ''
  31891. */
  31892. function repeat(string, n, guard) {
  31893. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31894. n = 1;
  31895. } else {
  31896. n = toInteger(n);
  31897. }
  31898. return baseRepeat(toString(string), n);
  31899. }
  31900. /**
  31901. * Replaces matches for `pattern` in `string` with `replacement`.
  31902. *
  31903. * **Note:** This method is based on
  31904. * [`String#replace`](https://mdn.io/String/replace).
  31905. *
  31906. * @static
  31907. * @memberOf _
  31908. * @since 4.0.0
  31909. * @category String
  31910. * @param {string} [string=''] The string to modify.
  31911. * @param {RegExp|string} pattern The pattern to replace.
  31912. * @param {Function|string} replacement The match replacement.
  31913. * @returns {string} Returns the modified string.
  31914. * @example
  31915. *
  31916. * _.replace('Hi Fred', 'Fred', 'Barney');
  31917. * // => 'Hi Barney'
  31918. */
  31919. function replace() {
  31920. var args = arguments,
  31921. string = toString(args[0]);
  31922. return args.length < 3 ? string : string.replace(args[1], args[2]);
  31923. }
  31924. /**
  31925. * Converts `string` to
  31926. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  31927. *
  31928. * @static
  31929. * @memberOf _
  31930. * @since 3.0.0
  31931. * @category String
  31932. * @param {string} [string=''] The string to convert.
  31933. * @returns {string} Returns the snake cased string.
  31934. * @example
  31935. *
  31936. * _.snakeCase('Foo Bar');
  31937. * // => 'foo_bar'
  31938. *
  31939. * _.snakeCase('fooBar');
  31940. * // => 'foo_bar'
  31941. *
  31942. * _.snakeCase('--FOO-BAR--');
  31943. * // => 'foo_bar'
  31944. */
  31945. var snakeCase = createCompounder(function(result, word, index) {
  31946. return result + (index ? '_' : '') + word.toLowerCase();
  31947. });
  31948. /**
  31949. * Splits `string` by `separator`.
  31950. *
  31951. * **Note:** This method is based on
  31952. * [`String#split`](https://mdn.io/String/split).
  31953. *
  31954. * @static
  31955. * @memberOf _
  31956. * @since 4.0.0
  31957. * @category String
  31958. * @param {string} [string=''] The string to split.
  31959. * @param {RegExp|string} separator The separator pattern to split by.
  31960. * @param {number} [limit] The length to truncate results to.
  31961. * @returns {Array} Returns the string segments.
  31962. * @example
  31963. *
  31964. * _.split('a-b-c', '-', 2);
  31965. * // => ['a', 'b']
  31966. */
  31967. function split(string, separator, limit) {
  31968. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  31969. separator = limit = undefined;
  31970. }
  31971. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  31972. if (!limit) {
  31973. return [];
  31974. }
  31975. string = toString(string);
  31976. if (string && (
  31977. typeof separator == 'string' ||
  31978. (separator != null && !isRegExp(separator))
  31979. )) {
  31980. separator = baseToString(separator);
  31981. if (!separator && hasUnicode(string)) {
  31982. return castSlice(stringToArray(string), 0, limit);
  31983. }
  31984. }
  31985. return string.split(separator, limit);
  31986. }
  31987. /**
  31988. * Converts `string` to
  31989. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  31990. *
  31991. * @static
  31992. * @memberOf _
  31993. * @since 3.1.0
  31994. * @category String
  31995. * @param {string} [string=''] The string to convert.
  31996. * @returns {string} Returns the start cased string.
  31997. * @example
  31998. *
  31999. * _.startCase('--foo-bar--');
  32000. * // => 'Foo Bar'
  32001. *
  32002. * _.startCase('fooBar');
  32003. * // => 'Foo Bar'
  32004. *
  32005. * _.startCase('__FOO_BAR__');
  32006. * // => 'FOO BAR'
  32007. */
  32008. var startCase = createCompounder(function(result, word, index) {
  32009. return result + (index ? ' ' : '') + upperFirst(word);
  32010. });
  32011. /**
  32012. * Checks if `string` starts with the given target string.
  32013. *
  32014. * @static
  32015. * @memberOf _
  32016. * @since 3.0.0
  32017. * @category String
  32018. * @param {string} [string=''] The string to inspect.
  32019. * @param {string} [target] The string to search for.
  32020. * @param {number} [position=0] The position to search from.
  32021. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32022. * else `false`.
  32023. * @example
  32024. *
  32025. * _.startsWith('abc', 'a');
  32026. * // => true
  32027. *
  32028. * _.startsWith('abc', 'b');
  32029. * // => false
  32030. *
  32031. * _.startsWith('abc', 'b', 1);
  32032. * // => true
  32033. */
  32034. function startsWith(string, target, position) {
  32035. string = toString(string);
  32036. position = position == null
  32037. ? 0
  32038. : baseClamp(toInteger(position), 0, string.length);
  32039. target = baseToString(target);
  32040. return string.slice(position, position + target.length) == target;
  32041. }
  32042. /**
  32043. * Creates a compiled template function that can interpolate data properties
  32044. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32045. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32046. * properties may be accessed as free variables in the template. If a setting
  32047. * object is given, it takes precedence over `_.templateSettings` values.
  32048. *
  32049. * **Note:** In the development build `_.template` utilizes
  32050. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32051. * for easier debugging.
  32052. *
  32053. * For more information on precompiling templates see
  32054. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32055. *
  32056. * For more information on Chrome extension sandboxes see
  32057. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32058. *
  32059. * @static
  32060. * @since 0.1.0
  32061. * @memberOf _
  32062. * @category String
  32063. * @param {string} [string=''] The template string.
  32064. * @param {Object} [options={}] The options object.
  32065. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32066. * The HTML "escape" delimiter.
  32067. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32068. * The "evaluate" delimiter.
  32069. * @param {Object} [options.imports=_.templateSettings.imports]
  32070. * An object to import into the template as free variables.
  32071. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32072. * The "interpolate" delimiter.
  32073. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32074. * The sourceURL of the compiled template.
  32075. * @param {string} [options.variable='obj']
  32076. * The data object variable name.
  32077. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32078. * @returns {Function} Returns the compiled template function.
  32079. * @example
  32080. *
  32081. * // Use the "interpolate" delimiter to create a compiled template.
  32082. * var compiled = _.template('hello <%= user %>!');
  32083. * compiled({ 'user': 'fred' });
  32084. * // => 'hello fred!'
  32085. *
  32086. * // Use the HTML "escape" delimiter to escape data property values.
  32087. * var compiled = _.template('<b><%- value %></b>');
  32088. * compiled({ 'value': '<script>' });
  32089. * // => '<b>&lt;script&gt;</b>'
  32090. *
  32091. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32092. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32093. * compiled({ 'users': ['fred', 'barney'] });
  32094. * // => '<li>fred</li><li>barney</li>'
  32095. *
  32096. * // Use the internal `print` function in "evaluate" delimiters.
  32097. * var compiled = _.template('<% print("hello " + user); %>!');
  32098. * compiled({ 'user': 'barney' });
  32099. * // => 'hello barney!'
  32100. *
  32101. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32102. * // Disable support by replacing the "interpolate" delimiter.
  32103. * var compiled = _.template('hello ${ user }!');
  32104. * compiled({ 'user': 'pebbles' });
  32105. * // => 'hello pebbles!'
  32106. *
  32107. * // Use backslashes to treat delimiters as plain text.
  32108. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32109. * compiled({ 'value': 'ignored' });
  32110. * // => '<%- value %>'
  32111. *
  32112. * // Use the `imports` option to import `jQuery` as `jq`.
  32113. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32114. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32115. * compiled({ 'users': ['fred', 'barney'] });
  32116. * // => '<li>fred</li><li>barney</li>'
  32117. *
  32118. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32119. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32120. * compiled(data);
  32121. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32122. *
  32123. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32124. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32125. * compiled.source;
  32126. * // => function(data) {
  32127. * // var __t, __p = '';
  32128. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32129. * // return __p;
  32130. * // }
  32131. *
  32132. * // Use custom template delimiters.
  32133. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32134. * var compiled = _.template('hello {{ user }}!');
  32135. * compiled({ 'user': 'mustache' });
  32136. * // => 'hello mustache!'
  32137. *
  32138. * // Use the `source` property to inline compiled templates for meaningful
  32139. * // line numbers in error messages and stack traces.
  32140. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32141. * var JST = {\
  32142. * "main": ' + _.template(mainText).source + '\
  32143. * };\
  32144. * ');
  32145. */
  32146. function template(string, options, guard) {
  32147. // Based on John Resig's `tmpl` implementation
  32148. // (http://ejohn.org/blog/javascript-micro-templating/)
  32149. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32150. var settings = lodash.templateSettings;
  32151. if (guard && isIterateeCall(string, options, guard)) {
  32152. options = undefined;
  32153. }
  32154. string = toString(string);
  32155. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32156. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32157. importsKeys = keys(imports),
  32158. importsValues = baseValues(imports, importsKeys);
  32159. var isEscaping,
  32160. isEvaluating,
  32161. index = 0,
  32162. interpolate = options.interpolate || reNoMatch,
  32163. source = "__p += '";
  32164. // Compile the regexp to match each delimiter.
  32165. var reDelimiters = RegExp(
  32166. (options.escape || reNoMatch).source + '|' +
  32167. interpolate.source + '|' +
  32168. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32169. (options.evaluate || reNoMatch).source + '|$'
  32170. , 'g');
  32171. // Use a sourceURL for easier debugging.
  32172. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32173. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32174. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32175. var sourceURL = '//# sourceURL=' +
  32176. (hasOwnProperty.call(options, 'sourceURL')
  32177. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32178. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32179. ) + '\n';
  32180. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32181. interpolateValue || (interpolateValue = esTemplateValue);
  32182. // Escape characters that can't be included in string literals.
  32183. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32184. // Replace delimiters with snippets.
  32185. if (escapeValue) {
  32186. isEscaping = true;
  32187. source += "' +\n__e(" + escapeValue + ") +\n'";
  32188. }
  32189. if (evaluateValue) {
  32190. isEvaluating = true;
  32191. source += "';\n" + evaluateValue + ";\n__p += '";
  32192. }
  32193. if (interpolateValue) {
  32194. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32195. }
  32196. index = offset + match.length;
  32197. // The JS engine embedded in Adobe products needs `match` returned in
  32198. // order to produce the correct `offset` value.
  32199. return match;
  32200. });
  32201. source += "';\n";
  32202. // If `variable` is not specified wrap a with-statement around the generated
  32203. // code to add the data object to the top of the scope chain.
  32204. // Like with sourceURL, we take care to not check the option's prototype,
  32205. // as this configuration is a code injection vector.
  32206. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32207. if (!variable) {
  32208. source = 'with (obj) {\n' + source + '\n}\n';
  32209. }
  32210. // Cleanup code by stripping empty strings.
  32211. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32212. .replace(reEmptyStringMiddle, '$1')
  32213. .replace(reEmptyStringTrailing, '$1;');
  32214. // Frame code as the function body.
  32215. source = 'function(' + (variable || 'obj') + ') {\n' +
  32216. (variable
  32217. ? ''
  32218. : 'obj || (obj = {});\n'
  32219. ) +
  32220. "var __t, __p = ''" +
  32221. (isEscaping
  32222. ? ', __e = _.escape'
  32223. : ''
  32224. ) +
  32225. (isEvaluating
  32226. ? ', __j = Array.prototype.join;\n' +
  32227. "function print() { __p += __j.call(arguments, '') }\n"
  32228. : ';\n'
  32229. ) +
  32230. source +
  32231. 'return __p\n}';
  32232. var result = attempt(function() {
  32233. return Function(importsKeys, sourceURL + 'return ' + source)
  32234. .apply(undefined, importsValues);
  32235. });
  32236. // Provide the compiled function's source by its `toString` method or
  32237. // the `source` property as a convenience for inlining compiled templates.
  32238. result.source = source;
  32239. if (isError(result)) {
  32240. throw result;
  32241. }
  32242. return result;
  32243. }
  32244. /**
  32245. * Converts `string`, as a whole, to lower case just like
  32246. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32247. *
  32248. * @static
  32249. * @memberOf _
  32250. * @since 4.0.0
  32251. * @category String
  32252. * @param {string} [string=''] The string to convert.
  32253. * @returns {string} Returns the lower cased string.
  32254. * @example
  32255. *
  32256. * _.toLower('--Foo-Bar--');
  32257. * // => '--foo-bar--'
  32258. *
  32259. * _.toLower('fooBar');
  32260. * // => 'foobar'
  32261. *
  32262. * _.toLower('__FOO_BAR__');
  32263. * // => '__foo_bar__'
  32264. */
  32265. function toLower(value) {
  32266. return toString(value).toLowerCase();
  32267. }
  32268. /**
  32269. * Converts `string`, as a whole, to upper case just like
  32270. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32271. *
  32272. * @static
  32273. * @memberOf _
  32274. * @since 4.0.0
  32275. * @category String
  32276. * @param {string} [string=''] The string to convert.
  32277. * @returns {string} Returns the upper cased string.
  32278. * @example
  32279. *
  32280. * _.toUpper('--foo-bar--');
  32281. * // => '--FOO-BAR--'
  32282. *
  32283. * _.toUpper('fooBar');
  32284. * // => 'FOOBAR'
  32285. *
  32286. * _.toUpper('__foo_bar__');
  32287. * // => '__FOO_BAR__'
  32288. */
  32289. function toUpper(value) {
  32290. return toString(value).toUpperCase();
  32291. }
  32292. /**
  32293. * Removes leading and trailing whitespace or specified characters from `string`.
  32294. *
  32295. * @static
  32296. * @memberOf _
  32297. * @since 3.0.0
  32298. * @category String
  32299. * @param {string} [string=''] The string to trim.
  32300. * @param {string} [chars=whitespace] The characters to trim.
  32301. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32302. * @returns {string} Returns the trimmed string.
  32303. * @example
  32304. *
  32305. * _.trim(' abc ');
  32306. * // => 'abc'
  32307. *
  32308. * _.trim('-_-abc-_-', '_-');
  32309. * // => 'abc'
  32310. *
  32311. * _.map([' foo ', ' bar '], _.trim);
  32312. * // => ['foo', 'bar']
  32313. */
  32314. function trim(string, chars, guard) {
  32315. string = toString(string);
  32316. if (string && (guard || chars === undefined)) {
  32317. return string.replace(reTrim, '');
  32318. }
  32319. if (!string || !(chars = baseToString(chars))) {
  32320. return string;
  32321. }
  32322. var strSymbols = stringToArray(string),
  32323. chrSymbols = stringToArray(chars),
  32324. start = charsStartIndex(strSymbols, chrSymbols),
  32325. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32326. return castSlice(strSymbols, start, end).join('');
  32327. }
  32328. /**
  32329. * Removes trailing whitespace or specified characters from `string`.
  32330. *
  32331. * @static
  32332. * @memberOf _
  32333. * @since 4.0.0
  32334. * @category String
  32335. * @param {string} [string=''] The string to trim.
  32336. * @param {string} [chars=whitespace] The characters to trim.
  32337. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32338. * @returns {string} Returns the trimmed string.
  32339. * @example
  32340. *
  32341. * _.trimEnd(' abc ');
  32342. * // => ' abc'
  32343. *
  32344. * _.trimEnd('-_-abc-_-', '_-');
  32345. * // => '-_-abc'
  32346. */
  32347. function trimEnd(string, chars, guard) {
  32348. string = toString(string);
  32349. if (string && (guard || chars === undefined)) {
  32350. return string.replace(reTrimEnd, '');
  32351. }
  32352. if (!string || !(chars = baseToString(chars))) {
  32353. return string;
  32354. }
  32355. var strSymbols = stringToArray(string),
  32356. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32357. return castSlice(strSymbols, 0, end).join('');
  32358. }
  32359. /**
  32360. * Removes leading whitespace or specified characters from `string`.
  32361. *
  32362. * @static
  32363. * @memberOf _
  32364. * @since 4.0.0
  32365. * @category String
  32366. * @param {string} [string=''] The string to trim.
  32367. * @param {string} [chars=whitespace] The characters to trim.
  32368. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32369. * @returns {string} Returns the trimmed string.
  32370. * @example
  32371. *
  32372. * _.trimStart(' abc ');
  32373. * // => 'abc '
  32374. *
  32375. * _.trimStart('-_-abc-_-', '_-');
  32376. * // => 'abc-_-'
  32377. */
  32378. function trimStart(string, chars, guard) {
  32379. string = toString(string);
  32380. if (string && (guard || chars === undefined)) {
  32381. return string.replace(reTrimStart, '');
  32382. }
  32383. if (!string || !(chars = baseToString(chars))) {
  32384. return string;
  32385. }
  32386. var strSymbols = stringToArray(string),
  32387. start = charsStartIndex(strSymbols, stringToArray(chars));
  32388. return castSlice(strSymbols, start).join('');
  32389. }
  32390. /**
  32391. * Truncates `string` if it's longer than the given maximum string length.
  32392. * The last characters of the truncated string are replaced with the omission
  32393. * string which defaults to "...".
  32394. *
  32395. * @static
  32396. * @memberOf _
  32397. * @since 4.0.0
  32398. * @category String
  32399. * @param {string} [string=''] The string to truncate.
  32400. * @param {Object} [options={}] The options object.
  32401. * @param {number} [options.length=30] The maximum string length.
  32402. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32403. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32404. * @returns {string} Returns the truncated string.
  32405. * @example
  32406. *
  32407. * _.truncate('hi-diddly-ho there, neighborino');
  32408. * // => 'hi-diddly-ho there, neighbo...'
  32409. *
  32410. * _.truncate('hi-diddly-ho there, neighborino', {
  32411. * 'length': 24,
  32412. * 'separator': ' '
  32413. * });
  32414. * // => 'hi-diddly-ho there,...'
  32415. *
  32416. * _.truncate('hi-diddly-ho there, neighborino', {
  32417. * 'length': 24,
  32418. * 'separator': /,? +/
  32419. * });
  32420. * // => 'hi-diddly-ho there...'
  32421. *
  32422. * _.truncate('hi-diddly-ho there, neighborino', {
  32423. * 'omission': ' [...]'
  32424. * });
  32425. * // => 'hi-diddly-ho there, neig [...]'
  32426. */
  32427. function truncate(string, options) {
  32428. var length = DEFAULT_TRUNC_LENGTH,
  32429. omission = DEFAULT_TRUNC_OMISSION;
  32430. if (isObject(options)) {
  32431. var separator = 'separator' in options ? options.separator : separator;
  32432. length = 'length' in options ? toInteger(options.length) : length;
  32433. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32434. }
  32435. string = toString(string);
  32436. var strLength = string.length;
  32437. if (hasUnicode(string)) {
  32438. var strSymbols = stringToArray(string);
  32439. strLength = strSymbols.length;
  32440. }
  32441. if (length >= strLength) {
  32442. return string;
  32443. }
  32444. var end = length - stringSize(omission);
  32445. if (end < 1) {
  32446. return omission;
  32447. }
  32448. var result = strSymbols
  32449. ? castSlice(strSymbols, 0, end).join('')
  32450. : string.slice(0, end);
  32451. if (separator === undefined) {
  32452. return result + omission;
  32453. }
  32454. if (strSymbols) {
  32455. end += (result.length - end);
  32456. }
  32457. if (isRegExp(separator)) {
  32458. if (string.slice(end).search(separator)) {
  32459. var match,
  32460. substring = result;
  32461. if (!separator.global) {
  32462. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32463. }
  32464. separator.lastIndex = 0;
  32465. while ((match = separator.exec(substring))) {
  32466. var newEnd = match.index;
  32467. }
  32468. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32469. }
  32470. } else if (string.indexOf(baseToString(separator), end) != end) {
  32471. var index = result.lastIndexOf(separator);
  32472. if (index > -1) {
  32473. result = result.slice(0, index);
  32474. }
  32475. }
  32476. return result + omission;
  32477. }
  32478. /**
  32479. * The inverse of `_.escape`; this method converts the HTML entities
  32480. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32481. * their corresponding characters.
  32482. *
  32483. * **Note:** No other HTML entities are unescaped. To unescape additional
  32484. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32485. *
  32486. * @static
  32487. * @memberOf _
  32488. * @since 0.6.0
  32489. * @category String
  32490. * @param {string} [string=''] The string to unescape.
  32491. * @returns {string} Returns the unescaped string.
  32492. * @example
  32493. *
  32494. * _.unescape('fred, barney, &amp; pebbles');
  32495. * // => 'fred, barney, & pebbles'
  32496. */
  32497. function unescape(string) {
  32498. string = toString(string);
  32499. return (string && reHasEscapedHtml.test(string))
  32500. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32501. : string;
  32502. }
  32503. /**
  32504. * Converts `string`, as space separated words, to upper case.
  32505. *
  32506. * @static
  32507. * @memberOf _
  32508. * @since 4.0.0
  32509. * @category String
  32510. * @param {string} [string=''] The string to convert.
  32511. * @returns {string} Returns the upper cased string.
  32512. * @example
  32513. *
  32514. * _.upperCase('--foo-bar');
  32515. * // => 'FOO BAR'
  32516. *
  32517. * _.upperCase('fooBar');
  32518. * // => 'FOO BAR'
  32519. *
  32520. * _.upperCase('__foo_bar__');
  32521. * // => 'FOO BAR'
  32522. */
  32523. var upperCase = createCompounder(function(result, word, index) {
  32524. return result + (index ? ' ' : '') + word.toUpperCase();
  32525. });
  32526. /**
  32527. * Converts the first character of `string` to upper case.
  32528. *
  32529. * @static
  32530. * @memberOf _
  32531. * @since 4.0.0
  32532. * @category String
  32533. * @param {string} [string=''] The string to convert.
  32534. * @returns {string} Returns the converted string.
  32535. * @example
  32536. *
  32537. * _.upperFirst('fred');
  32538. * // => 'Fred'
  32539. *
  32540. * _.upperFirst('FRED');
  32541. * // => 'FRED'
  32542. */
  32543. var upperFirst = createCaseFirst('toUpperCase');
  32544. /**
  32545. * Splits `string` into an array of its words.
  32546. *
  32547. * @static
  32548. * @memberOf _
  32549. * @since 3.0.0
  32550. * @category String
  32551. * @param {string} [string=''] The string to inspect.
  32552. * @param {RegExp|string} [pattern] The pattern to match words.
  32553. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32554. * @returns {Array} Returns the words of `string`.
  32555. * @example
  32556. *
  32557. * _.words('fred, barney, & pebbles');
  32558. * // => ['fred', 'barney', 'pebbles']
  32559. *
  32560. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32561. * // => ['fred', 'barney', '&', 'pebbles']
  32562. */
  32563. function words(string, pattern, guard) {
  32564. string = toString(string);
  32565. pattern = guard ? undefined : pattern;
  32566. if (pattern === undefined) {
  32567. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32568. }
  32569. return string.match(pattern) || [];
  32570. }
  32571. /*------------------------------------------------------------------------*/
  32572. /**
  32573. * Attempts to invoke `func`, returning either the result or the caught error
  32574. * object. Any additional arguments are provided to `func` when it's invoked.
  32575. *
  32576. * @static
  32577. * @memberOf _
  32578. * @since 3.0.0
  32579. * @category Util
  32580. * @param {Function} func The function to attempt.
  32581. * @param {...*} [args] The arguments to invoke `func` with.
  32582. * @returns {*} Returns the `func` result or error object.
  32583. * @example
  32584. *
  32585. * // Avoid throwing errors for invalid selectors.
  32586. * var elements = _.attempt(function(selector) {
  32587. * return document.querySelectorAll(selector);
  32588. * }, '>_>');
  32589. *
  32590. * if (_.isError(elements)) {
  32591. * elements = [];
  32592. * }
  32593. */
  32594. var attempt = baseRest(function(func, args) {
  32595. try {
  32596. return apply(func, undefined, args);
  32597. } catch (e) {
  32598. return isError(e) ? e : new Error(e);
  32599. }
  32600. });
  32601. /**
  32602. * Binds methods of an object to the object itself, overwriting the existing
  32603. * method.
  32604. *
  32605. * **Note:** This method doesn't set the "length" property of bound functions.
  32606. *
  32607. * @static
  32608. * @since 0.1.0
  32609. * @memberOf _
  32610. * @category Util
  32611. * @param {Object} object The object to bind and assign the bound methods to.
  32612. * @param {...(string|string[])} methodNames The object method names to bind.
  32613. * @returns {Object} Returns `object`.
  32614. * @example
  32615. *
  32616. * var view = {
  32617. * 'label': 'docs',
  32618. * 'click': function() {
  32619. * console.log('clicked ' + this.label);
  32620. * }
  32621. * };
  32622. *
  32623. * _.bindAll(view, ['click']);
  32624. * jQuery(element).on('click', view.click);
  32625. * // => Logs 'clicked docs' when clicked.
  32626. */
  32627. var bindAll = flatRest(function(object, methodNames) {
  32628. arrayEach(methodNames, function(key) {
  32629. key = toKey(key);
  32630. baseAssignValue(object, key, bind(object[key], object));
  32631. });
  32632. return object;
  32633. });
  32634. /**
  32635. * Creates a function that iterates over `pairs` and invokes the corresponding
  32636. * function of the first predicate to return truthy. The predicate-function
  32637. * pairs are invoked with the `this` binding and arguments of the created
  32638. * function.
  32639. *
  32640. * @static
  32641. * @memberOf _
  32642. * @since 4.0.0
  32643. * @category Util
  32644. * @param {Array} pairs The predicate-function pairs.
  32645. * @returns {Function} Returns the new composite function.
  32646. * @example
  32647. *
  32648. * var func = _.cond([
  32649. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32650. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32651. * [_.stubTrue, _.constant('no match')]
  32652. * ]);
  32653. *
  32654. * func({ 'a': 1, 'b': 2 });
  32655. * // => 'matches A'
  32656. *
  32657. * func({ 'a': 0, 'b': 1 });
  32658. * // => 'matches B'
  32659. *
  32660. * func({ 'a': '1', 'b': '2' });
  32661. * // => 'no match'
  32662. */
  32663. function cond(pairs) {
  32664. var length = pairs == null ? 0 : pairs.length,
  32665. toIteratee = getIteratee();
  32666. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32667. if (typeof pair[1] != 'function') {
  32668. throw new TypeError(FUNC_ERROR_TEXT);
  32669. }
  32670. return [toIteratee(pair[0]), pair[1]];
  32671. });
  32672. return baseRest(function(args) {
  32673. var index = -1;
  32674. while (++index < length) {
  32675. var pair = pairs[index];
  32676. if (apply(pair[0], this, args)) {
  32677. return apply(pair[1], this, args);
  32678. }
  32679. }
  32680. });
  32681. }
  32682. /**
  32683. * Creates a function that invokes the predicate properties of `source` with
  32684. * the corresponding property values of a given object, returning `true` if
  32685. * all predicates return truthy, else `false`.
  32686. *
  32687. * **Note:** The created function is equivalent to `_.conformsTo` with
  32688. * `source` partially applied.
  32689. *
  32690. * @static
  32691. * @memberOf _
  32692. * @since 4.0.0
  32693. * @category Util
  32694. * @param {Object} source The object of property predicates to conform to.
  32695. * @returns {Function} Returns the new spec function.
  32696. * @example
  32697. *
  32698. * var objects = [
  32699. * { 'a': 2, 'b': 1 },
  32700. * { 'a': 1, 'b': 2 }
  32701. * ];
  32702. *
  32703. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32704. * // => [{ 'a': 1, 'b': 2 }]
  32705. */
  32706. function conforms(source) {
  32707. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32708. }
  32709. /**
  32710. * Creates a function that returns `value`.
  32711. *
  32712. * @static
  32713. * @memberOf _
  32714. * @since 2.4.0
  32715. * @category Util
  32716. * @param {*} value The value to return from the new function.
  32717. * @returns {Function} Returns the new constant function.
  32718. * @example
  32719. *
  32720. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32721. *
  32722. * console.log(objects);
  32723. * // => [{ 'a': 1 }, { 'a': 1 }]
  32724. *
  32725. * console.log(objects[0] === objects[1]);
  32726. * // => true
  32727. */
  32728. function constant(value) {
  32729. return function() {
  32730. return value;
  32731. };
  32732. }
  32733. /**
  32734. * Checks `value` to determine whether a default value should be returned in
  32735. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32736. * or `undefined`.
  32737. *
  32738. * @static
  32739. * @memberOf _
  32740. * @since 4.14.0
  32741. * @category Util
  32742. * @param {*} value The value to check.
  32743. * @param {*} defaultValue The default value.
  32744. * @returns {*} Returns the resolved value.
  32745. * @example
  32746. *
  32747. * _.defaultTo(1, 10);
  32748. * // => 1
  32749. *
  32750. * _.defaultTo(undefined, 10);
  32751. * // => 10
  32752. */
  32753. function defaultTo(value, defaultValue) {
  32754. return (value == null || value !== value) ? defaultValue : value;
  32755. }
  32756. /**
  32757. * Creates a function that returns the result of invoking the given functions
  32758. * with the `this` binding of the created function, where each successive
  32759. * invocation is supplied the return value of the previous.
  32760. *
  32761. * @static
  32762. * @memberOf _
  32763. * @since 3.0.0
  32764. * @category Util
  32765. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32766. * @returns {Function} Returns the new composite function.
  32767. * @see _.flowRight
  32768. * @example
  32769. *
  32770. * function square(n) {
  32771. * return n * n;
  32772. * }
  32773. *
  32774. * var addSquare = _.flow([_.add, square]);
  32775. * addSquare(1, 2);
  32776. * // => 9
  32777. */
  32778. var flow = createFlow();
  32779. /**
  32780. * This method is like `_.flow` except that it creates a function that
  32781. * invokes the given functions from right to left.
  32782. *
  32783. * @static
  32784. * @since 3.0.0
  32785. * @memberOf _
  32786. * @category Util
  32787. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32788. * @returns {Function} Returns the new composite function.
  32789. * @see _.flow
  32790. * @example
  32791. *
  32792. * function square(n) {
  32793. * return n * n;
  32794. * }
  32795. *
  32796. * var addSquare = _.flowRight([square, _.add]);
  32797. * addSquare(1, 2);
  32798. * // => 9
  32799. */
  32800. var flowRight = createFlow(true);
  32801. /**
  32802. * This method returns the first argument it receives.
  32803. *
  32804. * @static
  32805. * @since 0.1.0
  32806. * @memberOf _
  32807. * @category Util
  32808. * @param {*} value Any value.
  32809. * @returns {*} Returns `value`.
  32810. * @example
  32811. *
  32812. * var object = { 'a': 1 };
  32813. *
  32814. * console.log(_.identity(object) === object);
  32815. * // => true
  32816. */
  32817. function identity(value) {
  32818. return value;
  32819. }
  32820. /**
  32821. * Creates a function that invokes `func` with the arguments of the created
  32822. * function. If `func` is a property name, the created function returns the
  32823. * property value for a given element. If `func` is an array or object, the
  32824. * created function returns `true` for elements that contain the equivalent
  32825. * source properties, otherwise it returns `false`.
  32826. *
  32827. * @static
  32828. * @since 4.0.0
  32829. * @memberOf _
  32830. * @category Util
  32831. * @param {*} [func=_.identity] The value to convert to a callback.
  32832. * @returns {Function} Returns the callback.
  32833. * @example
  32834. *
  32835. * var users = [
  32836. * { 'user': 'barney', 'age': 36, 'active': true },
  32837. * { 'user': 'fred', 'age': 40, 'active': false }
  32838. * ];
  32839. *
  32840. * // The `_.matches` iteratee shorthand.
  32841. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32842. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32843. *
  32844. * // The `_.matchesProperty` iteratee shorthand.
  32845. * _.filter(users, _.iteratee(['user', 'fred']));
  32846. * // => [{ 'user': 'fred', 'age': 40 }]
  32847. *
  32848. * // The `_.property` iteratee shorthand.
  32849. * _.map(users, _.iteratee('user'));
  32850. * // => ['barney', 'fred']
  32851. *
  32852. * // Create custom iteratee shorthands.
  32853. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32854. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32855. * return func.test(string);
  32856. * };
  32857. * });
  32858. *
  32859. * _.filter(['abc', 'def'], /ef/);
  32860. * // => ['def']
  32861. */
  32862. function iteratee(func) {
  32863. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32864. }
  32865. /**
  32866. * Creates a function that performs a partial deep comparison between a given
  32867. * object and `source`, returning `true` if the given object has equivalent
  32868. * property values, else `false`.
  32869. *
  32870. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32871. * partially applied.
  32872. *
  32873. * Partial comparisons will match empty array and empty object `source`
  32874. * values against any array or object value, respectively. See `_.isEqual`
  32875. * for a list of supported value comparisons.
  32876. *
  32877. * @static
  32878. * @memberOf _
  32879. * @since 3.0.0
  32880. * @category Util
  32881. * @param {Object} source The object of property values to match.
  32882. * @returns {Function} Returns the new spec function.
  32883. * @example
  32884. *
  32885. * var objects = [
  32886. * { 'a': 1, 'b': 2, 'c': 3 },
  32887. * { 'a': 4, 'b': 5, 'c': 6 }
  32888. * ];
  32889. *
  32890. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32891. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32892. */
  32893. function matches(source) {
  32894. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32895. }
  32896. /**
  32897. * Creates a function that performs a partial deep comparison between the
  32898. * value at `path` of a given object to `srcValue`, returning `true` if the
  32899. * object value is equivalent, else `false`.
  32900. *
  32901. * **Note:** Partial comparisons will match empty array and empty object
  32902. * `srcValue` values against any array or object value, respectively. See
  32903. * `_.isEqual` for a list of supported value comparisons.
  32904. *
  32905. * @static
  32906. * @memberOf _
  32907. * @since 3.2.0
  32908. * @category Util
  32909. * @param {Array|string} path The path of the property to get.
  32910. * @param {*} srcValue The value to match.
  32911. * @returns {Function} Returns the new spec function.
  32912. * @example
  32913. *
  32914. * var objects = [
  32915. * { 'a': 1, 'b': 2, 'c': 3 },
  32916. * { 'a': 4, 'b': 5, 'c': 6 }
  32917. * ];
  32918. *
  32919. * _.find(objects, _.matchesProperty('a', 4));
  32920. * // => { 'a': 4, 'b': 5, 'c': 6 }
  32921. */
  32922. function matchesProperty(path, srcValue) {
  32923. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  32924. }
  32925. /**
  32926. * Creates a function that invokes the method at `path` of a given object.
  32927. * Any additional arguments are provided to the invoked method.
  32928. *
  32929. * @static
  32930. * @memberOf _
  32931. * @since 3.7.0
  32932. * @category Util
  32933. * @param {Array|string} path The path of the method to invoke.
  32934. * @param {...*} [args] The arguments to invoke the method with.
  32935. * @returns {Function} Returns the new invoker function.
  32936. * @example
  32937. *
  32938. * var objects = [
  32939. * { 'a': { 'b': _.constant(2) } },
  32940. * { 'a': { 'b': _.constant(1) } }
  32941. * ];
  32942. *
  32943. * _.map(objects, _.method('a.b'));
  32944. * // => [2, 1]
  32945. *
  32946. * _.map(objects, _.method(['a', 'b']));
  32947. * // => [2, 1]
  32948. */
  32949. var method = baseRest(function(path, args) {
  32950. return function(object) {
  32951. return baseInvoke(object, path, args);
  32952. };
  32953. });
  32954. /**
  32955. * The opposite of `_.method`; this method creates a function that invokes
  32956. * the method at a given path of `object`. Any additional arguments are
  32957. * provided to the invoked method.
  32958. *
  32959. * @static
  32960. * @memberOf _
  32961. * @since 3.7.0
  32962. * @category Util
  32963. * @param {Object} object The object to query.
  32964. * @param {...*} [args] The arguments to invoke the method with.
  32965. * @returns {Function} Returns the new invoker function.
  32966. * @example
  32967. *
  32968. * var array = _.times(3, _.constant),
  32969. * object = { 'a': array, 'b': array, 'c': array };
  32970. *
  32971. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  32972. * // => [2, 0]
  32973. *
  32974. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  32975. * // => [2, 0]
  32976. */
  32977. var methodOf = baseRest(function(object, args) {
  32978. return function(path) {
  32979. return baseInvoke(object, path, args);
  32980. };
  32981. });
  32982. /**
  32983. * Adds all own enumerable string keyed function properties of a source
  32984. * object to the destination object. If `object` is a function, then methods
  32985. * are added to its prototype as well.
  32986. *
  32987. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  32988. * avoid conflicts caused by modifying the original.
  32989. *
  32990. * @static
  32991. * @since 0.1.0
  32992. * @memberOf _
  32993. * @category Util
  32994. * @param {Function|Object} [object=lodash] The destination object.
  32995. * @param {Object} source The object of functions to add.
  32996. * @param {Object} [options={}] The options object.
  32997. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  32998. * @returns {Function|Object} Returns `object`.
  32999. * @example
  33000. *
  33001. * function vowels(string) {
  33002. * return _.filter(string, function(v) {
  33003. * return /[aeiou]/i.test(v);
  33004. * });
  33005. * }
  33006. *
  33007. * _.mixin({ 'vowels': vowels });
  33008. * _.vowels('fred');
  33009. * // => ['e']
  33010. *
  33011. * _('fred').vowels().value();
  33012. * // => ['e']
  33013. *
  33014. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33015. * _('fred').vowels();
  33016. * // => ['e']
  33017. */
  33018. function mixin(object, source, options) {
  33019. var props = keys(source),
  33020. methodNames = baseFunctions(source, props);
  33021. if (options == null &&
  33022. !(isObject(source) && (methodNames.length || !props.length))) {
  33023. options = source;
  33024. source = object;
  33025. object = this;
  33026. methodNames = baseFunctions(source, keys(source));
  33027. }
  33028. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33029. isFunc = isFunction(object);
  33030. arrayEach(methodNames, function(methodName) {
  33031. var func = source[methodName];
  33032. object[methodName] = func;
  33033. if (isFunc) {
  33034. object.prototype[methodName] = function() {
  33035. var chainAll = this.__chain__;
  33036. if (chain || chainAll) {
  33037. var result = object(this.__wrapped__),
  33038. actions = result.__actions__ = copyArray(this.__actions__);
  33039. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33040. result.__chain__ = chainAll;
  33041. return result;
  33042. }
  33043. return func.apply(object, arrayPush([this.value()], arguments));
  33044. };
  33045. }
  33046. });
  33047. return object;
  33048. }
  33049. /**
  33050. * Reverts the `_` variable to its previous value and returns a reference to
  33051. * the `lodash` function.
  33052. *
  33053. * @static
  33054. * @since 0.1.0
  33055. * @memberOf _
  33056. * @category Util
  33057. * @returns {Function} Returns the `lodash` function.
  33058. * @example
  33059. *
  33060. * var lodash = _.noConflict();
  33061. */
  33062. function noConflict() {
  33063. if (root._ === this) {
  33064. root._ = oldDash;
  33065. }
  33066. return this;
  33067. }
  33068. /**
  33069. * This method returns `undefined`.
  33070. *
  33071. * @static
  33072. * @memberOf _
  33073. * @since 2.3.0
  33074. * @category Util
  33075. * @example
  33076. *
  33077. * _.times(2, _.noop);
  33078. * // => [undefined, undefined]
  33079. */
  33080. function noop() {
  33081. // No operation performed.
  33082. }
  33083. /**
  33084. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33085. * the nth argument from the end is returned.
  33086. *
  33087. * @static
  33088. * @memberOf _
  33089. * @since 4.0.0
  33090. * @category Util
  33091. * @param {number} [n=0] The index of the argument to return.
  33092. * @returns {Function} Returns the new pass-thru function.
  33093. * @example
  33094. *
  33095. * var func = _.nthArg(1);
  33096. * func('a', 'b', 'c', 'd');
  33097. * // => 'b'
  33098. *
  33099. * var func = _.nthArg(-2);
  33100. * func('a', 'b', 'c', 'd');
  33101. * // => 'c'
  33102. */
  33103. function nthArg(n) {
  33104. n = toInteger(n);
  33105. return baseRest(function(args) {
  33106. return baseNth(args, n);
  33107. });
  33108. }
  33109. /**
  33110. * Creates a function that invokes `iteratees` with the arguments it receives
  33111. * and returns their results.
  33112. *
  33113. * @static
  33114. * @memberOf _
  33115. * @since 4.0.0
  33116. * @category Util
  33117. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33118. * The iteratees to invoke.
  33119. * @returns {Function} Returns the new function.
  33120. * @example
  33121. *
  33122. * var func = _.over([Math.max, Math.min]);
  33123. *
  33124. * func(1, 2, 3, 4);
  33125. * // => [4, 1]
  33126. */
  33127. var over = createOver(arrayMap);
  33128. /**
  33129. * Creates a function that checks if **all** of the `predicates` return
  33130. * truthy when invoked with the arguments it receives.
  33131. *
  33132. * @static
  33133. * @memberOf _
  33134. * @since 4.0.0
  33135. * @category Util
  33136. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33137. * The predicates to check.
  33138. * @returns {Function} Returns the new function.
  33139. * @example
  33140. *
  33141. * var func = _.overEvery([Boolean, isFinite]);
  33142. *
  33143. * func('1');
  33144. * // => true
  33145. *
  33146. * func(null);
  33147. * // => false
  33148. *
  33149. * func(NaN);
  33150. * // => false
  33151. */
  33152. var overEvery = createOver(arrayEvery);
  33153. /**
  33154. * Creates a function that checks if **any** of the `predicates` return
  33155. * truthy when invoked with the arguments it receives.
  33156. *
  33157. * @static
  33158. * @memberOf _
  33159. * @since 4.0.0
  33160. * @category Util
  33161. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33162. * The predicates to check.
  33163. * @returns {Function} Returns the new function.
  33164. * @example
  33165. *
  33166. * var func = _.overSome([Boolean, isFinite]);
  33167. *
  33168. * func('1');
  33169. * // => true
  33170. *
  33171. * func(null);
  33172. * // => true
  33173. *
  33174. * func(NaN);
  33175. * // => false
  33176. */
  33177. var overSome = createOver(arraySome);
  33178. /**
  33179. * Creates a function that returns the value at `path` of a given object.
  33180. *
  33181. * @static
  33182. * @memberOf _
  33183. * @since 2.4.0
  33184. * @category Util
  33185. * @param {Array|string} path The path of the property to get.
  33186. * @returns {Function} Returns the new accessor function.
  33187. * @example
  33188. *
  33189. * var objects = [
  33190. * { 'a': { 'b': 2 } },
  33191. * { 'a': { 'b': 1 } }
  33192. * ];
  33193. *
  33194. * _.map(objects, _.property('a.b'));
  33195. * // => [2, 1]
  33196. *
  33197. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33198. * // => [1, 2]
  33199. */
  33200. function property(path) {
  33201. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33202. }
  33203. /**
  33204. * The opposite of `_.property`; this method creates a function that returns
  33205. * the value at a given path of `object`.
  33206. *
  33207. * @static
  33208. * @memberOf _
  33209. * @since 3.0.0
  33210. * @category Util
  33211. * @param {Object} object The object to query.
  33212. * @returns {Function} Returns the new accessor function.
  33213. * @example
  33214. *
  33215. * var array = [0, 1, 2],
  33216. * object = { 'a': array, 'b': array, 'c': array };
  33217. *
  33218. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33219. * // => [2, 0]
  33220. *
  33221. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33222. * // => [2, 0]
  33223. */
  33224. function propertyOf(object) {
  33225. return function(path) {
  33226. return object == null ? undefined : baseGet(object, path);
  33227. };
  33228. }
  33229. /**
  33230. * Creates an array of numbers (positive and/or negative) progressing from
  33231. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33232. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33233. * it's set to `start` with `start` then set to `0`.
  33234. *
  33235. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33236. * floating-point values which can produce unexpected results.
  33237. *
  33238. * @static
  33239. * @since 0.1.0
  33240. * @memberOf _
  33241. * @category Util
  33242. * @param {number} [start=0] The start of the range.
  33243. * @param {number} end The end of the range.
  33244. * @param {number} [step=1] The value to increment or decrement by.
  33245. * @returns {Array} Returns the range of numbers.
  33246. * @see _.inRange, _.rangeRight
  33247. * @example
  33248. *
  33249. * _.range(4);
  33250. * // => [0, 1, 2, 3]
  33251. *
  33252. * _.range(-4);
  33253. * // => [0, -1, -2, -3]
  33254. *
  33255. * _.range(1, 5);
  33256. * // => [1, 2, 3, 4]
  33257. *
  33258. * _.range(0, 20, 5);
  33259. * // => [0, 5, 10, 15]
  33260. *
  33261. * _.range(0, -4, -1);
  33262. * // => [0, -1, -2, -3]
  33263. *
  33264. * _.range(1, 4, 0);
  33265. * // => [1, 1, 1]
  33266. *
  33267. * _.range(0);
  33268. * // => []
  33269. */
  33270. var range = createRange();
  33271. /**
  33272. * This method is like `_.range` except that it populates values in
  33273. * descending order.
  33274. *
  33275. * @static
  33276. * @memberOf _
  33277. * @since 4.0.0
  33278. * @category Util
  33279. * @param {number} [start=0] The start of the range.
  33280. * @param {number} end The end of the range.
  33281. * @param {number} [step=1] The value to increment or decrement by.
  33282. * @returns {Array} Returns the range of numbers.
  33283. * @see _.inRange, _.range
  33284. * @example
  33285. *
  33286. * _.rangeRight(4);
  33287. * // => [3, 2, 1, 0]
  33288. *
  33289. * _.rangeRight(-4);
  33290. * // => [-3, -2, -1, 0]
  33291. *
  33292. * _.rangeRight(1, 5);
  33293. * // => [4, 3, 2, 1]
  33294. *
  33295. * _.rangeRight(0, 20, 5);
  33296. * // => [15, 10, 5, 0]
  33297. *
  33298. * _.rangeRight(0, -4, -1);
  33299. * // => [-3, -2, -1, 0]
  33300. *
  33301. * _.rangeRight(1, 4, 0);
  33302. * // => [1, 1, 1]
  33303. *
  33304. * _.rangeRight(0);
  33305. * // => []
  33306. */
  33307. var rangeRight = createRange(true);
  33308. /**
  33309. * This method returns a new empty array.
  33310. *
  33311. * @static
  33312. * @memberOf _
  33313. * @since 4.13.0
  33314. * @category Util
  33315. * @returns {Array} Returns the new empty array.
  33316. * @example
  33317. *
  33318. * var arrays = _.times(2, _.stubArray);
  33319. *
  33320. * console.log(arrays);
  33321. * // => [[], []]
  33322. *
  33323. * console.log(arrays[0] === arrays[1]);
  33324. * // => false
  33325. */
  33326. function stubArray() {
  33327. return [];
  33328. }
  33329. /**
  33330. * This method returns `false`.
  33331. *
  33332. * @static
  33333. * @memberOf _
  33334. * @since 4.13.0
  33335. * @category Util
  33336. * @returns {boolean} Returns `false`.
  33337. * @example
  33338. *
  33339. * _.times(2, _.stubFalse);
  33340. * // => [false, false]
  33341. */
  33342. function stubFalse() {
  33343. return false;
  33344. }
  33345. /**
  33346. * This method returns a new empty object.
  33347. *
  33348. * @static
  33349. * @memberOf _
  33350. * @since 4.13.0
  33351. * @category Util
  33352. * @returns {Object} Returns the new empty object.
  33353. * @example
  33354. *
  33355. * var objects = _.times(2, _.stubObject);
  33356. *
  33357. * console.log(objects);
  33358. * // => [{}, {}]
  33359. *
  33360. * console.log(objects[0] === objects[1]);
  33361. * // => false
  33362. */
  33363. function stubObject() {
  33364. return {};
  33365. }
  33366. /**
  33367. * This method returns an empty string.
  33368. *
  33369. * @static
  33370. * @memberOf _
  33371. * @since 4.13.0
  33372. * @category Util
  33373. * @returns {string} Returns the empty string.
  33374. * @example
  33375. *
  33376. * _.times(2, _.stubString);
  33377. * // => ['', '']
  33378. */
  33379. function stubString() {
  33380. return '';
  33381. }
  33382. /**
  33383. * This method returns `true`.
  33384. *
  33385. * @static
  33386. * @memberOf _
  33387. * @since 4.13.0
  33388. * @category Util
  33389. * @returns {boolean} Returns `true`.
  33390. * @example
  33391. *
  33392. * _.times(2, _.stubTrue);
  33393. * // => [true, true]
  33394. */
  33395. function stubTrue() {
  33396. return true;
  33397. }
  33398. /**
  33399. * Invokes the iteratee `n` times, returning an array of the results of
  33400. * each invocation. The iteratee is invoked with one argument; (index).
  33401. *
  33402. * @static
  33403. * @since 0.1.0
  33404. * @memberOf _
  33405. * @category Util
  33406. * @param {number} n The number of times to invoke `iteratee`.
  33407. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33408. * @returns {Array} Returns the array of results.
  33409. * @example
  33410. *
  33411. * _.times(3, String);
  33412. * // => ['0', '1', '2']
  33413. *
  33414. * _.times(4, _.constant(0));
  33415. * // => [0, 0, 0, 0]
  33416. */
  33417. function times(n, iteratee) {
  33418. n = toInteger(n);
  33419. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33420. return [];
  33421. }
  33422. var index = MAX_ARRAY_LENGTH,
  33423. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33424. iteratee = getIteratee(iteratee);
  33425. n -= MAX_ARRAY_LENGTH;
  33426. var result = baseTimes(length, iteratee);
  33427. while (++index < n) {
  33428. iteratee(index);
  33429. }
  33430. return result;
  33431. }
  33432. /**
  33433. * Converts `value` to a property path array.
  33434. *
  33435. * @static
  33436. * @memberOf _
  33437. * @since 4.0.0
  33438. * @category Util
  33439. * @param {*} value The value to convert.
  33440. * @returns {Array} Returns the new property path array.
  33441. * @example
  33442. *
  33443. * _.toPath('a.b.c');
  33444. * // => ['a', 'b', 'c']
  33445. *
  33446. * _.toPath('a[0].b.c');
  33447. * // => ['a', '0', 'b', 'c']
  33448. */
  33449. function toPath(value) {
  33450. if (isArray(value)) {
  33451. return arrayMap(value, toKey);
  33452. }
  33453. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33454. }
  33455. /**
  33456. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33457. *
  33458. * @static
  33459. * @since 0.1.0
  33460. * @memberOf _
  33461. * @category Util
  33462. * @param {string} [prefix=''] The value to prefix the ID with.
  33463. * @returns {string} Returns the unique ID.
  33464. * @example
  33465. *
  33466. * _.uniqueId('contact_');
  33467. * // => 'contact_104'
  33468. *
  33469. * _.uniqueId();
  33470. * // => '105'
  33471. */
  33472. function uniqueId(prefix) {
  33473. var id = ++idCounter;
  33474. return toString(prefix) + id;
  33475. }
  33476. /*------------------------------------------------------------------------*/
  33477. /**
  33478. * Adds two numbers.
  33479. *
  33480. * @static
  33481. * @memberOf _
  33482. * @since 3.4.0
  33483. * @category Math
  33484. * @param {number} augend The first number in an addition.
  33485. * @param {number} addend The second number in an addition.
  33486. * @returns {number} Returns the total.
  33487. * @example
  33488. *
  33489. * _.add(6, 4);
  33490. * // => 10
  33491. */
  33492. var add = createMathOperation(function(augend, addend) {
  33493. return augend + addend;
  33494. }, 0);
  33495. /**
  33496. * Computes `number` rounded up to `precision`.
  33497. *
  33498. * @static
  33499. * @memberOf _
  33500. * @since 3.10.0
  33501. * @category Math
  33502. * @param {number} number The number to round up.
  33503. * @param {number} [precision=0] The precision to round up to.
  33504. * @returns {number} Returns the rounded up number.
  33505. * @example
  33506. *
  33507. * _.ceil(4.006);
  33508. * // => 5
  33509. *
  33510. * _.ceil(6.004, 2);
  33511. * // => 6.01
  33512. *
  33513. * _.ceil(6040, -2);
  33514. * // => 6100
  33515. */
  33516. var ceil = createRound('ceil');
  33517. /**
  33518. * Divide two numbers.
  33519. *
  33520. * @static
  33521. * @memberOf _
  33522. * @since 4.7.0
  33523. * @category Math
  33524. * @param {number} dividend The first number in a division.
  33525. * @param {number} divisor The second number in a division.
  33526. * @returns {number} Returns the quotient.
  33527. * @example
  33528. *
  33529. * _.divide(6, 4);
  33530. * // => 1.5
  33531. */
  33532. var divide = createMathOperation(function(dividend, divisor) {
  33533. return dividend / divisor;
  33534. }, 1);
  33535. /**
  33536. * Computes `number` rounded down to `precision`.
  33537. *
  33538. * @static
  33539. * @memberOf _
  33540. * @since 3.10.0
  33541. * @category Math
  33542. * @param {number} number The number to round down.
  33543. * @param {number} [precision=0] The precision to round down to.
  33544. * @returns {number} Returns the rounded down number.
  33545. * @example
  33546. *
  33547. * _.floor(4.006);
  33548. * // => 4
  33549. *
  33550. * _.floor(0.046, 2);
  33551. * // => 0.04
  33552. *
  33553. * _.floor(4060, -2);
  33554. * // => 4000
  33555. */
  33556. var floor = createRound('floor');
  33557. /**
  33558. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33559. * `undefined` is returned.
  33560. *
  33561. * @static
  33562. * @since 0.1.0
  33563. * @memberOf _
  33564. * @category Math
  33565. * @param {Array} array The array to iterate over.
  33566. * @returns {*} Returns the maximum value.
  33567. * @example
  33568. *
  33569. * _.max([4, 2, 8, 6]);
  33570. * // => 8
  33571. *
  33572. * _.max([]);
  33573. * // => undefined
  33574. */
  33575. function max(array) {
  33576. return (array && array.length)
  33577. ? baseExtremum(array, identity, baseGt)
  33578. : undefined;
  33579. }
  33580. /**
  33581. * This method is like `_.max` except that it accepts `iteratee` which is
  33582. * invoked for each element in `array` to generate the criterion by which
  33583. * the value is ranked. The iteratee is invoked with one argument: (value).
  33584. *
  33585. * @static
  33586. * @memberOf _
  33587. * @since 4.0.0
  33588. * @category Math
  33589. * @param {Array} array The array to iterate over.
  33590. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33591. * @returns {*} Returns the maximum value.
  33592. * @example
  33593. *
  33594. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33595. *
  33596. * _.maxBy(objects, function(o) { return o.n; });
  33597. * // => { 'n': 2 }
  33598. *
  33599. * // The `_.property` iteratee shorthand.
  33600. * _.maxBy(objects, 'n');
  33601. * // => { 'n': 2 }
  33602. */
  33603. function maxBy(array, iteratee) {
  33604. return (array && array.length)
  33605. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33606. : undefined;
  33607. }
  33608. /**
  33609. * Computes the mean of the values in `array`.
  33610. *
  33611. * @static
  33612. * @memberOf _
  33613. * @since 4.0.0
  33614. * @category Math
  33615. * @param {Array} array The array to iterate over.
  33616. * @returns {number} Returns the mean.
  33617. * @example
  33618. *
  33619. * _.mean([4, 2, 8, 6]);
  33620. * // => 5
  33621. */
  33622. function mean(array) {
  33623. return baseMean(array, identity);
  33624. }
  33625. /**
  33626. * This method is like `_.mean` except that it accepts `iteratee` which is
  33627. * invoked for each element in `array` to generate the value to be averaged.
  33628. * The iteratee is invoked with one argument: (value).
  33629. *
  33630. * @static
  33631. * @memberOf _
  33632. * @since 4.7.0
  33633. * @category Math
  33634. * @param {Array} array The array to iterate over.
  33635. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33636. * @returns {number} Returns the mean.
  33637. * @example
  33638. *
  33639. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33640. *
  33641. * _.meanBy(objects, function(o) { return o.n; });
  33642. * // => 5
  33643. *
  33644. * // The `_.property` iteratee shorthand.
  33645. * _.meanBy(objects, 'n');
  33646. * // => 5
  33647. */
  33648. function meanBy(array, iteratee) {
  33649. return baseMean(array, getIteratee(iteratee, 2));
  33650. }
  33651. /**
  33652. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33653. * `undefined` is returned.
  33654. *
  33655. * @static
  33656. * @since 0.1.0
  33657. * @memberOf _
  33658. * @category Math
  33659. * @param {Array} array The array to iterate over.
  33660. * @returns {*} Returns the minimum value.
  33661. * @example
  33662. *
  33663. * _.min([4, 2, 8, 6]);
  33664. * // => 2
  33665. *
  33666. * _.min([]);
  33667. * // => undefined
  33668. */
  33669. function min(array) {
  33670. return (array && array.length)
  33671. ? baseExtremum(array, identity, baseLt)
  33672. : undefined;
  33673. }
  33674. /**
  33675. * This method is like `_.min` except that it accepts `iteratee` which is
  33676. * invoked for each element in `array` to generate the criterion by which
  33677. * the value is ranked. The iteratee is invoked with one argument: (value).
  33678. *
  33679. * @static
  33680. * @memberOf _
  33681. * @since 4.0.0
  33682. * @category Math
  33683. * @param {Array} array The array to iterate over.
  33684. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33685. * @returns {*} Returns the minimum value.
  33686. * @example
  33687. *
  33688. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33689. *
  33690. * _.minBy(objects, function(o) { return o.n; });
  33691. * // => { 'n': 1 }
  33692. *
  33693. * // The `_.property` iteratee shorthand.
  33694. * _.minBy(objects, 'n');
  33695. * // => { 'n': 1 }
  33696. */
  33697. function minBy(array, iteratee) {
  33698. return (array && array.length)
  33699. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33700. : undefined;
  33701. }
  33702. /**
  33703. * Multiply two numbers.
  33704. *
  33705. * @static
  33706. * @memberOf _
  33707. * @since 4.7.0
  33708. * @category Math
  33709. * @param {number} multiplier The first number in a multiplication.
  33710. * @param {number} multiplicand The second number in a multiplication.
  33711. * @returns {number} Returns the product.
  33712. * @example
  33713. *
  33714. * _.multiply(6, 4);
  33715. * // => 24
  33716. */
  33717. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33718. return multiplier * multiplicand;
  33719. }, 1);
  33720. /**
  33721. * Computes `number` rounded to `precision`.
  33722. *
  33723. * @static
  33724. * @memberOf _
  33725. * @since 3.10.0
  33726. * @category Math
  33727. * @param {number} number The number to round.
  33728. * @param {number} [precision=0] The precision to round to.
  33729. * @returns {number} Returns the rounded number.
  33730. * @example
  33731. *
  33732. * _.round(4.006);
  33733. * // => 4
  33734. *
  33735. * _.round(4.006, 2);
  33736. * // => 4.01
  33737. *
  33738. * _.round(4060, -2);
  33739. * // => 4100
  33740. */
  33741. var round = createRound('round');
  33742. /**
  33743. * Subtract two numbers.
  33744. *
  33745. * @static
  33746. * @memberOf _
  33747. * @since 4.0.0
  33748. * @category Math
  33749. * @param {number} minuend The first number in a subtraction.
  33750. * @param {number} subtrahend The second number in a subtraction.
  33751. * @returns {number} Returns the difference.
  33752. * @example
  33753. *
  33754. * _.subtract(6, 4);
  33755. * // => 2
  33756. */
  33757. var subtract = createMathOperation(function(minuend, subtrahend) {
  33758. return minuend - subtrahend;
  33759. }, 0);
  33760. /**
  33761. * Computes the sum of the values in `array`.
  33762. *
  33763. * @static
  33764. * @memberOf _
  33765. * @since 3.4.0
  33766. * @category Math
  33767. * @param {Array} array The array to iterate over.
  33768. * @returns {number} Returns the sum.
  33769. * @example
  33770. *
  33771. * _.sum([4, 2, 8, 6]);
  33772. * // => 20
  33773. */
  33774. function sum(array) {
  33775. return (array && array.length)
  33776. ? baseSum(array, identity)
  33777. : 0;
  33778. }
  33779. /**
  33780. * This method is like `_.sum` except that it accepts `iteratee` which is
  33781. * invoked for each element in `array` to generate the value to be summed.
  33782. * The iteratee is invoked with one argument: (value).
  33783. *
  33784. * @static
  33785. * @memberOf _
  33786. * @since 4.0.0
  33787. * @category Math
  33788. * @param {Array} array The array to iterate over.
  33789. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33790. * @returns {number} Returns the sum.
  33791. * @example
  33792. *
  33793. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33794. *
  33795. * _.sumBy(objects, function(o) { return o.n; });
  33796. * // => 20
  33797. *
  33798. * // The `_.property` iteratee shorthand.
  33799. * _.sumBy(objects, 'n');
  33800. * // => 20
  33801. */
  33802. function sumBy(array, iteratee) {
  33803. return (array && array.length)
  33804. ? baseSum(array, getIteratee(iteratee, 2))
  33805. : 0;
  33806. }
  33807. /*------------------------------------------------------------------------*/
  33808. // Add methods that return wrapped values in chain sequences.
  33809. lodash.after = after;
  33810. lodash.ary = ary;
  33811. lodash.assign = assign;
  33812. lodash.assignIn = assignIn;
  33813. lodash.assignInWith = assignInWith;
  33814. lodash.assignWith = assignWith;
  33815. lodash.at = at;
  33816. lodash.before = before;
  33817. lodash.bind = bind;
  33818. lodash.bindAll = bindAll;
  33819. lodash.bindKey = bindKey;
  33820. lodash.castArray = castArray;
  33821. lodash.chain = chain;
  33822. lodash.chunk = chunk;
  33823. lodash.compact = compact;
  33824. lodash.concat = concat;
  33825. lodash.cond = cond;
  33826. lodash.conforms = conforms;
  33827. lodash.constant = constant;
  33828. lodash.countBy = countBy;
  33829. lodash.create = create;
  33830. lodash.curry = curry;
  33831. lodash.curryRight = curryRight;
  33832. lodash.debounce = debounce;
  33833. lodash.defaults = defaults;
  33834. lodash.defaultsDeep = defaultsDeep;
  33835. lodash.defer = defer;
  33836. lodash.delay = delay;
  33837. lodash.difference = difference;
  33838. lodash.differenceBy = differenceBy;
  33839. lodash.differenceWith = differenceWith;
  33840. lodash.drop = drop;
  33841. lodash.dropRight = dropRight;
  33842. lodash.dropRightWhile = dropRightWhile;
  33843. lodash.dropWhile = dropWhile;
  33844. lodash.fill = fill;
  33845. lodash.filter = filter;
  33846. lodash.flatMap = flatMap;
  33847. lodash.flatMapDeep = flatMapDeep;
  33848. lodash.flatMapDepth = flatMapDepth;
  33849. lodash.flatten = flatten;
  33850. lodash.flattenDeep = flattenDeep;
  33851. lodash.flattenDepth = flattenDepth;
  33852. lodash.flip = flip;
  33853. lodash.flow = flow;
  33854. lodash.flowRight = flowRight;
  33855. lodash.fromPairs = fromPairs;
  33856. lodash.functions = functions;
  33857. lodash.functionsIn = functionsIn;
  33858. lodash.groupBy = groupBy;
  33859. lodash.initial = initial;
  33860. lodash.intersection = intersection;
  33861. lodash.intersectionBy = intersectionBy;
  33862. lodash.intersectionWith = intersectionWith;
  33863. lodash.invert = invert;
  33864. lodash.invertBy = invertBy;
  33865. lodash.invokeMap = invokeMap;
  33866. lodash.iteratee = iteratee;
  33867. lodash.keyBy = keyBy;
  33868. lodash.keys = keys;
  33869. lodash.keysIn = keysIn;
  33870. lodash.map = map;
  33871. lodash.mapKeys = mapKeys;
  33872. lodash.mapValues = mapValues;
  33873. lodash.matches = matches;
  33874. lodash.matchesProperty = matchesProperty;
  33875. lodash.memoize = memoize;
  33876. lodash.merge = merge;
  33877. lodash.mergeWith = mergeWith;
  33878. lodash.method = method;
  33879. lodash.methodOf = methodOf;
  33880. lodash.mixin = mixin;
  33881. lodash.negate = negate;
  33882. lodash.nthArg = nthArg;
  33883. lodash.omit = omit;
  33884. lodash.omitBy = omitBy;
  33885. lodash.once = once;
  33886. lodash.orderBy = orderBy;
  33887. lodash.over = over;
  33888. lodash.overArgs = overArgs;
  33889. lodash.overEvery = overEvery;
  33890. lodash.overSome = overSome;
  33891. lodash.partial = partial;
  33892. lodash.partialRight = partialRight;
  33893. lodash.partition = partition;
  33894. lodash.pick = pick;
  33895. lodash.pickBy = pickBy;
  33896. lodash.property = property;
  33897. lodash.propertyOf = propertyOf;
  33898. lodash.pull = pull;
  33899. lodash.pullAll = pullAll;
  33900. lodash.pullAllBy = pullAllBy;
  33901. lodash.pullAllWith = pullAllWith;
  33902. lodash.pullAt = pullAt;
  33903. lodash.range = range;
  33904. lodash.rangeRight = rangeRight;
  33905. lodash.rearg = rearg;
  33906. lodash.reject = reject;
  33907. lodash.remove = remove;
  33908. lodash.rest = rest;
  33909. lodash.reverse = reverse;
  33910. lodash.sampleSize = sampleSize;
  33911. lodash.set = set;
  33912. lodash.setWith = setWith;
  33913. lodash.shuffle = shuffle;
  33914. lodash.slice = slice;
  33915. lodash.sortBy = sortBy;
  33916. lodash.sortedUniq = sortedUniq;
  33917. lodash.sortedUniqBy = sortedUniqBy;
  33918. lodash.split = split;
  33919. lodash.spread = spread;
  33920. lodash.tail = tail;
  33921. lodash.take = take;
  33922. lodash.takeRight = takeRight;
  33923. lodash.takeRightWhile = takeRightWhile;
  33924. lodash.takeWhile = takeWhile;
  33925. lodash.tap = tap;
  33926. lodash.throttle = throttle;
  33927. lodash.thru = thru;
  33928. lodash.toArray = toArray;
  33929. lodash.toPairs = toPairs;
  33930. lodash.toPairsIn = toPairsIn;
  33931. lodash.toPath = toPath;
  33932. lodash.toPlainObject = toPlainObject;
  33933. lodash.transform = transform;
  33934. lodash.unary = unary;
  33935. lodash.union = union;
  33936. lodash.unionBy = unionBy;
  33937. lodash.unionWith = unionWith;
  33938. lodash.uniq = uniq;
  33939. lodash.uniqBy = uniqBy;
  33940. lodash.uniqWith = uniqWith;
  33941. lodash.unset = unset;
  33942. lodash.unzip = unzip;
  33943. lodash.unzipWith = unzipWith;
  33944. lodash.update = update;
  33945. lodash.updateWith = updateWith;
  33946. lodash.values = values;
  33947. lodash.valuesIn = valuesIn;
  33948. lodash.without = without;
  33949. lodash.words = words;
  33950. lodash.wrap = wrap;
  33951. lodash.xor = xor;
  33952. lodash.xorBy = xorBy;
  33953. lodash.xorWith = xorWith;
  33954. lodash.zip = zip;
  33955. lodash.zipObject = zipObject;
  33956. lodash.zipObjectDeep = zipObjectDeep;
  33957. lodash.zipWith = zipWith;
  33958. // Add aliases.
  33959. lodash.entries = toPairs;
  33960. lodash.entriesIn = toPairsIn;
  33961. lodash.extend = assignIn;
  33962. lodash.extendWith = assignInWith;
  33963. // Add methods to `lodash.prototype`.
  33964. mixin(lodash, lodash);
  33965. /*------------------------------------------------------------------------*/
  33966. // Add methods that return unwrapped values in chain sequences.
  33967. lodash.add = add;
  33968. lodash.attempt = attempt;
  33969. lodash.camelCase = camelCase;
  33970. lodash.capitalize = capitalize;
  33971. lodash.ceil = ceil;
  33972. lodash.clamp = clamp;
  33973. lodash.clone = clone;
  33974. lodash.cloneDeep = cloneDeep;
  33975. lodash.cloneDeepWith = cloneDeepWith;
  33976. lodash.cloneWith = cloneWith;
  33977. lodash.conformsTo = conformsTo;
  33978. lodash.deburr = deburr;
  33979. lodash.defaultTo = defaultTo;
  33980. lodash.divide = divide;
  33981. lodash.endsWith = endsWith;
  33982. lodash.eq = eq;
  33983. lodash.escape = escape;
  33984. lodash.escapeRegExp = escapeRegExp;
  33985. lodash.every = every;
  33986. lodash.find = find;
  33987. lodash.findIndex = findIndex;
  33988. lodash.findKey = findKey;
  33989. lodash.findLast = findLast;
  33990. lodash.findLastIndex = findLastIndex;
  33991. lodash.findLastKey = findLastKey;
  33992. lodash.floor = floor;
  33993. lodash.forEach = forEach;
  33994. lodash.forEachRight = forEachRight;
  33995. lodash.forIn = forIn;
  33996. lodash.forInRight = forInRight;
  33997. lodash.forOwn = forOwn;
  33998. lodash.forOwnRight = forOwnRight;
  33999. lodash.get = get;
  34000. lodash.gt = gt;
  34001. lodash.gte = gte;
  34002. lodash.has = has;
  34003. lodash.hasIn = hasIn;
  34004. lodash.head = head;
  34005. lodash.identity = identity;
  34006. lodash.includes = includes;
  34007. lodash.indexOf = indexOf;
  34008. lodash.inRange = inRange;
  34009. lodash.invoke = invoke;
  34010. lodash.isArguments = isArguments;
  34011. lodash.isArray = isArray;
  34012. lodash.isArrayBuffer = isArrayBuffer;
  34013. lodash.isArrayLike = isArrayLike;
  34014. lodash.isArrayLikeObject = isArrayLikeObject;
  34015. lodash.isBoolean = isBoolean;
  34016. lodash.isBuffer = isBuffer;
  34017. lodash.isDate = isDate;
  34018. lodash.isElement = isElement;
  34019. lodash.isEmpty = isEmpty;
  34020. lodash.isEqual = isEqual;
  34021. lodash.isEqualWith = isEqualWith;
  34022. lodash.isError = isError;
  34023. lodash.isFinite = isFinite;
  34024. lodash.isFunction = isFunction;
  34025. lodash.isInteger = isInteger;
  34026. lodash.isLength = isLength;
  34027. lodash.isMap = isMap;
  34028. lodash.isMatch = isMatch;
  34029. lodash.isMatchWith = isMatchWith;
  34030. lodash.isNaN = isNaN;
  34031. lodash.isNative = isNative;
  34032. lodash.isNil = isNil;
  34033. lodash.isNull = isNull;
  34034. lodash.isNumber = isNumber;
  34035. lodash.isObject = isObject;
  34036. lodash.isObjectLike = isObjectLike;
  34037. lodash.isPlainObject = isPlainObject;
  34038. lodash.isRegExp = isRegExp;
  34039. lodash.isSafeInteger = isSafeInteger;
  34040. lodash.isSet = isSet;
  34041. lodash.isString = isString;
  34042. lodash.isSymbol = isSymbol;
  34043. lodash.isTypedArray = isTypedArray;
  34044. lodash.isUndefined = isUndefined;
  34045. lodash.isWeakMap = isWeakMap;
  34046. lodash.isWeakSet = isWeakSet;
  34047. lodash.join = join;
  34048. lodash.kebabCase = kebabCase;
  34049. lodash.last = last;
  34050. lodash.lastIndexOf = lastIndexOf;
  34051. lodash.lowerCase = lowerCase;
  34052. lodash.lowerFirst = lowerFirst;
  34053. lodash.lt = lt;
  34054. lodash.lte = lte;
  34055. lodash.max = max;
  34056. lodash.maxBy = maxBy;
  34057. lodash.mean = mean;
  34058. lodash.meanBy = meanBy;
  34059. lodash.min = min;
  34060. lodash.minBy = minBy;
  34061. lodash.stubArray = stubArray;
  34062. lodash.stubFalse = stubFalse;
  34063. lodash.stubObject = stubObject;
  34064. lodash.stubString = stubString;
  34065. lodash.stubTrue = stubTrue;
  34066. lodash.multiply = multiply;
  34067. lodash.nth = nth;
  34068. lodash.noConflict = noConflict;
  34069. lodash.noop = noop;
  34070. lodash.now = now;
  34071. lodash.pad = pad;
  34072. lodash.padEnd = padEnd;
  34073. lodash.padStart = padStart;
  34074. lodash.parseInt = parseInt;
  34075. lodash.random = random;
  34076. lodash.reduce = reduce;
  34077. lodash.reduceRight = reduceRight;
  34078. lodash.repeat = repeat;
  34079. lodash.replace = replace;
  34080. lodash.result = result;
  34081. lodash.round = round;
  34082. lodash.runInContext = runInContext;
  34083. lodash.sample = sample;
  34084. lodash.size = size;
  34085. lodash.snakeCase = snakeCase;
  34086. lodash.some = some;
  34087. lodash.sortedIndex = sortedIndex;
  34088. lodash.sortedIndexBy = sortedIndexBy;
  34089. lodash.sortedIndexOf = sortedIndexOf;
  34090. lodash.sortedLastIndex = sortedLastIndex;
  34091. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34092. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34093. lodash.startCase = startCase;
  34094. lodash.startsWith = startsWith;
  34095. lodash.subtract = subtract;
  34096. lodash.sum = sum;
  34097. lodash.sumBy = sumBy;
  34098. lodash.template = template;
  34099. lodash.times = times;
  34100. lodash.toFinite = toFinite;
  34101. lodash.toInteger = toInteger;
  34102. lodash.toLength = toLength;
  34103. lodash.toLower = toLower;
  34104. lodash.toNumber = toNumber;
  34105. lodash.toSafeInteger = toSafeInteger;
  34106. lodash.toString = toString;
  34107. lodash.toUpper = toUpper;
  34108. lodash.trim = trim;
  34109. lodash.trimEnd = trimEnd;
  34110. lodash.trimStart = trimStart;
  34111. lodash.truncate = truncate;
  34112. lodash.unescape = unescape;
  34113. lodash.uniqueId = uniqueId;
  34114. lodash.upperCase = upperCase;
  34115. lodash.upperFirst = upperFirst;
  34116. // Add aliases.
  34117. lodash.each = forEach;
  34118. lodash.eachRight = forEachRight;
  34119. lodash.first = head;
  34120. mixin(lodash, (function() {
  34121. var source = {};
  34122. baseForOwn(lodash, function(func, methodName) {
  34123. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34124. source[methodName] = func;
  34125. }
  34126. });
  34127. return source;
  34128. }()), { 'chain': false });
  34129. /*------------------------------------------------------------------------*/
  34130. /**
  34131. * The semantic version number.
  34132. *
  34133. * @static
  34134. * @memberOf _
  34135. * @type {string}
  34136. */
  34137. lodash.VERSION = VERSION;
  34138. // Assign default placeholders.
  34139. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34140. lodash[methodName].placeholder = lodash;
  34141. });
  34142. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34143. arrayEach(['drop', 'take'], function(methodName, index) {
  34144. LazyWrapper.prototype[methodName] = function(n) {
  34145. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34146. var result = (this.__filtered__ && !index)
  34147. ? new LazyWrapper(this)
  34148. : this.clone();
  34149. if (result.__filtered__) {
  34150. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34151. } else {
  34152. result.__views__.push({
  34153. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34154. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34155. });
  34156. }
  34157. return result;
  34158. };
  34159. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34160. return this.reverse()[methodName](n).reverse();
  34161. };
  34162. });
  34163. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34164. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34165. var type = index + 1,
  34166. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34167. LazyWrapper.prototype[methodName] = function(iteratee) {
  34168. var result = this.clone();
  34169. result.__iteratees__.push({
  34170. 'iteratee': getIteratee(iteratee, 3),
  34171. 'type': type
  34172. });
  34173. result.__filtered__ = result.__filtered__ || isFilter;
  34174. return result;
  34175. };
  34176. });
  34177. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34178. arrayEach(['head', 'last'], function(methodName, index) {
  34179. var takeName = 'take' + (index ? 'Right' : '');
  34180. LazyWrapper.prototype[methodName] = function() {
  34181. return this[takeName](1).value()[0];
  34182. };
  34183. });
  34184. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34185. arrayEach(['initial', 'tail'], function(methodName, index) {
  34186. var dropName = 'drop' + (index ? '' : 'Right');
  34187. LazyWrapper.prototype[methodName] = function() {
  34188. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34189. };
  34190. });
  34191. LazyWrapper.prototype.compact = function() {
  34192. return this.filter(identity);
  34193. };
  34194. LazyWrapper.prototype.find = function(predicate) {
  34195. return this.filter(predicate).head();
  34196. };
  34197. LazyWrapper.prototype.findLast = function(predicate) {
  34198. return this.reverse().find(predicate);
  34199. };
  34200. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34201. if (typeof path == 'function') {
  34202. return new LazyWrapper(this);
  34203. }
  34204. return this.map(function(value) {
  34205. return baseInvoke(value, path, args);
  34206. });
  34207. });
  34208. LazyWrapper.prototype.reject = function(predicate) {
  34209. return this.filter(negate(getIteratee(predicate)));
  34210. };
  34211. LazyWrapper.prototype.slice = function(start, end) {
  34212. start = toInteger(start);
  34213. var result = this;
  34214. if (result.__filtered__ && (start > 0 || end < 0)) {
  34215. return new LazyWrapper(result);
  34216. }
  34217. if (start < 0) {
  34218. result = result.takeRight(-start);
  34219. } else if (start) {
  34220. result = result.drop(start);
  34221. }
  34222. if (end !== undefined) {
  34223. end = toInteger(end);
  34224. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34225. }
  34226. return result;
  34227. };
  34228. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34229. return this.reverse().takeWhile(predicate).reverse();
  34230. };
  34231. LazyWrapper.prototype.toArray = function() {
  34232. return this.take(MAX_ARRAY_LENGTH);
  34233. };
  34234. // Add `LazyWrapper` methods to `lodash.prototype`.
  34235. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34236. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34237. isTaker = /^(?:head|last)$/.test(methodName),
  34238. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34239. retUnwrapped = isTaker || /^find/.test(methodName);
  34240. if (!lodashFunc) {
  34241. return;
  34242. }
  34243. lodash.prototype[methodName] = function() {
  34244. var value = this.__wrapped__,
  34245. args = isTaker ? [1] : arguments,
  34246. isLazy = value instanceof LazyWrapper,
  34247. iteratee = args[0],
  34248. useLazy = isLazy || isArray(value);
  34249. var interceptor = function(value) {
  34250. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34251. return (isTaker && chainAll) ? result[0] : result;
  34252. };
  34253. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34254. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34255. isLazy = useLazy = false;
  34256. }
  34257. var chainAll = this.__chain__,
  34258. isHybrid = !!this.__actions__.length,
  34259. isUnwrapped = retUnwrapped && !chainAll,
  34260. onlyLazy = isLazy && !isHybrid;
  34261. if (!retUnwrapped && useLazy) {
  34262. value = onlyLazy ? value : new LazyWrapper(this);
  34263. var result = func.apply(value, args);
  34264. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34265. return new LodashWrapper(result, chainAll);
  34266. }
  34267. if (isUnwrapped && onlyLazy) {
  34268. return func.apply(this, args);
  34269. }
  34270. result = this.thru(interceptor);
  34271. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34272. };
  34273. });
  34274. // Add `Array` methods to `lodash.prototype`.
  34275. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34276. var func = arrayProto[methodName],
  34277. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34278. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34279. lodash.prototype[methodName] = function() {
  34280. var args = arguments;
  34281. if (retUnwrapped && !this.__chain__) {
  34282. var value = this.value();
  34283. return func.apply(isArray(value) ? value : [], args);
  34284. }
  34285. return this[chainName](function(value) {
  34286. return func.apply(isArray(value) ? value : [], args);
  34287. });
  34288. };
  34289. });
  34290. // Map minified method names to their real names.
  34291. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34292. var lodashFunc = lodash[methodName];
  34293. if (lodashFunc) {
  34294. var key = lodashFunc.name + '';
  34295. if (!hasOwnProperty.call(realNames, key)) {
  34296. realNames[key] = [];
  34297. }
  34298. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34299. }
  34300. });
  34301. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34302. 'name': 'wrapper',
  34303. 'func': undefined
  34304. }];
  34305. // Add methods to `LazyWrapper`.
  34306. LazyWrapper.prototype.clone = lazyClone;
  34307. LazyWrapper.prototype.reverse = lazyReverse;
  34308. LazyWrapper.prototype.value = lazyValue;
  34309. // Add chain sequence methods to the `lodash` wrapper.
  34310. lodash.prototype.at = wrapperAt;
  34311. lodash.prototype.chain = wrapperChain;
  34312. lodash.prototype.commit = wrapperCommit;
  34313. lodash.prototype.next = wrapperNext;
  34314. lodash.prototype.plant = wrapperPlant;
  34315. lodash.prototype.reverse = wrapperReverse;
  34316. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34317. // Add lazy aliases.
  34318. lodash.prototype.first = lodash.prototype.head;
  34319. if (symIterator) {
  34320. lodash.prototype[symIterator] = wrapperToIterator;
  34321. }
  34322. return lodash;
  34323. });
  34324. /*--------------------------------------------------------------------------*/
  34325. // Export lodash.
  34326. var _ = runInContext();
  34327. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34328. if (true) {
  34329. // Expose Lodash on the global object to prevent errors when Lodash is
  34330. // loaded by a script tag in the presence of an AMD loader.
  34331. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34332. // Use `_.noConflict` to remove Lodash from the global object.
  34333. root._ = _;
  34334. // Define as an anonymous module so, through path mapping, it can be
  34335. // referenced as the "underscore" module.
  34336. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34337. return _;
  34338. }).call(exports, __webpack_require__, exports, module),
  34339. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34340. }
  34341. // Check for `exports` after `define` in case a build optimizer adds it.
  34342. else {}
  34343. }.call(this));
  34344. /* 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)))
  34345. /***/ }),
  34346. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34347. /*!***************************************************!*\
  34348. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34349. \***************************************************/
  34350. /*! exports provided: default */
  34351. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34352. "use strict";
  34353. __webpack_require__.r(__webpack_exports__);
  34354. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34355. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34356. * @version 1.16.1
  34357. * @license
  34358. * Copyright (c) 2016 Federico Zivolo and contributors
  34359. *
  34360. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34361. * of this software and associated documentation files (the "Software"), to deal
  34362. * in the Software without restriction, including without limitation the rights
  34363. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34364. * copies of the Software, and to permit persons to whom the Software is
  34365. * furnished to do so, subject to the following conditions:
  34366. *
  34367. * The above copyright notice and this permission notice shall be included in all
  34368. * copies or substantial portions of the Software.
  34369. *
  34370. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34371. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34372. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34373. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34374. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34375. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34376. * SOFTWARE.
  34377. */
  34378. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34379. var timeoutDuration = function () {
  34380. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34381. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34382. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34383. return 1;
  34384. }
  34385. }
  34386. return 0;
  34387. }();
  34388. function microtaskDebounce(fn) {
  34389. var called = false;
  34390. return function () {
  34391. if (called) {
  34392. return;
  34393. }
  34394. called = true;
  34395. window.Promise.resolve().then(function () {
  34396. called = false;
  34397. fn();
  34398. });
  34399. };
  34400. }
  34401. function taskDebounce(fn) {
  34402. var scheduled = false;
  34403. return function () {
  34404. if (!scheduled) {
  34405. scheduled = true;
  34406. setTimeout(function () {
  34407. scheduled = false;
  34408. fn();
  34409. }, timeoutDuration);
  34410. }
  34411. };
  34412. }
  34413. var supportsMicroTasks = isBrowser && window.Promise;
  34414. /**
  34415. * Create a debounced version of a method, that's asynchronously deferred
  34416. * but called in the minimum time possible.
  34417. *
  34418. * @method
  34419. * @memberof Popper.Utils
  34420. * @argument {Function} fn
  34421. * @returns {Function}
  34422. */
  34423. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34424. /**
  34425. * Check if the given variable is a function
  34426. * @method
  34427. * @memberof Popper.Utils
  34428. * @argument {Any} functionToCheck - variable to check
  34429. * @returns {Boolean} answer to: is a function?
  34430. */
  34431. function isFunction(functionToCheck) {
  34432. var getType = {};
  34433. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34434. }
  34435. /**
  34436. * Get CSS computed property of the given element
  34437. * @method
  34438. * @memberof Popper.Utils
  34439. * @argument {Eement} element
  34440. * @argument {String} property
  34441. */
  34442. function getStyleComputedProperty(element, property) {
  34443. if (element.nodeType !== 1) {
  34444. return [];
  34445. }
  34446. // NOTE: 1 DOM access here
  34447. var window = element.ownerDocument.defaultView;
  34448. var css = window.getComputedStyle(element, null);
  34449. return property ? css[property] : css;
  34450. }
  34451. /**
  34452. * Returns the parentNode or the host of the element
  34453. * @method
  34454. * @memberof Popper.Utils
  34455. * @argument {Element} element
  34456. * @returns {Element} parent
  34457. */
  34458. function getParentNode(element) {
  34459. if (element.nodeName === 'HTML') {
  34460. return element;
  34461. }
  34462. return element.parentNode || element.host;
  34463. }
  34464. /**
  34465. * Returns the scrolling parent of the given element
  34466. * @method
  34467. * @memberof Popper.Utils
  34468. * @argument {Element} element
  34469. * @returns {Element} scroll parent
  34470. */
  34471. function getScrollParent(element) {
  34472. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34473. if (!element) {
  34474. return document.body;
  34475. }
  34476. switch (element.nodeName) {
  34477. case 'HTML':
  34478. case 'BODY':
  34479. return element.ownerDocument.body;
  34480. case '#document':
  34481. return element.body;
  34482. }
  34483. // Firefox want us to check `-x` and `-y` variations as well
  34484. var _getStyleComputedProp = getStyleComputedProperty(element),
  34485. overflow = _getStyleComputedProp.overflow,
  34486. overflowX = _getStyleComputedProp.overflowX,
  34487. overflowY = _getStyleComputedProp.overflowY;
  34488. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34489. return element;
  34490. }
  34491. return getScrollParent(getParentNode(element));
  34492. }
  34493. /**
  34494. * Returns the reference node of the reference object, or the reference object itself.
  34495. * @method
  34496. * @memberof Popper.Utils
  34497. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34498. * @returns {Element} parent
  34499. */
  34500. function getReferenceNode(reference) {
  34501. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34502. }
  34503. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34504. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34505. /**
  34506. * Determines if the browser is Internet Explorer
  34507. * @method
  34508. * @memberof Popper.Utils
  34509. * @param {Number} version to check
  34510. * @returns {Boolean} isIE
  34511. */
  34512. function isIE(version) {
  34513. if (version === 11) {
  34514. return isIE11;
  34515. }
  34516. if (version === 10) {
  34517. return isIE10;
  34518. }
  34519. return isIE11 || isIE10;
  34520. }
  34521. /**
  34522. * Returns the offset parent of the given element
  34523. * @method
  34524. * @memberof Popper.Utils
  34525. * @argument {Element} element
  34526. * @returns {Element} offset parent
  34527. */
  34528. function getOffsetParent(element) {
  34529. if (!element) {
  34530. return document.documentElement;
  34531. }
  34532. var noOffsetParent = isIE(10) ? document.body : null;
  34533. // NOTE: 1 DOM access here
  34534. var offsetParent = element.offsetParent || null;
  34535. // Skip hidden elements which don't have an offsetParent
  34536. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34537. offsetParent = (element = element.nextElementSibling).offsetParent;
  34538. }
  34539. var nodeName = offsetParent && offsetParent.nodeName;
  34540. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34541. return element ? element.ownerDocument.documentElement : document.documentElement;
  34542. }
  34543. // .offsetParent will return the closest TH, TD or TABLE in case
  34544. // no offsetParent is present, I hate this job...
  34545. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34546. return getOffsetParent(offsetParent);
  34547. }
  34548. return offsetParent;
  34549. }
  34550. function isOffsetContainer(element) {
  34551. var nodeName = element.nodeName;
  34552. if (nodeName === 'BODY') {
  34553. return false;
  34554. }
  34555. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34556. }
  34557. /**
  34558. * Finds the root node (document, shadowDOM root) of the given element
  34559. * @method
  34560. * @memberof Popper.Utils
  34561. * @argument {Element} node
  34562. * @returns {Element} root node
  34563. */
  34564. function getRoot(node) {
  34565. if (node.parentNode !== null) {
  34566. return getRoot(node.parentNode);
  34567. }
  34568. return node;
  34569. }
  34570. /**
  34571. * Finds the offset parent common to the two provided nodes
  34572. * @method
  34573. * @memberof Popper.Utils
  34574. * @argument {Element} element1
  34575. * @argument {Element} element2
  34576. * @returns {Element} common offset parent
  34577. */
  34578. function findCommonOffsetParent(element1, element2) {
  34579. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34580. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34581. return document.documentElement;
  34582. }
  34583. // Here we make sure to give as "start" the element that comes first in the DOM
  34584. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34585. var start = order ? element1 : element2;
  34586. var end = order ? element2 : element1;
  34587. // Get common ancestor container
  34588. var range = document.createRange();
  34589. range.setStart(start, 0);
  34590. range.setEnd(end, 0);
  34591. var commonAncestorContainer = range.commonAncestorContainer;
  34592. // Both nodes are inside #document
  34593. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34594. if (isOffsetContainer(commonAncestorContainer)) {
  34595. return commonAncestorContainer;
  34596. }
  34597. return getOffsetParent(commonAncestorContainer);
  34598. }
  34599. // one of the nodes is inside shadowDOM, find which one
  34600. var element1root = getRoot(element1);
  34601. if (element1root.host) {
  34602. return findCommonOffsetParent(element1root.host, element2);
  34603. } else {
  34604. return findCommonOffsetParent(element1, getRoot(element2).host);
  34605. }
  34606. }
  34607. /**
  34608. * Gets the scroll value of the given element in the given side (top and left)
  34609. * @method
  34610. * @memberof Popper.Utils
  34611. * @argument {Element} element
  34612. * @argument {String} side `top` or `left`
  34613. * @returns {number} amount of scrolled pixels
  34614. */
  34615. function getScroll(element) {
  34616. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34617. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34618. var nodeName = element.nodeName;
  34619. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34620. var html = element.ownerDocument.documentElement;
  34621. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34622. return scrollingElement[upperSide];
  34623. }
  34624. return element[upperSide];
  34625. }
  34626. /*
  34627. * Sum or subtract the element scroll values (left and top) from a given rect object
  34628. * @method
  34629. * @memberof Popper.Utils
  34630. * @param {Object} rect - Rect object you want to change
  34631. * @param {HTMLElement} element - The element from the function reads the scroll values
  34632. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34633. * @return {Object} rect - The modifier rect object
  34634. */
  34635. function includeScroll(rect, element) {
  34636. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34637. var scrollTop = getScroll(element, 'top');
  34638. var scrollLeft = getScroll(element, 'left');
  34639. var modifier = subtract ? -1 : 1;
  34640. rect.top += scrollTop * modifier;
  34641. rect.bottom += scrollTop * modifier;
  34642. rect.left += scrollLeft * modifier;
  34643. rect.right += scrollLeft * modifier;
  34644. return rect;
  34645. }
  34646. /*
  34647. * Helper to detect borders of a given element
  34648. * @method
  34649. * @memberof Popper.Utils
  34650. * @param {CSSStyleDeclaration} styles
  34651. * Result of `getStyleComputedProperty` on the given element
  34652. * @param {String} axis - `x` or `y`
  34653. * @return {number} borders - The borders size of the given axis
  34654. */
  34655. function getBordersSize(styles, axis) {
  34656. var sideA = axis === 'x' ? 'Left' : 'Top';
  34657. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34658. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34659. }
  34660. function getSize(axis, body, html, computedStyle) {
  34661. 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);
  34662. }
  34663. function getWindowSizes(document) {
  34664. var body = document.body;
  34665. var html = document.documentElement;
  34666. var computedStyle = isIE(10) && getComputedStyle(html);
  34667. return {
  34668. height: getSize('Height', body, html, computedStyle),
  34669. width: getSize('Width', body, html, computedStyle)
  34670. };
  34671. }
  34672. var classCallCheck = function (instance, Constructor) {
  34673. if (!(instance instanceof Constructor)) {
  34674. throw new TypeError("Cannot call a class as a function");
  34675. }
  34676. };
  34677. var createClass = function () {
  34678. function defineProperties(target, props) {
  34679. for (var i = 0; i < props.length; i++) {
  34680. var descriptor = props[i];
  34681. descriptor.enumerable = descriptor.enumerable || false;
  34682. descriptor.configurable = true;
  34683. if ("value" in descriptor) descriptor.writable = true;
  34684. Object.defineProperty(target, descriptor.key, descriptor);
  34685. }
  34686. }
  34687. return function (Constructor, protoProps, staticProps) {
  34688. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34689. if (staticProps) defineProperties(Constructor, staticProps);
  34690. return Constructor;
  34691. };
  34692. }();
  34693. var defineProperty = function (obj, key, value) {
  34694. if (key in obj) {
  34695. Object.defineProperty(obj, key, {
  34696. value: value,
  34697. enumerable: true,
  34698. configurable: true,
  34699. writable: true
  34700. });
  34701. } else {
  34702. obj[key] = value;
  34703. }
  34704. return obj;
  34705. };
  34706. var _extends = Object.assign || function (target) {
  34707. for (var i = 1; i < arguments.length; i++) {
  34708. var source = arguments[i];
  34709. for (var key in source) {
  34710. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34711. target[key] = source[key];
  34712. }
  34713. }
  34714. }
  34715. return target;
  34716. };
  34717. /**
  34718. * Given element offsets, generate an output similar to getBoundingClientRect
  34719. * @method
  34720. * @memberof Popper.Utils
  34721. * @argument {Object} offsets
  34722. * @returns {Object} ClientRect like output
  34723. */
  34724. function getClientRect(offsets) {
  34725. return _extends({}, offsets, {
  34726. right: offsets.left + offsets.width,
  34727. bottom: offsets.top + offsets.height
  34728. });
  34729. }
  34730. /**
  34731. * Get bounding client rect of given element
  34732. * @method
  34733. * @memberof Popper.Utils
  34734. * @param {HTMLElement} element
  34735. * @return {Object} client rect
  34736. */
  34737. function getBoundingClientRect(element) {
  34738. var rect = {};
  34739. // IE10 10 FIX: Please, don't ask, the element isn't
  34740. // considered in DOM in some circumstances...
  34741. // This isn't reproducible in IE10 compatibility mode of IE11
  34742. try {
  34743. if (isIE(10)) {
  34744. rect = element.getBoundingClientRect();
  34745. var scrollTop = getScroll(element, 'top');
  34746. var scrollLeft = getScroll(element, 'left');
  34747. rect.top += scrollTop;
  34748. rect.left += scrollLeft;
  34749. rect.bottom += scrollTop;
  34750. rect.right += scrollLeft;
  34751. } else {
  34752. rect = element.getBoundingClientRect();
  34753. }
  34754. } catch (e) {}
  34755. var result = {
  34756. left: rect.left,
  34757. top: rect.top,
  34758. width: rect.right - rect.left,
  34759. height: rect.bottom - rect.top
  34760. };
  34761. // subtract scrollbar size from sizes
  34762. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34763. var width = sizes.width || element.clientWidth || result.width;
  34764. var height = sizes.height || element.clientHeight || result.height;
  34765. var horizScrollbar = element.offsetWidth - width;
  34766. var vertScrollbar = element.offsetHeight - height;
  34767. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34768. // we make this check conditional for performance reasons
  34769. if (horizScrollbar || vertScrollbar) {
  34770. var styles = getStyleComputedProperty(element);
  34771. horizScrollbar -= getBordersSize(styles, 'x');
  34772. vertScrollbar -= getBordersSize(styles, 'y');
  34773. result.width -= horizScrollbar;
  34774. result.height -= vertScrollbar;
  34775. }
  34776. return getClientRect(result);
  34777. }
  34778. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34779. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34780. var isIE10 = isIE(10);
  34781. var isHTML = parent.nodeName === 'HTML';
  34782. var childrenRect = getBoundingClientRect(children);
  34783. var parentRect = getBoundingClientRect(parent);
  34784. var scrollParent = getScrollParent(children);
  34785. var styles = getStyleComputedProperty(parent);
  34786. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34787. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34788. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34789. if (fixedPosition && isHTML) {
  34790. parentRect.top = Math.max(parentRect.top, 0);
  34791. parentRect.left = Math.max(parentRect.left, 0);
  34792. }
  34793. var offsets = getClientRect({
  34794. top: childrenRect.top - parentRect.top - borderTopWidth,
  34795. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34796. width: childrenRect.width,
  34797. height: childrenRect.height
  34798. });
  34799. offsets.marginTop = 0;
  34800. offsets.marginLeft = 0;
  34801. // Subtract margins of documentElement in case it's being used as parent
  34802. // we do this only on HTML because it's the only element that behaves
  34803. // differently when margins are applied to it. The margins are included in
  34804. // the box of the documentElement, in the other cases not.
  34805. if (!isIE10 && isHTML) {
  34806. var marginTop = parseFloat(styles.marginTop);
  34807. var marginLeft = parseFloat(styles.marginLeft);
  34808. offsets.top -= borderTopWidth - marginTop;
  34809. offsets.bottom -= borderTopWidth - marginTop;
  34810. offsets.left -= borderLeftWidth - marginLeft;
  34811. offsets.right -= borderLeftWidth - marginLeft;
  34812. // Attach marginTop and marginLeft because in some circumstances we may need them
  34813. offsets.marginTop = marginTop;
  34814. offsets.marginLeft = marginLeft;
  34815. }
  34816. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34817. offsets = includeScroll(offsets, parent);
  34818. }
  34819. return offsets;
  34820. }
  34821. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34822. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34823. var html = element.ownerDocument.documentElement;
  34824. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34825. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34826. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34827. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34828. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34829. var offset = {
  34830. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34831. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34832. width: width,
  34833. height: height
  34834. };
  34835. return getClientRect(offset);
  34836. }
  34837. /**
  34838. * Check if the given element is fixed or is inside a fixed parent
  34839. * @method
  34840. * @memberof Popper.Utils
  34841. * @argument {Element} element
  34842. * @argument {Element} customContainer
  34843. * @returns {Boolean} answer to "isFixed?"
  34844. */
  34845. function isFixed(element) {
  34846. var nodeName = element.nodeName;
  34847. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34848. return false;
  34849. }
  34850. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34851. return true;
  34852. }
  34853. var parentNode = getParentNode(element);
  34854. if (!parentNode) {
  34855. return false;
  34856. }
  34857. return isFixed(parentNode);
  34858. }
  34859. /**
  34860. * Finds the first parent of an element that has a transformed property defined
  34861. * @method
  34862. * @memberof Popper.Utils
  34863. * @argument {Element} element
  34864. * @returns {Element} first transformed parent or documentElement
  34865. */
  34866. function getFixedPositionOffsetParent(element) {
  34867. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34868. if (!element || !element.parentElement || isIE()) {
  34869. return document.documentElement;
  34870. }
  34871. var el = element.parentElement;
  34872. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34873. el = el.parentElement;
  34874. }
  34875. return el || document.documentElement;
  34876. }
  34877. /**
  34878. * Computed the boundaries limits and return them
  34879. * @method
  34880. * @memberof Popper.Utils
  34881. * @param {HTMLElement} popper
  34882. * @param {HTMLElement} reference
  34883. * @param {number} padding
  34884. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34885. * @param {Boolean} fixedPosition - Is in fixed position mode
  34886. * @returns {Object} Coordinates of the boundaries
  34887. */
  34888. function getBoundaries(popper, reference, padding, boundariesElement) {
  34889. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34890. // NOTE: 1 DOM access here
  34891. var boundaries = { top: 0, left: 0 };
  34892. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34893. // Handle viewport case
  34894. if (boundariesElement === 'viewport') {
  34895. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34896. } else {
  34897. // Handle other cases based on DOM element used as boundaries
  34898. var boundariesNode = void 0;
  34899. if (boundariesElement === 'scrollParent') {
  34900. boundariesNode = getScrollParent(getParentNode(reference));
  34901. if (boundariesNode.nodeName === 'BODY') {
  34902. boundariesNode = popper.ownerDocument.documentElement;
  34903. }
  34904. } else if (boundariesElement === 'window') {
  34905. boundariesNode = popper.ownerDocument.documentElement;
  34906. } else {
  34907. boundariesNode = boundariesElement;
  34908. }
  34909. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  34910. // In case of HTML, we need a different computation
  34911. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  34912. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  34913. height = _getWindowSizes.height,
  34914. width = _getWindowSizes.width;
  34915. boundaries.top += offsets.top - offsets.marginTop;
  34916. boundaries.bottom = height + offsets.top;
  34917. boundaries.left += offsets.left - offsets.marginLeft;
  34918. boundaries.right = width + offsets.left;
  34919. } else {
  34920. // for all the other DOM elements, this one is good
  34921. boundaries = offsets;
  34922. }
  34923. }
  34924. // Add paddings
  34925. padding = padding || 0;
  34926. var isPaddingNumber = typeof padding === 'number';
  34927. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  34928. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  34929. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  34930. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  34931. return boundaries;
  34932. }
  34933. function getArea(_ref) {
  34934. var width = _ref.width,
  34935. height = _ref.height;
  34936. return width * height;
  34937. }
  34938. /**
  34939. * Utility used to transform the `auto` placement to the placement with more
  34940. * available space.
  34941. * @method
  34942. * @memberof Popper.Utils
  34943. * @argument {Object} data - The data object generated by update method
  34944. * @argument {Object} options - Modifiers configuration and options
  34945. * @returns {Object} The data object, properly modified
  34946. */
  34947. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  34948. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  34949. if (placement.indexOf('auto') === -1) {
  34950. return placement;
  34951. }
  34952. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  34953. var rects = {
  34954. top: {
  34955. width: boundaries.width,
  34956. height: refRect.top - boundaries.top
  34957. },
  34958. right: {
  34959. width: boundaries.right - refRect.right,
  34960. height: boundaries.height
  34961. },
  34962. bottom: {
  34963. width: boundaries.width,
  34964. height: boundaries.bottom - refRect.bottom
  34965. },
  34966. left: {
  34967. width: refRect.left - boundaries.left,
  34968. height: boundaries.height
  34969. }
  34970. };
  34971. var sortedAreas = Object.keys(rects).map(function (key) {
  34972. return _extends({
  34973. key: key
  34974. }, rects[key], {
  34975. area: getArea(rects[key])
  34976. });
  34977. }).sort(function (a, b) {
  34978. return b.area - a.area;
  34979. });
  34980. var filteredAreas = sortedAreas.filter(function (_ref2) {
  34981. var width = _ref2.width,
  34982. height = _ref2.height;
  34983. return width >= popper.clientWidth && height >= popper.clientHeight;
  34984. });
  34985. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  34986. var variation = placement.split('-')[1];
  34987. return computedPlacement + (variation ? '-' + variation : '');
  34988. }
  34989. /**
  34990. * Get offsets to the reference element
  34991. * @method
  34992. * @memberof Popper.Utils
  34993. * @param {Object} state
  34994. * @param {Element} popper - the popper element
  34995. * @param {Element} reference - the reference element (the popper will be relative to this)
  34996. * @param {Element} fixedPosition - is in fixed position mode
  34997. * @returns {Object} An object containing the offsets which will be applied to the popper
  34998. */
  34999. function getReferenceOffsets(state, popper, reference) {
  35000. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35001. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35002. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35003. }
  35004. /**
  35005. * Get the outer sizes of the given element (offset size + margins)
  35006. * @method
  35007. * @memberof Popper.Utils
  35008. * @argument {Element} element
  35009. * @returns {Object} object containing width and height properties
  35010. */
  35011. function getOuterSizes(element) {
  35012. var window = element.ownerDocument.defaultView;
  35013. var styles = window.getComputedStyle(element);
  35014. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35015. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35016. var result = {
  35017. width: element.offsetWidth + y,
  35018. height: element.offsetHeight + x
  35019. };
  35020. return result;
  35021. }
  35022. /**
  35023. * Get the opposite placement of the given one
  35024. * @method
  35025. * @memberof Popper.Utils
  35026. * @argument {String} placement
  35027. * @returns {String} flipped placement
  35028. */
  35029. function getOppositePlacement(placement) {
  35030. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35031. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35032. return hash[matched];
  35033. });
  35034. }
  35035. /**
  35036. * Get offsets to the popper
  35037. * @method
  35038. * @memberof Popper.Utils
  35039. * @param {Object} position - CSS position the Popper will get applied
  35040. * @param {HTMLElement} popper - the popper element
  35041. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35042. * @param {String} placement - one of the valid placement options
  35043. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35044. */
  35045. function getPopperOffsets(popper, referenceOffsets, placement) {
  35046. placement = placement.split('-')[0];
  35047. // Get popper node sizes
  35048. var popperRect = getOuterSizes(popper);
  35049. // Add position, width and height to our offsets object
  35050. var popperOffsets = {
  35051. width: popperRect.width,
  35052. height: popperRect.height
  35053. };
  35054. // depending by the popper placement we have to compute its offsets slightly differently
  35055. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35056. var mainSide = isHoriz ? 'top' : 'left';
  35057. var secondarySide = isHoriz ? 'left' : 'top';
  35058. var measurement = isHoriz ? 'height' : 'width';
  35059. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35060. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35061. if (placement === secondarySide) {
  35062. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35063. } else {
  35064. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35065. }
  35066. return popperOffsets;
  35067. }
  35068. /**
  35069. * Mimics the `find` method of Array
  35070. * @method
  35071. * @memberof Popper.Utils
  35072. * @argument {Array} arr
  35073. * @argument prop
  35074. * @argument value
  35075. * @returns index or -1
  35076. */
  35077. function find(arr, check) {
  35078. // use native find if supported
  35079. if (Array.prototype.find) {
  35080. return arr.find(check);
  35081. }
  35082. // use `filter` to obtain the same behavior of `find`
  35083. return arr.filter(check)[0];
  35084. }
  35085. /**
  35086. * Return the index of the matching object
  35087. * @method
  35088. * @memberof Popper.Utils
  35089. * @argument {Array} arr
  35090. * @argument prop
  35091. * @argument value
  35092. * @returns index or -1
  35093. */
  35094. function findIndex(arr, prop, value) {
  35095. // use native findIndex if supported
  35096. if (Array.prototype.findIndex) {
  35097. return arr.findIndex(function (cur) {
  35098. return cur[prop] === value;
  35099. });
  35100. }
  35101. // use `find` + `indexOf` if `findIndex` isn't supported
  35102. var match = find(arr, function (obj) {
  35103. return obj[prop] === value;
  35104. });
  35105. return arr.indexOf(match);
  35106. }
  35107. /**
  35108. * Loop trough the list of modifiers and run them in order,
  35109. * each of them will then edit the data object.
  35110. * @method
  35111. * @memberof Popper.Utils
  35112. * @param {dataObject} data
  35113. * @param {Array} modifiers
  35114. * @param {String} ends - Optional modifier name used as stopper
  35115. * @returns {dataObject}
  35116. */
  35117. function runModifiers(modifiers, data, ends) {
  35118. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35119. modifiersToRun.forEach(function (modifier) {
  35120. if (modifier['function']) {
  35121. // eslint-disable-line dot-notation
  35122. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35123. }
  35124. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35125. if (modifier.enabled && isFunction(fn)) {
  35126. // Add properties to offsets to make them a complete clientRect object
  35127. // we do this before each modifier to make sure the previous one doesn't
  35128. // mess with these values
  35129. data.offsets.popper = getClientRect(data.offsets.popper);
  35130. data.offsets.reference = getClientRect(data.offsets.reference);
  35131. data = fn(data, modifier);
  35132. }
  35133. });
  35134. return data;
  35135. }
  35136. /**
  35137. * Updates the position of the popper, computing the new offsets and applying
  35138. * the new style.<br />
  35139. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35140. * @method
  35141. * @memberof Popper
  35142. */
  35143. function update() {
  35144. // if popper is destroyed, don't perform any further update
  35145. if (this.state.isDestroyed) {
  35146. return;
  35147. }
  35148. var data = {
  35149. instance: this,
  35150. styles: {},
  35151. arrowStyles: {},
  35152. attributes: {},
  35153. flipped: false,
  35154. offsets: {}
  35155. };
  35156. // compute reference element offsets
  35157. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35158. // compute auto placement, store placement inside the data object,
  35159. // modifiers will be able to edit `placement` if needed
  35160. // and refer to originalPlacement to know the original value
  35161. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35162. // store the computed placement inside `originalPlacement`
  35163. data.originalPlacement = data.placement;
  35164. data.positionFixed = this.options.positionFixed;
  35165. // compute the popper offsets
  35166. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35167. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35168. // run the modifiers
  35169. data = runModifiers(this.modifiers, data);
  35170. // the first `update` will call `onCreate` callback
  35171. // the other ones will call `onUpdate` callback
  35172. if (!this.state.isCreated) {
  35173. this.state.isCreated = true;
  35174. this.options.onCreate(data);
  35175. } else {
  35176. this.options.onUpdate(data);
  35177. }
  35178. }
  35179. /**
  35180. * Helper used to know if the given modifier is enabled.
  35181. * @method
  35182. * @memberof Popper.Utils
  35183. * @returns {Boolean}
  35184. */
  35185. function isModifierEnabled(modifiers, modifierName) {
  35186. return modifiers.some(function (_ref) {
  35187. var name = _ref.name,
  35188. enabled = _ref.enabled;
  35189. return enabled && name === modifierName;
  35190. });
  35191. }
  35192. /**
  35193. * Get the prefixed supported property name
  35194. * @method
  35195. * @memberof Popper.Utils
  35196. * @argument {String} property (camelCase)
  35197. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35198. */
  35199. function getSupportedPropertyName(property) {
  35200. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35201. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35202. for (var i = 0; i < prefixes.length; i++) {
  35203. var prefix = prefixes[i];
  35204. var toCheck = prefix ? '' + prefix + upperProp : property;
  35205. if (typeof document.body.style[toCheck] !== 'undefined') {
  35206. return toCheck;
  35207. }
  35208. }
  35209. return null;
  35210. }
  35211. /**
  35212. * Destroys the popper.
  35213. * @method
  35214. * @memberof Popper
  35215. */
  35216. function destroy() {
  35217. this.state.isDestroyed = true;
  35218. // touch DOM only if `applyStyle` modifier is enabled
  35219. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35220. this.popper.removeAttribute('x-placement');
  35221. this.popper.style.position = '';
  35222. this.popper.style.top = '';
  35223. this.popper.style.left = '';
  35224. this.popper.style.right = '';
  35225. this.popper.style.bottom = '';
  35226. this.popper.style.willChange = '';
  35227. this.popper.style[getSupportedPropertyName('transform')] = '';
  35228. }
  35229. this.disableEventListeners();
  35230. // remove the popper if user explicitly asked for the deletion on destroy
  35231. // do not use `remove` because IE11 doesn't support it
  35232. if (this.options.removeOnDestroy) {
  35233. this.popper.parentNode.removeChild(this.popper);
  35234. }
  35235. return this;
  35236. }
  35237. /**
  35238. * Get the window associated with the element
  35239. * @argument {Element} element
  35240. * @returns {Window}
  35241. */
  35242. function getWindow(element) {
  35243. var ownerDocument = element.ownerDocument;
  35244. return ownerDocument ? ownerDocument.defaultView : window;
  35245. }
  35246. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35247. var isBody = scrollParent.nodeName === 'BODY';
  35248. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35249. target.addEventListener(event, callback, { passive: true });
  35250. if (!isBody) {
  35251. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35252. }
  35253. scrollParents.push(target);
  35254. }
  35255. /**
  35256. * Setup needed event listeners used to update the popper position
  35257. * @method
  35258. * @memberof Popper.Utils
  35259. * @private
  35260. */
  35261. function setupEventListeners(reference, options, state, updateBound) {
  35262. // Resize event listener on window
  35263. state.updateBound = updateBound;
  35264. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35265. // Scroll event listener on scroll parents
  35266. var scrollElement = getScrollParent(reference);
  35267. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35268. state.scrollElement = scrollElement;
  35269. state.eventsEnabled = true;
  35270. return state;
  35271. }
  35272. /**
  35273. * It will add resize/scroll events and start recalculating
  35274. * position of the popper element when they are triggered.
  35275. * @method
  35276. * @memberof Popper
  35277. */
  35278. function enableEventListeners() {
  35279. if (!this.state.eventsEnabled) {
  35280. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35281. }
  35282. }
  35283. /**
  35284. * Remove event listeners used to update the popper position
  35285. * @method
  35286. * @memberof Popper.Utils
  35287. * @private
  35288. */
  35289. function removeEventListeners(reference, state) {
  35290. // Remove resize event listener on window
  35291. getWindow(reference).removeEventListener('resize', state.updateBound);
  35292. // Remove scroll event listener on scroll parents
  35293. state.scrollParents.forEach(function (target) {
  35294. target.removeEventListener('scroll', state.updateBound);
  35295. });
  35296. // Reset state
  35297. state.updateBound = null;
  35298. state.scrollParents = [];
  35299. state.scrollElement = null;
  35300. state.eventsEnabled = false;
  35301. return state;
  35302. }
  35303. /**
  35304. * It will remove resize/scroll events and won't recalculate popper position
  35305. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35306. * unless you call `update` method manually.
  35307. * @method
  35308. * @memberof Popper
  35309. */
  35310. function disableEventListeners() {
  35311. if (this.state.eventsEnabled) {
  35312. cancelAnimationFrame(this.scheduleUpdate);
  35313. this.state = removeEventListeners(this.reference, this.state);
  35314. }
  35315. }
  35316. /**
  35317. * Tells if a given input is a number
  35318. * @method
  35319. * @memberof Popper.Utils
  35320. * @param {*} input to check
  35321. * @return {Boolean}
  35322. */
  35323. function isNumeric(n) {
  35324. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35325. }
  35326. /**
  35327. * Set the style to the given popper
  35328. * @method
  35329. * @memberof Popper.Utils
  35330. * @argument {Element} element - Element to apply the style to
  35331. * @argument {Object} styles
  35332. * Object with a list of properties and values which will be applied to the element
  35333. */
  35334. function setStyles(element, styles) {
  35335. Object.keys(styles).forEach(function (prop) {
  35336. var unit = '';
  35337. // add unit if the value is numeric and is one of the following
  35338. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35339. unit = 'px';
  35340. }
  35341. element.style[prop] = styles[prop] + unit;
  35342. });
  35343. }
  35344. /**
  35345. * Set the attributes to the given popper
  35346. * @method
  35347. * @memberof Popper.Utils
  35348. * @argument {Element} element - Element to apply the attributes to
  35349. * @argument {Object} styles
  35350. * Object with a list of properties and values which will be applied to the element
  35351. */
  35352. function setAttributes(element, attributes) {
  35353. Object.keys(attributes).forEach(function (prop) {
  35354. var value = attributes[prop];
  35355. if (value !== false) {
  35356. element.setAttribute(prop, attributes[prop]);
  35357. } else {
  35358. element.removeAttribute(prop);
  35359. }
  35360. });
  35361. }
  35362. /**
  35363. * @function
  35364. * @memberof Modifiers
  35365. * @argument {Object} data - The data object generated by `update` method
  35366. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35367. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35368. * @argument {Object} options - Modifiers configuration and options
  35369. * @returns {Object} The same data object
  35370. */
  35371. function applyStyle(data) {
  35372. // any property present in `data.styles` will be applied to the popper,
  35373. // in this way we can make the 3rd party modifiers add custom styles to it
  35374. // Be aware, modifiers could override the properties defined in the previous
  35375. // lines of this modifier!
  35376. setStyles(data.instance.popper, data.styles);
  35377. // any property present in `data.attributes` will be applied to the popper,
  35378. // they will be set as HTML attributes of the element
  35379. setAttributes(data.instance.popper, data.attributes);
  35380. // if arrowElement is defined and arrowStyles has some properties
  35381. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35382. setStyles(data.arrowElement, data.arrowStyles);
  35383. }
  35384. return data;
  35385. }
  35386. /**
  35387. * Set the x-placement attribute before everything else because it could be used
  35388. * to add margins to the popper margins needs to be calculated to get the
  35389. * correct popper offsets.
  35390. * @method
  35391. * @memberof Popper.modifiers
  35392. * @param {HTMLElement} reference - The reference element used to position the popper
  35393. * @param {HTMLElement} popper - The HTML element used as popper
  35394. * @param {Object} options - Popper.js options
  35395. */
  35396. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35397. // compute reference element offsets
  35398. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35399. // compute auto placement, store placement inside the data object,
  35400. // modifiers will be able to edit `placement` if needed
  35401. // and refer to originalPlacement to know the original value
  35402. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35403. popper.setAttribute('x-placement', placement);
  35404. // Apply `position` to popper before anything else because
  35405. // without the position applied we can't guarantee correct computations
  35406. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35407. return options;
  35408. }
  35409. /**
  35410. * @function
  35411. * @memberof Popper.Utils
  35412. * @argument {Object} data - The data object generated by `update` method
  35413. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35414. * @returns {Object} The popper's position offsets rounded
  35415. *
  35416. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35417. * good as it can be within reason.
  35418. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35419. *
  35420. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35421. * as well on High DPI screens).
  35422. *
  35423. * Firefox prefers no rounding for positioning and does not have blurriness on
  35424. * high DPI screens.
  35425. *
  35426. * Only horizontal placement and left/right values need to be considered.
  35427. */
  35428. function getRoundedOffsets(data, shouldRound) {
  35429. var _data$offsets = data.offsets,
  35430. popper = _data$offsets.popper,
  35431. reference = _data$offsets.reference;
  35432. var round = Math.round,
  35433. floor = Math.floor;
  35434. var noRound = function noRound(v) {
  35435. return v;
  35436. };
  35437. var referenceWidth = round(reference.width);
  35438. var popperWidth = round(popper.width);
  35439. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35440. var isVariation = data.placement.indexOf('-') !== -1;
  35441. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35442. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35443. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35444. var verticalToInteger = !shouldRound ? noRound : round;
  35445. return {
  35446. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35447. top: verticalToInteger(popper.top),
  35448. bottom: verticalToInteger(popper.bottom),
  35449. right: horizontalToInteger(popper.right)
  35450. };
  35451. }
  35452. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35453. /**
  35454. * @function
  35455. * @memberof Modifiers
  35456. * @argument {Object} data - The data object generated by `update` method
  35457. * @argument {Object} options - Modifiers configuration and options
  35458. * @returns {Object} The data object, properly modified
  35459. */
  35460. function computeStyle(data, options) {
  35461. var x = options.x,
  35462. y = options.y;
  35463. var popper = data.offsets.popper;
  35464. // Remove this legacy support in Popper.js v2
  35465. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35466. return modifier.name === 'applyStyle';
  35467. }).gpuAcceleration;
  35468. if (legacyGpuAccelerationOption !== undefined) {
  35469. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35470. }
  35471. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35472. var offsetParent = getOffsetParent(data.instance.popper);
  35473. var offsetParentRect = getBoundingClientRect(offsetParent);
  35474. // Styles
  35475. var styles = {
  35476. position: popper.position
  35477. };
  35478. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35479. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35480. var sideB = y === 'right' ? 'left' : 'right';
  35481. // if gpuAcceleration is set to `true` and transform is supported,
  35482. // we use `translate3d` to apply the position to the popper we
  35483. // automatically use the supported prefixed version if needed
  35484. var prefixedProperty = getSupportedPropertyName('transform');
  35485. // now, let's make a step back and look at this code closely (wtf?)
  35486. // If the content of the popper grows once it's been positioned, it
  35487. // may happen that the popper gets misplaced because of the new content
  35488. // overflowing its reference element
  35489. // To avoid this problem, we provide two options (x and y), which allow
  35490. // the consumer to define the offset origin.
  35491. // If we position a popper on top of a reference element, we can set
  35492. // `x` to `top` to make the popper grow towards its top instead of
  35493. // its bottom.
  35494. var left = void 0,
  35495. top = void 0;
  35496. if (sideA === 'bottom') {
  35497. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35498. // and not the bottom of the html element
  35499. if (offsetParent.nodeName === 'HTML') {
  35500. top = -offsetParent.clientHeight + offsets.bottom;
  35501. } else {
  35502. top = -offsetParentRect.height + offsets.bottom;
  35503. }
  35504. } else {
  35505. top = offsets.top;
  35506. }
  35507. if (sideB === 'right') {
  35508. if (offsetParent.nodeName === 'HTML') {
  35509. left = -offsetParent.clientWidth + offsets.right;
  35510. } else {
  35511. left = -offsetParentRect.width + offsets.right;
  35512. }
  35513. } else {
  35514. left = offsets.left;
  35515. }
  35516. if (gpuAcceleration && prefixedProperty) {
  35517. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35518. styles[sideA] = 0;
  35519. styles[sideB] = 0;
  35520. styles.willChange = 'transform';
  35521. } else {
  35522. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35523. var invertTop = sideA === 'bottom' ? -1 : 1;
  35524. var invertLeft = sideB === 'right' ? -1 : 1;
  35525. styles[sideA] = top * invertTop;
  35526. styles[sideB] = left * invertLeft;
  35527. styles.willChange = sideA + ', ' + sideB;
  35528. }
  35529. // Attributes
  35530. var attributes = {
  35531. 'x-placement': data.placement
  35532. };
  35533. // Update `data` attributes, styles and arrowStyles
  35534. data.attributes = _extends({}, attributes, data.attributes);
  35535. data.styles = _extends({}, styles, data.styles);
  35536. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35537. return data;
  35538. }
  35539. /**
  35540. * Helper used to know if the given modifier depends from another one.<br />
  35541. * It checks if the needed modifier is listed and enabled.
  35542. * @method
  35543. * @memberof Popper.Utils
  35544. * @param {Array} modifiers - list of modifiers
  35545. * @param {String} requestingName - name of requesting modifier
  35546. * @param {String} requestedName - name of requested modifier
  35547. * @returns {Boolean}
  35548. */
  35549. function isModifierRequired(modifiers, requestingName, requestedName) {
  35550. var requesting = find(modifiers, function (_ref) {
  35551. var name = _ref.name;
  35552. return name === requestingName;
  35553. });
  35554. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35555. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35556. });
  35557. if (!isRequired) {
  35558. var _requesting = '`' + requestingName + '`';
  35559. var requested = '`' + requestedName + '`';
  35560. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35561. }
  35562. return isRequired;
  35563. }
  35564. /**
  35565. * @function
  35566. * @memberof Modifiers
  35567. * @argument {Object} data - The data object generated by update method
  35568. * @argument {Object} options - Modifiers configuration and options
  35569. * @returns {Object} The data object, properly modified
  35570. */
  35571. function arrow(data, options) {
  35572. var _data$offsets$arrow;
  35573. // arrow depends on keepTogether in order to work
  35574. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35575. return data;
  35576. }
  35577. var arrowElement = options.element;
  35578. // if arrowElement is a string, suppose it's a CSS selector
  35579. if (typeof arrowElement === 'string') {
  35580. arrowElement = data.instance.popper.querySelector(arrowElement);
  35581. // if arrowElement is not found, don't run the modifier
  35582. if (!arrowElement) {
  35583. return data;
  35584. }
  35585. } else {
  35586. // if the arrowElement isn't a query selector we must check that the
  35587. // provided DOM node is child of its popper node
  35588. if (!data.instance.popper.contains(arrowElement)) {
  35589. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35590. return data;
  35591. }
  35592. }
  35593. var placement = data.placement.split('-')[0];
  35594. var _data$offsets = data.offsets,
  35595. popper = _data$offsets.popper,
  35596. reference = _data$offsets.reference;
  35597. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35598. var len = isVertical ? 'height' : 'width';
  35599. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35600. var side = sideCapitalized.toLowerCase();
  35601. var altSide = isVertical ? 'left' : 'top';
  35602. var opSide = isVertical ? 'bottom' : 'right';
  35603. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35604. //
  35605. // extends keepTogether behavior making sure the popper and its
  35606. // reference have enough pixels in conjunction
  35607. //
  35608. // top/left side
  35609. if (reference[opSide] - arrowElementSize < popper[side]) {
  35610. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35611. }
  35612. // bottom/right side
  35613. if (reference[side] + arrowElementSize > popper[opSide]) {
  35614. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35615. }
  35616. data.offsets.popper = getClientRect(data.offsets.popper);
  35617. // compute center of the popper
  35618. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35619. // Compute the sideValue using the updated popper offsets
  35620. // take popper margin in account because we don't have this info available
  35621. var css = getStyleComputedProperty(data.instance.popper);
  35622. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35623. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35624. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35625. // prevent arrowElement from being placed not contiguously to its popper
  35626. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35627. data.arrowElement = arrowElement;
  35628. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35629. return data;
  35630. }
  35631. /**
  35632. * Get the opposite placement variation of the given one
  35633. * @method
  35634. * @memberof Popper.Utils
  35635. * @argument {String} placement variation
  35636. * @returns {String} flipped placement variation
  35637. */
  35638. function getOppositeVariation(variation) {
  35639. if (variation === 'end') {
  35640. return 'start';
  35641. } else if (variation === 'start') {
  35642. return 'end';
  35643. }
  35644. return variation;
  35645. }
  35646. /**
  35647. * List of accepted placements to use as values of the `placement` option.<br />
  35648. * Valid placements are:
  35649. * - `auto`
  35650. * - `top`
  35651. * - `right`
  35652. * - `bottom`
  35653. * - `left`
  35654. *
  35655. * Each placement can have a variation from this list:
  35656. * - `-start`
  35657. * - `-end`
  35658. *
  35659. * Variations are interpreted easily if you think of them as the left to right
  35660. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35661. * is right.<br />
  35662. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35663. *
  35664. * Some valid examples are:
  35665. * - `top-end` (on top of reference, right aligned)
  35666. * - `right-start` (on right of reference, top aligned)
  35667. * - `bottom` (on bottom, centered)
  35668. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35669. *
  35670. * @static
  35671. * @type {Array}
  35672. * @enum {String}
  35673. * @readonly
  35674. * @method placements
  35675. * @memberof Popper
  35676. */
  35677. 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'];
  35678. // Get rid of `auto` `auto-start` and `auto-end`
  35679. var validPlacements = placements.slice(3);
  35680. /**
  35681. * Given an initial placement, returns all the subsequent placements
  35682. * clockwise (or counter-clockwise).
  35683. *
  35684. * @method
  35685. * @memberof Popper.Utils
  35686. * @argument {String} placement - A valid placement (it accepts variations)
  35687. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35688. * @returns {Array} placements including their variations
  35689. */
  35690. function clockwise(placement) {
  35691. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35692. var index = validPlacements.indexOf(placement);
  35693. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35694. return counter ? arr.reverse() : arr;
  35695. }
  35696. var BEHAVIORS = {
  35697. FLIP: 'flip',
  35698. CLOCKWISE: 'clockwise',
  35699. COUNTERCLOCKWISE: 'counterclockwise'
  35700. };
  35701. /**
  35702. * @function
  35703. * @memberof Modifiers
  35704. * @argument {Object} data - The data object generated by update method
  35705. * @argument {Object} options - Modifiers configuration and options
  35706. * @returns {Object} The data object, properly modified
  35707. */
  35708. function flip(data, options) {
  35709. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35710. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35711. return data;
  35712. }
  35713. if (data.flipped && data.placement === data.originalPlacement) {
  35714. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35715. return data;
  35716. }
  35717. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35718. var placement = data.placement.split('-')[0];
  35719. var placementOpposite = getOppositePlacement(placement);
  35720. var variation = data.placement.split('-')[1] || '';
  35721. var flipOrder = [];
  35722. switch (options.behavior) {
  35723. case BEHAVIORS.FLIP:
  35724. flipOrder = [placement, placementOpposite];
  35725. break;
  35726. case BEHAVIORS.CLOCKWISE:
  35727. flipOrder = clockwise(placement);
  35728. break;
  35729. case BEHAVIORS.COUNTERCLOCKWISE:
  35730. flipOrder = clockwise(placement, true);
  35731. break;
  35732. default:
  35733. flipOrder = options.behavior;
  35734. }
  35735. flipOrder.forEach(function (step, index) {
  35736. if (placement !== step || flipOrder.length === index + 1) {
  35737. return data;
  35738. }
  35739. placement = data.placement.split('-')[0];
  35740. placementOpposite = getOppositePlacement(placement);
  35741. var popperOffsets = data.offsets.popper;
  35742. var refOffsets = data.offsets.reference;
  35743. // using floor because the reference offsets may contain decimals we are not going to consider here
  35744. var floor = Math.floor;
  35745. 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);
  35746. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35747. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35748. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35749. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35750. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35751. // flip the variation if required
  35752. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35753. // flips variation if reference element overflows boundaries
  35754. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35755. // flips variation if popper content overflows boundaries
  35756. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35757. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35758. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35759. // this boolean to detect any flip loop
  35760. data.flipped = true;
  35761. if (overlapsRef || overflowsBoundaries) {
  35762. placement = flipOrder[index + 1];
  35763. }
  35764. if (flippedVariation) {
  35765. variation = getOppositeVariation(variation);
  35766. }
  35767. data.placement = placement + (variation ? '-' + variation : '');
  35768. // this object contains `position`, we want to preserve it along with
  35769. // any additional property we may add in the future
  35770. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35771. data = runModifiers(data.instance.modifiers, data, 'flip');
  35772. }
  35773. });
  35774. return data;
  35775. }
  35776. /**
  35777. * @function
  35778. * @memberof Modifiers
  35779. * @argument {Object} data - The data object generated by update method
  35780. * @argument {Object} options - Modifiers configuration and options
  35781. * @returns {Object} The data object, properly modified
  35782. */
  35783. function keepTogether(data) {
  35784. var _data$offsets = data.offsets,
  35785. popper = _data$offsets.popper,
  35786. reference = _data$offsets.reference;
  35787. var placement = data.placement.split('-')[0];
  35788. var floor = Math.floor;
  35789. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35790. var side = isVertical ? 'right' : 'bottom';
  35791. var opSide = isVertical ? 'left' : 'top';
  35792. var measurement = isVertical ? 'width' : 'height';
  35793. if (popper[side] < floor(reference[opSide])) {
  35794. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35795. }
  35796. if (popper[opSide] > floor(reference[side])) {
  35797. data.offsets.popper[opSide] = floor(reference[side]);
  35798. }
  35799. return data;
  35800. }
  35801. /**
  35802. * Converts a string containing value + unit into a px value number
  35803. * @function
  35804. * @memberof {modifiers~offset}
  35805. * @private
  35806. * @argument {String} str - Value + unit string
  35807. * @argument {String} measurement - `height` or `width`
  35808. * @argument {Object} popperOffsets
  35809. * @argument {Object} referenceOffsets
  35810. * @returns {Number|String}
  35811. * Value in pixels, or original string if no values were extracted
  35812. */
  35813. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35814. // separate value from unit
  35815. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35816. var value = +split[1];
  35817. var unit = split[2];
  35818. // If it's not a number it's an operator, I guess
  35819. if (!value) {
  35820. return str;
  35821. }
  35822. if (unit.indexOf('%') === 0) {
  35823. var element = void 0;
  35824. switch (unit) {
  35825. case '%p':
  35826. element = popperOffsets;
  35827. break;
  35828. case '%':
  35829. case '%r':
  35830. default:
  35831. element = referenceOffsets;
  35832. }
  35833. var rect = getClientRect(element);
  35834. return rect[measurement] / 100 * value;
  35835. } else if (unit === 'vh' || unit === 'vw') {
  35836. // if is a vh or vw, we calculate the size based on the viewport
  35837. var size = void 0;
  35838. if (unit === 'vh') {
  35839. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35840. } else {
  35841. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35842. }
  35843. return size / 100 * value;
  35844. } else {
  35845. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35846. // if is an implicit unit, it's px, and we return just the value
  35847. return value;
  35848. }
  35849. }
  35850. /**
  35851. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35852. * @function
  35853. * @memberof {modifiers~offset}
  35854. * @private
  35855. * @argument {String} offset
  35856. * @argument {Object} popperOffsets
  35857. * @argument {Object} referenceOffsets
  35858. * @argument {String} basePlacement
  35859. * @returns {Array} a two cells array with x and y offsets in numbers
  35860. */
  35861. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35862. var offsets = [0, 0];
  35863. // Use height if placement is left or right and index is 0 otherwise use width
  35864. // in this way the first offset will use an axis and the second one
  35865. // will use the other one
  35866. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35867. // Split the offset string to obtain a list of values and operands
  35868. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35869. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35870. return frag.trim();
  35871. });
  35872. // Detect if the offset string contains a pair of values or a single one
  35873. // they could be separated by comma or space
  35874. var divider = fragments.indexOf(find(fragments, function (frag) {
  35875. return frag.search(/,|\s/) !== -1;
  35876. }));
  35877. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35878. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35879. }
  35880. // If divider is found, we divide the list of values and operands to divide
  35881. // them by ofset X and Y.
  35882. var splitRegex = /\s*,\s*|\s+/;
  35883. 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];
  35884. // Convert the values with units to absolute pixels to allow our computations
  35885. ops = ops.map(function (op, index) {
  35886. // Most of the units rely on the orientation of the popper
  35887. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35888. var mergeWithPrevious = false;
  35889. return op
  35890. // This aggregates any `+` or `-` sign that aren't considered operators
  35891. // e.g.: 10 + +5 => [10, +, +5]
  35892. .reduce(function (a, b) {
  35893. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35894. a[a.length - 1] = b;
  35895. mergeWithPrevious = true;
  35896. return a;
  35897. } else if (mergeWithPrevious) {
  35898. a[a.length - 1] += b;
  35899. mergeWithPrevious = false;
  35900. return a;
  35901. } else {
  35902. return a.concat(b);
  35903. }
  35904. }, [])
  35905. // Here we convert the string values into number values (in px)
  35906. .map(function (str) {
  35907. return toValue(str, measurement, popperOffsets, referenceOffsets);
  35908. });
  35909. });
  35910. // Loop trough the offsets arrays and execute the operations
  35911. ops.forEach(function (op, index) {
  35912. op.forEach(function (frag, index2) {
  35913. if (isNumeric(frag)) {
  35914. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  35915. }
  35916. });
  35917. });
  35918. return offsets;
  35919. }
  35920. /**
  35921. * @function
  35922. * @memberof Modifiers
  35923. * @argument {Object} data - The data object generated by update method
  35924. * @argument {Object} options - Modifiers configuration and options
  35925. * @argument {Number|String} options.offset=0
  35926. * The offset value as described in the modifier description
  35927. * @returns {Object} The data object, properly modified
  35928. */
  35929. function offset(data, _ref) {
  35930. var offset = _ref.offset;
  35931. var placement = data.placement,
  35932. _data$offsets = data.offsets,
  35933. popper = _data$offsets.popper,
  35934. reference = _data$offsets.reference;
  35935. var basePlacement = placement.split('-')[0];
  35936. var offsets = void 0;
  35937. if (isNumeric(+offset)) {
  35938. offsets = [+offset, 0];
  35939. } else {
  35940. offsets = parseOffset(offset, popper, reference, basePlacement);
  35941. }
  35942. if (basePlacement === 'left') {
  35943. popper.top += offsets[0];
  35944. popper.left -= offsets[1];
  35945. } else if (basePlacement === 'right') {
  35946. popper.top += offsets[0];
  35947. popper.left += offsets[1];
  35948. } else if (basePlacement === 'top') {
  35949. popper.left += offsets[0];
  35950. popper.top -= offsets[1];
  35951. } else if (basePlacement === 'bottom') {
  35952. popper.left += offsets[0];
  35953. popper.top += offsets[1];
  35954. }
  35955. data.popper = popper;
  35956. return data;
  35957. }
  35958. /**
  35959. * @function
  35960. * @memberof Modifiers
  35961. * @argument {Object} data - The data object generated by `update` method
  35962. * @argument {Object} options - Modifiers configuration and options
  35963. * @returns {Object} The data object, properly modified
  35964. */
  35965. function preventOverflow(data, options) {
  35966. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  35967. // If offsetParent is the reference element, we really want to
  35968. // go one step up and use the next offsetParent as reference to
  35969. // avoid to make this modifier completely useless and look like broken
  35970. if (data.instance.reference === boundariesElement) {
  35971. boundariesElement = getOffsetParent(boundariesElement);
  35972. }
  35973. // NOTE: DOM access here
  35974. // resets the popper's position so that the document size can be calculated excluding
  35975. // the size of the popper element itself
  35976. var transformProp = getSupportedPropertyName('transform');
  35977. var popperStyles = data.instance.popper.style; // assignment to help minification
  35978. var top = popperStyles.top,
  35979. left = popperStyles.left,
  35980. transform = popperStyles[transformProp];
  35981. popperStyles.top = '';
  35982. popperStyles.left = '';
  35983. popperStyles[transformProp] = '';
  35984. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  35985. // NOTE: DOM access here
  35986. // restores the original style properties after the offsets have been computed
  35987. popperStyles.top = top;
  35988. popperStyles.left = left;
  35989. popperStyles[transformProp] = transform;
  35990. options.boundaries = boundaries;
  35991. var order = options.priority;
  35992. var popper = data.offsets.popper;
  35993. var check = {
  35994. primary: function primary(placement) {
  35995. var value = popper[placement];
  35996. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  35997. value = Math.max(popper[placement], boundaries[placement]);
  35998. }
  35999. return defineProperty({}, placement, value);
  36000. },
  36001. secondary: function secondary(placement) {
  36002. var mainSide = placement === 'right' ? 'left' : 'top';
  36003. var value = popper[mainSide];
  36004. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36005. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36006. }
  36007. return defineProperty({}, mainSide, value);
  36008. }
  36009. };
  36010. order.forEach(function (placement) {
  36011. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36012. popper = _extends({}, popper, check[side](placement));
  36013. });
  36014. data.offsets.popper = popper;
  36015. return data;
  36016. }
  36017. /**
  36018. * @function
  36019. * @memberof Modifiers
  36020. * @argument {Object} data - The data object generated by `update` method
  36021. * @argument {Object} options - Modifiers configuration and options
  36022. * @returns {Object} The data object, properly modified
  36023. */
  36024. function shift(data) {
  36025. var placement = data.placement;
  36026. var basePlacement = placement.split('-')[0];
  36027. var shiftvariation = placement.split('-')[1];
  36028. // if shift shiftvariation is specified, run the modifier
  36029. if (shiftvariation) {
  36030. var _data$offsets = data.offsets,
  36031. reference = _data$offsets.reference,
  36032. popper = _data$offsets.popper;
  36033. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36034. var side = isVertical ? 'left' : 'top';
  36035. var measurement = isVertical ? 'width' : 'height';
  36036. var shiftOffsets = {
  36037. start: defineProperty({}, side, reference[side]),
  36038. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36039. };
  36040. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36041. }
  36042. return data;
  36043. }
  36044. /**
  36045. * @function
  36046. * @memberof Modifiers
  36047. * @argument {Object} data - The data object generated by update method
  36048. * @argument {Object} options - Modifiers configuration and options
  36049. * @returns {Object} The data object, properly modified
  36050. */
  36051. function hide(data) {
  36052. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36053. return data;
  36054. }
  36055. var refRect = data.offsets.reference;
  36056. var bound = find(data.instance.modifiers, function (modifier) {
  36057. return modifier.name === 'preventOverflow';
  36058. }).boundaries;
  36059. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36060. // Avoid unnecessary DOM access if visibility hasn't changed
  36061. if (data.hide === true) {
  36062. return data;
  36063. }
  36064. data.hide = true;
  36065. data.attributes['x-out-of-boundaries'] = '';
  36066. } else {
  36067. // Avoid unnecessary DOM access if visibility hasn't changed
  36068. if (data.hide === false) {
  36069. return data;
  36070. }
  36071. data.hide = false;
  36072. data.attributes['x-out-of-boundaries'] = false;
  36073. }
  36074. return data;
  36075. }
  36076. /**
  36077. * @function
  36078. * @memberof Modifiers
  36079. * @argument {Object} data - The data object generated by `update` method
  36080. * @argument {Object} options - Modifiers configuration and options
  36081. * @returns {Object} The data object, properly modified
  36082. */
  36083. function inner(data) {
  36084. var placement = data.placement;
  36085. var basePlacement = placement.split('-')[0];
  36086. var _data$offsets = data.offsets,
  36087. popper = _data$offsets.popper,
  36088. reference = _data$offsets.reference;
  36089. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36090. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36091. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36092. data.placement = getOppositePlacement(placement);
  36093. data.offsets.popper = getClientRect(popper);
  36094. return data;
  36095. }
  36096. /**
  36097. * Modifier function, each modifier can have a function of this type assigned
  36098. * to its `fn` property.<br />
  36099. * These functions will be called on each update, this means that you must
  36100. * make sure they are performant enough to avoid performance bottlenecks.
  36101. *
  36102. * @function ModifierFn
  36103. * @argument {dataObject} data - The data object generated by `update` method
  36104. * @argument {Object} options - Modifiers configuration and options
  36105. * @returns {dataObject} The data object, properly modified
  36106. */
  36107. /**
  36108. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36109. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36110. * needed by the library.
  36111. *
  36112. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36113. * All the other properties are configurations that could be tweaked.
  36114. * @namespace modifiers
  36115. */
  36116. var modifiers = {
  36117. /**
  36118. * Modifier used to shift the popper on the start or end of its reference
  36119. * element.<br />
  36120. * It will read the variation of the `placement` property.<br />
  36121. * It can be one either `-end` or `-start`.
  36122. * @memberof modifiers
  36123. * @inner
  36124. */
  36125. shift: {
  36126. /** @prop {number} order=100 - Index used to define the order of execution */
  36127. order: 100,
  36128. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36129. enabled: true,
  36130. /** @prop {ModifierFn} */
  36131. fn: shift
  36132. },
  36133. /**
  36134. * The `offset` modifier can shift your popper on both its axis.
  36135. *
  36136. * It accepts the following units:
  36137. * - `px` or unit-less, interpreted as pixels
  36138. * - `%` or `%r`, percentage relative to the length of the reference element
  36139. * - `%p`, percentage relative to the length of the popper element
  36140. * - `vw`, CSS viewport width unit
  36141. * - `vh`, CSS viewport height unit
  36142. *
  36143. * For length is intended the main axis relative to the placement of the popper.<br />
  36144. * This means that if the placement is `top` or `bottom`, the length will be the
  36145. * `width`. In case of `left` or `right`, it will be the `height`.
  36146. *
  36147. * You can provide a single value (as `Number` or `String`), or a pair of values
  36148. * as `String` divided by a comma or one (or more) white spaces.<br />
  36149. * The latter is a deprecated method because it leads to confusion and will be
  36150. * removed in v2.<br />
  36151. * Additionally, it accepts additions and subtractions between different units.
  36152. * Note that multiplications and divisions aren't supported.
  36153. *
  36154. * Valid examples are:
  36155. * ```
  36156. * 10
  36157. * '10%'
  36158. * '10, 10'
  36159. * '10%, 10'
  36160. * '10 + 10%'
  36161. * '10 - 5vh + 3%'
  36162. * '-10px + 5vh, 5px - 6%'
  36163. * ```
  36164. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36165. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36166. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36167. *
  36168. * @memberof modifiers
  36169. * @inner
  36170. */
  36171. offset: {
  36172. /** @prop {number} order=200 - Index used to define the order of execution */
  36173. order: 200,
  36174. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36175. enabled: true,
  36176. /** @prop {ModifierFn} */
  36177. fn: offset,
  36178. /** @prop {Number|String} offset=0
  36179. * The offset value as described in the modifier description
  36180. */
  36181. offset: 0
  36182. },
  36183. /**
  36184. * Modifier used to prevent the popper from being positioned outside the boundary.
  36185. *
  36186. * A scenario exists where the reference itself is not within the boundaries.<br />
  36187. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36188. * In this case we need to decide whether the popper should either:
  36189. *
  36190. * - detach from the reference and remain "trapped" in the boundaries, or
  36191. * - if it should ignore the boundary and "escape with its reference"
  36192. *
  36193. * When `escapeWithReference` is set to`true` and reference is completely
  36194. * outside its boundaries, the popper will overflow (or completely leave)
  36195. * the boundaries in order to remain attached to the edge of the reference.
  36196. *
  36197. * @memberof modifiers
  36198. * @inner
  36199. */
  36200. preventOverflow: {
  36201. /** @prop {number} order=300 - Index used to define the order of execution */
  36202. order: 300,
  36203. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36204. enabled: true,
  36205. /** @prop {ModifierFn} */
  36206. fn: preventOverflow,
  36207. /**
  36208. * @prop {Array} [priority=['left','right','top','bottom']]
  36209. * Popper will try to prevent overflow following these priorities by default,
  36210. * then, it could overflow on the left and on top of the `boundariesElement`
  36211. */
  36212. priority: ['left', 'right', 'top', 'bottom'],
  36213. /**
  36214. * @prop {number} padding=5
  36215. * Amount of pixel used to define a minimum distance between the boundaries
  36216. * and the popper. This makes sure the popper always has a little padding
  36217. * between the edges of its container
  36218. */
  36219. padding: 5,
  36220. /**
  36221. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36222. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36223. * `viewport` or any DOM element.
  36224. */
  36225. boundariesElement: 'scrollParent'
  36226. },
  36227. /**
  36228. * Modifier used to make sure the reference and its popper stay near each other
  36229. * without leaving any gap between the two. Especially useful when the arrow is
  36230. * enabled and you want to ensure that it points to its reference element.
  36231. * It cares only about the first axis. You can still have poppers with margin
  36232. * between the popper and its reference element.
  36233. * @memberof modifiers
  36234. * @inner
  36235. */
  36236. keepTogether: {
  36237. /** @prop {number} order=400 - Index used to define the order of execution */
  36238. order: 400,
  36239. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36240. enabled: true,
  36241. /** @prop {ModifierFn} */
  36242. fn: keepTogether
  36243. },
  36244. /**
  36245. * This modifier is used to move the `arrowElement` of the popper to make
  36246. * sure it is positioned between the reference element and its popper element.
  36247. * It will read the outer size of the `arrowElement` node to detect how many
  36248. * pixels of conjunction are needed.
  36249. *
  36250. * It has no effect if no `arrowElement` is provided.
  36251. * @memberof modifiers
  36252. * @inner
  36253. */
  36254. arrow: {
  36255. /** @prop {number} order=500 - Index used to define the order of execution */
  36256. order: 500,
  36257. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36258. enabled: true,
  36259. /** @prop {ModifierFn} */
  36260. fn: arrow,
  36261. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36262. element: '[x-arrow]'
  36263. },
  36264. /**
  36265. * Modifier used to flip the popper's placement when it starts to overlap its
  36266. * reference element.
  36267. *
  36268. * Requires the `preventOverflow` modifier before it in order to work.
  36269. *
  36270. * **NOTE:** this modifier will interrupt the current update cycle and will
  36271. * restart it if it detects the need to flip the placement.
  36272. * @memberof modifiers
  36273. * @inner
  36274. */
  36275. flip: {
  36276. /** @prop {number} order=600 - Index used to define the order of execution */
  36277. order: 600,
  36278. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36279. enabled: true,
  36280. /** @prop {ModifierFn} */
  36281. fn: flip,
  36282. /**
  36283. * @prop {String|Array} behavior='flip'
  36284. * The behavior used to change the popper's placement. It can be one of
  36285. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36286. * placements (with optional variations)
  36287. */
  36288. behavior: 'flip',
  36289. /**
  36290. * @prop {number} padding=5
  36291. * The popper will flip if it hits the edges of the `boundariesElement`
  36292. */
  36293. padding: 5,
  36294. /**
  36295. * @prop {String|HTMLElement} boundariesElement='viewport'
  36296. * The element which will define the boundaries of the popper position.
  36297. * The popper will never be placed outside of the defined boundaries
  36298. * (except if `keepTogether` is enabled)
  36299. */
  36300. boundariesElement: 'viewport',
  36301. /**
  36302. * @prop {Boolean} flipVariations=false
  36303. * The popper will switch placement variation between `-start` and `-end` when
  36304. * the reference element overlaps its boundaries.
  36305. *
  36306. * The original placement should have a set variation.
  36307. */
  36308. flipVariations: false,
  36309. /**
  36310. * @prop {Boolean} flipVariationsByContent=false
  36311. * The popper will switch placement variation between `-start` and `-end` when
  36312. * the popper element overlaps its reference boundaries.
  36313. *
  36314. * The original placement should have a set variation.
  36315. */
  36316. flipVariationsByContent: false
  36317. },
  36318. /**
  36319. * Modifier used to make the popper flow toward the inner of the reference element.
  36320. * By default, when this modifier is disabled, the popper will be placed outside
  36321. * the reference element.
  36322. * @memberof modifiers
  36323. * @inner
  36324. */
  36325. inner: {
  36326. /** @prop {number} order=700 - Index used to define the order of execution */
  36327. order: 700,
  36328. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36329. enabled: false,
  36330. /** @prop {ModifierFn} */
  36331. fn: inner
  36332. },
  36333. /**
  36334. * Modifier used to hide the popper when its reference element is outside of the
  36335. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36336. * be used to hide with a CSS selector the popper when its reference is
  36337. * out of boundaries.
  36338. *
  36339. * Requires the `preventOverflow` modifier before it in order to work.
  36340. * @memberof modifiers
  36341. * @inner
  36342. */
  36343. hide: {
  36344. /** @prop {number} order=800 - Index used to define the order of execution */
  36345. order: 800,
  36346. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36347. enabled: true,
  36348. /** @prop {ModifierFn} */
  36349. fn: hide
  36350. },
  36351. /**
  36352. * Computes the style that will be applied to the popper element to gets
  36353. * properly positioned.
  36354. *
  36355. * Note that this modifier will not touch the DOM, it just prepares the styles
  36356. * so that `applyStyle` modifier can apply it. This separation is useful
  36357. * in case you need to replace `applyStyle` with a custom implementation.
  36358. *
  36359. * This modifier has `850` as `order` value to maintain backward compatibility
  36360. * with previous versions of Popper.js. Expect the modifiers ordering method
  36361. * to change in future major versions of the library.
  36362. *
  36363. * @memberof modifiers
  36364. * @inner
  36365. */
  36366. computeStyle: {
  36367. /** @prop {number} order=850 - Index used to define the order of execution */
  36368. order: 850,
  36369. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36370. enabled: true,
  36371. /** @prop {ModifierFn} */
  36372. fn: computeStyle,
  36373. /**
  36374. * @prop {Boolean} gpuAcceleration=true
  36375. * If true, it uses the CSS 3D transformation to position the popper.
  36376. * Otherwise, it will use the `top` and `left` properties
  36377. */
  36378. gpuAcceleration: true,
  36379. /**
  36380. * @prop {string} [x='bottom']
  36381. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36382. * Change this if your popper should grow in a direction different from `bottom`
  36383. */
  36384. x: 'bottom',
  36385. /**
  36386. * @prop {string} [x='left']
  36387. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36388. * Change this if your popper should grow in a direction different from `right`
  36389. */
  36390. y: 'right'
  36391. },
  36392. /**
  36393. * Applies the computed styles to the popper element.
  36394. *
  36395. * All the DOM manipulations are limited to this modifier. This is useful in case
  36396. * you want to integrate Popper.js inside a framework or view library and you
  36397. * want to delegate all the DOM manipulations to it.
  36398. *
  36399. * Note that if you disable this modifier, you must make sure the popper element
  36400. * has its position set to `absolute` before Popper.js can do its work!
  36401. *
  36402. * Just disable this modifier and define your own to achieve the desired effect.
  36403. *
  36404. * @memberof modifiers
  36405. * @inner
  36406. */
  36407. applyStyle: {
  36408. /** @prop {number} order=900 - Index used to define the order of execution */
  36409. order: 900,
  36410. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36411. enabled: true,
  36412. /** @prop {ModifierFn} */
  36413. fn: applyStyle,
  36414. /** @prop {Function} */
  36415. onLoad: applyStyleOnLoad,
  36416. /**
  36417. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36418. * @prop {Boolean} gpuAcceleration=true
  36419. * If true, it uses the CSS 3D transformation to position the popper.
  36420. * Otherwise, it will use the `top` and `left` properties
  36421. */
  36422. gpuAcceleration: undefined
  36423. }
  36424. };
  36425. /**
  36426. * The `dataObject` is an object containing all the information used by Popper.js.
  36427. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36428. * @name dataObject
  36429. * @property {Object} data.instance The Popper.js instance
  36430. * @property {String} data.placement Placement applied to popper
  36431. * @property {String} data.originalPlacement Placement originally defined on init
  36432. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36433. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36434. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36435. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36436. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36437. * @property {Object} data.boundaries Offsets of the popper boundaries
  36438. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36439. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36440. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36441. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36442. */
  36443. /**
  36444. * Default options provided to Popper.js constructor.<br />
  36445. * These can be overridden using the `options` argument of Popper.js.<br />
  36446. * To override an option, simply pass an object with the same
  36447. * structure of the `options` object, as the 3rd argument. For example:
  36448. * ```
  36449. * new Popper(ref, pop, {
  36450. * modifiers: {
  36451. * preventOverflow: { enabled: false }
  36452. * }
  36453. * })
  36454. * ```
  36455. * @type {Object}
  36456. * @static
  36457. * @memberof Popper
  36458. */
  36459. var Defaults = {
  36460. /**
  36461. * Popper's placement.
  36462. * @prop {Popper.placements} placement='bottom'
  36463. */
  36464. placement: 'bottom',
  36465. /**
  36466. * Set this to true if you want popper to position it self in 'fixed' mode
  36467. * @prop {Boolean} positionFixed=false
  36468. */
  36469. positionFixed: false,
  36470. /**
  36471. * Whether events (resize, scroll) are initially enabled.
  36472. * @prop {Boolean} eventsEnabled=true
  36473. */
  36474. eventsEnabled: true,
  36475. /**
  36476. * Set to true if you want to automatically remove the popper when
  36477. * you call the `destroy` method.
  36478. * @prop {Boolean} removeOnDestroy=false
  36479. */
  36480. removeOnDestroy: false,
  36481. /**
  36482. * Callback called when the popper is created.<br />
  36483. * By default, it is set to no-op.<br />
  36484. * Access Popper.js instance with `data.instance`.
  36485. * @prop {onCreate}
  36486. */
  36487. onCreate: function onCreate() {},
  36488. /**
  36489. * Callback called when the popper is updated. This callback is not called
  36490. * on the initialization/creation of the popper, but only on subsequent
  36491. * updates.<br />
  36492. * By default, it is set to no-op.<br />
  36493. * Access Popper.js instance with `data.instance`.
  36494. * @prop {onUpdate}
  36495. */
  36496. onUpdate: function onUpdate() {},
  36497. /**
  36498. * List of modifiers used to modify the offsets before they are applied to the popper.
  36499. * They provide most of the functionalities of Popper.js.
  36500. * @prop {modifiers}
  36501. */
  36502. modifiers: modifiers
  36503. };
  36504. /**
  36505. * @callback onCreate
  36506. * @param {dataObject} data
  36507. */
  36508. /**
  36509. * @callback onUpdate
  36510. * @param {dataObject} data
  36511. */
  36512. // Utils
  36513. // Methods
  36514. var Popper = function () {
  36515. /**
  36516. * Creates a new Popper.js instance.
  36517. * @class Popper
  36518. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36519. * @param {Element} popper - The HTML / XML element used as the popper
  36520. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36521. * @return {Object} instance - The generated Popper.js instance
  36522. */
  36523. function Popper(reference, popper) {
  36524. var _this = this;
  36525. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36526. classCallCheck(this, Popper);
  36527. this.scheduleUpdate = function () {
  36528. return requestAnimationFrame(_this.update);
  36529. };
  36530. // make update() debounced, so that it only runs at most once-per-tick
  36531. this.update = debounce(this.update.bind(this));
  36532. // with {} we create a new object with the options inside it
  36533. this.options = _extends({}, Popper.Defaults, options);
  36534. // init state
  36535. this.state = {
  36536. isDestroyed: false,
  36537. isCreated: false,
  36538. scrollParents: []
  36539. };
  36540. // get reference and popper elements (allow jQuery wrappers)
  36541. this.reference = reference && reference.jquery ? reference[0] : reference;
  36542. this.popper = popper && popper.jquery ? popper[0] : popper;
  36543. // Deep merge modifiers options
  36544. this.options.modifiers = {};
  36545. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36546. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36547. });
  36548. // Refactoring modifiers' list (Object => Array)
  36549. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36550. return _extends({
  36551. name: name
  36552. }, _this.options.modifiers[name]);
  36553. })
  36554. // sort the modifiers by order
  36555. .sort(function (a, b) {
  36556. return a.order - b.order;
  36557. });
  36558. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36559. // such code is executed in the same order of its modifier
  36560. // they could add new properties to their options configuration
  36561. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36562. this.modifiers.forEach(function (modifierOptions) {
  36563. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36564. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36565. }
  36566. });
  36567. // fire the first update to position the popper in the right place
  36568. this.update();
  36569. var eventsEnabled = this.options.eventsEnabled;
  36570. if (eventsEnabled) {
  36571. // setup event listeners, they will take care of update the position in specific situations
  36572. this.enableEventListeners();
  36573. }
  36574. this.state.eventsEnabled = eventsEnabled;
  36575. }
  36576. // We can't use class properties because they don't get listed in the
  36577. // class prototype and break stuff like Sinon stubs
  36578. createClass(Popper, [{
  36579. key: 'update',
  36580. value: function update$$1() {
  36581. return update.call(this);
  36582. }
  36583. }, {
  36584. key: 'destroy',
  36585. value: function destroy$$1() {
  36586. return destroy.call(this);
  36587. }
  36588. }, {
  36589. key: 'enableEventListeners',
  36590. value: function enableEventListeners$$1() {
  36591. return enableEventListeners.call(this);
  36592. }
  36593. }, {
  36594. key: 'disableEventListeners',
  36595. value: function disableEventListeners$$1() {
  36596. return disableEventListeners.call(this);
  36597. }
  36598. /**
  36599. * Schedules an update. It will run on the next UI update available.
  36600. * @method scheduleUpdate
  36601. * @memberof Popper
  36602. */
  36603. /**
  36604. * Collection of utilities useful when writing custom modifiers.
  36605. * Starting from version 1.7, this method is available only if you
  36606. * include `popper-utils.js` before `popper.js`.
  36607. *
  36608. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36609. * and will be removed in v2! Use the PopperUtils module directly instead.
  36610. * Due to the high instability of the methods contained in Utils, we can't
  36611. * guarantee them to follow semver. Use them at your own risk!
  36612. * @static
  36613. * @private
  36614. * @type {Object}
  36615. * @deprecated since version 1.8
  36616. * @member Utils
  36617. * @memberof Popper
  36618. */
  36619. }]);
  36620. return Popper;
  36621. }();
  36622. /**
  36623. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36624. * and lets you use it as replacement of a real DOM node.<br />
  36625. * You can use this method to position a popper relatively to a set of coordinates
  36626. * in case you don't have a DOM node to use as reference.
  36627. *
  36628. * ```
  36629. * new Popper(referenceObject, popperNode);
  36630. * ```
  36631. *
  36632. * NB: This feature isn't supported in Internet Explorer 10.
  36633. * @name referenceObject
  36634. * @property {Function} data.getBoundingClientRect
  36635. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36636. * @property {number} data.clientWidth
  36637. * An ES6 getter that will return the width of the virtual reference element.
  36638. * @property {number} data.clientHeight
  36639. * An ES6 getter that will return the height of the virtual reference element.
  36640. */
  36641. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36642. Popper.placements = placements;
  36643. Popper.Defaults = Defaults;
  36644. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36645. //# sourceMappingURL=popper.js.map
  36646. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36647. /***/ }),
  36648. /***/ "./node_modules/process/browser.js":
  36649. /*!*****************************************!*\
  36650. !*** ./node_modules/process/browser.js ***!
  36651. \*****************************************/
  36652. /*! no static exports found */
  36653. /***/ (function(module, exports) {
  36654. // shim for using process in browser
  36655. var process = module.exports = {};
  36656. // cached from whatever global is present so that test runners that stub it
  36657. // don't break things. But we need to wrap it in a try catch in case it is
  36658. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36659. // function because try/catches deoptimize in certain engines.
  36660. var cachedSetTimeout;
  36661. var cachedClearTimeout;
  36662. function defaultSetTimout() {
  36663. throw new Error('setTimeout has not been defined');
  36664. }
  36665. function defaultClearTimeout () {
  36666. throw new Error('clearTimeout has not been defined');
  36667. }
  36668. (function () {
  36669. try {
  36670. if (typeof setTimeout === 'function') {
  36671. cachedSetTimeout = setTimeout;
  36672. } else {
  36673. cachedSetTimeout = defaultSetTimout;
  36674. }
  36675. } catch (e) {
  36676. cachedSetTimeout = defaultSetTimout;
  36677. }
  36678. try {
  36679. if (typeof clearTimeout === 'function') {
  36680. cachedClearTimeout = clearTimeout;
  36681. } else {
  36682. cachedClearTimeout = defaultClearTimeout;
  36683. }
  36684. } catch (e) {
  36685. cachedClearTimeout = defaultClearTimeout;
  36686. }
  36687. } ())
  36688. function runTimeout(fun) {
  36689. if (cachedSetTimeout === setTimeout) {
  36690. //normal enviroments in sane situations
  36691. return setTimeout(fun, 0);
  36692. }
  36693. // if setTimeout wasn't available but was latter defined
  36694. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36695. cachedSetTimeout = setTimeout;
  36696. return setTimeout(fun, 0);
  36697. }
  36698. try {
  36699. // when when somebody has screwed with setTimeout but no I.E. maddness
  36700. return cachedSetTimeout(fun, 0);
  36701. } catch(e){
  36702. try {
  36703. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36704. return cachedSetTimeout.call(null, fun, 0);
  36705. } catch(e){
  36706. // 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
  36707. return cachedSetTimeout.call(this, fun, 0);
  36708. }
  36709. }
  36710. }
  36711. function runClearTimeout(marker) {
  36712. if (cachedClearTimeout === clearTimeout) {
  36713. //normal enviroments in sane situations
  36714. return clearTimeout(marker);
  36715. }
  36716. // if clearTimeout wasn't available but was latter defined
  36717. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36718. cachedClearTimeout = clearTimeout;
  36719. return clearTimeout(marker);
  36720. }
  36721. try {
  36722. // when when somebody has screwed with setTimeout but no I.E. maddness
  36723. return cachedClearTimeout(marker);
  36724. } catch (e){
  36725. try {
  36726. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36727. return cachedClearTimeout.call(null, marker);
  36728. } catch (e){
  36729. // 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.
  36730. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36731. return cachedClearTimeout.call(this, marker);
  36732. }
  36733. }
  36734. }
  36735. var queue = [];
  36736. var draining = false;
  36737. var currentQueue;
  36738. var queueIndex = -1;
  36739. function cleanUpNextTick() {
  36740. if (!draining || !currentQueue) {
  36741. return;
  36742. }
  36743. draining = false;
  36744. if (currentQueue.length) {
  36745. queue = currentQueue.concat(queue);
  36746. } else {
  36747. queueIndex = -1;
  36748. }
  36749. if (queue.length) {
  36750. drainQueue();
  36751. }
  36752. }
  36753. function drainQueue() {
  36754. if (draining) {
  36755. return;
  36756. }
  36757. var timeout = runTimeout(cleanUpNextTick);
  36758. draining = true;
  36759. var len = queue.length;
  36760. while(len) {
  36761. currentQueue = queue;
  36762. queue = [];
  36763. while (++queueIndex < len) {
  36764. if (currentQueue) {
  36765. currentQueue[queueIndex].run();
  36766. }
  36767. }
  36768. queueIndex = -1;
  36769. len = queue.length;
  36770. }
  36771. currentQueue = null;
  36772. draining = false;
  36773. runClearTimeout(timeout);
  36774. }
  36775. process.nextTick = function (fun) {
  36776. var args = new Array(arguments.length - 1);
  36777. if (arguments.length > 1) {
  36778. for (var i = 1; i < arguments.length; i++) {
  36779. args[i - 1] = arguments[i];
  36780. }
  36781. }
  36782. queue.push(new Item(fun, args));
  36783. if (queue.length === 1 && !draining) {
  36784. runTimeout(drainQueue);
  36785. }
  36786. };
  36787. // v8 likes predictible objects
  36788. function Item(fun, array) {
  36789. this.fun = fun;
  36790. this.array = array;
  36791. }
  36792. Item.prototype.run = function () {
  36793. this.fun.apply(null, this.array);
  36794. };
  36795. process.title = 'browser';
  36796. process.browser = true;
  36797. process.env = {};
  36798. process.argv = [];
  36799. process.version = ''; // empty string to avoid regexp issues
  36800. process.versions = {};
  36801. function noop() {}
  36802. process.on = noop;
  36803. process.addListener = noop;
  36804. process.once = noop;
  36805. process.off = noop;
  36806. process.removeListener = noop;
  36807. process.removeAllListeners = noop;
  36808. process.emit = noop;
  36809. process.prependListener = noop;
  36810. process.prependOnceListener = noop;
  36811. process.listeners = function (name) { return [] }
  36812. process.binding = function (name) {
  36813. throw new Error('process.binding is not supported');
  36814. };
  36815. process.cwd = function () { return '/' };
  36816. process.chdir = function (dir) {
  36817. throw new Error('process.chdir is not supported');
  36818. };
  36819. process.umask = function() { return 0; };
  36820. /***/ }),
  36821. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36822. /*!***************************************************!*\
  36823. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36824. \***************************************************/
  36825. /*! no static exports found */
  36826. /***/ (function(module, exports, __webpack_require__) {
  36827. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36828. * Pusher JavaScript Library v5.0.3
  36829. * https://pusher.com/
  36830. *
  36831. * Copyright 2017, Pusher
  36832. * Released under the MIT licence.
  36833. */
  36834. (function webpackUniversalModuleDefinition(root, factory) {
  36835. if(true)
  36836. module.exports = factory();
  36837. else {}
  36838. })(window, function() {
  36839. return /******/ (function(modules) { // webpackBootstrap
  36840. /******/ // The module cache
  36841. /******/ var installedModules = {};
  36842. /******/
  36843. /******/ // The require function
  36844. /******/ function __webpack_require__(moduleId) {
  36845. /******/
  36846. /******/ // Check if module is in cache
  36847. /******/ if(installedModules[moduleId]) {
  36848. /******/ return installedModules[moduleId].exports;
  36849. /******/ }
  36850. /******/ // Create a new module (and put it into the cache)
  36851. /******/ var module = installedModules[moduleId] = {
  36852. /******/ i: moduleId,
  36853. /******/ l: false,
  36854. /******/ exports: {}
  36855. /******/ };
  36856. /******/
  36857. /******/ // Execute the module function
  36858. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36859. /******/
  36860. /******/ // Flag the module as loaded
  36861. /******/ module.l = true;
  36862. /******/
  36863. /******/ // Return the exports of the module
  36864. /******/ return module.exports;
  36865. /******/ }
  36866. /******/
  36867. /******/
  36868. /******/ // expose the modules object (__webpack_modules__)
  36869. /******/ __webpack_require__.m = modules;
  36870. /******/
  36871. /******/ // expose the module cache
  36872. /******/ __webpack_require__.c = installedModules;
  36873. /******/
  36874. /******/ // define getter function for harmony exports
  36875. /******/ __webpack_require__.d = function(exports, name, getter) {
  36876. /******/ if(!__webpack_require__.o(exports, name)) {
  36877. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36878. /******/ }
  36879. /******/ };
  36880. /******/
  36881. /******/ // define __esModule on exports
  36882. /******/ __webpack_require__.r = function(exports) {
  36883. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36884. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36885. /******/ }
  36886. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36887. /******/ };
  36888. /******/
  36889. /******/ // create a fake namespace object
  36890. /******/ // mode & 1: value is a module id, require it
  36891. /******/ // mode & 2: merge all properties of value into the ns
  36892. /******/ // mode & 4: return value when already ns object
  36893. /******/ // mode & 8|1: behave like require
  36894. /******/ __webpack_require__.t = function(value, mode) {
  36895. /******/ if(mode & 1) value = __webpack_require__(value);
  36896. /******/ if(mode & 8) return value;
  36897. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36898. /******/ var ns = Object.create(null);
  36899. /******/ __webpack_require__.r(ns);
  36900. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36901. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36902. /******/ return ns;
  36903. /******/ };
  36904. /******/
  36905. /******/ // getDefaultExport function for compatibility with non-harmony modules
  36906. /******/ __webpack_require__.n = function(module) {
  36907. /******/ var getter = module && module.__esModule ?
  36908. /******/ function getDefault() { return module['default']; } :
  36909. /******/ function getModuleExports() { return module; };
  36910. /******/ __webpack_require__.d(getter, 'a', getter);
  36911. /******/ return getter;
  36912. /******/ };
  36913. /******/
  36914. /******/ // Object.prototype.hasOwnProperty.call
  36915. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  36916. /******/
  36917. /******/ // __webpack_public_path__
  36918. /******/ __webpack_require__.p = "";
  36919. /******/
  36920. /******/
  36921. /******/ // Load entry module and return exports
  36922. /******/ return __webpack_require__(__webpack_require__.s = 2);
  36923. /******/ })
  36924. /************************************************************************/
  36925. /******/ ([
  36926. /* 0 */
  36927. /***/ (function(module, exports, __webpack_require__) {
  36928. (function(nacl) {
  36929. 'use strict';
  36930. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  36931. // Public domain.
  36932. //
  36933. // Implementation derived from TweetNaCl version 20140427.
  36934. // See for details: http://tweetnacl.cr.yp.to/
  36935. var gf = function(init) {
  36936. var i, r = new Float64Array(16);
  36937. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  36938. return r;
  36939. };
  36940. // Pluggable, initialized in high-level API below.
  36941. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  36942. var _0 = new Uint8Array(16);
  36943. var _9 = new Uint8Array(32); _9[0] = 9;
  36944. var gf0 = gf(),
  36945. gf1 = gf([1]),
  36946. _121665 = gf([0xdb41, 1]),
  36947. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  36948. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  36949. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  36950. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  36951. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  36952. function ts64(x, i, h, l) {
  36953. x[i] = (h >> 24) & 0xff;
  36954. x[i+1] = (h >> 16) & 0xff;
  36955. x[i+2] = (h >> 8) & 0xff;
  36956. x[i+3] = h & 0xff;
  36957. x[i+4] = (l >> 24) & 0xff;
  36958. x[i+5] = (l >> 16) & 0xff;
  36959. x[i+6] = (l >> 8) & 0xff;
  36960. x[i+7] = l & 0xff;
  36961. }
  36962. function vn(x, xi, y, yi, n) {
  36963. var i,d = 0;
  36964. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  36965. return (1 & ((d - 1) >>> 8)) - 1;
  36966. }
  36967. function crypto_verify_16(x, xi, y, yi) {
  36968. return vn(x,xi,y,yi,16);
  36969. }
  36970. function crypto_verify_32(x, xi, y, yi) {
  36971. return vn(x,xi,y,yi,32);
  36972. }
  36973. function core_salsa20(o, p, k, c) {
  36974. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  36975. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  36976. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  36977. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  36978. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  36979. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  36980. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  36981. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  36982. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  36983. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  36984. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  36985. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  36986. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  36987. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  36988. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  36989. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  36990. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  36991. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  36992. x15 = j15, u;
  36993. for (var i = 0; i < 20; i += 2) {
  36994. u = x0 + x12 | 0;
  36995. x4 ^= u<<7 | u>>>(32-7);
  36996. u = x4 + x0 | 0;
  36997. x8 ^= u<<9 | u>>>(32-9);
  36998. u = x8 + x4 | 0;
  36999. x12 ^= u<<13 | u>>>(32-13);
  37000. u = x12 + x8 | 0;
  37001. x0 ^= u<<18 | u>>>(32-18);
  37002. u = x5 + x1 | 0;
  37003. x9 ^= u<<7 | u>>>(32-7);
  37004. u = x9 + x5 | 0;
  37005. x13 ^= u<<9 | u>>>(32-9);
  37006. u = x13 + x9 | 0;
  37007. x1 ^= u<<13 | u>>>(32-13);
  37008. u = x1 + x13 | 0;
  37009. x5 ^= u<<18 | u>>>(32-18);
  37010. u = x10 + x6 | 0;
  37011. x14 ^= u<<7 | u>>>(32-7);
  37012. u = x14 + x10 | 0;
  37013. x2 ^= u<<9 | u>>>(32-9);
  37014. u = x2 + x14 | 0;
  37015. x6 ^= u<<13 | u>>>(32-13);
  37016. u = x6 + x2 | 0;
  37017. x10 ^= u<<18 | u>>>(32-18);
  37018. u = x15 + x11 | 0;
  37019. x3 ^= u<<7 | u>>>(32-7);
  37020. u = x3 + x15 | 0;
  37021. x7 ^= u<<9 | u>>>(32-9);
  37022. u = x7 + x3 | 0;
  37023. x11 ^= u<<13 | u>>>(32-13);
  37024. u = x11 + x7 | 0;
  37025. x15 ^= u<<18 | u>>>(32-18);
  37026. u = x0 + x3 | 0;
  37027. x1 ^= u<<7 | u>>>(32-7);
  37028. u = x1 + x0 | 0;
  37029. x2 ^= u<<9 | u>>>(32-9);
  37030. u = x2 + x1 | 0;
  37031. x3 ^= u<<13 | u>>>(32-13);
  37032. u = x3 + x2 | 0;
  37033. x0 ^= u<<18 | u>>>(32-18);
  37034. u = x5 + x4 | 0;
  37035. x6 ^= u<<7 | u>>>(32-7);
  37036. u = x6 + x5 | 0;
  37037. x7 ^= u<<9 | u>>>(32-9);
  37038. u = x7 + x6 | 0;
  37039. x4 ^= u<<13 | u>>>(32-13);
  37040. u = x4 + x7 | 0;
  37041. x5 ^= u<<18 | u>>>(32-18);
  37042. u = x10 + x9 | 0;
  37043. x11 ^= u<<7 | u>>>(32-7);
  37044. u = x11 + x10 | 0;
  37045. x8 ^= u<<9 | u>>>(32-9);
  37046. u = x8 + x11 | 0;
  37047. x9 ^= u<<13 | u>>>(32-13);
  37048. u = x9 + x8 | 0;
  37049. x10 ^= u<<18 | u>>>(32-18);
  37050. u = x15 + x14 | 0;
  37051. x12 ^= u<<7 | u>>>(32-7);
  37052. u = x12 + x15 | 0;
  37053. x13 ^= u<<9 | u>>>(32-9);
  37054. u = x13 + x12 | 0;
  37055. x14 ^= u<<13 | u>>>(32-13);
  37056. u = x14 + x13 | 0;
  37057. x15 ^= u<<18 | u>>>(32-18);
  37058. }
  37059. x0 = x0 + j0 | 0;
  37060. x1 = x1 + j1 | 0;
  37061. x2 = x2 + j2 | 0;
  37062. x3 = x3 + j3 | 0;
  37063. x4 = x4 + j4 | 0;
  37064. x5 = x5 + j5 | 0;
  37065. x6 = x6 + j6 | 0;
  37066. x7 = x7 + j7 | 0;
  37067. x8 = x8 + j8 | 0;
  37068. x9 = x9 + j9 | 0;
  37069. x10 = x10 + j10 | 0;
  37070. x11 = x11 + j11 | 0;
  37071. x12 = x12 + j12 | 0;
  37072. x13 = x13 + j13 | 0;
  37073. x14 = x14 + j14 | 0;
  37074. x15 = x15 + j15 | 0;
  37075. o[ 0] = x0 >>> 0 & 0xff;
  37076. o[ 1] = x0 >>> 8 & 0xff;
  37077. o[ 2] = x0 >>> 16 & 0xff;
  37078. o[ 3] = x0 >>> 24 & 0xff;
  37079. o[ 4] = x1 >>> 0 & 0xff;
  37080. o[ 5] = x1 >>> 8 & 0xff;
  37081. o[ 6] = x1 >>> 16 & 0xff;
  37082. o[ 7] = x1 >>> 24 & 0xff;
  37083. o[ 8] = x2 >>> 0 & 0xff;
  37084. o[ 9] = x2 >>> 8 & 0xff;
  37085. o[10] = x2 >>> 16 & 0xff;
  37086. o[11] = x2 >>> 24 & 0xff;
  37087. o[12] = x3 >>> 0 & 0xff;
  37088. o[13] = x3 >>> 8 & 0xff;
  37089. o[14] = x3 >>> 16 & 0xff;
  37090. o[15] = x3 >>> 24 & 0xff;
  37091. o[16] = x4 >>> 0 & 0xff;
  37092. o[17] = x4 >>> 8 & 0xff;
  37093. o[18] = x4 >>> 16 & 0xff;
  37094. o[19] = x4 >>> 24 & 0xff;
  37095. o[20] = x5 >>> 0 & 0xff;
  37096. o[21] = x5 >>> 8 & 0xff;
  37097. o[22] = x5 >>> 16 & 0xff;
  37098. o[23] = x5 >>> 24 & 0xff;
  37099. o[24] = x6 >>> 0 & 0xff;
  37100. o[25] = x6 >>> 8 & 0xff;
  37101. o[26] = x6 >>> 16 & 0xff;
  37102. o[27] = x6 >>> 24 & 0xff;
  37103. o[28] = x7 >>> 0 & 0xff;
  37104. o[29] = x7 >>> 8 & 0xff;
  37105. o[30] = x7 >>> 16 & 0xff;
  37106. o[31] = x7 >>> 24 & 0xff;
  37107. o[32] = x8 >>> 0 & 0xff;
  37108. o[33] = x8 >>> 8 & 0xff;
  37109. o[34] = x8 >>> 16 & 0xff;
  37110. o[35] = x8 >>> 24 & 0xff;
  37111. o[36] = x9 >>> 0 & 0xff;
  37112. o[37] = x9 >>> 8 & 0xff;
  37113. o[38] = x9 >>> 16 & 0xff;
  37114. o[39] = x9 >>> 24 & 0xff;
  37115. o[40] = x10 >>> 0 & 0xff;
  37116. o[41] = x10 >>> 8 & 0xff;
  37117. o[42] = x10 >>> 16 & 0xff;
  37118. o[43] = x10 >>> 24 & 0xff;
  37119. o[44] = x11 >>> 0 & 0xff;
  37120. o[45] = x11 >>> 8 & 0xff;
  37121. o[46] = x11 >>> 16 & 0xff;
  37122. o[47] = x11 >>> 24 & 0xff;
  37123. o[48] = x12 >>> 0 & 0xff;
  37124. o[49] = x12 >>> 8 & 0xff;
  37125. o[50] = x12 >>> 16 & 0xff;
  37126. o[51] = x12 >>> 24 & 0xff;
  37127. o[52] = x13 >>> 0 & 0xff;
  37128. o[53] = x13 >>> 8 & 0xff;
  37129. o[54] = x13 >>> 16 & 0xff;
  37130. o[55] = x13 >>> 24 & 0xff;
  37131. o[56] = x14 >>> 0 & 0xff;
  37132. o[57] = x14 >>> 8 & 0xff;
  37133. o[58] = x14 >>> 16 & 0xff;
  37134. o[59] = x14 >>> 24 & 0xff;
  37135. o[60] = x15 >>> 0 & 0xff;
  37136. o[61] = x15 >>> 8 & 0xff;
  37137. o[62] = x15 >>> 16 & 0xff;
  37138. o[63] = x15 >>> 24 & 0xff;
  37139. }
  37140. function core_hsalsa20(o,p,k,c) {
  37141. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37142. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37143. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37144. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37145. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37146. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37147. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37148. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37149. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37150. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37151. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37152. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37153. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37154. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37155. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37156. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37157. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37158. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37159. x15 = j15, u;
  37160. for (var i = 0; i < 20; i += 2) {
  37161. u = x0 + x12 | 0;
  37162. x4 ^= u<<7 | u>>>(32-7);
  37163. u = x4 + x0 | 0;
  37164. x8 ^= u<<9 | u>>>(32-9);
  37165. u = x8 + x4 | 0;
  37166. x12 ^= u<<13 | u>>>(32-13);
  37167. u = x12 + x8 | 0;
  37168. x0 ^= u<<18 | u>>>(32-18);
  37169. u = x5 + x1 | 0;
  37170. x9 ^= u<<7 | u>>>(32-7);
  37171. u = x9 + x5 | 0;
  37172. x13 ^= u<<9 | u>>>(32-9);
  37173. u = x13 + x9 | 0;
  37174. x1 ^= u<<13 | u>>>(32-13);
  37175. u = x1 + x13 | 0;
  37176. x5 ^= u<<18 | u>>>(32-18);
  37177. u = x10 + x6 | 0;
  37178. x14 ^= u<<7 | u>>>(32-7);
  37179. u = x14 + x10 | 0;
  37180. x2 ^= u<<9 | u>>>(32-9);
  37181. u = x2 + x14 | 0;
  37182. x6 ^= u<<13 | u>>>(32-13);
  37183. u = x6 + x2 | 0;
  37184. x10 ^= u<<18 | u>>>(32-18);
  37185. u = x15 + x11 | 0;
  37186. x3 ^= u<<7 | u>>>(32-7);
  37187. u = x3 + x15 | 0;
  37188. x7 ^= u<<9 | u>>>(32-9);
  37189. u = x7 + x3 | 0;
  37190. x11 ^= u<<13 | u>>>(32-13);
  37191. u = x11 + x7 | 0;
  37192. x15 ^= u<<18 | u>>>(32-18);
  37193. u = x0 + x3 | 0;
  37194. x1 ^= u<<7 | u>>>(32-7);
  37195. u = x1 + x0 | 0;
  37196. x2 ^= u<<9 | u>>>(32-9);
  37197. u = x2 + x1 | 0;
  37198. x3 ^= u<<13 | u>>>(32-13);
  37199. u = x3 + x2 | 0;
  37200. x0 ^= u<<18 | u>>>(32-18);
  37201. u = x5 + x4 | 0;
  37202. x6 ^= u<<7 | u>>>(32-7);
  37203. u = x6 + x5 | 0;
  37204. x7 ^= u<<9 | u>>>(32-9);
  37205. u = x7 + x6 | 0;
  37206. x4 ^= u<<13 | u>>>(32-13);
  37207. u = x4 + x7 | 0;
  37208. x5 ^= u<<18 | u>>>(32-18);
  37209. u = x10 + x9 | 0;
  37210. x11 ^= u<<7 | u>>>(32-7);
  37211. u = x11 + x10 | 0;
  37212. x8 ^= u<<9 | u>>>(32-9);
  37213. u = x8 + x11 | 0;
  37214. x9 ^= u<<13 | u>>>(32-13);
  37215. u = x9 + x8 | 0;
  37216. x10 ^= u<<18 | u>>>(32-18);
  37217. u = x15 + x14 | 0;
  37218. x12 ^= u<<7 | u>>>(32-7);
  37219. u = x12 + x15 | 0;
  37220. x13 ^= u<<9 | u>>>(32-9);
  37221. u = x13 + x12 | 0;
  37222. x14 ^= u<<13 | u>>>(32-13);
  37223. u = x14 + x13 | 0;
  37224. x15 ^= u<<18 | u>>>(32-18);
  37225. }
  37226. o[ 0] = x0 >>> 0 & 0xff;
  37227. o[ 1] = x0 >>> 8 & 0xff;
  37228. o[ 2] = x0 >>> 16 & 0xff;
  37229. o[ 3] = x0 >>> 24 & 0xff;
  37230. o[ 4] = x5 >>> 0 & 0xff;
  37231. o[ 5] = x5 >>> 8 & 0xff;
  37232. o[ 6] = x5 >>> 16 & 0xff;
  37233. o[ 7] = x5 >>> 24 & 0xff;
  37234. o[ 8] = x10 >>> 0 & 0xff;
  37235. o[ 9] = x10 >>> 8 & 0xff;
  37236. o[10] = x10 >>> 16 & 0xff;
  37237. o[11] = x10 >>> 24 & 0xff;
  37238. o[12] = x15 >>> 0 & 0xff;
  37239. o[13] = x15 >>> 8 & 0xff;
  37240. o[14] = x15 >>> 16 & 0xff;
  37241. o[15] = x15 >>> 24 & 0xff;
  37242. o[16] = x6 >>> 0 & 0xff;
  37243. o[17] = x6 >>> 8 & 0xff;
  37244. o[18] = x6 >>> 16 & 0xff;
  37245. o[19] = x6 >>> 24 & 0xff;
  37246. o[20] = x7 >>> 0 & 0xff;
  37247. o[21] = x7 >>> 8 & 0xff;
  37248. o[22] = x7 >>> 16 & 0xff;
  37249. o[23] = x7 >>> 24 & 0xff;
  37250. o[24] = x8 >>> 0 & 0xff;
  37251. o[25] = x8 >>> 8 & 0xff;
  37252. o[26] = x8 >>> 16 & 0xff;
  37253. o[27] = x8 >>> 24 & 0xff;
  37254. o[28] = x9 >>> 0 & 0xff;
  37255. o[29] = x9 >>> 8 & 0xff;
  37256. o[30] = x9 >>> 16 & 0xff;
  37257. o[31] = x9 >>> 24 & 0xff;
  37258. }
  37259. function crypto_core_salsa20(out,inp,k,c) {
  37260. core_salsa20(out,inp,k,c);
  37261. }
  37262. function crypto_core_hsalsa20(out,inp,k,c) {
  37263. core_hsalsa20(out,inp,k,c);
  37264. }
  37265. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37266. // "expand 32-byte k"
  37267. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37268. var z = new Uint8Array(16), x = new Uint8Array(64);
  37269. var u, i;
  37270. for (i = 0; i < 16; i++) z[i] = 0;
  37271. for (i = 0; i < 8; i++) z[i] = n[i];
  37272. while (b >= 64) {
  37273. crypto_core_salsa20(x,z,k,sigma);
  37274. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37275. u = 1;
  37276. for (i = 8; i < 16; i++) {
  37277. u = u + (z[i] & 0xff) | 0;
  37278. z[i] = u & 0xff;
  37279. u >>>= 8;
  37280. }
  37281. b -= 64;
  37282. cpos += 64;
  37283. mpos += 64;
  37284. }
  37285. if (b > 0) {
  37286. crypto_core_salsa20(x,z,k,sigma);
  37287. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37288. }
  37289. return 0;
  37290. }
  37291. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37292. var z = new Uint8Array(16), x = new Uint8Array(64);
  37293. var u, i;
  37294. for (i = 0; i < 16; i++) z[i] = 0;
  37295. for (i = 0; i < 8; i++) z[i] = n[i];
  37296. while (b >= 64) {
  37297. crypto_core_salsa20(x,z,k,sigma);
  37298. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37299. u = 1;
  37300. for (i = 8; i < 16; i++) {
  37301. u = u + (z[i] & 0xff) | 0;
  37302. z[i] = u & 0xff;
  37303. u >>>= 8;
  37304. }
  37305. b -= 64;
  37306. cpos += 64;
  37307. }
  37308. if (b > 0) {
  37309. crypto_core_salsa20(x,z,k,sigma);
  37310. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37311. }
  37312. return 0;
  37313. }
  37314. function crypto_stream(c,cpos,d,n,k) {
  37315. var s = new Uint8Array(32);
  37316. crypto_core_hsalsa20(s,n,k,sigma);
  37317. var sn = new Uint8Array(8);
  37318. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37319. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37320. }
  37321. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37322. var s = new Uint8Array(32);
  37323. crypto_core_hsalsa20(s,n,k,sigma);
  37324. var sn = new Uint8Array(8);
  37325. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37326. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37327. }
  37328. /*
  37329. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37330. * https://github.com/floodyberry/poly1305-donna
  37331. */
  37332. var poly1305 = function(key) {
  37333. this.buffer = new Uint8Array(16);
  37334. this.r = new Uint16Array(10);
  37335. this.h = new Uint16Array(10);
  37336. this.pad = new Uint16Array(8);
  37337. this.leftover = 0;
  37338. this.fin = 0;
  37339. var t0, t1, t2, t3, t4, t5, t6, t7;
  37340. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37341. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37342. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37343. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37344. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37345. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37346. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37347. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37348. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37349. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37350. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37351. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37352. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37353. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37354. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37355. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37356. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37357. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37358. };
  37359. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37360. var hibit = this.fin ? 0 : (1 << 11);
  37361. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37362. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37363. var h0 = this.h[0],
  37364. h1 = this.h[1],
  37365. h2 = this.h[2],
  37366. h3 = this.h[3],
  37367. h4 = this.h[4],
  37368. h5 = this.h[5],
  37369. h6 = this.h[6],
  37370. h7 = this.h[7],
  37371. h8 = this.h[8],
  37372. h9 = this.h[9];
  37373. var r0 = this.r[0],
  37374. r1 = this.r[1],
  37375. r2 = this.r[2],
  37376. r3 = this.r[3],
  37377. r4 = this.r[4],
  37378. r5 = this.r[5],
  37379. r6 = this.r[6],
  37380. r7 = this.r[7],
  37381. r8 = this.r[8],
  37382. r9 = this.r[9];
  37383. while (bytes >= 16) {
  37384. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37385. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37386. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37387. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37388. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37389. h5 += ((t4 >>> 1)) & 0x1fff;
  37390. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37391. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37392. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37393. h9 += ((t7 >>> 5)) | hibit;
  37394. c = 0;
  37395. d0 = c;
  37396. d0 += h0 * r0;
  37397. d0 += h1 * (5 * r9);
  37398. d0 += h2 * (5 * r8);
  37399. d0 += h3 * (5 * r7);
  37400. d0 += h4 * (5 * r6);
  37401. c = (d0 >>> 13); d0 &= 0x1fff;
  37402. d0 += h5 * (5 * r5);
  37403. d0 += h6 * (5 * r4);
  37404. d0 += h7 * (5 * r3);
  37405. d0 += h8 * (5 * r2);
  37406. d0 += h9 * (5 * r1);
  37407. c += (d0 >>> 13); d0 &= 0x1fff;
  37408. d1 = c;
  37409. d1 += h0 * r1;
  37410. d1 += h1 * r0;
  37411. d1 += h2 * (5 * r9);
  37412. d1 += h3 * (5 * r8);
  37413. d1 += h4 * (5 * r7);
  37414. c = (d1 >>> 13); d1 &= 0x1fff;
  37415. d1 += h5 * (5 * r6);
  37416. d1 += h6 * (5 * r5);
  37417. d1 += h7 * (5 * r4);
  37418. d1 += h8 * (5 * r3);
  37419. d1 += h9 * (5 * r2);
  37420. c += (d1 >>> 13); d1 &= 0x1fff;
  37421. d2 = c;
  37422. d2 += h0 * r2;
  37423. d2 += h1 * r1;
  37424. d2 += h2 * r0;
  37425. d2 += h3 * (5 * r9);
  37426. d2 += h4 * (5 * r8);
  37427. c = (d2 >>> 13); d2 &= 0x1fff;
  37428. d2 += h5 * (5 * r7);
  37429. d2 += h6 * (5 * r6);
  37430. d2 += h7 * (5 * r5);
  37431. d2 += h8 * (5 * r4);
  37432. d2 += h9 * (5 * r3);
  37433. c += (d2 >>> 13); d2 &= 0x1fff;
  37434. d3 = c;
  37435. d3 += h0 * r3;
  37436. d3 += h1 * r2;
  37437. d3 += h2 * r1;
  37438. d3 += h3 * r0;
  37439. d3 += h4 * (5 * r9);
  37440. c = (d3 >>> 13); d3 &= 0x1fff;
  37441. d3 += h5 * (5 * r8);
  37442. d3 += h6 * (5 * r7);
  37443. d3 += h7 * (5 * r6);
  37444. d3 += h8 * (5 * r5);
  37445. d3 += h9 * (5 * r4);
  37446. c += (d3 >>> 13); d3 &= 0x1fff;
  37447. d4 = c;
  37448. d4 += h0 * r4;
  37449. d4 += h1 * r3;
  37450. d4 += h2 * r2;
  37451. d4 += h3 * r1;
  37452. d4 += h4 * r0;
  37453. c = (d4 >>> 13); d4 &= 0x1fff;
  37454. d4 += h5 * (5 * r9);
  37455. d4 += h6 * (5 * r8);
  37456. d4 += h7 * (5 * r7);
  37457. d4 += h8 * (5 * r6);
  37458. d4 += h9 * (5 * r5);
  37459. c += (d4 >>> 13); d4 &= 0x1fff;
  37460. d5 = c;
  37461. d5 += h0 * r5;
  37462. d5 += h1 * r4;
  37463. d5 += h2 * r3;
  37464. d5 += h3 * r2;
  37465. d5 += h4 * r1;
  37466. c = (d5 >>> 13); d5 &= 0x1fff;
  37467. d5 += h5 * r0;
  37468. d5 += h6 * (5 * r9);
  37469. d5 += h7 * (5 * r8);
  37470. d5 += h8 * (5 * r7);
  37471. d5 += h9 * (5 * r6);
  37472. c += (d5 >>> 13); d5 &= 0x1fff;
  37473. d6 = c;
  37474. d6 += h0 * r6;
  37475. d6 += h1 * r5;
  37476. d6 += h2 * r4;
  37477. d6 += h3 * r3;
  37478. d6 += h4 * r2;
  37479. c = (d6 >>> 13); d6 &= 0x1fff;
  37480. d6 += h5 * r1;
  37481. d6 += h6 * r0;
  37482. d6 += h7 * (5 * r9);
  37483. d6 += h8 * (5 * r8);
  37484. d6 += h9 * (5 * r7);
  37485. c += (d6 >>> 13); d6 &= 0x1fff;
  37486. d7 = c;
  37487. d7 += h0 * r7;
  37488. d7 += h1 * r6;
  37489. d7 += h2 * r5;
  37490. d7 += h3 * r4;
  37491. d7 += h4 * r3;
  37492. c = (d7 >>> 13); d7 &= 0x1fff;
  37493. d7 += h5 * r2;
  37494. d7 += h6 * r1;
  37495. d7 += h7 * r0;
  37496. d7 += h8 * (5 * r9);
  37497. d7 += h9 * (5 * r8);
  37498. c += (d7 >>> 13); d7 &= 0x1fff;
  37499. d8 = c;
  37500. d8 += h0 * r8;
  37501. d8 += h1 * r7;
  37502. d8 += h2 * r6;
  37503. d8 += h3 * r5;
  37504. d8 += h4 * r4;
  37505. c = (d8 >>> 13); d8 &= 0x1fff;
  37506. d8 += h5 * r3;
  37507. d8 += h6 * r2;
  37508. d8 += h7 * r1;
  37509. d8 += h8 * r0;
  37510. d8 += h9 * (5 * r9);
  37511. c += (d8 >>> 13); d8 &= 0x1fff;
  37512. d9 = c;
  37513. d9 += h0 * r9;
  37514. d9 += h1 * r8;
  37515. d9 += h2 * r7;
  37516. d9 += h3 * r6;
  37517. d9 += h4 * r5;
  37518. c = (d9 >>> 13); d9 &= 0x1fff;
  37519. d9 += h5 * r4;
  37520. d9 += h6 * r3;
  37521. d9 += h7 * r2;
  37522. d9 += h8 * r1;
  37523. d9 += h9 * r0;
  37524. c += (d9 >>> 13); d9 &= 0x1fff;
  37525. c = (((c << 2) + c)) | 0;
  37526. c = (c + d0) | 0;
  37527. d0 = c & 0x1fff;
  37528. c = (c >>> 13);
  37529. d1 += c;
  37530. h0 = d0;
  37531. h1 = d1;
  37532. h2 = d2;
  37533. h3 = d3;
  37534. h4 = d4;
  37535. h5 = d5;
  37536. h6 = d6;
  37537. h7 = d7;
  37538. h8 = d8;
  37539. h9 = d9;
  37540. mpos += 16;
  37541. bytes -= 16;
  37542. }
  37543. this.h[0] = h0;
  37544. this.h[1] = h1;
  37545. this.h[2] = h2;
  37546. this.h[3] = h3;
  37547. this.h[4] = h4;
  37548. this.h[5] = h5;
  37549. this.h[6] = h6;
  37550. this.h[7] = h7;
  37551. this.h[8] = h8;
  37552. this.h[9] = h9;
  37553. };
  37554. poly1305.prototype.finish = function(mac, macpos) {
  37555. var g = new Uint16Array(10);
  37556. var c, mask, f, i;
  37557. if (this.leftover) {
  37558. i = this.leftover;
  37559. this.buffer[i++] = 1;
  37560. for (; i < 16; i++) this.buffer[i] = 0;
  37561. this.fin = 1;
  37562. this.blocks(this.buffer, 0, 16);
  37563. }
  37564. c = this.h[1] >>> 13;
  37565. this.h[1] &= 0x1fff;
  37566. for (i = 2; i < 10; i++) {
  37567. this.h[i] += c;
  37568. c = this.h[i] >>> 13;
  37569. this.h[i] &= 0x1fff;
  37570. }
  37571. this.h[0] += (c * 5);
  37572. c = this.h[0] >>> 13;
  37573. this.h[0] &= 0x1fff;
  37574. this.h[1] += c;
  37575. c = this.h[1] >>> 13;
  37576. this.h[1] &= 0x1fff;
  37577. this.h[2] += c;
  37578. g[0] = this.h[0] + 5;
  37579. c = g[0] >>> 13;
  37580. g[0] &= 0x1fff;
  37581. for (i = 1; i < 10; i++) {
  37582. g[i] = this.h[i] + c;
  37583. c = g[i] >>> 13;
  37584. g[i] &= 0x1fff;
  37585. }
  37586. g[9] -= (1 << 13);
  37587. mask = (c ^ 1) - 1;
  37588. for (i = 0; i < 10; i++) g[i] &= mask;
  37589. mask = ~mask;
  37590. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37591. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37592. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37593. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37594. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37595. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37596. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37597. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37598. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37599. f = this.h[0] + this.pad[0];
  37600. this.h[0] = f & 0xffff;
  37601. for (i = 1; i < 8; i++) {
  37602. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37603. this.h[i] = f & 0xffff;
  37604. }
  37605. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37606. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37607. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37608. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37609. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37610. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37611. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37612. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37613. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37614. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37615. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37616. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37617. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37618. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37619. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37620. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37621. };
  37622. poly1305.prototype.update = function(m, mpos, bytes) {
  37623. var i, want;
  37624. if (this.leftover) {
  37625. want = (16 - this.leftover);
  37626. if (want > bytes)
  37627. want = bytes;
  37628. for (i = 0; i < want; i++)
  37629. this.buffer[this.leftover + i] = m[mpos+i];
  37630. bytes -= want;
  37631. mpos += want;
  37632. this.leftover += want;
  37633. if (this.leftover < 16)
  37634. return;
  37635. this.blocks(this.buffer, 0, 16);
  37636. this.leftover = 0;
  37637. }
  37638. if (bytes >= 16) {
  37639. want = bytes - (bytes % 16);
  37640. this.blocks(m, mpos, want);
  37641. mpos += want;
  37642. bytes -= want;
  37643. }
  37644. if (bytes) {
  37645. for (i = 0; i < bytes; i++)
  37646. this.buffer[this.leftover + i] = m[mpos+i];
  37647. this.leftover += bytes;
  37648. }
  37649. };
  37650. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37651. var s = new poly1305(k);
  37652. s.update(m, mpos, n);
  37653. s.finish(out, outpos);
  37654. return 0;
  37655. }
  37656. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37657. var x = new Uint8Array(16);
  37658. crypto_onetimeauth(x,0,m,mpos,n,k);
  37659. return crypto_verify_16(h,hpos,x,0);
  37660. }
  37661. function crypto_secretbox(c,m,d,n,k) {
  37662. var i;
  37663. if (d < 32) return -1;
  37664. crypto_stream_xor(c,0,m,0,d,n,k);
  37665. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37666. for (i = 0; i < 16; i++) c[i] = 0;
  37667. return 0;
  37668. }
  37669. function crypto_secretbox_open(m,c,d,n,k) {
  37670. var i;
  37671. var x = new Uint8Array(32);
  37672. if (d < 32) return -1;
  37673. crypto_stream(x,0,32,n,k);
  37674. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37675. crypto_stream_xor(m,0,c,0,d,n,k);
  37676. for (i = 0; i < 32; i++) m[i] = 0;
  37677. return 0;
  37678. }
  37679. function set25519(r, a) {
  37680. var i;
  37681. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37682. }
  37683. function car25519(o) {
  37684. var i, v, c = 1;
  37685. for (i = 0; i < 16; i++) {
  37686. v = o[i] + c + 65535;
  37687. c = Math.floor(v / 65536);
  37688. o[i] = v - c * 65536;
  37689. }
  37690. o[0] += c-1 + 37 * (c-1);
  37691. }
  37692. function sel25519(p, q, b) {
  37693. var t, c = ~(b-1);
  37694. for (var i = 0; i < 16; i++) {
  37695. t = c & (p[i] ^ q[i]);
  37696. p[i] ^= t;
  37697. q[i] ^= t;
  37698. }
  37699. }
  37700. function pack25519(o, n) {
  37701. var i, j, b;
  37702. var m = gf(), t = gf();
  37703. for (i = 0; i < 16; i++) t[i] = n[i];
  37704. car25519(t);
  37705. car25519(t);
  37706. car25519(t);
  37707. for (j = 0; j < 2; j++) {
  37708. m[0] = t[0] - 0xffed;
  37709. for (i = 1; i < 15; i++) {
  37710. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37711. m[i-1] &= 0xffff;
  37712. }
  37713. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37714. b = (m[15]>>16) & 1;
  37715. m[14] &= 0xffff;
  37716. sel25519(t, m, 1-b);
  37717. }
  37718. for (i = 0; i < 16; i++) {
  37719. o[2*i] = t[i] & 0xff;
  37720. o[2*i+1] = t[i]>>8;
  37721. }
  37722. }
  37723. function neq25519(a, b) {
  37724. var c = new Uint8Array(32), d = new Uint8Array(32);
  37725. pack25519(c, a);
  37726. pack25519(d, b);
  37727. return crypto_verify_32(c, 0, d, 0);
  37728. }
  37729. function par25519(a) {
  37730. var d = new Uint8Array(32);
  37731. pack25519(d, a);
  37732. return d[0] & 1;
  37733. }
  37734. function unpack25519(o, n) {
  37735. var i;
  37736. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37737. o[15] &= 0x7fff;
  37738. }
  37739. function A(o, a, b) {
  37740. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37741. }
  37742. function Z(o, a, b) {
  37743. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37744. }
  37745. function M(o, a, b) {
  37746. var v, c,
  37747. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37748. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37749. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37750. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37751. b0 = b[0],
  37752. b1 = b[1],
  37753. b2 = b[2],
  37754. b3 = b[3],
  37755. b4 = b[4],
  37756. b5 = b[5],
  37757. b6 = b[6],
  37758. b7 = b[7],
  37759. b8 = b[8],
  37760. b9 = b[9],
  37761. b10 = b[10],
  37762. b11 = b[11],
  37763. b12 = b[12],
  37764. b13 = b[13],
  37765. b14 = b[14],
  37766. b15 = b[15];
  37767. v = a[0];
  37768. t0 += v * b0;
  37769. t1 += v * b1;
  37770. t2 += v * b2;
  37771. t3 += v * b3;
  37772. t4 += v * b4;
  37773. t5 += v * b5;
  37774. t6 += v * b6;
  37775. t7 += v * b7;
  37776. t8 += v * b8;
  37777. t9 += v * b9;
  37778. t10 += v * b10;
  37779. t11 += v * b11;
  37780. t12 += v * b12;
  37781. t13 += v * b13;
  37782. t14 += v * b14;
  37783. t15 += v * b15;
  37784. v = a[1];
  37785. t1 += v * b0;
  37786. t2 += v * b1;
  37787. t3 += v * b2;
  37788. t4 += v * b3;
  37789. t5 += v * b4;
  37790. t6 += v * b5;
  37791. t7 += v * b6;
  37792. t8 += v * b7;
  37793. t9 += v * b8;
  37794. t10 += v * b9;
  37795. t11 += v * b10;
  37796. t12 += v * b11;
  37797. t13 += v * b12;
  37798. t14 += v * b13;
  37799. t15 += v * b14;
  37800. t16 += v * b15;
  37801. v = a[2];
  37802. t2 += v * b0;
  37803. t3 += v * b1;
  37804. t4 += v * b2;
  37805. t5 += v * b3;
  37806. t6 += v * b4;
  37807. t7 += v * b5;
  37808. t8 += v * b6;
  37809. t9 += v * b7;
  37810. t10 += v * b8;
  37811. t11 += v * b9;
  37812. t12 += v * b10;
  37813. t13 += v * b11;
  37814. t14 += v * b12;
  37815. t15 += v * b13;
  37816. t16 += v * b14;
  37817. t17 += v * b15;
  37818. v = a[3];
  37819. t3 += v * b0;
  37820. t4 += v * b1;
  37821. t5 += v * b2;
  37822. t6 += v * b3;
  37823. t7 += v * b4;
  37824. t8 += v * b5;
  37825. t9 += v * b6;
  37826. t10 += v * b7;
  37827. t11 += v * b8;
  37828. t12 += v * b9;
  37829. t13 += v * b10;
  37830. t14 += v * b11;
  37831. t15 += v * b12;
  37832. t16 += v * b13;
  37833. t17 += v * b14;
  37834. t18 += v * b15;
  37835. v = a[4];
  37836. t4 += v * b0;
  37837. t5 += v * b1;
  37838. t6 += v * b2;
  37839. t7 += v * b3;
  37840. t8 += v * b4;
  37841. t9 += v * b5;
  37842. t10 += v * b6;
  37843. t11 += v * b7;
  37844. t12 += v * b8;
  37845. t13 += v * b9;
  37846. t14 += v * b10;
  37847. t15 += v * b11;
  37848. t16 += v * b12;
  37849. t17 += v * b13;
  37850. t18 += v * b14;
  37851. t19 += v * b15;
  37852. v = a[5];
  37853. t5 += v * b0;
  37854. t6 += v * b1;
  37855. t7 += v * b2;
  37856. t8 += v * b3;
  37857. t9 += v * b4;
  37858. t10 += v * b5;
  37859. t11 += v * b6;
  37860. t12 += v * b7;
  37861. t13 += v * b8;
  37862. t14 += v * b9;
  37863. t15 += v * b10;
  37864. t16 += v * b11;
  37865. t17 += v * b12;
  37866. t18 += v * b13;
  37867. t19 += v * b14;
  37868. t20 += v * b15;
  37869. v = a[6];
  37870. t6 += v * b0;
  37871. t7 += v * b1;
  37872. t8 += v * b2;
  37873. t9 += v * b3;
  37874. t10 += v * b4;
  37875. t11 += v * b5;
  37876. t12 += v * b6;
  37877. t13 += v * b7;
  37878. t14 += v * b8;
  37879. t15 += v * b9;
  37880. t16 += v * b10;
  37881. t17 += v * b11;
  37882. t18 += v * b12;
  37883. t19 += v * b13;
  37884. t20 += v * b14;
  37885. t21 += v * b15;
  37886. v = a[7];
  37887. t7 += v * b0;
  37888. t8 += v * b1;
  37889. t9 += v * b2;
  37890. t10 += v * b3;
  37891. t11 += v * b4;
  37892. t12 += v * b5;
  37893. t13 += v * b6;
  37894. t14 += v * b7;
  37895. t15 += v * b8;
  37896. t16 += v * b9;
  37897. t17 += v * b10;
  37898. t18 += v * b11;
  37899. t19 += v * b12;
  37900. t20 += v * b13;
  37901. t21 += v * b14;
  37902. t22 += v * b15;
  37903. v = a[8];
  37904. t8 += v * b0;
  37905. t9 += v * b1;
  37906. t10 += v * b2;
  37907. t11 += v * b3;
  37908. t12 += v * b4;
  37909. t13 += v * b5;
  37910. t14 += v * b6;
  37911. t15 += v * b7;
  37912. t16 += v * b8;
  37913. t17 += v * b9;
  37914. t18 += v * b10;
  37915. t19 += v * b11;
  37916. t20 += v * b12;
  37917. t21 += v * b13;
  37918. t22 += v * b14;
  37919. t23 += v * b15;
  37920. v = a[9];
  37921. t9 += v * b0;
  37922. t10 += v * b1;
  37923. t11 += v * b2;
  37924. t12 += v * b3;
  37925. t13 += v * b4;
  37926. t14 += v * b5;
  37927. t15 += v * b6;
  37928. t16 += v * b7;
  37929. t17 += v * b8;
  37930. t18 += v * b9;
  37931. t19 += v * b10;
  37932. t20 += v * b11;
  37933. t21 += v * b12;
  37934. t22 += v * b13;
  37935. t23 += v * b14;
  37936. t24 += v * b15;
  37937. v = a[10];
  37938. t10 += v * b0;
  37939. t11 += v * b1;
  37940. t12 += v * b2;
  37941. t13 += v * b3;
  37942. t14 += v * b4;
  37943. t15 += v * b5;
  37944. t16 += v * b6;
  37945. t17 += v * b7;
  37946. t18 += v * b8;
  37947. t19 += v * b9;
  37948. t20 += v * b10;
  37949. t21 += v * b11;
  37950. t22 += v * b12;
  37951. t23 += v * b13;
  37952. t24 += v * b14;
  37953. t25 += v * b15;
  37954. v = a[11];
  37955. t11 += v * b0;
  37956. t12 += v * b1;
  37957. t13 += v * b2;
  37958. t14 += v * b3;
  37959. t15 += v * b4;
  37960. t16 += v * b5;
  37961. t17 += v * b6;
  37962. t18 += v * b7;
  37963. t19 += v * b8;
  37964. t20 += v * b9;
  37965. t21 += v * b10;
  37966. t22 += v * b11;
  37967. t23 += v * b12;
  37968. t24 += v * b13;
  37969. t25 += v * b14;
  37970. t26 += v * b15;
  37971. v = a[12];
  37972. t12 += v * b0;
  37973. t13 += v * b1;
  37974. t14 += v * b2;
  37975. t15 += v * b3;
  37976. t16 += v * b4;
  37977. t17 += v * b5;
  37978. t18 += v * b6;
  37979. t19 += v * b7;
  37980. t20 += v * b8;
  37981. t21 += v * b9;
  37982. t22 += v * b10;
  37983. t23 += v * b11;
  37984. t24 += v * b12;
  37985. t25 += v * b13;
  37986. t26 += v * b14;
  37987. t27 += v * b15;
  37988. v = a[13];
  37989. t13 += v * b0;
  37990. t14 += v * b1;
  37991. t15 += v * b2;
  37992. t16 += v * b3;
  37993. t17 += v * b4;
  37994. t18 += v * b5;
  37995. t19 += v * b6;
  37996. t20 += v * b7;
  37997. t21 += v * b8;
  37998. t22 += v * b9;
  37999. t23 += v * b10;
  38000. t24 += v * b11;
  38001. t25 += v * b12;
  38002. t26 += v * b13;
  38003. t27 += v * b14;
  38004. t28 += v * b15;
  38005. v = a[14];
  38006. t14 += v * b0;
  38007. t15 += v * b1;
  38008. t16 += v * b2;
  38009. t17 += v * b3;
  38010. t18 += v * b4;
  38011. t19 += v * b5;
  38012. t20 += v * b6;
  38013. t21 += v * b7;
  38014. t22 += v * b8;
  38015. t23 += v * b9;
  38016. t24 += v * b10;
  38017. t25 += v * b11;
  38018. t26 += v * b12;
  38019. t27 += v * b13;
  38020. t28 += v * b14;
  38021. t29 += v * b15;
  38022. v = a[15];
  38023. t15 += v * b0;
  38024. t16 += v * b1;
  38025. t17 += v * b2;
  38026. t18 += v * b3;
  38027. t19 += v * b4;
  38028. t20 += v * b5;
  38029. t21 += v * b6;
  38030. t22 += v * b7;
  38031. t23 += v * b8;
  38032. t24 += v * b9;
  38033. t25 += v * b10;
  38034. t26 += v * b11;
  38035. t27 += v * b12;
  38036. t28 += v * b13;
  38037. t29 += v * b14;
  38038. t30 += v * b15;
  38039. t0 += 38 * t16;
  38040. t1 += 38 * t17;
  38041. t2 += 38 * t18;
  38042. t3 += 38 * t19;
  38043. t4 += 38 * t20;
  38044. t5 += 38 * t21;
  38045. t6 += 38 * t22;
  38046. t7 += 38 * t23;
  38047. t8 += 38 * t24;
  38048. t9 += 38 * t25;
  38049. t10 += 38 * t26;
  38050. t11 += 38 * t27;
  38051. t12 += 38 * t28;
  38052. t13 += 38 * t29;
  38053. t14 += 38 * t30;
  38054. // t15 left as is
  38055. // first car
  38056. c = 1;
  38057. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38058. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38059. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38060. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38061. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38062. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38063. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38064. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38065. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38066. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38067. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38068. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38069. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38070. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38071. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38072. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38073. t0 += c-1 + 37 * (c-1);
  38074. // second car
  38075. c = 1;
  38076. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38077. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38078. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38079. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38080. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38081. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38082. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38083. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38084. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38085. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38086. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38087. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38088. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38089. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38090. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38091. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38092. t0 += c-1 + 37 * (c-1);
  38093. o[ 0] = t0;
  38094. o[ 1] = t1;
  38095. o[ 2] = t2;
  38096. o[ 3] = t3;
  38097. o[ 4] = t4;
  38098. o[ 5] = t5;
  38099. o[ 6] = t6;
  38100. o[ 7] = t7;
  38101. o[ 8] = t8;
  38102. o[ 9] = t9;
  38103. o[10] = t10;
  38104. o[11] = t11;
  38105. o[12] = t12;
  38106. o[13] = t13;
  38107. o[14] = t14;
  38108. o[15] = t15;
  38109. }
  38110. function S(o, a) {
  38111. M(o, a, a);
  38112. }
  38113. function inv25519(o, i) {
  38114. var c = gf();
  38115. var a;
  38116. for (a = 0; a < 16; a++) c[a] = i[a];
  38117. for (a = 253; a >= 0; a--) {
  38118. S(c, c);
  38119. if(a !== 2 && a !== 4) M(c, c, i);
  38120. }
  38121. for (a = 0; a < 16; a++) o[a] = c[a];
  38122. }
  38123. function pow2523(o, i) {
  38124. var c = gf();
  38125. var a;
  38126. for (a = 0; a < 16; a++) c[a] = i[a];
  38127. for (a = 250; a >= 0; a--) {
  38128. S(c, c);
  38129. if(a !== 1) M(c, c, i);
  38130. }
  38131. for (a = 0; a < 16; a++) o[a] = c[a];
  38132. }
  38133. function crypto_scalarmult(q, n, p) {
  38134. var z = new Uint8Array(32);
  38135. var x = new Float64Array(80), r, i;
  38136. var a = gf(), b = gf(), c = gf(),
  38137. d = gf(), e = gf(), f = gf();
  38138. for (i = 0; i < 31; i++) z[i] = n[i];
  38139. z[31]=(n[31]&127)|64;
  38140. z[0]&=248;
  38141. unpack25519(x,p);
  38142. for (i = 0; i < 16; i++) {
  38143. b[i]=x[i];
  38144. d[i]=a[i]=c[i]=0;
  38145. }
  38146. a[0]=d[0]=1;
  38147. for (i=254; i>=0; --i) {
  38148. r=(z[i>>>3]>>>(i&7))&1;
  38149. sel25519(a,b,r);
  38150. sel25519(c,d,r);
  38151. A(e,a,c);
  38152. Z(a,a,c);
  38153. A(c,b,d);
  38154. Z(b,b,d);
  38155. S(d,e);
  38156. S(f,a);
  38157. M(a,c,a);
  38158. M(c,b,e);
  38159. A(e,a,c);
  38160. Z(a,a,c);
  38161. S(b,a);
  38162. Z(c,d,f);
  38163. M(a,c,_121665);
  38164. A(a,a,d);
  38165. M(c,c,a);
  38166. M(a,d,f);
  38167. M(d,b,x);
  38168. S(b,e);
  38169. sel25519(a,b,r);
  38170. sel25519(c,d,r);
  38171. }
  38172. for (i = 0; i < 16; i++) {
  38173. x[i+16]=a[i];
  38174. x[i+32]=c[i];
  38175. x[i+48]=b[i];
  38176. x[i+64]=d[i];
  38177. }
  38178. var x32 = x.subarray(32);
  38179. var x16 = x.subarray(16);
  38180. inv25519(x32,x32);
  38181. M(x16,x16,x32);
  38182. pack25519(q,x16);
  38183. return 0;
  38184. }
  38185. function crypto_scalarmult_base(q, n) {
  38186. return crypto_scalarmult(q, n, _9);
  38187. }
  38188. function crypto_box_keypair(y, x) {
  38189. randombytes(x, 32);
  38190. return crypto_scalarmult_base(y, x);
  38191. }
  38192. function crypto_box_beforenm(k, y, x) {
  38193. var s = new Uint8Array(32);
  38194. crypto_scalarmult(s, x, y);
  38195. return crypto_core_hsalsa20(k, _0, s, sigma);
  38196. }
  38197. var crypto_box_afternm = crypto_secretbox;
  38198. var crypto_box_open_afternm = crypto_secretbox_open;
  38199. function crypto_box(c, m, d, n, y, x) {
  38200. var k = new Uint8Array(32);
  38201. crypto_box_beforenm(k, y, x);
  38202. return crypto_box_afternm(c, m, d, n, k);
  38203. }
  38204. function crypto_box_open(m, c, d, n, y, x) {
  38205. var k = new Uint8Array(32);
  38206. crypto_box_beforenm(k, y, x);
  38207. return crypto_box_open_afternm(m, c, d, n, k);
  38208. }
  38209. var K = [
  38210. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38211. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38212. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38213. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38214. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38215. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38216. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38217. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38218. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38219. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38220. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38221. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38222. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38223. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38224. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38225. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38226. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38227. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38228. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38229. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38230. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38231. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38232. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38233. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38234. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38235. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38236. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38237. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38238. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38239. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38240. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38241. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38242. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38243. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38244. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38245. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38246. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38247. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38248. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38249. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38250. ];
  38251. function crypto_hashblocks_hl(hh, hl, m, n) {
  38252. var wh = new Int32Array(16), wl = new Int32Array(16),
  38253. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38254. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38255. th, tl, i, j, h, l, a, b, c, d;
  38256. var ah0 = hh[0],
  38257. ah1 = hh[1],
  38258. ah2 = hh[2],
  38259. ah3 = hh[3],
  38260. ah4 = hh[4],
  38261. ah5 = hh[5],
  38262. ah6 = hh[6],
  38263. ah7 = hh[7],
  38264. al0 = hl[0],
  38265. al1 = hl[1],
  38266. al2 = hl[2],
  38267. al3 = hl[3],
  38268. al4 = hl[4],
  38269. al5 = hl[5],
  38270. al6 = hl[6],
  38271. al7 = hl[7];
  38272. var pos = 0;
  38273. while (n >= 128) {
  38274. for (i = 0; i < 16; i++) {
  38275. j = 8 * i + pos;
  38276. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38277. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38278. }
  38279. for (i = 0; i < 80; i++) {
  38280. bh0 = ah0;
  38281. bh1 = ah1;
  38282. bh2 = ah2;
  38283. bh3 = ah3;
  38284. bh4 = ah4;
  38285. bh5 = ah5;
  38286. bh6 = ah6;
  38287. bh7 = ah7;
  38288. bl0 = al0;
  38289. bl1 = al1;
  38290. bl2 = al2;
  38291. bl3 = al3;
  38292. bl4 = al4;
  38293. bl5 = al5;
  38294. bl6 = al6;
  38295. bl7 = al7;
  38296. // add
  38297. h = ah7;
  38298. l = al7;
  38299. a = l & 0xffff; b = l >>> 16;
  38300. c = h & 0xffff; d = h >>> 16;
  38301. // Sigma1
  38302. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38303. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38304. a += l & 0xffff; b += l >>> 16;
  38305. c += h & 0xffff; d += h >>> 16;
  38306. // Ch
  38307. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38308. l = (al4 & al5) ^ (~al4 & al6);
  38309. a += l & 0xffff; b += l >>> 16;
  38310. c += h & 0xffff; d += h >>> 16;
  38311. // K
  38312. h = K[i*2];
  38313. l = K[i*2+1];
  38314. a += l & 0xffff; b += l >>> 16;
  38315. c += h & 0xffff; d += h >>> 16;
  38316. // w
  38317. h = wh[i%16];
  38318. l = wl[i%16];
  38319. a += l & 0xffff; b += l >>> 16;
  38320. c += h & 0xffff; d += h >>> 16;
  38321. b += a >>> 16;
  38322. c += b >>> 16;
  38323. d += c >>> 16;
  38324. th = c & 0xffff | d << 16;
  38325. tl = a & 0xffff | b << 16;
  38326. // add
  38327. h = th;
  38328. l = tl;
  38329. a = l & 0xffff; b = l >>> 16;
  38330. c = h & 0xffff; d = h >>> 16;
  38331. // Sigma0
  38332. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38333. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38334. a += l & 0xffff; b += l >>> 16;
  38335. c += h & 0xffff; d += h >>> 16;
  38336. // Maj
  38337. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38338. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38339. a += l & 0xffff; b += l >>> 16;
  38340. c += h & 0xffff; d += h >>> 16;
  38341. b += a >>> 16;
  38342. c += b >>> 16;
  38343. d += c >>> 16;
  38344. bh7 = (c & 0xffff) | (d << 16);
  38345. bl7 = (a & 0xffff) | (b << 16);
  38346. // add
  38347. h = bh3;
  38348. l = bl3;
  38349. a = l & 0xffff; b = l >>> 16;
  38350. c = h & 0xffff; d = h >>> 16;
  38351. h = th;
  38352. l = tl;
  38353. a += l & 0xffff; b += l >>> 16;
  38354. c += h & 0xffff; d += h >>> 16;
  38355. b += a >>> 16;
  38356. c += b >>> 16;
  38357. d += c >>> 16;
  38358. bh3 = (c & 0xffff) | (d << 16);
  38359. bl3 = (a & 0xffff) | (b << 16);
  38360. ah1 = bh0;
  38361. ah2 = bh1;
  38362. ah3 = bh2;
  38363. ah4 = bh3;
  38364. ah5 = bh4;
  38365. ah6 = bh5;
  38366. ah7 = bh6;
  38367. ah0 = bh7;
  38368. al1 = bl0;
  38369. al2 = bl1;
  38370. al3 = bl2;
  38371. al4 = bl3;
  38372. al5 = bl4;
  38373. al6 = bl5;
  38374. al7 = bl6;
  38375. al0 = bl7;
  38376. if (i%16 === 15) {
  38377. for (j = 0; j < 16; j++) {
  38378. // add
  38379. h = wh[j];
  38380. l = wl[j];
  38381. a = l & 0xffff; b = l >>> 16;
  38382. c = h & 0xffff; d = h >>> 16;
  38383. h = wh[(j+9)%16];
  38384. l = wl[(j+9)%16];
  38385. a += l & 0xffff; b += l >>> 16;
  38386. c += h & 0xffff; d += h >>> 16;
  38387. // sigma0
  38388. th = wh[(j+1)%16];
  38389. tl = wl[(j+1)%16];
  38390. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38391. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38392. a += l & 0xffff; b += l >>> 16;
  38393. c += h & 0xffff; d += h >>> 16;
  38394. // sigma1
  38395. th = wh[(j+14)%16];
  38396. tl = wl[(j+14)%16];
  38397. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38398. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38399. a += l & 0xffff; b += l >>> 16;
  38400. c += h & 0xffff; d += h >>> 16;
  38401. b += a >>> 16;
  38402. c += b >>> 16;
  38403. d += c >>> 16;
  38404. wh[j] = (c & 0xffff) | (d << 16);
  38405. wl[j] = (a & 0xffff) | (b << 16);
  38406. }
  38407. }
  38408. }
  38409. // add
  38410. h = ah0;
  38411. l = al0;
  38412. a = l & 0xffff; b = l >>> 16;
  38413. c = h & 0xffff; d = h >>> 16;
  38414. h = hh[0];
  38415. l = hl[0];
  38416. a += l & 0xffff; b += l >>> 16;
  38417. c += h & 0xffff; d += h >>> 16;
  38418. b += a >>> 16;
  38419. c += b >>> 16;
  38420. d += c >>> 16;
  38421. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38422. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38423. h = ah1;
  38424. l = al1;
  38425. a = l & 0xffff; b = l >>> 16;
  38426. c = h & 0xffff; d = h >>> 16;
  38427. h = hh[1];
  38428. l = hl[1];
  38429. a += l & 0xffff; b += l >>> 16;
  38430. c += h & 0xffff; d += h >>> 16;
  38431. b += a >>> 16;
  38432. c += b >>> 16;
  38433. d += c >>> 16;
  38434. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38435. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38436. h = ah2;
  38437. l = al2;
  38438. a = l & 0xffff; b = l >>> 16;
  38439. c = h & 0xffff; d = h >>> 16;
  38440. h = hh[2];
  38441. l = hl[2];
  38442. a += l & 0xffff; b += l >>> 16;
  38443. c += h & 0xffff; d += h >>> 16;
  38444. b += a >>> 16;
  38445. c += b >>> 16;
  38446. d += c >>> 16;
  38447. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38448. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38449. h = ah3;
  38450. l = al3;
  38451. a = l & 0xffff; b = l >>> 16;
  38452. c = h & 0xffff; d = h >>> 16;
  38453. h = hh[3];
  38454. l = hl[3];
  38455. a += l & 0xffff; b += l >>> 16;
  38456. c += h & 0xffff; d += h >>> 16;
  38457. b += a >>> 16;
  38458. c += b >>> 16;
  38459. d += c >>> 16;
  38460. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38461. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38462. h = ah4;
  38463. l = al4;
  38464. a = l & 0xffff; b = l >>> 16;
  38465. c = h & 0xffff; d = h >>> 16;
  38466. h = hh[4];
  38467. l = hl[4];
  38468. a += l & 0xffff; b += l >>> 16;
  38469. c += h & 0xffff; d += h >>> 16;
  38470. b += a >>> 16;
  38471. c += b >>> 16;
  38472. d += c >>> 16;
  38473. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38474. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38475. h = ah5;
  38476. l = al5;
  38477. a = l & 0xffff; b = l >>> 16;
  38478. c = h & 0xffff; d = h >>> 16;
  38479. h = hh[5];
  38480. l = hl[5];
  38481. a += l & 0xffff; b += l >>> 16;
  38482. c += h & 0xffff; d += h >>> 16;
  38483. b += a >>> 16;
  38484. c += b >>> 16;
  38485. d += c >>> 16;
  38486. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38487. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38488. h = ah6;
  38489. l = al6;
  38490. a = l & 0xffff; b = l >>> 16;
  38491. c = h & 0xffff; d = h >>> 16;
  38492. h = hh[6];
  38493. l = hl[6];
  38494. a += l & 0xffff; b += l >>> 16;
  38495. c += h & 0xffff; d += h >>> 16;
  38496. b += a >>> 16;
  38497. c += b >>> 16;
  38498. d += c >>> 16;
  38499. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38500. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38501. h = ah7;
  38502. l = al7;
  38503. a = l & 0xffff; b = l >>> 16;
  38504. c = h & 0xffff; d = h >>> 16;
  38505. h = hh[7];
  38506. l = hl[7];
  38507. a += l & 0xffff; b += l >>> 16;
  38508. c += h & 0xffff; d += h >>> 16;
  38509. b += a >>> 16;
  38510. c += b >>> 16;
  38511. d += c >>> 16;
  38512. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38513. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38514. pos += 128;
  38515. n -= 128;
  38516. }
  38517. return n;
  38518. }
  38519. function crypto_hash(out, m, n) {
  38520. var hh = new Int32Array(8),
  38521. hl = new Int32Array(8),
  38522. x = new Uint8Array(256),
  38523. i, b = n;
  38524. hh[0] = 0x6a09e667;
  38525. hh[1] = 0xbb67ae85;
  38526. hh[2] = 0x3c6ef372;
  38527. hh[3] = 0xa54ff53a;
  38528. hh[4] = 0x510e527f;
  38529. hh[5] = 0x9b05688c;
  38530. hh[6] = 0x1f83d9ab;
  38531. hh[7] = 0x5be0cd19;
  38532. hl[0] = 0xf3bcc908;
  38533. hl[1] = 0x84caa73b;
  38534. hl[2] = 0xfe94f82b;
  38535. hl[3] = 0x5f1d36f1;
  38536. hl[4] = 0xade682d1;
  38537. hl[5] = 0x2b3e6c1f;
  38538. hl[6] = 0xfb41bd6b;
  38539. hl[7] = 0x137e2179;
  38540. crypto_hashblocks_hl(hh, hl, m, n);
  38541. n %= 128;
  38542. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38543. x[n] = 128;
  38544. n = 256-128*(n<112?1:0);
  38545. x[n-9] = 0;
  38546. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38547. crypto_hashblocks_hl(hh, hl, x, n);
  38548. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38549. return 0;
  38550. }
  38551. function add(p, q) {
  38552. var a = gf(), b = gf(), c = gf(),
  38553. d = gf(), e = gf(), f = gf(),
  38554. g = gf(), h = gf(), t = gf();
  38555. Z(a, p[1], p[0]);
  38556. Z(t, q[1], q[0]);
  38557. M(a, a, t);
  38558. A(b, p[0], p[1]);
  38559. A(t, q[0], q[1]);
  38560. M(b, b, t);
  38561. M(c, p[3], q[3]);
  38562. M(c, c, D2);
  38563. M(d, p[2], q[2]);
  38564. A(d, d, d);
  38565. Z(e, b, a);
  38566. Z(f, d, c);
  38567. A(g, d, c);
  38568. A(h, b, a);
  38569. M(p[0], e, f);
  38570. M(p[1], h, g);
  38571. M(p[2], g, f);
  38572. M(p[3], e, h);
  38573. }
  38574. function cswap(p, q, b) {
  38575. var i;
  38576. for (i = 0; i < 4; i++) {
  38577. sel25519(p[i], q[i], b);
  38578. }
  38579. }
  38580. function pack(r, p) {
  38581. var tx = gf(), ty = gf(), zi = gf();
  38582. inv25519(zi, p[2]);
  38583. M(tx, p[0], zi);
  38584. M(ty, p[1], zi);
  38585. pack25519(r, ty);
  38586. r[31] ^= par25519(tx) << 7;
  38587. }
  38588. function scalarmult(p, q, s) {
  38589. var b, i;
  38590. set25519(p[0], gf0);
  38591. set25519(p[1], gf1);
  38592. set25519(p[2], gf1);
  38593. set25519(p[3], gf0);
  38594. for (i = 255; i >= 0; --i) {
  38595. b = (s[(i/8)|0] >> (i&7)) & 1;
  38596. cswap(p, q, b);
  38597. add(q, p);
  38598. add(p, p);
  38599. cswap(p, q, b);
  38600. }
  38601. }
  38602. function scalarbase(p, s) {
  38603. var q = [gf(), gf(), gf(), gf()];
  38604. set25519(q[0], X);
  38605. set25519(q[1], Y);
  38606. set25519(q[2], gf1);
  38607. M(q[3], X, Y);
  38608. scalarmult(p, q, s);
  38609. }
  38610. function crypto_sign_keypair(pk, sk, seeded) {
  38611. var d = new Uint8Array(64);
  38612. var p = [gf(), gf(), gf(), gf()];
  38613. var i;
  38614. if (!seeded) randombytes(sk, 32);
  38615. crypto_hash(d, sk, 32);
  38616. d[0] &= 248;
  38617. d[31] &= 127;
  38618. d[31] |= 64;
  38619. scalarbase(p, d);
  38620. pack(pk, p);
  38621. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38622. return 0;
  38623. }
  38624. 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]);
  38625. function modL(r, x) {
  38626. var carry, i, j, k;
  38627. for (i = 63; i >= 32; --i) {
  38628. carry = 0;
  38629. for (j = i - 32, k = i - 12; j < k; ++j) {
  38630. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38631. carry = (x[j] + 128) >> 8;
  38632. x[j] -= carry * 256;
  38633. }
  38634. x[j] += carry;
  38635. x[i] = 0;
  38636. }
  38637. carry = 0;
  38638. for (j = 0; j < 32; j++) {
  38639. x[j] += carry - (x[31] >> 4) * L[j];
  38640. carry = x[j] >> 8;
  38641. x[j] &= 255;
  38642. }
  38643. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38644. for (i = 0; i < 32; i++) {
  38645. x[i+1] += x[i] >> 8;
  38646. r[i] = x[i] & 255;
  38647. }
  38648. }
  38649. function reduce(r) {
  38650. var x = new Float64Array(64), i;
  38651. for (i = 0; i < 64; i++) x[i] = r[i];
  38652. for (i = 0; i < 64; i++) r[i] = 0;
  38653. modL(r, x);
  38654. }
  38655. // Note: difference from C - smlen returned, not passed as argument.
  38656. function crypto_sign(sm, m, n, sk) {
  38657. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38658. var i, j, x = new Float64Array(64);
  38659. var p = [gf(), gf(), gf(), gf()];
  38660. crypto_hash(d, sk, 32);
  38661. d[0] &= 248;
  38662. d[31] &= 127;
  38663. d[31] |= 64;
  38664. var smlen = n + 64;
  38665. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38666. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38667. crypto_hash(r, sm.subarray(32), n+32);
  38668. reduce(r);
  38669. scalarbase(p, r);
  38670. pack(sm, p);
  38671. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38672. crypto_hash(h, sm, n + 64);
  38673. reduce(h);
  38674. for (i = 0; i < 64; i++) x[i] = 0;
  38675. for (i = 0; i < 32; i++) x[i] = r[i];
  38676. for (i = 0; i < 32; i++) {
  38677. for (j = 0; j < 32; j++) {
  38678. x[i+j] += h[i] * d[j];
  38679. }
  38680. }
  38681. modL(sm.subarray(32), x);
  38682. return smlen;
  38683. }
  38684. function unpackneg(r, p) {
  38685. var t = gf(), chk = gf(), num = gf(),
  38686. den = gf(), den2 = gf(), den4 = gf(),
  38687. den6 = gf();
  38688. set25519(r[2], gf1);
  38689. unpack25519(r[1], p);
  38690. S(num, r[1]);
  38691. M(den, num, D);
  38692. Z(num, num, r[2]);
  38693. A(den, r[2], den);
  38694. S(den2, den);
  38695. S(den4, den2);
  38696. M(den6, den4, den2);
  38697. M(t, den6, num);
  38698. M(t, t, den);
  38699. pow2523(t, t);
  38700. M(t, t, num);
  38701. M(t, t, den);
  38702. M(t, t, den);
  38703. M(r[0], t, den);
  38704. S(chk, r[0]);
  38705. M(chk, chk, den);
  38706. if (neq25519(chk, num)) M(r[0], r[0], I);
  38707. S(chk, r[0]);
  38708. M(chk, chk, den);
  38709. if (neq25519(chk, num)) return -1;
  38710. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38711. M(r[3], r[0], r[1]);
  38712. return 0;
  38713. }
  38714. function crypto_sign_open(m, sm, n, pk) {
  38715. var i, mlen;
  38716. var t = new Uint8Array(32), h = new Uint8Array(64);
  38717. var p = [gf(), gf(), gf(), gf()],
  38718. q = [gf(), gf(), gf(), gf()];
  38719. mlen = -1;
  38720. if (n < 64) return -1;
  38721. if (unpackneg(q, pk)) return -1;
  38722. for (i = 0; i < n; i++) m[i] = sm[i];
  38723. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38724. crypto_hash(h, m, n);
  38725. reduce(h);
  38726. scalarmult(p, q, h);
  38727. scalarbase(q, sm.subarray(32));
  38728. add(p, q);
  38729. pack(t, p);
  38730. n -= 64;
  38731. if (crypto_verify_32(sm, 0, t, 0)) {
  38732. for (i = 0; i < n; i++) m[i] = 0;
  38733. return -1;
  38734. }
  38735. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38736. mlen = n;
  38737. return mlen;
  38738. }
  38739. var crypto_secretbox_KEYBYTES = 32,
  38740. crypto_secretbox_NONCEBYTES = 24,
  38741. crypto_secretbox_ZEROBYTES = 32,
  38742. crypto_secretbox_BOXZEROBYTES = 16,
  38743. crypto_scalarmult_BYTES = 32,
  38744. crypto_scalarmult_SCALARBYTES = 32,
  38745. crypto_box_PUBLICKEYBYTES = 32,
  38746. crypto_box_SECRETKEYBYTES = 32,
  38747. crypto_box_BEFORENMBYTES = 32,
  38748. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38749. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38750. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38751. crypto_sign_BYTES = 64,
  38752. crypto_sign_PUBLICKEYBYTES = 32,
  38753. crypto_sign_SECRETKEYBYTES = 64,
  38754. crypto_sign_SEEDBYTES = 32,
  38755. crypto_hash_BYTES = 64;
  38756. nacl.lowlevel = {
  38757. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38758. crypto_stream_xor: crypto_stream_xor,
  38759. crypto_stream: crypto_stream,
  38760. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38761. crypto_stream_salsa20: crypto_stream_salsa20,
  38762. crypto_onetimeauth: crypto_onetimeauth,
  38763. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38764. crypto_verify_16: crypto_verify_16,
  38765. crypto_verify_32: crypto_verify_32,
  38766. crypto_secretbox: crypto_secretbox,
  38767. crypto_secretbox_open: crypto_secretbox_open,
  38768. crypto_scalarmult: crypto_scalarmult,
  38769. crypto_scalarmult_base: crypto_scalarmult_base,
  38770. crypto_box_beforenm: crypto_box_beforenm,
  38771. crypto_box_afternm: crypto_box_afternm,
  38772. crypto_box: crypto_box,
  38773. crypto_box_open: crypto_box_open,
  38774. crypto_box_keypair: crypto_box_keypair,
  38775. crypto_hash: crypto_hash,
  38776. crypto_sign: crypto_sign,
  38777. crypto_sign_keypair: crypto_sign_keypair,
  38778. crypto_sign_open: crypto_sign_open,
  38779. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38780. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38781. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38782. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38783. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38784. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38785. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38786. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38787. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38788. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38789. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38790. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38791. crypto_sign_BYTES: crypto_sign_BYTES,
  38792. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38793. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38794. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38795. crypto_hash_BYTES: crypto_hash_BYTES
  38796. };
  38797. /* High-level API */
  38798. function checkLengths(k, n) {
  38799. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38800. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38801. }
  38802. function checkBoxLengths(pk, sk) {
  38803. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38804. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38805. }
  38806. function checkArrayTypes() {
  38807. for (var i = 0; i < arguments.length; i++) {
  38808. if (!(arguments[i] instanceof Uint8Array))
  38809. throw new TypeError('unexpected type, use Uint8Array');
  38810. }
  38811. }
  38812. function cleanup(arr) {
  38813. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38814. }
  38815. nacl.randomBytes = function(n) {
  38816. var b = new Uint8Array(n);
  38817. randombytes(b, n);
  38818. return b;
  38819. };
  38820. nacl.secretbox = function(msg, nonce, key) {
  38821. checkArrayTypes(msg, nonce, key);
  38822. checkLengths(key, nonce);
  38823. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38824. var c = new Uint8Array(m.length);
  38825. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38826. crypto_secretbox(c, m, m.length, nonce, key);
  38827. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38828. };
  38829. nacl.secretbox.open = function(box, nonce, key) {
  38830. checkArrayTypes(box, nonce, key);
  38831. checkLengths(key, nonce);
  38832. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38833. var m = new Uint8Array(c.length);
  38834. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38835. if (c.length < 32) return null;
  38836. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38837. return m.subarray(crypto_secretbox_ZEROBYTES);
  38838. };
  38839. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38840. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38841. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38842. nacl.scalarMult = function(n, p) {
  38843. checkArrayTypes(n, p);
  38844. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38845. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38846. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38847. crypto_scalarmult(q, n, p);
  38848. return q;
  38849. };
  38850. nacl.scalarMult.base = function(n) {
  38851. checkArrayTypes(n);
  38852. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38853. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38854. crypto_scalarmult_base(q, n);
  38855. return q;
  38856. };
  38857. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38858. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38859. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38860. var k = nacl.box.before(publicKey, secretKey);
  38861. return nacl.secretbox(msg, nonce, k);
  38862. };
  38863. nacl.box.before = function(publicKey, secretKey) {
  38864. checkArrayTypes(publicKey, secretKey);
  38865. checkBoxLengths(publicKey, secretKey);
  38866. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38867. crypto_box_beforenm(k, publicKey, secretKey);
  38868. return k;
  38869. };
  38870. nacl.box.after = nacl.secretbox;
  38871. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38872. var k = nacl.box.before(publicKey, secretKey);
  38873. return nacl.secretbox.open(msg, nonce, k);
  38874. };
  38875. nacl.box.open.after = nacl.secretbox.open;
  38876. nacl.box.keyPair = function() {
  38877. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38878. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38879. crypto_box_keypair(pk, sk);
  38880. return {publicKey: pk, secretKey: sk};
  38881. };
  38882. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38883. checkArrayTypes(secretKey);
  38884. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38885. throw new Error('bad secret key size');
  38886. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38887. crypto_scalarmult_base(pk, secretKey);
  38888. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38889. };
  38890. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38891. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38892. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38893. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38894. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38895. nacl.sign = function(msg, secretKey) {
  38896. checkArrayTypes(msg, secretKey);
  38897. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38898. throw new Error('bad secret key size');
  38899. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38900. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38901. return signedMsg;
  38902. };
  38903. nacl.sign.open = function(signedMsg, publicKey) {
  38904. checkArrayTypes(signedMsg, publicKey);
  38905. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38906. throw new Error('bad public key size');
  38907. var tmp = new Uint8Array(signedMsg.length);
  38908. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  38909. if (mlen < 0) return null;
  38910. var m = new Uint8Array(mlen);
  38911. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  38912. return m;
  38913. };
  38914. nacl.sign.detached = function(msg, secretKey) {
  38915. var signedMsg = nacl.sign(msg, secretKey);
  38916. var sig = new Uint8Array(crypto_sign_BYTES);
  38917. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  38918. return sig;
  38919. };
  38920. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  38921. checkArrayTypes(msg, sig, publicKey);
  38922. if (sig.length !== crypto_sign_BYTES)
  38923. throw new Error('bad signature size');
  38924. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  38925. throw new Error('bad public key size');
  38926. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  38927. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  38928. var i;
  38929. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  38930. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  38931. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  38932. };
  38933. nacl.sign.keyPair = function() {
  38934. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38935. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38936. crypto_sign_keypair(pk, sk);
  38937. return {publicKey: pk, secretKey: sk};
  38938. };
  38939. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  38940. checkArrayTypes(secretKey);
  38941. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38942. throw new Error('bad secret key size');
  38943. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38944. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  38945. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38946. };
  38947. nacl.sign.keyPair.fromSeed = function(seed) {
  38948. checkArrayTypes(seed);
  38949. if (seed.length !== crypto_sign_SEEDBYTES)
  38950. throw new Error('bad seed size');
  38951. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  38952. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  38953. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  38954. crypto_sign_keypair(pk, sk, true);
  38955. return {publicKey: pk, secretKey: sk};
  38956. };
  38957. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  38958. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  38959. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  38960. nacl.sign.signatureLength = crypto_sign_BYTES;
  38961. nacl.hash = function(msg) {
  38962. checkArrayTypes(msg);
  38963. var h = new Uint8Array(crypto_hash_BYTES);
  38964. crypto_hash(h, msg, msg.length);
  38965. return h;
  38966. };
  38967. nacl.hash.hashLength = crypto_hash_BYTES;
  38968. nacl.verify = function(x, y) {
  38969. checkArrayTypes(x, y);
  38970. // Zero length arguments are considered not equal.
  38971. if (x.length === 0 || y.length === 0) return false;
  38972. if (x.length !== y.length) return false;
  38973. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  38974. };
  38975. nacl.setPRNG = function(fn) {
  38976. randombytes = fn;
  38977. };
  38978. (function() {
  38979. // Initialize PRNG if environment provides CSPRNG.
  38980. // If not, methods calling randombytes will throw.
  38981. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  38982. if (crypto && crypto.getRandomValues) {
  38983. // Browsers.
  38984. var QUOTA = 65536;
  38985. nacl.setPRNG(function(x, n) {
  38986. var i, v = new Uint8Array(n);
  38987. for (i = 0; i < n; i += QUOTA) {
  38988. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  38989. }
  38990. for (i = 0; i < n; i++) x[i] = v[i];
  38991. cleanup(v);
  38992. });
  38993. } else if (true) {
  38994. // Node.js.
  38995. crypto = __webpack_require__(3);
  38996. if (crypto && crypto.randomBytes) {
  38997. nacl.setPRNG(function(x, n) {
  38998. var i, v = crypto.randomBytes(n);
  38999. for (i = 0; i < n; i++) x[i] = v[i];
  39000. cleanup(v);
  39001. });
  39002. }
  39003. }
  39004. })();
  39005. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39006. /***/ }),
  39007. /* 1 */
  39008. /***/ (function(module, exports, __webpack_require__) {
  39009. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39010. // Public domain.
  39011. (function(root, f) {
  39012. 'use strict';
  39013. if ( true && module.exports) module.exports = f();
  39014. else if (root.nacl) root.nacl.util = f();
  39015. else {
  39016. root.nacl = {};
  39017. root.nacl.util = f();
  39018. }
  39019. }(this, function() {
  39020. 'use strict';
  39021. var util = {};
  39022. function validateBase64(s) {
  39023. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39024. throw new TypeError('invalid encoding');
  39025. }
  39026. }
  39027. util.decodeUTF8 = function(s) {
  39028. if (typeof s !== 'string') throw new TypeError('expected string');
  39029. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39030. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39031. return b;
  39032. };
  39033. util.encodeUTF8 = function(arr) {
  39034. var i, s = [];
  39035. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39036. return decodeURIComponent(escape(s.join('')));
  39037. };
  39038. if (typeof atob === 'undefined') {
  39039. // Node.js
  39040. if (typeof Buffer.from !== 'undefined') {
  39041. // Node v6 and later
  39042. util.encodeBase64 = function (arr) { // v6 and later
  39043. return Buffer.from(arr).toString('base64');
  39044. };
  39045. util.decodeBase64 = function (s) {
  39046. validateBase64(s);
  39047. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39048. };
  39049. } else {
  39050. // Node earlier than v6
  39051. util.encodeBase64 = function (arr) { // v6 and later
  39052. return (new Buffer(arr)).toString('base64');
  39053. };
  39054. util.decodeBase64 = function(s) {
  39055. validateBase64(s);
  39056. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39057. };
  39058. }
  39059. } else {
  39060. // Browsers
  39061. util.encodeBase64 = function(arr) {
  39062. var i, s = [], len = arr.length;
  39063. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39064. return btoa(s.join(''));
  39065. };
  39066. util.decodeBase64 = function(s) {
  39067. validateBase64(s);
  39068. var i, d = atob(s), b = new Uint8Array(d.length);
  39069. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39070. return b;
  39071. };
  39072. }
  39073. return util;
  39074. }));
  39075. /***/ }),
  39076. /* 2 */
  39077. /***/ (function(module, exports, __webpack_require__) {
  39078. // required so we don't have to do require('pusher').default etc.
  39079. module.exports = __webpack_require__(4).default;
  39080. /***/ }),
  39081. /* 3 */
  39082. /***/ (function(module, exports) {
  39083. /* (ignored) */
  39084. /***/ }),
  39085. /* 4 */
  39086. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39087. "use strict";
  39088. __webpack_require__.r(__webpack_exports__);
  39089. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39090. var ScriptReceiverFactory = (function () {
  39091. function ScriptReceiverFactory(prefix, name) {
  39092. this.lastId = 0;
  39093. this.prefix = prefix;
  39094. this.name = name;
  39095. }
  39096. ScriptReceiverFactory.prototype.create = function (callback) {
  39097. this.lastId++;
  39098. var number = this.lastId;
  39099. var id = this.prefix + number;
  39100. var name = this.name + "[" + number + "]";
  39101. var called = false;
  39102. var callbackWrapper = function () {
  39103. if (!called) {
  39104. callback.apply(null, arguments);
  39105. called = true;
  39106. }
  39107. };
  39108. this[number] = callbackWrapper;
  39109. return { number: number, id: id, name: name, callback: callbackWrapper };
  39110. };
  39111. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39112. delete this[receiver.number];
  39113. };
  39114. return ScriptReceiverFactory;
  39115. }());
  39116. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39117. // CONCATENATED MODULE: ./src/core/defaults.ts
  39118. var Defaults = {
  39119. VERSION: "5.0.3",
  39120. PROTOCOL: 7,
  39121. host: 'ws.pusherapp.com',
  39122. ws_port: 80,
  39123. wss_port: 443,
  39124. ws_path: '',
  39125. sockjs_host: 'sockjs.pusher.com',
  39126. sockjs_http_port: 80,
  39127. sockjs_https_port: 443,
  39128. sockjs_path: '/pusher',
  39129. stats_host: 'stats.pusher.com',
  39130. channel_auth_endpoint: '/pusher/auth',
  39131. channel_auth_transport: 'ajax',
  39132. activity_timeout: 120000,
  39133. pong_timeout: 30000,
  39134. unavailable_timeout: 10000,
  39135. cdn_http: "http://js.pusher.com",
  39136. cdn_https: "https://js.pusher.com",
  39137. dependency_suffix: ""
  39138. };
  39139. /* harmony default export */ var defaults = (Defaults);
  39140. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39141. var dependency_loader_DependencyLoader = (function () {
  39142. function DependencyLoader(options) {
  39143. this.options = options;
  39144. this.receivers = options.receivers || ScriptReceivers;
  39145. this.loading = {};
  39146. }
  39147. DependencyLoader.prototype.load = function (name, options, callback) {
  39148. var self = this;
  39149. if (self.loading[name] && self.loading[name].length > 0) {
  39150. self.loading[name].push(callback);
  39151. }
  39152. else {
  39153. self.loading[name] = [callback];
  39154. var request = runtime.createScriptRequest(self.getPath(name, options));
  39155. var receiver = self.receivers.create(function (error) {
  39156. self.receivers.remove(receiver);
  39157. if (self.loading[name]) {
  39158. var callbacks = self.loading[name];
  39159. delete self.loading[name];
  39160. var successCallback = function (wasSuccessful) {
  39161. if (!wasSuccessful) {
  39162. request.cleanup();
  39163. }
  39164. };
  39165. for (var i = 0; i < callbacks.length; i++) {
  39166. callbacks[i](error, successCallback);
  39167. }
  39168. }
  39169. });
  39170. request.send(receiver);
  39171. }
  39172. };
  39173. DependencyLoader.prototype.getRoot = function (options) {
  39174. var cdn;
  39175. var protocol = runtime.getDocument().location.protocol;
  39176. if ((options && options.useTLS) || protocol === "https:") {
  39177. cdn = this.options.cdn_https;
  39178. }
  39179. else {
  39180. cdn = this.options.cdn_http;
  39181. }
  39182. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39183. };
  39184. DependencyLoader.prototype.getPath = function (name, options) {
  39185. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39186. };
  39187. ;
  39188. return DependencyLoader;
  39189. }());
  39190. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39191. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39192. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39193. var Dependencies = new dependency_loader({
  39194. cdn_http: defaults.cdn_http,
  39195. cdn_https: defaults.cdn_https,
  39196. version: defaults.VERSION,
  39197. suffix: defaults.dependency_suffix,
  39198. receivers: DependenciesReceivers
  39199. });
  39200. // CONCATENATED MODULE: ./src/core/base64.ts
  39201. function encode(s) {
  39202. return btoa(utob(s));
  39203. }
  39204. var fromCharCode = String.fromCharCode;
  39205. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39206. var b64tab = {};
  39207. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39208. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39209. }
  39210. var cb_utob = function (c) {
  39211. var cc = c.charCodeAt(0);
  39212. return cc < 0x80
  39213. ? c
  39214. : cc < 0x800
  39215. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39216. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39217. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39218. fromCharCode(0x80 | (cc & 0x3f));
  39219. };
  39220. var utob = function (u) {
  39221. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39222. };
  39223. var cb_encode = function (ccc) {
  39224. var padlen = [0, 2, 1][ccc.length % 3];
  39225. var ord = (ccc.charCodeAt(0) << 16) |
  39226. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39227. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39228. var chars = [
  39229. b64chars.charAt(ord >>> 18),
  39230. b64chars.charAt((ord >>> 12) & 63),
  39231. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39232. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39233. ];
  39234. return chars.join('');
  39235. };
  39236. var btoa = window.btoa ||
  39237. function (b) {
  39238. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39239. };
  39240. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39241. var Timer = (function () {
  39242. function Timer(set, clear, delay, callback) {
  39243. var _this = this;
  39244. this.clear = clear;
  39245. this.timer = set(function () {
  39246. if (_this.timer) {
  39247. _this.timer = callback(_this.timer);
  39248. }
  39249. }, delay);
  39250. }
  39251. Timer.prototype.isRunning = function () {
  39252. return this.timer !== null;
  39253. };
  39254. Timer.prototype.ensureAborted = function () {
  39255. if (this.timer) {
  39256. this.clear(this.timer);
  39257. this.timer = null;
  39258. }
  39259. };
  39260. return Timer;
  39261. }());
  39262. /* harmony default export */ var abstract_timer = (Timer);
  39263. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39264. var __extends = (undefined && undefined.__extends) || (function () {
  39265. var extendStatics = function (d, b) {
  39266. extendStatics = Object.setPrototypeOf ||
  39267. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39268. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39269. return extendStatics(d, b);
  39270. };
  39271. return function (d, b) {
  39272. extendStatics(d, b);
  39273. function __() { this.constructor = d; }
  39274. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39275. };
  39276. })();
  39277. function timers_clearTimeout(timer) {
  39278. window.clearTimeout(timer);
  39279. }
  39280. function timers_clearInterval(timer) {
  39281. window.clearInterval(timer);
  39282. }
  39283. var OneOffTimer = (function (_super) {
  39284. __extends(OneOffTimer, _super);
  39285. function OneOffTimer(delay, callback) {
  39286. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39287. callback();
  39288. return null;
  39289. }) || this;
  39290. }
  39291. return OneOffTimer;
  39292. }(abstract_timer));
  39293. var PeriodicTimer = (function (_super) {
  39294. __extends(PeriodicTimer, _super);
  39295. function PeriodicTimer(delay, callback) {
  39296. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39297. callback();
  39298. return timer;
  39299. }) || this;
  39300. }
  39301. return PeriodicTimer;
  39302. }(abstract_timer));
  39303. // CONCATENATED MODULE: ./src/core/util.ts
  39304. var Util = {
  39305. now: function () {
  39306. if (Date.now) {
  39307. return Date.now();
  39308. }
  39309. else {
  39310. return new Date().valueOf();
  39311. }
  39312. },
  39313. defer: function (callback) {
  39314. return new OneOffTimer(0, callback);
  39315. },
  39316. method: function (name) {
  39317. var args = [];
  39318. for (var _i = 1; _i < arguments.length; _i++) {
  39319. args[_i - 1] = arguments[_i];
  39320. }
  39321. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39322. return function (object) {
  39323. return object[name].apply(object, boundArguments.concat(arguments));
  39324. };
  39325. }
  39326. };
  39327. /* harmony default export */ var util = (Util);
  39328. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39329. function extend(target) {
  39330. var sources = [];
  39331. for (var _i = 1; _i < arguments.length; _i++) {
  39332. sources[_i - 1] = arguments[_i];
  39333. }
  39334. for (var i = 0; i < sources.length; i++) {
  39335. var extensions = sources[i];
  39336. for (var property in extensions) {
  39337. if (extensions[property] && extensions[property].constructor &&
  39338. extensions[property].constructor === Object) {
  39339. target[property] = extend(target[property] || {}, extensions[property]);
  39340. }
  39341. else {
  39342. target[property] = extensions[property];
  39343. }
  39344. }
  39345. }
  39346. return target;
  39347. }
  39348. function stringify() {
  39349. var m = ["Pusher"];
  39350. for (var i = 0; i < arguments.length; i++) {
  39351. if (typeof arguments[i] === "string") {
  39352. m.push(arguments[i]);
  39353. }
  39354. else {
  39355. m.push(safeJSONStringify(arguments[i]));
  39356. }
  39357. }
  39358. return m.join(" : ");
  39359. }
  39360. function arrayIndexOf(array, item) {
  39361. var nativeIndexOf = Array.prototype.indexOf;
  39362. if (array === null) {
  39363. return -1;
  39364. }
  39365. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39366. return array.indexOf(item);
  39367. }
  39368. for (var i = 0, l = array.length; i < l; i++) {
  39369. if (array[i] === item) {
  39370. return i;
  39371. }
  39372. }
  39373. return -1;
  39374. }
  39375. function objectApply(object, f) {
  39376. for (var key in object) {
  39377. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39378. f(object[key], key, object);
  39379. }
  39380. }
  39381. }
  39382. function keys(object) {
  39383. var keys = [];
  39384. objectApply(object, function (_, key) {
  39385. keys.push(key);
  39386. });
  39387. return keys;
  39388. }
  39389. function values(object) {
  39390. var values = [];
  39391. objectApply(object, function (value) {
  39392. values.push(value);
  39393. });
  39394. return values;
  39395. }
  39396. function apply(array, f, context) {
  39397. for (var i = 0; i < array.length; i++) {
  39398. f.call(context || window, array[i], i, array);
  39399. }
  39400. }
  39401. function map(array, f) {
  39402. var result = [];
  39403. for (var i = 0; i < array.length; i++) {
  39404. result.push(f(array[i], i, array, result));
  39405. }
  39406. return result;
  39407. }
  39408. function mapObject(object, f) {
  39409. var result = {};
  39410. objectApply(object, function (value, key) {
  39411. result[key] = f(value);
  39412. });
  39413. return result;
  39414. }
  39415. function filter(array, test) {
  39416. test = test || function (value) { return !!value; };
  39417. var result = [];
  39418. for (var i = 0; i < array.length; i++) {
  39419. if (test(array[i], i, array, result)) {
  39420. result.push(array[i]);
  39421. }
  39422. }
  39423. return result;
  39424. }
  39425. function filterObject(object, test) {
  39426. var result = {};
  39427. objectApply(object, function (value, key) {
  39428. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39429. result[key] = value;
  39430. }
  39431. });
  39432. return result;
  39433. }
  39434. function flatten(object) {
  39435. var result = [];
  39436. objectApply(object, function (value, key) {
  39437. result.push([key, value]);
  39438. });
  39439. return result;
  39440. }
  39441. function any(array, test) {
  39442. for (var i = 0; i < array.length; i++) {
  39443. if (test(array[i], i, array)) {
  39444. return true;
  39445. }
  39446. }
  39447. return false;
  39448. }
  39449. function collections_all(array, test) {
  39450. for (var i = 0; i < array.length; i++) {
  39451. if (!test(array[i], i, array)) {
  39452. return false;
  39453. }
  39454. }
  39455. return true;
  39456. }
  39457. function encodeParamsObject(data) {
  39458. return mapObject(data, function (value) {
  39459. if (typeof value === "object") {
  39460. value = safeJSONStringify(value);
  39461. }
  39462. return encodeURIComponent(encode(value.toString()));
  39463. });
  39464. }
  39465. function buildQueryString(data) {
  39466. var params = filterObject(data, function (value) {
  39467. return value !== undefined;
  39468. });
  39469. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39470. return query;
  39471. }
  39472. function decycleObject(object) {
  39473. var objects = [], paths = [];
  39474. return (function derez(value, path) {
  39475. var i, name, nu;
  39476. switch (typeof value) {
  39477. case 'object':
  39478. if (!value) {
  39479. return null;
  39480. }
  39481. for (i = 0; i < objects.length; i += 1) {
  39482. if (objects[i] === value) {
  39483. return { $ref: paths[i] };
  39484. }
  39485. }
  39486. objects.push(value);
  39487. paths.push(path);
  39488. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39489. nu = [];
  39490. for (i = 0; i < value.length; i += 1) {
  39491. nu[i] = derez(value[i], path + '[' + i + ']');
  39492. }
  39493. }
  39494. else {
  39495. nu = {};
  39496. for (name in value) {
  39497. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39498. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39499. }
  39500. }
  39501. }
  39502. return nu;
  39503. case 'number':
  39504. case 'string':
  39505. case 'boolean':
  39506. return value;
  39507. }
  39508. }(object, '$'));
  39509. }
  39510. function safeJSONStringify(source) {
  39511. try {
  39512. return JSON.stringify(source);
  39513. }
  39514. catch (e) {
  39515. return JSON.stringify(decycleObject(source));
  39516. }
  39517. }
  39518. // CONCATENATED MODULE: ./src/core/logger.ts
  39519. var logger_Logger = (function () {
  39520. function Logger() {
  39521. this.globalLog = function (message) {
  39522. if (window.console && window.console.log) {
  39523. window.console.log(message);
  39524. }
  39525. };
  39526. }
  39527. Logger.prototype.debug = function () {
  39528. var args = [];
  39529. for (var _i = 0; _i < arguments.length; _i++) {
  39530. args[_i] = arguments[_i];
  39531. }
  39532. this.log(this.globalLog, args);
  39533. };
  39534. Logger.prototype.warn = function () {
  39535. var args = [];
  39536. for (var _i = 0; _i < arguments.length; _i++) {
  39537. args[_i] = arguments[_i];
  39538. }
  39539. this.log(this.globalLogWarn, args);
  39540. };
  39541. Logger.prototype.error = function () {
  39542. var args = [];
  39543. for (var _i = 0; _i < arguments.length; _i++) {
  39544. args[_i] = arguments[_i];
  39545. }
  39546. this.log(this.globalLogError, args);
  39547. };
  39548. Logger.prototype.globalLogWarn = function (message) {
  39549. if (window.console && window.console.warn) {
  39550. window.console.warn(message);
  39551. }
  39552. else {
  39553. this.globalLog(message);
  39554. }
  39555. };
  39556. Logger.prototype.globalLogError = function (message) {
  39557. if (window.console && window.console.error) {
  39558. window.console.error(message);
  39559. }
  39560. else {
  39561. this.globalLogWarn(message);
  39562. }
  39563. };
  39564. Logger.prototype.log = function (defaultLoggingFunction) {
  39565. var args = [];
  39566. for (var _i = 1; _i < arguments.length; _i++) {
  39567. args[_i - 1] = arguments[_i];
  39568. }
  39569. var message = stringify.apply(this, arguments);
  39570. if (core_pusher.log) {
  39571. core_pusher.log(message);
  39572. }
  39573. else if (core_pusher.logToConsole) {
  39574. var log = defaultLoggingFunction.bind(this);
  39575. log(message);
  39576. }
  39577. };
  39578. return Logger;
  39579. }());
  39580. /* harmony default export */ var logger = (new logger_Logger());
  39581. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39582. var urlStore = {
  39583. baseUrl: "https://pusher.com",
  39584. urls: {
  39585. authenticationEndpoint: {
  39586. path: "/docs/authenticating_users",
  39587. },
  39588. javascriptQuickStart: {
  39589. path: "/docs/javascript_quick_start"
  39590. },
  39591. triggeringClientEvents: {
  39592. path: "/docs/client_api_guide/client_events#trigger-events"
  39593. }
  39594. }
  39595. };
  39596. var buildLogSuffix = function (key) {
  39597. var urlPrefix = "See:";
  39598. var urlObj = urlStore.urls[key];
  39599. if (!urlObj)
  39600. return "";
  39601. var url;
  39602. if (urlObj.fullUrl) {
  39603. url = urlObj.fullUrl;
  39604. }
  39605. else if (urlObj.path) {
  39606. url = urlStore.baseUrl + urlObj.path;
  39607. }
  39608. if (!url)
  39609. return "";
  39610. return urlPrefix + " " + url;
  39611. };
  39612. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39613. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39614. var ajax = function (context, socketId, callback) {
  39615. var self = this, xhr;
  39616. xhr = runtime.createXHR();
  39617. xhr.open("POST", self.options.authEndpoint, true);
  39618. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39619. for (var headerName in this.authOptions.headers) {
  39620. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39621. }
  39622. xhr.onreadystatechange = function () {
  39623. if (xhr.readyState === 4) {
  39624. if (xhr.status === 200) {
  39625. var data, parsed = false;
  39626. try {
  39627. data = JSON.parse(xhr.responseText);
  39628. parsed = true;
  39629. }
  39630. catch (e) {
  39631. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39632. }
  39633. if (parsed) {
  39634. callback(false, data);
  39635. }
  39636. }
  39637. else {
  39638. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39639. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39640. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39641. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39642. callback(true, xhr.status);
  39643. }
  39644. }
  39645. };
  39646. xhr.send(this.composeQuery(socketId));
  39647. return xhr;
  39648. };
  39649. /* harmony default export */ var xhr_auth = (ajax);
  39650. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39651. var jsonp = function (context, socketId, callback) {
  39652. if (this.authOptions.headers !== undefined) {
  39653. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39654. }
  39655. var callbackName = context.nextAuthCallbackID.toString();
  39656. context.nextAuthCallbackID++;
  39657. var document = context.getDocument();
  39658. var script = document.createElement("script");
  39659. context.auth_callbacks[callbackName] = function (data) {
  39660. callback(false, data);
  39661. };
  39662. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39663. script.src = this.options.authEndpoint +
  39664. '?callback=' +
  39665. encodeURIComponent(callback_name) +
  39666. '&' +
  39667. this.composeQuery(socketId);
  39668. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39669. head.insertBefore(script, head.firstChild);
  39670. };
  39671. /* harmony default export */ var jsonp_auth = (jsonp);
  39672. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39673. var ScriptRequest = (function () {
  39674. function ScriptRequest(src) {
  39675. this.src = src;
  39676. }
  39677. ScriptRequest.prototype.send = function (receiver) {
  39678. var self = this;
  39679. var errorString = "Error loading " + self.src;
  39680. self.script = document.createElement("script");
  39681. self.script.id = receiver.id;
  39682. self.script.src = self.src;
  39683. self.script.type = "text/javascript";
  39684. self.script.charset = "UTF-8";
  39685. if (self.script.addEventListener) {
  39686. self.script.onerror = function () {
  39687. receiver.callback(errorString);
  39688. };
  39689. self.script.onload = function () {
  39690. receiver.callback(null);
  39691. };
  39692. }
  39693. else {
  39694. self.script.onreadystatechange = function () {
  39695. if (self.script.readyState === 'loaded' ||
  39696. self.script.readyState === 'complete') {
  39697. receiver.callback(null);
  39698. }
  39699. };
  39700. }
  39701. if (self.script.async === undefined && document.attachEvent &&
  39702. /opera/i.test(navigator.userAgent)) {
  39703. self.errorScript = document.createElement("script");
  39704. self.errorScript.id = receiver.id + "_error";
  39705. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39706. self.script.async = self.errorScript.async = false;
  39707. }
  39708. else {
  39709. self.script.async = true;
  39710. }
  39711. var head = document.getElementsByTagName('head')[0];
  39712. head.insertBefore(self.script, head.firstChild);
  39713. if (self.errorScript) {
  39714. head.insertBefore(self.errorScript, self.script.nextSibling);
  39715. }
  39716. };
  39717. ScriptRequest.prototype.cleanup = function () {
  39718. if (this.script) {
  39719. this.script.onload = this.script.onerror = null;
  39720. this.script.onreadystatechange = null;
  39721. }
  39722. if (this.script && this.script.parentNode) {
  39723. this.script.parentNode.removeChild(this.script);
  39724. }
  39725. if (this.errorScript && this.errorScript.parentNode) {
  39726. this.errorScript.parentNode.removeChild(this.errorScript);
  39727. }
  39728. this.script = null;
  39729. this.errorScript = null;
  39730. };
  39731. return ScriptRequest;
  39732. }());
  39733. /* harmony default export */ var script_request = (ScriptRequest);
  39734. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39735. var jsonp_request_JSONPRequest = (function () {
  39736. function JSONPRequest(url, data) {
  39737. this.url = url;
  39738. this.data = data;
  39739. }
  39740. JSONPRequest.prototype.send = function (receiver) {
  39741. if (this.request) {
  39742. return;
  39743. }
  39744. var query = buildQueryString(this.data);
  39745. var url = this.url + "/" + receiver.number + "?" + query;
  39746. this.request = runtime.createScriptRequest(url);
  39747. this.request.send(receiver);
  39748. };
  39749. JSONPRequest.prototype.cleanup = function () {
  39750. if (this.request) {
  39751. this.request.cleanup();
  39752. }
  39753. };
  39754. return JSONPRequest;
  39755. }());
  39756. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39757. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39758. var getAgent = function (sender, useTLS) {
  39759. return function (data, callback) {
  39760. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39761. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39762. var request = runtime.createJSONPRequest(url, data);
  39763. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39764. ScriptReceivers.remove(receiver);
  39765. request.cleanup();
  39766. if (result && result.host) {
  39767. sender.host = result.host;
  39768. }
  39769. if (callback) {
  39770. callback(error, result);
  39771. }
  39772. });
  39773. request.send(receiver);
  39774. };
  39775. };
  39776. var jsonp_timeline_jsonp = {
  39777. name: 'jsonp',
  39778. getAgent: getAgent
  39779. };
  39780. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39781. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39782. function getGenericURL(baseScheme, params, path) {
  39783. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39784. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39785. return scheme + "://" + host + path;
  39786. }
  39787. function getGenericPath(key, queryString) {
  39788. var path = "/app/" + key;
  39789. var query = "?protocol=" + defaults.PROTOCOL +
  39790. "&client=js" +
  39791. "&version=" + defaults.VERSION +
  39792. (queryString ? ("&" + queryString) : "");
  39793. return path + query;
  39794. }
  39795. var ws = {
  39796. getInitial: function (key, params) {
  39797. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39798. return getGenericURL("ws", params, path);
  39799. }
  39800. };
  39801. var http = {
  39802. getInitial: function (key, params) {
  39803. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39804. return getGenericURL("http", params, path);
  39805. }
  39806. };
  39807. var sockjs = {
  39808. getInitial: function (key, params) {
  39809. return getGenericURL("http", params, params.httpPath || "/pusher");
  39810. },
  39811. getPath: function (key, params) {
  39812. return getGenericPath(key);
  39813. }
  39814. };
  39815. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39816. var callback_registry_CallbackRegistry = (function () {
  39817. function CallbackRegistry() {
  39818. this._callbacks = {};
  39819. }
  39820. CallbackRegistry.prototype.get = function (name) {
  39821. return this._callbacks[prefix(name)];
  39822. };
  39823. CallbackRegistry.prototype.add = function (name, callback, context) {
  39824. var prefixedEventName = prefix(name);
  39825. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39826. this._callbacks[prefixedEventName].push({
  39827. fn: callback,
  39828. context: context
  39829. });
  39830. };
  39831. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39832. if (!name && !callback && !context) {
  39833. this._callbacks = {};
  39834. return;
  39835. }
  39836. var names = name ? [prefix(name)] : keys(this._callbacks);
  39837. if (callback || context) {
  39838. this.removeCallback(names, callback, context);
  39839. }
  39840. else {
  39841. this.removeAllCallbacks(names);
  39842. }
  39843. };
  39844. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39845. apply(names, function (name) {
  39846. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39847. return (callback && callback !== binding.fn) ||
  39848. (context && context !== binding.context);
  39849. });
  39850. if (this._callbacks[name].length === 0) {
  39851. delete this._callbacks[name];
  39852. }
  39853. }, this);
  39854. };
  39855. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39856. apply(names, function (name) {
  39857. delete this._callbacks[name];
  39858. }, this);
  39859. };
  39860. return CallbackRegistry;
  39861. }());
  39862. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39863. function prefix(name) {
  39864. return "_" + name;
  39865. }
  39866. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39867. var dispatcher_Dispatcher = (function () {
  39868. function Dispatcher(failThrough) {
  39869. this.callbacks = new callback_registry();
  39870. this.global_callbacks = [];
  39871. this.failThrough = failThrough;
  39872. }
  39873. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39874. this.callbacks.add(eventName, callback, context);
  39875. return this;
  39876. };
  39877. Dispatcher.prototype.bind_global = function (callback) {
  39878. this.global_callbacks.push(callback);
  39879. return this;
  39880. };
  39881. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39882. this.callbacks.remove(eventName, callback, context);
  39883. return this;
  39884. };
  39885. Dispatcher.prototype.unbind_global = function (callback) {
  39886. if (!callback) {
  39887. this.global_callbacks = [];
  39888. return this;
  39889. }
  39890. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39891. return this;
  39892. };
  39893. Dispatcher.prototype.unbind_all = function () {
  39894. this.unbind();
  39895. this.unbind_global();
  39896. return this;
  39897. };
  39898. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39899. for (var i = 0; i < this.global_callbacks.length; i++) {
  39900. this.global_callbacks[i](eventName, data);
  39901. }
  39902. var callbacks = this.callbacks.get(eventName);
  39903. var args = [];
  39904. if (metadata) {
  39905. args.push(data, metadata);
  39906. }
  39907. else if (data) {
  39908. args.push(data);
  39909. }
  39910. if (callbacks && callbacks.length > 0) {
  39911. for (var i = 0; i < callbacks.length; i++) {
  39912. callbacks[i].fn.apply(callbacks[i].context || window, args);
  39913. }
  39914. }
  39915. else if (this.failThrough) {
  39916. this.failThrough(eventName, data);
  39917. }
  39918. return this;
  39919. };
  39920. return Dispatcher;
  39921. }());
  39922. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  39923. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  39924. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  39925. var extendStatics = function (d, b) {
  39926. extendStatics = Object.setPrototypeOf ||
  39927. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39928. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39929. return extendStatics(d, b);
  39930. };
  39931. return function (d, b) {
  39932. extendStatics(d, b);
  39933. function __() { this.constructor = d; }
  39934. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39935. };
  39936. })();
  39937. var transport_connection_TransportConnection = (function (_super) {
  39938. transport_connection_extends(TransportConnection, _super);
  39939. function TransportConnection(hooks, name, priority, key, options) {
  39940. var _this = _super.call(this) || this;
  39941. _this.initialize = runtime.transportConnectionInitializer;
  39942. _this.hooks = hooks;
  39943. _this.name = name;
  39944. _this.priority = priority;
  39945. _this.key = key;
  39946. _this.options = options;
  39947. _this.state = "new";
  39948. _this.timeline = options.timeline;
  39949. _this.activityTimeout = options.activityTimeout;
  39950. _this.id = _this.timeline.generateUniqueID();
  39951. return _this;
  39952. }
  39953. TransportConnection.prototype.handlesActivityChecks = function () {
  39954. return Boolean(this.hooks.handlesActivityChecks);
  39955. };
  39956. TransportConnection.prototype.supportsPing = function () {
  39957. return Boolean(this.hooks.supportsPing);
  39958. };
  39959. TransportConnection.prototype.connect = function () {
  39960. var _this = this;
  39961. if (this.socket || this.state !== "initialized") {
  39962. return false;
  39963. }
  39964. var url = this.hooks.urls.getInitial(this.key, this.options);
  39965. try {
  39966. this.socket = this.hooks.getSocket(url, this.options);
  39967. }
  39968. catch (e) {
  39969. util.defer(function () {
  39970. _this.onError(e);
  39971. _this.changeState("closed");
  39972. });
  39973. return false;
  39974. }
  39975. this.bindListeners();
  39976. logger.debug("Connecting", { transport: this.name, url: url });
  39977. this.changeState("connecting");
  39978. return true;
  39979. };
  39980. TransportConnection.prototype.close = function () {
  39981. if (this.socket) {
  39982. this.socket.close();
  39983. return true;
  39984. }
  39985. else {
  39986. return false;
  39987. }
  39988. };
  39989. TransportConnection.prototype.send = function (data) {
  39990. var _this = this;
  39991. if (this.state === "open") {
  39992. util.defer(function () {
  39993. if (_this.socket) {
  39994. _this.socket.send(data);
  39995. }
  39996. });
  39997. return true;
  39998. }
  39999. else {
  40000. return false;
  40001. }
  40002. };
  40003. TransportConnection.prototype.ping = function () {
  40004. if (this.state === "open" && this.supportsPing()) {
  40005. this.socket.ping();
  40006. }
  40007. };
  40008. TransportConnection.prototype.onOpen = function () {
  40009. if (this.hooks.beforeOpen) {
  40010. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40011. }
  40012. this.changeState("open");
  40013. this.socket.onopen = undefined;
  40014. };
  40015. TransportConnection.prototype.onError = function (error) {
  40016. this.emit("error", { type: 'WebSocketError', error: error });
  40017. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40018. };
  40019. TransportConnection.prototype.onClose = function (closeEvent) {
  40020. if (closeEvent) {
  40021. this.changeState("closed", {
  40022. code: closeEvent.code,
  40023. reason: closeEvent.reason,
  40024. wasClean: closeEvent.wasClean
  40025. });
  40026. }
  40027. else {
  40028. this.changeState("closed");
  40029. }
  40030. this.unbindListeners();
  40031. this.socket = undefined;
  40032. };
  40033. TransportConnection.prototype.onMessage = function (message) {
  40034. this.emit("message", message);
  40035. };
  40036. TransportConnection.prototype.onActivity = function () {
  40037. this.emit("activity");
  40038. };
  40039. TransportConnection.prototype.bindListeners = function () {
  40040. var _this = this;
  40041. this.socket.onopen = function () {
  40042. _this.onOpen();
  40043. };
  40044. this.socket.onerror = function (error) {
  40045. _this.onError(error);
  40046. };
  40047. this.socket.onclose = function (closeEvent) {
  40048. _this.onClose(closeEvent);
  40049. };
  40050. this.socket.onmessage = function (message) {
  40051. _this.onMessage(message);
  40052. };
  40053. if (this.supportsPing()) {
  40054. this.socket.onactivity = function () { _this.onActivity(); };
  40055. }
  40056. };
  40057. TransportConnection.prototype.unbindListeners = function () {
  40058. if (this.socket) {
  40059. this.socket.onopen = undefined;
  40060. this.socket.onerror = undefined;
  40061. this.socket.onclose = undefined;
  40062. this.socket.onmessage = undefined;
  40063. if (this.supportsPing()) {
  40064. this.socket.onactivity = undefined;
  40065. }
  40066. }
  40067. };
  40068. TransportConnection.prototype.changeState = function (state, params) {
  40069. this.state = state;
  40070. this.timeline.info(this.buildTimelineMessage({
  40071. state: state,
  40072. params: params
  40073. }));
  40074. this.emit(state, params);
  40075. };
  40076. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40077. return extend({ cid: this.id }, message);
  40078. };
  40079. return TransportConnection;
  40080. }(dispatcher));
  40081. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40082. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40083. var transport_Transport = (function () {
  40084. function Transport(hooks) {
  40085. this.hooks = hooks;
  40086. }
  40087. Transport.prototype.isSupported = function (environment) {
  40088. return this.hooks.isSupported(environment);
  40089. };
  40090. Transport.prototype.createConnection = function (name, priority, key, options) {
  40091. return new transport_connection(this.hooks, name, priority, key, options);
  40092. };
  40093. return Transport;
  40094. }());
  40095. /* harmony default export */ var transports_transport = (transport_Transport);
  40096. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40097. var WSTransport = new transports_transport({
  40098. urls: ws,
  40099. handlesActivityChecks: false,
  40100. supportsPing: false,
  40101. isInitialized: function () {
  40102. return Boolean(runtime.getWebSocketAPI());
  40103. },
  40104. isSupported: function () {
  40105. return Boolean(runtime.getWebSocketAPI());
  40106. },
  40107. getSocket: function (url) {
  40108. return runtime.createWebSocket(url);
  40109. }
  40110. });
  40111. var httpConfiguration = {
  40112. urls: http,
  40113. handlesActivityChecks: false,
  40114. supportsPing: true,
  40115. isInitialized: function () {
  40116. return true;
  40117. }
  40118. };
  40119. var streamingConfiguration = extend({ getSocket: function (url) {
  40120. return runtime.HTTPFactory.createStreamingSocket(url);
  40121. }
  40122. }, httpConfiguration);
  40123. var pollingConfiguration = extend({ getSocket: function (url) {
  40124. return runtime.HTTPFactory.createPollingSocket(url);
  40125. }
  40126. }, httpConfiguration);
  40127. var xhrConfiguration = {
  40128. isSupported: function () {
  40129. return runtime.isXHRSupported();
  40130. }
  40131. };
  40132. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40133. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40134. var Transports = {
  40135. ws: WSTransport,
  40136. xhr_streaming: XHRStreamingTransport,
  40137. xhr_polling: XHRPollingTransport
  40138. };
  40139. /* harmony default export */ var transports = (Transports);
  40140. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40141. var SockJSTransport = new transports_transport({
  40142. file: "sockjs",
  40143. urls: sockjs,
  40144. handlesActivityChecks: true,
  40145. supportsPing: false,
  40146. isSupported: function () {
  40147. return true;
  40148. },
  40149. isInitialized: function () {
  40150. return window.SockJS !== undefined;
  40151. },
  40152. getSocket: function (url, options) {
  40153. return new window.SockJS(url, null, {
  40154. js_path: Dependencies.getPath("sockjs", {
  40155. useTLS: options.useTLS
  40156. }),
  40157. ignore_null_origin: options.ignoreNullOrigin
  40158. });
  40159. },
  40160. beforeOpen: function (socket, path) {
  40161. socket.send(JSON.stringify({
  40162. path: path
  40163. }));
  40164. }
  40165. });
  40166. var xdrConfiguration = {
  40167. isSupported: function (environment) {
  40168. var yes = runtime.isXDRSupported(environment.useTLS);
  40169. return yes;
  40170. }
  40171. };
  40172. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40173. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40174. transports.xdr_streaming = XDRStreamingTransport;
  40175. transports.xdr_polling = XDRPollingTransport;
  40176. transports.sockjs = SockJSTransport;
  40177. /* harmony default export */ var transports_transports = (transports);
  40178. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40179. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40180. var extendStatics = function (d, b) {
  40181. extendStatics = Object.setPrototypeOf ||
  40182. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40183. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40184. return extendStatics(d, b);
  40185. };
  40186. return function (d, b) {
  40187. extendStatics(d, b);
  40188. function __() { this.constructor = d; }
  40189. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40190. };
  40191. })();
  40192. var NetInfo = (function (_super) {
  40193. net_info_extends(NetInfo, _super);
  40194. function NetInfo() {
  40195. var _this = _super.call(this) || this;
  40196. var self = _this;
  40197. if (window.addEventListener !== undefined) {
  40198. window.addEventListener("online", function () {
  40199. self.emit('online');
  40200. }, false);
  40201. window.addEventListener("offline", function () {
  40202. self.emit('offline');
  40203. }, false);
  40204. }
  40205. return _this;
  40206. }
  40207. NetInfo.prototype.isOnline = function () {
  40208. if (window.navigator.onLine === undefined) {
  40209. return true;
  40210. }
  40211. else {
  40212. return window.navigator.onLine;
  40213. }
  40214. };
  40215. return NetInfo;
  40216. }(dispatcher));
  40217. var net_info_Network = new NetInfo();
  40218. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40219. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40220. function AssistantToTheTransportManager(manager, transport, options) {
  40221. this.manager = manager;
  40222. this.transport = transport;
  40223. this.minPingDelay = options.minPingDelay;
  40224. this.maxPingDelay = options.maxPingDelay;
  40225. this.pingDelay = undefined;
  40226. }
  40227. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40228. var _this = this;
  40229. options = extend({}, options, {
  40230. activityTimeout: this.pingDelay
  40231. });
  40232. var connection = this.transport.createConnection(name, priority, key, options);
  40233. var openTimestamp = null;
  40234. var onOpen = function () {
  40235. connection.unbind("open", onOpen);
  40236. connection.bind("closed", onClosed);
  40237. openTimestamp = util.now();
  40238. };
  40239. var onClosed = function (closeEvent) {
  40240. connection.unbind("closed", onClosed);
  40241. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40242. _this.manager.reportDeath();
  40243. }
  40244. else if (!closeEvent.wasClean && openTimestamp) {
  40245. var lifespan = util.now() - openTimestamp;
  40246. if (lifespan < 2 * _this.maxPingDelay) {
  40247. _this.manager.reportDeath();
  40248. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40249. }
  40250. }
  40251. };
  40252. connection.bind("open", onOpen);
  40253. return connection;
  40254. };
  40255. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40256. return this.manager.isAlive() && this.transport.isSupported(environment);
  40257. };
  40258. return AssistantToTheTransportManager;
  40259. }());
  40260. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40261. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40262. var Protocol = {
  40263. decodeMessage: function (messageEvent) {
  40264. try {
  40265. var messageData = JSON.parse(messageEvent.data);
  40266. var pusherEventData = messageData.data;
  40267. if (typeof pusherEventData === 'string') {
  40268. try {
  40269. pusherEventData = JSON.parse(messageData.data);
  40270. }
  40271. catch (e) { }
  40272. }
  40273. var pusherEvent = {
  40274. event: messageData.event,
  40275. channel: messageData.channel,
  40276. data: pusherEventData,
  40277. };
  40278. if (messageData.user_id) {
  40279. pusherEvent.user_id = messageData.user_id;
  40280. }
  40281. return pusherEvent;
  40282. }
  40283. catch (e) {
  40284. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40285. }
  40286. },
  40287. encodeMessage: function (event) {
  40288. return JSON.stringify(event);
  40289. },
  40290. processHandshake: function (messageEvent) {
  40291. var message = Protocol.decodeMessage(messageEvent);
  40292. if (message.event === "pusher:connection_established") {
  40293. if (!message.data.activity_timeout) {
  40294. throw "No activity timeout specified in handshake";
  40295. }
  40296. return {
  40297. action: "connected",
  40298. id: message.data.socket_id,
  40299. activityTimeout: message.data.activity_timeout * 1000
  40300. };
  40301. }
  40302. else if (message.event === "pusher:error") {
  40303. return {
  40304. action: this.getCloseAction(message.data),
  40305. error: this.getCloseError(message.data)
  40306. };
  40307. }
  40308. else {
  40309. throw "Invalid handshake";
  40310. }
  40311. },
  40312. getCloseAction: function (closeEvent) {
  40313. if (closeEvent.code < 4000) {
  40314. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40315. return "backoff";
  40316. }
  40317. else {
  40318. return null;
  40319. }
  40320. }
  40321. else if (closeEvent.code === 4000) {
  40322. return "tls_only";
  40323. }
  40324. else if (closeEvent.code < 4100) {
  40325. return "refused";
  40326. }
  40327. else if (closeEvent.code < 4200) {
  40328. return "backoff";
  40329. }
  40330. else if (closeEvent.code < 4300) {
  40331. return "retry";
  40332. }
  40333. else {
  40334. return "refused";
  40335. }
  40336. },
  40337. getCloseError: function (closeEvent) {
  40338. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40339. return {
  40340. type: 'PusherError',
  40341. data: {
  40342. code: closeEvent.code,
  40343. message: closeEvent.reason || closeEvent.message
  40344. }
  40345. };
  40346. }
  40347. else {
  40348. return null;
  40349. }
  40350. }
  40351. };
  40352. /* harmony default export */ var protocol_protocol = (Protocol);
  40353. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40354. var connection_extends = (undefined && undefined.__extends) || (function () {
  40355. var extendStatics = function (d, b) {
  40356. extendStatics = Object.setPrototypeOf ||
  40357. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40358. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40359. return extendStatics(d, b);
  40360. };
  40361. return function (d, b) {
  40362. extendStatics(d, b);
  40363. function __() { this.constructor = d; }
  40364. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40365. };
  40366. })();
  40367. var connection_Connection = (function (_super) {
  40368. connection_extends(Connection, _super);
  40369. function Connection(id, transport) {
  40370. var _this = _super.call(this) || this;
  40371. _this.id = id;
  40372. _this.transport = transport;
  40373. _this.activityTimeout = transport.activityTimeout;
  40374. _this.bindListeners();
  40375. return _this;
  40376. }
  40377. Connection.prototype.handlesActivityChecks = function () {
  40378. return this.transport.handlesActivityChecks();
  40379. };
  40380. Connection.prototype.send = function (data) {
  40381. return this.transport.send(data);
  40382. };
  40383. Connection.prototype.send_event = function (name, data, channel) {
  40384. var event = { event: name, data: data };
  40385. if (channel) {
  40386. event.channel = channel;
  40387. }
  40388. logger.debug('Event sent', event);
  40389. return this.send(protocol_protocol.encodeMessage(event));
  40390. };
  40391. Connection.prototype.ping = function () {
  40392. if (this.transport.supportsPing()) {
  40393. this.transport.ping();
  40394. }
  40395. else {
  40396. this.send_event('pusher:ping', {});
  40397. }
  40398. };
  40399. Connection.prototype.close = function () {
  40400. this.transport.close();
  40401. };
  40402. Connection.prototype.bindListeners = function () {
  40403. var _this = this;
  40404. var listeners = {
  40405. message: function (messageEvent) {
  40406. var pusherEvent;
  40407. try {
  40408. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40409. }
  40410. catch (e) {
  40411. _this.emit('error', {
  40412. type: 'MessageParseError',
  40413. error: e,
  40414. data: messageEvent.data
  40415. });
  40416. }
  40417. if (pusherEvent !== undefined) {
  40418. logger.debug('Event recd', pusherEvent);
  40419. switch (pusherEvent.event) {
  40420. case 'pusher:error':
  40421. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40422. break;
  40423. case 'pusher:ping':
  40424. _this.emit("ping");
  40425. break;
  40426. case 'pusher:pong':
  40427. _this.emit("pong");
  40428. break;
  40429. }
  40430. _this.emit('message', pusherEvent);
  40431. }
  40432. },
  40433. activity: function () {
  40434. _this.emit("activity");
  40435. },
  40436. error: function (error) {
  40437. _this.emit("error", { type: "WebSocketError", error: error });
  40438. },
  40439. closed: function (closeEvent) {
  40440. unbindListeners();
  40441. if (closeEvent && closeEvent.code) {
  40442. _this.handleCloseEvent(closeEvent);
  40443. }
  40444. _this.transport = null;
  40445. _this.emit("closed");
  40446. }
  40447. };
  40448. var unbindListeners = function () {
  40449. objectApply(listeners, function (listener, event) {
  40450. _this.transport.unbind(event, listener);
  40451. });
  40452. };
  40453. objectApply(listeners, function (listener, event) {
  40454. _this.transport.bind(event, listener);
  40455. });
  40456. };
  40457. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40458. var action = protocol_protocol.getCloseAction(closeEvent);
  40459. var error = protocol_protocol.getCloseError(closeEvent);
  40460. if (error) {
  40461. this.emit('error', error);
  40462. }
  40463. if (action) {
  40464. this.emit(action, { action: action, error: error });
  40465. }
  40466. };
  40467. return Connection;
  40468. }(dispatcher));
  40469. /* harmony default export */ var connection_connection = (connection_Connection);
  40470. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40471. var handshake_Handshake = (function () {
  40472. function Handshake(transport, callback) {
  40473. this.transport = transport;
  40474. this.callback = callback;
  40475. this.bindListeners();
  40476. }
  40477. Handshake.prototype.close = function () {
  40478. this.unbindListeners();
  40479. this.transport.close();
  40480. };
  40481. Handshake.prototype.bindListeners = function () {
  40482. var _this = this;
  40483. this.onMessage = function (m) {
  40484. _this.unbindListeners();
  40485. var result;
  40486. try {
  40487. result = protocol_protocol.processHandshake(m);
  40488. }
  40489. catch (e) {
  40490. _this.finish("error", { error: e });
  40491. _this.transport.close();
  40492. return;
  40493. }
  40494. if (result.action === "connected") {
  40495. _this.finish("connected", {
  40496. connection: new connection_connection(result.id, _this.transport),
  40497. activityTimeout: result.activityTimeout
  40498. });
  40499. }
  40500. else {
  40501. _this.finish(result.action, { error: result.error });
  40502. _this.transport.close();
  40503. }
  40504. };
  40505. this.onClosed = function (closeEvent) {
  40506. _this.unbindListeners();
  40507. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40508. var error = protocol_protocol.getCloseError(closeEvent);
  40509. _this.finish(action, { error: error });
  40510. };
  40511. this.transport.bind("message", this.onMessage);
  40512. this.transport.bind("closed", this.onClosed);
  40513. };
  40514. Handshake.prototype.unbindListeners = function () {
  40515. this.transport.unbind("message", this.onMessage);
  40516. this.transport.unbind("closed", this.onClosed);
  40517. };
  40518. Handshake.prototype.finish = function (action, params) {
  40519. this.callback(extend({ transport: this.transport, action: action }, params));
  40520. };
  40521. return Handshake;
  40522. }());
  40523. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40524. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40525. var pusher_authorizer_PusherAuthorizer = (function () {
  40526. function PusherAuthorizer(channel, options) {
  40527. this.channel = channel;
  40528. var authTransport = options.authTransport;
  40529. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40530. throw "'" + authTransport + "' is not a recognized auth transport";
  40531. }
  40532. this.type = authTransport;
  40533. this.options = options;
  40534. this.authOptions = (options || {}).auth || {};
  40535. }
  40536. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40537. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40538. '&channel_name=' + encodeURIComponent(this.channel.name);
  40539. for (var i in this.authOptions.params) {
  40540. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40541. }
  40542. return query;
  40543. };
  40544. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40545. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40546. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40547. };
  40548. return PusherAuthorizer;
  40549. }());
  40550. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40551. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40552. var timeline_sender_TimelineSender = (function () {
  40553. function TimelineSender(timeline, options) {
  40554. this.timeline = timeline;
  40555. this.options = options || {};
  40556. }
  40557. TimelineSender.prototype.send = function (useTLS, callback) {
  40558. if (this.timeline.isEmpty()) {
  40559. return;
  40560. }
  40561. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40562. };
  40563. return TimelineSender;
  40564. }());
  40565. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40566. // CONCATENATED MODULE: ./src/core/errors.ts
  40567. var errors_extends = (undefined && undefined.__extends) || (function () {
  40568. var extendStatics = function (d, b) {
  40569. extendStatics = Object.setPrototypeOf ||
  40570. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40571. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40572. return extendStatics(d, b);
  40573. };
  40574. return function (d, b) {
  40575. extendStatics(d, b);
  40576. function __() { this.constructor = d; }
  40577. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40578. };
  40579. })();
  40580. var BadEventName = (function (_super) {
  40581. errors_extends(BadEventName, _super);
  40582. function BadEventName(msg) {
  40583. var _newTarget = this.constructor;
  40584. var _this = _super.call(this, msg) || this;
  40585. Object.setPrototypeOf(_this, _newTarget.prototype);
  40586. return _this;
  40587. }
  40588. return BadEventName;
  40589. }(Error));
  40590. var RequestTimedOut = (function (_super) {
  40591. errors_extends(RequestTimedOut, _super);
  40592. function RequestTimedOut(msg) {
  40593. var _newTarget = this.constructor;
  40594. var _this = _super.call(this, msg) || this;
  40595. Object.setPrototypeOf(_this, _newTarget.prototype);
  40596. return _this;
  40597. }
  40598. return RequestTimedOut;
  40599. }(Error));
  40600. var TransportPriorityTooLow = (function (_super) {
  40601. errors_extends(TransportPriorityTooLow, _super);
  40602. function TransportPriorityTooLow(msg) {
  40603. var _newTarget = this.constructor;
  40604. var _this = _super.call(this, msg) || this;
  40605. Object.setPrototypeOf(_this, _newTarget.prototype);
  40606. return _this;
  40607. }
  40608. return TransportPriorityTooLow;
  40609. }(Error));
  40610. var TransportClosed = (function (_super) {
  40611. errors_extends(TransportClosed, _super);
  40612. function TransportClosed(msg) {
  40613. var _newTarget = this.constructor;
  40614. var _this = _super.call(this, msg) || this;
  40615. Object.setPrototypeOf(_this, _newTarget.prototype);
  40616. return _this;
  40617. }
  40618. return TransportClosed;
  40619. }(Error));
  40620. var UnsupportedFeature = (function (_super) {
  40621. errors_extends(UnsupportedFeature, _super);
  40622. function UnsupportedFeature(msg) {
  40623. var _newTarget = this.constructor;
  40624. var _this = _super.call(this, msg) || this;
  40625. Object.setPrototypeOf(_this, _newTarget.prototype);
  40626. return _this;
  40627. }
  40628. return UnsupportedFeature;
  40629. }(Error));
  40630. var UnsupportedTransport = (function (_super) {
  40631. errors_extends(UnsupportedTransport, _super);
  40632. function UnsupportedTransport(msg) {
  40633. var _newTarget = this.constructor;
  40634. var _this = _super.call(this, msg) || this;
  40635. Object.setPrototypeOf(_this, _newTarget.prototype);
  40636. return _this;
  40637. }
  40638. return UnsupportedTransport;
  40639. }(Error));
  40640. var UnsupportedStrategy = (function (_super) {
  40641. errors_extends(UnsupportedStrategy, _super);
  40642. function UnsupportedStrategy(msg) {
  40643. var _newTarget = this.constructor;
  40644. var _this = _super.call(this, msg) || this;
  40645. Object.setPrototypeOf(_this, _newTarget.prototype);
  40646. return _this;
  40647. }
  40648. return UnsupportedStrategy;
  40649. }(Error));
  40650. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40651. var channel_extends = (undefined && undefined.__extends) || (function () {
  40652. var extendStatics = function (d, b) {
  40653. extendStatics = Object.setPrototypeOf ||
  40654. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40655. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40656. return extendStatics(d, b);
  40657. };
  40658. return function (d, b) {
  40659. extendStatics(d, b);
  40660. function __() { this.constructor = d; }
  40661. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40662. };
  40663. })();
  40664. var channel_Channel = (function (_super) {
  40665. channel_extends(Channel, _super);
  40666. function Channel(name, pusher) {
  40667. var _this = _super.call(this, function (event, data) {
  40668. logger.debug('No callbacks on ' + name + ' for ' + event);
  40669. }) || this;
  40670. _this.name = name;
  40671. _this.pusher = pusher;
  40672. _this.subscribed = false;
  40673. _this.subscriptionPending = false;
  40674. _this.subscriptionCancelled = false;
  40675. return _this;
  40676. }
  40677. Channel.prototype.authorize = function (socketId, callback) {
  40678. return callback(false, {});
  40679. };
  40680. Channel.prototype.trigger = function (event, data) {
  40681. if (event.indexOf("client-") !== 0) {
  40682. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40683. }
  40684. if (!this.subscribed) {
  40685. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40686. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40687. }
  40688. return this.pusher.send_event(event, data, this.name);
  40689. };
  40690. Channel.prototype.disconnect = function () {
  40691. this.subscribed = false;
  40692. this.subscriptionPending = false;
  40693. };
  40694. Channel.prototype.handleEvent = function (event) {
  40695. var eventName = event.event;
  40696. var data = event.data;
  40697. if (eventName === "pusher_internal:subscription_succeeded") {
  40698. this.handleSubscriptionSucceededEvent(event);
  40699. }
  40700. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40701. var metadata = {};
  40702. this.emit(eventName, data, metadata);
  40703. }
  40704. };
  40705. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40706. this.subscriptionPending = false;
  40707. this.subscribed = true;
  40708. if (this.subscriptionCancelled) {
  40709. this.pusher.unsubscribe(this.name);
  40710. }
  40711. else {
  40712. this.emit("pusher:subscription_succeeded", event.data);
  40713. }
  40714. };
  40715. Channel.prototype.subscribe = function () {
  40716. var _this = this;
  40717. if (this.subscribed) {
  40718. return;
  40719. }
  40720. this.subscriptionPending = true;
  40721. this.subscriptionCancelled = false;
  40722. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40723. if (error) {
  40724. logger.error(data);
  40725. _this.emit('pusher:subscription_error', data);
  40726. }
  40727. else {
  40728. _this.pusher.send_event('pusher:subscribe', {
  40729. auth: data.auth,
  40730. channel_data: data.channel_data,
  40731. channel: _this.name
  40732. });
  40733. }
  40734. });
  40735. };
  40736. Channel.prototype.unsubscribe = function () {
  40737. this.subscribed = false;
  40738. this.pusher.send_event('pusher:unsubscribe', {
  40739. channel: this.name
  40740. });
  40741. };
  40742. Channel.prototype.cancelSubscription = function () {
  40743. this.subscriptionCancelled = true;
  40744. };
  40745. Channel.prototype.reinstateSubscription = function () {
  40746. this.subscriptionCancelled = false;
  40747. };
  40748. return Channel;
  40749. }(dispatcher));
  40750. /* harmony default export */ var channels_channel = (channel_Channel);
  40751. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40752. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40753. var extendStatics = function (d, b) {
  40754. extendStatics = Object.setPrototypeOf ||
  40755. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40756. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40757. return extendStatics(d, b);
  40758. };
  40759. return function (d, b) {
  40760. extendStatics(d, b);
  40761. function __() { this.constructor = d; }
  40762. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40763. };
  40764. })();
  40765. var private_channel_PrivateChannel = (function (_super) {
  40766. private_channel_extends(PrivateChannel, _super);
  40767. function PrivateChannel() {
  40768. return _super !== null && _super.apply(this, arguments) || this;
  40769. }
  40770. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40771. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40772. return authorizer.authorize(socketId, callback);
  40773. };
  40774. return PrivateChannel;
  40775. }(channels_channel));
  40776. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40777. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40778. var members_Members = (function () {
  40779. function Members() {
  40780. this.reset();
  40781. }
  40782. Members.prototype.get = function (id) {
  40783. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40784. return {
  40785. id: id,
  40786. info: this.members[id]
  40787. };
  40788. }
  40789. else {
  40790. return null;
  40791. }
  40792. };
  40793. Members.prototype.each = function (callback) {
  40794. var _this = this;
  40795. objectApply(this.members, function (member, id) {
  40796. callback(_this.get(id));
  40797. });
  40798. };
  40799. Members.prototype.setMyID = function (id) {
  40800. this.myID = id;
  40801. };
  40802. Members.prototype.onSubscription = function (subscriptionData) {
  40803. this.members = subscriptionData.presence.hash;
  40804. this.count = subscriptionData.presence.count;
  40805. this.me = this.get(this.myID);
  40806. };
  40807. Members.prototype.addMember = function (memberData) {
  40808. if (this.get(memberData.user_id) === null) {
  40809. this.count++;
  40810. }
  40811. this.members[memberData.user_id] = memberData.user_info;
  40812. return this.get(memberData.user_id);
  40813. };
  40814. Members.prototype.removeMember = function (memberData) {
  40815. var member = this.get(memberData.user_id);
  40816. if (member) {
  40817. delete this.members[memberData.user_id];
  40818. this.count--;
  40819. }
  40820. return member;
  40821. };
  40822. Members.prototype.reset = function () {
  40823. this.members = {};
  40824. this.count = 0;
  40825. this.myID = null;
  40826. this.me = null;
  40827. };
  40828. return Members;
  40829. }());
  40830. /* harmony default export */ var members = (members_Members);
  40831. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40832. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40833. var extendStatics = function (d, b) {
  40834. extendStatics = Object.setPrototypeOf ||
  40835. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40836. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40837. return extendStatics(d, b);
  40838. };
  40839. return function (d, b) {
  40840. extendStatics(d, b);
  40841. function __() { this.constructor = d; }
  40842. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40843. };
  40844. })();
  40845. var presence_channel_PresenceChannel = (function (_super) {
  40846. presence_channel_extends(PresenceChannel, _super);
  40847. function PresenceChannel(name, pusher) {
  40848. var _this = _super.call(this, name, pusher) || this;
  40849. _this.members = new members();
  40850. return _this;
  40851. }
  40852. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40853. var _this = this;
  40854. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40855. if (!error) {
  40856. if (authData.channel_data === undefined) {
  40857. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40858. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40859. ("expected 'channel_data' field. " + suffix));
  40860. callback("Invalid auth response");
  40861. return;
  40862. }
  40863. var channelData = JSON.parse(authData.channel_data);
  40864. _this.members.setMyID(channelData.user_id);
  40865. }
  40866. callback(error, authData);
  40867. });
  40868. };
  40869. PresenceChannel.prototype.handleEvent = function (event) {
  40870. var eventName = event.event;
  40871. if (eventName.indexOf("pusher_internal:") === 0) {
  40872. this.handleInternalEvent(event);
  40873. }
  40874. else {
  40875. var data = event.data;
  40876. var metadata = {};
  40877. if (event.user_id) {
  40878. metadata.user_id = event.user_id;
  40879. }
  40880. this.emit(eventName, data, metadata);
  40881. }
  40882. };
  40883. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40884. var eventName = event.event;
  40885. var data = event.data;
  40886. switch (eventName) {
  40887. case "pusher_internal:subscription_succeeded":
  40888. this.handleSubscriptionSucceededEvent(event);
  40889. break;
  40890. case "pusher_internal:member_added":
  40891. var addedMember = this.members.addMember(data);
  40892. this.emit('pusher:member_added', addedMember);
  40893. break;
  40894. case "pusher_internal:member_removed":
  40895. var removedMember = this.members.removeMember(data);
  40896. if (removedMember) {
  40897. this.emit('pusher:member_removed', removedMember);
  40898. }
  40899. break;
  40900. }
  40901. };
  40902. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40903. this.subscriptionPending = false;
  40904. this.subscribed = true;
  40905. if (this.subscriptionCancelled) {
  40906. this.pusher.unsubscribe(this.name);
  40907. }
  40908. else {
  40909. this.members.onSubscription(event.data);
  40910. this.emit("pusher:subscription_succeeded", this.members);
  40911. }
  40912. };
  40913. PresenceChannel.prototype.disconnect = function () {
  40914. this.members.reset();
  40915. _super.prototype.disconnect.call(this);
  40916. };
  40917. return PresenceChannel;
  40918. }(private_channel));
  40919. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  40920. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  40921. var nacl_fast = __webpack_require__(0);
  40922. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  40923. var nacl_util = __webpack_require__(1);
  40924. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  40925. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  40926. var extendStatics = function (d, b) {
  40927. extendStatics = Object.setPrototypeOf ||
  40928. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40929. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40930. return extendStatics(d, b);
  40931. };
  40932. return function (d, b) {
  40933. extendStatics(d, b);
  40934. function __() { this.constructor = d; }
  40935. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40936. };
  40937. })();
  40938. var encrypted_channel_EncryptedChannel = (function (_super) {
  40939. encrypted_channel_extends(EncryptedChannel, _super);
  40940. function EncryptedChannel() {
  40941. var _this = _super !== null && _super.apply(this, arguments) || this;
  40942. _this.key = null;
  40943. return _this;
  40944. }
  40945. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  40946. var _this = this;
  40947. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40948. if (error) {
  40949. callback(true, authData);
  40950. return;
  40951. }
  40952. var sharedSecret = authData["shared_secret"];
  40953. if (!sharedSecret) {
  40954. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  40955. callback(true, errorMsg);
  40956. return;
  40957. }
  40958. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  40959. delete authData["shared_secret"];
  40960. callback(false, authData);
  40961. });
  40962. };
  40963. EncryptedChannel.prototype.trigger = function (event, data) {
  40964. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  40965. };
  40966. EncryptedChannel.prototype.handleEvent = function (event) {
  40967. var eventName = event.event;
  40968. var data = event.data;
  40969. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  40970. _super.prototype.handleEvent.call(this, event);
  40971. return;
  40972. }
  40973. this.handleEncryptedEvent(eventName, data);
  40974. };
  40975. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  40976. var _this = this;
  40977. if (!this.key) {
  40978. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  40979. return;
  40980. }
  40981. if (!data.ciphertext || !data.nonce) {
  40982. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  40983. return;
  40984. }
  40985. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  40986. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  40987. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  40988. return;
  40989. }
  40990. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  40991. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  40992. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  40993. return;
  40994. }
  40995. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  40996. if (bytes === null) {
  40997. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  40998. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  40999. if (error) {
  41000. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41001. return;
  41002. }
  41003. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41004. if (bytes === null) {
  41005. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41006. return;
  41007. }
  41008. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41009. return;
  41010. });
  41011. return;
  41012. }
  41013. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41014. };
  41015. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41016. try {
  41017. this.emit(eventName, JSON.parse(data));
  41018. }
  41019. catch (e) {
  41020. this.emit(eventName, data);
  41021. }
  41022. return this;
  41023. };
  41024. return EncryptedChannel;
  41025. }(private_channel));
  41026. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41027. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41028. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41029. var extendStatics = function (d, b) {
  41030. extendStatics = Object.setPrototypeOf ||
  41031. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41032. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41033. return extendStatics(d, b);
  41034. };
  41035. return function (d, b) {
  41036. extendStatics(d, b);
  41037. function __() { this.constructor = d; }
  41038. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41039. };
  41040. })();
  41041. var connection_manager_ConnectionManager = (function (_super) {
  41042. connection_manager_extends(ConnectionManager, _super);
  41043. function ConnectionManager(key, options) {
  41044. var _this = _super.call(this) || this;
  41045. _this.key = key;
  41046. _this.options = options || {};
  41047. _this.state = "initialized";
  41048. _this.connection = null;
  41049. _this.usingTLS = !!options.useTLS;
  41050. _this.timeline = _this.options.timeline;
  41051. _this.errorCallbacks = _this.buildErrorCallbacks();
  41052. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41053. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41054. var Network = runtime.getNetwork();
  41055. Network.bind("online", function () {
  41056. _this.timeline.info({ netinfo: "online" });
  41057. if (_this.state === "connecting" || _this.state === "unavailable") {
  41058. _this.retryIn(0);
  41059. }
  41060. });
  41061. Network.bind("offline", function () {
  41062. _this.timeline.info({ netinfo: "offline" });
  41063. if (_this.connection) {
  41064. _this.sendActivityCheck();
  41065. }
  41066. });
  41067. _this.updateStrategy();
  41068. return _this;
  41069. }
  41070. ConnectionManager.prototype.connect = function () {
  41071. if (this.connection || this.runner) {
  41072. return;
  41073. }
  41074. if (!this.strategy.isSupported()) {
  41075. this.updateState("failed");
  41076. return;
  41077. }
  41078. this.updateState("connecting");
  41079. this.startConnecting();
  41080. this.setUnavailableTimer();
  41081. };
  41082. ;
  41083. ConnectionManager.prototype.send = function (data) {
  41084. if (this.connection) {
  41085. return this.connection.send(data);
  41086. }
  41087. else {
  41088. return false;
  41089. }
  41090. };
  41091. ;
  41092. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41093. if (this.connection) {
  41094. return this.connection.send_event(name, data, channel);
  41095. }
  41096. else {
  41097. return false;
  41098. }
  41099. };
  41100. ;
  41101. ConnectionManager.prototype.disconnect = function () {
  41102. this.disconnectInternally();
  41103. this.updateState("disconnected");
  41104. };
  41105. ;
  41106. ConnectionManager.prototype.isUsingTLS = function () {
  41107. return this.usingTLS;
  41108. };
  41109. ;
  41110. ConnectionManager.prototype.startConnecting = function () {
  41111. var _this = this;
  41112. var callback = function (error, handshake) {
  41113. if (error) {
  41114. _this.runner = _this.strategy.connect(0, callback);
  41115. }
  41116. else {
  41117. if (handshake.action === "error") {
  41118. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41119. _this.timeline.error({ handshakeError: handshake.error });
  41120. }
  41121. else {
  41122. _this.abortConnecting();
  41123. _this.handshakeCallbacks[handshake.action](handshake);
  41124. }
  41125. }
  41126. };
  41127. this.runner = this.strategy.connect(0, callback);
  41128. };
  41129. ;
  41130. ConnectionManager.prototype.abortConnecting = function () {
  41131. if (this.runner) {
  41132. this.runner.abort();
  41133. this.runner = null;
  41134. }
  41135. };
  41136. ;
  41137. ConnectionManager.prototype.disconnectInternally = function () {
  41138. this.abortConnecting();
  41139. this.clearRetryTimer();
  41140. this.clearUnavailableTimer();
  41141. if (this.connection) {
  41142. var connection = this.abandonConnection();
  41143. connection.close();
  41144. }
  41145. };
  41146. ;
  41147. ConnectionManager.prototype.updateStrategy = function () {
  41148. this.strategy = this.options.getStrategy({
  41149. key: this.key,
  41150. timeline: this.timeline,
  41151. useTLS: this.usingTLS
  41152. });
  41153. };
  41154. ;
  41155. ConnectionManager.prototype.retryIn = function (delay) {
  41156. var _this = this;
  41157. this.timeline.info({ action: "retry", delay: delay });
  41158. if (delay > 0) {
  41159. this.emit("connecting_in", Math.round(delay / 1000));
  41160. }
  41161. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41162. _this.disconnectInternally();
  41163. _this.connect();
  41164. });
  41165. };
  41166. ;
  41167. ConnectionManager.prototype.clearRetryTimer = function () {
  41168. if (this.retryTimer) {
  41169. this.retryTimer.ensureAborted();
  41170. this.retryTimer = null;
  41171. }
  41172. };
  41173. ;
  41174. ConnectionManager.prototype.setUnavailableTimer = function () {
  41175. var _this = this;
  41176. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41177. _this.updateState("unavailable");
  41178. });
  41179. };
  41180. ;
  41181. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41182. if (this.unavailableTimer) {
  41183. this.unavailableTimer.ensureAborted();
  41184. }
  41185. };
  41186. ;
  41187. ConnectionManager.prototype.sendActivityCheck = function () {
  41188. var _this = this;
  41189. this.stopActivityCheck();
  41190. this.connection.ping();
  41191. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41192. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41193. _this.retryIn(0);
  41194. });
  41195. };
  41196. ;
  41197. ConnectionManager.prototype.resetActivityCheck = function () {
  41198. var _this = this;
  41199. this.stopActivityCheck();
  41200. if (this.connection && !this.connection.handlesActivityChecks()) {
  41201. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41202. _this.sendActivityCheck();
  41203. });
  41204. }
  41205. };
  41206. ;
  41207. ConnectionManager.prototype.stopActivityCheck = function () {
  41208. if (this.activityTimer) {
  41209. this.activityTimer.ensureAborted();
  41210. }
  41211. };
  41212. ;
  41213. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41214. var _this = this;
  41215. return extend({}, errorCallbacks, {
  41216. message: function (message) {
  41217. _this.resetActivityCheck();
  41218. _this.emit('message', message);
  41219. },
  41220. ping: function () {
  41221. _this.send_event('pusher:pong', {});
  41222. },
  41223. activity: function () {
  41224. _this.resetActivityCheck();
  41225. },
  41226. error: function (error) {
  41227. _this.emit("error", { type: "WebSocketError", error: error });
  41228. },
  41229. closed: function () {
  41230. _this.abandonConnection();
  41231. if (_this.shouldRetry()) {
  41232. _this.retryIn(1000);
  41233. }
  41234. }
  41235. });
  41236. };
  41237. ;
  41238. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41239. var _this = this;
  41240. return extend({}, errorCallbacks, {
  41241. connected: function (handshake) {
  41242. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41243. _this.clearUnavailableTimer();
  41244. _this.setConnection(handshake.connection);
  41245. _this.socket_id = _this.connection.id;
  41246. _this.updateState("connected", { socket_id: _this.socket_id });
  41247. }
  41248. });
  41249. };
  41250. ;
  41251. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41252. var _this = this;
  41253. var withErrorEmitted = function (callback) {
  41254. return function (result) {
  41255. if (result.error) {
  41256. _this.emit("error", { type: "WebSocketError", error: result.error });
  41257. }
  41258. callback(result);
  41259. };
  41260. };
  41261. return {
  41262. tls_only: withErrorEmitted(function () {
  41263. _this.usingTLS = true;
  41264. _this.updateStrategy();
  41265. _this.retryIn(0);
  41266. }),
  41267. refused: withErrorEmitted(function () {
  41268. _this.disconnect();
  41269. }),
  41270. backoff: withErrorEmitted(function () {
  41271. _this.retryIn(1000);
  41272. }),
  41273. retry: withErrorEmitted(function () {
  41274. _this.retryIn(0);
  41275. })
  41276. };
  41277. };
  41278. ;
  41279. ConnectionManager.prototype.setConnection = function (connection) {
  41280. this.connection = connection;
  41281. for (var event in this.connectionCallbacks) {
  41282. this.connection.bind(event, this.connectionCallbacks[event]);
  41283. }
  41284. this.resetActivityCheck();
  41285. };
  41286. ;
  41287. ConnectionManager.prototype.abandonConnection = function () {
  41288. if (!this.connection) {
  41289. return;
  41290. }
  41291. this.stopActivityCheck();
  41292. for (var event in this.connectionCallbacks) {
  41293. this.connection.unbind(event, this.connectionCallbacks[event]);
  41294. }
  41295. var connection = this.connection;
  41296. this.connection = null;
  41297. return connection;
  41298. };
  41299. ConnectionManager.prototype.updateState = function (newState, data) {
  41300. var previousState = this.state;
  41301. this.state = newState;
  41302. if (previousState !== newState) {
  41303. var newStateDescription = newState;
  41304. if (newStateDescription === "connected") {
  41305. newStateDescription += " with new socket ID " + data.socket_id;
  41306. }
  41307. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41308. this.timeline.info({ state: newState, params: data });
  41309. this.emit('state_change', { previous: previousState, current: newState });
  41310. this.emit(newState, data);
  41311. }
  41312. };
  41313. ConnectionManager.prototype.shouldRetry = function () {
  41314. return this.state === "connecting" || this.state === "connected";
  41315. };
  41316. return ConnectionManager;
  41317. }(dispatcher));
  41318. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41319. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41320. var channels_Channels = (function () {
  41321. function Channels() {
  41322. this.channels = {};
  41323. }
  41324. Channels.prototype.add = function (name, pusher) {
  41325. if (!this.channels[name]) {
  41326. this.channels[name] = createChannel(name, pusher);
  41327. }
  41328. return this.channels[name];
  41329. };
  41330. Channels.prototype.all = function () {
  41331. return values(this.channels);
  41332. };
  41333. Channels.prototype.find = function (name) {
  41334. return this.channels[name];
  41335. };
  41336. Channels.prototype.remove = function (name) {
  41337. var channel = this.channels[name];
  41338. delete this.channels[name];
  41339. return channel;
  41340. };
  41341. Channels.prototype.disconnect = function () {
  41342. objectApply(this.channels, function (channel) {
  41343. channel.disconnect();
  41344. });
  41345. };
  41346. return Channels;
  41347. }());
  41348. /* harmony default export */ var channels = (channels_Channels);
  41349. function createChannel(name, pusher) {
  41350. if (name.indexOf('private-encrypted-') === 0) {
  41351. if (false) { var errorMsg; }
  41352. return factory.createEncryptedChannel(name, pusher);
  41353. }
  41354. else if (name.indexOf('private-') === 0) {
  41355. return factory.createPrivateChannel(name, pusher);
  41356. }
  41357. else if (name.indexOf('presence-') === 0) {
  41358. return factory.createPresenceChannel(name, pusher);
  41359. }
  41360. else {
  41361. return factory.createChannel(name, pusher);
  41362. }
  41363. }
  41364. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41365. var Factory = {
  41366. createChannels: function () {
  41367. return new channels();
  41368. },
  41369. createConnectionManager: function (key, options) {
  41370. return new connection_manager(key, options);
  41371. },
  41372. createChannel: function (name, pusher) {
  41373. return new channels_channel(name, pusher);
  41374. },
  41375. createPrivateChannel: function (name, pusher) {
  41376. return new private_channel(name, pusher);
  41377. },
  41378. createPresenceChannel: function (name, pusher) {
  41379. return new presence_channel(name, pusher);
  41380. },
  41381. createEncryptedChannel: function (name, pusher) {
  41382. return new encrypted_channel(name, pusher);
  41383. },
  41384. createTimelineSender: function (timeline, options) {
  41385. return new timeline_sender(timeline, options);
  41386. },
  41387. createAuthorizer: function (channel, options) {
  41388. if (options.authorizer) {
  41389. return options.authorizer(channel, options);
  41390. }
  41391. return new pusher_authorizer(channel, options);
  41392. },
  41393. createHandshake: function (transport, callback) {
  41394. return new connection_handshake(transport, callback);
  41395. },
  41396. createAssistantToTheTransportManager: function (manager, transport, options) {
  41397. return new assistant_to_the_transport_manager(manager, transport, options);
  41398. }
  41399. };
  41400. /* harmony default export */ var factory = (Factory);
  41401. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41402. var transport_manager_TransportManager = (function () {
  41403. function TransportManager(options) {
  41404. this.options = options || {};
  41405. this.livesLeft = this.options.lives || Infinity;
  41406. }
  41407. TransportManager.prototype.getAssistant = function (transport) {
  41408. return factory.createAssistantToTheTransportManager(this, transport, {
  41409. minPingDelay: this.options.minPingDelay,
  41410. maxPingDelay: this.options.maxPingDelay
  41411. });
  41412. };
  41413. TransportManager.prototype.isAlive = function () {
  41414. return this.livesLeft > 0;
  41415. };
  41416. TransportManager.prototype.reportDeath = function () {
  41417. this.livesLeft -= 1;
  41418. };
  41419. return TransportManager;
  41420. }());
  41421. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41422. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41423. var sequential_strategy_SequentialStrategy = (function () {
  41424. function SequentialStrategy(strategies, options) {
  41425. this.strategies = strategies;
  41426. this.loop = Boolean(options.loop);
  41427. this.failFast = Boolean(options.failFast);
  41428. this.timeout = options.timeout;
  41429. this.timeoutLimit = options.timeoutLimit;
  41430. }
  41431. SequentialStrategy.prototype.isSupported = function () {
  41432. return any(this.strategies, util.method("isSupported"));
  41433. };
  41434. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41435. var _this = this;
  41436. var strategies = this.strategies;
  41437. var current = 0;
  41438. var timeout = this.timeout;
  41439. var runner = null;
  41440. var tryNextStrategy = function (error, handshake) {
  41441. if (handshake) {
  41442. callback(null, handshake);
  41443. }
  41444. else {
  41445. current = current + 1;
  41446. if (_this.loop) {
  41447. current = current % strategies.length;
  41448. }
  41449. if (current < strategies.length) {
  41450. if (timeout) {
  41451. timeout = timeout * 2;
  41452. if (_this.timeoutLimit) {
  41453. timeout = Math.min(timeout, _this.timeoutLimit);
  41454. }
  41455. }
  41456. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41457. }
  41458. else {
  41459. callback(true);
  41460. }
  41461. }
  41462. };
  41463. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41464. return {
  41465. abort: function () {
  41466. runner.abort();
  41467. },
  41468. forceMinPriority: function (p) {
  41469. minPriority = p;
  41470. if (runner) {
  41471. runner.forceMinPriority(p);
  41472. }
  41473. }
  41474. };
  41475. };
  41476. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41477. var timer = null;
  41478. var runner = null;
  41479. if (options.timeout > 0) {
  41480. timer = new OneOffTimer(options.timeout, function () {
  41481. runner.abort();
  41482. callback(true);
  41483. });
  41484. }
  41485. runner = strategy.connect(minPriority, function (error, handshake) {
  41486. if (error && timer && timer.isRunning() && !options.failFast) {
  41487. return;
  41488. }
  41489. if (timer) {
  41490. timer.ensureAborted();
  41491. }
  41492. callback(error, handshake);
  41493. });
  41494. return {
  41495. abort: function () {
  41496. if (timer) {
  41497. timer.ensureAborted();
  41498. }
  41499. runner.abort();
  41500. },
  41501. forceMinPriority: function (p) {
  41502. runner.forceMinPriority(p);
  41503. }
  41504. };
  41505. };
  41506. return SequentialStrategy;
  41507. }());
  41508. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41509. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41510. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41511. function BestConnectedEverStrategy(strategies) {
  41512. this.strategies = strategies;
  41513. }
  41514. BestConnectedEverStrategy.prototype.isSupported = function () {
  41515. return any(this.strategies, util.method("isSupported"));
  41516. };
  41517. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41518. return connect(this.strategies, minPriority, function (i, runners) {
  41519. return function (error, handshake) {
  41520. runners[i].error = error;
  41521. if (error) {
  41522. if (allRunnersFailed(runners)) {
  41523. callback(true);
  41524. }
  41525. return;
  41526. }
  41527. apply(runners, function (runner) {
  41528. runner.forceMinPriority(handshake.transport.priority);
  41529. });
  41530. callback(null, handshake);
  41531. };
  41532. });
  41533. };
  41534. return BestConnectedEverStrategy;
  41535. }());
  41536. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41537. function connect(strategies, minPriority, callbackBuilder) {
  41538. var runners = map(strategies, function (strategy, i, _, rs) {
  41539. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41540. });
  41541. return {
  41542. abort: function () {
  41543. apply(runners, abortRunner);
  41544. },
  41545. forceMinPriority: function (p) {
  41546. apply(runners, function (runner) {
  41547. runner.forceMinPriority(p);
  41548. });
  41549. }
  41550. };
  41551. }
  41552. function allRunnersFailed(runners) {
  41553. return collections_all(runners, function (runner) {
  41554. return Boolean(runner.error);
  41555. });
  41556. }
  41557. function abortRunner(runner) {
  41558. if (!runner.error && !runner.aborted) {
  41559. runner.abort();
  41560. runner.aborted = true;
  41561. }
  41562. }
  41563. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41564. var cached_strategy_CachedStrategy = (function () {
  41565. function CachedStrategy(strategy, transports, options) {
  41566. this.strategy = strategy;
  41567. this.transports = transports;
  41568. this.ttl = options.ttl || 1800 * 1000;
  41569. this.usingTLS = options.useTLS;
  41570. this.timeline = options.timeline;
  41571. }
  41572. CachedStrategy.prototype.isSupported = function () {
  41573. return this.strategy.isSupported();
  41574. };
  41575. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41576. var usingTLS = this.usingTLS;
  41577. var info = fetchTransportCache(usingTLS);
  41578. var strategies = [this.strategy];
  41579. if (info && info.timestamp + this.ttl >= util.now()) {
  41580. var transport = this.transports[info.transport];
  41581. if (transport) {
  41582. this.timeline.info({
  41583. cached: true,
  41584. transport: info.transport,
  41585. latency: info.latency
  41586. });
  41587. strategies.push(new sequential_strategy([transport], {
  41588. timeout: info.latency * 2 + 1000,
  41589. failFast: true
  41590. }));
  41591. }
  41592. }
  41593. var startTimestamp = util.now();
  41594. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41595. if (error) {
  41596. flushTransportCache(usingTLS);
  41597. if (strategies.length > 0) {
  41598. startTimestamp = util.now();
  41599. runner = strategies.pop().connect(minPriority, cb);
  41600. }
  41601. else {
  41602. callback(error);
  41603. }
  41604. }
  41605. else {
  41606. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41607. callback(null, handshake);
  41608. }
  41609. });
  41610. return {
  41611. abort: function () {
  41612. runner.abort();
  41613. },
  41614. forceMinPriority: function (p) {
  41615. minPriority = p;
  41616. if (runner) {
  41617. runner.forceMinPriority(p);
  41618. }
  41619. }
  41620. };
  41621. };
  41622. return CachedStrategy;
  41623. }());
  41624. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41625. function getTransportCacheKey(usingTLS) {
  41626. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41627. }
  41628. function fetchTransportCache(usingTLS) {
  41629. var storage = runtime.getLocalStorage();
  41630. if (storage) {
  41631. try {
  41632. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41633. if (serializedCache) {
  41634. return JSON.parse(serializedCache);
  41635. }
  41636. }
  41637. catch (e) {
  41638. flushTransportCache(usingTLS);
  41639. }
  41640. }
  41641. return null;
  41642. }
  41643. function storeTransportCache(usingTLS, transport, latency) {
  41644. var storage = runtime.getLocalStorage();
  41645. if (storage) {
  41646. try {
  41647. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41648. timestamp: util.now(),
  41649. transport: transport,
  41650. latency: latency
  41651. });
  41652. }
  41653. catch (e) {
  41654. }
  41655. }
  41656. }
  41657. function flushTransportCache(usingTLS) {
  41658. var storage = runtime.getLocalStorage();
  41659. if (storage) {
  41660. try {
  41661. delete storage[getTransportCacheKey(usingTLS)];
  41662. }
  41663. catch (e) {
  41664. }
  41665. }
  41666. }
  41667. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41668. var delayed_strategy_DelayedStrategy = (function () {
  41669. function DelayedStrategy(strategy, _a) {
  41670. var number = _a.delay;
  41671. this.strategy = strategy;
  41672. this.options = { delay: number };
  41673. }
  41674. DelayedStrategy.prototype.isSupported = function () {
  41675. return this.strategy.isSupported();
  41676. };
  41677. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41678. var strategy = this.strategy;
  41679. var runner;
  41680. var timer = new OneOffTimer(this.options.delay, function () {
  41681. runner = strategy.connect(minPriority, callback);
  41682. });
  41683. return {
  41684. abort: function () {
  41685. timer.ensureAborted();
  41686. if (runner) {
  41687. runner.abort();
  41688. }
  41689. },
  41690. forceMinPriority: function (p) {
  41691. minPriority = p;
  41692. if (runner) {
  41693. runner.forceMinPriority(p);
  41694. }
  41695. }
  41696. };
  41697. };
  41698. return DelayedStrategy;
  41699. }());
  41700. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41701. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41702. var IfStrategy = (function () {
  41703. function IfStrategy(test, trueBranch, falseBranch) {
  41704. this.test = test;
  41705. this.trueBranch = trueBranch;
  41706. this.falseBranch = falseBranch;
  41707. }
  41708. IfStrategy.prototype.isSupported = function () {
  41709. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41710. return branch.isSupported();
  41711. };
  41712. IfStrategy.prototype.connect = function (minPriority, callback) {
  41713. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41714. return branch.connect(minPriority, callback);
  41715. };
  41716. return IfStrategy;
  41717. }());
  41718. /* harmony default export */ var if_strategy = (IfStrategy);
  41719. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41720. var FirstConnectedStrategy = (function () {
  41721. function FirstConnectedStrategy(strategy) {
  41722. this.strategy = strategy;
  41723. }
  41724. FirstConnectedStrategy.prototype.isSupported = function () {
  41725. return this.strategy.isSupported();
  41726. };
  41727. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41728. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41729. if (handshake) {
  41730. runner.abort();
  41731. }
  41732. callback(error, handshake);
  41733. });
  41734. return runner;
  41735. };
  41736. return FirstConnectedStrategy;
  41737. }());
  41738. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41739. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41740. function testSupportsStrategy(strategy) {
  41741. return function () {
  41742. return strategy.isSupported();
  41743. };
  41744. }
  41745. var getDefaultStrategy = function (config, defineTransport) {
  41746. var definedTransports = {};
  41747. function defineTransportStrategy(name, type, priority, options, manager) {
  41748. var transport = defineTransport(config, name, type, priority, options, manager);
  41749. definedTransports[name] = transport;
  41750. return transport;
  41751. }
  41752. var ws_options = {
  41753. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41754. hostTLS: config.wsHost + ":" + config.wssPort,
  41755. httpPath: config.wsPath
  41756. };
  41757. var wss_options = extend({}, ws_options, {
  41758. useTLS: true
  41759. });
  41760. var sockjs_options = {
  41761. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41762. hostTLS: config.httpHost + ":" + config.httpsPort,
  41763. httpPath: config.httpPath
  41764. };
  41765. var timeouts = {
  41766. loop: true,
  41767. timeout: 15000,
  41768. timeoutLimit: 60000
  41769. };
  41770. var ws_manager = new transport_manager({
  41771. lives: 2,
  41772. minPingDelay: 10000,
  41773. maxPingDelay: config.activity_timeout
  41774. });
  41775. var streaming_manager = new transport_manager({
  41776. lives: 2,
  41777. minPingDelay: 10000,
  41778. maxPingDelay: config.activity_timeout
  41779. });
  41780. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41781. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41782. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41783. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41784. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41785. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41786. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41787. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41788. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41789. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41790. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41791. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41792. 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);
  41793. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41794. var wsStrategy;
  41795. if (config.useTLS) {
  41796. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41797. }
  41798. else {
  41799. wsStrategy = new best_connected_ever_strategy([
  41800. ws_loop,
  41801. new delayed_strategy(wss_loop, { delay: 2000 }),
  41802. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41803. ]);
  41804. }
  41805. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41806. ttl: 1800000,
  41807. timeline: config.timeline,
  41808. useTLS: config.useTLS
  41809. });
  41810. };
  41811. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41812. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41813. /* harmony default export */ var transport_connection_initializer = (function () {
  41814. var self = this;
  41815. self.timeline.info(self.buildTimelineMessage({
  41816. transport: self.name + (self.options.useTLS ? "s" : "")
  41817. }));
  41818. if (self.hooks.isInitialized()) {
  41819. self.changeState("initialized");
  41820. }
  41821. else if (self.hooks.file) {
  41822. self.changeState("initializing");
  41823. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41824. if (self.hooks.isInitialized()) {
  41825. self.changeState("initialized");
  41826. callback(true);
  41827. }
  41828. else {
  41829. if (error) {
  41830. self.onError(error);
  41831. }
  41832. self.onClose();
  41833. callback(false);
  41834. }
  41835. });
  41836. }
  41837. else {
  41838. self.onClose();
  41839. }
  41840. });
  41841. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41842. var http_xdomain_request_hooks = {
  41843. getRequest: function (socket) {
  41844. var xdr = new window.XDomainRequest();
  41845. xdr.ontimeout = function () {
  41846. socket.emit("error", new RequestTimedOut());
  41847. socket.close();
  41848. };
  41849. xdr.onerror = function (e) {
  41850. socket.emit("error", e);
  41851. socket.close();
  41852. };
  41853. xdr.onprogress = function () {
  41854. if (xdr.responseText && xdr.responseText.length > 0) {
  41855. socket.onChunk(200, xdr.responseText);
  41856. }
  41857. };
  41858. xdr.onload = function () {
  41859. if (xdr.responseText && xdr.responseText.length > 0) {
  41860. socket.onChunk(200, xdr.responseText);
  41861. }
  41862. socket.emit("finished", 200);
  41863. socket.close();
  41864. };
  41865. return xdr;
  41866. },
  41867. abortRequest: function (xdr) {
  41868. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41869. xdr.abort();
  41870. }
  41871. };
  41872. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41873. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41874. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41875. var extendStatics = function (d, b) {
  41876. extendStatics = Object.setPrototypeOf ||
  41877. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41878. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41879. return extendStatics(d, b);
  41880. };
  41881. return function (d, b) {
  41882. extendStatics(d, b);
  41883. function __() { this.constructor = d; }
  41884. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41885. };
  41886. })();
  41887. var MAX_BUFFER_LENGTH = 256 * 1024;
  41888. var http_request_HTTPRequest = (function (_super) {
  41889. http_request_extends(HTTPRequest, _super);
  41890. function HTTPRequest(hooks, method, url) {
  41891. var _this = _super.call(this) || this;
  41892. _this.hooks = hooks;
  41893. _this.method = method;
  41894. _this.url = url;
  41895. return _this;
  41896. }
  41897. HTTPRequest.prototype.start = function (payload) {
  41898. var _this = this;
  41899. this.position = 0;
  41900. this.xhr = this.hooks.getRequest(this);
  41901. this.unloader = function () {
  41902. _this.close();
  41903. };
  41904. runtime.addUnloadListener(this.unloader);
  41905. this.xhr.open(this.method, this.url, true);
  41906. if (this.xhr.setRequestHeader) {
  41907. this.xhr.setRequestHeader("Content-Type", "application/json");
  41908. }
  41909. this.xhr.send(payload);
  41910. };
  41911. HTTPRequest.prototype.close = function () {
  41912. if (this.unloader) {
  41913. runtime.removeUnloadListener(this.unloader);
  41914. this.unloader = null;
  41915. }
  41916. if (this.xhr) {
  41917. this.hooks.abortRequest(this.xhr);
  41918. this.xhr = null;
  41919. }
  41920. };
  41921. HTTPRequest.prototype.onChunk = function (status, data) {
  41922. while (true) {
  41923. var chunk = this.advanceBuffer(data);
  41924. if (chunk) {
  41925. this.emit("chunk", { status: status, data: chunk });
  41926. }
  41927. else {
  41928. break;
  41929. }
  41930. }
  41931. if (this.isBufferTooLong(data)) {
  41932. this.emit("buffer_too_long");
  41933. }
  41934. };
  41935. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  41936. var unreadData = buffer.slice(this.position);
  41937. var endOfLinePosition = unreadData.indexOf("\n");
  41938. if (endOfLinePosition !== -1) {
  41939. this.position += endOfLinePosition + 1;
  41940. return unreadData.slice(0, endOfLinePosition);
  41941. }
  41942. else {
  41943. return null;
  41944. }
  41945. };
  41946. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  41947. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  41948. };
  41949. return HTTPRequest;
  41950. }(dispatcher));
  41951. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  41952. // CONCATENATED MODULE: ./src/core/http/state.ts
  41953. var State;
  41954. (function (State) {
  41955. State[State["CONNECTING"] = 0] = "CONNECTING";
  41956. State[State["OPEN"] = 1] = "OPEN";
  41957. State[State["CLOSED"] = 3] = "CLOSED";
  41958. })(State || (State = {}));
  41959. /* harmony default export */ var state = (State);
  41960. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  41961. var autoIncrement = 1;
  41962. var http_socket_HTTPSocket = (function () {
  41963. function HTTPSocket(hooks, url) {
  41964. this.hooks = hooks;
  41965. this.session = randomNumber(1000) + "/" + randomString(8);
  41966. this.location = getLocation(url);
  41967. this.readyState = state.CONNECTING;
  41968. this.openStream();
  41969. }
  41970. HTTPSocket.prototype.send = function (payload) {
  41971. return this.sendRaw(JSON.stringify([payload]));
  41972. };
  41973. HTTPSocket.prototype.ping = function () {
  41974. this.hooks.sendHeartbeat(this);
  41975. };
  41976. HTTPSocket.prototype.close = function (code, reason) {
  41977. this.onClose(code, reason, true);
  41978. };
  41979. HTTPSocket.prototype.sendRaw = function (payload) {
  41980. if (this.readyState === state.OPEN) {
  41981. try {
  41982. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  41983. return true;
  41984. }
  41985. catch (e) {
  41986. return false;
  41987. }
  41988. }
  41989. else {
  41990. return false;
  41991. }
  41992. };
  41993. HTTPSocket.prototype.reconnect = function () {
  41994. this.closeStream();
  41995. this.openStream();
  41996. };
  41997. ;
  41998. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  41999. this.closeStream();
  42000. this.readyState = state.CLOSED;
  42001. if (this.onclose) {
  42002. this.onclose({
  42003. code: code,
  42004. reason: reason,
  42005. wasClean: wasClean
  42006. });
  42007. }
  42008. };
  42009. HTTPSocket.prototype.onChunk = function (chunk) {
  42010. if (chunk.status !== 200) {
  42011. return;
  42012. }
  42013. if (this.readyState === state.OPEN) {
  42014. this.onActivity();
  42015. }
  42016. var payload;
  42017. var type = chunk.data.slice(0, 1);
  42018. switch (type) {
  42019. case 'o':
  42020. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42021. this.onOpen(payload);
  42022. break;
  42023. case 'a':
  42024. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42025. for (var i = 0; i < payload.length; i++) {
  42026. this.onEvent(payload[i]);
  42027. }
  42028. break;
  42029. case 'm':
  42030. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42031. this.onEvent(payload);
  42032. break;
  42033. case 'h':
  42034. this.hooks.onHeartbeat(this);
  42035. break;
  42036. case 'c':
  42037. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42038. this.onClose(payload[0], payload[1], true);
  42039. break;
  42040. }
  42041. };
  42042. HTTPSocket.prototype.onOpen = function (options) {
  42043. if (this.readyState === state.CONNECTING) {
  42044. if (options && options.hostname) {
  42045. this.location.base = replaceHost(this.location.base, options.hostname);
  42046. }
  42047. this.readyState = state.OPEN;
  42048. if (this.onopen) {
  42049. this.onopen();
  42050. }
  42051. }
  42052. else {
  42053. this.onClose(1006, "Server lost session", true);
  42054. }
  42055. };
  42056. HTTPSocket.prototype.onEvent = function (event) {
  42057. if (this.readyState === state.OPEN && this.onmessage) {
  42058. this.onmessage({ data: event });
  42059. }
  42060. };
  42061. HTTPSocket.prototype.onActivity = function () {
  42062. if (this.onactivity) {
  42063. this.onactivity();
  42064. }
  42065. };
  42066. HTTPSocket.prototype.onError = function (error) {
  42067. if (this.onerror) {
  42068. this.onerror(error);
  42069. }
  42070. };
  42071. HTTPSocket.prototype.openStream = function () {
  42072. var _this = this;
  42073. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42074. this.stream.bind("chunk", function (chunk) {
  42075. _this.onChunk(chunk);
  42076. });
  42077. this.stream.bind("finished", function (status) {
  42078. _this.hooks.onFinished(_this, status);
  42079. });
  42080. this.stream.bind("buffer_too_long", function () {
  42081. _this.reconnect();
  42082. });
  42083. try {
  42084. this.stream.start();
  42085. }
  42086. catch (error) {
  42087. util.defer(function () {
  42088. _this.onError(error);
  42089. _this.onClose(1006, "Could not start streaming", false);
  42090. });
  42091. }
  42092. };
  42093. HTTPSocket.prototype.closeStream = function () {
  42094. if (this.stream) {
  42095. this.stream.unbind_all();
  42096. this.stream.close();
  42097. this.stream = null;
  42098. }
  42099. };
  42100. return HTTPSocket;
  42101. }());
  42102. function getLocation(url) {
  42103. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42104. return {
  42105. base: parts[1],
  42106. queryString: parts[2]
  42107. };
  42108. }
  42109. function getSendURL(url, session) {
  42110. return url.base + "/" + session + "/xhr_send";
  42111. }
  42112. function getUniqueURL(url) {
  42113. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42114. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42115. }
  42116. function replaceHost(url, hostname) {
  42117. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42118. return urlParts[1] + hostname + urlParts[3];
  42119. }
  42120. function randomNumber(max) {
  42121. return Math.floor(Math.random() * max);
  42122. }
  42123. function randomString(length) {
  42124. var result = [];
  42125. for (var i = 0; i < length; i++) {
  42126. result.push(randomNumber(32).toString(32));
  42127. }
  42128. return result.join('');
  42129. }
  42130. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42131. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42132. var http_streaming_socket_hooks = {
  42133. getReceiveURL: function (url, session) {
  42134. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42135. },
  42136. onHeartbeat: function (socket) {
  42137. socket.sendRaw("[]");
  42138. },
  42139. sendHeartbeat: function (socket) {
  42140. socket.sendRaw("[]");
  42141. },
  42142. onFinished: function (socket, status) {
  42143. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42144. }
  42145. };
  42146. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42147. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42148. var http_polling_socket_hooks = {
  42149. getReceiveURL: function (url, session) {
  42150. return url.base + "/" + session + "/xhr" + url.queryString;
  42151. },
  42152. onHeartbeat: function () {
  42153. },
  42154. sendHeartbeat: function (socket) {
  42155. socket.sendRaw("[]");
  42156. },
  42157. onFinished: function (socket, status) {
  42158. if (status === 200) {
  42159. socket.reconnect();
  42160. }
  42161. else {
  42162. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42163. }
  42164. }
  42165. };
  42166. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42167. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42168. var http_xhr_request_hooks = {
  42169. getRequest: function (socket) {
  42170. var Constructor = runtime.getXHRAPI();
  42171. var xhr = new Constructor();
  42172. xhr.onreadystatechange = xhr.onprogress = function () {
  42173. switch (xhr.readyState) {
  42174. case 3:
  42175. if (xhr.responseText && xhr.responseText.length > 0) {
  42176. socket.onChunk(xhr.status, xhr.responseText);
  42177. }
  42178. break;
  42179. case 4:
  42180. if (xhr.responseText && xhr.responseText.length > 0) {
  42181. socket.onChunk(xhr.status, xhr.responseText);
  42182. }
  42183. socket.emit("finished", xhr.status);
  42184. socket.close();
  42185. break;
  42186. }
  42187. };
  42188. return xhr;
  42189. },
  42190. abortRequest: function (xhr) {
  42191. xhr.onreadystatechange = null;
  42192. xhr.abort();
  42193. }
  42194. };
  42195. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42196. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42197. var HTTP = {
  42198. createStreamingSocket: function (url) {
  42199. return this.createSocket(http_streaming_socket, url);
  42200. },
  42201. createPollingSocket: function (url) {
  42202. return this.createSocket(http_polling_socket, url);
  42203. },
  42204. createSocket: function (hooks, url) {
  42205. return new http_socket(hooks, url);
  42206. },
  42207. createXHR: function (method, url) {
  42208. return this.createRequest(http_xhr_request, method, url);
  42209. },
  42210. createRequest: function (hooks, method, url) {
  42211. return new http_request(hooks, method, url);
  42212. }
  42213. };
  42214. /* harmony default export */ var http_http = (HTTP);
  42215. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42216. http_http.createXDR = function (method, url) {
  42217. return this.createRequest(http_xdomain_request, method, url);
  42218. };
  42219. /* harmony default export */ var web_http_http = (http_http);
  42220. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42221. var Runtime = {
  42222. nextAuthCallbackID: 1,
  42223. auth_callbacks: {},
  42224. ScriptReceivers: ScriptReceivers,
  42225. DependenciesReceivers: DependenciesReceivers,
  42226. getDefaultStrategy: default_strategy,
  42227. Transports: transports_transports,
  42228. transportConnectionInitializer: transport_connection_initializer,
  42229. HTTPFactory: web_http_http,
  42230. TimelineTransport: jsonp_timeline,
  42231. getXHRAPI: function () {
  42232. return window.XMLHttpRequest;
  42233. },
  42234. getWebSocketAPI: function () {
  42235. return window.WebSocket || window.MozWebSocket;
  42236. },
  42237. setup: function (PusherClass) {
  42238. var _this = this;
  42239. window.Pusher = PusherClass;
  42240. var initializeOnDocumentBody = function () {
  42241. _this.onDocumentBody(PusherClass.ready);
  42242. };
  42243. if (!window.JSON) {
  42244. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42245. }
  42246. else {
  42247. initializeOnDocumentBody();
  42248. }
  42249. },
  42250. getDocument: function () {
  42251. return document;
  42252. },
  42253. getProtocol: function () {
  42254. return this.getDocument().location.protocol;
  42255. },
  42256. getAuthorizers: function () {
  42257. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42258. },
  42259. onDocumentBody: function (callback) {
  42260. var _this = this;
  42261. if (document.body) {
  42262. callback();
  42263. }
  42264. else {
  42265. setTimeout(function () {
  42266. _this.onDocumentBody(callback);
  42267. }, 0);
  42268. }
  42269. },
  42270. createJSONPRequest: function (url, data) {
  42271. return new jsonp_request(url, data);
  42272. },
  42273. createScriptRequest: function (src) {
  42274. return new script_request(src);
  42275. },
  42276. getLocalStorage: function () {
  42277. try {
  42278. return window.localStorage;
  42279. }
  42280. catch (e) {
  42281. return undefined;
  42282. }
  42283. },
  42284. createXHR: function () {
  42285. if (this.getXHRAPI()) {
  42286. return this.createXMLHttpRequest();
  42287. }
  42288. else {
  42289. return this.createMicrosoftXHR();
  42290. }
  42291. },
  42292. createXMLHttpRequest: function () {
  42293. var Constructor = this.getXHRAPI();
  42294. return new Constructor();
  42295. },
  42296. createMicrosoftXHR: function () {
  42297. return new ActiveXObject("Microsoft.XMLHTTP");
  42298. },
  42299. getNetwork: function () {
  42300. return net_info_Network;
  42301. },
  42302. createWebSocket: function (url) {
  42303. var Constructor = this.getWebSocketAPI();
  42304. return new Constructor(url);
  42305. },
  42306. createSocketRequest: function (method, url) {
  42307. if (this.isXHRSupported()) {
  42308. return this.HTTPFactory.createXHR(method, url);
  42309. }
  42310. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42311. return this.HTTPFactory.createXDR(method, url);
  42312. }
  42313. else {
  42314. throw "Cross-origin HTTP requests are not supported";
  42315. }
  42316. },
  42317. isXHRSupported: function () {
  42318. var Constructor = this.getXHRAPI();
  42319. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42320. },
  42321. isXDRSupported: function (useTLS) {
  42322. var protocol = useTLS ? "https:" : "http:";
  42323. var documentProtocol = this.getProtocol();
  42324. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42325. },
  42326. addUnloadListener: function (listener) {
  42327. if (window.addEventListener !== undefined) {
  42328. window.addEventListener("unload", listener, false);
  42329. }
  42330. else if (window.attachEvent !== undefined) {
  42331. window.attachEvent("onunload", listener);
  42332. }
  42333. },
  42334. removeUnloadListener: function (listener) {
  42335. if (window.addEventListener !== undefined) {
  42336. window.removeEventListener("unload", listener, false);
  42337. }
  42338. else if (window.detachEvent !== undefined) {
  42339. window.detachEvent("onunload", listener);
  42340. }
  42341. }
  42342. };
  42343. /* harmony default export */ var runtime = (Runtime);
  42344. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42345. var TimelineLevel;
  42346. (function (TimelineLevel) {
  42347. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42348. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42349. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42350. })(TimelineLevel || (TimelineLevel = {}));
  42351. /* harmony default export */ var timeline_level = (TimelineLevel);
  42352. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42353. var timeline_Timeline = (function () {
  42354. function Timeline(key, session, options) {
  42355. this.key = key;
  42356. this.session = session;
  42357. this.events = [];
  42358. this.options = options || {};
  42359. this.sent = 0;
  42360. this.uniqueID = 0;
  42361. }
  42362. Timeline.prototype.log = function (level, event) {
  42363. if (level <= this.options.level) {
  42364. this.events.push(extend({}, event, { timestamp: util.now() }));
  42365. if (this.options.limit && this.events.length > this.options.limit) {
  42366. this.events.shift();
  42367. }
  42368. }
  42369. };
  42370. Timeline.prototype.error = function (event) {
  42371. this.log(timeline_level.ERROR, event);
  42372. };
  42373. Timeline.prototype.info = function (event) {
  42374. this.log(timeline_level.INFO, event);
  42375. };
  42376. Timeline.prototype.debug = function (event) {
  42377. this.log(timeline_level.DEBUG, event);
  42378. };
  42379. Timeline.prototype.isEmpty = function () {
  42380. return this.events.length === 0;
  42381. };
  42382. Timeline.prototype.send = function (sendfn, callback) {
  42383. var _this = this;
  42384. var data = extend({
  42385. session: this.session,
  42386. bundle: this.sent + 1,
  42387. key: this.key,
  42388. lib: "js",
  42389. version: this.options.version,
  42390. cluster: this.options.cluster,
  42391. features: this.options.features,
  42392. timeline: this.events
  42393. }, this.options.params);
  42394. this.events = [];
  42395. sendfn(data, function (error, result) {
  42396. if (!error) {
  42397. _this.sent++;
  42398. }
  42399. if (callback) {
  42400. callback(error, result);
  42401. }
  42402. });
  42403. return true;
  42404. };
  42405. Timeline.prototype.generateUniqueID = function () {
  42406. this.uniqueID++;
  42407. return this.uniqueID;
  42408. };
  42409. return Timeline;
  42410. }());
  42411. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42412. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42413. var transport_strategy_TransportStrategy = (function () {
  42414. function TransportStrategy(name, priority, transport, options) {
  42415. this.name = name;
  42416. this.priority = priority;
  42417. this.transport = transport;
  42418. this.options = options || {};
  42419. }
  42420. TransportStrategy.prototype.isSupported = function () {
  42421. return this.transport.isSupported({
  42422. useTLS: this.options.useTLS
  42423. });
  42424. };
  42425. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42426. var _this = this;
  42427. if (!this.isSupported()) {
  42428. return failAttempt(new UnsupportedStrategy(), callback);
  42429. }
  42430. else if (this.priority < minPriority) {
  42431. return failAttempt(new TransportPriorityTooLow(), callback);
  42432. }
  42433. var connected = false;
  42434. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42435. var handshake = null;
  42436. var onInitialized = function () {
  42437. transport.unbind("initialized", onInitialized);
  42438. transport.connect();
  42439. };
  42440. var onOpen = function () {
  42441. handshake = factory.createHandshake(transport, function (result) {
  42442. connected = true;
  42443. unbindListeners();
  42444. callback(null, result);
  42445. });
  42446. };
  42447. var onError = function (error) {
  42448. unbindListeners();
  42449. callback(error);
  42450. };
  42451. var onClosed = function () {
  42452. unbindListeners();
  42453. var serializedTransport;
  42454. serializedTransport = safeJSONStringify(transport);
  42455. callback(new TransportClosed(serializedTransport));
  42456. };
  42457. var unbindListeners = function () {
  42458. transport.unbind("initialized", onInitialized);
  42459. transport.unbind("open", onOpen);
  42460. transport.unbind("error", onError);
  42461. transport.unbind("closed", onClosed);
  42462. };
  42463. transport.bind("initialized", onInitialized);
  42464. transport.bind("open", onOpen);
  42465. transport.bind("error", onError);
  42466. transport.bind("closed", onClosed);
  42467. transport.initialize();
  42468. return {
  42469. abort: function () {
  42470. if (connected) {
  42471. return;
  42472. }
  42473. unbindListeners();
  42474. if (handshake) {
  42475. handshake.close();
  42476. }
  42477. else {
  42478. transport.close();
  42479. }
  42480. },
  42481. forceMinPriority: function (p) {
  42482. if (connected) {
  42483. return;
  42484. }
  42485. if (_this.priority < p) {
  42486. if (handshake) {
  42487. handshake.close();
  42488. }
  42489. else {
  42490. transport.close();
  42491. }
  42492. }
  42493. }
  42494. };
  42495. };
  42496. return TransportStrategy;
  42497. }());
  42498. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42499. function failAttempt(error, callback) {
  42500. util.defer(function () {
  42501. callback(error);
  42502. });
  42503. return {
  42504. abort: function () { },
  42505. forceMinPriority: function () { }
  42506. };
  42507. }
  42508. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42509. var strategy_builder_Transports = runtime.Transports;
  42510. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42511. var transportClass = strategy_builder_Transports[type];
  42512. if (!transportClass) {
  42513. throw new UnsupportedTransport(type);
  42514. }
  42515. var enabled = (!config.enabledTransports ||
  42516. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42517. (!config.disabledTransports ||
  42518. arrayIndexOf(config.disabledTransports, name) === -1);
  42519. var transport;
  42520. if (enabled) {
  42521. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42522. key: config.key,
  42523. useTLS: config.useTLS,
  42524. timeline: config.timeline,
  42525. ignoreNullOrigin: config.ignoreNullOrigin
  42526. }, options));
  42527. }
  42528. else {
  42529. transport = strategy_builder_UnsupportedStrategy;
  42530. }
  42531. return transport;
  42532. };
  42533. var strategy_builder_UnsupportedStrategy = {
  42534. isSupported: function () {
  42535. return false;
  42536. },
  42537. connect: function (_, callback) {
  42538. var deferred = util.defer(function () {
  42539. callback(new UnsupportedStrategy());
  42540. });
  42541. return {
  42542. abort: function () {
  42543. deferred.ensureAborted();
  42544. },
  42545. forceMinPriority: function () { }
  42546. };
  42547. }
  42548. };
  42549. // CONCATENATED MODULE: ./src/core/config.ts
  42550. var getGlobalConfig = function () {
  42551. return {
  42552. wsHost: defaults.host,
  42553. wsPort: defaults.ws_port,
  42554. wssPort: defaults.wss_port,
  42555. wsPath: defaults.ws_path,
  42556. httpHost: defaults.sockjs_host,
  42557. httpPort: defaults.sockjs_http_port,
  42558. httpsPort: defaults.sockjs_https_port,
  42559. httpPath: defaults.sockjs_path,
  42560. statsHost: defaults.stats_host,
  42561. authEndpoint: defaults.channel_auth_endpoint,
  42562. authTransport: defaults.channel_auth_transport,
  42563. activity_timeout: defaults.activity_timeout,
  42564. pong_timeout: defaults.pong_timeout,
  42565. unavailable_timeout: defaults.unavailable_timeout
  42566. };
  42567. };
  42568. var getClusterConfig = function (clusterName) {
  42569. return {
  42570. wsHost: 'ws-' + clusterName + '.pusher.com',
  42571. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42572. };
  42573. };
  42574. // CONCATENATED MODULE: ./src/core/pusher.ts
  42575. var pusher_Pusher = (function () {
  42576. function Pusher(app_key, options) {
  42577. var _this = this;
  42578. checkAppKey(app_key);
  42579. options = options || {};
  42580. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42581. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42582. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42583. }
  42584. this.key = app_key;
  42585. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42586. this.channels = factory.createChannels();
  42587. this.global_emitter = new dispatcher();
  42588. this.sessionID = Math.floor(Math.random() * 1000000000);
  42589. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42590. cluster: this.config.cluster,
  42591. features: Pusher.getClientFeatures(),
  42592. params: this.config.timelineParams || {},
  42593. limit: 50,
  42594. level: timeline_level.INFO,
  42595. version: defaults.VERSION
  42596. });
  42597. if (!this.config.disableStats) {
  42598. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42599. host: this.config.statsHost,
  42600. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42601. });
  42602. }
  42603. var getStrategy = function (options) {
  42604. var config = extend({}, _this.config, options);
  42605. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42606. };
  42607. this.connection = factory.createConnectionManager(this.key, extend({
  42608. getStrategy: getStrategy,
  42609. timeline: this.timeline,
  42610. activityTimeout: this.config.activity_timeout,
  42611. pongTimeout: this.config.pong_timeout,
  42612. unavailableTimeout: this.config.unavailable_timeout
  42613. }, this.config, { useTLS: this.shouldUseTLS() }));
  42614. this.connection.bind('connected', function () {
  42615. _this.subscribeAll();
  42616. if (_this.timelineSender) {
  42617. _this.timelineSender.send(_this.connection.isUsingTLS());
  42618. }
  42619. });
  42620. this.connection.bind('message', function (event) {
  42621. var eventName = event.event;
  42622. var internal = eventName.indexOf('pusher_internal:') === 0;
  42623. if (event.channel) {
  42624. var channel = _this.channel(event.channel);
  42625. if (channel) {
  42626. channel.handleEvent(event);
  42627. }
  42628. }
  42629. if (!internal) {
  42630. _this.global_emitter.emit(event.event, event.data);
  42631. }
  42632. });
  42633. this.connection.bind('connecting', function () {
  42634. _this.channels.disconnect();
  42635. });
  42636. this.connection.bind('disconnected', function () {
  42637. _this.channels.disconnect();
  42638. });
  42639. this.connection.bind('error', function (err) {
  42640. logger.warn(err);
  42641. });
  42642. Pusher.instances.push(this);
  42643. this.timeline.info({ instances: Pusher.instances.length });
  42644. if (Pusher.isReady) {
  42645. this.connect();
  42646. }
  42647. }
  42648. Pusher.ready = function () {
  42649. Pusher.isReady = true;
  42650. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42651. Pusher.instances[i].connect();
  42652. }
  42653. };
  42654. Pusher.getClientFeatures = function () {
  42655. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42656. return t.isSupported({});
  42657. }));
  42658. };
  42659. Pusher.prototype.channel = function (name) {
  42660. return this.channels.find(name);
  42661. };
  42662. Pusher.prototype.allChannels = function () {
  42663. return this.channels.all();
  42664. };
  42665. Pusher.prototype.connect = function () {
  42666. this.connection.connect();
  42667. if (this.timelineSender) {
  42668. if (!this.timelineSenderTimer) {
  42669. var usingTLS = this.connection.isUsingTLS();
  42670. var timelineSender = this.timelineSender;
  42671. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42672. timelineSender.send(usingTLS);
  42673. });
  42674. }
  42675. }
  42676. };
  42677. Pusher.prototype.disconnect = function () {
  42678. this.connection.disconnect();
  42679. if (this.timelineSenderTimer) {
  42680. this.timelineSenderTimer.ensureAborted();
  42681. this.timelineSenderTimer = null;
  42682. }
  42683. };
  42684. Pusher.prototype.bind = function (event_name, callback, context) {
  42685. this.global_emitter.bind(event_name, callback, context);
  42686. return this;
  42687. };
  42688. Pusher.prototype.unbind = function (event_name, callback, context) {
  42689. this.global_emitter.unbind(event_name, callback, context);
  42690. return this;
  42691. };
  42692. Pusher.prototype.bind_global = function (callback) {
  42693. this.global_emitter.bind_global(callback);
  42694. return this;
  42695. };
  42696. Pusher.prototype.unbind_global = function (callback) {
  42697. this.global_emitter.unbind_global(callback);
  42698. return this;
  42699. };
  42700. Pusher.prototype.unbind_all = function (callback) {
  42701. this.global_emitter.unbind_all();
  42702. return this;
  42703. };
  42704. Pusher.prototype.subscribeAll = function () {
  42705. var channelName;
  42706. for (channelName in this.channels.channels) {
  42707. if (this.channels.channels.hasOwnProperty(channelName)) {
  42708. this.subscribe(channelName);
  42709. }
  42710. }
  42711. };
  42712. Pusher.prototype.subscribe = function (channel_name) {
  42713. var channel = this.channels.add(channel_name, this);
  42714. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42715. channel.reinstateSubscription();
  42716. }
  42717. else if (!channel.subscriptionPending &&
  42718. this.connection.state === 'connected') {
  42719. channel.subscribe();
  42720. }
  42721. return channel;
  42722. };
  42723. Pusher.prototype.unsubscribe = function (channel_name) {
  42724. var channel = this.channels.find(channel_name);
  42725. if (channel && channel.subscriptionPending) {
  42726. channel.cancelSubscription();
  42727. }
  42728. else {
  42729. channel = this.channels.remove(channel_name);
  42730. if (channel && this.connection.state === 'connected') {
  42731. channel.unsubscribe();
  42732. }
  42733. }
  42734. };
  42735. Pusher.prototype.send_event = function (event_name, data, channel) {
  42736. return this.connection.send_event(event_name, data, channel);
  42737. };
  42738. Pusher.prototype.shouldUseTLS = function () {
  42739. if (runtime.getProtocol() === 'https:') {
  42740. return true;
  42741. }
  42742. else if (this.config.forceTLS === true) {
  42743. return true;
  42744. }
  42745. else {
  42746. return Boolean(this.config.encrypted);
  42747. }
  42748. };
  42749. Pusher.instances = [];
  42750. Pusher.isReady = false;
  42751. Pusher.logToConsole = false;
  42752. Pusher.Runtime = runtime;
  42753. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42754. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42755. Pusher.auth_callbacks = runtime.auth_callbacks;
  42756. return Pusher;
  42757. }());
  42758. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42759. function checkAppKey(key) {
  42760. if (key === null || key === undefined) {
  42761. throw 'You must pass your app key when you instantiate Pusher.';
  42762. }
  42763. }
  42764. runtime.setup(pusher_Pusher);
  42765. /***/ })
  42766. /******/ ]);
  42767. });
  42768. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42769. /***/ }),
  42770. /***/ "./node_modules/setimmediate/setImmediate.js":
  42771. /*!***************************************************!*\
  42772. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42773. \***************************************************/
  42774. /*! no static exports found */
  42775. /***/ (function(module, exports, __webpack_require__) {
  42776. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42777. "use strict";
  42778. if (global.setImmediate) {
  42779. return;
  42780. }
  42781. var nextHandle = 1; // Spec says greater than zero
  42782. var tasksByHandle = {};
  42783. var currentlyRunningATask = false;
  42784. var doc = global.document;
  42785. var registerImmediate;
  42786. function setImmediate(callback) {
  42787. // Callback can either be a function or a string
  42788. if (typeof callback !== "function") {
  42789. callback = new Function("" + callback);
  42790. }
  42791. // Copy function arguments
  42792. var args = new Array(arguments.length - 1);
  42793. for (var i = 0; i < args.length; i++) {
  42794. args[i] = arguments[i + 1];
  42795. }
  42796. // Store and register the task
  42797. var task = { callback: callback, args: args };
  42798. tasksByHandle[nextHandle] = task;
  42799. registerImmediate(nextHandle);
  42800. return nextHandle++;
  42801. }
  42802. function clearImmediate(handle) {
  42803. delete tasksByHandle[handle];
  42804. }
  42805. function run(task) {
  42806. var callback = task.callback;
  42807. var args = task.args;
  42808. switch (args.length) {
  42809. case 0:
  42810. callback();
  42811. break;
  42812. case 1:
  42813. callback(args[0]);
  42814. break;
  42815. case 2:
  42816. callback(args[0], args[1]);
  42817. break;
  42818. case 3:
  42819. callback(args[0], args[1], args[2]);
  42820. break;
  42821. default:
  42822. callback.apply(undefined, args);
  42823. break;
  42824. }
  42825. }
  42826. function runIfPresent(handle) {
  42827. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42828. // So if we're currently running a task, we'll need to delay this invocation.
  42829. if (currentlyRunningATask) {
  42830. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42831. // "too much recursion" error.
  42832. setTimeout(runIfPresent, 0, handle);
  42833. } else {
  42834. var task = tasksByHandle[handle];
  42835. if (task) {
  42836. currentlyRunningATask = true;
  42837. try {
  42838. run(task);
  42839. } finally {
  42840. clearImmediate(handle);
  42841. currentlyRunningATask = false;
  42842. }
  42843. }
  42844. }
  42845. }
  42846. function installNextTickImplementation() {
  42847. registerImmediate = function(handle) {
  42848. process.nextTick(function () { runIfPresent(handle); });
  42849. };
  42850. }
  42851. function canUsePostMessage() {
  42852. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42853. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42854. if (global.postMessage && !global.importScripts) {
  42855. var postMessageIsAsynchronous = true;
  42856. var oldOnMessage = global.onmessage;
  42857. global.onmessage = function() {
  42858. postMessageIsAsynchronous = false;
  42859. };
  42860. global.postMessage("", "*");
  42861. global.onmessage = oldOnMessage;
  42862. return postMessageIsAsynchronous;
  42863. }
  42864. }
  42865. function installPostMessageImplementation() {
  42866. // Installs an event handler on `global` for the `message` event: see
  42867. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42868. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42869. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42870. var onGlobalMessage = function(event) {
  42871. if (event.source === global &&
  42872. typeof event.data === "string" &&
  42873. event.data.indexOf(messagePrefix) === 0) {
  42874. runIfPresent(+event.data.slice(messagePrefix.length));
  42875. }
  42876. };
  42877. if (global.addEventListener) {
  42878. global.addEventListener("message", onGlobalMessage, false);
  42879. } else {
  42880. global.attachEvent("onmessage", onGlobalMessage);
  42881. }
  42882. registerImmediate = function(handle) {
  42883. global.postMessage(messagePrefix + handle, "*");
  42884. };
  42885. }
  42886. function installMessageChannelImplementation() {
  42887. var channel = new MessageChannel();
  42888. channel.port1.onmessage = function(event) {
  42889. var handle = event.data;
  42890. runIfPresent(handle);
  42891. };
  42892. registerImmediate = function(handle) {
  42893. channel.port2.postMessage(handle);
  42894. };
  42895. }
  42896. function installReadyStateChangeImplementation() {
  42897. var html = doc.documentElement;
  42898. registerImmediate = function(handle) {
  42899. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42900. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42901. var script = doc.createElement("script");
  42902. script.onreadystatechange = function () {
  42903. runIfPresent(handle);
  42904. script.onreadystatechange = null;
  42905. html.removeChild(script);
  42906. script = null;
  42907. };
  42908. html.appendChild(script);
  42909. };
  42910. }
  42911. function installSetTimeoutImplementation() {
  42912. registerImmediate = function(handle) {
  42913. setTimeout(runIfPresent, 0, handle);
  42914. };
  42915. }
  42916. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  42917. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  42918. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  42919. // Don't get fooled by e.g. browserify environments.
  42920. if ({}.toString.call(global.process) === "[object process]") {
  42921. // For Node.js before 0.9
  42922. installNextTickImplementation();
  42923. } else if (canUsePostMessage()) {
  42924. // For non-IE10 modern browsers
  42925. installPostMessageImplementation();
  42926. } else if (global.MessageChannel) {
  42927. // For web workers, where supported
  42928. installMessageChannelImplementation();
  42929. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  42930. // For IE 6–8
  42931. installReadyStateChangeImplementation();
  42932. } else {
  42933. // For older browsers
  42934. installSetTimeoutImplementation();
  42935. }
  42936. attachTo.setImmediate = setImmediate;
  42937. attachTo.clearImmediate = clearImmediate;
  42938. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  42939. /* 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")))
  42940. /***/ }),
  42941. /***/ "./node_modules/timers-browserify/main.js":
  42942. /*!************************************************!*\
  42943. !*** ./node_modules/timers-browserify/main.js ***!
  42944. \************************************************/
  42945. /*! no static exports found */
  42946. /***/ (function(module, exports, __webpack_require__) {
  42947. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  42948. (typeof self !== "undefined" && self) ||
  42949. window;
  42950. var apply = Function.prototype.apply;
  42951. // DOM APIs, for completeness
  42952. exports.setTimeout = function() {
  42953. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  42954. };
  42955. exports.setInterval = function() {
  42956. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  42957. };
  42958. exports.clearTimeout =
  42959. exports.clearInterval = function(timeout) {
  42960. if (timeout) {
  42961. timeout.close();
  42962. }
  42963. };
  42964. function Timeout(id, clearFn) {
  42965. this._id = id;
  42966. this._clearFn = clearFn;
  42967. }
  42968. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  42969. Timeout.prototype.close = function() {
  42970. this._clearFn.call(scope, this._id);
  42971. };
  42972. // Does not start the time, just sets up the members needed.
  42973. exports.enroll = function(item, msecs) {
  42974. clearTimeout(item._idleTimeoutId);
  42975. item._idleTimeout = msecs;
  42976. };
  42977. exports.unenroll = function(item) {
  42978. clearTimeout(item._idleTimeoutId);
  42979. item._idleTimeout = -1;
  42980. };
  42981. exports._unrefActive = exports.active = function(item) {
  42982. clearTimeout(item._idleTimeoutId);
  42983. var msecs = item._idleTimeout;
  42984. if (msecs >= 0) {
  42985. item._idleTimeoutId = setTimeout(function onTimeout() {
  42986. if (item._onTimeout)
  42987. item._onTimeout();
  42988. }, msecs);
  42989. }
  42990. };
  42991. // setimmediate attaches itself to the global object
  42992. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  42993. // On some exotic environments, it's not clear which object `setimmediate` was
  42994. // able to install onto. Search each possibility in the same order as the
  42995. // `setimmediate` library.
  42996. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  42997. (typeof global !== "undefined" && global.setImmediate) ||
  42998. (this && this.setImmediate);
  42999. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  43000. (typeof global !== "undefined" && global.clearImmediate) ||
  43001. (this && this.clearImmediate);
  43002. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  43003. /***/ }),
  43004. /***/ "./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&":
  43005. /*!*******************************************************************************************************************************************************************************************************************!*\
  43006. !*** ./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& ***!
  43007. \*******************************************************************************************************************************************************************************************************************/
  43008. /*! exports provided: render, staticRenderFns */
  43009. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43010. "use strict";
  43011. __webpack_require__.r(__webpack_exports__);
  43012. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43013. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43014. var render = function() {
  43015. var _vm = this
  43016. var _h = _vm.$createElement
  43017. var _c = _vm._self._c || _h
  43018. return _vm._m(0)
  43019. }
  43020. var staticRenderFns = [
  43021. function() {
  43022. var _vm = this
  43023. var _h = _vm.$createElement
  43024. var _c = _vm._self._c || _h
  43025. return _c("div", { staticClass: "container" }, [
  43026. _c("div", { staticClass: "row justify-content-center" }, [
  43027. _c("div", { staticClass: "col-md-8" }, [
  43028. _c("div", { staticClass: "card" }, [
  43029. _c("div", { staticClass: "card-header" }, [
  43030. _vm._v("Example Component")
  43031. ]),
  43032. _vm._v(" "),
  43033. _c("div", { staticClass: "card-body" }, [
  43034. _vm._v(
  43035. "\n I'm an example component.\n "
  43036. )
  43037. ])
  43038. ])
  43039. ])
  43040. ])
  43041. ])
  43042. }
  43043. ]
  43044. render._withStripped = true
  43045. /***/ }),
  43046. /***/ "./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&":
  43047. /*!************************************************************************************************************************************************************************************************************!*\
  43048. !*** ./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& ***!
  43049. \************************************************************************************************************************************************************************************************************/
  43050. /*! exports provided: render, staticRenderFns */
  43051. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43052. "use strict";
  43053. __webpack_require__.r(__webpack_exports__);
  43054. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43055. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43056. var render = function() {
  43057. var _vm = this
  43058. var _h = _vm.$createElement
  43059. var _c = _vm._self._c || _h
  43060. return _c(
  43061. "div",
  43062. [
  43063. _c(
  43064. "modal",
  43065. {
  43066. attrs: {
  43067. id: "asseteditModal",
  43068. tabindex: "-1",
  43069. role: "dialog",
  43070. "aria-labelledby": "asseteditModalLabel"
  43071. }
  43072. },
  43073. [
  43074. _c(
  43075. "h5",
  43076. {
  43077. staticClass: "modal-title",
  43078. attrs: { slot: "header", id: "asseteditModalLabel" },
  43079. slot: "header"
  43080. },
  43081. [_vm._v("\n Edit Work Order Information\n ")]
  43082. ),
  43083. _vm._v(" "),
  43084. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43085. _c("div", { staticClass: "form-group" }, [
  43086. _c("label", { attrs: { for: "manufacturer" } }, [
  43087. _vm._v("Manufacturer")
  43088. ]),
  43089. _vm._v(" "),
  43090. _c("input", {
  43091. directives: [
  43092. {
  43093. name: "model",
  43094. rawName: "v-model.lazy",
  43095. value: _vm.data.pcmanu,
  43096. expression: "data.pcmanu",
  43097. modifiers: { lazy: true }
  43098. }
  43099. ],
  43100. staticClass: "form-control",
  43101. attrs: {
  43102. type: "text",
  43103. name: "manufacturer",
  43104. id: "manufacturer"
  43105. },
  43106. domProps: { value: _vm.data.pcmanu },
  43107. on: {
  43108. change: function($event) {
  43109. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  43110. }
  43111. }
  43112. })
  43113. ]),
  43114. _vm._v(" "),
  43115. _c("div", { staticClass: "form-group" }, [
  43116. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  43117. _vm._v(" "),
  43118. _c("input", {
  43119. directives: [
  43120. {
  43121. name: "model",
  43122. rawName: "v-model.lazy",
  43123. value: _vm.data.pcmake,
  43124. expression: "data.pcmake",
  43125. modifiers: { lazy: true }
  43126. }
  43127. ],
  43128. staticClass: "form-control",
  43129. attrs: { type: "text", name: "make", id: "make" },
  43130. domProps: { value: _vm.data.pcmake },
  43131. on: {
  43132. change: function($event) {
  43133. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  43134. }
  43135. }
  43136. })
  43137. ]),
  43138. _vm._v(" "),
  43139. _c("div", { staticClass: "form-group" }, [
  43140. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  43141. _vm._v(" "),
  43142. _c("input", {
  43143. directives: [
  43144. {
  43145. name: "model",
  43146. rawName: "v-model.lazy",
  43147. value: _vm.data.pcnickname,
  43148. expression: "data.pcnickname",
  43149. modifiers: { lazy: true }
  43150. }
  43151. ],
  43152. staticClass: "form-control",
  43153. attrs: { type: "text", name: "nickname", id: "nickname" },
  43154. domProps: { value: _vm.data.pcnickname },
  43155. on: {
  43156. change: function($event) {
  43157. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  43158. }
  43159. }
  43160. })
  43161. ]),
  43162. _vm._v(" "),
  43163. _c("div", { staticClass: "form-group" }, [
  43164. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  43165. _vm._v(" "),
  43166. _c("input", {
  43167. directives: [
  43168. {
  43169. name: "model",
  43170. rawName: "v-model.lazy",
  43171. value: _vm.pcextra[2],
  43172. expression: "pcextra[2]",
  43173. modifiers: { lazy: true }
  43174. }
  43175. ],
  43176. staticClass: "form-control",
  43177. attrs: { type: "text", name: "os", id: "os" },
  43178. domProps: { value: _vm.pcextra[2] },
  43179. on: {
  43180. change: function($event) {
  43181. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  43182. }
  43183. }
  43184. })
  43185. ]),
  43186. _vm._v(" "),
  43187. _c("div", { staticClass: "form-group" }, [
  43188. _c("label", { attrs: { for: "serial" } }, [
  43189. _vm._v("Serial Number")
  43190. ]),
  43191. _vm._v(" "),
  43192. _c("input", {
  43193. directives: [
  43194. {
  43195. name: "model",
  43196. rawName: "v-model.lazy",
  43197. value: _vm.pcextra[104],
  43198. expression: "pcextra[104]",
  43199. modifiers: { lazy: true }
  43200. }
  43201. ],
  43202. staticClass: "form-control",
  43203. attrs: { type: "text", id: "serial", name: "serial" },
  43204. domProps: { value: _vm.pcextra[104] },
  43205. on: {
  43206. change: function($event) {
  43207. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  43208. }
  43209. }
  43210. })
  43211. ]),
  43212. _vm._v(" "),
  43213. _c("div", { staticClass: "form-group" }, [
  43214. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  43215. _vm._v(" "),
  43216. _c("input", {
  43217. directives: [
  43218. {
  43219. name: "model",
  43220. rawName: "v-model.lazy",
  43221. value: _vm.pcextra[101],
  43222. expression: "pcextra[101]",
  43223. modifiers: { lazy: true }
  43224. }
  43225. ],
  43226. staticClass: "form-control",
  43227. attrs: { type: "text", id: "cpu", name: "cpu" },
  43228. domProps: { value: _vm.pcextra[101] },
  43229. on: {
  43230. change: function($event) {
  43231. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  43232. }
  43233. }
  43234. })
  43235. ]),
  43236. _vm._v(" "),
  43237. _c("div", { staticClass: "form-group" }, [
  43238. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  43239. _vm._v(" "),
  43240. _c("input", {
  43241. directives: [
  43242. {
  43243. name: "model",
  43244. rawName: "v-model.lazy",
  43245. value: _vm.pcextra[100],
  43246. expression: "pcextra[100]",
  43247. modifiers: { lazy: true }
  43248. }
  43249. ],
  43250. staticClass: "form-control",
  43251. attrs: { type: "text", name: "ram", id: "ram" },
  43252. domProps: { value: _vm.pcextra[100] },
  43253. on: {
  43254. change: function($event) {
  43255. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  43256. }
  43257. }
  43258. })
  43259. ]),
  43260. _vm._v(" "),
  43261. _c("div", { staticClass: "form-group" }, [
  43262. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  43263. _vm._v(" "),
  43264. _c("input", {
  43265. directives: [
  43266. {
  43267. name: "model",
  43268. rawName: "v-model.lazy",
  43269. value: _vm.pcextra[4],
  43270. expression: "pcextra[4]",
  43271. modifiers: { lazy: true }
  43272. }
  43273. ],
  43274. staticClass: "form-control",
  43275. attrs: { type: "text", name: "graphics", id: "grapics" },
  43276. domProps: { value: _vm.pcextra[4] },
  43277. on: {
  43278. change: function($event) {
  43279. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  43280. }
  43281. }
  43282. })
  43283. ])
  43284. ]),
  43285. _vm._v(" "),
  43286. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43287. _c(
  43288. "button",
  43289. {
  43290. staticClass: "btn btn-secondary",
  43291. attrs: { type: "button", "data-dismiss": "modal" }
  43292. },
  43293. [_vm._v("Close")]
  43294. ),
  43295. _vm._v(" "),
  43296. _c(
  43297. "button",
  43298. {
  43299. staticClass: "btn btn-primary",
  43300. attrs: { type: "button" },
  43301. on: {
  43302. click: function($event) {
  43303. return _vm.updateAsset()
  43304. }
  43305. }
  43306. },
  43307. [_vm._v("Save")]
  43308. )
  43309. ])
  43310. ]
  43311. ),
  43312. _vm._v(" "),
  43313. _c("h4", { staticClass: "text-center" }, [
  43314. _vm._v(
  43315. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43316. ),
  43317. _c("small", { staticClass: "text-muted" }, [
  43318. _vm._v(_vm._s(this.data.pcnickname))
  43319. ])
  43320. ]),
  43321. _vm._v(" "),
  43322. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43323. _vm._v(" "),
  43324. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43325. _vm._v(" "),
  43326. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43327. _vm._v(" "),
  43328. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43329. _vm._v(" "),
  43330. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43331. _vm._v(" "),
  43332. _c(
  43333. "button",
  43334. {
  43335. staticClass: "btn btn-primary",
  43336. attrs: {
  43337. type: "button",
  43338. "data-toggle": "modal",
  43339. "data-target": "#asseteditModal"
  43340. }
  43341. },
  43342. [_vm._v("Edit")]
  43343. )
  43344. ],
  43345. 1
  43346. )
  43347. }
  43348. var staticRenderFns = []
  43349. render._withStripped = true
  43350. /***/ }),
  43351. /***/ "./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&":
  43352. /*!*******************************************************************************************************************************************************************************************************************************!*\
  43353. !*** ./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& ***!
  43354. \*******************************************************************************************************************************************************************************************************************************/
  43355. /*! exports provided: render, staticRenderFns */
  43356. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43357. "use strict";
  43358. __webpack_require__.r(__webpack_exports__);
  43359. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43360. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43361. var render = function() {
  43362. var _vm = this
  43363. var _h = _vm.$createElement
  43364. var _c = _vm._self._c || _h
  43365. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  43366. _c("div", { staticClass: "input-group" }, [
  43367. _c("input", {
  43368. directives: [
  43369. {
  43370. name: "model",
  43371. rawName: "v-model",
  43372. value: _vm.searchText,
  43373. expression: "searchText"
  43374. }
  43375. ],
  43376. staticClass: "form-control",
  43377. attrs: { type: "text" },
  43378. domProps: { value: _vm.searchText },
  43379. on: {
  43380. input: [
  43381. function($event) {
  43382. if ($event.target.composing) {
  43383. return
  43384. }
  43385. _vm.searchText = $event.target.value
  43386. },
  43387. _vm.searchChanged
  43388. ]
  43389. }
  43390. }),
  43391. _vm._v(" "),
  43392. _c("div", { staticClass: "form-group-append" }, [
  43393. _c(
  43394. "a",
  43395. {
  43396. staticClass: "toggle input-group-text bg-primary text-light",
  43397. on: {
  43398. mousedown: function($event) {
  43399. $event.preventDefault()
  43400. },
  43401. click: function($event) {
  43402. return _vm.setOpen(!_vm.open)
  43403. }
  43404. }
  43405. },
  43406. [
  43407. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  43408. _vm._v(" "),
  43409. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  43410. ]
  43411. )
  43412. ])
  43413. ]),
  43414. _vm._v(" "),
  43415. _c(
  43416. "ul",
  43417. { staticClass: "suggestion-list list-unstyled" },
  43418. _vm._l(_vm.matches, function(suggestion, index) {
  43419. return _c(
  43420. "li",
  43421. {
  43422. key: index,
  43423. on: {
  43424. mousedown: function($event) {
  43425. $event.preventDefault()
  43426. },
  43427. click: function($event) {
  43428. return _vm.suggestionSelected(suggestion)
  43429. }
  43430. }
  43431. },
  43432. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  43433. )
  43434. }),
  43435. 0
  43436. )
  43437. ])
  43438. }
  43439. var staticRenderFns = []
  43440. render._withStripped = true
  43441. /***/ }),
  43442. /***/ "./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&":
  43443. /*!************************************************************************************************************************************************************************************************************************!*\
  43444. !*** ./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& ***!
  43445. \************************************************************************************************************************************************************************************************************************/
  43446. /*! exports provided: render, staticRenderFns */
  43447. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43448. "use strict";
  43449. __webpack_require__.r(__webpack_exports__);
  43450. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43451. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43452. var render = function() {
  43453. var _vm = this
  43454. var _h = _vm.$createElement
  43455. var _c = _vm._self._c || _h
  43456. return _c(
  43457. "modal",
  43458. {
  43459. attrs: {
  43460. id: _vm.id,
  43461. tabindex: "-1",
  43462. role: "dialog",
  43463. "aria-labelledby": _vm.id + "Label"
  43464. }
  43465. },
  43466. [
  43467. _c(
  43468. "h5",
  43469. {
  43470. staticClass: "modal-title",
  43471. attrs: { slot: "header", id: _vm.id + "Label" },
  43472. slot: "header"
  43473. },
  43474. [_vm._v("\n Edit Credential\n ")]
  43475. ),
  43476. _vm._v(" "),
  43477. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43478. _c(
  43479. "div",
  43480. { staticClass: "form" },
  43481. [
  43482. _c("autocomplete-custom-dropdown", {
  43483. attrs: {
  43484. options: _vm.descriptions,
  43485. value: _vm.creddesc,
  43486. "allow-custom": true
  43487. },
  43488. model: {
  43489. value: _vm.creddesc,
  43490. callback: function($$v) {
  43491. _vm.creddesc = $$v
  43492. },
  43493. expression: "creddesc"
  43494. }
  43495. })
  43496. ],
  43497. 1
  43498. ),
  43499. _vm._v(" "),
  43500. _c("div", { staticClass: "form-group" }, [
  43501. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  43502. _vm._v(" "),
  43503. _c("input", {
  43504. directives: [
  43505. {
  43506. name: "model",
  43507. rawName: "v-model",
  43508. value: _vm.data.creduser,
  43509. expression: "data.creduser"
  43510. }
  43511. ],
  43512. staticClass: "form-control credential",
  43513. attrs: {
  43514. type: "text",
  43515. name: "newusername" + _vm.data.credid,
  43516. id: "newusername" + _vm.data.credid
  43517. },
  43518. domProps: { value: _vm.data.creduser },
  43519. on: {
  43520. input: function($event) {
  43521. if ($event.target.composing) {
  43522. return
  43523. }
  43524. _vm.$set(_vm.data, "creduser", $event.target.value)
  43525. }
  43526. }
  43527. })
  43528. ]),
  43529. _vm._v(" "),
  43530. _c("div", { staticClass: "form-group" }, [
  43531. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  43532. _vm._v(" "),
  43533. _c("input", {
  43534. directives: [
  43535. {
  43536. name: "model",
  43537. rawName: "v-model",
  43538. value: _vm.data.credpass,
  43539. expression: "data.credpass"
  43540. }
  43541. ],
  43542. staticClass: "form-control credential",
  43543. attrs: {
  43544. type: "text",
  43545. name: "newpassword" + _vm.data.credid,
  43546. id: "newpassword" + _vm.data.credid
  43547. },
  43548. domProps: { value: _vm.data.credpass },
  43549. on: {
  43550. input: function($event) {
  43551. if ($event.target.composing) {
  43552. return
  43553. }
  43554. _vm.$set(_vm.data, "credpass", $event.target.value)
  43555. }
  43556. }
  43557. }),
  43558. _vm._v(" "),
  43559. _c(
  43560. "button",
  43561. {
  43562. staticClass: "btn btn-secondary",
  43563. attrs: { type: "button" },
  43564. on: {
  43565. click: function($event) {
  43566. return _vm.getRandomPassword(_vm.data.credid)
  43567. }
  43568. }
  43569. },
  43570. [_vm._v("Generate Random")]
  43571. )
  43572. ]),
  43573. _vm._v(" "),
  43574. _c("div", { staticClass: "form-group" })
  43575. ]),
  43576. _vm._v(" "),
  43577. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43578. _c(
  43579. "button",
  43580. {
  43581. staticClass: "btn btn-secondary",
  43582. attrs: { type: "button", "data-dismiss": "modal" }
  43583. },
  43584. [_vm._v("Close")]
  43585. ),
  43586. _vm._v(" "),
  43587. _c(
  43588. "button",
  43589. {
  43590. staticClass: "btn btn-primary",
  43591. attrs: { type: "button" },
  43592. on: {
  43593. click: function($event) {
  43594. return _vm.updateCredential()
  43595. }
  43596. }
  43597. },
  43598. [_vm._v("Save")]
  43599. )
  43600. ])
  43601. ]
  43602. )
  43603. }
  43604. var staticRenderFns = []
  43605. render._withStripped = true
  43606. /***/ }),
  43607. /***/ "./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&":
  43608. /*!******************************************************************************************************************************************************************************************************************!*\
  43609. !*** ./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& ***!
  43610. \******************************************************************************************************************************************************************************************************************/
  43611. /*! exports provided: render, staticRenderFns */
  43612. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43613. "use strict";
  43614. __webpack_require__.r(__webpack_exports__);
  43615. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43616. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43617. var render = function() {
  43618. var _vm = this
  43619. var _h = _vm.$createElement
  43620. var _c = _vm._self._c || _h
  43621. return _c(
  43622. "div",
  43623. [
  43624. _c("credential-form-modal", {
  43625. attrs: {
  43626. "modal-id": "newCredentialModal",
  43627. descriptions: _vm.creddescList,
  43628. create: true,
  43629. pcid: _vm.pcid
  43630. }
  43631. }),
  43632. _vm._v(" "),
  43633. _c(
  43634. "button",
  43635. {
  43636. staticClass: "btn btn-primary",
  43637. attrs: {
  43638. type: "button",
  43639. "data-toggle": "modal",
  43640. "data-target": "#newCredentialModal"
  43641. }
  43642. },
  43643. [_vm._v("New Credential")]
  43644. ),
  43645. _vm._v(" "),
  43646. _vm._l(_vm.credentials, function(credential) {
  43647. return _c(
  43648. "div",
  43649. { key: credential.credid },
  43650. [
  43651. _c("credential", {
  43652. attrs: { credential: credential, descriptions: _vm.creddescList }
  43653. })
  43654. ],
  43655. 1
  43656. )
  43657. })
  43658. ],
  43659. 2
  43660. )
  43661. }
  43662. var staticRenderFns = []
  43663. render._withStripped = true
  43664. /***/ }),
  43665. /***/ "./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&":
  43666. /*!*************************************************************************************************************************************************************************************************************!*\
  43667. !*** ./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& ***!
  43668. \*************************************************************************************************************************************************************************************************************/
  43669. /*! exports provided: render, staticRenderFns */
  43670. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43671. "use strict";
  43672. __webpack_require__.r(__webpack_exports__);
  43673. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43674. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43675. var render = function() {
  43676. var _vm = this
  43677. var _h = _vm.$createElement
  43678. var _c = _vm._self._c || _h
  43679. return _c(
  43680. "div",
  43681. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43682. [
  43683. _c("credential-form-modal", {
  43684. attrs: {
  43685. descriptions: _vm.creddescList,
  43686. "modal-id": "credential" + this.data.credid + "editModal",
  43687. populateWith: this.data
  43688. }
  43689. }),
  43690. _vm._v(" "),
  43691. _c(
  43692. "modal",
  43693. {
  43694. attrs: {
  43695. id: "credential" + this.data.credid + "deleteModal",
  43696. tabindex: "-1"
  43697. }
  43698. },
  43699. [
  43700. _c(
  43701. "h5",
  43702. {
  43703. staticClass: "modal-title",
  43704. attrs: {
  43705. slot: "header",
  43706. id: "credential" + this.data.credid + "deleteModalLabel"
  43707. },
  43708. slot: "header"
  43709. },
  43710. [_vm._v("\r\n Delete Credential\r\n ")]
  43711. ),
  43712. _vm._v(" "),
  43713. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43714. _vm._v("\r\n Are you sure?\r\n ")
  43715. ]),
  43716. _vm._v(" "),
  43717. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43718. _c(
  43719. "button",
  43720. {
  43721. staticClass: "btn btn-secondary",
  43722. attrs: { type: "button", "data-dismiss": "modal" }
  43723. },
  43724. [_vm._v("Cancel")]
  43725. ),
  43726. _vm._v(" "),
  43727. _c(
  43728. "button",
  43729. {
  43730. staticClass: "btn btn-danger",
  43731. attrs: { type: "button" },
  43732. on: {
  43733. click: function($event) {
  43734. return _vm.deleteCredential()
  43735. }
  43736. }
  43737. },
  43738. [_vm._v("Confirm")]
  43739. )
  43740. ])
  43741. ]
  43742. ),
  43743. _vm._v(" "),
  43744. _c("div", { staticClass: "row no-gutters" }, [
  43745. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43746. _vm._v(_vm._s(this.data.creddesc))
  43747. ]),
  43748. _vm._v(" "),
  43749. _c("div", { staticClass: "col-9 text-right" }, [
  43750. _vm._v(_vm._s(this.data.creddate))
  43751. ])
  43752. ]),
  43753. _vm._v(" "),
  43754. _c("div", { staticClass: "row" }, [
  43755. _c("div", { staticClass: "col-lg-9" }, [
  43756. _c("div", [
  43757. _vm._m(0),
  43758. _vm._v(" "),
  43759. _c("input", {
  43760. staticClass: "border-0 credential",
  43761. attrs: {
  43762. type: "text",
  43763. id: "username" + this.data.credid,
  43764. readonly: ""
  43765. },
  43766. domProps: { value: this.data.creduser }
  43767. }),
  43768. _vm._v(" "),
  43769. _c(
  43770. "button",
  43771. {
  43772. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43773. attrs: {
  43774. id: "btn-username" + this.data.credid,
  43775. "data-clipboard-target": "#username" + this.data.credid
  43776. }
  43777. },
  43778. [_c("i", { staticClass: "far fa-clone" })]
  43779. )
  43780. ]),
  43781. _vm._v(" "),
  43782. _c("div", [
  43783. _vm._m(1),
  43784. _vm._v(" "),
  43785. _c("input", {
  43786. staticClass: "border-0 credential",
  43787. attrs: {
  43788. type: "text",
  43789. id: "password" + this.data.credid,
  43790. readonly: ""
  43791. },
  43792. domProps: { value: this.data.credpass }
  43793. }),
  43794. _vm._v(" "),
  43795. _c(
  43796. "button",
  43797. {
  43798. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43799. attrs: {
  43800. id: "btn-password" + this.data.credid,
  43801. "data-clipboard-target": "#password" + this.data.credid
  43802. }
  43803. },
  43804. [_c("i", { staticClass: "far fa-clone" })]
  43805. )
  43806. ])
  43807. ]),
  43808. _vm._v(" "),
  43809. _c(
  43810. "div",
  43811. {
  43812. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43813. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43814. },
  43815. [
  43816. _c(
  43817. "button",
  43818. {
  43819. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43820. attrs: {
  43821. type: "button",
  43822. "data-toggle": "modal",
  43823. "data-target": "#credential" + this.data.credid + "editModal"
  43824. }
  43825. },
  43826. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43827. ),
  43828. _vm._v(" "),
  43829. _c(
  43830. "button",
  43831. {
  43832. staticClass: "btn btn-sm btn-danger p-lg-1",
  43833. attrs: {
  43834. type: "button",
  43835. "data-toggle": "modal",
  43836. "data-target":
  43837. "#credential" + this.data.credid + "deleteModal"
  43838. }
  43839. },
  43840. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43841. )
  43842. ]
  43843. )
  43844. ])
  43845. ],
  43846. 1
  43847. )
  43848. }
  43849. var staticRenderFns = [
  43850. function() {
  43851. var _vm = this
  43852. var _h = _vm.$createElement
  43853. var _c = _vm._self._c || _h
  43854. return _c("label", { attrs: { for: "username" } }, [
  43855. _c("i", { staticClass: "fas fa-fw fa-user" })
  43856. ])
  43857. },
  43858. function() {
  43859. var _vm = this
  43860. var _h = _vm.$createElement
  43861. var _c = _vm._self._c || _h
  43862. return _c("label", { attrs: { for: "password" } }, [
  43863. _c("i", { staticClass: "fas fa-fw fa-key" })
  43864. ])
  43865. }
  43866. ]
  43867. render._withStripped = true
  43868. /***/ }),
  43869. /***/ "./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&":
  43870. /*!************************************************************************************************************************************************************************************************************!*\
  43871. !*** ./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& ***!
  43872. \************************************************************************************************************************************************************************************************************/
  43873. /*! exports provided: render, staticRenderFns */
  43874. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43875. "use strict";
  43876. __webpack_require__.r(__webpack_exports__);
  43877. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43878. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43879. var render = function() {
  43880. var _vm = this
  43881. var _h = _vm.$createElement
  43882. var _c = _vm._self._c || _h
  43883. return _c(
  43884. "ul",
  43885. { staticClass: "list-unstyled" },
  43886. _vm._l(_vm.errorList, function(error) {
  43887. return _c("li", { key: error, staticClass: "text-danger" }, [
  43888. _vm._v(" " + _vm._s(error) + " ")
  43889. ])
  43890. }),
  43891. 0
  43892. )
  43893. }
  43894. var staticRenderFns = []
  43895. render._withStripped = true
  43896. /***/ }),
  43897. /***/ "./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&":
  43898. /*!********************************************************************************************************************************************************************************************************!*\
  43899. !*** ./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& ***!
  43900. \********************************************************************************************************************************************************************************************************/
  43901. /*! exports provided: render, staticRenderFns */
  43902. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43903. "use strict";
  43904. __webpack_require__.r(__webpack_exports__);
  43905. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43906. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43907. var render = function() {
  43908. var _vm = this
  43909. var _h = _vm.$createElement
  43910. var _c = _vm._self._c || _h
  43911. return _c("div", { staticClass: "modal fade" }, [
  43912. _c(
  43913. "div",
  43914. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  43915. [
  43916. _c("div", { staticClass: "modal-content" }, [
  43917. _c(
  43918. "div",
  43919. { staticClass: "modal-header" },
  43920. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  43921. 2
  43922. ),
  43923. _vm._v(" "),
  43924. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  43925. _vm._v(" "),
  43926. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  43927. ])
  43928. ]
  43929. )
  43930. ])
  43931. }
  43932. var staticRenderFns = [
  43933. function() {
  43934. var _vm = this
  43935. var _h = _vm.$createElement
  43936. var _c = _vm._self._c || _h
  43937. return _c(
  43938. "button",
  43939. {
  43940. staticClass: "close",
  43941. attrs: {
  43942. type: "button",
  43943. "data-dismiss": "modal",
  43944. "aria-label": "Close"
  43945. }
  43946. },
  43947. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  43948. )
  43949. }
  43950. ]
  43951. render._withStripped = true
  43952. /***/ }),
  43953. /***/ "./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&":
  43954. /*!********************************************************************************************************************************************************************************************************!*\
  43955. !*** ./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& ***!
  43956. \********************************************************************************************************************************************************************************************************/
  43957. /*! exports provided: render, staticRenderFns */
  43958. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43959. "use strict";
  43960. __webpack_require__.r(__webpack_exports__);
  43961. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43962. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43963. var render = function() {
  43964. var _vm = this
  43965. var _h = _vm.$createElement
  43966. var _c = _vm._self._c || _h
  43967. return _c(
  43968. "ul",
  43969. { staticClass: "list-unstyled" },
  43970. _vm._l(this.notes, function(note) {
  43971. return _c(
  43972. "li",
  43973. { key: note.noteid, staticClass: "row no-gutters mb-2" },
  43974. [
  43975. _c(
  43976. "modal",
  43977. {
  43978. attrs: {
  43979. id: "note" + note.noteid + "editModal",
  43980. tabindex: "-1",
  43981. role: "dialog",
  43982. "aria-labelledby": "note" + note.noteid + "editModalLabel"
  43983. }
  43984. },
  43985. [
  43986. _c(
  43987. "h5",
  43988. {
  43989. staticClass: "modal-title",
  43990. attrs: {
  43991. slot: "header",
  43992. id: "note" + note.noteid + "editModalLabel"
  43993. },
  43994. slot: "header"
  43995. },
  43996. [_vm._v("\n Edit Note\n ")]
  43997. ),
  43998. _vm._v(" "),
  43999. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44000. _c("div", { staticClass: "form-group" }, [
  44001. _c("label", { attrs: { for: "content" } }, [
  44002. _vm._v("Content")
  44003. ]),
  44004. _vm._v(" "),
  44005. _c("textarea", {
  44006. directives: [
  44007. {
  44008. name: "model",
  44009. rawName: "v-model",
  44010. value: note.thenote,
  44011. expression: "note.thenote"
  44012. }
  44013. ],
  44014. staticClass: "form-control",
  44015. attrs: {
  44016. name: "content" + note.noteid,
  44017. id: "content" + note.noteid
  44018. },
  44019. domProps: { value: note.thenote },
  44020. on: {
  44021. input: function($event) {
  44022. if ($event.target.composing) {
  44023. return
  44024. }
  44025. _vm.$set(note, "thenote", $event.target.value)
  44026. }
  44027. }
  44028. })
  44029. ])
  44030. ]),
  44031. _vm._v(" "),
  44032. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44033. _c(
  44034. "button",
  44035. {
  44036. staticClass: "btn btn-secondary",
  44037. attrs: { type: "button", "data-dismiss": "modal" }
  44038. },
  44039. [_vm._v("Close")]
  44040. ),
  44041. _vm._v(" "),
  44042. _c(
  44043. "button",
  44044. {
  44045. staticClass: "btn btn-primary",
  44046. attrs: { type: "button" },
  44047. on: {
  44048. click: function($event) {
  44049. return _vm.updateNote(note.noteid)
  44050. }
  44051. }
  44052. },
  44053. [_vm._v("Save")]
  44054. )
  44055. ])
  44056. ]
  44057. ),
  44058. _vm._v(" "),
  44059. _c("div", { staticClass: "col-md-1 d-flex flex-column mx-md-3" }, [
  44060. _c("div", { staticClass: "text-center p-0 m-0" }, [
  44061. _vm._v(_vm._s(note.noteuser))
  44062. ]),
  44063. _vm._v(" "),
  44064. _c(
  44065. "div",
  44066. { staticClass: "text-muted text-small text-center p-0 m-0" },
  44067. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  44068. ),
  44069. _vm._v(" "),
  44070. _c(
  44071. "div",
  44072. { staticClass: "btn-group justify-content-center p-0 m-0" },
  44073. [
  44074. _vm.authusername === note.noteuser ||
  44075. _vm.authusername === "admin"
  44076. ? [
  44077. _c(
  44078. "button",
  44079. {
  44080. staticClass: "btn btn-sm btn-primary m-1",
  44081. attrs: {
  44082. "data-toggle": "modal",
  44083. "data-target": "#note" + note.noteid + "editModal"
  44084. }
  44085. },
  44086. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44087. ),
  44088. _vm._v(" "),
  44089. _vm._m(0, true),
  44090. _vm._v(" "),
  44091. _vm._m(1, true)
  44092. ]
  44093. : _vm._e()
  44094. ],
  44095. 2
  44096. )
  44097. ]),
  44098. _vm._v(" "),
  44099. _c("div", { staticClass: "col-md-10" }, [
  44100. _c("div", { staticClass: "card m-2" }, [
  44101. _c("div", { staticClass: "card-body p-2" }, [
  44102. _vm._v(
  44103. "\n " +
  44104. _vm._s(note.thenote) +
  44105. "\n "
  44106. )
  44107. ])
  44108. ])
  44109. ])
  44110. ],
  44111. 1
  44112. )
  44113. }),
  44114. 0
  44115. )
  44116. }
  44117. var staticRenderFns = [
  44118. function() {
  44119. var _vm = this
  44120. var _h = _vm.$createElement
  44121. var _c = _vm._self._c || _h
  44122. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  44123. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  44124. ])
  44125. },
  44126. function() {
  44127. var _vm = this
  44128. var _h = _vm.$createElement
  44129. var _c = _vm._self._c || _h
  44130. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  44131. _c("i", { staticClass: "fa fa-fw fa-random" })
  44132. ])
  44133. }
  44134. ]
  44135. render._withStripped = true
  44136. /***/ }),
  44137. /***/ "./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&":
  44138. /*!********************************************************************************************************************************************************************************************************************!*\
  44139. !*** ./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& ***!
  44140. \********************************************************************************************************************************************************************************************************************/
  44141. /*! exports provided: render, staticRenderFns */
  44142. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44143. "use strict";
  44144. __webpack_require__.r(__webpack_exports__);
  44145. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44146. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44147. var render = function() {
  44148. var _vm = this
  44149. var _h = _vm.$createElement
  44150. var _c = _vm._self._c || _h
  44151. return _c(
  44152. "modal",
  44153. {
  44154. attrs: {
  44155. id: _vm.id,
  44156. tabindex: "-1",
  44157. role: "dialog",
  44158. "aria-labelledby": _vm.id + "Label"
  44159. }
  44160. },
  44161. [
  44162. _c(
  44163. "h5",
  44164. {
  44165. staticClass: "modal-title",
  44166. attrs: { slot: "header", id: _vm.id + "Label" },
  44167. slot: "header"
  44168. },
  44169. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  44170. ),
  44171. _vm._v(" "),
  44172. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44173. _c(
  44174. "div",
  44175. { staticClass: "form-group" },
  44176. [
  44177. _c("label", { attrs: { for: "probdesc" } }, [
  44178. _vm._v("Problem Description")
  44179. ]),
  44180. _vm._v(" "),
  44181. _c("textarea", {
  44182. directives: [
  44183. {
  44184. name: "model",
  44185. rawName: "v-model",
  44186. value: _vm.data.probdesc,
  44187. expression: "data.probdesc"
  44188. }
  44189. ],
  44190. class: {
  44191. "form-control": true,
  44192. "is-invalid": _vm.errors.probdesc
  44193. },
  44194. attrs: { id: "probdesc", name: "probdesc" },
  44195. domProps: { value: _vm.data.probdesc },
  44196. on: {
  44197. input: function($event) {
  44198. if ($event.target.composing) {
  44199. return
  44200. }
  44201. _vm.$set(_vm.data, "probdesc", $event.target.value)
  44202. }
  44203. }
  44204. }),
  44205. _vm._v(" "),
  44206. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  44207. ],
  44208. 1
  44209. ),
  44210. _vm._v(" "),
  44211. _c(
  44212. "div",
  44213. { staticClass: "form-group" },
  44214. [
  44215. _c("label", { attrs: { for: "suggested" } }, [
  44216. _vm._v("Suggested Solution")
  44217. ]),
  44218. _vm._v(" "),
  44219. _c("textarea", {
  44220. directives: [
  44221. {
  44222. name: "model",
  44223. rawName: "v-model",
  44224. value: _vm.data.suggested,
  44225. expression: "data.suggested"
  44226. }
  44227. ],
  44228. class: {
  44229. "form-control": true,
  44230. "is-invalid": _vm.errors.suggested
  44231. },
  44232. attrs: { id: "suggested", name: "suggested" },
  44233. domProps: { value: _vm.data.suggested },
  44234. on: {
  44235. input: function($event) {
  44236. if ($event.target.composing) {
  44237. return
  44238. }
  44239. _vm.$set(_vm.data, "suggested", $event.target.value)
  44240. }
  44241. }
  44242. }),
  44243. _vm._v(" "),
  44244. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  44245. ],
  44246. 1
  44247. ),
  44248. _vm._v(" "),
  44249. _c(
  44250. "div",
  44251. { staticClass: "form-group" },
  44252. [
  44253. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  44254. _vm._v(" "),
  44255. _c("autocomplete-custom-dropdown", {
  44256. attrs: { options: _vm.storeList, value: this.store },
  44257. model: {
  44258. value: _vm.store,
  44259. callback: function($$v) {
  44260. _vm.store = $$v
  44261. },
  44262. expression: "store"
  44263. }
  44264. })
  44265. ],
  44266. 1
  44267. )
  44268. ]),
  44269. _vm._v(" "),
  44270. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44271. _c(
  44272. "button",
  44273. {
  44274. staticClass: "btn btn-secondary",
  44275. attrs: { type: "button", "data-dismiss": "modal" }
  44276. },
  44277. [_vm._v("Close")]
  44278. ),
  44279. _vm._v(" "),
  44280. _c(
  44281. "button",
  44282. {
  44283. staticClass: "btn btn-primary",
  44284. attrs: { type: "button" },
  44285. on: {
  44286. click: function($event) {
  44287. return _vm.updateWorkOrder()
  44288. }
  44289. }
  44290. },
  44291. [_vm._v("Save")]
  44292. )
  44293. ])
  44294. ]
  44295. )
  44296. }
  44297. var staticRenderFns = []
  44298. render._withStripped = true
  44299. /***/ }),
  44300. /***/ "./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&":
  44301. /*!*********************************************************************************************************************************************************************************************************!*\
  44302. !*** ./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& ***!
  44303. \*********************************************************************************************************************************************************************************************************/
  44304. /*! exports provided: render, staticRenderFns */
  44305. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44306. "use strict";
  44307. __webpack_require__.r(__webpack_exports__);
  44308. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44309. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44310. var render = function() {
  44311. var _vm = this
  44312. var _h = _vm.$createElement
  44313. var _c = _vm._self._c || _h
  44314. return _c(
  44315. "div",
  44316. [
  44317. _c("woinfo-edit-modal", {
  44318. attrs: {
  44319. "modal-id": "workordereditModal",
  44320. "populate-with": this.data,
  44321. "store-list": this.storeList
  44322. }
  44323. }),
  44324. _vm._v(" "),
  44325. _c("p", [
  44326. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  44327. _vm._v(" "),
  44328. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  44329. ]),
  44330. _vm._v(" "),
  44331. _c("p", [
  44332. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  44333. _vm._v(" "),
  44334. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  44335. ]),
  44336. _vm._v(" "),
  44337. _c("p", [
  44338. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  44339. _vm._v(" "),
  44340. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  44341. ]),
  44342. _vm._v(" "),
  44343. _c("p", [
  44344. _c("i", { staticClass: "fas fa-fw fa-building" }),
  44345. _vm._v(" "),
  44346. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.data.storeid]))])
  44347. ]),
  44348. _vm._v(" "),
  44349. _c("p", [
  44350. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  44351. _vm._v(" "),
  44352. _c(
  44353. "span",
  44354. {
  44355. staticClass: "dashed-underline",
  44356. attrs: {
  44357. "data-toggle": "tooltip",
  44358. "data-placement": "bottom",
  44359. title: this.getHRDate(this.data.dropdate)
  44360. }
  44361. },
  44362. [
  44363. _vm._v(
  44364. "\n " +
  44365. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  44366. " days ago\n "
  44367. )
  44368. ]
  44369. )
  44370. ]),
  44371. _vm._v(" "),
  44372. _c("p", [
  44373. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44374. _vm._v(" "),
  44375. !this.isZero(this.data.pickupdate)
  44376. ? _c(
  44377. "span",
  44378. {
  44379. staticClass: "dashed-underline",
  44380. attrs: {
  44381. "data-toggle": "tooltip",
  44382. "data-placement": "bottom",
  44383. title: this.getHRDate(this.data.pickupdate)
  44384. }
  44385. },
  44386. [
  44387. _vm._v(
  44388. "\n " +
  44389. _vm._s(
  44390. Math.floor(this.daysSinceToday(this.data.pickupdate))
  44391. ) +
  44392. " days ago\n "
  44393. )
  44394. ]
  44395. )
  44396. : _vm._e()
  44397. ]),
  44398. _vm._v(" "),
  44399. _c(
  44400. "button",
  44401. {
  44402. staticClass: "btn btn-primary",
  44403. attrs: {
  44404. type: "button",
  44405. "data-toggle": "modal",
  44406. "data-target": "#workordereditModal"
  44407. }
  44408. },
  44409. [_vm._v("Edit")]
  44410. )
  44411. ],
  44412. 1
  44413. )
  44414. }
  44415. var staticRenderFns = []
  44416. render._withStripped = true
  44417. /***/ }),
  44418. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  44419. /*!********************************************************************!*\
  44420. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  44421. \********************************************************************/
  44422. /*! exports provided: default */
  44423. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44424. "use strict";
  44425. __webpack_require__.r(__webpack_exports__);
  44426. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  44427. /* globals __VUE_SSR_CONTEXT__ */
  44428. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  44429. // This module is a runtime utility for cleaner component module output and will
  44430. // be included in the final webpack user bundle.
  44431. function normalizeComponent (
  44432. scriptExports,
  44433. render,
  44434. staticRenderFns,
  44435. functionalTemplate,
  44436. injectStyles,
  44437. scopeId,
  44438. moduleIdentifier, /* server only */
  44439. shadowMode /* vue-cli only */
  44440. ) {
  44441. // Vue.extend constructor export interop
  44442. var options = typeof scriptExports === 'function'
  44443. ? scriptExports.options
  44444. : scriptExports
  44445. // render functions
  44446. if (render) {
  44447. options.render = render
  44448. options.staticRenderFns = staticRenderFns
  44449. options._compiled = true
  44450. }
  44451. // functional template
  44452. if (functionalTemplate) {
  44453. options.functional = true
  44454. }
  44455. // scopedId
  44456. if (scopeId) {
  44457. options._scopeId = 'data-v-' + scopeId
  44458. }
  44459. var hook
  44460. if (moduleIdentifier) { // server build
  44461. hook = function (context) {
  44462. // 2.3 injection
  44463. context =
  44464. context || // cached call
  44465. (this.$vnode && this.$vnode.ssrContext) || // stateful
  44466. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  44467. // 2.2 with runInNewContext: true
  44468. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  44469. context = __VUE_SSR_CONTEXT__
  44470. }
  44471. // inject component styles
  44472. if (injectStyles) {
  44473. injectStyles.call(this, context)
  44474. }
  44475. // register component module identifier for async chunk inferrence
  44476. if (context && context._registeredComponents) {
  44477. context._registeredComponents.add(moduleIdentifier)
  44478. }
  44479. }
  44480. // used by ssr in case component is cached and beforeCreate
  44481. // never gets called
  44482. options._ssrRegister = hook
  44483. } else if (injectStyles) {
  44484. hook = shadowMode
  44485. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44486. : injectStyles
  44487. }
  44488. if (hook) {
  44489. if (options.functional) {
  44490. // for template-only hot-reload because in that case the render fn doesn't
  44491. // go through the normalizer
  44492. options._injectStyles = hook
  44493. // register for functioal component in vue file
  44494. var originalRender = options.render
  44495. options.render = function renderWithStyleInjection (h, context) {
  44496. hook.call(context)
  44497. return originalRender(h, context)
  44498. }
  44499. } else {
  44500. // inject component registration as beforeCreate hook
  44501. var existing = options.beforeCreate
  44502. options.beforeCreate = existing
  44503. ? [].concat(existing, hook)
  44504. : [hook]
  44505. }
  44506. }
  44507. return {
  44508. exports: scriptExports,
  44509. options: options
  44510. }
  44511. }
  44512. /***/ }),
  44513. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  44514. /*!*************************************************!*\
  44515. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44516. \*************************************************/
  44517. /*! no static exports found */
  44518. /***/ (function(module, exports, __webpack_require__) {
  44519. "use strict";
  44520. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44521. * Vue.js v2.6.11
  44522. * (c) 2014-2019 Evan You
  44523. * Released under the MIT License.
  44524. */
  44525. /* */
  44526. var emptyObject = Object.freeze({});
  44527. // These helpers produce better VM code in JS engines due to their
  44528. // explicitness and function inlining.
  44529. function isUndef (v) {
  44530. return v === undefined || v === null
  44531. }
  44532. function isDef (v) {
  44533. return v !== undefined && v !== null
  44534. }
  44535. function isTrue (v) {
  44536. return v === true
  44537. }
  44538. function isFalse (v) {
  44539. return v === false
  44540. }
  44541. /**
  44542. * Check if value is primitive.
  44543. */
  44544. function isPrimitive (value) {
  44545. return (
  44546. typeof value === 'string' ||
  44547. typeof value === 'number' ||
  44548. // $flow-disable-line
  44549. typeof value === 'symbol' ||
  44550. typeof value === 'boolean'
  44551. )
  44552. }
  44553. /**
  44554. * Quick object check - this is primarily used to tell
  44555. * Objects from primitive values when we know the value
  44556. * is a JSON-compliant type.
  44557. */
  44558. function isObject (obj) {
  44559. return obj !== null && typeof obj === 'object'
  44560. }
  44561. /**
  44562. * Get the raw type string of a value, e.g., [object Object].
  44563. */
  44564. var _toString = Object.prototype.toString;
  44565. function toRawType (value) {
  44566. return _toString.call(value).slice(8, -1)
  44567. }
  44568. /**
  44569. * Strict object type check. Only returns true
  44570. * for plain JavaScript objects.
  44571. */
  44572. function isPlainObject (obj) {
  44573. return _toString.call(obj) === '[object Object]'
  44574. }
  44575. function isRegExp (v) {
  44576. return _toString.call(v) === '[object RegExp]'
  44577. }
  44578. /**
  44579. * Check if val is a valid array index.
  44580. */
  44581. function isValidArrayIndex (val) {
  44582. var n = parseFloat(String(val));
  44583. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44584. }
  44585. function isPromise (val) {
  44586. return (
  44587. isDef(val) &&
  44588. typeof val.then === 'function' &&
  44589. typeof val.catch === 'function'
  44590. )
  44591. }
  44592. /**
  44593. * Convert a value to a string that is actually rendered.
  44594. */
  44595. function toString (val) {
  44596. return val == null
  44597. ? ''
  44598. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44599. ? JSON.stringify(val, null, 2)
  44600. : String(val)
  44601. }
  44602. /**
  44603. * Convert an input value to a number for persistence.
  44604. * If the conversion fails, return original string.
  44605. */
  44606. function toNumber (val) {
  44607. var n = parseFloat(val);
  44608. return isNaN(n) ? val : n
  44609. }
  44610. /**
  44611. * Make a map and return a function for checking if a key
  44612. * is in that map.
  44613. */
  44614. function makeMap (
  44615. str,
  44616. expectsLowerCase
  44617. ) {
  44618. var map = Object.create(null);
  44619. var list = str.split(',');
  44620. for (var i = 0; i < list.length; i++) {
  44621. map[list[i]] = true;
  44622. }
  44623. return expectsLowerCase
  44624. ? function (val) { return map[val.toLowerCase()]; }
  44625. : function (val) { return map[val]; }
  44626. }
  44627. /**
  44628. * Check if a tag is a built-in tag.
  44629. */
  44630. var isBuiltInTag = makeMap('slot,component', true);
  44631. /**
  44632. * Check if an attribute is a reserved attribute.
  44633. */
  44634. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44635. /**
  44636. * Remove an item from an array.
  44637. */
  44638. function remove (arr, item) {
  44639. if (arr.length) {
  44640. var index = arr.indexOf(item);
  44641. if (index > -1) {
  44642. return arr.splice(index, 1)
  44643. }
  44644. }
  44645. }
  44646. /**
  44647. * Check whether an object has the property.
  44648. */
  44649. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44650. function hasOwn (obj, key) {
  44651. return hasOwnProperty.call(obj, key)
  44652. }
  44653. /**
  44654. * Create a cached version of a pure function.
  44655. */
  44656. function cached (fn) {
  44657. var cache = Object.create(null);
  44658. return (function cachedFn (str) {
  44659. var hit = cache[str];
  44660. return hit || (cache[str] = fn(str))
  44661. })
  44662. }
  44663. /**
  44664. * Camelize a hyphen-delimited string.
  44665. */
  44666. var camelizeRE = /-(\w)/g;
  44667. var camelize = cached(function (str) {
  44668. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44669. });
  44670. /**
  44671. * Capitalize a string.
  44672. */
  44673. var capitalize = cached(function (str) {
  44674. return str.charAt(0).toUpperCase() + str.slice(1)
  44675. });
  44676. /**
  44677. * Hyphenate a camelCase string.
  44678. */
  44679. var hyphenateRE = /\B([A-Z])/g;
  44680. var hyphenate = cached(function (str) {
  44681. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44682. });
  44683. /**
  44684. * Simple bind polyfill for environments that do not support it,
  44685. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44686. * since native bind is now performant enough in most browsers.
  44687. * But removing it would mean breaking code that was able to run in
  44688. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44689. */
  44690. /* istanbul ignore next */
  44691. function polyfillBind (fn, ctx) {
  44692. function boundFn (a) {
  44693. var l = arguments.length;
  44694. return l
  44695. ? l > 1
  44696. ? fn.apply(ctx, arguments)
  44697. : fn.call(ctx, a)
  44698. : fn.call(ctx)
  44699. }
  44700. boundFn._length = fn.length;
  44701. return boundFn
  44702. }
  44703. function nativeBind (fn, ctx) {
  44704. return fn.bind(ctx)
  44705. }
  44706. var bind = Function.prototype.bind
  44707. ? nativeBind
  44708. : polyfillBind;
  44709. /**
  44710. * Convert an Array-like object to a real Array.
  44711. */
  44712. function toArray (list, start) {
  44713. start = start || 0;
  44714. var i = list.length - start;
  44715. var ret = new Array(i);
  44716. while (i--) {
  44717. ret[i] = list[i + start];
  44718. }
  44719. return ret
  44720. }
  44721. /**
  44722. * Mix properties into target object.
  44723. */
  44724. function extend (to, _from) {
  44725. for (var key in _from) {
  44726. to[key] = _from[key];
  44727. }
  44728. return to
  44729. }
  44730. /**
  44731. * Merge an Array of Objects into a single Object.
  44732. */
  44733. function toObject (arr) {
  44734. var res = {};
  44735. for (var i = 0; i < arr.length; i++) {
  44736. if (arr[i]) {
  44737. extend(res, arr[i]);
  44738. }
  44739. }
  44740. return res
  44741. }
  44742. /* eslint-disable no-unused-vars */
  44743. /**
  44744. * Perform no operation.
  44745. * Stubbing args to make Flow happy without leaving useless transpiled code
  44746. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44747. */
  44748. function noop (a, b, c) {}
  44749. /**
  44750. * Always return false.
  44751. */
  44752. var no = function (a, b, c) { return false; };
  44753. /* eslint-enable no-unused-vars */
  44754. /**
  44755. * Return the same value.
  44756. */
  44757. var identity = function (_) { return _; };
  44758. /**
  44759. * Generate a string containing static keys from compiler modules.
  44760. */
  44761. function genStaticKeys (modules) {
  44762. return modules.reduce(function (keys, m) {
  44763. return keys.concat(m.staticKeys || [])
  44764. }, []).join(',')
  44765. }
  44766. /**
  44767. * Check if two values are loosely equal - that is,
  44768. * if they are plain objects, do they have the same shape?
  44769. */
  44770. function looseEqual (a, b) {
  44771. if (a === b) { return true }
  44772. var isObjectA = isObject(a);
  44773. var isObjectB = isObject(b);
  44774. if (isObjectA && isObjectB) {
  44775. try {
  44776. var isArrayA = Array.isArray(a);
  44777. var isArrayB = Array.isArray(b);
  44778. if (isArrayA && isArrayB) {
  44779. return a.length === b.length && a.every(function (e, i) {
  44780. return looseEqual(e, b[i])
  44781. })
  44782. } else if (a instanceof Date && b instanceof Date) {
  44783. return a.getTime() === b.getTime()
  44784. } else if (!isArrayA && !isArrayB) {
  44785. var keysA = Object.keys(a);
  44786. var keysB = Object.keys(b);
  44787. return keysA.length === keysB.length && keysA.every(function (key) {
  44788. return looseEqual(a[key], b[key])
  44789. })
  44790. } else {
  44791. /* istanbul ignore next */
  44792. return false
  44793. }
  44794. } catch (e) {
  44795. /* istanbul ignore next */
  44796. return false
  44797. }
  44798. } else if (!isObjectA && !isObjectB) {
  44799. return String(a) === String(b)
  44800. } else {
  44801. return false
  44802. }
  44803. }
  44804. /**
  44805. * Return the first index at which a loosely equal value can be
  44806. * found in the array (if value is a plain object, the array must
  44807. * contain an object of the same shape), or -1 if it is not present.
  44808. */
  44809. function looseIndexOf (arr, val) {
  44810. for (var i = 0; i < arr.length; i++) {
  44811. if (looseEqual(arr[i], val)) { return i }
  44812. }
  44813. return -1
  44814. }
  44815. /**
  44816. * Ensure a function is called only once.
  44817. */
  44818. function once (fn) {
  44819. var called = false;
  44820. return function () {
  44821. if (!called) {
  44822. called = true;
  44823. fn.apply(this, arguments);
  44824. }
  44825. }
  44826. }
  44827. var SSR_ATTR = 'data-server-rendered';
  44828. var ASSET_TYPES = [
  44829. 'component',
  44830. 'directive',
  44831. 'filter'
  44832. ];
  44833. var LIFECYCLE_HOOKS = [
  44834. 'beforeCreate',
  44835. 'created',
  44836. 'beforeMount',
  44837. 'mounted',
  44838. 'beforeUpdate',
  44839. 'updated',
  44840. 'beforeDestroy',
  44841. 'destroyed',
  44842. 'activated',
  44843. 'deactivated',
  44844. 'errorCaptured',
  44845. 'serverPrefetch'
  44846. ];
  44847. /* */
  44848. var config = ({
  44849. /**
  44850. * Option merge strategies (used in core/util/options)
  44851. */
  44852. // $flow-disable-line
  44853. optionMergeStrategies: Object.create(null),
  44854. /**
  44855. * Whether to suppress warnings.
  44856. */
  44857. silent: false,
  44858. /**
  44859. * Show production mode tip message on boot?
  44860. */
  44861. productionTip: "development" !== 'production',
  44862. /**
  44863. * Whether to enable devtools
  44864. */
  44865. devtools: "development" !== 'production',
  44866. /**
  44867. * Whether to record perf
  44868. */
  44869. performance: false,
  44870. /**
  44871. * Error handler for watcher errors
  44872. */
  44873. errorHandler: null,
  44874. /**
  44875. * Warn handler for watcher warns
  44876. */
  44877. warnHandler: null,
  44878. /**
  44879. * Ignore certain custom elements
  44880. */
  44881. ignoredElements: [],
  44882. /**
  44883. * Custom user key aliases for v-on
  44884. */
  44885. // $flow-disable-line
  44886. keyCodes: Object.create(null),
  44887. /**
  44888. * Check if a tag is reserved so that it cannot be registered as a
  44889. * component. This is platform-dependent and may be overwritten.
  44890. */
  44891. isReservedTag: no,
  44892. /**
  44893. * Check if an attribute is reserved so that it cannot be used as a component
  44894. * prop. This is platform-dependent and may be overwritten.
  44895. */
  44896. isReservedAttr: no,
  44897. /**
  44898. * Check if a tag is an unknown element.
  44899. * Platform-dependent.
  44900. */
  44901. isUnknownElement: no,
  44902. /**
  44903. * Get the namespace of an element
  44904. */
  44905. getTagNamespace: noop,
  44906. /**
  44907. * Parse the real tag name for the specific platform.
  44908. */
  44909. parsePlatformTagName: identity,
  44910. /**
  44911. * Check if an attribute must be bound using property, e.g. value
  44912. * Platform-dependent.
  44913. */
  44914. mustUseProp: no,
  44915. /**
  44916. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  44917. * This will significantly reduce performance if set to false.
  44918. */
  44919. async: true,
  44920. /**
  44921. * Exposed for legacy reasons
  44922. */
  44923. _lifecycleHooks: LIFECYCLE_HOOKS
  44924. });
  44925. /* */
  44926. /**
  44927. * unicode letters used for parsing html tags, component names and property paths.
  44928. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  44929. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  44930. */
  44931. 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/;
  44932. /**
  44933. * Check if a string starts with $ or _
  44934. */
  44935. function isReserved (str) {
  44936. var c = (str + '').charCodeAt(0);
  44937. return c === 0x24 || c === 0x5F
  44938. }
  44939. /**
  44940. * Define a property.
  44941. */
  44942. function def (obj, key, val, enumerable) {
  44943. Object.defineProperty(obj, key, {
  44944. value: val,
  44945. enumerable: !!enumerable,
  44946. writable: true,
  44947. configurable: true
  44948. });
  44949. }
  44950. /**
  44951. * Parse simple path.
  44952. */
  44953. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  44954. function parsePath (path) {
  44955. if (bailRE.test(path)) {
  44956. return
  44957. }
  44958. var segments = path.split('.');
  44959. return function (obj) {
  44960. for (var i = 0; i < segments.length; i++) {
  44961. if (!obj) { return }
  44962. obj = obj[segments[i]];
  44963. }
  44964. return obj
  44965. }
  44966. }
  44967. /* */
  44968. // can we use __proto__?
  44969. var hasProto = '__proto__' in {};
  44970. // Browser environment sniffing
  44971. var inBrowser = typeof window !== 'undefined';
  44972. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  44973. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  44974. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  44975. var isIE = UA && /msie|trident/.test(UA);
  44976. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  44977. var isEdge = UA && UA.indexOf('edge/') > 0;
  44978. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  44979. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  44980. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  44981. var isPhantomJS = UA && /phantomjs/.test(UA);
  44982. var isFF = UA && UA.match(/firefox\/(\d+)/);
  44983. // Firefox has a "watch" function on Object.prototype...
  44984. var nativeWatch = ({}).watch;
  44985. var supportsPassive = false;
  44986. if (inBrowser) {
  44987. try {
  44988. var opts = {};
  44989. Object.defineProperty(opts, 'passive', ({
  44990. get: function get () {
  44991. /* istanbul ignore next */
  44992. supportsPassive = true;
  44993. }
  44994. })); // https://github.com/facebook/flow/issues/285
  44995. window.addEventListener('test-passive', null, opts);
  44996. } catch (e) {}
  44997. }
  44998. // this needs to be lazy-evaled because vue may be required before
  44999. // vue-server-renderer can set VUE_ENV
  45000. var _isServer;
  45001. var isServerRendering = function () {
  45002. if (_isServer === undefined) {
  45003. /* istanbul ignore if */
  45004. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  45005. // detect presence of vue-server-renderer and avoid
  45006. // Webpack shimming the process
  45007. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  45008. } else {
  45009. _isServer = false;
  45010. }
  45011. }
  45012. return _isServer
  45013. };
  45014. // detect devtools
  45015. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  45016. /* istanbul ignore next */
  45017. function isNative (Ctor) {
  45018. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  45019. }
  45020. var hasSymbol =
  45021. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  45022. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  45023. var _Set;
  45024. /* istanbul ignore if */ // $flow-disable-line
  45025. if (typeof Set !== 'undefined' && isNative(Set)) {
  45026. // use native Set when available.
  45027. _Set = Set;
  45028. } else {
  45029. // a non-standard Set polyfill that only works with primitive keys.
  45030. _Set = /*@__PURE__*/(function () {
  45031. function Set () {
  45032. this.set = Object.create(null);
  45033. }
  45034. Set.prototype.has = function has (key) {
  45035. return this.set[key] === true
  45036. };
  45037. Set.prototype.add = function add (key) {
  45038. this.set[key] = true;
  45039. };
  45040. Set.prototype.clear = function clear () {
  45041. this.set = Object.create(null);
  45042. };
  45043. return Set;
  45044. }());
  45045. }
  45046. /* */
  45047. var warn = noop;
  45048. var tip = noop;
  45049. var generateComponentTrace = (noop); // work around flow check
  45050. var formatComponentName = (noop);
  45051. {
  45052. var hasConsole = typeof console !== 'undefined';
  45053. var classifyRE = /(?:^|[-_])(\w)/g;
  45054. var classify = function (str) { return str
  45055. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  45056. .replace(/[-_]/g, ''); };
  45057. warn = function (msg, vm) {
  45058. var trace = vm ? generateComponentTrace(vm) : '';
  45059. if (config.warnHandler) {
  45060. config.warnHandler.call(null, msg, vm, trace);
  45061. } else if (hasConsole && (!config.silent)) {
  45062. console.error(("[Vue warn]: " + msg + trace));
  45063. }
  45064. };
  45065. tip = function (msg, vm) {
  45066. if (hasConsole && (!config.silent)) {
  45067. console.warn("[Vue tip]: " + msg + (
  45068. vm ? generateComponentTrace(vm) : ''
  45069. ));
  45070. }
  45071. };
  45072. formatComponentName = function (vm, includeFile) {
  45073. if (vm.$root === vm) {
  45074. return '<Root>'
  45075. }
  45076. var options = typeof vm === 'function' && vm.cid != null
  45077. ? vm.options
  45078. : vm._isVue
  45079. ? vm.$options || vm.constructor.options
  45080. : vm;
  45081. var name = options.name || options._componentTag;
  45082. var file = options.__file;
  45083. if (!name && file) {
  45084. var match = file.match(/([^/\\]+)\.vue$/);
  45085. name = match && match[1];
  45086. }
  45087. return (
  45088. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  45089. (file && includeFile !== false ? (" at " + file) : '')
  45090. )
  45091. };
  45092. var repeat = function (str, n) {
  45093. var res = '';
  45094. while (n) {
  45095. if (n % 2 === 1) { res += str; }
  45096. if (n > 1) { str += str; }
  45097. n >>= 1;
  45098. }
  45099. return res
  45100. };
  45101. generateComponentTrace = function (vm) {
  45102. if (vm._isVue && vm.$parent) {
  45103. var tree = [];
  45104. var currentRecursiveSequence = 0;
  45105. while (vm) {
  45106. if (tree.length > 0) {
  45107. var last = tree[tree.length - 1];
  45108. if (last.constructor === vm.constructor) {
  45109. currentRecursiveSequence++;
  45110. vm = vm.$parent;
  45111. continue
  45112. } else if (currentRecursiveSequence > 0) {
  45113. tree[tree.length - 1] = [last, currentRecursiveSequence];
  45114. currentRecursiveSequence = 0;
  45115. }
  45116. }
  45117. tree.push(vm);
  45118. vm = vm.$parent;
  45119. }
  45120. return '\n\nfound in\n\n' + tree
  45121. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  45122. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  45123. : formatComponentName(vm))); })
  45124. .join('\n')
  45125. } else {
  45126. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  45127. }
  45128. };
  45129. }
  45130. /* */
  45131. var uid = 0;
  45132. /**
  45133. * A dep is an observable that can have multiple
  45134. * directives subscribing to it.
  45135. */
  45136. var Dep = function Dep () {
  45137. this.id = uid++;
  45138. this.subs = [];
  45139. };
  45140. Dep.prototype.addSub = function addSub (sub) {
  45141. this.subs.push(sub);
  45142. };
  45143. Dep.prototype.removeSub = function removeSub (sub) {
  45144. remove(this.subs, sub);
  45145. };
  45146. Dep.prototype.depend = function depend () {
  45147. if (Dep.target) {
  45148. Dep.target.addDep(this);
  45149. }
  45150. };
  45151. Dep.prototype.notify = function notify () {
  45152. // stabilize the subscriber list first
  45153. var subs = this.subs.slice();
  45154. if (!config.async) {
  45155. // subs aren't sorted in scheduler if not running async
  45156. // we need to sort them now to make sure they fire in correct
  45157. // order
  45158. subs.sort(function (a, b) { return a.id - b.id; });
  45159. }
  45160. for (var i = 0, l = subs.length; i < l; i++) {
  45161. subs[i].update();
  45162. }
  45163. };
  45164. // The current target watcher being evaluated.
  45165. // This is globally unique because only one watcher
  45166. // can be evaluated at a time.
  45167. Dep.target = null;
  45168. var targetStack = [];
  45169. function pushTarget (target) {
  45170. targetStack.push(target);
  45171. Dep.target = target;
  45172. }
  45173. function popTarget () {
  45174. targetStack.pop();
  45175. Dep.target = targetStack[targetStack.length - 1];
  45176. }
  45177. /* */
  45178. var VNode = function VNode (
  45179. tag,
  45180. data,
  45181. children,
  45182. text,
  45183. elm,
  45184. context,
  45185. componentOptions,
  45186. asyncFactory
  45187. ) {
  45188. this.tag = tag;
  45189. this.data = data;
  45190. this.children = children;
  45191. this.text = text;
  45192. this.elm = elm;
  45193. this.ns = undefined;
  45194. this.context = context;
  45195. this.fnContext = undefined;
  45196. this.fnOptions = undefined;
  45197. this.fnScopeId = undefined;
  45198. this.key = data && data.key;
  45199. this.componentOptions = componentOptions;
  45200. this.componentInstance = undefined;
  45201. this.parent = undefined;
  45202. this.raw = false;
  45203. this.isStatic = false;
  45204. this.isRootInsert = true;
  45205. this.isComment = false;
  45206. this.isCloned = false;
  45207. this.isOnce = false;
  45208. this.asyncFactory = asyncFactory;
  45209. this.asyncMeta = undefined;
  45210. this.isAsyncPlaceholder = false;
  45211. };
  45212. var prototypeAccessors = { child: { configurable: true } };
  45213. // DEPRECATED: alias for componentInstance for backwards compat.
  45214. /* istanbul ignore next */
  45215. prototypeAccessors.child.get = function () {
  45216. return this.componentInstance
  45217. };
  45218. Object.defineProperties( VNode.prototype, prototypeAccessors );
  45219. var createEmptyVNode = function (text) {
  45220. if ( text === void 0 ) text = '';
  45221. var node = new VNode();
  45222. node.text = text;
  45223. node.isComment = true;
  45224. return node
  45225. };
  45226. function createTextVNode (val) {
  45227. return new VNode(undefined, undefined, undefined, String(val))
  45228. }
  45229. // optimized shallow clone
  45230. // used for static nodes and slot nodes because they may be reused across
  45231. // multiple renders, cloning them avoids errors when DOM manipulations rely
  45232. // on their elm reference.
  45233. function cloneVNode (vnode) {
  45234. var cloned = new VNode(
  45235. vnode.tag,
  45236. vnode.data,
  45237. // #7975
  45238. // clone children array to avoid mutating original in case of cloning
  45239. // a child.
  45240. vnode.children && vnode.children.slice(),
  45241. vnode.text,
  45242. vnode.elm,
  45243. vnode.context,
  45244. vnode.componentOptions,
  45245. vnode.asyncFactory
  45246. );
  45247. cloned.ns = vnode.ns;
  45248. cloned.isStatic = vnode.isStatic;
  45249. cloned.key = vnode.key;
  45250. cloned.isComment = vnode.isComment;
  45251. cloned.fnContext = vnode.fnContext;
  45252. cloned.fnOptions = vnode.fnOptions;
  45253. cloned.fnScopeId = vnode.fnScopeId;
  45254. cloned.asyncMeta = vnode.asyncMeta;
  45255. cloned.isCloned = true;
  45256. return cloned
  45257. }
  45258. /*
  45259. * not type checking this file because flow doesn't play well with
  45260. * dynamically accessing methods on Array prototype
  45261. */
  45262. var arrayProto = Array.prototype;
  45263. var arrayMethods = Object.create(arrayProto);
  45264. var methodsToPatch = [
  45265. 'push',
  45266. 'pop',
  45267. 'shift',
  45268. 'unshift',
  45269. 'splice',
  45270. 'sort',
  45271. 'reverse'
  45272. ];
  45273. /**
  45274. * Intercept mutating methods and emit events
  45275. */
  45276. methodsToPatch.forEach(function (method) {
  45277. // cache original method
  45278. var original = arrayProto[method];
  45279. def(arrayMethods, method, function mutator () {
  45280. var args = [], len = arguments.length;
  45281. while ( len-- ) args[ len ] = arguments[ len ];
  45282. var result = original.apply(this, args);
  45283. var ob = this.__ob__;
  45284. var inserted;
  45285. switch (method) {
  45286. case 'push':
  45287. case 'unshift':
  45288. inserted = args;
  45289. break
  45290. case 'splice':
  45291. inserted = args.slice(2);
  45292. break
  45293. }
  45294. if (inserted) { ob.observeArray(inserted); }
  45295. // notify change
  45296. ob.dep.notify();
  45297. return result
  45298. });
  45299. });
  45300. /* */
  45301. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  45302. /**
  45303. * In some cases we may want to disable observation inside a component's
  45304. * update computation.
  45305. */
  45306. var shouldObserve = true;
  45307. function toggleObserving (value) {
  45308. shouldObserve = value;
  45309. }
  45310. /**
  45311. * Observer class that is attached to each observed
  45312. * object. Once attached, the observer converts the target
  45313. * object's property keys into getter/setters that
  45314. * collect dependencies and dispatch updates.
  45315. */
  45316. var Observer = function Observer (value) {
  45317. this.value = value;
  45318. this.dep = new Dep();
  45319. this.vmCount = 0;
  45320. def(value, '__ob__', this);
  45321. if (Array.isArray(value)) {
  45322. if (hasProto) {
  45323. protoAugment(value, arrayMethods);
  45324. } else {
  45325. copyAugment(value, arrayMethods, arrayKeys);
  45326. }
  45327. this.observeArray(value);
  45328. } else {
  45329. this.walk(value);
  45330. }
  45331. };
  45332. /**
  45333. * Walk through all properties and convert them into
  45334. * getter/setters. This method should only be called when
  45335. * value type is Object.
  45336. */
  45337. Observer.prototype.walk = function walk (obj) {
  45338. var keys = Object.keys(obj);
  45339. for (var i = 0; i < keys.length; i++) {
  45340. defineReactive$$1(obj, keys[i]);
  45341. }
  45342. };
  45343. /**
  45344. * Observe a list of Array items.
  45345. */
  45346. Observer.prototype.observeArray = function observeArray (items) {
  45347. for (var i = 0, l = items.length; i < l; i++) {
  45348. observe(items[i]);
  45349. }
  45350. };
  45351. // helpers
  45352. /**
  45353. * Augment a target Object or Array by intercepting
  45354. * the prototype chain using __proto__
  45355. */
  45356. function protoAugment (target, src) {
  45357. /* eslint-disable no-proto */
  45358. target.__proto__ = src;
  45359. /* eslint-enable no-proto */
  45360. }
  45361. /**
  45362. * Augment a target Object or Array by defining
  45363. * hidden properties.
  45364. */
  45365. /* istanbul ignore next */
  45366. function copyAugment (target, src, keys) {
  45367. for (var i = 0, l = keys.length; i < l; i++) {
  45368. var key = keys[i];
  45369. def(target, key, src[key]);
  45370. }
  45371. }
  45372. /**
  45373. * Attempt to create an observer instance for a value,
  45374. * returns the new observer if successfully observed,
  45375. * or the existing observer if the value already has one.
  45376. */
  45377. function observe (value, asRootData) {
  45378. if (!isObject(value) || value instanceof VNode) {
  45379. return
  45380. }
  45381. var ob;
  45382. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  45383. ob = value.__ob__;
  45384. } else if (
  45385. shouldObserve &&
  45386. !isServerRendering() &&
  45387. (Array.isArray(value) || isPlainObject(value)) &&
  45388. Object.isExtensible(value) &&
  45389. !value._isVue
  45390. ) {
  45391. ob = new Observer(value);
  45392. }
  45393. if (asRootData && ob) {
  45394. ob.vmCount++;
  45395. }
  45396. return ob
  45397. }
  45398. /**
  45399. * Define a reactive property on an Object.
  45400. */
  45401. function defineReactive$$1 (
  45402. obj,
  45403. key,
  45404. val,
  45405. customSetter,
  45406. shallow
  45407. ) {
  45408. var dep = new Dep();
  45409. var property = Object.getOwnPropertyDescriptor(obj, key);
  45410. if (property && property.configurable === false) {
  45411. return
  45412. }
  45413. // cater for pre-defined getter/setters
  45414. var getter = property && property.get;
  45415. var setter = property && property.set;
  45416. if ((!getter || setter) && arguments.length === 2) {
  45417. val = obj[key];
  45418. }
  45419. var childOb = !shallow && observe(val);
  45420. Object.defineProperty(obj, key, {
  45421. enumerable: true,
  45422. configurable: true,
  45423. get: function reactiveGetter () {
  45424. var value = getter ? getter.call(obj) : val;
  45425. if (Dep.target) {
  45426. dep.depend();
  45427. if (childOb) {
  45428. childOb.dep.depend();
  45429. if (Array.isArray(value)) {
  45430. dependArray(value);
  45431. }
  45432. }
  45433. }
  45434. return value
  45435. },
  45436. set: function reactiveSetter (newVal) {
  45437. var value = getter ? getter.call(obj) : val;
  45438. /* eslint-disable no-self-compare */
  45439. if (newVal === value || (newVal !== newVal && value !== value)) {
  45440. return
  45441. }
  45442. /* eslint-enable no-self-compare */
  45443. if (customSetter) {
  45444. customSetter();
  45445. }
  45446. // #7981: for accessor properties without setter
  45447. if (getter && !setter) { return }
  45448. if (setter) {
  45449. setter.call(obj, newVal);
  45450. } else {
  45451. val = newVal;
  45452. }
  45453. childOb = !shallow && observe(newVal);
  45454. dep.notify();
  45455. }
  45456. });
  45457. }
  45458. /**
  45459. * Set a property on an object. Adds the new property and
  45460. * triggers change notification if the property doesn't
  45461. * already exist.
  45462. */
  45463. function set (target, key, val) {
  45464. if (isUndef(target) || isPrimitive(target)
  45465. ) {
  45466. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  45467. }
  45468. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45469. target.length = Math.max(target.length, key);
  45470. target.splice(key, 1, val);
  45471. return val
  45472. }
  45473. if (key in target && !(key in Object.prototype)) {
  45474. target[key] = val;
  45475. return val
  45476. }
  45477. var ob = (target).__ob__;
  45478. if (target._isVue || (ob && ob.vmCount)) {
  45479. warn(
  45480. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  45481. 'at runtime - declare it upfront in the data option.'
  45482. );
  45483. return val
  45484. }
  45485. if (!ob) {
  45486. target[key] = val;
  45487. return val
  45488. }
  45489. defineReactive$$1(ob.value, key, val);
  45490. ob.dep.notify();
  45491. return val
  45492. }
  45493. /**
  45494. * Delete a property and trigger change if necessary.
  45495. */
  45496. function del (target, key) {
  45497. if (isUndef(target) || isPrimitive(target)
  45498. ) {
  45499. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  45500. }
  45501. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45502. target.splice(key, 1);
  45503. return
  45504. }
  45505. var ob = (target).__ob__;
  45506. if (target._isVue || (ob && ob.vmCount)) {
  45507. warn(
  45508. 'Avoid deleting properties on a Vue instance or its root $data ' +
  45509. '- just set it to null.'
  45510. );
  45511. return
  45512. }
  45513. if (!hasOwn(target, key)) {
  45514. return
  45515. }
  45516. delete target[key];
  45517. if (!ob) {
  45518. return
  45519. }
  45520. ob.dep.notify();
  45521. }
  45522. /**
  45523. * Collect dependencies on array elements when the array is touched, since
  45524. * we cannot intercept array element access like property getters.
  45525. */
  45526. function dependArray (value) {
  45527. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45528. e = value[i];
  45529. e && e.__ob__ && e.__ob__.dep.depend();
  45530. if (Array.isArray(e)) {
  45531. dependArray(e);
  45532. }
  45533. }
  45534. }
  45535. /* */
  45536. /**
  45537. * Option overwriting strategies are functions that handle
  45538. * how to merge a parent option value and a child option
  45539. * value into the final value.
  45540. */
  45541. var strats = config.optionMergeStrategies;
  45542. /**
  45543. * Options with restrictions
  45544. */
  45545. {
  45546. strats.el = strats.propsData = function (parent, child, vm, key) {
  45547. if (!vm) {
  45548. warn(
  45549. "option \"" + key + "\" can only be used during instance " +
  45550. 'creation with the `new` keyword.'
  45551. );
  45552. }
  45553. return defaultStrat(parent, child)
  45554. };
  45555. }
  45556. /**
  45557. * Helper that recursively merges two data objects together.
  45558. */
  45559. function mergeData (to, from) {
  45560. if (!from) { return to }
  45561. var key, toVal, fromVal;
  45562. var keys = hasSymbol
  45563. ? Reflect.ownKeys(from)
  45564. : Object.keys(from);
  45565. for (var i = 0; i < keys.length; i++) {
  45566. key = keys[i];
  45567. // in case the object is already observed...
  45568. if (key === '__ob__') { continue }
  45569. toVal = to[key];
  45570. fromVal = from[key];
  45571. if (!hasOwn(to, key)) {
  45572. set(to, key, fromVal);
  45573. } else if (
  45574. toVal !== fromVal &&
  45575. isPlainObject(toVal) &&
  45576. isPlainObject(fromVal)
  45577. ) {
  45578. mergeData(toVal, fromVal);
  45579. }
  45580. }
  45581. return to
  45582. }
  45583. /**
  45584. * Data
  45585. */
  45586. function mergeDataOrFn (
  45587. parentVal,
  45588. childVal,
  45589. vm
  45590. ) {
  45591. if (!vm) {
  45592. // in a Vue.extend merge, both should be functions
  45593. if (!childVal) {
  45594. return parentVal
  45595. }
  45596. if (!parentVal) {
  45597. return childVal
  45598. }
  45599. // when parentVal & childVal are both present,
  45600. // we need to return a function that returns the
  45601. // merged result of both functions... no need to
  45602. // check if parentVal is a function here because
  45603. // it has to be a function to pass previous merges.
  45604. return function mergedDataFn () {
  45605. return mergeData(
  45606. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45607. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45608. )
  45609. }
  45610. } else {
  45611. return function mergedInstanceDataFn () {
  45612. // instance merge
  45613. var instanceData = typeof childVal === 'function'
  45614. ? childVal.call(vm, vm)
  45615. : childVal;
  45616. var defaultData = typeof parentVal === 'function'
  45617. ? parentVal.call(vm, vm)
  45618. : parentVal;
  45619. if (instanceData) {
  45620. return mergeData(instanceData, defaultData)
  45621. } else {
  45622. return defaultData
  45623. }
  45624. }
  45625. }
  45626. }
  45627. strats.data = function (
  45628. parentVal,
  45629. childVal,
  45630. vm
  45631. ) {
  45632. if (!vm) {
  45633. if (childVal && typeof childVal !== 'function') {
  45634. warn(
  45635. 'The "data" option should be a function ' +
  45636. 'that returns a per-instance value in component ' +
  45637. 'definitions.',
  45638. vm
  45639. );
  45640. return parentVal
  45641. }
  45642. return mergeDataOrFn(parentVal, childVal)
  45643. }
  45644. return mergeDataOrFn(parentVal, childVal, vm)
  45645. };
  45646. /**
  45647. * Hooks and props are merged as arrays.
  45648. */
  45649. function mergeHook (
  45650. parentVal,
  45651. childVal
  45652. ) {
  45653. var res = childVal
  45654. ? parentVal
  45655. ? parentVal.concat(childVal)
  45656. : Array.isArray(childVal)
  45657. ? childVal
  45658. : [childVal]
  45659. : parentVal;
  45660. return res
  45661. ? dedupeHooks(res)
  45662. : res
  45663. }
  45664. function dedupeHooks (hooks) {
  45665. var res = [];
  45666. for (var i = 0; i < hooks.length; i++) {
  45667. if (res.indexOf(hooks[i]) === -1) {
  45668. res.push(hooks[i]);
  45669. }
  45670. }
  45671. return res
  45672. }
  45673. LIFECYCLE_HOOKS.forEach(function (hook) {
  45674. strats[hook] = mergeHook;
  45675. });
  45676. /**
  45677. * Assets
  45678. *
  45679. * When a vm is present (instance creation), we need to do
  45680. * a three-way merge between constructor options, instance
  45681. * options and parent options.
  45682. */
  45683. function mergeAssets (
  45684. parentVal,
  45685. childVal,
  45686. vm,
  45687. key
  45688. ) {
  45689. var res = Object.create(parentVal || null);
  45690. if (childVal) {
  45691. assertObjectType(key, childVal, vm);
  45692. return extend(res, childVal)
  45693. } else {
  45694. return res
  45695. }
  45696. }
  45697. ASSET_TYPES.forEach(function (type) {
  45698. strats[type + 's'] = mergeAssets;
  45699. });
  45700. /**
  45701. * Watchers.
  45702. *
  45703. * Watchers hashes should not overwrite one
  45704. * another, so we merge them as arrays.
  45705. */
  45706. strats.watch = function (
  45707. parentVal,
  45708. childVal,
  45709. vm,
  45710. key
  45711. ) {
  45712. // work around Firefox's Object.prototype.watch...
  45713. if (parentVal === nativeWatch) { parentVal = undefined; }
  45714. if (childVal === nativeWatch) { childVal = undefined; }
  45715. /* istanbul ignore if */
  45716. if (!childVal) { return Object.create(parentVal || null) }
  45717. {
  45718. assertObjectType(key, childVal, vm);
  45719. }
  45720. if (!parentVal) { return childVal }
  45721. var ret = {};
  45722. extend(ret, parentVal);
  45723. for (var key$1 in childVal) {
  45724. var parent = ret[key$1];
  45725. var child = childVal[key$1];
  45726. if (parent && !Array.isArray(parent)) {
  45727. parent = [parent];
  45728. }
  45729. ret[key$1] = parent
  45730. ? parent.concat(child)
  45731. : Array.isArray(child) ? child : [child];
  45732. }
  45733. return ret
  45734. };
  45735. /**
  45736. * Other object hashes.
  45737. */
  45738. strats.props =
  45739. strats.methods =
  45740. strats.inject =
  45741. strats.computed = function (
  45742. parentVal,
  45743. childVal,
  45744. vm,
  45745. key
  45746. ) {
  45747. if (childVal && "development" !== 'production') {
  45748. assertObjectType(key, childVal, vm);
  45749. }
  45750. if (!parentVal) { return childVal }
  45751. var ret = Object.create(null);
  45752. extend(ret, parentVal);
  45753. if (childVal) { extend(ret, childVal); }
  45754. return ret
  45755. };
  45756. strats.provide = mergeDataOrFn;
  45757. /**
  45758. * Default strategy.
  45759. */
  45760. var defaultStrat = function (parentVal, childVal) {
  45761. return childVal === undefined
  45762. ? parentVal
  45763. : childVal
  45764. };
  45765. /**
  45766. * Validate component names
  45767. */
  45768. function checkComponents (options) {
  45769. for (var key in options.components) {
  45770. validateComponentName(key);
  45771. }
  45772. }
  45773. function validateComponentName (name) {
  45774. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45775. warn(
  45776. 'Invalid component name: "' + name + '". Component names ' +
  45777. 'should conform to valid custom element name in html5 specification.'
  45778. );
  45779. }
  45780. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  45781. warn(
  45782. 'Do not use built-in or reserved HTML elements as component ' +
  45783. 'id: ' + name
  45784. );
  45785. }
  45786. }
  45787. /**
  45788. * Ensure all props option syntax are normalized into the
  45789. * Object-based format.
  45790. */
  45791. function normalizeProps (options, vm) {
  45792. var props = options.props;
  45793. if (!props) { return }
  45794. var res = {};
  45795. var i, val, name;
  45796. if (Array.isArray(props)) {
  45797. i = props.length;
  45798. while (i--) {
  45799. val = props[i];
  45800. if (typeof val === 'string') {
  45801. name = camelize(val);
  45802. res[name] = { type: null };
  45803. } else {
  45804. warn('props must be strings when using array syntax.');
  45805. }
  45806. }
  45807. } else if (isPlainObject(props)) {
  45808. for (var key in props) {
  45809. val = props[key];
  45810. name = camelize(key);
  45811. res[name] = isPlainObject(val)
  45812. ? val
  45813. : { type: val };
  45814. }
  45815. } else {
  45816. warn(
  45817. "Invalid value for option \"props\": expected an Array or an Object, " +
  45818. "but got " + (toRawType(props)) + ".",
  45819. vm
  45820. );
  45821. }
  45822. options.props = res;
  45823. }
  45824. /**
  45825. * Normalize all injections into Object-based format
  45826. */
  45827. function normalizeInject (options, vm) {
  45828. var inject = options.inject;
  45829. if (!inject) { return }
  45830. var normalized = options.inject = {};
  45831. if (Array.isArray(inject)) {
  45832. for (var i = 0; i < inject.length; i++) {
  45833. normalized[inject[i]] = { from: inject[i] };
  45834. }
  45835. } else if (isPlainObject(inject)) {
  45836. for (var key in inject) {
  45837. var val = inject[key];
  45838. normalized[key] = isPlainObject(val)
  45839. ? extend({ from: key }, val)
  45840. : { from: val };
  45841. }
  45842. } else {
  45843. warn(
  45844. "Invalid value for option \"inject\": expected an Array or an Object, " +
  45845. "but got " + (toRawType(inject)) + ".",
  45846. vm
  45847. );
  45848. }
  45849. }
  45850. /**
  45851. * Normalize raw function directives into object format.
  45852. */
  45853. function normalizeDirectives (options) {
  45854. var dirs = options.directives;
  45855. if (dirs) {
  45856. for (var key in dirs) {
  45857. var def$$1 = dirs[key];
  45858. if (typeof def$$1 === 'function') {
  45859. dirs[key] = { bind: def$$1, update: def$$1 };
  45860. }
  45861. }
  45862. }
  45863. }
  45864. function assertObjectType (name, value, vm) {
  45865. if (!isPlainObject(value)) {
  45866. warn(
  45867. "Invalid value for option \"" + name + "\": expected an Object, " +
  45868. "but got " + (toRawType(value)) + ".",
  45869. vm
  45870. );
  45871. }
  45872. }
  45873. /**
  45874. * Merge two option objects into a new one.
  45875. * Core utility used in both instantiation and inheritance.
  45876. */
  45877. function mergeOptions (
  45878. parent,
  45879. child,
  45880. vm
  45881. ) {
  45882. {
  45883. checkComponents(child);
  45884. }
  45885. if (typeof child === 'function') {
  45886. child = child.options;
  45887. }
  45888. normalizeProps(child, vm);
  45889. normalizeInject(child, vm);
  45890. normalizeDirectives(child);
  45891. // Apply extends and mixins on the child options,
  45892. // but only if it is a raw options object that isn't
  45893. // the result of another mergeOptions call.
  45894. // Only merged options has the _base property.
  45895. if (!child._base) {
  45896. if (child.extends) {
  45897. parent = mergeOptions(parent, child.extends, vm);
  45898. }
  45899. if (child.mixins) {
  45900. for (var i = 0, l = child.mixins.length; i < l; i++) {
  45901. parent = mergeOptions(parent, child.mixins[i], vm);
  45902. }
  45903. }
  45904. }
  45905. var options = {};
  45906. var key;
  45907. for (key in parent) {
  45908. mergeField(key);
  45909. }
  45910. for (key in child) {
  45911. if (!hasOwn(parent, key)) {
  45912. mergeField(key);
  45913. }
  45914. }
  45915. function mergeField (key) {
  45916. var strat = strats[key] || defaultStrat;
  45917. options[key] = strat(parent[key], child[key], vm, key);
  45918. }
  45919. return options
  45920. }
  45921. /**
  45922. * Resolve an asset.
  45923. * This function is used because child instances need access
  45924. * to assets defined in its ancestor chain.
  45925. */
  45926. function resolveAsset (
  45927. options,
  45928. type,
  45929. id,
  45930. warnMissing
  45931. ) {
  45932. /* istanbul ignore if */
  45933. if (typeof id !== 'string') {
  45934. return
  45935. }
  45936. var assets = options[type];
  45937. // check local registration variations first
  45938. if (hasOwn(assets, id)) { return assets[id] }
  45939. var camelizedId = camelize(id);
  45940. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  45941. var PascalCaseId = capitalize(camelizedId);
  45942. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  45943. // fallback to prototype chain
  45944. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  45945. if (warnMissing && !res) {
  45946. warn(
  45947. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  45948. options
  45949. );
  45950. }
  45951. return res
  45952. }
  45953. /* */
  45954. function validateProp (
  45955. key,
  45956. propOptions,
  45957. propsData,
  45958. vm
  45959. ) {
  45960. var prop = propOptions[key];
  45961. var absent = !hasOwn(propsData, key);
  45962. var value = propsData[key];
  45963. // boolean casting
  45964. var booleanIndex = getTypeIndex(Boolean, prop.type);
  45965. if (booleanIndex > -1) {
  45966. if (absent && !hasOwn(prop, 'default')) {
  45967. value = false;
  45968. } else if (value === '' || value === hyphenate(key)) {
  45969. // only cast empty string / same name to boolean if
  45970. // boolean has higher priority
  45971. var stringIndex = getTypeIndex(String, prop.type);
  45972. if (stringIndex < 0 || booleanIndex < stringIndex) {
  45973. value = true;
  45974. }
  45975. }
  45976. }
  45977. // check default value
  45978. if (value === undefined) {
  45979. value = getPropDefaultValue(vm, prop, key);
  45980. // since the default value is a fresh copy,
  45981. // make sure to observe it.
  45982. var prevShouldObserve = shouldObserve;
  45983. toggleObserving(true);
  45984. observe(value);
  45985. toggleObserving(prevShouldObserve);
  45986. }
  45987. {
  45988. assertProp(prop, key, value, vm, absent);
  45989. }
  45990. return value
  45991. }
  45992. /**
  45993. * Get the default value of a prop.
  45994. */
  45995. function getPropDefaultValue (vm, prop, key) {
  45996. // no default, return undefined
  45997. if (!hasOwn(prop, 'default')) {
  45998. return undefined
  45999. }
  46000. var def = prop.default;
  46001. // warn against non-factory defaults for Object & Array
  46002. if (isObject(def)) {
  46003. warn(
  46004. 'Invalid default value for prop "' + key + '": ' +
  46005. 'Props with type Object/Array must use a factory function ' +
  46006. 'to return the default value.',
  46007. vm
  46008. );
  46009. }
  46010. // the raw prop value was also undefined from previous render,
  46011. // return previous default value to avoid unnecessary watcher trigger
  46012. if (vm && vm.$options.propsData &&
  46013. vm.$options.propsData[key] === undefined &&
  46014. vm._props[key] !== undefined
  46015. ) {
  46016. return vm._props[key]
  46017. }
  46018. // call factory function for non-Function types
  46019. // a value is Function if its prototype is function even across different execution context
  46020. return typeof def === 'function' && getType(prop.type) !== 'Function'
  46021. ? def.call(vm)
  46022. : def
  46023. }
  46024. /**
  46025. * Assert whether a prop is valid.
  46026. */
  46027. function assertProp (
  46028. prop,
  46029. name,
  46030. value,
  46031. vm,
  46032. absent
  46033. ) {
  46034. if (prop.required && absent) {
  46035. warn(
  46036. 'Missing required prop: "' + name + '"',
  46037. vm
  46038. );
  46039. return
  46040. }
  46041. if (value == null && !prop.required) {
  46042. return
  46043. }
  46044. var type = prop.type;
  46045. var valid = !type || type === true;
  46046. var expectedTypes = [];
  46047. if (type) {
  46048. if (!Array.isArray(type)) {
  46049. type = [type];
  46050. }
  46051. for (var i = 0; i < type.length && !valid; i++) {
  46052. var assertedType = assertType(value, type[i]);
  46053. expectedTypes.push(assertedType.expectedType || '');
  46054. valid = assertedType.valid;
  46055. }
  46056. }
  46057. if (!valid) {
  46058. warn(
  46059. getInvalidTypeMessage(name, value, expectedTypes),
  46060. vm
  46061. );
  46062. return
  46063. }
  46064. var validator = prop.validator;
  46065. if (validator) {
  46066. if (!validator(value)) {
  46067. warn(
  46068. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  46069. vm
  46070. );
  46071. }
  46072. }
  46073. }
  46074. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  46075. function assertType (value, type) {
  46076. var valid;
  46077. var expectedType = getType(type);
  46078. if (simpleCheckRE.test(expectedType)) {
  46079. var t = typeof value;
  46080. valid = t === expectedType.toLowerCase();
  46081. // for primitive wrapper objects
  46082. if (!valid && t === 'object') {
  46083. valid = value instanceof type;
  46084. }
  46085. } else if (expectedType === 'Object') {
  46086. valid = isPlainObject(value);
  46087. } else if (expectedType === 'Array') {
  46088. valid = Array.isArray(value);
  46089. } else {
  46090. valid = value instanceof type;
  46091. }
  46092. return {
  46093. valid: valid,
  46094. expectedType: expectedType
  46095. }
  46096. }
  46097. /**
  46098. * Use function string name to check built-in types,
  46099. * because a simple equality check will fail when running
  46100. * across different vms / iframes.
  46101. */
  46102. function getType (fn) {
  46103. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  46104. return match ? match[1] : ''
  46105. }
  46106. function isSameType (a, b) {
  46107. return getType(a) === getType(b)
  46108. }
  46109. function getTypeIndex (type, expectedTypes) {
  46110. if (!Array.isArray(expectedTypes)) {
  46111. return isSameType(expectedTypes, type) ? 0 : -1
  46112. }
  46113. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  46114. if (isSameType(expectedTypes[i], type)) {
  46115. return i
  46116. }
  46117. }
  46118. return -1
  46119. }
  46120. function getInvalidTypeMessage (name, value, expectedTypes) {
  46121. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  46122. " Expected " + (expectedTypes.map(capitalize).join(', '));
  46123. var expectedType = expectedTypes[0];
  46124. var receivedType = toRawType(value);
  46125. var expectedValue = styleValue(value, expectedType);
  46126. var receivedValue = styleValue(value, receivedType);
  46127. // check if we need to specify expected value
  46128. if (expectedTypes.length === 1 &&
  46129. isExplicable(expectedType) &&
  46130. !isBoolean(expectedType, receivedType)) {
  46131. message += " with value " + expectedValue;
  46132. }
  46133. message += ", got " + receivedType + " ";
  46134. // check if we need to specify received value
  46135. if (isExplicable(receivedType)) {
  46136. message += "with value " + receivedValue + ".";
  46137. }
  46138. return message
  46139. }
  46140. function styleValue (value, type) {
  46141. if (type === 'String') {
  46142. return ("\"" + value + "\"")
  46143. } else if (type === 'Number') {
  46144. return ("" + (Number(value)))
  46145. } else {
  46146. return ("" + value)
  46147. }
  46148. }
  46149. function isExplicable (value) {
  46150. var explicitTypes = ['string', 'number', 'boolean'];
  46151. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  46152. }
  46153. function isBoolean () {
  46154. var args = [], len = arguments.length;
  46155. while ( len-- ) args[ len ] = arguments[ len ];
  46156. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  46157. }
  46158. /* */
  46159. function handleError (err, vm, info) {
  46160. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  46161. // See: https://github.com/vuejs/vuex/issues/1505
  46162. pushTarget();
  46163. try {
  46164. if (vm) {
  46165. var cur = vm;
  46166. while ((cur = cur.$parent)) {
  46167. var hooks = cur.$options.errorCaptured;
  46168. if (hooks) {
  46169. for (var i = 0; i < hooks.length; i++) {
  46170. try {
  46171. var capture = hooks[i].call(cur, err, vm, info) === false;
  46172. if (capture) { return }
  46173. } catch (e) {
  46174. globalHandleError(e, cur, 'errorCaptured hook');
  46175. }
  46176. }
  46177. }
  46178. }
  46179. }
  46180. globalHandleError(err, vm, info);
  46181. } finally {
  46182. popTarget();
  46183. }
  46184. }
  46185. function invokeWithErrorHandling (
  46186. handler,
  46187. context,
  46188. args,
  46189. vm,
  46190. info
  46191. ) {
  46192. var res;
  46193. try {
  46194. res = args ? handler.apply(context, args) : handler.call(context);
  46195. if (res && !res._isVue && isPromise(res) && !res._handled) {
  46196. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  46197. // issue #9511
  46198. // avoid catch triggering multiple times when nested calls
  46199. res._handled = true;
  46200. }
  46201. } catch (e) {
  46202. handleError(e, vm, info);
  46203. }
  46204. return res
  46205. }
  46206. function globalHandleError (err, vm, info) {
  46207. if (config.errorHandler) {
  46208. try {
  46209. return config.errorHandler.call(null, err, vm, info)
  46210. } catch (e) {
  46211. // if the user intentionally throws the original error in the handler,
  46212. // do not log it twice
  46213. if (e !== err) {
  46214. logError(e, null, 'config.errorHandler');
  46215. }
  46216. }
  46217. }
  46218. logError(err, vm, info);
  46219. }
  46220. function logError (err, vm, info) {
  46221. {
  46222. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  46223. }
  46224. /* istanbul ignore else */
  46225. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  46226. console.error(err);
  46227. } else {
  46228. throw err
  46229. }
  46230. }
  46231. /* */
  46232. var isUsingMicroTask = false;
  46233. var callbacks = [];
  46234. var pending = false;
  46235. function flushCallbacks () {
  46236. pending = false;
  46237. var copies = callbacks.slice(0);
  46238. callbacks.length = 0;
  46239. for (var i = 0; i < copies.length; i++) {
  46240. copies[i]();
  46241. }
  46242. }
  46243. // Here we have async deferring wrappers using microtasks.
  46244. // In 2.5 we used (macro) tasks (in combination with microtasks).
  46245. // However, it has subtle problems when state is changed right before repaint
  46246. // (e.g. #6813, out-in transitions).
  46247. // Also, using (macro) tasks in event handler would cause some weird behaviors
  46248. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  46249. // So we now use microtasks everywhere, again.
  46250. // A major drawback of this tradeoff is that there are some scenarios
  46251. // where microtasks have too high a priority and fire in between supposedly
  46252. // sequential events (e.g. #4521, #6690, which have workarounds)
  46253. // or even between bubbling of the same event (#6566).
  46254. var timerFunc;
  46255. // The nextTick behavior leverages the microtask queue, which can be accessed
  46256. // via either native Promise.then or MutationObserver.
  46257. // MutationObserver has wider support, however it is seriously bugged in
  46258. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  46259. // completely stops working after triggering a few times... so, if native
  46260. // Promise is available, we will use it:
  46261. /* istanbul ignore next, $flow-disable-line */
  46262. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  46263. var p = Promise.resolve();
  46264. timerFunc = function () {
  46265. p.then(flushCallbacks);
  46266. // In problematic UIWebViews, Promise.then doesn't completely break, but
  46267. // it can get stuck in a weird state where callbacks are pushed into the
  46268. // microtask queue but the queue isn't being flushed, until the browser
  46269. // needs to do some other work, e.g. handle a timer. Therefore we can
  46270. // "force" the microtask queue to be flushed by adding an empty timer.
  46271. if (isIOS) { setTimeout(noop); }
  46272. };
  46273. isUsingMicroTask = true;
  46274. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  46275. isNative(MutationObserver) ||
  46276. // PhantomJS and iOS 7.x
  46277. MutationObserver.toString() === '[object MutationObserverConstructor]'
  46278. )) {
  46279. // Use MutationObserver where native Promise is not available,
  46280. // e.g. PhantomJS, iOS7, Android 4.4
  46281. // (#6466 MutationObserver is unreliable in IE11)
  46282. var counter = 1;
  46283. var observer = new MutationObserver(flushCallbacks);
  46284. var textNode = document.createTextNode(String(counter));
  46285. observer.observe(textNode, {
  46286. characterData: true
  46287. });
  46288. timerFunc = function () {
  46289. counter = (counter + 1) % 2;
  46290. textNode.data = String(counter);
  46291. };
  46292. isUsingMicroTask = true;
  46293. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  46294. // Fallback to setImmediate.
  46295. // Technically it leverages the (macro) task queue,
  46296. // but it is still a better choice than setTimeout.
  46297. timerFunc = function () {
  46298. setImmediate(flushCallbacks);
  46299. };
  46300. } else {
  46301. // Fallback to setTimeout.
  46302. timerFunc = function () {
  46303. setTimeout(flushCallbacks, 0);
  46304. };
  46305. }
  46306. function nextTick (cb, ctx) {
  46307. var _resolve;
  46308. callbacks.push(function () {
  46309. if (cb) {
  46310. try {
  46311. cb.call(ctx);
  46312. } catch (e) {
  46313. handleError(e, ctx, 'nextTick');
  46314. }
  46315. } else if (_resolve) {
  46316. _resolve(ctx);
  46317. }
  46318. });
  46319. if (!pending) {
  46320. pending = true;
  46321. timerFunc();
  46322. }
  46323. // $flow-disable-line
  46324. if (!cb && typeof Promise !== 'undefined') {
  46325. return new Promise(function (resolve) {
  46326. _resolve = resolve;
  46327. })
  46328. }
  46329. }
  46330. /* */
  46331. var mark;
  46332. var measure;
  46333. {
  46334. var perf = inBrowser && window.performance;
  46335. /* istanbul ignore if */
  46336. if (
  46337. perf &&
  46338. perf.mark &&
  46339. perf.measure &&
  46340. perf.clearMarks &&
  46341. perf.clearMeasures
  46342. ) {
  46343. mark = function (tag) { return perf.mark(tag); };
  46344. measure = function (name, startTag, endTag) {
  46345. perf.measure(name, startTag, endTag);
  46346. perf.clearMarks(startTag);
  46347. perf.clearMarks(endTag);
  46348. // perf.clearMeasures(name)
  46349. };
  46350. }
  46351. }
  46352. /* not type checking this file because flow doesn't play well with Proxy */
  46353. var initProxy;
  46354. {
  46355. var allowedGlobals = makeMap(
  46356. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  46357. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  46358. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  46359. 'require' // for Webpack/Browserify
  46360. );
  46361. var warnNonPresent = function (target, key) {
  46362. warn(
  46363. "Property or method \"" + key + "\" is not defined on the instance but " +
  46364. 'referenced during render. Make sure that this property is reactive, ' +
  46365. 'either in the data option, or for class-based components, by ' +
  46366. 'initializing the property. ' +
  46367. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  46368. target
  46369. );
  46370. };
  46371. var warnReservedPrefix = function (target, key) {
  46372. warn(
  46373. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  46374. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  46375. 'prevent conflicts with Vue internals. ' +
  46376. 'See: https://vuejs.org/v2/api/#data',
  46377. target
  46378. );
  46379. };
  46380. var hasProxy =
  46381. typeof Proxy !== 'undefined' && isNative(Proxy);
  46382. if (hasProxy) {
  46383. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  46384. config.keyCodes = new Proxy(config.keyCodes, {
  46385. set: function set (target, key, value) {
  46386. if (isBuiltInModifier(key)) {
  46387. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  46388. return false
  46389. } else {
  46390. target[key] = value;
  46391. return true
  46392. }
  46393. }
  46394. });
  46395. }
  46396. var hasHandler = {
  46397. has: function has (target, key) {
  46398. var has = key in target;
  46399. var isAllowed = allowedGlobals(key) ||
  46400. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  46401. if (!has && !isAllowed) {
  46402. if (key in target.$data) { warnReservedPrefix(target, key); }
  46403. else { warnNonPresent(target, key); }
  46404. }
  46405. return has || !isAllowed
  46406. }
  46407. };
  46408. var getHandler = {
  46409. get: function get (target, key) {
  46410. if (typeof key === 'string' && !(key in target)) {
  46411. if (key in target.$data) { warnReservedPrefix(target, key); }
  46412. else { warnNonPresent(target, key); }
  46413. }
  46414. return target[key]
  46415. }
  46416. };
  46417. initProxy = function initProxy (vm) {
  46418. if (hasProxy) {
  46419. // determine which proxy handler to use
  46420. var options = vm.$options;
  46421. var handlers = options.render && options.render._withStripped
  46422. ? getHandler
  46423. : hasHandler;
  46424. vm._renderProxy = new Proxy(vm, handlers);
  46425. } else {
  46426. vm._renderProxy = vm;
  46427. }
  46428. };
  46429. }
  46430. /* */
  46431. var seenObjects = new _Set();
  46432. /**
  46433. * Recursively traverse an object to evoke all converted
  46434. * getters, so that every nested property inside the object
  46435. * is collected as a "deep" dependency.
  46436. */
  46437. function traverse (val) {
  46438. _traverse(val, seenObjects);
  46439. seenObjects.clear();
  46440. }
  46441. function _traverse (val, seen) {
  46442. var i, keys;
  46443. var isA = Array.isArray(val);
  46444. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  46445. return
  46446. }
  46447. if (val.__ob__) {
  46448. var depId = val.__ob__.dep.id;
  46449. if (seen.has(depId)) {
  46450. return
  46451. }
  46452. seen.add(depId);
  46453. }
  46454. if (isA) {
  46455. i = val.length;
  46456. while (i--) { _traverse(val[i], seen); }
  46457. } else {
  46458. keys = Object.keys(val);
  46459. i = keys.length;
  46460. while (i--) { _traverse(val[keys[i]], seen); }
  46461. }
  46462. }
  46463. /* */
  46464. var normalizeEvent = cached(function (name) {
  46465. var passive = name.charAt(0) === '&';
  46466. name = passive ? name.slice(1) : name;
  46467. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  46468. name = once$$1 ? name.slice(1) : name;
  46469. var capture = name.charAt(0) === '!';
  46470. name = capture ? name.slice(1) : name;
  46471. return {
  46472. name: name,
  46473. once: once$$1,
  46474. capture: capture,
  46475. passive: passive
  46476. }
  46477. });
  46478. function createFnInvoker (fns, vm) {
  46479. function invoker () {
  46480. var arguments$1 = arguments;
  46481. var fns = invoker.fns;
  46482. if (Array.isArray(fns)) {
  46483. var cloned = fns.slice();
  46484. for (var i = 0; i < cloned.length; i++) {
  46485. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  46486. }
  46487. } else {
  46488. // return handler return value for single handlers
  46489. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  46490. }
  46491. }
  46492. invoker.fns = fns;
  46493. return invoker
  46494. }
  46495. function updateListeners (
  46496. on,
  46497. oldOn,
  46498. add,
  46499. remove$$1,
  46500. createOnceHandler,
  46501. vm
  46502. ) {
  46503. var name, def$$1, cur, old, event;
  46504. for (name in on) {
  46505. def$$1 = cur = on[name];
  46506. old = oldOn[name];
  46507. event = normalizeEvent(name);
  46508. if (isUndef(cur)) {
  46509. warn(
  46510. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  46511. vm
  46512. );
  46513. } else if (isUndef(old)) {
  46514. if (isUndef(cur.fns)) {
  46515. cur = on[name] = createFnInvoker(cur, vm);
  46516. }
  46517. if (isTrue(event.once)) {
  46518. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46519. }
  46520. add(event.name, cur, event.capture, event.passive, event.params);
  46521. } else if (cur !== old) {
  46522. old.fns = cur;
  46523. on[name] = old;
  46524. }
  46525. }
  46526. for (name in oldOn) {
  46527. if (isUndef(on[name])) {
  46528. event = normalizeEvent(name);
  46529. remove$$1(event.name, oldOn[name], event.capture);
  46530. }
  46531. }
  46532. }
  46533. /* */
  46534. function mergeVNodeHook (def, hookKey, hook) {
  46535. if (def instanceof VNode) {
  46536. def = def.data.hook || (def.data.hook = {});
  46537. }
  46538. var invoker;
  46539. var oldHook = def[hookKey];
  46540. function wrappedHook () {
  46541. hook.apply(this, arguments);
  46542. // important: remove merged hook to ensure it's called only once
  46543. // and prevent memory leak
  46544. remove(invoker.fns, wrappedHook);
  46545. }
  46546. if (isUndef(oldHook)) {
  46547. // no existing hook
  46548. invoker = createFnInvoker([wrappedHook]);
  46549. } else {
  46550. /* istanbul ignore if */
  46551. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46552. // already a merged invoker
  46553. invoker = oldHook;
  46554. invoker.fns.push(wrappedHook);
  46555. } else {
  46556. // existing plain hook
  46557. invoker = createFnInvoker([oldHook, wrappedHook]);
  46558. }
  46559. }
  46560. invoker.merged = true;
  46561. def[hookKey] = invoker;
  46562. }
  46563. /* */
  46564. function extractPropsFromVNodeData (
  46565. data,
  46566. Ctor,
  46567. tag
  46568. ) {
  46569. // we are only extracting raw values here.
  46570. // validation and default values are handled in the child
  46571. // component itself.
  46572. var propOptions = Ctor.options.props;
  46573. if (isUndef(propOptions)) {
  46574. return
  46575. }
  46576. var res = {};
  46577. var attrs = data.attrs;
  46578. var props = data.props;
  46579. if (isDef(attrs) || isDef(props)) {
  46580. for (var key in propOptions) {
  46581. var altKey = hyphenate(key);
  46582. {
  46583. var keyInLowerCase = key.toLowerCase();
  46584. if (
  46585. key !== keyInLowerCase &&
  46586. attrs && hasOwn(attrs, keyInLowerCase)
  46587. ) {
  46588. tip(
  46589. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46590. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46591. " \"" + key + "\". " +
  46592. "Note that HTML attributes are case-insensitive and camelCased " +
  46593. "props need to use their kebab-case equivalents when using in-DOM " +
  46594. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46595. );
  46596. }
  46597. }
  46598. checkProp(res, props, key, altKey, true) ||
  46599. checkProp(res, attrs, key, altKey, false);
  46600. }
  46601. }
  46602. return res
  46603. }
  46604. function checkProp (
  46605. res,
  46606. hash,
  46607. key,
  46608. altKey,
  46609. preserve
  46610. ) {
  46611. if (isDef(hash)) {
  46612. if (hasOwn(hash, key)) {
  46613. res[key] = hash[key];
  46614. if (!preserve) {
  46615. delete hash[key];
  46616. }
  46617. return true
  46618. } else if (hasOwn(hash, altKey)) {
  46619. res[key] = hash[altKey];
  46620. if (!preserve) {
  46621. delete hash[altKey];
  46622. }
  46623. return true
  46624. }
  46625. }
  46626. return false
  46627. }
  46628. /* */
  46629. // The template compiler attempts to minimize the need for normalization by
  46630. // statically analyzing the template at compile time.
  46631. //
  46632. // For plain HTML markup, normalization can be completely skipped because the
  46633. // generated render function is guaranteed to return Array<VNode>. There are
  46634. // two cases where extra normalization is needed:
  46635. // 1. When the children contains components - because a functional component
  46636. // may return an Array instead of a single root. In this case, just a simple
  46637. // normalization is needed - if any child is an Array, we flatten the whole
  46638. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46639. // because functional components already normalize their own children.
  46640. function simpleNormalizeChildren (children) {
  46641. for (var i = 0; i < children.length; i++) {
  46642. if (Array.isArray(children[i])) {
  46643. return Array.prototype.concat.apply([], children)
  46644. }
  46645. }
  46646. return children
  46647. }
  46648. // 2. When the children contains constructs that always generated nested Arrays,
  46649. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46650. // with hand-written render functions / JSX. In such cases a full normalization
  46651. // is needed to cater to all possible types of children values.
  46652. function normalizeChildren (children) {
  46653. return isPrimitive(children)
  46654. ? [createTextVNode(children)]
  46655. : Array.isArray(children)
  46656. ? normalizeArrayChildren(children)
  46657. : undefined
  46658. }
  46659. function isTextNode (node) {
  46660. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46661. }
  46662. function normalizeArrayChildren (children, nestedIndex) {
  46663. var res = [];
  46664. var i, c, lastIndex, last;
  46665. for (i = 0; i < children.length; i++) {
  46666. c = children[i];
  46667. if (isUndef(c) || typeof c === 'boolean') { continue }
  46668. lastIndex = res.length - 1;
  46669. last = res[lastIndex];
  46670. // nested
  46671. if (Array.isArray(c)) {
  46672. if (c.length > 0) {
  46673. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46674. // merge adjacent text nodes
  46675. if (isTextNode(c[0]) && isTextNode(last)) {
  46676. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46677. c.shift();
  46678. }
  46679. res.push.apply(res, c);
  46680. }
  46681. } else if (isPrimitive(c)) {
  46682. if (isTextNode(last)) {
  46683. // merge adjacent text nodes
  46684. // this is necessary for SSR hydration because text nodes are
  46685. // essentially merged when rendered to HTML strings
  46686. res[lastIndex] = createTextVNode(last.text + c);
  46687. } else if (c !== '') {
  46688. // convert primitive to vnode
  46689. res.push(createTextVNode(c));
  46690. }
  46691. } else {
  46692. if (isTextNode(c) && isTextNode(last)) {
  46693. // merge adjacent text nodes
  46694. res[lastIndex] = createTextVNode(last.text + c.text);
  46695. } else {
  46696. // default key for nested array children (likely generated by v-for)
  46697. if (isTrue(children._isVList) &&
  46698. isDef(c.tag) &&
  46699. isUndef(c.key) &&
  46700. isDef(nestedIndex)) {
  46701. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46702. }
  46703. res.push(c);
  46704. }
  46705. }
  46706. }
  46707. return res
  46708. }
  46709. /* */
  46710. function initProvide (vm) {
  46711. var provide = vm.$options.provide;
  46712. if (provide) {
  46713. vm._provided = typeof provide === 'function'
  46714. ? provide.call(vm)
  46715. : provide;
  46716. }
  46717. }
  46718. function initInjections (vm) {
  46719. var result = resolveInject(vm.$options.inject, vm);
  46720. if (result) {
  46721. toggleObserving(false);
  46722. Object.keys(result).forEach(function (key) {
  46723. /* istanbul ignore else */
  46724. {
  46725. defineReactive$$1(vm, key, result[key], function () {
  46726. warn(
  46727. "Avoid mutating an injected value directly since the changes will be " +
  46728. "overwritten whenever the provided component re-renders. " +
  46729. "injection being mutated: \"" + key + "\"",
  46730. vm
  46731. );
  46732. });
  46733. }
  46734. });
  46735. toggleObserving(true);
  46736. }
  46737. }
  46738. function resolveInject (inject, vm) {
  46739. if (inject) {
  46740. // inject is :any because flow is not smart enough to figure out cached
  46741. var result = Object.create(null);
  46742. var keys = hasSymbol
  46743. ? Reflect.ownKeys(inject)
  46744. : Object.keys(inject);
  46745. for (var i = 0; i < keys.length; i++) {
  46746. var key = keys[i];
  46747. // #6574 in case the inject object is observed...
  46748. if (key === '__ob__') { continue }
  46749. var provideKey = inject[key].from;
  46750. var source = vm;
  46751. while (source) {
  46752. if (source._provided && hasOwn(source._provided, provideKey)) {
  46753. result[key] = source._provided[provideKey];
  46754. break
  46755. }
  46756. source = source.$parent;
  46757. }
  46758. if (!source) {
  46759. if ('default' in inject[key]) {
  46760. var provideDefault = inject[key].default;
  46761. result[key] = typeof provideDefault === 'function'
  46762. ? provideDefault.call(vm)
  46763. : provideDefault;
  46764. } else {
  46765. warn(("Injection \"" + key + "\" not found"), vm);
  46766. }
  46767. }
  46768. }
  46769. return result
  46770. }
  46771. }
  46772. /* */
  46773. /**
  46774. * Runtime helper for resolving raw children VNodes into a slot object.
  46775. */
  46776. function resolveSlots (
  46777. children,
  46778. context
  46779. ) {
  46780. if (!children || !children.length) {
  46781. return {}
  46782. }
  46783. var slots = {};
  46784. for (var i = 0, l = children.length; i < l; i++) {
  46785. var child = children[i];
  46786. var data = child.data;
  46787. // remove slot attribute if the node is resolved as a Vue slot node
  46788. if (data && data.attrs && data.attrs.slot) {
  46789. delete data.attrs.slot;
  46790. }
  46791. // named slots should only be respected if the vnode was rendered in the
  46792. // same context.
  46793. if ((child.context === context || child.fnContext === context) &&
  46794. data && data.slot != null
  46795. ) {
  46796. var name = data.slot;
  46797. var slot = (slots[name] || (slots[name] = []));
  46798. if (child.tag === 'template') {
  46799. slot.push.apply(slot, child.children || []);
  46800. } else {
  46801. slot.push(child);
  46802. }
  46803. } else {
  46804. (slots.default || (slots.default = [])).push(child);
  46805. }
  46806. }
  46807. // ignore slots that contains only whitespace
  46808. for (var name$1 in slots) {
  46809. if (slots[name$1].every(isWhitespace)) {
  46810. delete slots[name$1];
  46811. }
  46812. }
  46813. return slots
  46814. }
  46815. function isWhitespace (node) {
  46816. return (node.isComment && !node.asyncFactory) || node.text === ' '
  46817. }
  46818. /* */
  46819. function normalizeScopedSlots (
  46820. slots,
  46821. normalSlots,
  46822. prevSlots
  46823. ) {
  46824. var res;
  46825. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  46826. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  46827. var key = slots && slots.$key;
  46828. if (!slots) {
  46829. res = {};
  46830. } else if (slots._normalized) {
  46831. // fast path 1: child component re-render only, parent did not change
  46832. return slots._normalized
  46833. } else if (
  46834. isStable &&
  46835. prevSlots &&
  46836. prevSlots !== emptyObject &&
  46837. key === prevSlots.$key &&
  46838. !hasNormalSlots &&
  46839. !prevSlots.$hasNormal
  46840. ) {
  46841. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  46842. // only need to normalize once
  46843. return prevSlots
  46844. } else {
  46845. res = {};
  46846. for (var key$1 in slots) {
  46847. if (slots[key$1] && key$1[0] !== '$') {
  46848. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  46849. }
  46850. }
  46851. }
  46852. // expose normal slots on scopedSlots
  46853. for (var key$2 in normalSlots) {
  46854. if (!(key$2 in res)) {
  46855. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  46856. }
  46857. }
  46858. // avoriaz seems to mock a non-extensible $scopedSlots object
  46859. // and when that is passed down this would cause an error
  46860. if (slots && Object.isExtensible(slots)) {
  46861. (slots)._normalized = res;
  46862. }
  46863. def(res, '$stable', isStable);
  46864. def(res, '$key', key);
  46865. def(res, '$hasNormal', hasNormalSlots);
  46866. return res
  46867. }
  46868. function normalizeScopedSlot(normalSlots, key, fn) {
  46869. var normalized = function () {
  46870. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  46871. res = res && typeof res === 'object' && !Array.isArray(res)
  46872. ? [res] // single vnode
  46873. : normalizeChildren(res);
  46874. return res && (
  46875. res.length === 0 ||
  46876. (res.length === 1 && res[0].isComment) // #9658
  46877. ) ? undefined
  46878. : res
  46879. };
  46880. // this is a slot using the new v-slot syntax without scope. although it is
  46881. // compiled as a scoped slot, render fn users would expect it to be present
  46882. // on this.$slots because the usage is semantically a normal slot.
  46883. if (fn.proxy) {
  46884. Object.defineProperty(normalSlots, key, {
  46885. get: normalized,
  46886. enumerable: true,
  46887. configurable: true
  46888. });
  46889. }
  46890. return normalized
  46891. }
  46892. function proxyNormalSlot(slots, key) {
  46893. return function () { return slots[key]; }
  46894. }
  46895. /* */
  46896. /**
  46897. * Runtime helper for rendering v-for lists.
  46898. */
  46899. function renderList (
  46900. val,
  46901. render
  46902. ) {
  46903. var ret, i, l, keys, key;
  46904. if (Array.isArray(val) || typeof val === 'string') {
  46905. ret = new Array(val.length);
  46906. for (i = 0, l = val.length; i < l; i++) {
  46907. ret[i] = render(val[i], i);
  46908. }
  46909. } else if (typeof val === 'number') {
  46910. ret = new Array(val);
  46911. for (i = 0; i < val; i++) {
  46912. ret[i] = render(i + 1, i);
  46913. }
  46914. } else if (isObject(val)) {
  46915. if (hasSymbol && val[Symbol.iterator]) {
  46916. ret = [];
  46917. var iterator = val[Symbol.iterator]();
  46918. var result = iterator.next();
  46919. while (!result.done) {
  46920. ret.push(render(result.value, ret.length));
  46921. result = iterator.next();
  46922. }
  46923. } else {
  46924. keys = Object.keys(val);
  46925. ret = new Array(keys.length);
  46926. for (i = 0, l = keys.length; i < l; i++) {
  46927. key = keys[i];
  46928. ret[i] = render(val[key], key, i);
  46929. }
  46930. }
  46931. }
  46932. if (!isDef(ret)) {
  46933. ret = [];
  46934. }
  46935. (ret)._isVList = true;
  46936. return ret
  46937. }
  46938. /* */
  46939. /**
  46940. * Runtime helper for rendering <slot>
  46941. */
  46942. function renderSlot (
  46943. name,
  46944. fallback,
  46945. props,
  46946. bindObject
  46947. ) {
  46948. var scopedSlotFn = this.$scopedSlots[name];
  46949. var nodes;
  46950. if (scopedSlotFn) { // scoped slot
  46951. props = props || {};
  46952. if (bindObject) {
  46953. if (!isObject(bindObject)) {
  46954. warn(
  46955. 'slot v-bind without argument expects an Object',
  46956. this
  46957. );
  46958. }
  46959. props = extend(extend({}, bindObject), props);
  46960. }
  46961. nodes = scopedSlotFn(props) || fallback;
  46962. } else {
  46963. nodes = this.$slots[name] || fallback;
  46964. }
  46965. var target = props && props.slot;
  46966. if (target) {
  46967. return this.$createElement('template', { slot: target }, nodes)
  46968. } else {
  46969. return nodes
  46970. }
  46971. }
  46972. /* */
  46973. /**
  46974. * Runtime helper for resolving filters
  46975. */
  46976. function resolveFilter (id) {
  46977. return resolveAsset(this.$options, 'filters', id, true) || identity
  46978. }
  46979. /* */
  46980. function isKeyNotMatch (expect, actual) {
  46981. if (Array.isArray(expect)) {
  46982. return expect.indexOf(actual) === -1
  46983. } else {
  46984. return expect !== actual
  46985. }
  46986. }
  46987. /**
  46988. * Runtime helper for checking keyCodes from config.
  46989. * exposed as Vue.prototype._k
  46990. * passing in eventKeyName as last argument separately for backwards compat
  46991. */
  46992. function checkKeyCodes (
  46993. eventKeyCode,
  46994. key,
  46995. builtInKeyCode,
  46996. eventKeyName,
  46997. builtInKeyName
  46998. ) {
  46999. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  47000. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  47001. return isKeyNotMatch(builtInKeyName, eventKeyName)
  47002. } else if (mappedKeyCode) {
  47003. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  47004. } else if (eventKeyName) {
  47005. return hyphenate(eventKeyName) !== key
  47006. }
  47007. }
  47008. /* */
  47009. /**
  47010. * Runtime helper for merging v-bind="object" into a VNode's data.
  47011. */
  47012. function bindObjectProps (
  47013. data,
  47014. tag,
  47015. value,
  47016. asProp,
  47017. isSync
  47018. ) {
  47019. if (value) {
  47020. if (!isObject(value)) {
  47021. warn(
  47022. 'v-bind without argument expects an Object or Array value',
  47023. this
  47024. );
  47025. } else {
  47026. if (Array.isArray(value)) {
  47027. value = toObject(value);
  47028. }
  47029. var hash;
  47030. var loop = function ( key ) {
  47031. if (
  47032. key === 'class' ||
  47033. key === 'style' ||
  47034. isReservedAttribute(key)
  47035. ) {
  47036. hash = data;
  47037. } else {
  47038. var type = data.attrs && data.attrs.type;
  47039. hash = asProp || config.mustUseProp(tag, type, key)
  47040. ? data.domProps || (data.domProps = {})
  47041. : data.attrs || (data.attrs = {});
  47042. }
  47043. var camelizedKey = camelize(key);
  47044. var hyphenatedKey = hyphenate(key);
  47045. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  47046. hash[key] = value[key];
  47047. if (isSync) {
  47048. var on = data.on || (data.on = {});
  47049. on[("update:" + key)] = function ($event) {
  47050. value[key] = $event;
  47051. };
  47052. }
  47053. }
  47054. };
  47055. for (var key in value) loop( key );
  47056. }
  47057. }
  47058. return data
  47059. }
  47060. /* */
  47061. /**
  47062. * Runtime helper for rendering static trees.
  47063. */
  47064. function renderStatic (
  47065. index,
  47066. isInFor
  47067. ) {
  47068. var cached = this._staticTrees || (this._staticTrees = []);
  47069. var tree = cached[index];
  47070. // if has already-rendered static tree and not inside v-for,
  47071. // we can reuse the same tree.
  47072. if (tree && !isInFor) {
  47073. return tree
  47074. }
  47075. // otherwise, render a fresh tree.
  47076. tree = cached[index] = this.$options.staticRenderFns[index].call(
  47077. this._renderProxy,
  47078. null,
  47079. this // for render fns generated for functional component templates
  47080. );
  47081. markStatic(tree, ("__static__" + index), false);
  47082. return tree
  47083. }
  47084. /**
  47085. * Runtime helper for v-once.
  47086. * Effectively it means marking the node as static with a unique key.
  47087. */
  47088. function markOnce (
  47089. tree,
  47090. index,
  47091. key
  47092. ) {
  47093. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  47094. return tree
  47095. }
  47096. function markStatic (
  47097. tree,
  47098. key,
  47099. isOnce
  47100. ) {
  47101. if (Array.isArray(tree)) {
  47102. for (var i = 0; i < tree.length; i++) {
  47103. if (tree[i] && typeof tree[i] !== 'string') {
  47104. markStaticNode(tree[i], (key + "_" + i), isOnce);
  47105. }
  47106. }
  47107. } else {
  47108. markStaticNode(tree, key, isOnce);
  47109. }
  47110. }
  47111. function markStaticNode (node, key, isOnce) {
  47112. node.isStatic = true;
  47113. node.key = key;
  47114. node.isOnce = isOnce;
  47115. }
  47116. /* */
  47117. function bindObjectListeners (data, value) {
  47118. if (value) {
  47119. if (!isPlainObject(value)) {
  47120. warn(
  47121. 'v-on without argument expects an Object value',
  47122. this
  47123. );
  47124. } else {
  47125. var on = data.on = data.on ? extend({}, data.on) : {};
  47126. for (var key in value) {
  47127. var existing = on[key];
  47128. var ours = value[key];
  47129. on[key] = existing ? [].concat(existing, ours) : ours;
  47130. }
  47131. }
  47132. }
  47133. return data
  47134. }
  47135. /* */
  47136. function resolveScopedSlots (
  47137. fns, // see flow/vnode
  47138. res,
  47139. // the following are added in 2.6
  47140. hasDynamicKeys,
  47141. contentHashKey
  47142. ) {
  47143. res = res || { $stable: !hasDynamicKeys };
  47144. for (var i = 0; i < fns.length; i++) {
  47145. var slot = fns[i];
  47146. if (Array.isArray(slot)) {
  47147. resolveScopedSlots(slot, res, hasDynamicKeys);
  47148. } else if (slot) {
  47149. // marker for reverse proxying v-slot without scope on this.$slots
  47150. if (slot.proxy) {
  47151. slot.fn.proxy = true;
  47152. }
  47153. res[slot.key] = slot.fn;
  47154. }
  47155. }
  47156. if (contentHashKey) {
  47157. (res).$key = contentHashKey;
  47158. }
  47159. return res
  47160. }
  47161. /* */
  47162. function bindDynamicKeys (baseObj, values) {
  47163. for (var i = 0; i < values.length; i += 2) {
  47164. var key = values[i];
  47165. if (typeof key === 'string' && key) {
  47166. baseObj[values[i]] = values[i + 1];
  47167. } else if (key !== '' && key !== null) {
  47168. // null is a special value for explicitly removing a binding
  47169. warn(
  47170. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  47171. this
  47172. );
  47173. }
  47174. }
  47175. return baseObj
  47176. }
  47177. // helper to dynamically append modifier runtime markers to event names.
  47178. // ensure only append when value is already string, otherwise it will be cast
  47179. // to string and cause the type check to miss.
  47180. function prependModifier (value, symbol) {
  47181. return typeof value === 'string' ? symbol + value : value
  47182. }
  47183. /* */
  47184. function installRenderHelpers (target) {
  47185. target._o = markOnce;
  47186. target._n = toNumber;
  47187. target._s = toString;
  47188. target._l = renderList;
  47189. target._t = renderSlot;
  47190. target._q = looseEqual;
  47191. target._i = looseIndexOf;
  47192. target._m = renderStatic;
  47193. target._f = resolveFilter;
  47194. target._k = checkKeyCodes;
  47195. target._b = bindObjectProps;
  47196. target._v = createTextVNode;
  47197. target._e = createEmptyVNode;
  47198. target._u = resolveScopedSlots;
  47199. target._g = bindObjectListeners;
  47200. target._d = bindDynamicKeys;
  47201. target._p = prependModifier;
  47202. }
  47203. /* */
  47204. function FunctionalRenderContext (
  47205. data,
  47206. props,
  47207. children,
  47208. parent,
  47209. Ctor
  47210. ) {
  47211. var this$1 = this;
  47212. var options = Ctor.options;
  47213. // ensure the createElement function in functional components
  47214. // gets a unique context - this is necessary for correct named slot check
  47215. var contextVm;
  47216. if (hasOwn(parent, '_uid')) {
  47217. contextVm = Object.create(parent);
  47218. // $flow-disable-line
  47219. contextVm._original = parent;
  47220. } else {
  47221. // the context vm passed in is a functional context as well.
  47222. // in this case we want to make sure we are able to get a hold to the
  47223. // real context instance.
  47224. contextVm = parent;
  47225. // $flow-disable-line
  47226. parent = parent._original;
  47227. }
  47228. var isCompiled = isTrue(options._compiled);
  47229. var needNormalization = !isCompiled;
  47230. this.data = data;
  47231. this.props = props;
  47232. this.children = children;
  47233. this.parent = parent;
  47234. this.listeners = data.on || emptyObject;
  47235. this.injections = resolveInject(options.inject, parent);
  47236. this.slots = function () {
  47237. if (!this$1.$slots) {
  47238. normalizeScopedSlots(
  47239. data.scopedSlots,
  47240. this$1.$slots = resolveSlots(children, parent)
  47241. );
  47242. }
  47243. return this$1.$slots
  47244. };
  47245. Object.defineProperty(this, 'scopedSlots', ({
  47246. enumerable: true,
  47247. get: function get () {
  47248. return normalizeScopedSlots(data.scopedSlots, this.slots())
  47249. }
  47250. }));
  47251. // support for compiled functional template
  47252. if (isCompiled) {
  47253. // exposing $options for renderStatic()
  47254. this.$options = options;
  47255. // pre-resolve slots for renderSlot()
  47256. this.$slots = this.slots();
  47257. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  47258. }
  47259. if (options._scopeId) {
  47260. this._c = function (a, b, c, d) {
  47261. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  47262. if (vnode && !Array.isArray(vnode)) {
  47263. vnode.fnScopeId = options._scopeId;
  47264. vnode.fnContext = parent;
  47265. }
  47266. return vnode
  47267. };
  47268. } else {
  47269. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  47270. }
  47271. }
  47272. installRenderHelpers(FunctionalRenderContext.prototype);
  47273. function createFunctionalComponent (
  47274. Ctor,
  47275. propsData,
  47276. data,
  47277. contextVm,
  47278. children
  47279. ) {
  47280. var options = Ctor.options;
  47281. var props = {};
  47282. var propOptions = options.props;
  47283. if (isDef(propOptions)) {
  47284. for (var key in propOptions) {
  47285. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  47286. }
  47287. } else {
  47288. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  47289. if (isDef(data.props)) { mergeProps(props, data.props); }
  47290. }
  47291. var renderContext = new FunctionalRenderContext(
  47292. data,
  47293. props,
  47294. children,
  47295. contextVm,
  47296. Ctor
  47297. );
  47298. var vnode = options.render.call(null, renderContext._c, renderContext);
  47299. if (vnode instanceof VNode) {
  47300. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  47301. } else if (Array.isArray(vnode)) {
  47302. var vnodes = normalizeChildren(vnode) || [];
  47303. var res = new Array(vnodes.length);
  47304. for (var i = 0; i < vnodes.length; i++) {
  47305. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  47306. }
  47307. return res
  47308. }
  47309. }
  47310. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  47311. // #7817 clone node before setting fnContext, otherwise if the node is reused
  47312. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  47313. // that should not be matched to match.
  47314. var clone = cloneVNode(vnode);
  47315. clone.fnContext = contextVm;
  47316. clone.fnOptions = options;
  47317. {
  47318. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  47319. }
  47320. if (data.slot) {
  47321. (clone.data || (clone.data = {})).slot = data.slot;
  47322. }
  47323. return clone
  47324. }
  47325. function mergeProps (to, from) {
  47326. for (var key in from) {
  47327. to[camelize(key)] = from[key];
  47328. }
  47329. }
  47330. /* */
  47331. /* */
  47332. /* */
  47333. /* */
  47334. // inline hooks to be invoked on component VNodes during patch
  47335. var componentVNodeHooks = {
  47336. init: function init (vnode, hydrating) {
  47337. if (
  47338. vnode.componentInstance &&
  47339. !vnode.componentInstance._isDestroyed &&
  47340. vnode.data.keepAlive
  47341. ) {
  47342. // kept-alive components, treat as a patch
  47343. var mountedNode = vnode; // work around flow
  47344. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  47345. } else {
  47346. var child = vnode.componentInstance = createComponentInstanceForVnode(
  47347. vnode,
  47348. activeInstance
  47349. );
  47350. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  47351. }
  47352. },
  47353. prepatch: function prepatch (oldVnode, vnode) {
  47354. var options = vnode.componentOptions;
  47355. var child = vnode.componentInstance = oldVnode.componentInstance;
  47356. updateChildComponent(
  47357. child,
  47358. options.propsData, // updated props
  47359. options.listeners, // updated listeners
  47360. vnode, // new parent vnode
  47361. options.children // new children
  47362. );
  47363. },
  47364. insert: function insert (vnode) {
  47365. var context = vnode.context;
  47366. var componentInstance = vnode.componentInstance;
  47367. if (!componentInstance._isMounted) {
  47368. componentInstance._isMounted = true;
  47369. callHook(componentInstance, 'mounted');
  47370. }
  47371. if (vnode.data.keepAlive) {
  47372. if (context._isMounted) {
  47373. // vue-router#1212
  47374. // During updates, a kept-alive component's child components may
  47375. // change, so directly walking the tree here may call activated hooks
  47376. // on incorrect children. Instead we push them into a queue which will
  47377. // be processed after the whole patch process ended.
  47378. queueActivatedComponent(componentInstance);
  47379. } else {
  47380. activateChildComponent(componentInstance, true /* direct */);
  47381. }
  47382. }
  47383. },
  47384. destroy: function destroy (vnode) {
  47385. var componentInstance = vnode.componentInstance;
  47386. if (!componentInstance._isDestroyed) {
  47387. if (!vnode.data.keepAlive) {
  47388. componentInstance.$destroy();
  47389. } else {
  47390. deactivateChildComponent(componentInstance, true /* direct */);
  47391. }
  47392. }
  47393. }
  47394. };
  47395. var hooksToMerge = Object.keys(componentVNodeHooks);
  47396. function createComponent (
  47397. Ctor,
  47398. data,
  47399. context,
  47400. children,
  47401. tag
  47402. ) {
  47403. if (isUndef(Ctor)) {
  47404. return
  47405. }
  47406. var baseCtor = context.$options._base;
  47407. // plain options object: turn it into a constructor
  47408. if (isObject(Ctor)) {
  47409. Ctor = baseCtor.extend(Ctor);
  47410. }
  47411. // if at this stage it's not a constructor or an async component factory,
  47412. // reject.
  47413. if (typeof Ctor !== 'function') {
  47414. {
  47415. warn(("Invalid Component definition: " + (String(Ctor))), context);
  47416. }
  47417. return
  47418. }
  47419. // async component
  47420. var asyncFactory;
  47421. if (isUndef(Ctor.cid)) {
  47422. asyncFactory = Ctor;
  47423. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  47424. if (Ctor === undefined) {
  47425. // return a placeholder node for async component, which is rendered
  47426. // as a comment node but preserves all the raw information for the node.
  47427. // the information will be used for async server-rendering and hydration.
  47428. return createAsyncPlaceholder(
  47429. asyncFactory,
  47430. data,
  47431. context,
  47432. children,
  47433. tag
  47434. )
  47435. }
  47436. }
  47437. data = data || {};
  47438. // resolve constructor options in case global mixins are applied after
  47439. // component constructor creation
  47440. resolveConstructorOptions(Ctor);
  47441. // transform component v-model data into props & events
  47442. if (isDef(data.model)) {
  47443. transformModel(Ctor.options, data);
  47444. }
  47445. // extract props
  47446. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  47447. // functional component
  47448. if (isTrue(Ctor.options.functional)) {
  47449. return createFunctionalComponent(Ctor, propsData, data, context, children)
  47450. }
  47451. // extract listeners, since these needs to be treated as
  47452. // child component listeners instead of DOM listeners
  47453. var listeners = data.on;
  47454. // replace with listeners with .native modifier
  47455. // so it gets processed during parent component patch.
  47456. data.on = data.nativeOn;
  47457. if (isTrue(Ctor.options.abstract)) {
  47458. // abstract components do not keep anything
  47459. // other than props & listeners & slot
  47460. // work around flow
  47461. var slot = data.slot;
  47462. data = {};
  47463. if (slot) {
  47464. data.slot = slot;
  47465. }
  47466. }
  47467. // install component management hooks onto the placeholder node
  47468. installComponentHooks(data);
  47469. // return a placeholder vnode
  47470. var name = Ctor.options.name || tag;
  47471. var vnode = new VNode(
  47472. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  47473. data, undefined, undefined, undefined, context,
  47474. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  47475. asyncFactory
  47476. );
  47477. return vnode
  47478. }
  47479. function createComponentInstanceForVnode (
  47480. vnode, // we know it's MountedComponentVNode but flow doesn't
  47481. parent // activeInstance in lifecycle state
  47482. ) {
  47483. var options = {
  47484. _isComponent: true,
  47485. _parentVnode: vnode,
  47486. parent: parent
  47487. };
  47488. // check inline-template render functions
  47489. var inlineTemplate = vnode.data.inlineTemplate;
  47490. if (isDef(inlineTemplate)) {
  47491. options.render = inlineTemplate.render;
  47492. options.staticRenderFns = inlineTemplate.staticRenderFns;
  47493. }
  47494. return new vnode.componentOptions.Ctor(options)
  47495. }
  47496. function installComponentHooks (data) {
  47497. var hooks = data.hook || (data.hook = {});
  47498. for (var i = 0; i < hooksToMerge.length; i++) {
  47499. var key = hooksToMerge[i];
  47500. var existing = hooks[key];
  47501. var toMerge = componentVNodeHooks[key];
  47502. if (existing !== toMerge && !(existing && existing._merged)) {
  47503. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  47504. }
  47505. }
  47506. }
  47507. function mergeHook$1 (f1, f2) {
  47508. var merged = function (a, b) {
  47509. // flow complains about extra args which is why we use any
  47510. f1(a, b);
  47511. f2(a, b);
  47512. };
  47513. merged._merged = true;
  47514. return merged
  47515. }
  47516. // transform component v-model info (value and callback) into
  47517. // prop and event handler respectively.
  47518. function transformModel (options, data) {
  47519. var prop = (options.model && options.model.prop) || 'value';
  47520. var event = (options.model && options.model.event) || 'input'
  47521. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47522. var on = data.on || (data.on = {});
  47523. var existing = on[event];
  47524. var callback = data.model.callback;
  47525. if (isDef(existing)) {
  47526. if (
  47527. Array.isArray(existing)
  47528. ? existing.indexOf(callback) === -1
  47529. : existing !== callback
  47530. ) {
  47531. on[event] = [callback].concat(existing);
  47532. }
  47533. } else {
  47534. on[event] = callback;
  47535. }
  47536. }
  47537. /* */
  47538. var SIMPLE_NORMALIZE = 1;
  47539. var ALWAYS_NORMALIZE = 2;
  47540. // wrapper function for providing a more flexible interface
  47541. // without getting yelled at by flow
  47542. function createElement (
  47543. context,
  47544. tag,
  47545. data,
  47546. children,
  47547. normalizationType,
  47548. alwaysNormalize
  47549. ) {
  47550. if (Array.isArray(data) || isPrimitive(data)) {
  47551. normalizationType = children;
  47552. children = data;
  47553. data = undefined;
  47554. }
  47555. if (isTrue(alwaysNormalize)) {
  47556. normalizationType = ALWAYS_NORMALIZE;
  47557. }
  47558. return _createElement(context, tag, data, children, normalizationType)
  47559. }
  47560. function _createElement (
  47561. context,
  47562. tag,
  47563. data,
  47564. children,
  47565. normalizationType
  47566. ) {
  47567. if (isDef(data) && isDef((data).__ob__)) {
  47568. warn(
  47569. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47570. 'Always create fresh vnode data objects in each render!',
  47571. context
  47572. );
  47573. return createEmptyVNode()
  47574. }
  47575. // object syntax in v-bind
  47576. if (isDef(data) && isDef(data.is)) {
  47577. tag = data.is;
  47578. }
  47579. if (!tag) {
  47580. // in case of component :is set to falsy value
  47581. return createEmptyVNode()
  47582. }
  47583. // warn against non-primitive key
  47584. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47585. ) {
  47586. {
  47587. warn(
  47588. 'Avoid using non-primitive value as key, ' +
  47589. 'use string/number value instead.',
  47590. context
  47591. );
  47592. }
  47593. }
  47594. // support single function children as default scoped slot
  47595. if (Array.isArray(children) &&
  47596. typeof children[0] === 'function'
  47597. ) {
  47598. data = data || {};
  47599. data.scopedSlots = { default: children[0] };
  47600. children.length = 0;
  47601. }
  47602. if (normalizationType === ALWAYS_NORMALIZE) {
  47603. children = normalizeChildren(children);
  47604. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47605. children = simpleNormalizeChildren(children);
  47606. }
  47607. var vnode, ns;
  47608. if (typeof tag === 'string') {
  47609. var Ctor;
  47610. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47611. if (config.isReservedTag(tag)) {
  47612. // platform built-in elements
  47613. if (isDef(data) && isDef(data.nativeOn)) {
  47614. warn(
  47615. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47616. context
  47617. );
  47618. }
  47619. vnode = new VNode(
  47620. config.parsePlatformTagName(tag), data, children,
  47621. undefined, undefined, context
  47622. );
  47623. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47624. // component
  47625. vnode = createComponent(Ctor, data, context, children, tag);
  47626. } else {
  47627. // unknown or unlisted namespaced elements
  47628. // check at runtime because it may get assigned a namespace when its
  47629. // parent normalizes children
  47630. vnode = new VNode(
  47631. tag, data, children,
  47632. undefined, undefined, context
  47633. );
  47634. }
  47635. } else {
  47636. // direct component options / constructor
  47637. vnode = createComponent(tag, data, context, children);
  47638. }
  47639. if (Array.isArray(vnode)) {
  47640. return vnode
  47641. } else if (isDef(vnode)) {
  47642. if (isDef(ns)) { applyNS(vnode, ns); }
  47643. if (isDef(data)) { registerDeepBindings(data); }
  47644. return vnode
  47645. } else {
  47646. return createEmptyVNode()
  47647. }
  47648. }
  47649. function applyNS (vnode, ns, force) {
  47650. vnode.ns = ns;
  47651. if (vnode.tag === 'foreignObject') {
  47652. // use default namespace inside foreignObject
  47653. ns = undefined;
  47654. force = true;
  47655. }
  47656. if (isDef(vnode.children)) {
  47657. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47658. var child = vnode.children[i];
  47659. if (isDef(child.tag) && (
  47660. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47661. applyNS(child, ns, force);
  47662. }
  47663. }
  47664. }
  47665. }
  47666. // ref #5318
  47667. // necessary to ensure parent re-render when deep bindings like :style and
  47668. // :class are used on slot nodes
  47669. function registerDeepBindings (data) {
  47670. if (isObject(data.style)) {
  47671. traverse(data.style);
  47672. }
  47673. if (isObject(data.class)) {
  47674. traverse(data.class);
  47675. }
  47676. }
  47677. /* */
  47678. function initRender (vm) {
  47679. vm._vnode = null; // the root of the child tree
  47680. vm._staticTrees = null; // v-once cached trees
  47681. var options = vm.$options;
  47682. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47683. var renderContext = parentVnode && parentVnode.context;
  47684. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47685. vm.$scopedSlots = emptyObject;
  47686. // bind the createElement fn to this instance
  47687. // so that we get proper render context inside it.
  47688. // args order: tag, data, children, normalizationType, alwaysNormalize
  47689. // internal version is used by render functions compiled from templates
  47690. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47691. // normalization is always applied for the public version, used in
  47692. // user-written render functions.
  47693. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47694. // $attrs & $listeners are exposed for easier HOC creation.
  47695. // they need to be reactive so that HOCs using them are always updated
  47696. var parentData = parentVnode && parentVnode.data;
  47697. /* istanbul ignore else */
  47698. {
  47699. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47700. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47701. }, true);
  47702. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47703. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47704. }, true);
  47705. }
  47706. }
  47707. var currentRenderingInstance = null;
  47708. function renderMixin (Vue) {
  47709. // install runtime convenience helpers
  47710. installRenderHelpers(Vue.prototype);
  47711. Vue.prototype.$nextTick = function (fn) {
  47712. return nextTick(fn, this)
  47713. };
  47714. Vue.prototype._render = function () {
  47715. var vm = this;
  47716. var ref = vm.$options;
  47717. var render = ref.render;
  47718. var _parentVnode = ref._parentVnode;
  47719. if (_parentVnode) {
  47720. vm.$scopedSlots = normalizeScopedSlots(
  47721. _parentVnode.data.scopedSlots,
  47722. vm.$slots,
  47723. vm.$scopedSlots
  47724. );
  47725. }
  47726. // set parent vnode. this allows render functions to have access
  47727. // to the data on the placeholder node.
  47728. vm.$vnode = _parentVnode;
  47729. // render self
  47730. var vnode;
  47731. try {
  47732. // There's no need to maintain a stack because all render fns are called
  47733. // separately from one another. Nested component's render fns are called
  47734. // when parent component is patched.
  47735. currentRenderingInstance = vm;
  47736. vnode = render.call(vm._renderProxy, vm.$createElement);
  47737. } catch (e) {
  47738. handleError(e, vm, "render");
  47739. // return error render result,
  47740. // or previous vnode to prevent render error causing blank component
  47741. /* istanbul ignore else */
  47742. if (vm.$options.renderError) {
  47743. try {
  47744. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47745. } catch (e) {
  47746. handleError(e, vm, "renderError");
  47747. vnode = vm._vnode;
  47748. }
  47749. } else {
  47750. vnode = vm._vnode;
  47751. }
  47752. } finally {
  47753. currentRenderingInstance = null;
  47754. }
  47755. // if the returned array contains only a single node, allow it
  47756. if (Array.isArray(vnode) && vnode.length === 1) {
  47757. vnode = vnode[0];
  47758. }
  47759. // return empty vnode in case the render function errored out
  47760. if (!(vnode instanceof VNode)) {
  47761. if (Array.isArray(vnode)) {
  47762. warn(
  47763. 'Multiple root nodes returned from render function. Render function ' +
  47764. 'should return a single root node.',
  47765. vm
  47766. );
  47767. }
  47768. vnode = createEmptyVNode();
  47769. }
  47770. // set parent
  47771. vnode.parent = _parentVnode;
  47772. return vnode
  47773. };
  47774. }
  47775. /* */
  47776. function ensureCtor (comp, base) {
  47777. if (
  47778. comp.__esModule ||
  47779. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  47780. ) {
  47781. comp = comp.default;
  47782. }
  47783. return isObject(comp)
  47784. ? base.extend(comp)
  47785. : comp
  47786. }
  47787. function createAsyncPlaceholder (
  47788. factory,
  47789. data,
  47790. context,
  47791. children,
  47792. tag
  47793. ) {
  47794. var node = createEmptyVNode();
  47795. node.asyncFactory = factory;
  47796. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  47797. return node
  47798. }
  47799. function resolveAsyncComponent (
  47800. factory,
  47801. baseCtor
  47802. ) {
  47803. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  47804. return factory.errorComp
  47805. }
  47806. if (isDef(factory.resolved)) {
  47807. return factory.resolved
  47808. }
  47809. var owner = currentRenderingInstance;
  47810. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  47811. // already pending
  47812. factory.owners.push(owner);
  47813. }
  47814. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  47815. return factory.loadingComp
  47816. }
  47817. if (owner && !isDef(factory.owners)) {
  47818. var owners = factory.owners = [owner];
  47819. var sync = true;
  47820. var timerLoading = null;
  47821. var timerTimeout = null
  47822. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  47823. var forceRender = function (renderCompleted) {
  47824. for (var i = 0, l = owners.length; i < l; i++) {
  47825. (owners[i]).$forceUpdate();
  47826. }
  47827. if (renderCompleted) {
  47828. owners.length = 0;
  47829. if (timerLoading !== null) {
  47830. clearTimeout(timerLoading);
  47831. timerLoading = null;
  47832. }
  47833. if (timerTimeout !== null) {
  47834. clearTimeout(timerTimeout);
  47835. timerTimeout = null;
  47836. }
  47837. }
  47838. };
  47839. var resolve = once(function (res) {
  47840. // cache resolved
  47841. factory.resolved = ensureCtor(res, baseCtor);
  47842. // invoke callbacks only if this is not a synchronous resolve
  47843. // (async resolves are shimmed as synchronous during SSR)
  47844. if (!sync) {
  47845. forceRender(true);
  47846. } else {
  47847. owners.length = 0;
  47848. }
  47849. });
  47850. var reject = once(function (reason) {
  47851. warn(
  47852. "Failed to resolve async component: " + (String(factory)) +
  47853. (reason ? ("\nReason: " + reason) : '')
  47854. );
  47855. if (isDef(factory.errorComp)) {
  47856. factory.error = true;
  47857. forceRender(true);
  47858. }
  47859. });
  47860. var res = factory(resolve, reject);
  47861. if (isObject(res)) {
  47862. if (isPromise(res)) {
  47863. // () => Promise
  47864. if (isUndef(factory.resolved)) {
  47865. res.then(resolve, reject);
  47866. }
  47867. } else if (isPromise(res.component)) {
  47868. res.component.then(resolve, reject);
  47869. if (isDef(res.error)) {
  47870. factory.errorComp = ensureCtor(res.error, baseCtor);
  47871. }
  47872. if (isDef(res.loading)) {
  47873. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  47874. if (res.delay === 0) {
  47875. factory.loading = true;
  47876. } else {
  47877. timerLoading = setTimeout(function () {
  47878. timerLoading = null;
  47879. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  47880. factory.loading = true;
  47881. forceRender(false);
  47882. }
  47883. }, res.delay || 200);
  47884. }
  47885. }
  47886. if (isDef(res.timeout)) {
  47887. timerTimeout = setTimeout(function () {
  47888. timerTimeout = null;
  47889. if (isUndef(factory.resolved)) {
  47890. reject(
  47891. "timeout (" + (res.timeout) + "ms)"
  47892. );
  47893. }
  47894. }, res.timeout);
  47895. }
  47896. }
  47897. }
  47898. sync = false;
  47899. // return in case resolved synchronously
  47900. return factory.loading
  47901. ? factory.loadingComp
  47902. : factory.resolved
  47903. }
  47904. }
  47905. /* */
  47906. function isAsyncPlaceholder (node) {
  47907. return node.isComment && node.asyncFactory
  47908. }
  47909. /* */
  47910. function getFirstComponentChild (children) {
  47911. if (Array.isArray(children)) {
  47912. for (var i = 0; i < children.length; i++) {
  47913. var c = children[i];
  47914. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  47915. return c
  47916. }
  47917. }
  47918. }
  47919. }
  47920. /* */
  47921. /* */
  47922. function initEvents (vm) {
  47923. vm._events = Object.create(null);
  47924. vm._hasHookEvent = false;
  47925. // init parent attached events
  47926. var listeners = vm.$options._parentListeners;
  47927. if (listeners) {
  47928. updateComponentListeners(vm, listeners);
  47929. }
  47930. }
  47931. var target;
  47932. function add (event, fn) {
  47933. target.$on(event, fn);
  47934. }
  47935. function remove$1 (event, fn) {
  47936. target.$off(event, fn);
  47937. }
  47938. function createOnceHandler (event, fn) {
  47939. var _target = target;
  47940. return function onceHandler () {
  47941. var res = fn.apply(null, arguments);
  47942. if (res !== null) {
  47943. _target.$off(event, onceHandler);
  47944. }
  47945. }
  47946. }
  47947. function updateComponentListeners (
  47948. vm,
  47949. listeners,
  47950. oldListeners
  47951. ) {
  47952. target = vm;
  47953. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  47954. target = undefined;
  47955. }
  47956. function eventsMixin (Vue) {
  47957. var hookRE = /^hook:/;
  47958. Vue.prototype.$on = function (event, fn) {
  47959. var vm = this;
  47960. if (Array.isArray(event)) {
  47961. for (var i = 0, l = event.length; i < l; i++) {
  47962. vm.$on(event[i], fn);
  47963. }
  47964. } else {
  47965. (vm._events[event] || (vm._events[event] = [])).push(fn);
  47966. // optimize hook:event cost by using a boolean flag marked at registration
  47967. // instead of a hash lookup
  47968. if (hookRE.test(event)) {
  47969. vm._hasHookEvent = true;
  47970. }
  47971. }
  47972. return vm
  47973. };
  47974. Vue.prototype.$once = function (event, fn) {
  47975. var vm = this;
  47976. function on () {
  47977. vm.$off(event, on);
  47978. fn.apply(vm, arguments);
  47979. }
  47980. on.fn = fn;
  47981. vm.$on(event, on);
  47982. return vm
  47983. };
  47984. Vue.prototype.$off = function (event, fn) {
  47985. var vm = this;
  47986. // all
  47987. if (!arguments.length) {
  47988. vm._events = Object.create(null);
  47989. return vm
  47990. }
  47991. // array of events
  47992. if (Array.isArray(event)) {
  47993. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  47994. vm.$off(event[i$1], fn);
  47995. }
  47996. return vm
  47997. }
  47998. // specific event
  47999. var cbs = vm._events[event];
  48000. if (!cbs) {
  48001. return vm
  48002. }
  48003. if (!fn) {
  48004. vm._events[event] = null;
  48005. return vm
  48006. }
  48007. // specific handler
  48008. var cb;
  48009. var i = cbs.length;
  48010. while (i--) {
  48011. cb = cbs[i];
  48012. if (cb === fn || cb.fn === fn) {
  48013. cbs.splice(i, 1);
  48014. break
  48015. }
  48016. }
  48017. return vm
  48018. };
  48019. Vue.prototype.$emit = function (event) {
  48020. var vm = this;
  48021. {
  48022. var lowerCaseEvent = event.toLowerCase();
  48023. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  48024. tip(
  48025. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  48026. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  48027. "Note that HTML attributes are case-insensitive and you cannot use " +
  48028. "v-on to listen to camelCase events when using in-DOM templates. " +
  48029. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  48030. );
  48031. }
  48032. }
  48033. var cbs = vm._events[event];
  48034. if (cbs) {
  48035. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  48036. var args = toArray(arguments, 1);
  48037. var info = "event handler for \"" + event + "\"";
  48038. for (var i = 0, l = cbs.length; i < l; i++) {
  48039. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  48040. }
  48041. }
  48042. return vm
  48043. };
  48044. }
  48045. /* */
  48046. var activeInstance = null;
  48047. var isUpdatingChildComponent = false;
  48048. function setActiveInstance(vm) {
  48049. var prevActiveInstance = activeInstance;
  48050. activeInstance = vm;
  48051. return function () {
  48052. activeInstance = prevActiveInstance;
  48053. }
  48054. }
  48055. function initLifecycle (vm) {
  48056. var options = vm.$options;
  48057. // locate first non-abstract parent
  48058. var parent = options.parent;
  48059. if (parent && !options.abstract) {
  48060. while (parent.$options.abstract && parent.$parent) {
  48061. parent = parent.$parent;
  48062. }
  48063. parent.$children.push(vm);
  48064. }
  48065. vm.$parent = parent;
  48066. vm.$root = parent ? parent.$root : vm;
  48067. vm.$children = [];
  48068. vm.$refs = {};
  48069. vm._watcher = null;
  48070. vm._inactive = null;
  48071. vm._directInactive = false;
  48072. vm._isMounted = false;
  48073. vm._isDestroyed = false;
  48074. vm._isBeingDestroyed = false;
  48075. }
  48076. function lifecycleMixin (Vue) {
  48077. Vue.prototype._update = function (vnode, hydrating) {
  48078. var vm = this;
  48079. var prevEl = vm.$el;
  48080. var prevVnode = vm._vnode;
  48081. var restoreActiveInstance = setActiveInstance(vm);
  48082. vm._vnode = vnode;
  48083. // Vue.prototype.__patch__ is injected in entry points
  48084. // based on the rendering backend used.
  48085. if (!prevVnode) {
  48086. // initial render
  48087. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  48088. } else {
  48089. // updates
  48090. vm.$el = vm.__patch__(prevVnode, vnode);
  48091. }
  48092. restoreActiveInstance();
  48093. // update __vue__ reference
  48094. if (prevEl) {
  48095. prevEl.__vue__ = null;
  48096. }
  48097. if (vm.$el) {
  48098. vm.$el.__vue__ = vm;
  48099. }
  48100. // if parent is an HOC, update its $el as well
  48101. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  48102. vm.$parent.$el = vm.$el;
  48103. }
  48104. // updated hook is called by the scheduler to ensure that children are
  48105. // updated in a parent's updated hook.
  48106. };
  48107. Vue.prototype.$forceUpdate = function () {
  48108. var vm = this;
  48109. if (vm._watcher) {
  48110. vm._watcher.update();
  48111. }
  48112. };
  48113. Vue.prototype.$destroy = function () {
  48114. var vm = this;
  48115. if (vm._isBeingDestroyed) {
  48116. return
  48117. }
  48118. callHook(vm, 'beforeDestroy');
  48119. vm._isBeingDestroyed = true;
  48120. // remove self from parent
  48121. var parent = vm.$parent;
  48122. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  48123. remove(parent.$children, vm);
  48124. }
  48125. // teardown watchers
  48126. if (vm._watcher) {
  48127. vm._watcher.teardown();
  48128. }
  48129. var i = vm._watchers.length;
  48130. while (i--) {
  48131. vm._watchers[i].teardown();
  48132. }
  48133. // remove reference from data ob
  48134. // frozen object may not have observer.
  48135. if (vm._data.__ob__) {
  48136. vm._data.__ob__.vmCount--;
  48137. }
  48138. // call the last hook...
  48139. vm._isDestroyed = true;
  48140. // invoke destroy hooks on current rendered tree
  48141. vm.__patch__(vm._vnode, null);
  48142. // fire destroyed hook
  48143. callHook(vm, 'destroyed');
  48144. // turn off all instance listeners.
  48145. vm.$off();
  48146. // remove __vue__ reference
  48147. if (vm.$el) {
  48148. vm.$el.__vue__ = null;
  48149. }
  48150. // release circular reference (#6759)
  48151. if (vm.$vnode) {
  48152. vm.$vnode.parent = null;
  48153. }
  48154. };
  48155. }
  48156. function mountComponent (
  48157. vm,
  48158. el,
  48159. hydrating
  48160. ) {
  48161. vm.$el = el;
  48162. if (!vm.$options.render) {
  48163. vm.$options.render = createEmptyVNode;
  48164. {
  48165. /* istanbul ignore if */
  48166. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  48167. vm.$options.el || el) {
  48168. warn(
  48169. 'You are using the runtime-only build of Vue where the template ' +
  48170. 'compiler is not available. Either pre-compile the templates into ' +
  48171. 'render functions, or use the compiler-included build.',
  48172. vm
  48173. );
  48174. } else {
  48175. warn(
  48176. 'Failed to mount component: template or render function not defined.',
  48177. vm
  48178. );
  48179. }
  48180. }
  48181. }
  48182. callHook(vm, 'beforeMount');
  48183. var updateComponent;
  48184. /* istanbul ignore if */
  48185. if (config.performance && mark) {
  48186. updateComponent = function () {
  48187. var name = vm._name;
  48188. var id = vm._uid;
  48189. var startTag = "vue-perf-start:" + id;
  48190. var endTag = "vue-perf-end:" + id;
  48191. mark(startTag);
  48192. var vnode = vm._render();
  48193. mark(endTag);
  48194. measure(("vue " + name + " render"), startTag, endTag);
  48195. mark(startTag);
  48196. vm._update(vnode, hydrating);
  48197. mark(endTag);
  48198. measure(("vue " + name + " patch"), startTag, endTag);
  48199. };
  48200. } else {
  48201. updateComponent = function () {
  48202. vm._update(vm._render(), hydrating);
  48203. };
  48204. }
  48205. // we set this to vm._watcher inside the watcher's constructor
  48206. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  48207. // component's mounted hook), which relies on vm._watcher being already defined
  48208. new Watcher(vm, updateComponent, noop, {
  48209. before: function before () {
  48210. if (vm._isMounted && !vm._isDestroyed) {
  48211. callHook(vm, 'beforeUpdate');
  48212. }
  48213. }
  48214. }, true /* isRenderWatcher */);
  48215. hydrating = false;
  48216. // manually mounted instance, call mounted on self
  48217. // mounted is called for render-created child components in its inserted hook
  48218. if (vm.$vnode == null) {
  48219. vm._isMounted = true;
  48220. callHook(vm, 'mounted');
  48221. }
  48222. return vm
  48223. }
  48224. function updateChildComponent (
  48225. vm,
  48226. propsData,
  48227. listeners,
  48228. parentVnode,
  48229. renderChildren
  48230. ) {
  48231. {
  48232. isUpdatingChildComponent = true;
  48233. }
  48234. // determine whether component has slot children
  48235. // we need to do this before overwriting $options._renderChildren.
  48236. // check if there are dynamic scopedSlots (hand-written or compiled but with
  48237. // dynamic slot names). Static scoped slots compiled from template has the
  48238. // "$stable" marker.
  48239. var newScopedSlots = parentVnode.data.scopedSlots;
  48240. var oldScopedSlots = vm.$scopedSlots;
  48241. var hasDynamicScopedSlot = !!(
  48242. (newScopedSlots && !newScopedSlots.$stable) ||
  48243. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  48244. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  48245. );
  48246. // Any static slot children from the parent may have changed during parent's
  48247. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  48248. // update is necessary to ensure correctness.
  48249. var needsForceUpdate = !!(
  48250. renderChildren || // has new static slots
  48251. vm.$options._renderChildren || // has old static slots
  48252. hasDynamicScopedSlot
  48253. );
  48254. vm.$options._parentVnode = parentVnode;
  48255. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  48256. if (vm._vnode) { // update child tree's parent
  48257. vm._vnode.parent = parentVnode;
  48258. }
  48259. vm.$options._renderChildren = renderChildren;
  48260. // update $attrs and $listeners hash
  48261. // these are also reactive so they may trigger child update if the child
  48262. // used them during render
  48263. vm.$attrs = parentVnode.data.attrs || emptyObject;
  48264. vm.$listeners = listeners || emptyObject;
  48265. // update props
  48266. if (propsData && vm.$options.props) {
  48267. toggleObserving(false);
  48268. var props = vm._props;
  48269. var propKeys = vm.$options._propKeys || [];
  48270. for (var i = 0; i < propKeys.length; i++) {
  48271. var key = propKeys[i];
  48272. var propOptions = vm.$options.props; // wtf flow?
  48273. props[key] = validateProp(key, propOptions, propsData, vm);
  48274. }
  48275. toggleObserving(true);
  48276. // keep a copy of raw propsData
  48277. vm.$options.propsData = propsData;
  48278. }
  48279. // update listeners
  48280. listeners = listeners || emptyObject;
  48281. var oldListeners = vm.$options._parentListeners;
  48282. vm.$options._parentListeners = listeners;
  48283. updateComponentListeners(vm, listeners, oldListeners);
  48284. // resolve slots + force update if has children
  48285. if (needsForceUpdate) {
  48286. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  48287. vm.$forceUpdate();
  48288. }
  48289. {
  48290. isUpdatingChildComponent = false;
  48291. }
  48292. }
  48293. function isInInactiveTree (vm) {
  48294. while (vm && (vm = vm.$parent)) {
  48295. if (vm._inactive) { return true }
  48296. }
  48297. return false
  48298. }
  48299. function activateChildComponent (vm, direct) {
  48300. if (direct) {
  48301. vm._directInactive = false;
  48302. if (isInInactiveTree(vm)) {
  48303. return
  48304. }
  48305. } else if (vm._directInactive) {
  48306. return
  48307. }
  48308. if (vm._inactive || vm._inactive === null) {
  48309. vm._inactive = false;
  48310. for (var i = 0; i < vm.$children.length; i++) {
  48311. activateChildComponent(vm.$children[i]);
  48312. }
  48313. callHook(vm, 'activated');
  48314. }
  48315. }
  48316. function deactivateChildComponent (vm, direct) {
  48317. if (direct) {
  48318. vm._directInactive = true;
  48319. if (isInInactiveTree(vm)) {
  48320. return
  48321. }
  48322. }
  48323. if (!vm._inactive) {
  48324. vm._inactive = true;
  48325. for (var i = 0; i < vm.$children.length; i++) {
  48326. deactivateChildComponent(vm.$children[i]);
  48327. }
  48328. callHook(vm, 'deactivated');
  48329. }
  48330. }
  48331. function callHook (vm, hook) {
  48332. // #7573 disable dep collection when invoking lifecycle hooks
  48333. pushTarget();
  48334. var handlers = vm.$options[hook];
  48335. var info = hook + " hook";
  48336. if (handlers) {
  48337. for (var i = 0, j = handlers.length; i < j; i++) {
  48338. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  48339. }
  48340. }
  48341. if (vm._hasHookEvent) {
  48342. vm.$emit('hook:' + hook);
  48343. }
  48344. popTarget();
  48345. }
  48346. /* */
  48347. var MAX_UPDATE_COUNT = 100;
  48348. var queue = [];
  48349. var activatedChildren = [];
  48350. var has = {};
  48351. var circular = {};
  48352. var waiting = false;
  48353. var flushing = false;
  48354. var index = 0;
  48355. /**
  48356. * Reset the scheduler's state.
  48357. */
  48358. function resetSchedulerState () {
  48359. index = queue.length = activatedChildren.length = 0;
  48360. has = {};
  48361. {
  48362. circular = {};
  48363. }
  48364. waiting = flushing = false;
  48365. }
  48366. // Async edge case #6566 requires saving the timestamp when event listeners are
  48367. // attached. However, calling performance.now() has a perf overhead especially
  48368. // if the page has thousands of event listeners. Instead, we take a timestamp
  48369. // every time the scheduler flushes and use that for all event listeners
  48370. // attached during that flush.
  48371. var currentFlushTimestamp = 0;
  48372. // Async edge case fix requires storing an event listener's attach timestamp.
  48373. var getNow = Date.now;
  48374. // Determine what event timestamp the browser is using. Annoyingly, the
  48375. // timestamp can either be hi-res (relative to page load) or low-res
  48376. // (relative to UNIX epoch), so in order to compare time we have to use the
  48377. // same timestamp type when saving the flush timestamp.
  48378. // All IE versions use low-res event timestamps, and have problematic clock
  48379. // implementations (#9632)
  48380. if (inBrowser && !isIE) {
  48381. var performance = window.performance;
  48382. if (
  48383. performance &&
  48384. typeof performance.now === 'function' &&
  48385. getNow() > document.createEvent('Event').timeStamp
  48386. ) {
  48387. // if the event timestamp, although evaluated AFTER the Date.now(), is
  48388. // smaller than it, it means the event is using a hi-res timestamp,
  48389. // and we need to use the hi-res version for event listener timestamps as
  48390. // well.
  48391. getNow = function () { return performance.now(); };
  48392. }
  48393. }
  48394. /**
  48395. * Flush both queues and run the watchers.
  48396. */
  48397. function flushSchedulerQueue () {
  48398. currentFlushTimestamp = getNow();
  48399. flushing = true;
  48400. var watcher, id;
  48401. // Sort queue before flush.
  48402. // This ensures that:
  48403. // 1. Components are updated from parent to child. (because parent is always
  48404. // created before the child)
  48405. // 2. A component's user watchers are run before its render watcher (because
  48406. // user watchers are created before the render watcher)
  48407. // 3. If a component is destroyed during a parent component's watcher run,
  48408. // its watchers can be skipped.
  48409. queue.sort(function (a, b) { return a.id - b.id; });
  48410. // do not cache length because more watchers might be pushed
  48411. // as we run existing watchers
  48412. for (index = 0; index < queue.length; index++) {
  48413. watcher = queue[index];
  48414. if (watcher.before) {
  48415. watcher.before();
  48416. }
  48417. id = watcher.id;
  48418. has[id] = null;
  48419. watcher.run();
  48420. // in dev build, check and stop circular updates.
  48421. if (has[id] != null) {
  48422. circular[id] = (circular[id] || 0) + 1;
  48423. if (circular[id] > MAX_UPDATE_COUNT) {
  48424. warn(
  48425. 'You may have an infinite update loop ' + (
  48426. watcher.user
  48427. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  48428. : "in a component render function."
  48429. ),
  48430. watcher.vm
  48431. );
  48432. break
  48433. }
  48434. }
  48435. }
  48436. // keep copies of post queues before resetting state
  48437. var activatedQueue = activatedChildren.slice();
  48438. var updatedQueue = queue.slice();
  48439. resetSchedulerState();
  48440. // call component updated and activated hooks
  48441. callActivatedHooks(activatedQueue);
  48442. callUpdatedHooks(updatedQueue);
  48443. // devtool hook
  48444. /* istanbul ignore if */
  48445. if (devtools && config.devtools) {
  48446. devtools.emit('flush');
  48447. }
  48448. }
  48449. function callUpdatedHooks (queue) {
  48450. var i = queue.length;
  48451. while (i--) {
  48452. var watcher = queue[i];
  48453. var vm = watcher.vm;
  48454. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  48455. callHook(vm, 'updated');
  48456. }
  48457. }
  48458. }
  48459. /**
  48460. * Queue a kept-alive component that was activated during patch.
  48461. * The queue will be processed after the entire tree has been patched.
  48462. */
  48463. function queueActivatedComponent (vm) {
  48464. // setting _inactive to false here so that a render function can
  48465. // rely on checking whether it's in an inactive tree (e.g. router-view)
  48466. vm._inactive = false;
  48467. activatedChildren.push(vm);
  48468. }
  48469. function callActivatedHooks (queue) {
  48470. for (var i = 0; i < queue.length; i++) {
  48471. queue[i]._inactive = true;
  48472. activateChildComponent(queue[i], true /* true */);
  48473. }
  48474. }
  48475. /**
  48476. * Push a watcher into the watcher queue.
  48477. * Jobs with duplicate IDs will be skipped unless it's
  48478. * pushed when the queue is being flushed.
  48479. */
  48480. function queueWatcher (watcher) {
  48481. var id = watcher.id;
  48482. if (has[id] == null) {
  48483. has[id] = true;
  48484. if (!flushing) {
  48485. queue.push(watcher);
  48486. } else {
  48487. // if already flushing, splice the watcher based on its id
  48488. // if already past its id, it will be run next immediately.
  48489. var i = queue.length - 1;
  48490. while (i > index && queue[i].id > watcher.id) {
  48491. i--;
  48492. }
  48493. queue.splice(i + 1, 0, watcher);
  48494. }
  48495. // queue the flush
  48496. if (!waiting) {
  48497. waiting = true;
  48498. if (!config.async) {
  48499. flushSchedulerQueue();
  48500. return
  48501. }
  48502. nextTick(flushSchedulerQueue);
  48503. }
  48504. }
  48505. }
  48506. /* */
  48507. var uid$2 = 0;
  48508. /**
  48509. * A watcher parses an expression, collects dependencies,
  48510. * and fires callback when the expression value changes.
  48511. * This is used for both the $watch() api and directives.
  48512. */
  48513. var Watcher = function Watcher (
  48514. vm,
  48515. expOrFn,
  48516. cb,
  48517. options,
  48518. isRenderWatcher
  48519. ) {
  48520. this.vm = vm;
  48521. if (isRenderWatcher) {
  48522. vm._watcher = this;
  48523. }
  48524. vm._watchers.push(this);
  48525. // options
  48526. if (options) {
  48527. this.deep = !!options.deep;
  48528. this.user = !!options.user;
  48529. this.lazy = !!options.lazy;
  48530. this.sync = !!options.sync;
  48531. this.before = options.before;
  48532. } else {
  48533. this.deep = this.user = this.lazy = this.sync = false;
  48534. }
  48535. this.cb = cb;
  48536. this.id = ++uid$2; // uid for batching
  48537. this.active = true;
  48538. this.dirty = this.lazy; // for lazy watchers
  48539. this.deps = [];
  48540. this.newDeps = [];
  48541. this.depIds = new _Set();
  48542. this.newDepIds = new _Set();
  48543. this.expression = expOrFn.toString();
  48544. // parse expression for getter
  48545. if (typeof expOrFn === 'function') {
  48546. this.getter = expOrFn;
  48547. } else {
  48548. this.getter = parsePath(expOrFn);
  48549. if (!this.getter) {
  48550. this.getter = noop;
  48551. warn(
  48552. "Failed watching path: \"" + expOrFn + "\" " +
  48553. 'Watcher only accepts simple dot-delimited paths. ' +
  48554. 'For full control, use a function instead.',
  48555. vm
  48556. );
  48557. }
  48558. }
  48559. this.value = this.lazy
  48560. ? undefined
  48561. : this.get();
  48562. };
  48563. /**
  48564. * Evaluate the getter, and re-collect dependencies.
  48565. */
  48566. Watcher.prototype.get = function get () {
  48567. pushTarget(this);
  48568. var value;
  48569. var vm = this.vm;
  48570. try {
  48571. value = this.getter.call(vm, vm);
  48572. } catch (e) {
  48573. if (this.user) {
  48574. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48575. } else {
  48576. throw e
  48577. }
  48578. } finally {
  48579. // "touch" every property so they are all tracked as
  48580. // dependencies for deep watching
  48581. if (this.deep) {
  48582. traverse(value);
  48583. }
  48584. popTarget();
  48585. this.cleanupDeps();
  48586. }
  48587. return value
  48588. };
  48589. /**
  48590. * Add a dependency to this directive.
  48591. */
  48592. Watcher.prototype.addDep = function addDep (dep) {
  48593. var id = dep.id;
  48594. if (!this.newDepIds.has(id)) {
  48595. this.newDepIds.add(id);
  48596. this.newDeps.push(dep);
  48597. if (!this.depIds.has(id)) {
  48598. dep.addSub(this);
  48599. }
  48600. }
  48601. };
  48602. /**
  48603. * Clean up for dependency collection.
  48604. */
  48605. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48606. var i = this.deps.length;
  48607. while (i--) {
  48608. var dep = this.deps[i];
  48609. if (!this.newDepIds.has(dep.id)) {
  48610. dep.removeSub(this);
  48611. }
  48612. }
  48613. var tmp = this.depIds;
  48614. this.depIds = this.newDepIds;
  48615. this.newDepIds = tmp;
  48616. this.newDepIds.clear();
  48617. tmp = this.deps;
  48618. this.deps = this.newDeps;
  48619. this.newDeps = tmp;
  48620. this.newDeps.length = 0;
  48621. };
  48622. /**
  48623. * Subscriber interface.
  48624. * Will be called when a dependency changes.
  48625. */
  48626. Watcher.prototype.update = function update () {
  48627. /* istanbul ignore else */
  48628. if (this.lazy) {
  48629. this.dirty = true;
  48630. } else if (this.sync) {
  48631. this.run();
  48632. } else {
  48633. queueWatcher(this);
  48634. }
  48635. };
  48636. /**
  48637. * Scheduler job interface.
  48638. * Will be called by the scheduler.
  48639. */
  48640. Watcher.prototype.run = function run () {
  48641. if (this.active) {
  48642. var value = this.get();
  48643. if (
  48644. value !== this.value ||
  48645. // Deep watchers and watchers on Object/Arrays should fire even
  48646. // when the value is the same, because the value may
  48647. // have mutated.
  48648. isObject(value) ||
  48649. this.deep
  48650. ) {
  48651. // set new value
  48652. var oldValue = this.value;
  48653. this.value = value;
  48654. if (this.user) {
  48655. try {
  48656. this.cb.call(this.vm, value, oldValue);
  48657. } catch (e) {
  48658. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48659. }
  48660. } else {
  48661. this.cb.call(this.vm, value, oldValue);
  48662. }
  48663. }
  48664. }
  48665. };
  48666. /**
  48667. * Evaluate the value of the watcher.
  48668. * This only gets called for lazy watchers.
  48669. */
  48670. Watcher.prototype.evaluate = function evaluate () {
  48671. this.value = this.get();
  48672. this.dirty = false;
  48673. };
  48674. /**
  48675. * Depend on all deps collected by this watcher.
  48676. */
  48677. Watcher.prototype.depend = function depend () {
  48678. var i = this.deps.length;
  48679. while (i--) {
  48680. this.deps[i].depend();
  48681. }
  48682. };
  48683. /**
  48684. * Remove self from all dependencies' subscriber list.
  48685. */
  48686. Watcher.prototype.teardown = function teardown () {
  48687. if (this.active) {
  48688. // remove self from vm's watcher list
  48689. // this is a somewhat expensive operation so we skip it
  48690. // if the vm is being destroyed.
  48691. if (!this.vm._isBeingDestroyed) {
  48692. remove(this.vm._watchers, this);
  48693. }
  48694. var i = this.deps.length;
  48695. while (i--) {
  48696. this.deps[i].removeSub(this);
  48697. }
  48698. this.active = false;
  48699. }
  48700. };
  48701. /* */
  48702. var sharedPropertyDefinition = {
  48703. enumerable: true,
  48704. configurable: true,
  48705. get: noop,
  48706. set: noop
  48707. };
  48708. function proxy (target, sourceKey, key) {
  48709. sharedPropertyDefinition.get = function proxyGetter () {
  48710. return this[sourceKey][key]
  48711. };
  48712. sharedPropertyDefinition.set = function proxySetter (val) {
  48713. this[sourceKey][key] = val;
  48714. };
  48715. Object.defineProperty(target, key, sharedPropertyDefinition);
  48716. }
  48717. function initState (vm) {
  48718. vm._watchers = [];
  48719. var opts = vm.$options;
  48720. if (opts.props) { initProps(vm, opts.props); }
  48721. if (opts.methods) { initMethods(vm, opts.methods); }
  48722. if (opts.data) {
  48723. initData(vm);
  48724. } else {
  48725. observe(vm._data = {}, true /* asRootData */);
  48726. }
  48727. if (opts.computed) { initComputed(vm, opts.computed); }
  48728. if (opts.watch && opts.watch !== nativeWatch) {
  48729. initWatch(vm, opts.watch);
  48730. }
  48731. }
  48732. function initProps (vm, propsOptions) {
  48733. var propsData = vm.$options.propsData || {};
  48734. var props = vm._props = {};
  48735. // cache prop keys so that future props updates can iterate using Array
  48736. // instead of dynamic object key enumeration.
  48737. var keys = vm.$options._propKeys = [];
  48738. var isRoot = !vm.$parent;
  48739. // root instance props should be converted
  48740. if (!isRoot) {
  48741. toggleObserving(false);
  48742. }
  48743. var loop = function ( key ) {
  48744. keys.push(key);
  48745. var value = validateProp(key, propsOptions, propsData, vm);
  48746. /* istanbul ignore else */
  48747. {
  48748. var hyphenatedKey = hyphenate(key);
  48749. if (isReservedAttribute(hyphenatedKey) ||
  48750. config.isReservedAttr(hyphenatedKey)) {
  48751. warn(
  48752. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48753. vm
  48754. );
  48755. }
  48756. defineReactive$$1(props, key, value, function () {
  48757. if (!isRoot && !isUpdatingChildComponent) {
  48758. warn(
  48759. "Avoid mutating a prop directly since the value will be " +
  48760. "overwritten whenever the parent component re-renders. " +
  48761. "Instead, use a data or computed property based on the prop's " +
  48762. "value. Prop being mutated: \"" + key + "\"",
  48763. vm
  48764. );
  48765. }
  48766. });
  48767. }
  48768. // static props are already proxied on the component's prototype
  48769. // during Vue.extend(). We only need to proxy props defined at
  48770. // instantiation here.
  48771. if (!(key in vm)) {
  48772. proxy(vm, "_props", key);
  48773. }
  48774. };
  48775. for (var key in propsOptions) loop( key );
  48776. toggleObserving(true);
  48777. }
  48778. function initData (vm) {
  48779. var data = vm.$options.data;
  48780. data = vm._data = typeof data === 'function'
  48781. ? getData(data, vm)
  48782. : data || {};
  48783. if (!isPlainObject(data)) {
  48784. data = {};
  48785. warn(
  48786. 'data functions should return an object:\n' +
  48787. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  48788. vm
  48789. );
  48790. }
  48791. // proxy data on instance
  48792. var keys = Object.keys(data);
  48793. var props = vm.$options.props;
  48794. var methods = vm.$options.methods;
  48795. var i = keys.length;
  48796. while (i--) {
  48797. var key = keys[i];
  48798. {
  48799. if (methods && hasOwn(methods, key)) {
  48800. warn(
  48801. ("Method \"" + key + "\" has already been defined as a data property."),
  48802. vm
  48803. );
  48804. }
  48805. }
  48806. if (props && hasOwn(props, key)) {
  48807. warn(
  48808. "The data property \"" + key + "\" is already declared as a prop. " +
  48809. "Use prop default value instead.",
  48810. vm
  48811. );
  48812. } else if (!isReserved(key)) {
  48813. proxy(vm, "_data", key);
  48814. }
  48815. }
  48816. // observe data
  48817. observe(data, true /* asRootData */);
  48818. }
  48819. function getData (data, vm) {
  48820. // #7573 disable dep collection when invoking data getters
  48821. pushTarget();
  48822. try {
  48823. return data.call(vm, vm)
  48824. } catch (e) {
  48825. handleError(e, vm, "data()");
  48826. return {}
  48827. } finally {
  48828. popTarget();
  48829. }
  48830. }
  48831. var computedWatcherOptions = { lazy: true };
  48832. function initComputed (vm, computed) {
  48833. // $flow-disable-line
  48834. var watchers = vm._computedWatchers = Object.create(null);
  48835. // computed properties are just getters during SSR
  48836. var isSSR = isServerRendering();
  48837. for (var key in computed) {
  48838. var userDef = computed[key];
  48839. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  48840. if (getter == null) {
  48841. warn(
  48842. ("Getter is missing for computed property \"" + key + "\"."),
  48843. vm
  48844. );
  48845. }
  48846. if (!isSSR) {
  48847. // create internal watcher for the computed property.
  48848. watchers[key] = new Watcher(
  48849. vm,
  48850. getter || noop,
  48851. noop,
  48852. computedWatcherOptions
  48853. );
  48854. }
  48855. // component-defined computed properties are already defined on the
  48856. // component prototype. We only need to define computed properties defined
  48857. // at instantiation here.
  48858. if (!(key in vm)) {
  48859. defineComputed(vm, key, userDef);
  48860. } else {
  48861. if (key in vm.$data) {
  48862. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  48863. } else if (vm.$options.props && key in vm.$options.props) {
  48864. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  48865. }
  48866. }
  48867. }
  48868. }
  48869. function defineComputed (
  48870. target,
  48871. key,
  48872. userDef
  48873. ) {
  48874. var shouldCache = !isServerRendering();
  48875. if (typeof userDef === 'function') {
  48876. sharedPropertyDefinition.get = shouldCache
  48877. ? createComputedGetter(key)
  48878. : createGetterInvoker(userDef);
  48879. sharedPropertyDefinition.set = noop;
  48880. } else {
  48881. sharedPropertyDefinition.get = userDef.get
  48882. ? shouldCache && userDef.cache !== false
  48883. ? createComputedGetter(key)
  48884. : createGetterInvoker(userDef.get)
  48885. : noop;
  48886. sharedPropertyDefinition.set = userDef.set || noop;
  48887. }
  48888. if (sharedPropertyDefinition.set === noop) {
  48889. sharedPropertyDefinition.set = function () {
  48890. warn(
  48891. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  48892. this
  48893. );
  48894. };
  48895. }
  48896. Object.defineProperty(target, key, sharedPropertyDefinition);
  48897. }
  48898. function createComputedGetter (key) {
  48899. return function computedGetter () {
  48900. var watcher = this._computedWatchers && this._computedWatchers[key];
  48901. if (watcher) {
  48902. if (watcher.dirty) {
  48903. watcher.evaluate();
  48904. }
  48905. if (Dep.target) {
  48906. watcher.depend();
  48907. }
  48908. return watcher.value
  48909. }
  48910. }
  48911. }
  48912. function createGetterInvoker(fn) {
  48913. return function computedGetter () {
  48914. return fn.call(this, this)
  48915. }
  48916. }
  48917. function initMethods (vm, methods) {
  48918. var props = vm.$options.props;
  48919. for (var key in methods) {
  48920. {
  48921. if (typeof methods[key] !== 'function') {
  48922. warn(
  48923. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  48924. "Did you reference the function correctly?",
  48925. vm
  48926. );
  48927. }
  48928. if (props && hasOwn(props, key)) {
  48929. warn(
  48930. ("Method \"" + key + "\" has already been defined as a prop."),
  48931. vm
  48932. );
  48933. }
  48934. if ((key in vm) && isReserved(key)) {
  48935. warn(
  48936. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  48937. "Avoid defining component methods that start with _ or $."
  48938. );
  48939. }
  48940. }
  48941. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  48942. }
  48943. }
  48944. function initWatch (vm, watch) {
  48945. for (var key in watch) {
  48946. var handler = watch[key];
  48947. if (Array.isArray(handler)) {
  48948. for (var i = 0; i < handler.length; i++) {
  48949. createWatcher(vm, key, handler[i]);
  48950. }
  48951. } else {
  48952. createWatcher(vm, key, handler);
  48953. }
  48954. }
  48955. }
  48956. function createWatcher (
  48957. vm,
  48958. expOrFn,
  48959. handler,
  48960. options
  48961. ) {
  48962. if (isPlainObject(handler)) {
  48963. options = handler;
  48964. handler = handler.handler;
  48965. }
  48966. if (typeof handler === 'string') {
  48967. handler = vm[handler];
  48968. }
  48969. return vm.$watch(expOrFn, handler, options)
  48970. }
  48971. function stateMixin (Vue) {
  48972. // flow somehow has problems with directly declared definition object
  48973. // when using Object.defineProperty, so we have to procedurally build up
  48974. // the object here.
  48975. var dataDef = {};
  48976. dataDef.get = function () { return this._data };
  48977. var propsDef = {};
  48978. propsDef.get = function () { return this._props };
  48979. {
  48980. dataDef.set = function () {
  48981. warn(
  48982. 'Avoid replacing instance root $data. ' +
  48983. 'Use nested data properties instead.',
  48984. this
  48985. );
  48986. };
  48987. propsDef.set = function () {
  48988. warn("$props is readonly.", this);
  48989. };
  48990. }
  48991. Object.defineProperty(Vue.prototype, '$data', dataDef);
  48992. Object.defineProperty(Vue.prototype, '$props', propsDef);
  48993. Vue.prototype.$set = set;
  48994. Vue.prototype.$delete = del;
  48995. Vue.prototype.$watch = function (
  48996. expOrFn,
  48997. cb,
  48998. options
  48999. ) {
  49000. var vm = this;
  49001. if (isPlainObject(cb)) {
  49002. return createWatcher(vm, expOrFn, cb, options)
  49003. }
  49004. options = options || {};
  49005. options.user = true;
  49006. var watcher = new Watcher(vm, expOrFn, cb, options);
  49007. if (options.immediate) {
  49008. try {
  49009. cb.call(vm, watcher.value);
  49010. } catch (error) {
  49011. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  49012. }
  49013. }
  49014. return function unwatchFn () {
  49015. watcher.teardown();
  49016. }
  49017. };
  49018. }
  49019. /* */
  49020. var uid$3 = 0;
  49021. function initMixin (Vue) {
  49022. Vue.prototype._init = function (options) {
  49023. var vm = this;
  49024. // a uid
  49025. vm._uid = uid$3++;
  49026. var startTag, endTag;
  49027. /* istanbul ignore if */
  49028. if (config.performance && mark) {
  49029. startTag = "vue-perf-start:" + (vm._uid);
  49030. endTag = "vue-perf-end:" + (vm._uid);
  49031. mark(startTag);
  49032. }
  49033. // a flag to avoid this being observed
  49034. vm._isVue = true;
  49035. // merge options
  49036. if (options && options._isComponent) {
  49037. // optimize internal component instantiation
  49038. // since dynamic options merging is pretty slow, and none of the
  49039. // internal component options needs special treatment.
  49040. initInternalComponent(vm, options);
  49041. } else {
  49042. vm.$options = mergeOptions(
  49043. resolveConstructorOptions(vm.constructor),
  49044. options || {},
  49045. vm
  49046. );
  49047. }
  49048. /* istanbul ignore else */
  49049. {
  49050. initProxy(vm);
  49051. }
  49052. // expose real self
  49053. vm._self = vm;
  49054. initLifecycle(vm);
  49055. initEvents(vm);
  49056. initRender(vm);
  49057. callHook(vm, 'beforeCreate');
  49058. initInjections(vm); // resolve injections before data/props
  49059. initState(vm);
  49060. initProvide(vm); // resolve provide after data/props
  49061. callHook(vm, 'created');
  49062. /* istanbul ignore if */
  49063. if (config.performance && mark) {
  49064. vm._name = formatComponentName(vm, false);
  49065. mark(endTag);
  49066. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  49067. }
  49068. if (vm.$options.el) {
  49069. vm.$mount(vm.$options.el);
  49070. }
  49071. };
  49072. }
  49073. function initInternalComponent (vm, options) {
  49074. var opts = vm.$options = Object.create(vm.constructor.options);
  49075. // doing this because it's faster than dynamic enumeration.
  49076. var parentVnode = options._parentVnode;
  49077. opts.parent = options.parent;
  49078. opts._parentVnode = parentVnode;
  49079. var vnodeComponentOptions = parentVnode.componentOptions;
  49080. opts.propsData = vnodeComponentOptions.propsData;
  49081. opts._parentListeners = vnodeComponentOptions.listeners;
  49082. opts._renderChildren = vnodeComponentOptions.children;
  49083. opts._componentTag = vnodeComponentOptions.tag;
  49084. if (options.render) {
  49085. opts.render = options.render;
  49086. opts.staticRenderFns = options.staticRenderFns;
  49087. }
  49088. }
  49089. function resolveConstructorOptions (Ctor) {
  49090. var options = Ctor.options;
  49091. if (Ctor.super) {
  49092. var superOptions = resolveConstructorOptions(Ctor.super);
  49093. var cachedSuperOptions = Ctor.superOptions;
  49094. if (superOptions !== cachedSuperOptions) {
  49095. // super option changed,
  49096. // need to resolve new options.
  49097. Ctor.superOptions = superOptions;
  49098. // check if there are any late-modified/attached options (#4976)
  49099. var modifiedOptions = resolveModifiedOptions(Ctor);
  49100. // update base extend options
  49101. if (modifiedOptions) {
  49102. extend(Ctor.extendOptions, modifiedOptions);
  49103. }
  49104. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  49105. if (options.name) {
  49106. options.components[options.name] = Ctor;
  49107. }
  49108. }
  49109. }
  49110. return options
  49111. }
  49112. function resolveModifiedOptions (Ctor) {
  49113. var modified;
  49114. var latest = Ctor.options;
  49115. var sealed = Ctor.sealedOptions;
  49116. for (var key in latest) {
  49117. if (latest[key] !== sealed[key]) {
  49118. if (!modified) { modified = {}; }
  49119. modified[key] = latest[key];
  49120. }
  49121. }
  49122. return modified
  49123. }
  49124. function Vue (options) {
  49125. if (!(this instanceof Vue)
  49126. ) {
  49127. warn('Vue is a constructor and should be called with the `new` keyword');
  49128. }
  49129. this._init(options);
  49130. }
  49131. initMixin(Vue);
  49132. stateMixin(Vue);
  49133. eventsMixin(Vue);
  49134. lifecycleMixin(Vue);
  49135. renderMixin(Vue);
  49136. /* */
  49137. function initUse (Vue) {
  49138. Vue.use = function (plugin) {
  49139. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  49140. if (installedPlugins.indexOf(plugin) > -1) {
  49141. return this
  49142. }
  49143. // additional parameters
  49144. var args = toArray(arguments, 1);
  49145. args.unshift(this);
  49146. if (typeof plugin.install === 'function') {
  49147. plugin.install.apply(plugin, args);
  49148. } else if (typeof plugin === 'function') {
  49149. plugin.apply(null, args);
  49150. }
  49151. installedPlugins.push(plugin);
  49152. return this
  49153. };
  49154. }
  49155. /* */
  49156. function initMixin$1 (Vue) {
  49157. Vue.mixin = function (mixin) {
  49158. this.options = mergeOptions(this.options, mixin);
  49159. return this
  49160. };
  49161. }
  49162. /* */
  49163. function initExtend (Vue) {
  49164. /**
  49165. * Each instance constructor, including Vue, has a unique
  49166. * cid. This enables us to create wrapped "child
  49167. * constructors" for prototypal inheritance and cache them.
  49168. */
  49169. Vue.cid = 0;
  49170. var cid = 1;
  49171. /**
  49172. * Class inheritance
  49173. */
  49174. Vue.extend = function (extendOptions) {
  49175. extendOptions = extendOptions || {};
  49176. var Super = this;
  49177. var SuperId = Super.cid;
  49178. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  49179. if (cachedCtors[SuperId]) {
  49180. return cachedCtors[SuperId]
  49181. }
  49182. var name = extendOptions.name || Super.options.name;
  49183. if (name) {
  49184. validateComponentName(name);
  49185. }
  49186. var Sub = function VueComponent (options) {
  49187. this._init(options);
  49188. };
  49189. Sub.prototype = Object.create(Super.prototype);
  49190. Sub.prototype.constructor = Sub;
  49191. Sub.cid = cid++;
  49192. Sub.options = mergeOptions(
  49193. Super.options,
  49194. extendOptions
  49195. );
  49196. Sub['super'] = Super;
  49197. // For props and computed properties, we define the proxy getters on
  49198. // the Vue instances at extension time, on the extended prototype. This
  49199. // avoids Object.defineProperty calls for each instance created.
  49200. if (Sub.options.props) {
  49201. initProps$1(Sub);
  49202. }
  49203. if (Sub.options.computed) {
  49204. initComputed$1(Sub);
  49205. }
  49206. // allow further extension/mixin/plugin usage
  49207. Sub.extend = Super.extend;
  49208. Sub.mixin = Super.mixin;
  49209. Sub.use = Super.use;
  49210. // create asset registers, so extended classes
  49211. // can have their private assets too.
  49212. ASSET_TYPES.forEach(function (type) {
  49213. Sub[type] = Super[type];
  49214. });
  49215. // enable recursive self-lookup
  49216. if (name) {
  49217. Sub.options.components[name] = Sub;
  49218. }
  49219. // keep a reference to the super options at extension time.
  49220. // later at instantiation we can check if Super's options have
  49221. // been updated.
  49222. Sub.superOptions = Super.options;
  49223. Sub.extendOptions = extendOptions;
  49224. Sub.sealedOptions = extend({}, Sub.options);
  49225. // cache constructor
  49226. cachedCtors[SuperId] = Sub;
  49227. return Sub
  49228. };
  49229. }
  49230. function initProps$1 (Comp) {
  49231. var props = Comp.options.props;
  49232. for (var key in props) {
  49233. proxy(Comp.prototype, "_props", key);
  49234. }
  49235. }
  49236. function initComputed$1 (Comp) {
  49237. var computed = Comp.options.computed;
  49238. for (var key in computed) {
  49239. defineComputed(Comp.prototype, key, computed[key]);
  49240. }
  49241. }
  49242. /* */
  49243. function initAssetRegisters (Vue) {
  49244. /**
  49245. * Create asset registration methods.
  49246. */
  49247. ASSET_TYPES.forEach(function (type) {
  49248. Vue[type] = function (
  49249. id,
  49250. definition
  49251. ) {
  49252. if (!definition) {
  49253. return this.options[type + 's'][id]
  49254. } else {
  49255. /* istanbul ignore if */
  49256. if (type === 'component') {
  49257. validateComponentName(id);
  49258. }
  49259. if (type === 'component' && isPlainObject(definition)) {
  49260. definition.name = definition.name || id;
  49261. definition = this.options._base.extend(definition);
  49262. }
  49263. if (type === 'directive' && typeof definition === 'function') {
  49264. definition = { bind: definition, update: definition };
  49265. }
  49266. this.options[type + 's'][id] = definition;
  49267. return definition
  49268. }
  49269. };
  49270. });
  49271. }
  49272. /* */
  49273. function getComponentName (opts) {
  49274. return opts && (opts.Ctor.options.name || opts.tag)
  49275. }
  49276. function matches (pattern, name) {
  49277. if (Array.isArray(pattern)) {
  49278. return pattern.indexOf(name) > -1
  49279. } else if (typeof pattern === 'string') {
  49280. return pattern.split(',').indexOf(name) > -1
  49281. } else if (isRegExp(pattern)) {
  49282. return pattern.test(name)
  49283. }
  49284. /* istanbul ignore next */
  49285. return false
  49286. }
  49287. function pruneCache (keepAliveInstance, filter) {
  49288. var cache = keepAliveInstance.cache;
  49289. var keys = keepAliveInstance.keys;
  49290. var _vnode = keepAliveInstance._vnode;
  49291. for (var key in cache) {
  49292. var cachedNode = cache[key];
  49293. if (cachedNode) {
  49294. var name = getComponentName(cachedNode.componentOptions);
  49295. if (name && !filter(name)) {
  49296. pruneCacheEntry(cache, key, keys, _vnode);
  49297. }
  49298. }
  49299. }
  49300. }
  49301. function pruneCacheEntry (
  49302. cache,
  49303. key,
  49304. keys,
  49305. current
  49306. ) {
  49307. var cached$$1 = cache[key];
  49308. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  49309. cached$$1.componentInstance.$destroy();
  49310. }
  49311. cache[key] = null;
  49312. remove(keys, key);
  49313. }
  49314. var patternTypes = [String, RegExp, Array];
  49315. var KeepAlive = {
  49316. name: 'keep-alive',
  49317. abstract: true,
  49318. props: {
  49319. include: patternTypes,
  49320. exclude: patternTypes,
  49321. max: [String, Number]
  49322. },
  49323. created: function created () {
  49324. this.cache = Object.create(null);
  49325. this.keys = [];
  49326. },
  49327. destroyed: function destroyed () {
  49328. for (var key in this.cache) {
  49329. pruneCacheEntry(this.cache, key, this.keys);
  49330. }
  49331. },
  49332. mounted: function mounted () {
  49333. var this$1 = this;
  49334. this.$watch('include', function (val) {
  49335. pruneCache(this$1, function (name) { return matches(val, name); });
  49336. });
  49337. this.$watch('exclude', function (val) {
  49338. pruneCache(this$1, function (name) { return !matches(val, name); });
  49339. });
  49340. },
  49341. render: function render () {
  49342. var slot = this.$slots.default;
  49343. var vnode = getFirstComponentChild(slot);
  49344. var componentOptions = vnode && vnode.componentOptions;
  49345. if (componentOptions) {
  49346. // check pattern
  49347. var name = getComponentName(componentOptions);
  49348. var ref = this;
  49349. var include = ref.include;
  49350. var exclude = ref.exclude;
  49351. if (
  49352. // not included
  49353. (include && (!name || !matches(include, name))) ||
  49354. // excluded
  49355. (exclude && name && matches(exclude, name))
  49356. ) {
  49357. return vnode
  49358. }
  49359. var ref$1 = this;
  49360. var cache = ref$1.cache;
  49361. var keys = ref$1.keys;
  49362. var key = vnode.key == null
  49363. // same constructor may get registered as different local components
  49364. // so cid alone is not enough (#3269)
  49365. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  49366. : vnode.key;
  49367. if (cache[key]) {
  49368. vnode.componentInstance = cache[key].componentInstance;
  49369. // make current key freshest
  49370. remove(keys, key);
  49371. keys.push(key);
  49372. } else {
  49373. cache[key] = vnode;
  49374. keys.push(key);
  49375. // prune oldest entry
  49376. if (this.max && keys.length > parseInt(this.max)) {
  49377. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  49378. }
  49379. }
  49380. vnode.data.keepAlive = true;
  49381. }
  49382. return vnode || (slot && slot[0])
  49383. }
  49384. };
  49385. var builtInComponents = {
  49386. KeepAlive: KeepAlive
  49387. };
  49388. /* */
  49389. function initGlobalAPI (Vue) {
  49390. // config
  49391. var configDef = {};
  49392. configDef.get = function () { return config; };
  49393. {
  49394. configDef.set = function () {
  49395. warn(
  49396. 'Do not replace the Vue.config object, set individual fields instead.'
  49397. );
  49398. };
  49399. }
  49400. Object.defineProperty(Vue, 'config', configDef);
  49401. // exposed util methods.
  49402. // NOTE: these are not considered part of the public API - avoid relying on
  49403. // them unless you are aware of the risk.
  49404. Vue.util = {
  49405. warn: warn,
  49406. extend: extend,
  49407. mergeOptions: mergeOptions,
  49408. defineReactive: defineReactive$$1
  49409. };
  49410. Vue.set = set;
  49411. Vue.delete = del;
  49412. Vue.nextTick = nextTick;
  49413. // 2.6 explicit observable API
  49414. Vue.observable = function (obj) {
  49415. observe(obj);
  49416. return obj
  49417. };
  49418. Vue.options = Object.create(null);
  49419. ASSET_TYPES.forEach(function (type) {
  49420. Vue.options[type + 's'] = Object.create(null);
  49421. });
  49422. // this is used to identify the "base" constructor to extend all plain-object
  49423. // components with in Weex's multi-instance scenarios.
  49424. Vue.options._base = Vue;
  49425. extend(Vue.options.components, builtInComponents);
  49426. initUse(Vue);
  49427. initMixin$1(Vue);
  49428. initExtend(Vue);
  49429. initAssetRegisters(Vue);
  49430. }
  49431. initGlobalAPI(Vue);
  49432. Object.defineProperty(Vue.prototype, '$isServer', {
  49433. get: isServerRendering
  49434. });
  49435. Object.defineProperty(Vue.prototype, '$ssrContext', {
  49436. get: function get () {
  49437. /* istanbul ignore next */
  49438. return this.$vnode && this.$vnode.ssrContext
  49439. }
  49440. });
  49441. // expose FunctionalRenderContext for ssr runtime helper installation
  49442. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  49443. value: FunctionalRenderContext
  49444. });
  49445. Vue.version = '2.6.11';
  49446. /* */
  49447. // these are reserved for web because they are directly compiled away
  49448. // during template compilation
  49449. var isReservedAttr = makeMap('style,class');
  49450. // attributes that should be using props for binding
  49451. var acceptValue = makeMap('input,textarea,option,select,progress');
  49452. var mustUseProp = function (tag, type, attr) {
  49453. return (
  49454. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  49455. (attr === 'selected' && tag === 'option') ||
  49456. (attr === 'checked' && tag === 'input') ||
  49457. (attr === 'muted' && tag === 'video')
  49458. )
  49459. };
  49460. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  49461. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  49462. var convertEnumeratedValue = function (key, value) {
  49463. return isFalsyAttrValue(value) || value === 'false'
  49464. ? 'false'
  49465. // allow arbitrary string value for contenteditable
  49466. : key === 'contenteditable' && isValidContentEditableValue(value)
  49467. ? value
  49468. : 'true'
  49469. };
  49470. var isBooleanAttr = makeMap(
  49471. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  49472. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  49473. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  49474. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  49475. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  49476. 'truespeed,typemustmatch,visible'
  49477. );
  49478. var xlinkNS = 'http://www.w3.org/1999/xlink';
  49479. var isXlink = function (name) {
  49480. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  49481. };
  49482. var getXlinkProp = function (name) {
  49483. return isXlink(name) ? name.slice(6, name.length) : ''
  49484. };
  49485. var isFalsyAttrValue = function (val) {
  49486. return val == null || val === false
  49487. };
  49488. /* */
  49489. function genClassForVnode (vnode) {
  49490. var data = vnode.data;
  49491. var parentNode = vnode;
  49492. var childNode = vnode;
  49493. while (isDef(childNode.componentInstance)) {
  49494. childNode = childNode.componentInstance._vnode;
  49495. if (childNode && childNode.data) {
  49496. data = mergeClassData(childNode.data, data);
  49497. }
  49498. }
  49499. while (isDef(parentNode = parentNode.parent)) {
  49500. if (parentNode && parentNode.data) {
  49501. data = mergeClassData(data, parentNode.data);
  49502. }
  49503. }
  49504. return renderClass(data.staticClass, data.class)
  49505. }
  49506. function mergeClassData (child, parent) {
  49507. return {
  49508. staticClass: concat(child.staticClass, parent.staticClass),
  49509. class: isDef(child.class)
  49510. ? [child.class, parent.class]
  49511. : parent.class
  49512. }
  49513. }
  49514. function renderClass (
  49515. staticClass,
  49516. dynamicClass
  49517. ) {
  49518. if (isDef(staticClass) || isDef(dynamicClass)) {
  49519. return concat(staticClass, stringifyClass(dynamicClass))
  49520. }
  49521. /* istanbul ignore next */
  49522. return ''
  49523. }
  49524. function concat (a, b) {
  49525. return a ? b ? (a + ' ' + b) : a : (b || '')
  49526. }
  49527. function stringifyClass (value) {
  49528. if (Array.isArray(value)) {
  49529. return stringifyArray(value)
  49530. }
  49531. if (isObject(value)) {
  49532. return stringifyObject(value)
  49533. }
  49534. if (typeof value === 'string') {
  49535. return value
  49536. }
  49537. /* istanbul ignore next */
  49538. return ''
  49539. }
  49540. function stringifyArray (value) {
  49541. var res = '';
  49542. var stringified;
  49543. for (var i = 0, l = value.length; i < l; i++) {
  49544. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49545. if (res) { res += ' '; }
  49546. res += stringified;
  49547. }
  49548. }
  49549. return res
  49550. }
  49551. function stringifyObject (value) {
  49552. var res = '';
  49553. for (var key in value) {
  49554. if (value[key]) {
  49555. if (res) { res += ' '; }
  49556. res += key;
  49557. }
  49558. }
  49559. return res
  49560. }
  49561. /* */
  49562. var namespaceMap = {
  49563. svg: 'http://www.w3.org/2000/svg',
  49564. math: 'http://www.w3.org/1998/Math/MathML'
  49565. };
  49566. var isHTMLTag = makeMap(
  49567. 'html,body,base,head,link,meta,style,title,' +
  49568. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49569. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49570. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49571. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49572. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49573. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49574. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49575. 'output,progress,select,textarea,' +
  49576. 'details,dialog,menu,menuitem,summary,' +
  49577. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49578. );
  49579. // this map is intentionally selective, only covering SVG elements that may
  49580. // contain child elements.
  49581. var isSVG = makeMap(
  49582. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49583. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49584. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49585. true
  49586. );
  49587. var isPreTag = function (tag) { return tag === 'pre'; };
  49588. var isReservedTag = function (tag) {
  49589. return isHTMLTag(tag) || isSVG(tag)
  49590. };
  49591. function getTagNamespace (tag) {
  49592. if (isSVG(tag)) {
  49593. return 'svg'
  49594. }
  49595. // basic support for MathML
  49596. // note it doesn't support other MathML elements being component roots
  49597. if (tag === 'math') {
  49598. return 'math'
  49599. }
  49600. }
  49601. var unknownElementCache = Object.create(null);
  49602. function isUnknownElement (tag) {
  49603. /* istanbul ignore if */
  49604. if (!inBrowser) {
  49605. return true
  49606. }
  49607. if (isReservedTag(tag)) {
  49608. return false
  49609. }
  49610. tag = tag.toLowerCase();
  49611. /* istanbul ignore if */
  49612. if (unknownElementCache[tag] != null) {
  49613. return unknownElementCache[tag]
  49614. }
  49615. var el = document.createElement(tag);
  49616. if (tag.indexOf('-') > -1) {
  49617. // http://stackoverflow.com/a/28210364/1070244
  49618. return (unknownElementCache[tag] = (
  49619. el.constructor === window.HTMLUnknownElement ||
  49620. el.constructor === window.HTMLElement
  49621. ))
  49622. } else {
  49623. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49624. }
  49625. }
  49626. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49627. /* */
  49628. /**
  49629. * Query an element selector if it's not an element already.
  49630. */
  49631. function query (el) {
  49632. if (typeof el === 'string') {
  49633. var selected = document.querySelector(el);
  49634. if (!selected) {
  49635. warn(
  49636. 'Cannot find element: ' + el
  49637. );
  49638. return document.createElement('div')
  49639. }
  49640. return selected
  49641. } else {
  49642. return el
  49643. }
  49644. }
  49645. /* */
  49646. function createElement$1 (tagName, vnode) {
  49647. var elm = document.createElement(tagName);
  49648. if (tagName !== 'select') {
  49649. return elm
  49650. }
  49651. // false or null will remove the attribute but undefined will not
  49652. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49653. elm.setAttribute('multiple', 'multiple');
  49654. }
  49655. return elm
  49656. }
  49657. function createElementNS (namespace, tagName) {
  49658. return document.createElementNS(namespaceMap[namespace], tagName)
  49659. }
  49660. function createTextNode (text) {
  49661. return document.createTextNode(text)
  49662. }
  49663. function createComment (text) {
  49664. return document.createComment(text)
  49665. }
  49666. function insertBefore (parentNode, newNode, referenceNode) {
  49667. parentNode.insertBefore(newNode, referenceNode);
  49668. }
  49669. function removeChild (node, child) {
  49670. node.removeChild(child);
  49671. }
  49672. function appendChild (node, child) {
  49673. node.appendChild(child);
  49674. }
  49675. function parentNode (node) {
  49676. return node.parentNode
  49677. }
  49678. function nextSibling (node) {
  49679. return node.nextSibling
  49680. }
  49681. function tagName (node) {
  49682. return node.tagName
  49683. }
  49684. function setTextContent (node, text) {
  49685. node.textContent = text;
  49686. }
  49687. function setStyleScope (node, scopeId) {
  49688. node.setAttribute(scopeId, '');
  49689. }
  49690. var nodeOps = /*#__PURE__*/Object.freeze({
  49691. createElement: createElement$1,
  49692. createElementNS: createElementNS,
  49693. createTextNode: createTextNode,
  49694. createComment: createComment,
  49695. insertBefore: insertBefore,
  49696. removeChild: removeChild,
  49697. appendChild: appendChild,
  49698. parentNode: parentNode,
  49699. nextSibling: nextSibling,
  49700. tagName: tagName,
  49701. setTextContent: setTextContent,
  49702. setStyleScope: setStyleScope
  49703. });
  49704. /* */
  49705. var ref = {
  49706. create: function create (_, vnode) {
  49707. registerRef(vnode);
  49708. },
  49709. update: function update (oldVnode, vnode) {
  49710. if (oldVnode.data.ref !== vnode.data.ref) {
  49711. registerRef(oldVnode, true);
  49712. registerRef(vnode);
  49713. }
  49714. },
  49715. destroy: function destroy (vnode) {
  49716. registerRef(vnode, true);
  49717. }
  49718. };
  49719. function registerRef (vnode, isRemoval) {
  49720. var key = vnode.data.ref;
  49721. if (!isDef(key)) { return }
  49722. var vm = vnode.context;
  49723. var ref = vnode.componentInstance || vnode.elm;
  49724. var refs = vm.$refs;
  49725. if (isRemoval) {
  49726. if (Array.isArray(refs[key])) {
  49727. remove(refs[key], ref);
  49728. } else if (refs[key] === ref) {
  49729. refs[key] = undefined;
  49730. }
  49731. } else {
  49732. if (vnode.data.refInFor) {
  49733. if (!Array.isArray(refs[key])) {
  49734. refs[key] = [ref];
  49735. } else if (refs[key].indexOf(ref) < 0) {
  49736. // $flow-disable-line
  49737. refs[key].push(ref);
  49738. }
  49739. } else {
  49740. refs[key] = ref;
  49741. }
  49742. }
  49743. }
  49744. /**
  49745. * Virtual DOM patching algorithm based on Snabbdom by
  49746. * Simon Friis Vindum (@paldepind)
  49747. * Licensed under the MIT License
  49748. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49749. *
  49750. * modified by Evan You (@yyx990803)
  49751. *
  49752. * Not type-checking this because this file is perf-critical and the cost
  49753. * of making flow understand it is not worth it.
  49754. */
  49755. var emptyNode = new VNode('', {}, []);
  49756. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49757. function sameVnode (a, b) {
  49758. return (
  49759. a.key === b.key && (
  49760. (
  49761. a.tag === b.tag &&
  49762. a.isComment === b.isComment &&
  49763. isDef(a.data) === isDef(b.data) &&
  49764. sameInputType(a, b)
  49765. ) || (
  49766. isTrue(a.isAsyncPlaceholder) &&
  49767. a.asyncFactory === b.asyncFactory &&
  49768. isUndef(b.asyncFactory.error)
  49769. )
  49770. )
  49771. )
  49772. }
  49773. function sameInputType (a, b) {
  49774. if (a.tag !== 'input') { return true }
  49775. var i;
  49776. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  49777. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  49778. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  49779. }
  49780. function createKeyToOldIdx (children, beginIdx, endIdx) {
  49781. var i, key;
  49782. var map = {};
  49783. for (i = beginIdx; i <= endIdx; ++i) {
  49784. key = children[i].key;
  49785. if (isDef(key)) { map[key] = i; }
  49786. }
  49787. return map
  49788. }
  49789. function createPatchFunction (backend) {
  49790. var i, j;
  49791. var cbs = {};
  49792. var modules = backend.modules;
  49793. var nodeOps = backend.nodeOps;
  49794. for (i = 0; i < hooks.length; ++i) {
  49795. cbs[hooks[i]] = [];
  49796. for (j = 0; j < modules.length; ++j) {
  49797. if (isDef(modules[j][hooks[i]])) {
  49798. cbs[hooks[i]].push(modules[j][hooks[i]]);
  49799. }
  49800. }
  49801. }
  49802. function emptyNodeAt (elm) {
  49803. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  49804. }
  49805. function createRmCb (childElm, listeners) {
  49806. function remove$$1 () {
  49807. if (--remove$$1.listeners === 0) {
  49808. removeNode(childElm);
  49809. }
  49810. }
  49811. remove$$1.listeners = listeners;
  49812. return remove$$1
  49813. }
  49814. function removeNode (el) {
  49815. var parent = nodeOps.parentNode(el);
  49816. // element may have already been removed due to v-html / v-text
  49817. if (isDef(parent)) {
  49818. nodeOps.removeChild(parent, el);
  49819. }
  49820. }
  49821. function isUnknownElement$$1 (vnode, inVPre) {
  49822. return (
  49823. !inVPre &&
  49824. !vnode.ns &&
  49825. !(
  49826. config.ignoredElements.length &&
  49827. config.ignoredElements.some(function (ignore) {
  49828. return isRegExp(ignore)
  49829. ? ignore.test(vnode.tag)
  49830. : ignore === vnode.tag
  49831. })
  49832. ) &&
  49833. config.isUnknownElement(vnode.tag)
  49834. )
  49835. }
  49836. var creatingElmInVPre = 0;
  49837. function createElm (
  49838. vnode,
  49839. insertedVnodeQueue,
  49840. parentElm,
  49841. refElm,
  49842. nested,
  49843. ownerArray,
  49844. index
  49845. ) {
  49846. if (isDef(vnode.elm) && isDef(ownerArray)) {
  49847. // This vnode was used in a previous render!
  49848. // now it's used as a new node, overwriting its elm would cause
  49849. // potential patch errors down the road when it's used as an insertion
  49850. // reference node. Instead, we clone the node on-demand before creating
  49851. // associated DOM element for it.
  49852. vnode = ownerArray[index] = cloneVNode(vnode);
  49853. }
  49854. vnode.isRootInsert = !nested; // for transition enter check
  49855. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  49856. return
  49857. }
  49858. var data = vnode.data;
  49859. var children = vnode.children;
  49860. var tag = vnode.tag;
  49861. if (isDef(tag)) {
  49862. {
  49863. if (data && data.pre) {
  49864. creatingElmInVPre++;
  49865. }
  49866. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  49867. warn(
  49868. 'Unknown custom element: <' + tag + '> - did you ' +
  49869. 'register the component correctly? For recursive components, ' +
  49870. 'make sure to provide the "name" option.',
  49871. vnode.context
  49872. );
  49873. }
  49874. }
  49875. vnode.elm = vnode.ns
  49876. ? nodeOps.createElementNS(vnode.ns, tag)
  49877. : nodeOps.createElement(tag, vnode);
  49878. setScope(vnode);
  49879. /* istanbul ignore if */
  49880. {
  49881. createChildren(vnode, children, insertedVnodeQueue);
  49882. if (isDef(data)) {
  49883. invokeCreateHooks(vnode, insertedVnodeQueue);
  49884. }
  49885. insert(parentElm, vnode.elm, refElm);
  49886. }
  49887. if (data && data.pre) {
  49888. creatingElmInVPre--;
  49889. }
  49890. } else if (isTrue(vnode.isComment)) {
  49891. vnode.elm = nodeOps.createComment(vnode.text);
  49892. insert(parentElm, vnode.elm, refElm);
  49893. } else {
  49894. vnode.elm = nodeOps.createTextNode(vnode.text);
  49895. insert(parentElm, vnode.elm, refElm);
  49896. }
  49897. }
  49898. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49899. var i = vnode.data;
  49900. if (isDef(i)) {
  49901. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  49902. if (isDef(i = i.hook) && isDef(i = i.init)) {
  49903. i(vnode, false /* hydrating */);
  49904. }
  49905. // after calling the init hook, if the vnode is a child component
  49906. // it should've created a child instance and mounted it. the child
  49907. // component also has set the placeholder vnode's elm.
  49908. // in that case we can just return the element and be done.
  49909. if (isDef(vnode.componentInstance)) {
  49910. initComponent(vnode, insertedVnodeQueue);
  49911. insert(parentElm, vnode.elm, refElm);
  49912. if (isTrue(isReactivated)) {
  49913. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  49914. }
  49915. return true
  49916. }
  49917. }
  49918. }
  49919. function initComponent (vnode, insertedVnodeQueue) {
  49920. if (isDef(vnode.data.pendingInsert)) {
  49921. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  49922. vnode.data.pendingInsert = null;
  49923. }
  49924. vnode.elm = vnode.componentInstance.$el;
  49925. if (isPatchable(vnode)) {
  49926. invokeCreateHooks(vnode, insertedVnodeQueue);
  49927. setScope(vnode);
  49928. } else {
  49929. // empty component root.
  49930. // skip all element-related modules except for ref (#3455)
  49931. registerRef(vnode);
  49932. // make sure to invoke the insert hook
  49933. insertedVnodeQueue.push(vnode);
  49934. }
  49935. }
  49936. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  49937. var i;
  49938. // hack for #4339: a reactivated component with inner transition
  49939. // does not trigger because the inner node's created hooks are not called
  49940. // again. It's not ideal to involve module-specific logic in here but
  49941. // there doesn't seem to be a better way to do it.
  49942. var innerNode = vnode;
  49943. while (innerNode.componentInstance) {
  49944. innerNode = innerNode.componentInstance._vnode;
  49945. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  49946. for (i = 0; i < cbs.activate.length; ++i) {
  49947. cbs.activate[i](emptyNode, innerNode);
  49948. }
  49949. insertedVnodeQueue.push(innerNode);
  49950. break
  49951. }
  49952. }
  49953. // unlike a newly created component,
  49954. // a reactivated keep-alive component doesn't insert itself
  49955. insert(parentElm, vnode.elm, refElm);
  49956. }
  49957. function insert (parent, elm, ref$$1) {
  49958. if (isDef(parent)) {
  49959. if (isDef(ref$$1)) {
  49960. if (nodeOps.parentNode(ref$$1) === parent) {
  49961. nodeOps.insertBefore(parent, elm, ref$$1);
  49962. }
  49963. } else {
  49964. nodeOps.appendChild(parent, elm);
  49965. }
  49966. }
  49967. }
  49968. function createChildren (vnode, children, insertedVnodeQueue) {
  49969. if (Array.isArray(children)) {
  49970. {
  49971. checkDuplicateKeys(children);
  49972. }
  49973. for (var i = 0; i < children.length; ++i) {
  49974. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  49975. }
  49976. } else if (isPrimitive(vnode.text)) {
  49977. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  49978. }
  49979. }
  49980. function isPatchable (vnode) {
  49981. while (vnode.componentInstance) {
  49982. vnode = vnode.componentInstance._vnode;
  49983. }
  49984. return isDef(vnode.tag)
  49985. }
  49986. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  49987. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  49988. cbs.create[i$1](emptyNode, vnode);
  49989. }
  49990. i = vnode.data.hook; // Reuse variable
  49991. if (isDef(i)) {
  49992. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  49993. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  49994. }
  49995. }
  49996. // set scope id attribute for scoped CSS.
  49997. // this is implemented as a special case to avoid the overhead
  49998. // of going through the normal attribute patching process.
  49999. function setScope (vnode) {
  50000. var i;
  50001. if (isDef(i = vnode.fnScopeId)) {
  50002. nodeOps.setStyleScope(vnode.elm, i);
  50003. } else {
  50004. var ancestor = vnode;
  50005. while (ancestor) {
  50006. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  50007. nodeOps.setStyleScope(vnode.elm, i);
  50008. }
  50009. ancestor = ancestor.parent;
  50010. }
  50011. }
  50012. // for slot content they should also get the scopeId from the host instance.
  50013. if (isDef(i = activeInstance) &&
  50014. i !== vnode.context &&
  50015. i !== vnode.fnContext &&
  50016. isDef(i = i.$options._scopeId)
  50017. ) {
  50018. nodeOps.setStyleScope(vnode.elm, i);
  50019. }
  50020. }
  50021. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  50022. for (; startIdx <= endIdx; ++startIdx) {
  50023. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  50024. }
  50025. }
  50026. function invokeDestroyHook (vnode) {
  50027. var i, j;
  50028. var data = vnode.data;
  50029. if (isDef(data)) {
  50030. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  50031. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  50032. }
  50033. if (isDef(i = vnode.children)) {
  50034. for (j = 0; j < vnode.children.length; ++j) {
  50035. invokeDestroyHook(vnode.children[j]);
  50036. }
  50037. }
  50038. }
  50039. function removeVnodes (vnodes, startIdx, endIdx) {
  50040. for (; startIdx <= endIdx; ++startIdx) {
  50041. var ch = vnodes[startIdx];
  50042. if (isDef(ch)) {
  50043. if (isDef(ch.tag)) {
  50044. removeAndInvokeRemoveHook(ch);
  50045. invokeDestroyHook(ch);
  50046. } else { // Text node
  50047. removeNode(ch.elm);
  50048. }
  50049. }
  50050. }
  50051. }
  50052. function removeAndInvokeRemoveHook (vnode, rm) {
  50053. if (isDef(rm) || isDef(vnode.data)) {
  50054. var i;
  50055. var listeners = cbs.remove.length + 1;
  50056. if (isDef(rm)) {
  50057. // we have a recursively passed down rm callback
  50058. // increase the listeners count
  50059. rm.listeners += listeners;
  50060. } else {
  50061. // directly removing
  50062. rm = createRmCb(vnode.elm, listeners);
  50063. }
  50064. // recursively invoke hooks on child component root node
  50065. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  50066. removeAndInvokeRemoveHook(i, rm);
  50067. }
  50068. for (i = 0; i < cbs.remove.length; ++i) {
  50069. cbs.remove[i](vnode, rm);
  50070. }
  50071. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  50072. i(vnode, rm);
  50073. } else {
  50074. rm();
  50075. }
  50076. } else {
  50077. removeNode(vnode.elm);
  50078. }
  50079. }
  50080. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  50081. var oldStartIdx = 0;
  50082. var newStartIdx = 0;
  50083. var oldEndIdx = oldCh.length - 1;
  50084. var oldStartVnode = oldCh[0];
  50085. var oldEndVnode = oldCh[oldEndIdx];
  50086. var newEndIdx = newCh.length - 1;
  50087. var newStartVnode = newCh[0];
  50088. var newEndVnode = newCh[newEndIdx];
  50089. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  50090. // removeOnly is a special flag used only by <transition-group>
  50091. // to ensure removed elements stay in correct relative positions
  50092. // during leaving transitions
  50093. var canMove = !removeOnly;
  50094. {
  50095. checkDuplicateKeys(newCh);
  50096. }
  50097. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  50098. if (isUndef(oldStartVnode)) {
  50099. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  50100. } else if (isUndef(oldEndVnode)) {
  50101. oldEndVnode = oldCh[--oldEndIdx];
  50102. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  50103. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50104. oldStartVnode = oldCh[++oldStartIdx];
  50105. newStartVnode = newCh[++newStartIdx];
  50106. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  50107. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50108. oldEndVnode = oldCh[--oldEndIdx];
  50109. newEndVnode = newCh[--newEndIdx];
  50110. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  50111. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50112. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  50113. oldStartVnode = oldCh[++oldStartIdx];
  50114. newEndVnode = newCh[--newEndIdx];
  50115. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  50116. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50117. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  50118. oldEndVnode = oldCh[--oldEndIdx];
  50119. newStartVnode = newCh[++newStartIdx];
  50120. } else {
  50121. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  50122. idxInOld = isDef(newStartVnode.key)
  50123. ? oldKeyToIdx[newStartVnode.key]
  50124. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  50125. if (isUndef(idxInOld)) { // New element
  50126. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50127. } else {
  50128. vnodeToMove = oldCh[idxInOld];
  50129. if (sameVnode(vnodeToMove, newStartVnode)) {
  50130. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50131. oldCh[idxInOld] = undefined;
  50132. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  50133. } else {
  50134. // same key but different element. treat as new element
  50135. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50136. }
  50137. }
  50138. newStartVnode = newCh[++newStartIdx];
  50139. }
  50140. }
  50141. if (oldStartIdx > oldEndIdx) {
  50142. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  50143. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  50144. } else if (newStartIdx > newEndIdx) {
  50145. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  50146. }
  50147. }
  50148. function checkDuplicateKeys (children) {
  50149. var seenKeys = {};
  50150. for (var i = 0; i < children.length; i++) {
  50151. var vnode = children[i];
  50152. var key = vnode.key;
  50153. if (isDef(key)) {
  50154. if (seenKeys[key]) {
  50155. warn(
  50156. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  50157. vnode.context
  50158. );
  50159. } else {
  50160. seenKeys[key] = true;
  50161. }
  50162. }
  50163. }
  50164. }
  50165. function findIdxInOld (node, oldCh, start, end) {
  50166. for (var i = start; i < end; i++) {
  50167. var c = oldCh[i];
  50168. if (isDef(c) && sameVnode(node, c)) { return i }
  50169. }
  50170. }
  50171. function patchVnode (
  50172. oldVnode,
  50173. vnode,
  50174. insertedVnodeQueue,
  50175. ownerArray,
  50176. index,
  50177. removeOnly
  50178. ) {
  50179. if (oldVnode === vnode) {
  50180. return
  50181. }
  50182. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50183. // clone reused vnode
  50184. vnode = ownerArray[index] = cloneVNode(vnode);
  50185. }
  50186. var elm = vnode.elm = oldVnode.elm;
  50187. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  50188. if (isDef(vnode.asyncFactory.resolved)) {
  50189. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  50190. } else {
  50191. vnode.isAsyncPlaceholder = true;
  50192. }
  50193. return
  50194. }
  50195. // reuse element for static trees.
  50196. // note we only do this if the vnode is cloned -
  50197. // if the new node is not cloned it means the render functions have been
  50198. // reset by the hot-reload-api and we need to do a proper re-render.
  50199. if (isTrue(vnode.isStatic) &&
  50200. isTrue(oldVnode.isStatic) &&
  50201. vnode.key === oldVnode.key &&
  50202. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  50203. ) {
  50204. vnode.componentInstance = oldVnode.componentInstance;
  50205. return
  50206. }
  50207. var i;
  50208. var data = vnode.data;
  50209. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  50210. i(oldVnode, vnode);
  50211. }
  50212. var oldCh = oldVnode.children;
  50213. var ch = vnode.children;
  50214. if (isDef(data) && isPatchable(vnode)) {
  50215. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  50216. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  50217. }
  50218. if (isUndef(vnode.text)) {
  50219. if (isDef(oldCh) && isDef(ch)) {
  50220. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  50221. } else if (isDef(ch)) {
  50222. {
  50223. checkDuplicateKeys(ch);
  50224. }
  50225. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  50226. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  50227. } else if (isDef(oldCh)) {
  50228. removeVnodes(oldCh, 0, oldCh.length - 1);
  50229. } else if (isDef(oldVnode.text)) {
  50230. nodeOps.setTextContent(elm, '');
  50231. }
  50232. } else if (oldVnode.text !== vnode.text) {
  50233. nodeOps.setTextContent(elm, vnode.text);
  50234. }
  50235. if (isDef(data)) {
  50236. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  50237. }
  50238. }
  50239. function invokeInsertHook (vnode, queue, initial) {
  50240. // delay insert hooks for component root nodes, invoke them after the
  50241. // element is really inserted
  50242. if (isTrue(initial) && isDef(vnode.parent)) {
  50243. vnode.parent.data.pendingInsert = queue;
  50244. } else {
  50245. for (var i = 0; i < queue.length; ++i) {
  50246. queue[i].data.hook.insert(queue[i]);
  50247. }
  50248. }
  50249. }
  50250. var hydrationBailed = false;
  50251. // list of modules that can skip create hook during hydration because they
  50252. // are already rendered on the client or has no need for initialization
  50253. // Note: style is excluded because it relies on initial clone for future
  50254. // deep updates (#7063).
  50255. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  50256. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  50257. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  50258. var i;
  50259. var tag = vnode.tag;
  50260. var data = vnode.data;
  50261. var children = vnode.children;
  50262. inVPre = inVPre || (data && data.pre);
  50263. vnode.elm = elm;
  50264. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  50265. vnode.isAsyncPlaceholder = true;
  50266. return true
  50267. }
  50268. // assert node match
  50269. {
  50270. if (!assertNodeMatch(elm, vnode, inVPre)) {
  50271. return false
  50272. }
  50273. }
  50274. if (isDef(data)) {
  50275. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  50276. if (isDef(i = vnode.componentInstance)) {
  50277. // child component. it should have hydrated its own tree.
  50278. initComponent(vnode, insertedVnodeQueue);
  50279. return true
  50280. }
  50281. }
  50282. if (isDef(tag)) {
  50283. if (isDef(children)) {
  50284. // empty element, allow client to pick up and populate children
  50285. if (!elm.hasChildNodes()) {
  50286. createChildren(vnode, children, insertedVnodeQueue);
  50287. } else {
  50288. // v-html and domProps: innerHTML
  50289. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  50290. if (i !== elm.innerHTML) {
  50291. /* istanbul ignore if */
  50292. if (typeof console !== 'undefined' &&
  50293. !hydrationBailed
  50294. ) {
  50295. hydrationBailed = true;
  50296. console.warn('Parent: ', elm);
  50297. console.warn('server innerHTML: ', i);
  50298. console.warn('client innerHTML: ', elm.innerHTML);
  50299. }
  50300. return false
  50301. }
  50302. } else {
  50303. // iterate and compare children lists
  50304. var childrenMatch = true;
  50305. var childNode = elm.firstChild;
  50306. for (var i$1 = 0; i$1 < children.length; i$1++) {
  50307. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  50308. childrenMatch = false;
  50309. break
  50310. }
  50311. childNode = childNode.nextSibling;
  50312. }
  50313. // if childNode is not null, it means the actual childNodes list is
  50314. // longer than the virtual children list.
  50315. if (!childrenMatch || childNode) {
  50316. /* istanbul ignore if */
  50317. if (typeof console !== 'undefined' &&
  50318. !hydrationBailed
  50319. ) {
  50320. hydrationBailed = true;
  50321. console.warn('Parent: ', elm);
  50322. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  50323. }
  50324. return false
  50325. }
  50326. }
  50327. }
  50328. }
  50329. if (isDef(data)) {
  50330. var fullInvoke = false;
  50331. for (var key in data) {
  50332. if (!isRenderedModule(key)) {
  50333. fullInvoke = true;
  50334. invokeCreateHooks(vnode, insertedVnodeQueue);
  50335. break
  50336. }
  50337. }
  50338. if (!fullInvoke && data['class']) {
  50339. // ensure collecting deps for deep class bindings for future updates
  50340. traverse(data['class']);
  50341. }
  50342. }
  50343. } else if (elm.data !== vnode.text) {
  50344. elm.data = vnode.text;
  50345. }
  50346. return true
  50347. }
  50348. function assertNodeMatch (node, vnode, inVPre) {
  50349. if (isDef(vnode.tag)) {
  50350. return vnode.tag.indexOf('vue-component') === 0 || (
  50351. !isUnknownElement$$1(vnode, inVPre) &&
  50352. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  50353. )
  50354. } else {
  50355. return node.nodeType === (vnode.isComment ? 8 : 3)
  50356. }
  50357. }
  50358. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  50359. if (isUndef(vnode)) {
  50360. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  50361. return
  50362. }
  50363. var isInitialPatch = false;
  50364. var insertedVnodeQueue = [];
  50365. if (isUndef(oldVnode)) {
  50366. // empty mount (likely as component), create new root element
  50367. isInitialPatch = true;
  50368. createElm(vnode, insertedVnodeQueue);
  50369. } else {
  50370. var isRealElement = isDef(oldVnode.nodeType);
  50371. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  50372. // patch existing root node
  50373. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  50374. } else {
  50375. if (isRealElement) {
  50376. // mounting to a real element
  50377. // check if this is server-rendered content and if we can perform
  50378. // a successful hydration.
  50379. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  50380. oldVnode.removeAttribute(SSR_ATTR);
  50381. hydrating = true;
  50382. }
  50383. if (isTrue(hydrating)) {
  50384. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  50385. invokeInsertHook(vnode, insertedVnodeQueue, true);
  50386. return oldVnode
  50387. } else {
  50388. warn(
  50389. 'The client-side rendered virtual DOM tree is not matching ' +
  50390. 'server-rendered content. This is likely caused by incorrect ' +
  50391. 'HTML markup, for example nesting block-level elements inside ' +
  50392. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  50393. 'full client-side render.'
  50394. );
  50395. }
  50396. }
  50397. // either not server-rendered, or hydration failed.
  50398. // create an empty node and replace it
  50399. oldVnode = emptyNodeAt(oldVnode);
  50400. }
  50401. // replacing existing element
  50402. var oldElm = oldVnode.elm;
  50403. var parentElm = nodeOps.parentNode(oldElm);
  50404. // create new node
  50405. createElm(
  50406. vnode,
  50407. insertedVnodeQueue,
  50408. // extremely rare edge case: do not insert if old element is in a
  50409. // leaving transition. Only happens when combining transition +
  50410. // keep-alive + HOCs. (#4590)
  50411. oldElm._leaveCb ? null : parentElm,
  50412. nodeOps.nextSibling(oldElm)
  50413. );
  50414. // update parent placeholder node element, recursively
  50415. if (isDef(vnode.parent)) {
  50416. var ancestor = vnode.parent;
  50417. var patchable = isPatchable(vnode);
  50418. while (ancestor) {
  50419. for (var i = 0; i < cbs.destroy.length; ++i) {
  50420. cbs.destroy[i](ancestor);
  50421. }
  50422. ancestor.elm = vnode.elm;
  50423. if (patchable) {
  50424. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50425. cbs.create[i$1](emptyNode, ancestor);
  50426. }
  50427. // #6513
  50428. // invoke insert hooks that may have been merged by create hooks.
  50429. // e.g. for directives that uses the "inserted" hook.
  50430. var insert = ancestor.data.hook.insert;
  50431. if (insert.merged) {
  50432. // start at index 1 to avoid re-invoking component mounted hook
  50433. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  50434. insert.fns[i$2]();
  50435. }
  50436. }
  50437. } else {
  50438. registerRef(ancestor);
  50439. }
  50440. ancestor = ancestor.parent;
  50441. }
  50442. }
  50443. // destroy old node
  50444. if (isDef(parentElm)) {
  50445. removeVnodes([oldVnode], 0, 0);
  50446. } else if (isDef(oldVnode.tag)) {
  50447. invokeDestroyHook(oldVnode);
  50448. }
  50449. }
  50450. }
  50451. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  50452. return vnode.elm
  50453. }
  50454. }
  50455. /* */
  50456. var directives = {
  50457. create: updateDirectives,
  50458. update: updateDirectives,
  50459. destroy: function unbindDirectives (vnode) {
  50460. updateDirectives(vnode, emptyNode);
  50461. }
  50462. };
  50463. function updateDirectives (oldVnode, vnode) {
  50464. if (oldVnode.data.directives || vnode.data.directives) {
  50465. _update(oldVnode, vnode);
  50466. }
  50467. }
  50468. function _update (oldVnode, vnode) {
  50469. var isCreate = oldVnode === emptyNode;
  50470. var isDestroy = vnode === emptyNode;
  50471. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  50472. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  50473. var dirsWithInsert = [];
  50474. var dirsWithPostpatch = [];
  50475. var key, oldDir, dir;
  50476. for (key in newDirs) {
  50477. oldDir = oldDirs[key];
  50478. dir = newDirs[key];
  50479. if (!oldDir) {
  50480. // new directive, bind
  50481. callHook$1(dir, 'bind', vnode, oldVnode);
  50482. if (dir.def && dir.def.inserted) {
  50483. dirsWithInsert.push(dir);
  50484. }
  50485. } else {
  50486. // existing directive, update
  50487. dir.oldValue = oldDir.value;
  50488. dir.oldArg = oldDir.arg;
  50489. callHook$1(dir, 'update', vnode, oldVnode);
  50490. if (dir.def && dir.def.componentUpdated) {
  50491. dirsWithPostpatch.push(dir);
  50492. }
  50493. }
  50494. }
  50495. if (dirsWithInsert.length) {
  50496. var callInsert = function () {
  50497. for (var i = 0; i < dirsWithInsert.length; i++) {
  50498. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  50499. }
  50500. };
  50501. if (isCreate) {
  50502. mergeVNodeHook(vnode, 'insert', callInsert);
  50503. } else {
  50504. callInsert();
  50505. }
  50506. }
  50507. if (dirsWithPostpatch.length) {
  50508. mergeVNodeHook(vnode, 'postpatch', function () {
  50509. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  50510. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  50511. }
  50512. });
  50513. }
  50514. if (!isCreate) {
  50515. for (key in oldDirs) {
  50516. if (!newDirs[key]) {
  50517. // no longer present, unbind
  50518. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50519. }
  50520. }
  50521. }
  50522. }
  50523. var emptyModifiers = Object.create(null);
  50524. function normalizeDirectives$1 (
  50525. dirs,
  50526. vm
  50527. ) {
  50528. var res = Object.create(null);
  50529. if (!dirs) {
  50530. // $flow-disable-line
  50531. return res
  50532. }
  50533. var i, dir;
  50534. for (i = 0; i < dirs.length; i++) {
  50535. dir = dirs[i];
  50536. if (!dir.modifiers) {
  50537. // $flow-disable-line
  50538. dir.modifiers = emptyModifiers;
  50539. }
  50540. res[getRawDirName(dir)] = dir;
  50541. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50542. }
  50543. // $flow-disable-line
  50544. return res
  50545. }
  50546. function getRawDirName (dir) {
  50547. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50548. }
  50549. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50550. var fn = dir.def && dir.def[hook];
  50551. if (fn) {
  50552. try {
  50553. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50554. } catch (e) {
  50555. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50556. }
  50557. }
  50558. }
  50559. var baseModules = [
  50560. ref,
  50561. directives
  50562. ];
  50563. /* */
  50564. function updateAttrs (oldVnode, vnode) {
  50565. var opts = vnode.componentOptions;
  50566. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50567. return
  50568. }
  50569. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50570. return
  50571. }
  50572. var key, cur, old;
  50573. var elm = vnode.elm;
  50574. var oldAttrs = oldVnode.data.attrs || {};
  50575. var attrs = vnode.data.attrs || {};
  50576. // clone observed objects, as the user probably wants to mutate it
  50577. if (isDef(attrs.__ob__)) {
  50578. attrs = vnode.data.attrs = extend({}, attrs);
  50579. }
  50580. for (key in attrs) {
  50581. cur = attrs[key];
  50582. old = oldAttrs[key];
  50583. if (old !== cur) {
  50584. setAttr(elm, key, cur);
  50585. }
  50586. }
  50587. // #4391: in IE9, setting type can reset value for input[type=radio]
  50588. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50589. /* istanbul ignore if */
  50590. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50591. setAttr(elm, 'value', attrs.value);
  50592. }
  50593. for (key in oldAttrs) {
  50594. if (isUndef(attrs[key])) {
  50595. if (isXlink(key)) {
  50596. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50597. } else if (!isEnumeratedAttr(key)) {
  50598. elm.removeAttribute(key);
  50599. }
  50600. }
  50601. }
  50602. }
  50603. function setAttr (el, key, value) {
  50604. if (el.tagName.indexOf('-') > -1) {
  50605. baseSetAttr(el, key, value);
  50606. } else if (isBooleanAttr(key)) {
  50607. // set attribute for blank value
  50608. // e.g. <option disabled>Select one</option>
  50609. if (isFalsyAttrValue(value)) {
  50610. el.removeAttribute(key);
  50611. } else {
  50612. // technically allowfullscreen is a boolean attribute for <iframe>,
  50613. // but Flash expects a value of "true" when used on <embed> tag
  50614. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50615. ? 'true'
  50616. : key;
  50617. el.setAttribute(key, value);
  50618. }
  50619. } else if (isEnumeratedAttr(key)) {
  50620. el.setAttribute(key, convertEnumeratedValue(key, value));
  50621. } else if (isXlink(key)) {
  50622. if (isFalsyAttrValue(value)) {
  50623. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50624. } else {
  50625. el.setAttributeNS(xlinkNS, key, value);
  50626. }
  50627. } else {
  50628. baseSetAttr(el, key, value);
  50629. }
  50630. }
  50631. function baseSetAttr (el, key, value) {
  50632. if (isFalsyAttrValue(value)) {
  50633. el.removeAttribute(key);
  50634. } else {
  50635. // #7138: IE10 & 11 fires input event when setting placeholder on
  50636. // <textarea>... block the first input event and remove the blocker
  50637. // immediately.
  50638. /* istanbul ignore if */
  50639. if (
  50640. isIE && !isIE9 &&
  50641. el.tagName === 'TEXTAREA' &&
  50642. key === 'placeholder' && value !== '' && !el.__ieph
  50643. ) {
  50644. var blocker = function (e) {
  50645. e.stopImmediatePropagation();
  50646. el.removeEventListener('input', blocker);
  50647. };
  50648. el.addEventListener('input', blocker);
  50649. // $flow-disable-line
  50650. el.__ieph = true; /* IE placeholder patched */
  50651. }
  50652. el.setAttribute(key, value);
  50653. }
  50654. }
  50655. var attrs = {
  50656. create: updateAttrs,
  50657. update: updateAttrs
  50658. };
  50659. /* */
  50660. function updateClass (oldVnode, vnode) {
  50661. var el = vnode.elm;
  50662. var data = vnode.data;
  50663. var oldData = oldVnode.data;
  50664. if (
  50665. isUndef(data.staticClass) &&
  50666. isUndef(data.class) && (
  50667. isUndef(oldData) || (
  50668. isUndef(oldData.staticClass) &&
  50669. isUndef(oldData.class)
  50670. )
  50671. )
  50672. ) {
  50673. return
  50674. }
  50675. var cls = genClassForVnode(vnode);
  50676. // handle transition classes
  50677. var transitionClass = el._transitionClasses;
  50678. if (isDef(transitionClass)) {
  50679. cls = concat(cls, stringifyClass(transitionClass));
  50680. }
  50681. // set the class
  50682. if (cls !== el._prevClass) {
  50683. el.setAttribute('class', cls);
  50684. el._prevClass = cls;
  50685. }
  50686. }
  50687. var klass = {
  50688. create: updateClass,
  50689. update: updateClass
  50690. };
  50691. /* */
  50692. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50693. function parseFilters (exp) {
  50694. var inSingle = false;
  50695. var inDouble = false;
  50696. var inTemplateString = false;
  50697. var inRegex = false;
  50698. var curly = 0;
  50699. var square = 0;
  50700. var paren = 0;
  50701. var lastFilterIndex = 0;
  50702. var c, prev, i, expression, filters;
  50703. for (i = 0; i < exp.length; i++) {
  50704. prev = c;
  50705. c = exp.charCodeAt(i);
  50706. if (inSingle) {
  50707. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50708. } else if (inDouble) {
  50709. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50710. } else if (inTemplateString) {
  50711. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50712. } else if (inRegex) {
  50713. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50714. } else if (
  50715. c === 0x7C && // pipe
  50716. exp.charCodeAt(i + 1) !== 0x7C &&
  50717. exp.charCodeAt(i - 1) !== 0x7C &&
  50718. !curly && !square && !paren
  50719. ) {
  50720. if (expression === undefined) {
  50721. // first filter, end of expression
  50722. lastFilterIndex = i + 1;
  50723. expression = exp.slice(0, i).trim();
  50724. } else {
  50725. pushFilter();
  50726. }
  50727. } else {
  50728. switch (c) {
  50729. case 0x22: inDouble = true; break // "
  50730. case 0x27: inSingle = true; break // '
  50731. case 0x60: inTemplateString = true; break // `
  50732. case 0x28: paren++; break // (
  50733. case 0x29: paren--; break // )
  50734. case 0x5B: square++; break // [
  50735. case 0x5D: square--; break // ]
  50736. case 0x7B: curly++; break // {
  50737. case 0x7D: curly--; break // }
  50738. }
  50739. if (c === 0x2f) { // /
  50740. var j = i - 1;
  50741. var p = (void 0);
  50742. // find first non-whitespace prev char
  50743. for (; j >= 0; j--) {
  50744. p = exp.charAt(j);
  50745. if (p !== ' ') { break }
  50746. }
  50747. if (!p || !validDivisionCharRE.test(p)) {
  50748. inRegex = true;
  50749. }
  50750. }
  50751. }
  50752. }
  50753. if (expression === undefined) {
  50754. expression = exp.slice(0, i).trim();
  50755. } else if (lastFilterIndex !== 0) {
  50756. pushFilter();
  50757. }
  50758. function pushFilter () {
  50759. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50760. lastFilterIndex = i + 1;
  50761. }
  50762. if (filters) {
  50763. for (i = 0; i < filters.length; i++) {
  50764. expression = wrapFilter(expression, filters[i]);
  50765. }
  50766. }
  50767. return expression
  50768. }
  50769. function wrapFilter (exp, filter) {
  50770. var i = filter.indexOf('(');
  50771. if (i < 0) {
  50772. // _f: resolveFilter
  50773. return ("_f(\"" + filter + "\")(" + exp + ")")
  50774. } else {
  50775. var name = filter.slice(0, i);
  50776. var args = filter.slice(i + 1);
  50777. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  50778. }
  50779. }
  50780. /* */
  50781. /* eslint-disable no-unused-vars */
  50782. function baseWarn (msg, range) {
  50783. console.error(("[Vue compiler]: " + msg));
  50784. }
  50785. /* eslint-enable no-unused-vars */
  50786. function pluckModuleFunction (
  50787. modules,
  50788. key
  50789. ) {
  50790. return modules
  50791. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  50792. : []
  50793. }
  50794. function addProp (el, name, value, range, dynamic) {
  50795. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50796. el.plain = false;
  50797. }
  50798. function addAttr (el, name, value, range, dynamic) {
  50799. var attrs = dynamic
  50800. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  50801. : (el.attrs || (el.attrs = []));
  50802. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  50803. el.plain = false;
  50804. }
  50805. // add a raw attr (use this in preTransforms)
  50806. function addRawAttr (el, name, value, range) {
  50807. el.attrsMap[name] = value;
  50808. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  50809. }
  50810. function addDirective (
  50811. el,
  50812. name,
  50813. rawName,
  50814. value,
  50815. arg,
  50816. isDynamicArg,
  50817. modifiers,
  50818. range
  50819. ) {
  50820. (el.directives || (el.directives = [])).push(rangeSetItem({
  50821. name: name,
  50822. rawName: rawName,
  50823. value: value,
  50824. arg: arg,
  50825. isDynamicArg: isDynamicArg,
  50826. modifiers: modifiers
  50827. }, range));
  50828. el.plain = false;
  50829. }
  50830. function prependModifierMarker (symbol, name, dynamic) {
  50831. return dynamic
  50832. ? ("_p(" + name + ",\"" + symbol + "\")")
  50833. : symbol + name // mark the event as captured
  50834. }
  50835. function addHandler (
  50836. el,
  50837. name,
  50838. value,
  50839. modifiers,
  50840. important,
  50841. warn,
  50842. range,
  50843. dynamic
  50844. ) {
  50845. modifiers = modifiers || emptyObject;
  50846. // warn prevent and passive modifier
  50847. /* istanbul ignore if */
  50848. if (
  50849. warn &&
  50850. modifiers.prevent && modifiers.passive
  50851. ) {
  50852. warn(
  50853. 'passive and prevent can\'t be used together. ' +
  50854. 'Passive handler can\'t prevent default event.',
  50855. range
  50856. );
  50857. }
  50858. // normalize click.right and click.middle since they don't actually fire
  50859. // this is technically browser-specific, but at least for now browsers are
  50860. // the only target envs that have right/middle clicks.
  50861. if (modifiers.right) {
  50862. if (dynamic) {
  50863. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  50864. } else if (name === 'click') {
  50865. name = 'contextmenu';
  50866. delete modifiers.right;
  50867. }
  50868. } else if (modifiers.middle) {
  50869. if (dynamic) {
  50870. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  50871. } else if (name === 'click') {
  50872. name = 'mouseup';
  50873. }
  50874. }
  50875. // check capture modifier
  50876. if (modifiers.capture) {
  50877. delete modifiers.capture;
  50878. name = prependModifierMarker('!', name, dynamic);
  50879. }
  50880. if (modifiers.once) {
  50881. delete modifiers.once;
  50882. name = prependModifierMarker('~', name, dynamic);
  50883. }
  50884. /* istanbul ignore if */
  50885. if (modifiers.passive) {
  50886. delete modifiers.passive;
  50887. name = prependModifierMarker('&', name, dynamic);
  50888. }
  50889. var events;
  50890. if (modifiers.native) {
  50891. delete modifiers.native;
  50892. events = el.nativeEvents || (el.nativeEvents = {});
  50893. } else {
  50894. events = el.events || (el.events = {});
  50895. }
  50896. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  50897. if (modifiers !== emptyObject) {
  50898. newHandler.modifiers = modifiers;
  50899. }
  50900. var handlers = events[name];
  50901. /* istanbul ignore if */
  50902. if (Array.isArray(handlers)) {
  50903. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  50904. } else if (handlers) {
  50905. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  50906. } else {
  50907. events[name] = newHandler;
  50908. }
  50909. el.plain = false;
  50910. }
  50911. function getRawBindingAttr (
  50912. el,
  50913. name
  50914. ) {
  50915. return el.rawAttrsMap[':' + name] ||
  50916. el.rawAttrsMap['v-bind:' + name] ||
  50917. el.rawAttrsMap[name]
  50918. }
  50919. function getBindingAttr (
  50920. el,
  50921. name,
  50922. getStatic
  50923. ) {
  50924. var dynamicValue =
  50925. getAndRemoveAttr(el, ':' + name) ||
  50926. getAndRemoveAttr(el, 'v-bind:' + name);
  50927. if (dynamicValue != null) {
  50928. return parseFilters(dynamicValue)
  50929. } else if (getStatic !== false) {
  50930. var staticValue = getAndRemoveAttr(el, name);
  50931. if (staticValue != null) {
  50932. return JSON.stringify(staticValue)
  50933. }
  50934. }
  50935. }
  50936. // note: this only removes the attr from the Array (attrsList) so that it
  50937. // doesn't get processed by processAttrs.
  50938. // By default it does NOT remove it from the map (attrsMap) because the map is
  50939. // needed during codegen.
  50940. function getAndRemoveAttr (
  50941. el,
  50942. name,
  50943. removeFromMap
  50944. ) {
  50945. var val;
  50946. if ((val = el.attrsMap[name]) != null) {
  50947. var list = el.attrsList;
  50948. for (var i = 0, l = list.length; i < l; i++) {
  50949. if (list[i].name === name) {
  50950. list.splice(i, 1);
  50951. break
  50952. }
  50953. }
  50954. }
  50955. if (removeFromMap) {
  50956. delete el.attrsMap[name];
  50957. }
  50958. return val
  50959. }
  50960. function getAndRemoveAttrByRegex (
  50961. el,
  50962. name
  50963. ) {
  50964. var list = el.attrsList;
  50965. for (var i = 0, l = list.length; i < l; i++) {
  50966. var attr = list[i];
  50967. if (name.test(attr.name)) {
  50968. list.splice(i, 1);
  50969. return attr
  50970. }
  50971. }
  50972. }
  50973. function rangeSetItem (
  50974. item,
  50975. range
  50976. ) {
  50977. if (range) {
  50978. if (range.start != null) {
  50979. item.start = range.start;
  50980. }
  50981. if (range.end != null) {
  50982. item.end = range.end;
  50983. }
  50984. }
  50985. return item
  50986. }
  50987. /* */
  50988. /**
  50989. * Cross-platform code generation for component v-model
  50990. */
  50991. function genComponentModel (
  50992. el,
  50993. value,
  50994. modifiers
  50995. ) {
  50996. var ref = modifiers || {};
  50997. var number = ref.number;
  50998. var trim = ref.trim;
  50999. var baseValueExpression = '$$v';
  51000. var valueExpression = baseValueExpression;
  51001. if (trim) {
  51002. valueExpression =
  51003. "(typeof " + baseValueExpression + " === 'string'" +
  51004. "? " + baseValueExpression + ".trim()" +
  51005. ": " + baseValueExpression + ")";
  51006. }
  51007. if (number) {
  51008. valueExpression = "_n(" + valueExpression + ")";
  51009. }
  51010. var assignment = genAssignmentCode(value, valueExpression);
  51011. el.model = {
  51012. value: ("(" + value + ")"),
  51013. expression: JSON.stringify(value),
  51014. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  51015. };
  51016. }
  51017. /**
  51018. * Cross-platform codegen helper for generating v-model value assignment code.
  51019. */
  51020. function genAssignmentCode (
  51021. value,
  51022. assignment
  51023. ) {
  51024. var res = parseModel(value);
  51025. if (res.key === null) {
  51026. return (value + "=" + assignment)
  51027. } else {
  51028. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  51029. }
  51030. }
  51031. /**
  51032. * Parse a v-model expression into a base path and a final key segment.
  51033. * Handles both dot-path and possible square brackets.
  51034. *
  51035. * Possible cases:
  51036. *
  51037. * - test
  51038. * - test[key]
  51039. * - test[test1[key]]
  51040. * - test["a"][key]
  51041. * - xxx.test[a[a].test1[key]]
  51042. * - test.xxx.a["asa"][test1[key]]
  51043. *
  51044. */
  51045. var len, str, chr, index$1, expressionPos, expressionEndPos;
  51046. function parseModel (val) {
  51047. // Fix https://github.com/vuejs/vue/pull/7730
  51048. // allow v-model="obj.val " (trailing whitespace)
  51049. val = val.trim();
  51050. len = val.length;
  51051. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  51052. index$1 = val.lastIndexOf('.');
  51053. if (index$1 > -1) {
  51054. return {
  51055. exp: val.slice(0, index$1),
  51056. key: '"' + val.slice(index$1 + 1) + '"'
  51057. }
  51058. } else {
  51059. return {
  51060. exp: val,
  51061. key: null
  51062. }
  51063. }
  51064. }
  51065. str = val;
  51066. index$1 = expressionPos = expressionEndPos = 0;
  51067. while (!eof()) {
  51068. chr = next();
  51069. /* istanbul ignore if */
  51070. if (isStringStart(chr)) {
  51071. parseString(chr);
  51072. } else if (chr === 0x5B) {
  51073. parseBracket(chr);
  51074. }
  51075. }
  51076. return {
  51077. exp: val.slice(0, expressionPos),
  51078. key: val.slice(expressionPos + 1, expressionEndPos)
  51079. }
  51080. }
  51081. function next () {
  51082. return str.charCodeAt(++index$1)
  51083. }
  51084. function eof () {
  51085. return index$1 >= len
  51086. }
  51087. function isStringStart (chr) {
  51088. return chr === 0x22 || chr === 0x27
  51089. }
  51090. function parseBracket (chr) {
  51091. var inBracket = 1;
  51092. expressionPos = index$1;
  51093. while (!eof()) {
  51094. chr = next();
  51095. if (isStringStart(chr)) {
  51096. parseString(chr);
  51097. continue
  51098. }
  51099. if (chr === 0x5B) { inBracket++; }
  51100. if (chr === 0x5D) { inBracket--; }
  51101. if (inBracket === 0) {
  51102. expressionEndPos = index$1;
  51103. break
  51104. }
  51105. }
  51106. }
  51107. function parseString (chr) {
  51108. var stringQuote = chr;
  51109. while (!eof()) {
  51110. chr = next();
  51111. if (chr === stringQuote) {
  51112. break
  51113. }
  51114. }
  51115. }
  51116. /* */
  51117. var warn$1;
  51118. // in some cases, the event used has to be determined at runtime
  51119. // so we used some reserved tokens during compile.
  51120. var RANGE_TOKEN = '__r';
  51121. var CHECKBOX_RADIO_TOKEN = '__c';
  51122. function model (
  51123. el,
  51124. dir,
  51125. _warn
  51126. ) {
  51127. warn$1 = _warn;
  51128. var value = dir.value;
  51129. var modifiers = dir.modifiers;
  51130. var tag = el.tag;
  51131. var type = el.attrsMap.type;
  51132. {
  51133. // inputs with type="file" are read only and setting the input's
  51134. // value will throw an error.
  51135. if (tag === 'input' && type === 'file') {
  51136. warn$1(
  51137. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  51138. "File inputs are read only. Use a v-on:change listener instead.",
  51139. el.rawAttrsMap['v-model']
  51140. );
  51141. }
  51142. }
  51143. if (el.component) {
  51144. genComponentModel(el, value, modifiers);
  51145. // component v-model doesn't need extra runtime
  51146. return false
  51147. } else if (tag === 'select') {
  51148. genSelect(el, value, modifiers);
  51149. } else if (tag === 'input' && type === 'checkbox') {
  51150. genCheckboxModel(el, value, modifiers);
  51151. } else if (tag === 'input' && type === 'radio') {
  51152. genRadioModel(el, value, modifiers);
  51153. } else if (tag === 'input' || tag === 'textarea') {
  51154. genDefaultModel(el, value, modifiers);
  51155. } else if (!config.isReservedTag(tag)) {
  51156. genComponentModel(el, value, modifiers);
  51157. // component v-model doesn't need extra runtime
  51158. return false
  51159. } else {
  51160. warn$1(
  51161. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  51162. "v-model is not supported on this element type. " +
  51163. 'If you are working with contenteditable, it\'s recommended to ' +
  51164. 'wrap a library dedicated for that purpose inside a custom component.',
  51165. el.rawAttrsMap['v-model']
  51166. );
  51167. }
  51168. // ensure runtime directive metadata
  51169. return true
  51170. }
  51171. function genCheckboxModel (
  51172. el,
  51173. value,
  51174. modifiers
  51175. ) {
  51176. var number = modifiers && modifiers.number;
  51177. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51178. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  51179. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  51180. addProp(el, 'checked',
  51181. "Array.isArray(" + value + ")" +
  51182. "?_i(" + value + "," + valueBinding + ")>-1" + (
  51183. trueValueBinding === 'true'
  51184. ? (":(" + value + ")")
  51185. : (":_q(" + value + "," + trueValueBinding + ")")
  51186. )
  51187. );
  51188. addHandler(el, 'change',
  51189. "var $$a=" + value + "," +
  51190. '$$el=$event.target,' +
  51191. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  51192. 'if(Array.isArray($$a)){' +
  51193. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  51194. '$$i=_i($$a,$$v);' +
  51195. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  51196. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  51197. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  51198. null, true
  51199. );
  51200. }
  51201. function genRadioModel (
  51202. el,
  51203. value,
  51204. modifiers
  51205. ) {
  51206. var number = modifiers && modifiers.number;
  51207. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51208. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  51209. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  51210. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  51211. }
  51212. function genSelect (
  51213. el,
  51214. value,
  51215. modifiers
  51216. ) {
  51217. var number = modifiers && modifiers.number;
  51218. var selectedVal = "Array.prototype.filter" +
  51219. ".call($event.target.options,function(o){return o.selected})" +
  51220. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  51221. "return " + (number ? '_n(val)' : 'val') + "})";
  51222. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  51223. var code = "var $$selectedVal = " + selectedVal + ";";
  51224. code = code + " " + (genAssignmentCode(value, assignment));
  51225. addHandler(el, 'change', code, null, true);
  51226. }
  51227. function genDefaultModel (
  51228. el,
  51229. value,
  51230. modifiers
  51231. ) {
  51232. var type = el.attrsMap.type;
  51233. // warn if v-bind:value conflicts with v-model
  51234. // except for inputs with v-bind:type
  51235. {
  51236. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  51237. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  51238. if (value$1 && !typeBinding) {
  51239. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  51240. warn$1(
  51241. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  51242. 'because the latter already expands to a value binding internally',
  51243. el.rawAttrsMap[binding]
  51244. );
  51245. }
  51246. }
  51247. var ref = modifiers || {};
  51248. var lazy = ref.lazy;
  51249. var number = ref.number;
  51250. var trim = ref.trim;
  51251. var needCompositionGuard = !lazy && type !== 'range';
  51252. var event = lazy
  51253. ? 'change'
  51254. : type === 'range'
  51255. ? RANGE_TOKEN
  51256. : 'input';
  51257. var valueExpression = '$event.target.value';
  51258. if (trim) {
  51259. valueExpression = "$event.target.value.trim()";
  51260. }
  51261. if (number) {
  51262. valueExpression = "_n(" + valueExpression + ")";
  51263. }
  51264. var code = genAssignmentCode(value, valueExpression);
  51265. if (needCompositionGuard) {
  51266. code = "if($event.target.composing)return;" + code;
  51267. }
  51268. addProp(el, 'value', ("(" + value + ")"));
  51269. addHandler(el, event, code, null, true);
  51270. if (trim || number) {
  51271. addHandler(el, 'blur', '$forceUpdate()');
  51272. }
  51273. }
  51274. /* */
  51275. // normalize v-model event tokens that can only be determined at runtime.
  51276. // it's important to place the event as the first in the array because
  51277. // the whole point is ensuring the v-model callback gets called before
  51278. // user-attached handlers.
  51279. function normalizeEvents (on) {
  51280. /* istanbul ignore if */
  51281. if (isDef(on[RANGE_TOKEN])) {
  51282. // IE input[type=range] only supports `change` event
  51283. var event = isIE ? 'change' : 'input';
  51284. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  51285. delete on[RANGE_TOKEN];
  51286. }
  51287. // This was originally intended to fix #4521 but no longer necessary
  51288. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  51289. /* istanbul ignore if */
  51290. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  51291. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  51292. delete on[CHECKBOX_RADIO_TOKEN];
  51293. }
  51294. }
  51295. var target$1;
  51296. function createOnceHandler$1 (event, handler, capture) {
  51297. var _target = target$1; // save current target element in closure
  51298. return function onceHandler () {
  51299. var res = handler.apply(null, arguments);
  51300. if (res !== null) {
  51301. remove$2(event, onceHandler, capture, _target);
  51302. }
  51303. }
  51304. }
  51305. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  51306. // implementation and does not fire microtasks in between event propagation, so
  51307. // safe to exclude.
  51308. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  51309. function add$1 (
  51310. name,
  51311. handler,
  51312. capture,
  51313. passive
  51314. ) {
  51315. // async edge case #6566: inner click event triggers patch, event handler
  51316. // attached to outer element during patch, and triggered again. This
  51317. // happens because browsers fire microtask ticks between event propagation.
  51318. // the solution is simple: we save the timestamp when a handler is attached,
  51319. // and the handler would only fire if the event passed to it was fired
  51320. // AFTER it was attached.
  51321. if (useMicrotaskFix) {
  51322. var attachedTimestamp = currentFlushTimestamp;
  51323. var original = handler;
  51324. handler = original._wrapper = function (e) {
  51325. if (
  51326. // no bubbling, should always fire.
  51327. // this is just a safety net in case event.timeStamp is unreliable in
  51328. // certain weird environments...
  51329. e.target === e.currentTarget ||
  51330. // event is fired after handler attachment
  51331. e.timeStamp >= attachedTimestamp ||
  51332. // bail for environments that have buggy event.timeStamp implementations
  51333. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  51334. // #9681 QtWebEngine event.timeStamp is negative value
  51335. e.timeStamp <= 0 ||
  51336. // #9448 bail if event is fired in another document in a multi-page
  51337. // electron/nw.js app, since event.timeStamp will be using a different
  51338. // starting reference
  51339. e.target.ownerDocument !== document
  51340. ) {
  51341. return original.apply(this, arguments)
  51342. }
  51343. };
  51344. }
  51345. target$1.addEventListener(
  51346. name,
  51347. handler,
  51348. supportsPassive
  51349. ? { capture: capture, passive: passive }
  51350. : capture
  51351. );
  51352. }
  51353. function remove$2 (
  51354. name,
  51355. handler,
  51356. capture,
  51357. _target
  51358. ) {
  51359. (_target || target$1).removeEventListener(
  51360. name,
  51361. handler._wrapper || handler,
  51362. capture
  51363. );
  51364. }
  51365. function updateDOMListeners (oldVnode, vnode) {
  51366. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  51367. return
  51368. }
  51369. var on = vnode.data.on || {};
  51370. var oldOn = oldVnode.data.on || {};
  51371. target$1 = vnode.elm;
  51372. normalizeEvents(on);
  51373. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  51374. target$1 = undefined;
  51375. }
  51376. var events = {
  51377. create: updateDOMListeners,
  51378. update: updateDOMListeners
  51379. };
  51380. /* */
  51381. var svgContainer;
  51382. function updateDOMProps (oldVnode, vnode) {
  51383. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  51384. return
  51385. }
  51386. var key, cur;
  51387. var elm = vnode.elm;
  51388. var oldProps = oldVnode.data.domProps || {};
  51389. var props = vnode.data.domProps || {};
  51390. // clone observed objects, as the user probably wants to mutate it
  51391. if (isDef(props.__ob__)) {
  51392. props = vnode.data.domProps = extend({}, props);
  51393. }
  51394. for (key in oldProps) {
  51395. if (!(key in props)) {
  51396. elm[key] = '';
  51397. }
  51398. }
  51399. for (key in props) {
  51400. cur = props[key];
  51401. // ignore children if the node has textContent or innerHTML,
  51402. // as these will throw away existing DOM nodes and cause removal errors
  51403. // on subsequent patches (#3360)
  51404. if (key === 'textContent' || key === 'innerHTML') {
  51405. if (vnode.children) { vnode.children.length = 0; }
  51406. if (cur === oldProps[key]) { continue }
  51407. // #6601 work around Chrome version <= 55 bug where single textNode
  51408. // replaced by innerHTML/textContent retains its parentNode property
  51409. if (elm.childNodes.length === 1) {
  51410. elm.removeChild(elm.childNodes[0]);
  51411. }
  51412. }
  51413. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  51414. // store value as _value as well since
  51415. // non-string values will be stringified
  51416. elm._value = cur;
  51417. // avoid resetting cursor position when value is the same
  51418. var strCur = isUndef(cur) ? '' : String(cur);
  51419. if (shouldUpdateValue(elm, strCur)) {
  51420. elm.value = strCur;
  51421. }
  51422. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  51423. // IE doesn't support innerHTML for SVG elements
  51424. svgContainer = svgContainer || document.createElement('div');
  51425. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  51426. var svg = svgContainer.firstChild;
  51427. while (elm.firstChild) {
  51428. elm.removeChild(elm.firstChild);
  51429. }
  51430. while (svg.firstChild) {
  51431. elm.appendChild(svg.firstChild);
  51432. }
  51433. } else if (
  51434. // skip the update if old and new VDOM state is the same.
  51435. // `value` is handled separately because the DOM value may be temporarily
  51436. // out of sync with VDOM state due to focus, composition and modifiers.
  51437. // This #4521 by skipping the unnecesarry `checked` update.
  51438. cur !== oldProps[key]
  51439. ) {
  51440. // some property updates can throw
  51441. // e.g. `value` on <progress> w/ non-finite value
  51442. try {
  51443. elm[key] = cur;
  51444. } catch (e) {}
  51445. }
  51446. }
  51447. }
  51448. // check platforms/web/util/attrs.js acceptValue
  51449. function shouldUpdateValue (elm, checkVal) {
  51450. return (!elm.composing && (
  51451. elm.tagName === 'OPTION' ||
  51452. isNotInFocusAndDirty(elm, checkVal) ||
  51453. isDirtyWithModifiers(elm, checkVal)
  51454. ))
  51455. }
  51456. function isNotInFocusAndDirty (elm, checkVal) {
  51457. // return true when textbox (.number and .trim) loses focus and its value is
  51458. // not equal to the updated value
  51459. var notInFocus = true;
  51460. // #6157
  51461. // work around IE bug when accessing document.activeElement in an iframe
  51462. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  51463. return notInFocus && elm.value !== checkVal
  51464. }
  51465. function isDirtyWithModifiers (elm, newVal) {
  51466. var value = elm.value;
  51467. var modifiers = elm._vModifiers; // injected by v-model runtime
  51468. if (isDef(modifiers)) {
  51469. if (modifiers.number) {
  51470. return toNumber(value) !== toNumber(newVal)
  51471. }
  51472. if (modifiers.trim) {
  51473. return value.trim() !== newVal.trim()
  51474. }
  51475. }
  51476. return value !== newVal
  51477. }
  51478. var domProps = {
  51479. create: updateDOMProps,
  51480. update: updateDOMProps
  51481. };
  51482. /* */
  51483. var parseStyleText = cached(function (cssText) {
  51484. var res = {};
  51485. var listDelimiter = /;(?![^(]*\))/g;
  51486. var propertyDelimiter = /:(.+)/;
  51487. cssText.split(listDelimiter).forEach(function (item) {
  51488. if (item) {
  51489. var tmp = item.split(propertyDelimiter);
  51490. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  51491. }
  51492. });
  51493. return res
  51494. });
  51495. // merge static and dynamic style data on the same vnode
  51496. function normalizeStyleData (data) {
  51497. var style = normalizeStyleBinding(data.style);
  51498. // static style is pre-processed into an object during compilation
  51499. // and is always a fresh object, so it's safe to merge into it
  51500. return data.staticStyle
  51501. ? extend(data.staticStyle, style)
  51502. : style
  51503. }
  51504. // normalize possible array / string values into Object
  51505. function normalizeStyleBinding (bindingStyle) {
  51506. if (Array.isArray(bindingStyle)) {
  51507. return toObject(bindingStyle)
  51508. }
  51509. if (typeof bindingStyle === 'string') {
  51510. return parseStyleText(bindingStyle)
  51511. }
  51512. return bindingStyle
  51513. }
  51514. /**
  51515. * parent component style should be after child's
  51516. * so that parent component's style could override it
  51517. */
  51518. function getStyle (vnode, checkChild) {
  51519. var res = {};
  51520. var styleData;
  51521. if (checkChild) {
  51522. var childNode = vnode;
  51523. while (childNode.componentInstance) {
  51524. childNode = childNode.componentInstance._vnode;
  51525. if (
  51526. childNode && childNode.data &&
  51527. (styleData = normalizeStyleData(childNode.data))
  51528. ) {
  51529. extend(res, styleData);
  51530. }
  51531. }
  51532. }
  51533. if ((styleData = normalizeStyleData(vnode.data))) {
  51534. extend(res, styleData);
  51535. }
  51536. var parentNode = vnode;
  51537. while ((parentNode = parentNode.parent)) {
  51538. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51539. extend(res, styleData);
  51540. }
  51541. }
  51542. return res
  51543. }
  51544. /* */
  51545. var cssVarRE = /^--/;
  51546. var importantRE = /\s*!important$/;
  51547. var setProp = function (el, name, val) {
  51548. /* istanbul ignore if */
  51549. if (cssVarRE.test(name)) {
  51550. el.style.setProperty(name, val);
  51551. } else if (importantRE.test(val)) {
  51552. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51553. } else {
  51554. var normalizedName = normalize(name);
  51555. if (Array.isArray(val)) {
  51556. // Support values array created by autoprefixer, e.g.
  51557. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51558. // Set them one by one, and the browser will only set those it can recognize
  51559. for (var i = 0, len = val.length; i < len; i++) {
  51560. el.style[normalizedName] = val[i];
  51561. }
  51562. } else {
  51563. el.style[normalizedName] = val;
  51564. }
  51565. }
  51566. };
  51567. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51568. var emptyStyle;
  51569. var normalize = cached(function (prop) {
  51570. emptyStyle = emptyStyle || document.createElement('div').style;
  51571. prop = camelize(prop);
  51572. if (prop !== 'filter' && (prop in emptyStyle)) {
  51573. return prop
  51574. }
  51575. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51576. for (var i = 0; i < vendorNames.length; i++) {
  51577. var name = vendorNames[i] + capName;
  51578. if (name in emptyStyle) {
  51579. return name
  51580. }
  51581. }
  51582. });
  51583. function updateStyle (oldVnode, vnode) {
  51584. var data = vnode.data;
  51585. var oldData = oldVnode.data;
  51586. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51587. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51588. ) {
  51589. return
  51590. }
  51591. var cur, name;
  51592. var el = vnode.elm;
  51593. var oldStaticStyle = oldData.staticStyle;
  51594. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51595. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51596. var oldStyle = oldStaticStyle || oldStyleBinding;
  51597. var style = normalizeStyleBinding(vnode.data.style) || {};
  51598. // store normalized style under a different key for next diff
  51599. // make sure to clone it if it's reactive, since the user likely wants
  51600. // to mutate it.
  51601. vnode.data.normalizedStyle = isDef(style.__ob__)
  51602. ? extend({}, style)
  51603. : style;
  51604. var newStyle = getStyle(vnode, true);
  51605. for (name in oldStyle) {
  51606. if (isUndef(newStyle[name])) {
  51607. setProp(el, name, '');
  51608. }
  51609. }
  51610. for (name in newStyle) {
  51611. cur = newStyle[name];
  51612. if (cur !== oldStyle[name]) {
  51613. // ie9 setting to null has no effect, must use empty string
  51614. setProp(el, name, cur == null ? '' : cur);
  51615. }
  51616. }
  51617. }
  51618. var style = {
  51619. create: updateStyle,
  51620. update: updateStyle
  51621. };
  51622. /* */
  51623. var whitespaceRE = /\s+/;
  51624. /**
  51625. * Add class with compatibility for SVG since classList is not supported on
  51626. * SVG elements in IE
  51627. */
  51628. function addClass (el, cls) {
  51629. /* istanbul ignore if */
  51630. if (!cls || !(cls = cls.trim())) {
  51631. return
  51632. }
  51633. /* istanbul ignore else */
  51634. if (el.classList) {
  51635. if (cls.indexOf(' ') > -1) {
  51636. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51637. } else {
  51638. el.classList.add(cls);
  51639. }
  51640. } else {
  51641. var cur = " " + (el.getAttribute('class') || '') + " ";
  51642. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51643. el.setAttribute('class', (cur + cls).trim());
  51644. }
  51645. }
  51646. }
  51647. /**
  51648. * Remove class with compatibility for SVG since classList is not supported on
  51649. * SVG elements in IE
  51650. */
  51651. function removeClass (el, cls) {
  51652. /* istanbul ignore if */
  51653. if (!cls || !(cls = cls.trim())) {
  51654. return
  51655. }
  51656. /* istanbul ignore else */
  51657. if (el.classList) {
  51658. if (cls.indexOf(' ') > -1) {
  51659. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51660. } else {
  51661. el.classList.remove(cls);
  51662. }
  51663. if (!el.classList.length) {
  51664. el.removeAttribute('class');
  51665. }
  51666. } else {
  51667. var cur = " " + (el.getAttribute('class') || '') + " ";
  51668. var tar = ' ' + cls + ' ';
  51669. while (cur.indexOf(tar) >= 0) {
  51670. cur = cur.replace(tar, ' ');
  51671. }
  51672. cur = cur.trim();
  51673. if (cur) {
  51674. el.setAttribute('class', cur);
  51675. } else {
  51676. el.removeAttribute('class');
  51677. }
  51678. }
  51679. }
  51680. /* */
  51681. function resolveTransition (def$$1) {
  51682. if (!def$$1) {
  51683. return
  51684. }
  51685. /* istanbul ignore else */
  51686. if (typeof def$$1 === 'object') {
  51687. var res = {};
  51688. if (def$$1.css !== false) {
  51689. extend(res, autoCssTransition(def$$1.name || 'v'));
  51690. }
  51691. extend(res, def$$1);
  51692. return res
  51693. } else if (typeof def$$1 === 'string') {
  51694. return autoCssTransition(def$$1)
  51695. }
  51696. }
  51697. var autoCssTransition = cached(function (name) {
  51698. return {
  51699. enterClass: (name + "-enter"),
  51700. enterToClass: (name + "-enter-to"),
  51701. enterActiveClass: (name + "-enter-active"),
  51702. leaveClass: (name + "-leave"),
  51703. leaveToClass: (name + "-leave-to"),
  51704. leaveActiveClass: (name + "-leave-active")
  51705. }
  51706. });
  51707. var hasTransition = inBrowser && !isIE9;
  51708. var TRANSITION = 'transition';
  51709. var ANIMATION = 'animation';
  51710. // Transition property/event sniffing
  51711. var transitionProp = 'transition';
  51712. var transitionEndEvent = 'transitionend';
  51713. var animationProp = 'animation';
  51714. var animationEndEvent = 'animationend';
  51715. if (hasTransition) {
  51716. /* istanbul ignore if */
  51717. if (window.ontransitionend === undefined &&
  51718. window.onwebkittransitionend !== undefined
  51719. ) {
  51720. transitionProp = 'WebkitTransition';
  51721. transitionEndEvent = 'webkitTransitionEnd';
  51722. }
  51723. if (window.onanimationend === undefined &&
  51724. window.onwebkitanimationend !== undefined
  51725. ) {
  51726. animationProp = 'WebkitAnimation';
  51727. animationEndEvent = 'webkitAnimationEnd';
  51728. }
  51729. }
  51730. // binding to window is necessary to make hot reload work in IE in strict mode
  51731. var raf = inBrowser
  51732. ? window.requestAnimationFrame
  51733. ? window.requestAnimationFrame.bind(window)
  51734. : setTimeout
  51735. : /* istanbul ignore next */ function (fn) { return fn(); };
  51736. function nextFrame (fn) {
  51737. raf(function () {
  51738. raf(fn);
  51739. });
  51740. }
  51741. function addTransitionClass (el, cls) {
  51742. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51743. if (transitionClasses.indexOf(cls) < 0) {
  51744. transitionClasses.push(cls);
  51745. addClass(el, cls);
  51746. }
  51747. }
  51748. function removeTransitionClass (el, cls) {
  51749. if (el._transitionClasses) {
  51750. remove(el._transitionClasses, cls);
  51751. }
  51752. removeClass(el, cls);
  51753. }
  51754. function whenTransitionEnds (
  51755. el,
  51756. expectedType,
  51757. cb
  51758. ) {
  51759. var ref = getTransitionInfo(el, expectedType);
  51760. var type = ref.type;
  51761. var timeout = ref.timeout;
  51762. var propCount = ref.propCount;
  51763. if (!type) { return cb() }
  51764. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51765. var ended = 0;
  51766. var end = function () {
  51767. el.removeEventListener(event, onEnd);
  51768. cb();
  51769. };
  51770. var onEnd = function (e) {
  51771. if (e.target === el) {
  51772. if (++ended >= propCount) {
  51773. end();
  51774. }
  51775. }
  51776. };
  51777. setTimeout(function () {
  51778. if (ended < propCount) {
  51779. end();
  51780. }
  51781. }, timeout + 1);
  51782. el.addEventListener(event, onEnd);
  51783. }
  51784. var transformRE = /\b(transform|all)(,|$)/;
  51785. function getTransitionInfo (el, expectedType) {
  51786. var styles = window.getComputedStyle(el);
  51787. // JSDOM may return undefined for transition properties
  51788. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  51789. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  51790. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  51791. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  51792. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  51793. var animationTimeout = getTimeout(animationDelays, animationDurations);
  51794. var type;
  51795. var timeout = 0;
  51796. var propCount = 0;
  51797. /* istanbul ignore if */
  51798. if (expectedType === TRANSITION) {
  51799. if (transitionTimeout > 0) {
  51800. type = TRANSITION;
  51801. timeout = transitionTimeout;
  51802. propCount = transitionDurations.length;
  51803. }
  51804. } else if (expectedType === ANIMATION) {
  51805. if (animationTimeout > 0) {
  51806. type = ANIMATION;
  51807. timeout = animationTimeout;
  51808. propCount = animationDurations.length;
  51809. }
  51810. } else {
  51811. timeout = Math.max(transitionTimeout, animationTimeout);
  51812. type = timeout > 0
  51813. ? transitionTimeout > animationTimeout
  51814. ? TRANSITION
  51815. : ANIMATION
  51816. : null;
  51817. propCount = type
  51818. ? type === TRANSITION
  51819. ? transitionDurations.length
  51820. : animationDurations.length
  51821. : 0;
  51822. }
  51823. var hasTransform =
  51824. type === TRANSITION &&
  51825. transformRE.test(styles[transitionProp + 'Property']);
  51826. return {
  51827. type: type,
  51828. timeout: timeout,
  51829. propCount: propCount,
  51830. hasTransform: hasTransform
  51831. }
  51832. }
  51833. function getTimeout (delays, durations) {
  51834. /* istanbul ignore next */
  51835. while (delays.length < durations.length) {
  51836. delays = delays.concat(delays);
  51837. }
  51838. return Math.max.apply(null, durations.map(function (d, i) {
  51839. return toMs(d) + toMs(delays[i])
  51840. }))
  51841. }
  51842. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  51843. // in a locale-dependent way, using a comma instead of a dot.
  51844. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  51845. // as a floor function) causing unexpected behaviors
  51846. function toMs (s) {
  51847. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  51848. }
  51849. /* */
  51850. function enter (vnode, toggleDisplay) {
  51851. var el = vnode.elm;
  51852. // call leave callback now
  51853. if (isDef(el._leaveCb)) {
  51854. el._leaveCb.cancelled = true;
  51855. el._leaveCb();
  51856. }
  51857. var data = resolveTransition(vnode.data.transition);
  51858. if (isUndef(data)) {
  51859. return
  51860. }
  51861. /* istanbul ignore if */
  51862. if (isDef(el._enterCb) || el.nodeType !== 1) {
  51863. return
  51864. }
  51865. var css = data.css;
  51866. var type = data.type;
  51867. var enterClass = data.enterClass;
  51868. var enterToClass = data.enterToClass;
  51869. var enterActiveClass = data.enterActiveClass;
  51870. var appearClass = data.appearClass;
  51871. var appearToClass = data.appearToClass;
  51872. var appearActiveClass = data.appearActiveClass;
  51873. var beforeEnter = data.beforeEnter;
  51874. var enter = data.enter;
  51875. var afterEnter = data.afterEnter;
  51876. var enterCancelled = data.enterCancelled;
  51877. var beforeAppear = data.beforeAppear;
  51878. var appear = data.appear;
  51879. var afterAppear = data.afterAppear;
  51880. var appearCancelled = data.appearCancelled;
  51881. var duration = data.duration;
  51882. // activeInstance will always be the <transition> component managing this
  51883. // transition. One edge case to check is when the <transition> is placed
  51884. // as the root node of a child component. In that case we need to check
  51885. // <transition>'s parent for appear check.
  51886. var context = activeInstance;
  51887. var transitionNode = activeInstance.$vnode;
  51888. while (transitionNode && transitionNode.parent) {
  51889. context = transitionNode.context;
  51890. transitionNode = transitionNode.parent;
  51891. }
  51892. var isAppear = !context._isMounted || !vnode.isRootInsert;
  51893. if (isAppear && !appear && appear !== '') {
  51894. return
  51895. }
  51896. var startClass = isAppear && appearClass
  51897. ? appearClass
  51898. : enterClass;
  51899. var activeClass = isAppear && appearActiveClass
  51900. ? appearActiveClass
  51901. : enterActiveClass;
  51902. var toClass = isAppear && appearToClass
  51903. ? appearToClass
  51904. : enterToClass;
  51905. var beforeEnterHook = isAppear
  51906. ? (beforeAppear || beforeEnter)
  51907. : beforeEnter;
  51908. var enterHook = isAppear
  51909. ? (typeof appear === 'function' ? appear : enter)
  51910. : enter;
  51911. var afterEnterHook = isAppear
  51912. ? (afterAppear || afterEnter)
  51913. : afterEnter;
  51914. var enterCancelledHook = isAppear
  51915. ? (appearCancelled || enterCancelled)
  51916. : enterCancelled;
  51917. var explicitEnterDuration = toNumber(
  51918. isObject(duration)
  51919. ? duration.enter
  51920. : duration
  51921. );
  51922. if (explicitEnterDuration != null) {
  51923. checkDuration(explicitEnterDuration, 'enter', vnode);
  51924. }
  51925. var expectsCSS = css !== false && !isIE9;
  51926. var userWantsControl = getHookArgumentsLength(enterHook);
  51927. var cb = el._enterCb = once(function () {
  51928. if (expectsCSS) {
  51929. removeTransitionClass(el, toClass);
  51930. removeTransitionClass(el, activeClass);
  51931. }
  51932. if (cb.cancelled) {
  51933. if (expectsCSS) {
  51934. removeTransitionClass(el, startClass);
  51935. }
  51936. enterCancelledHook && enterCancelledHook(el);
  51937. } else {
  51938. afterEnterHook && afterEnterHook(el);
  51939. }
  51940. el._enterCb = null;
  51941. });
  51942. if (!vnode.data.show) {
  51943. // remove pending leave element on enter by injecting an insert hook
  51944. mergeVNodeHook(vnode, 'insert', function () {
  51945. var parent = el.parentNode;
  51946. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  51947. if (pendingNode &&
  51948. pendingNode.tag === vnode.tag &&
  51949. pendingNode.elm._leaveCb
  51950. ) {
  51951. pendingNode.elm._leaveCb();
  51952. }
  51953. enterHook && enterHook(el, cb);
  51954. });
  51955. }
  51956. // start enter transition
  51957. beforeEnterHook && beforeEnterHook(el);
  51958. if (expectsCSS) {
  51959. addTransitionClass(el, startClass);
  51960. addTransitionClass(el, activeClass);
  51961. nextFrame(function () {
  51962. removeTransitionClass(el, startClass);
  51963. if (!cb.cancelled) {
  51964. addTransitionClass(el, toClass);
  51965. if (!userWantsControl) {
  51966. if (isValidDuration(explicitEnterDuration)) {
  51967. setTimeout(cb, explicitEnterDuration);
  51968. } else {
  51969. whenTransitionEnds(el, type, cb);
  51970. }
  51971. }
  51972. }
  51973. });
  51974. }
  51975. if (vnode.data.show) {
  51976. toggleDisplay && toggleDisplay();
  51977. enterHook && enterHook(el, cb);
  51978. }
  51979. if (!expectsCSS && !userWantsControl) {
  51980. cb();
  51981. }
  51982. }
  51983. function leave (vnode, rm) {
  51984. var el = vnode.elm;
  51985. // call enter callback now
  51986. if (isDef(el._enterCb)) {
  51987. el._enterCb.cancelled = true;
  51988. el._enterCb();
  51989. }
  51990. var data = resolveTransition(vnode.data.transition);
  51991. if (isUndef(data) || el.nodeType !== 1) {
  51992. return rm()
  51993. }
  51994. /* istanbul ignore if */
  51995. if (isDef(el._leaveCb)) {
  51996. return
  51997. }
  51998. var css = data.css;
  51999. var type = data.type;
  52000. var leaveClass = data.leaveClass;
  52001. var leaveToClass = data.leaveToClass;
  52002. var leaveActiveClass = data.leaveActiveClass;
  52003. var beforeLeave = data.beforeLeave;
  52004. var leave = data.leave;
  52005. var afterLeave = data.afterLeave;
  52006. var leaveCancelled = data.leaveCancelled;
  52007. var delayLeave = data.delayLeave;
  52008. var duration = data.duration;
  52009. var expectsCSS = css !== false && !isIE9;
  52010. var userWantsControl = getHookArgumentsLength(leave);
  52011. var explicitLeaveDuration = toNumber(
  52012. isObject(duration)
  52013. ? duration.leave
  52014. : duration
  52015. );
  52016. if (isDef(explicitLeaveDuration)) {
  52017. checkDuration(explicitLeaveDuration, 'leave', vnode);
  52018. }
  52019. var cb = el._leaveCb = once(function () {
  52020. if (el.parentNode && el.parentNode._pending) {
  52021. el.parentNode._pending[vnode.key] = null;
  52022. }
  52023. if (expectsCSS) {
  52024. removeTransitionClass(el, leaveToClass);
  52025. removeTransitionClass(el, leaveActiveClass);
  52026. }
  52027. if (cb.cancelled) {
  52028. if (expectsCSS) {
  52029. removeTransitionClass(el, leaveClass);
  52030. }
  52031. leaveCancelled && leaveCancelled(el);
  52032. } else {
  52033. rm();
  52034. afterLeave && afterLeave(el);
  52035. }
  52036. el._leaveCb = null;
  52037. });
  52038. if (delayLeave) {
  52039. delayLeave(performLeave);
  52040. } else {
  52041. performLeave();
  52042. }
  52043. function performLeave () {
  52044. // the delayed leave may have already been cancelled
  52045. if (cb.cancelled) {
  52046. return
  52047. }
  52048. // record leaving element
  52049. if (!vnode.data.show && el.parentNode) {
  52050. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  52051. }
  52052. beforeLeave && beforeLeave(el);
  52053. if (expectsCSS) {
  52054. addTransitionClass(el, leaveClass);
  52055. addTransitionClass(el, leaveActiveClass);
  52056. nextFrame(function () {
  52057. removeTransitionClass(el, leaveClass);
  52058. if (!cb.cancelled) {
  52059. addTransitionClass(el, leaveToClass);
  52060. if (!userWantsControl) {
  52061. if (isValidDuration(explicitLeaveDuration)) {
  52062. setTimeout(cb, explicitLeaveDuration);
  52063. } else {
  52064. whenTransitionEnds(el, type, cb);
  52065. }
  52066. }
  52067. }
  52068. });
  52069. }
  52070. leave && leave(el, cb);
  52071. if (!expectsCSS && !userWantsControl) {
  52072. cb();
  52073. }
  52074. }
  52075. }
  52076. // only used in dev mode
  52077. function checkDuration (val, name, vnode) {
  52078. if (typeof val !== 'number') {
  52079. warn(
  52080. "<transition> explicit " + name + " duration is not a valid number - " +
  52081. "got " + (JSON.stringify(val)) + ".",
  52082. vnode.context
  52083. );
  52084. } else if (isNaN(val)) {
  52085. warn(
  52086. "<transition> explicit " + name + " duration is NaN - " +
  52087. 'the duration expression might be incorrect.',
  52088. vnode.context
  52089. );
  52090. }
  52091. }
  52092. function isValidDuration (val) {
  52093. return typeof val === 'number' && !isNaN(val)
  52094. }
  52095. /**
  52096. * Normalize a transition hook's argument length. The hook may be:
  52097. * - a merged hook (invoker) with the original in .fns
  52098. * - a wrapped component method (check ._length)
  52099. * - a plain function (.length)
  52100. */
  52101. function getHookArgumentsLength (fn) {
  52102. if (isUndef(fn)) {
  52103. return false
  52104. }
  52105. var invokerFns = fn.fns;
  52106. if (isDef(invokerFns)) {
  52107. // invoker
  52108. return getHookArgumentsLength(
  52109. Array.isArray(invokerFns)
  52110. ? invokerFns[0]
  52111. : invokerFns
  52112. )
  52113. } else {
  52114. return (fn._length || fn.length) > 1
  52115. }
  52116. }
  52117. function _enter (_, vnode) {
  52118. if (vnode.data.show !== true) {
  52119. enter(vnode);
  52120. }
  52121. }
  52122. var transition = inBrowser ? {
  52123. create: _enter,
  52124. activate: _enter,
  52125. remove: function remove$$1 (vnode, rm) {
  52126. /* istanbul ignore else */
  52127. if (vnode.data.show !== true) {
  52128. leave(vnode, rm);
  52129. } else {
  52130. rm();
  52131. }
  52132. }
  52133. } : {};
  52134. var platformModules = [
  52135. attrs,
  52136. klass,
  52137. events,
  52138. domProps,
  52139. style,
  52140. transition
  52141. ];
  52142. /* */
  52143. // the directive module should be applied last, after all
  52144. // built-in modules have been applied.
  52145. var modules = platformModules.concat(baseModules);
  52146. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  52147. /**
  52148. * Not type checking this file because flow doesn't like attaching
  52149. * properties to Elements.
  52150. */
  52151. /* istanbul ignore if */
  52152. if (isIE9) {
  52153. // http://www.matts411.com/post/internet-explorer-9-oninput/
  52154. document.addEventListener('selectionchange', function () {
  52155. var el = document.activeElement;
  52156. if (el && el.vmodel) {
  52157. trigger(el, 'input');
  52158. }
  52159. });
  52160. }
  52161. var directive = {
  52162. inserted: function inserted (el, binding, vnode, oldVnode) {
  52163. if (vnode.tag === 'select') {
  52164. // #6903
  52165. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  52166. mergeVNodeHook(vnode, 'postpatch', function () {
  52167. directive.componentUpdated(el, binding, vnode);
  52168. });
  52169. } else {
  52170. setSelected(el, binding, vnode.context);
  52171. }
  52172. el._vOptions = [].map.call(el.options, getValue);
  52173. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  52174. el._vModifiers = binding.modifiers;
  52175. if (!binding.modifiers.lazy) {
  52176. el.addEventListener('compositionstart', onCompositionStart);
  52177. el.addEventListener('compositionend', onCompositionEnd);
  52178. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  52179. // switching focus before confirming composition choice
  52180. // this also fixes the issue where some browsers e.g. iOS Chrome
  52181. // fires "change" instead of "input" on autocomplete.
  52182. el.addEventListener('change', onCompositionEnd);
  52183. /* istanbul ignore if */
  52184. if (isIE9) {
  52185. el.vmodel = true;
  52186. }
  52187. }
  52188. }
  52189. },
  52190. componentUpdated: function componentUpdated (el, binding, vnode) {
  52191. if (vnode.tag === 'select') {
  52192. setSelected(el, binding, vnode.context);
  52193. // in case the options rendered by v-for have changed,
  52194. // it's possible that the value is out-of-sync with the rendered options.
  52195. // detect such cases and filter out values that no longer has a matching
  52196. // option in the DOM.
  52197. var prevOptions = el._vOptions;
  52198. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  52199. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  52200. // trigger change event if
  52201. // no matching option found for at least one value
  52202. var needReset = el.multiple
  52203. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  52204. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  52205. if (needReset) {
  52206. trigger(el, 'change');
  52207. }
  52208. }
  52209. }
  52210. }
  52211. };
  52212. function setSelected (el, binding, vm) {
  52213. actuallySetSelected(el, binding, vm);
  52214. /* istanbul ignore if */
  52215. if (isIE || isEdge) {
  52216. setTimeout(function () {
  52217. actuallySetSelected(el, binding, vm);
  52218. }, 0);
  52219. }
  52220. }
  52221. function actuallySetSelected (el, binding, vm) {
  52222. var value = binding.value;
  52223. var isMultiple = el.multiple;
  52224. if (isMultiple && !Array.isArray(value)) {
  52225. warn(
  52226. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  52227. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  52228. vm
  52229. );
  52230. return
  52231. }
  52232. var selected, option;
  52233. for (var i = 0, l = el.options.length; i < l; i++) {
  52234. option = el.options[i];
  52235. if (isMultiple) {
  52236. selected = looseIndexOf(value, getValue(option)) > -1;
  52237. if (option.selected !== selected) {
  52238. option.selected = selected;
  52239. }
  52240. } else {
  52241. if (looseEqual(getValue(option), value)) {
  52242. if (el.selectedIndex !== i) {
  52243. el.selectedIndex = i;
  52244. }
  52245. return
  52246. }
  52247. }
  52248. }
  52249. if (!isMultiple) {
  52250. el.selectedIndex = -1;
  52251. }
  52252. }
  52253. function hasNoMatchingOption (value, options) {
  52254. return options.every(function (o) { return !looseEqual(o, value); })
  52255. }
  52256. function getValue (option) {
  52257. return '_value' in option
  52258. ? option._value
  52259. : option.value
  52260. }
  52261. function onCompositionStart (e) {
  52262. e.target.composing = true;
  52263. }
  52264. function onCompositionEnd (e) {
  52265. // prevent triggering an input event for no reason
  52266. if (!e.target.composing) { return }
  52267. e.target.composing = false;
  52268. trigger(e.target, 'input');
  52269. }
  52270. function trigger (el, type) {
  52271. var e = document.createEvent('HTMLEvents');
  52272. e.initEvent(type, true, true);
  52273. el.dispatchEvent(e);
  52274. }
  52275. /* */
  52276. // recursively search for possible transition defined inside the component root
  52277. function locateNode (vnode) {
  52278. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  52279. ? locateNode(vnode.componentInstance._vnode)
  52280. : vnode
  52281. }
  52282. var show = {
  52283. bind: function bind (el, ref, vnode) {
  52284. var value = ref.value;
  52285. vnode = locateNode(vnode);
  52286. var transition$$1 = vnode.data && vnode.data.transition;
  52287. var originalDisplay = el.__vOriginalDisplay =
  52288. el.style.display === 'none' ? '' : el.style.display;
  52289. if (value && transition$$1) {
  52290. vnode.data.show = true;
  52291. enter(vnode, function () {
  52292. el.style.display = originalDisplay;
  52293. });
  52294. } else {
  52295. el.style.display = value ? originalDisplay : 'none';
  52296. }
  52297. },
  52298. update: function update (el, ref, vnode) {
  52299. var value = ref.value;
  52300. var oldValue = ref.oldValue;
  52301. /* istanbul ignore if */
  52302. if (!value === !oldValue) { return }
  52303. vnode = locateNode(vnode);
  52304. var transition$$1 = vnode.data && vnode.data.transition;
  52305. if (transition$$1) {
  52306. vnode.data.show = true;
  52307. if (value) {
  52308. enter(vnode, function () {
  52309. el.style.display = el.__vOriginalDisplay;
  52310. });
  52311. } else {
  52312. leave(vnode, function () {
  52313. el.style.display = 'none';
  52314. });
  52315. }
  52316. } else {
  52317. el.style.display = value ? el.__vOriginalDisplay : 'none';
  52318. }
  52319. },
  52320. unbind: function unbind (
  52321. el,
  52322. binding,
  52323. vnode,
  52324. oldVnode,
  52325. isDestroy
  52326. ) {
  52327. if (!isDestroy) {
  52328. el.style.display = el.__vOriginalDisplay;
  52329. }
  52330. }
  52331. };
  52332. var platformDirectives = {
  52333. model: directive,
  52334. show: show
  52335. };
  52336. /* */
  52337. var transitionProps = {
  52338. name: String,
  52339. appear: Boolean,
  52340. css: Boolean,
  52341. mode: String,
  52342. type: String,
  52343. enterClass: String,
  52344. leaveClass: String,
  52345. enterToClass: String,
  52346. leaveToClass: String,
  52347. enterActiveClass: String,
  52348. leaveActiveClass: String,
  52349. appearClass: String,
  52350. appearActiveClass: String,
  52351. appearToClass: String,
  52352. duration: [Number, String, Object]
  52353. };
  52354. // in case the child is also an abstract component, e.g. <keep-alive>
  52355. // we want to recursively retrieve the real component to be rendered
  52356. function getRealChild (vnode) {
  52357. var compOptions = vnode && vnode.componentOptions;
  52358. if (compOptions && compOptions.Ctor.options.abstract) {
  52359. return getRealChild(getFirstComponentChild(compOptions.children))
  52360. } else {
  52361. return vnode
  52362. }
  52363. }
  52364. function extractTransitionData (comp) {
  52365. var data = {};
  52366. var options = comp.$options;
  52367. // props
  52368. for (var key in options.propsData) {
  52369. data[key] = comp[key];
  52370. }
  52371. // events.
  52372. // extract listeners and pass them directly to the transition methods
  52373. var listeners = options._parentListeners;
  52374. for (var key$1 in listeners) {
  52375. data[camelize(key$1)] = listeners[key$1];
  52376. }
  52377. return data
  52378. }
  52379. function placeholder (h, rawChild) {
  52380. if (/\d-keep-alive$/.test(rawChild.tag)) {
  52381. return h('keep-alive', {
  52382. props: rawChild.componentOptions.propsData
  52383. })
  52384. }
  52385. }
  52386. function hasParentTransition (vnode) {
  52387. while ((vnode = vnode.parent)) {
  52388. if (vnode.data.transition) {
  52389. return true
  52390. }
  52391. }
  52392. }
  52393. function isSameChild (child, oldChild) {
  52394. return oldChild.key === child.key && oldChild.tag === child.tag
  52395. }
  52396. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  52397. var isVShowDirective = function (d) { return d.name === 'show'; };
  52398. var Transition = {
  52399. name: 'transition',
  52400. props: transitionProps,
  52401. abstract: true,
  52402. render: function render (h) {
  52403. var this$1 = this;
  52404. var children = this.$slots.default;
  52405. if (!children) {
  52406. return
  52407. }
  52408. // filter out text nodes (possible whitespaces)
  52409. children = children.filter(isNotTextNode);
  52410. /* istanbul ignore if */
  52411. if (!children.length) {
  52412. return
  52413. }
  52414. // warn multiple elements
  52415. if (children.length > 1) {
  52416. warn(
  52417. '<transition> can only be used on a single element. Use ' +
  52418. '<transition-group> for lists.',
  52419. this.$parent
  52420. );
  52421. }
  52422. var mode = this.mode;
  52423. // warn invalid mode
  52424. if (mode && mode !== 'in-out' && mode !== 'out-in'
  52425. ) {
  52426. warn(
  52427. 'invalid <transition> mode: ' + mode,
  52428. this.$parent
  52429. );
  52430. }
  52431. var rawChild = children[0];
  52432. // if this is a component root node and the component's
  52433. // parent container node also has transition, skip.
  52434. if (hasParentTransition(this.$vnode)) {
  52435. return rawChild
  52436. }
  52437. // apply transition data to child
  52438. // use getRealChild() to ignore abstract components e.g. keep-alive
  52439. var child = getRealChild(rawChild);
  52440. /* istanbul ignore if */
  52441. if (!child) {
  52442. return rawChild
  52443. }
  52444. if (this._leaving) {
  52445. return placeholder(h, rawChild)
  52446. }
  52447. // ensure a key that is unique to the vnode type and to this transition
  52448. // component instance. This key will be used to remove pending leaving nodes
  52449. // during entering.
  52450. var id = "__transition-" + (this._uid) + "-";
  52451. child.key = child.key == null
  52452. ? child.isComment
  52453. ? id + 'comment'
  52454. : id + child.tag
  52455. : isPrimitive(child.key)
  52456. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  52457. : child.key;
  52458. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  52459. var oldRawChild = this._vnode;
  52460. var oldChild = getRealChild(oldRawChild);
  52461. // mark v-show
  52462. // so that the transition module can hand over the control to the directive
  52463. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  52464. child.data.show = true;
  52465. }
  52466. if (
  52467. oldChild &&
  52468. oldChild.data &&
  52469. !isSameChild(child, oldChild) &&
  52470. !isAsyncPlaceholder(oldChild) &&
  52471. // #6687 component root is a comment node
  52472. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  52473. ) {
  52474. // replace old child transition data with fresh one
  52475. // important for dynamic transitions!
  52476. var oldData = oldChild.data.transition = extend({}, data);
  52477. // handle transition mode
  52478. if (mode === 'out-in') {
  52479. // return placeholder node and queue update when leave finishes
  52480. this._leaving = true;
  52481. mergeVNodeHook(oldData, 'afterLeave', function () {
  52482. this$1._leaving = false;
  52483. this$1.$forceUpdate();
  52484. });
  52485. return placeholder(h, rawChild)
  52486. } else if (mode === 'in-out') {
  52487. if (isAsyncPlaceholder(child)) {
  52488. return oldRawChild
  52489. }
  52490. var delayedLeave;
  52491. var performLeave = function () { delayedLeave(); };
  52492. mergeVNodeHook(data, 'afterEnter', performLeave);
  52493. mergeVNodeHook(data, 'enterCancelled', performLeave);
  52494. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  52495. }
  52496. }
  52497. return rawChild
  52498. }
  52499. };
  52500. /* */
  52501. var props = extend({
  52502. tag: String,
  52503. moveClass: String
  52504. }, transitionProps);
  52505. delete props.mode;
  52506. var TransitionGroup = {
  52507. props: props,
  52508. beforeMount: function beforeMount () {
  52509. var this$1 = this;
  52510. var update = this._update;
  52511. this._update = function (vnode, hydrating) {
  52512. var restoreActiveInstance = setActiveInstance(this$1);
  52513. // force removing pass
  52514. this$1.__patch__(
  52515. this$1._vnode,
  52516. this$1.kept,
  52517. false, // hydrating
  52518. true // removeOnly (!important, avoids unnecessary moves)
  52519. );
  52520. this$1._vnode = this$1.kept;
  52521. restoreActiveInstance();
  52522. update.call(this$1, vnode, hydrating);
  52523. };
  52524. },
  52525. render: function render (h) {
  52526. var tag = this.tag || this.$vnode.data.tag || 'span';
  52527. var map = Object.create(null);
  52528. var prevChildren = this.prevChildren = this.children;
  52529. var rawChildren = this.$slots.default || [];
  52530. var children = this.children = [];
  52531. var transitionData = extractTransitionData(this);
  52532. for (var i = 0; i < rawChildren.length; i++) {
  52533. var c = rawChildren[i];
  52534. if (c.tag) {
  52535. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52536. children.push(c);
  52537. map[c.key] = c
  52538. ;(c.data || (c.data = {})).transition = transitionData;
  52539. } else {
  52540. var opts = c.componentOptions;
  52541. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52542. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52543. }
  52544. }
  52545. }
  52546. if (prevChildren) {
  52547. var kept = [];
  52548. var removed = [];
  52549. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52550. var c$1 = prevChildren[i$1];
  52551. c$1.data.transition = transitionData;
  52552. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52553. if (map[c$1.key]) {
  52554. kept.push(c$1);
  52555. } else {
  52556. removed.push(c$1);
  52557. }
  52558. }
  52559. this.kept = h(tag, null, kept);
  52560. this.removed = removed;
  52561. }
  52562. return h(tag, null, children)
  52563. },
  52564. updated: function updated () {
  52565. var children = this.prevChildren;
  52566. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52567. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52568. return
  52569. }
  52570. // we divide the work into three loops to avoid mixing DOM reads and writes
  52571. // in each iteration - which helps prevent layout thrashing.
  52572. children.forEach(callPendingCbs);
  52573. children.forEach(recordPosition);
  52574. children.forEach(applyTranslation);
  52575. // force reflow to put everything in position
  52576. // assign to this to avoid being removed in tree-shaking
  52577. // $flow-disable-line
  52578. this._reflow = document.body.offsetHeight;
  52579. children.forEach(function (c) {
  52580. if (c.data.moved) {
  52581. var el = c.elm;
  52582. var s = el.style;
  52583. addTransitionClass(el, moveClass);
  52584. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52585. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52586. if (e && e.target !== el) {
  52587. return
  52588. }
  52589. if (!e || /transform$/.test(e.propertyName)) {
  52590. el.removeEventListener(transitionEndEvent, cb);
  52591. el._moveCb = null;
  52592. removeTransitionClass(el, moveClass);
  52593. }
  52594. });
  52595. }
  52596. });
  52597. },
  52598. methods: {
  52599. hasMove: function hasMove (el, moveClass) {
  52600. /* istanbul ignore if */
  52601. if (!hasTransition) {
  52602. return false
  52603. }
  52604. /* istanbul ignore if */
  52605. if (this._hasMove) {
  52606. return this._hasMove
  52607. }
  52608. // Detect whether an element with the move class applied has
  52609. // CSS transitions. Since the element may be inside an entering
  52610. // transition at this very moment, we make a clone of it and remove
  52611. // all other transition classes applied to ensure only the move class
  52612. // is applied.
  52613. var clone = el.cloneNode();
  52614. if (el._transitionClasses) {
  52615. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52616. }
  52617. addClass(clone, moveClass);
  52618. clone.style.display = 'none';
  52619. this.$el.appendChild(clone);
  52620. var info = getTransitionInfo(clone);
  52621. this.$el.removeChild(clone);
  52622. return (this._hasMove = info.hasTransform)
  52623. }
  52624. }
  52625. };
  52626. function callPendingCbs (c) {
  52627. /* istanbul ignore if */
  52628. if (c.elm._moveCb) {
  52629. c.elm._moveCb();
  52630. }
  52631. /* istanbul ignore if */
  52632. if (c.elm._enterCb) {
  52633. c.elm._enterCb();
  52634. }
  52635. }
  52636. function recordPosition (c) {
  52637. c.data.newPos = c.elm.getBoundingClientRect();
  52638. }
  52639. function applyTranslation (c) {
  52640. var oldPos = c.data.pos;
  52641. var newPos = c.data.newPos;
  52642. var dx = oldPos.left - newPos.left;
  52643. var dy = oldPos.top - newPos.top;
  52644. if (dx || dy) {
  52645. c.data.moved = true;
  52646. var s = c.elm.style;
  52647. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52648. s.transitionDuration = '0s';
  52649. }
  52650. }
  52651. var platformComponents = {
  52652. Transition: Transition,
  52653. TransitionGroup: TransitionGroup
  52654. };
  52655. /* */
  52656. // install platform specific utils
  52657. Vue.config.mustUseProp = mustUseProp;
  52658. Vue.config.isReservedTag = isReservedTag;
  52659. Vue.config.isReservedAttr = isReservedAttr;
  52660. Vue.config.getTagNamespace = getTagNamespace;
  52661. Vue.config.isUnknownElement = isUnknownElement;
  52662. // install platform runtime directives & components
  52663. extend(Vue.options.directives, platformDirectives);
  52664. extend(Vue.options.components, platformComponents);
  52665. // install platform patch function
  52666. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52667. // public mount method
  52668. Vue.prototype.$mount = function (
  52669. el,
  52670. hydrating
  52671. ) {
  52672. el = el && inBrowser ? query(el) : undefined;
  52673. return mountComponent(this, el, hydrating)
  52674. };
  52675. // devtools global hook
  52676. /* istanbul ignore next */
  52677. if (inBrowser) {
  52678. setTimeout(function () {
  52679. if (config.devtools) {
  52680. if (devtools) {
  52681. devtools.emit('init', Vue);
  52682. } else {
  52683. console[console.info ? 'info' : 'log'](
  52684. 'Download the Vue Devtools extension for a better development experience:\n' +
  52685. 'https://github.com/vuejs/vue-devtools'
  52686. );
  52687. }
  52688. }
  52689. if (config.productionTip !== false &&
  52690. typeof console !== 'undefined'
  52691. ) {
  52692. console[console.info ? 'info' : 'log'](
  52693. "You are running Vue in development mode.\n" +
  52694. "Make sure to turn on production mode when deploying for production.\n" +
  52695. "See more tips at https://vuejs.org/guide/deployment.html"
  52696. );
  52697. }
  52698. }, 0);
  52699. }
  52700. /* */
  52701. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52702. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52703. var buildRegex = cached(function (delimiters) {
  52704. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52705. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52706. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52707. });
  52708. function parseText (
  52709. text,
  52710. delimiters
  52711. ) {
  52712. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52713. if (!tagRE.test(text)) {
  52714. return
  52715. }
  52716. var tokens = [];
  52717. var rawTokens = [];
  52718. var lastIndex = tagRE.lastIndex = 0;
  52719. var match, index, tokenValue;
  52720. while ((match = tagRE.exec(text))) {
  52721. index = match.index;
  52722. // push text token
  52723. if (index > lastIndex) {
  52724. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52725. tokens.push(JSON.stringify(tokenValue));
  52726. }
  52727. // tag token
  52728. var exp = parseFilters(match[1].trim());
  52729. tokens.push(("_s(" + exp + ")"));
  52730. rawTokens.push({ '@binding': exp });
  52731. lastIndex = index + match[0].length;
  52732. }
  52733. if (lastIndex < text.length) {
  52734. rawTokens.push(tokenValue = text.slice(lastIndex));
  52735. tokens.push(JSON.stringify(tokenValue));
  52736. }
  52737. return {
  52738. expression: tokens.join('+'),
  52739. tokens: rawTokens
  52740. }
  52741. }
  52742. /* */
  52743. function transformNode (el, options) {
  52744. var warn = options.warn || baseWarn;
  52745. var staticClass = getAndRemoveAttr(el, 'class');
  52746. if (staticClass) {
  52747. var res = parseText(staticClass, options.delimiters);
  52748. if (res) {
  52749. warn(
  52750. "class=\"" + staticClass + "\": " +
  52751. 'Interpolation inside attributes has been removed. ' +
  52752. 'Use v-bind or the colon shorthand instead. For example, ' +
  52753. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52754. el.rawAttrsMap['class']
  52755. );
  52756. }
  52757. }
  52758. if (staticClass) {
  52759. el.staticClass = JSON.stringify(staticClass);
  52760. }
  52761. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52762. if (classBinding) {
  52763. el.classBinding = classBinding;
  52764. }
  52765. }
  52766. function genData (el) {
  52767. var data = '';
  52768. if (el.staticClass) {
  52769. data += "staticClass:" + (el.staticClass) + ",";
  52770. }
  52771. if (el.classBinding) {
  52772. data += "class:" + (el.classBinding) + ",";
  52773. }
  52774. return data
  52775. }
  52776. var klass$1 = {
  52777. staticKeys: ['staticClass'],
  52778. transformNode: transformNode,
  52779. genData: genData
  52780. };
  52781. /* */
  52782. function transformNode$1 (el, options) {
  52783. var warn = options.warn || baseWarn;
  52784. var staticStyle = getAndRemoveAttr(el, 'style');
  52785. if (staticStyle) {
  52786. /* istanbul ignore if */
  52787. {
  52788. var res = parseText(staticStyle, options.delimiters);
  52789. if (res) {
  52790. warn(
  52791. "style=\"" + staticStyle + "\": " +
  52792. 'Interpolation inside attributes has been removed. ' +
  52793. 'Use v-bind or the colon shorthand instead. For example, ' +
  52794. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  52795. el.rawAttrsMap['style']
  52796. );
  52797. }
  52798. }
  52799. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  52800. }
  52801. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  52802. if (styleBinding) {
  52803. el.styleBinding = styleBinding;
  52804. }
  52805. }
  52806. function genData$1 (el) {
  52807. var data = '';
  52808. if (el.staticStyle) {
  52809. data += "staticStyle:" + (el.staticStyle) + ",";
  52810. }
  52811. if (el.styleBinding) {
  52812. data += "style:(" + (el.styleBinding) + "),";
  52813. }
  52814. return data
  52815. }
  52816. var style$1 = {
  52817. staticKeys: ['staticStyle'],
  52818. transformNode: transformNode$1,
  52819. genData: genData$1
  52820. };
  52821. /* */
  52822. var decoder;
  52823. var he = {
  52824. decode: function decode (html) {
  52825. decoder = decoder || document.createElement('div');
  52826. decoder.innerHTML = html;
  52827. return decoder.textContent
  52828. }
  52829. };
  52830. /* */
  52831. var isUnaryTag = makeMap(
  52832. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  52833. 'link,meta,param,source,track,wbr'
  52834. );
  52835. // Elements that you can, intentionally, leave open
  52836. // (and which close themselves)
  52837. var canBeLeftOpenTag = makeMap(
  52838. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  52839. );
  52840. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  52841. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  52842. var isNonPhrasingTag = makeMap(
  52843. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  52844. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  52845. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  52846. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  52847. 'title,tr,track'
  52848. );
  52849. /**
  52850. * Not type-checking this file because it's mostly vendor code.
  52851. */
  52852. // Regular Expressions for parsing tags and attributes
  52853. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52854. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  52855. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  52856. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  52857. var startTagOpen = new RegExp(("^<" + qnameCapture));
  52858. var startTagClose = /^\s*(\/?)>/;
  52859. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  52860. var doctype = /^<!DOCTYPE [^>]+>/i;
  52861. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  52862. var comment = /^<!\--/;
  52863. var conditionalComment = /^<!\[/;
  52864. // Special Elements (can contain anything)
  52865. var isPlainTextElement = makeMap('script,style,textarea', true);
  52866. var reCache = {};
  52867. var decodingMap = {
  52868. '&lt;': '<',
  52869. '&gt;': '>',
  52870. '&quot;': '"',
  52871. '&amp;': '&',
  52872. '&#10;': '\n',
  52873. '&#9;': '\t',
  52874. '&#39;': "'"
  52875. };
  52876. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  52877. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  52878. // #5992
  52879. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  52880. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  52881. function decodeAttr (value, shouldDecodeNewlines) {
  52882. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  52883. return value.replace(re, function (match) { return decodingMap[match]; })
  52884. }
  52885. function parseHTML (html, options) {
  52886. var stack = [];
  52887. var expectHTML = options.expectHTML;
  52888. var isUnaryTag$$1 = options.isUnaryTag || no;
  52889. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  52890. var index = 0;
  52891. var last, lastTag;
  52892. while (html) {
  52893. last = html;
  52894. // Make sure we're not in a plaintext content element like script/style
  52895. if (!lastTag || !isPlainTextElement(lastTag)) {
  52896. var textEnd = html.indexOf('<');
  52897. if (textEnd === 0) {
  52898. // Comment:
  52899. if (comment.test(html)) {
  52900. var commentEnd = html.indexOf('-->');
  52901. if (commentEnd >= 0) {
  52902. if (options.shouldKeepComment) {
  52903. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  52904. }
  52905. advance(commentEnd + 3);
  52906. continue
  52907. }
  52908. }
  52909. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  52910. if (conditionalComment.test(html)) {
  52911. var conditionalEnd = html.indexOf(']>');
  52912. if (conditionalEnd >= 0) {
  52913. advance(conditionalEnd + 2);
  52914. continue
  52915. }
  52916. }
  52917. // Doctype:
  52918. var doctypeMatch = html.match(doctype);
  52919. if (doctypeMatch) {
  52920. advance(doctypeMatch[0].length);
  52921. continue
  52922. }
  52923. // End tag:
  52924. var endTagMatch = html.match(endTag);
  52925. if (endTagMatch) {
  52926. var curIndex = index;
  52927. advance(endTagMatch[0].length);
  52928. parseEndTag(endTagMatch[1], curIndex, index);
  52929. continue
  52930. }
  52931. // Start tag:
  52932. var startTagMatch = parseStartTag();
  52933. if (startTagMatch) {
  52934. handleStartTag(startTagMatch);
  52935. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  52936. advance(1);
  52937. }
  52938. continue
  52939. }
  52940. }
  52941. var text = (void 0), rest = (void 0), next = (void 0);
  52942. if (textEnd >= 0) {
  52943. rest = html.slice(textEnd);
  52944. while (
  52945. !endTag.test(rest) &&
  52946. !startTagOpen.test(rest) &&
  52947. !comment.test(rest) &&
  52948. !conditionalComment.test(rest)
  52949. ) {
  52950. // < in plain text, be forgiving and treat it as text
  52951. next = rest.indexOf('<', 1);
  52952. if (next < 0) { break }
  52953. textEnd += next;
  52954. rest = html.slice(textEnd);
  52955. }
  52956. text = html.substring(0, textEnd);
  52957. }
  52958. if (textEnd < 0) {
  52959. text = html;
  52960. }
  52961. if (text) {
  52962. advance(text.length);
  52963. }
  52964. if (options.chars && text) {
  52965. options.chars(text, index - text.length, index);
  52966. }
  52967. } else {
  52968. var endTagLength = 0;
  52969. var stackedTag = lastTag.toLowerCase();
  52970. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  52971. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  52972. endTagLength = endTag.length;
  52973. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  52974. text = text
  52975. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  52976. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  52977. }
  52978. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  52979. text = text.slice(1);
  52980. }
  52981. if (options.chars) {
  52982. options.chars(text);
  52983. }
  52984. return ''
  52985. });
  52986. index += html.length - rest$1.length;
  52987. html = rest$1;
  52988. parseEndTag(stackedTag, index - endTagLength, index);
  52989. }
  52990. if (html === last) {
  52991. options.chars && options.chars(html);
  52992. if (!stack.length && options.warn) {
  52993. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  52994. }
  52995. break
  52996. }
  52997. }
  52998. // Clean up any remaining tags
  52999. parseEndTag();
  53000. function advance (n) {
  53001. index += n;
  53002. html = html.substring(n);
  53003. }
  53004. function parseStartTag () {
  53005. var start = html.match(startTagOpen);
  53006. if (start) {
  53007. var match = {
  53008. tagName: start[1],
  53009. attrs: [],
  53010. start: index
  53011. };
  53012. advance(start[0].length);
  53013. var end, attr;
  53014. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  53015. attr.start = index;
  53016. advance(attr[0].length);
  53017. attr.end = index;
  53018. match.attrs.push(attr);
  53019. }
  53020. if (end) {
  53021. match.unarySlash = end[1];
  53022. advance(end[0].length);
  53023. match.end = index;
  53024. return match
  53025. }
  53026. }
  53027. }
  53028. function handleStartTag (match) {
  53029. var tagName = match.tagName;
  53030. var unarySlash = match.unarySlash;
  53031. if (expectHTML) {
  53032. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  53033. parseEndTag(lastTag);
  53034. }
  53035. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  53036. parseEndTag(tagName);
  53037. }
  53038. }
  53039. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  53040. var l = match.attrs.length;
  53041. var attrs = new Array(l);
  53042. for (var i = 0; i < l; i++) {
  53043. var args = match.attrs[i];
  53044. var value = args[3] || args[4] || args[5] || '';
  53045. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  53046. ? options.shouldDecodeNewlinesForHref
  53047. : options.shouldDecodeNewlines;
  53048. attrs[i] = {
  53049. name: args[1],
  53050. value: decodeAttr(value, shouldDecodeNewlines)
  53051. };
  53052. if (options.outputSourceRange) {
  53053. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  53054. attrs[i].end = args.end;
  53055. }
  53056. }
  53057. if (!unary) {
  53058. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  53059. lastTag = tagName;
  53060. }
  53061. if (options.start) {
  53062. options.start(tagName, attrs, unary, match.start, match.end);
  53063. }
  53064. }
  53065. function parseEndTag (tagName, start, end) {
  53066. var pos, lowerCasedTagName;
  53067. if (start == null) { start = index; }
  53068. if (end == null) { end = index; }
  53069. // Find the closest opened tag of the same type
  53070. if (tagName) {
  53071. lowerCasedTagName = tagName.toLowerCase();
  53072. for (pos = stack.length - 1; pos >= 0; pos--) {
  53073. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  53074. break
  53075. }
  53076. }
  53077. } else {
  53078. // If no tag name is provided, clean shop
  53079. pos = 0;
  53080. }
  53081. if (pos >= 0) {
  53082. // Close all the open elements, up the stack
  53083. for (var i = stack.length - 1; i >= pos; i--) {
  53084. if (i > pos || !tagName &&
  53085. options.warn
  53086. ) {
  53087. options.warn(
  53088. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  53089. { start: stack[i].start, end: stack[i].end }
  53090. );
  53091. }
  53092. if (options.end) {
  53093. options.end(stack[i].tag, start, end);
  53094. }
  53095. }
  53096. // Remove the open elements from the stack
  53097. stack.length = pos;
  53098. lastTag = pos && stack[pos - 1].tag;
  53099. } else if (lowerCasedTagName === 'br') {
  53100. if (options.start) {
  53101. options.start(tagName, [], true, start, end);
  53102. }
  53103. } else if (lowerCasedTagName === 'p') {
  53104. if (options.start) {
  53105. options.start(tagName, [], false, start, end);
  53106. }
  53107. if (options.end) {
  53108. options.end(tagName, start, end);
  53109. }
  53110. }
  53111. }
  53112. }
  53113. /* */
  53114. var onRE = /^@|^v-on:/;
  53115. var dirRE = /^v-|^@|^:|^#/;
  53116. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  53117. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  53118. var stripParensRE = /^\(|\)$/g;
  53119. var dynamicArgRE = /^\[.*\]$/;
  53120. var argRE = /:(.*)$/;
  53121. var bindRE = /^:|^\.|^v-bind:/;
  53122. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  53123. var slotRE = /^v-slot(:|$)|^#/;
  53124. var lineBreakRE = /[\r\n]/;
  53125. var whitespaceRE$1 = /\s+/g;
  53126. var invalidAttributeRE = /[\s"'<>\/=]/;
  53127. var decodeHTMLCached = cached(he.decode);
  53128. var emptySlotScopeToken = "_empty_";
  53129. // configurable state
  53130. var warn$2;
  53131. var delimiters;
  53132. var transforms;
  53133. var preTransforms;
  53134. var postTransforms;
  53135. var platformIsPreTag;
  53136. var platformMustUseProp;
  53137. var platformGetTagNamespace;
  53138. var maybeComponent;
  53139. function createASTElement (
  53140. tag,
  53141. attrs,
  53142. parent
  53143. ) {
  53144. return {
  53145. type: 1,
  53146. tag: tag,
  53147. attrsList: attrs,
  53148. attrsMap: makeAttrsMap(attrs),
  53149. rawAttrsMap: {},
  53150. parent: parent,
  53151. children: []
  53152. }
  53153. }
  53154. /**
  53155. * Convert HTML string to AST.
  53156. */
  53157. function parse (
  53158. template,
  53159. options
  53160. ) {
  53161. warn$2 = options.warn || baseWarn;
  53162. platformIsPreTag = options.isPreTag || no;
  53163. platformMustUseProp = options.mustUseProp || no;
  53164. platformGetTagNamespace = options.getTagNamespace || no;
  53165. var isReservedTag = options.isReservedTag || no;
  53166. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53167. transforms = pluckModuleFunction(options.modules, 'transformNode');
  53168. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  53169. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  53170. delimiters = options.delimiters;
  53171. var stack = [];
  53172. var preserveWhitespace = options.preserveWhitespace !== false;
  53173. var whitespaceOption = options.whitespace;
  53174. var root;
  53175. var currentParent;
  53176. var inVPre = false;
  53177. var inPre = false;
  53178. var warned = false;
  53179. function warnOnce (msg, range) {
  53180. if (!warned) {
  53181. warned = true;
  53182. warn$2(msg, range);
  53183. }
  53184. }
  53185. function closeElement (element) {
  53186. trimEndingWhitespace(element);
  53187. if (!inVPre && !element.processed) {
  53188. element = processElement(element, options);
  53189. }
  53190. // tree management
  53191. if (!stack.length && element !== root) {
  53192. // allow root elements with v-if, v-else-if and v-else
  53193. if (root.if && (element.elseif || element.else)) {
  53194. {
  53195. checkRootConstraints(element);
  53196. }
  53197. addIfCondition(root, {
  53198. exp: element.elseif,
  53199. block: element
  53200. });
  53201. } else {
  53202. warnOnce(
  53203. "Component template should contain exactly one root element. " +
  53204. "If you are using v-if on multiple elements, " +
  53205. "use v-else-if to chain them instead.",
  53206. { start: element.start }
  53207. );
  53208. }
  53209. }
  53210. if (currentParent && !element.forbidden) {
  53211. if (element.elseif || element.else) {
  53212. processIfConditions(element, currentParent);
  53213. } else {
  53214. if (element.slotScope) {
  53215. // scoped slot
  53216. // keep it in the children list so that v-else(-if) conditions can
  53217. // find it as the prev node.
  53218. var name = element.slotTarget || '"default"'
  53219. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  53220. }
  53221. currentParent.children.push(element);
  53222. element.parent = currentParent;
  53223. }
  53224. }
  53225. // final children cleanup
  53226. // filter out scoped slots
  53227. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  53228. // remove trailing whitespace node again
  53229. trimEndingWhitespace(element);
  53230. // check pre state
  53231. if (element.pre) {
  53232. inVPre = false;
  53233. }
  53234. if (platformIsPreTag(element.tag)) {
  53235. inPre = false;
  53236. }
  53237. // apply post-transforms
  53238. for (var i = 0; i < postTransforms.length; i++) {
  53239. postTransforms[i](element, options);
  53240. }
  53241. }
  53242. function trimEndingWhitespace (el) {
  53243. // remove trailing whitespace node
  53244. if (!inPre) {
  53245. var lastNode;
  53246. while (
  53247. (lastNode = el.children[el.children.length - 1]) &&
  53248. lastNode.type === 3 &&
  53249. lastNode.text === ' '
  53250. ) {
  53251. el.children.pop();
  53252. }
  53253. }
  53254. }
  53255. function checkRootConstraints (el) {
  53256. if (el.tag === 'slot' || el.tag === 'template') {
  53257. warnOnce(
  53258. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  53259. 'contain multiple nodes.',
  53260. { start: el.start }
  53261. );
  53262. }
  53263. if (el.attrsMap.hasOwnProperty('v-for')) {
  53264. warnOnce(
  53265. 'Cannot use v-for on stateful component root element because ' +
  53266. 'it renders multiple elements.',
  53267. el.rawAttrsMap['v-for']
  53268. );
  53269. }
  53270. }
  53271. parseHTML(template, {
  53272. warn: warn$2,
  53273. expectHTML: options.expectHTML,
  53274. isUnaryTag: options.isUnaryTag,
  53275. canBeLeftOpenTag: options.canBeLeftOpenTag,
  53276. shouldDecodeNewlines: options.shouldDecodeNewlines,
  53277. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  53278. shouldKeepComment: options.comments,
  53279. outputSourceRange: options.outputSourceRange,
  53280. start: function start (tag, attrs, unary, start$1, end) {
  53281. // check namespace.
  53282. // inherit parent ns if there is one
  53283. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  53284. // handle IE svg bug
  53285. /* istanbul ignore if */
  53286. if (isIE && ns === 'svg') {
  53287. attrs = guardIESVGBug(attrs);
  53288. }
  53289. var element = createASTElement(tag, attrs, currentParent);
  53290. if (ns) {
  53291. element.ns = ns;
  53292. }
  53293. {
  53294. if (options.outputSourceRange) {
  53295. element.start = start$1;
  53296. element.end = end;
  53297. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  53298. cumulated[attr.name] = attr;
  53299. return cumulated
  53300. }, {});
  53301. }
  53302. attrs.forEach(function (attr) {
  53303. if (invalidAttributeRE.test(attr.name)) {
  53304. warn$2(
  53305. "Invalid dynamic argument expression: attribute names cannot contain " +
  53306. "spaces, quotes, <, >, / or =.",
  53307. {
  53308. start: attr.start + attr.name.indexOf("["),
  53309. end: attr.start + attr.name.length
  53310. }
  53311. );
  53312. }
  53313. });
  53314. }
  53315. if (isForbiddenTag(element) && !isServerRendering()) {
  53316. element.forbidden = true;
  53317. warn$2(
  53318. 'Templates should only be responsible for mapping the state to the ' +
  53319. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  53320. "<" + tag + ">" + ', as they will not be parsed.',
  53321. { start: element.start }
  53322. );
  53323. }
  53324. // apply pre-transforms
  53325. for (var i = 0; i < preTransforms.length; i++) {
  53326. element = preTransforms[i](element, options) || element;
  53327. }
  53328. if (!inVPre) {
  53329. processPre(element);
  53330. if (element.pre) {
  53331. inVPre = true;
  53332. }
  53333. }
  53334. if (platformIsPreTag(element.tag)) {
  53335. inPre = true;
  53336. }
  53337. if (inVPre) {
  53338. processRawAttrs(element);
  53339. } else if (!element.processed) {
  53340. // structural directives
  53341. processFor(element);
  53342. processIf(element);
  53343. processOnce(element);
  53344. }
  53345. if (!root) {
  53346. root = element;
  53347. {
  53348. checkRootConstraints(root);
  53349. }
  53350. }
  53351. if (!unary) {
  53352. currentParent = element;
  53353. stack.push(element);
  53354. } else {
  53355. closeElement(element);
  53356. }
  53357. },
  53358. end: function end (tag, start, end$1) {
  53359. var element = stack[stack.length - 1];
  53360. // pop stack
  53361. stack.length -= 1;
  53362. currentParent = stack[stack.length - 1];
  53363. if (options.outputSourceRange) {
  53364. element.end = end$1;
  53365. }
  53366. closeElement(element);
  53367. },
  53368. chars: function chars (text, start, end) {
  53369. if (!currentParent) {
  53370. {
  53371. if (text === template) {
  53372. warnOnce(
  53373. 'Component template requires a root element, rather than just text.',
  53374. { start: start }
  53375. );
  53376. } else if ((text = text.trim())) {
  53377. warnOnce(
  53378. ("text \"" + text + "\" outside root element will be ignored."),
  53379. { start: start }
  53380. );
  53381. }
  53382. }
  53383. return
  53384. }
  53385. // IE textarea placeholder bug
  53386. /* istanbul ignore if */
  53387. if (isIE &&
  53388. currentParent.tag === 'textarea' &&
  53389. currentParent.attrsMap.placeholder === text
  53390. ) {
  53391. return
  53392. }
  53393. var children = currentParent.children;
  53394. if (inPre || text.trim()) {
  53395. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  53396. } else if (!children.length) {
  53397. // remove the whitespace-only node right after an opening tag
  53398. text = '';
  53399. } else if (whitespaceOption) {
  53400. if (whitespaceOption === 'condense') {
  53401. // in condense mode, remove the whitespace node if it contains
  53402. // line break, otherwise condense to a single space
  53403. text = lineBreakRE.test(text) ? '' : ' ';
  53404. } else {
  53405. text = ' ';
  53406. }
  53407. } else {
  53408. text = preserveWhitespace ? ' ' : '';
  53409. }
  53410. if (text) {
  53411. if (!inPre && whitespaceOption === 'condense') {
  53412. // condense consecutive whitespaces into single space
  53413. text = text.replace(whitespaceRE$1, ' ');
  53414. }
  53415. var res;
  53416. var child;
  53417. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  53418. child = {
  53419. type: 2,
  53420. expression: res.expression,
  53421. tokens: res.tokens,
  53422. text: text
  53423. };
  53424. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  53425. child = {
  53426. type: 3,
  53427. text: text
  53428. };
  53429. }
  53430. if (child) {
  53431. if (options.outputSourceRange) {
  53432. child.start = start;
  53433. child.end = end;
  53434. }
  53435. children.push(child);
  53436. }
  53437. }
  53438. },
  53439. comment: function comment (text, start, end) {
  53440. // adding anyting as a sibling to the root node is forbidden
  53441. // comments should still be allowed, but ignored
  53442. if (currentParent) {
  53443. var child = {
  53444. type: 3,
  53445. text: text,
  53446. isComment: true
  53447. };
  53448. if (options.outputSourceRange) {
  53449. child.start = start;
  53450. child.end = end;
  53451. }
  53452. currentParent.children.push(child);
  53453. }
  53454. }
  53455. });
  53456. return root
  53457. }
  53458. function processPre (el) {
  53459. if (getAndRemoveAttr(el, 'v-pre') != null) {
  53460. el.pre = true;
  53461. }
  53462. }
  53463. function processRawAttrs (el) {
  53464. var list = el.attrsList;
  53465. var len = list.length;
  53466. if (len) {
  53467. var attrs = el.attrs = new Array(len);
  53468. for (var i = 0; i < len; i++) {
  53469. attrs[i] = {
  53470. name: list[i].name,
  53471. value: JSON.stringify(list[i].value)
  53472. };
  53473. if (list[i].start != null) {
  53474. attrs[i].start = list[i].start;
  53475. attrs[i].end = list[i].end;
  53476. }
  53477. }
  53478. } else if (!el.pre) {
  53479. // non root node in pre blocks with no attributes
  53480. el.plain = true;
  53481. }
  53482. }
  53483. function processElement (
  53484. element,
  53485. options
  53486. ) {
  53487. processKey(element);
  53488. // determine whether this is a plain element after
  53489. // removing structural attributes
  53490. element.plain = (
  53491. !element.key &&
  53492. !element.scopedSlots &&
  53493. !element.attrsList.length
  53494. );
  53495. processRef(element);
  53496. processSlotContent(element);
  53497. processSlotOutlet(element);
  53498. processComponent(element);
  53499. for (var i = 0; i < transforms.length; i++) {
  53500. element = transforms[i](element, options) || element;
  53501. }
  53502. processAttrs(element);
  53503. return element
  53504. }
  53505. function processKey (el) {
  53506. var exp = getBindingAttr(el, 'key');
  53507. if (exp) {
  53508. {
  53509. if (el.tag === 'template') {
  53510. warn$2(
  53511. "<template> cannot be keyed. Place the key on real elements instead.",
  53512. getRawBindingAttr(el, 'key')
  53513. );
  53514. }
  53515. if (el.for) {
  53516. var iterator = el.iterator2 || el.iterator1;
  53517. var parent = el.parent;
  53518. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53519. warn$2(
  53520. "Do not use v-for index as key on <transition-group> children, " +
  53521. "this is the same as not using keys.",
  53522. getRawBindingAttr(el, 'key'),
  53523. true /* tip */
  53524. );
  53525. }
  53526. }
  53527. }
  53528. el.key = exp;
  53529. }
  53530. }
  53531. function processRef (el) {
  53532. var ref = getBindingAttr(el, 'ref');
  53533. if (ref) {
  53534. el.ref = ref;
  53535. el.refInFor = checkInFor(el);
  53536. }
  53537. }
  53538. function processFor (el) {
  53539. var exp;
  53540. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53541. var res = parseFor(exp);
  53542. if (res) {
  53543. extend(el, res);
  53544. } else {
  53545. warn$2(
  53546. ("Invalid v-for expression: " + exp),
  53547. el.rawAttrsMap['v-for']
  53548. );
  53549. }
  53550. }
  53551. }
  53552. function parseFor (exp) {
  53553. var inMatch = exp.match(forAliasRE);
  53554. if (!inMatch) { return }
  53555. var res = {};
  53556. res.for = inMatch[2].trim();
  53557. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53558. var iteratorMatch = alias.match(forIteratorRE);
  53559. if (iteratorMatch) {
  53560. res.alias = alias.replace(forIteratorRE, '').trim();
  53561. res.iterator1 = iteratorMatch[1].trim();
  53562. if (iteratorMatch[2]) {
  53563. res.iterator2 = iteratorMatch[2].trim();
  53564. }
  53565. } else {
  53566. res.alias = alias;
  53567. }
  53568. return res
  53569. }
  53570. function processIf (el) {
  53571. var exp = getAndRemoveAttr(el, 'v-if');
  53572. if (exp) {
  53573. el.if = exp;
  53574. addIfCondition(el, {
  53575. exp: exp,
  53576. block: el
  53577. });
  53578. } else {
  53579. if (getAndRemoveAttr(el, 'v-else') != null) {
  53580. el.else = true;
  53581. }
  53582. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53583. if (elseif) {
  53584. el.elseif = elseif;
  53585. }
  53586. }
  53587. }
  53588. function processIfConditions (el, parent) {
  53589. var prev = findPrevElement(parent.children);
  53590. if (prev && prev.if) {
  53591. addIfCondition(prev, {
  53592. exp: el.elseif,
  53593. block: el
  53594. });
  53595. } else {
  53596. warn$2(
  53597. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53598. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53599. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53600. );
  53601. }
  53602. }
  53603. function findPrevElement (children) {
  53604. var i = children.length;
  53605. while (i--) {
  53606. if (children[i].type === 1) {
  53607. return children[i]
  53608. } else {
  53609. if (children[i].text !== ' ') {
  53610. warn$2(
  53611. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53612. "will be ignored.",
  53613. children[i]
  53614. );
  53615. }
  53616. children.pop();
  53617. }
  53618. }
  53619. }
  53620. function addIfCondition (el, condition) {
  53621. if (!el.ifConditions) {
  53622. el.ifConditions = [];
  53623. }
  53624. el.ifConditions.push(condition);
  53625. }
  53626. function processOnce (el) {
  53627. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53628. if (once$$1 != null) {
  53629. el.once = true;
  53630. }
  53631. }
  53632. // handle content being passed to a component as slot,
  53633. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53634. function processSlotContent (el) {
  53635. var slotScope;
  53636. if (el.tag === 'template') {
  53637. slotScope = getAndRemoveAttr(el, 'scope');
  53638. /* istanbul ignore if */
  53639. if (slotScope) {
  53640. warn$2(
  53641. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53642. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53643. "can also be used on plain elements in addition to <template> to " +
  53644. "denote scoped slots.",
  53645. el.rawAttrsMap['scope'],
  53646. true
  53647. );
  53648. }
  53649. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53650. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53651. /* istanbul ignore if */
  53652. if (el.attrsMap['v-for']) {
  53653. warn$2(
  53654. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53655. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53656. "scoped slot to make it clearer.",
  53657. el.rawAttrsMap['slot-scope'],
  53658. true
  53659. );
  53660. }
  53661. el.slotScope = slotScope;
  53662. }
  53663. // slot="xxx"
  53664. var slotTarget = getBindingAttr(el, 'slot');
  53665. if (slotTarget) {
  53666. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53667. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53668. // preserve slot as an attribute for native shadow DOM compat
  53669. // only for non-scoped slots.
  53670. if (el.tag !== 'template' && !el.slotScope) {
  53671. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53672. }
  53673. }
  53674. // 2.6 v-slot syntax
  53675. {
  53676. if (el.tag === 'template') {
  53677. // v-slot on <template>
  53678. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53679. if (slotBinding) {
  53680. {
  53681. if (el.slotTarget || el.slotScope) {
  53682. warn$2(
  53683. "Unexpected mixed usage of different slot syntaxes.",
  53684. el
  53685. );
  53686. }
  53687. if (el.parent && !maybeComponent(el.parent)) {
  53688. warn$2(
  53689. "<template v-slot> can only appear at the root level inside " +
  53690. "the receiving component",
  53691. el
  53692. );
  53693. }
  53694. }
  53695. var ref = getSlotName(slotBinding);
  53696. var name = ref.name;
  53697. var dynamic = ref.dynamic;
  53698. el.slotTarget = name;
  53699. el.slotTargetDynamic = dynamic;
  53700. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53701. }
  53702. } else {
  53703. // v-slot on component, denotes default slot
  53704. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53705. if (slotBinding$1) {
  53706. {
  53707. if (!maybeComponent(el)) {
  53708. warn$2(
  53709. "v-slot can only be used on components or <template>.",
  53710. slotBinding$1
  53711. );
  53712. }
  53713. if (el.slotScope || el.slotTarget) {
  53714. warn$2(
  53715. "Unexpected mixed usage of different slot syntaxes.",
  53716. el
  53717. );
  53718. }
  53719. if (el.scopedSlots) {
  53720. warn$2(
  53721. "To avoid scope ambiguity, the default slot should also use " +
  53722. "<template> syntax when there are other named slots.",
  53723. slotBinding$1
  53724. );
  53725. }
  53726. }
  53727. // add the component's children to its default slot
  53728. var slots = el.scopedSlots || (el.scopedSlots = {});
  53729. var ref$1 = getSlotName(slotBinding$1);
  53730. var name$1 = ref$1.name;
  53731. var dynamic$1 = ref$1.dynamic;
  53732. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53733. slotContainer.slotTarget = name$1;
  53734. slotContainer.slotTargetDynamic = dynamic$1;
  53735. slotContainer.children = el.children.filter(function (c) {
  53736. if (!c.slotScope) {
  53737. c.parent = slotContainer;
  53738. return true
  53739. }
  53740. });
  53741. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53742. // remove children as they are returned from scopedSlots now
  53743. el.children = [];
  53744. // mark el non-plain so data gets generated
  53745. el.plain = false;
  53746. }
  53747. }
  53748. }
  53749. }
  53750. function getSlotName (binding) {
  53751. var name = binding.name.replace(slotRE, '');
  53752. if (!name) {
  53753. if (binding.name[0] !== '#') {
  53754. name = 'default';
  53755. } else {
  53756. warn$2(
  53757. "v-slot shorthand syntax requires a slot name.",
  53758. binding
  53759. );
  53760. }
  53761. }
  53762. return dynamicArgRE.test(name)
  53763. // dynamic [name]
  53764. ? { name: name.slice(1, -1), dynamic: true }
  53765. // static name
  53766. : { name: ("\"" + name + "\""), dynamic: false }
  53767. }
  53768. // handle <slot/> outlets
  53769. function processSlotOutlet (el) {
  53770. if (el.tag === 'slot') {
  53771. el.slotName = getBindingAttr(el, 'name');
  53772. if (el.key) {
  53773. warn$2(
  53774. "`key` does not work on <slot> because slots are abstract outlets " +
  53775. "and can possibly expand into multiple elements. " +
  53776. "Use the key on a wrapping element instead.",
  53777. getRawBindingAttr(el, 'key')
  53778. );
  53779. }
  53780. }
  53781. }
  53782. function processComponent (el) {
  53783. var binding;
  53784. if ((binding = getBindingAttr(el, 'is'))) {
  53785. el.component = binding;
  53786. }
  53787. if (getAndRemoveAttr(el, 'inline-template') != null) {
  53788. el.inlineTemplate = true;
  53789. }
  53790. }
  53791. function processAttrs (el) {
  53792. var list = el.attrsList;
  53793. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  53794. for (i = 0, l = list.length; i < l; i++) {
  53795. name = rawName = list[i].name;
  53796. value = list[i].value;
  53797. if (dirRE.test(name)) {
  53798. // mark element as dynamic
  53799. el.hasBindings = true;
  53800. // modifiers
  53801. modifiers = parseModifiers(name.replace(dirRE, ''));
  53802. // support .foo shorthand syntax for the .prop modifier
  53803. if (modifiers) {
  53804. name = name.replace(modifierRE, '');
  53805. }
  53806. if (bindRE.test(name)) { // v-bind
  53807. name = name.replace(bindRE, '');
  53808. value = parseFilters(value);
  53809. isDynamic = dynamicArgRE.test(name);
  53810. if (isDynamic) {
  53811. name = name.slice(1, -1);
  53812. }
  53813. if (
  53814. value.trim().length === 0
  53815. ) {
  53816. warn$2(
  53817. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  53818. );
  53819. }
  53820. if (modifiers) {
  53821. if (modifiers.prop && !isDynamic) {
  53822. name = camelize(name);
  53823. if (name === 'innerHtml') { name = 'innerHTML'; }
  53824. }
  53825. if (modifiers.camel && !isDynamic) {
  53826. name = camelize(name);
  53827. }
  53828. if (modifiers.sync) {
  53829. syncGen = genAssignmentCode(value, "$event");
  53830. if (!isDynamic) {
  53831. addHandler(
  53832. el,
  53833. ("update:" + (camelize(name))),
  53834. syncGen,
  53835. null,
  53836. false,
  53837. warn$2,
  53838. list[i]
  53839. );
  53840. if (hyphenate(name) !== camelize(name)) {
  53841. addHandler(
  53842. el,
  53843. ("update:" + (hyphenate(name))),
  53844. syncGen,
  53845. null,
  53846. false,
  53847. warn$2,
  53848. list[i]
  53849. );
  53850. }
  53851. } else {
  53852. // handler w/ dynamic event name
  53853. addHandler(
  53854. el,
  53855. ("\"update:\"+(" + name + ")"),
  53856. syncGen,
  53857. null,
  53858. false,
  53859. warn$2,
  53860. list[i],
  53861. true // dynamic
  53862. );
  53863. }
  53864. }
  53865. }
  53866. if ((modifiers && modifiers.prop) || (
  53867. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  53868. )) {
  53869. addProp(el, name, value, list[i], isDynamic);
  53870. } else {
  53871. addAttr(el, name, value, list[i], isDynamic);
  53872. }
  53873. } else if (onRE.test(name)) { // v-on
  53874. name = name.replace(onRE, '');
  53875. isDynamic = dynamicArgRE.test(name);
  53876. if (isDynamic) {
  53877. name = name.slice(1, -1);
  53878. }
  53879. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  53880. } else { // normal directives
  53881. name = name.replace(dirRE, '');
  53882. // parse arg
  53883. var argMatch = name.match(argRE);
  53884. var arg = argMatch && argMatch[1];
  53885. isDynamic = false;
  53886. if (arg) {
  53887. name = name.slice(0, -(arg.length + 1));
  53888. if (dynamicArgRE.test(arg)) {
  53889. arg = arg.slice(1, -1);
  53890. isDynamic = true;
  53891. }
  53892. }
  53893. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  53894. if (name === 'model') {
  53895. checkForAliasModel(el, value);
  53896. }
  53897. }
  53898. } else {
  53899. // literal attribute
  53900. {
  53901. var res = parseText(value, delimiters);
  53902. if (res) {
  53903. warn$2(
  53904. name + "=\"" + value + "\": " +
  53905. 'Interpolation inside attributes has been removed. ' +
  53906. 'Use v-bind or the colon shorthand instead. For example, ' +
  53907. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  53908. list[i]
  53909. );
  53910. }
  53911. }
  53912. addAttr(el, name, JSON.stringify(value), list[i]);
  53913. // #6887 firefox doesn't update muted state if set via attribute
  53914. // even immediately after element creation
  53915. if (!el.component &&
  53916. name === 'muted' &&
  53917. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  53918. addProp(el, name, 'true', list[i]);
  53919. }
  53920. }
  53921. }
  53922. }
  53923. function checkInFor (el) {
  53924. var parent = el;
  53925. while (parent) {
  53926. if (parent.for !== undefined) {
  53927. return true
  53928. }
  53929. parent = parent.parent;
  53930. }
  53931. return false
  53932. }
  53933. function parseModifiers (name) {
  53934. var match = name.match(modifierRE);
  53935. if (match) {
  53936. var ret = {};
  53937. match.forEach(function (m) { ret[m.slice(1)] = true; });
  53938. return ret
  53939. }
  53940. }
  53941. function makeAttrsMap (attrs) {
  53942. var map = {};
  53943. for (var i = 0, l = attrs.length; i < l; i++) {
  53944. if (
  53945. map[attrs[i].name] && !isIE && !isEdge
  53946. ) {
  53947. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  53948. }
  53949. map[attrs[i].name] = attrs[i].value;
  53950. }
  53951. return map
  53952. }
  53953. // for script (e.g. type="x/template") or style, do not decode content
  53954. function isTextTag (el) {
  53955. return el.tag === 'script' || el.tag === 'style'
  53956. }
  53957. function isForbiddenTag (el) {
  53958. return (
  53959. el.tag === 'style' ||
  53960. (el.tag === 'script' && (
  53961. !el.attrsMap.type ||
  53962. el.attrsMap.type === 'text/javascript'
  53963. ))
  53964. )
  53965. }
  53966. var ieNSBug = /^xmlns:NS\d+/;
  53967. var ieNSPrefix = /^NS\d+:/;
  53968. /* istanbul ignore next */
  53969. function guardIESVGBug (attrs) {
  53970. var res = [];
  53971. for (var i = 0; i < attrs.length; i++) {
  53972. var attr = attrs[i];
  53973. if (!ieNSBug.test(attr.name)) {
  53974. attr.name = attr.name.replace(ieNSPrefix, '');
  53975. res.push(attr);
  53976. }
  53977. }
  53978. return res
  53979. }
  53980. function checkForAliasModel (el, value) {
  53981. var _el = el;
  53982. while (_el) {
  53983. if (_el.for && _el.alias === value) {
  53984. warn$2(
  53985. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  53986. "You are binding v-model directly to a v-for iteration alias. " +
  53987. "This will not be able to modify the v-for source array because " +
  53988. "writing to the alias is like modifying a function local variable. " +
  53989. "Consider using an array of objects and use v-model on an object property instead.",
  53990. el.rawAttrsMap['v-model']
  53991. );
  53992. }
  53993. _el = _el.parent;
  53994. }
  53995. }
  53996. /* */
  53997. function preTransformNode (el, options) {
  53998. if (el.tag === 'input') {
  53999. var map = el.attrsMap;
  54000. if (!map['v-model']) {
  54001. return
  54002. }
  54003. var typeBinding;
  54004. if (map[':type'] || map['v-bind:type']) {
  54005. typeBinding = getBindingAttr(el, 'type');
  54006. }
  54007. if (!map.type && !typeBinding && map['v-bind']) {
  54008. typeBinding = "(" + (map['v-bind']) + ").type";
  54009. }
  54010. if (typeBinding) {
  54011. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  54012. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  54013. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  54014. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  54015. // 1. checkbox
  54016. var branch0 = cloneASTElement(el);
  54017. // process for on the main node
  54018. processFor(branch0);
  54019. addRawAttr(branch0, 'type', 'checkbox');
  54020. processElement(branch0, options);
  54021. branch0.processed = true; // prevent it from double-processed
  54022. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  54023. addIfCondition(branch0, {
  54024. exp: branch0.if,
  54025. block: branch0
  54026. });
  54027. // 2. add radio else-if condition
  54028. var branch1 = cloneASTElement(el);
  54029. getAndRemoveAttr(branch1, 'v-for', true);
  54030. addRawAttr(branch1, 'type', 'radio');
  54031. processElement(branch1, options);
  54032. addIfCondition(branch0, {
  54033. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  54034. block: branch1
  54035. });
  54036. // 3. other
  54037. var branch2 = cloneASTElement(el);
  54038. getAndRemoveAttr(branch2, 'v-for', true);
  54039. addRawAttr(branch2, ':type', typeBinding);
  54040. processElement(branch2, options);
  54041. addIfCondition(branch0, {
  54042. exp: ifCondition,
  54043. block: branch2
  54044. });
  54045. if (hasElse) {
  54046. branch0.else = true;
  54047. } else if (elseIfCondition) {
  54048. branch0.elseif = elseIfCondition;
  54049. }
  54050. return branch0
  54051. }
  54052. }
  54053. }
  54054. function cloneASTElement (el) {
  54055. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  54056. }
  54057. var model$1 = {
  54058. preTransformNode: preTransformNode
  54059. };
  54060. var modules$1 = [
  54061. klass$1,
  54062. style$1,
  54063. model$1
  54064. ];
  54065. /* */
  54066. function text (el, dir) {
  54067. if (dir.value) {
  54068. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  54069. }
  54070. }
  54071. /* */
  54072. function html (el, dir) {
  54073. if (dir.value) {
  54074. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  54075. }
  54076. }
  54077. var directives$1 = {
  54078. model: model,
  54079. text: text,
  54080. html: html
  54081. };
  54082. /* */
  54083. var baseOptions = {
  54084. expectHTML: true,
  54085. modules: modules$1,
  54086. directives: directives$1,
  54087. isPreTag: isPreTag,
  54088. isUnaryTag: isUnaryTag,
  54089. mustUseProp: mustUseProp,
  54090. canBeLeftOpenTag: canBeLeftOpenTag,
  54091. isReservedTag: isReservedTag,
  54092. getTagNamespace: getTagNamespace,
  54093. staticKeys: genStaticKeys(modules$1)
  54094. };
  54095. /* */
  54096. var isStaticKey;
  54097. var isPlatformReservedTag;
  54098. var genStaticKeysCached = cached(genStaticKeys$1);
  54099. /**
  54100. * Goal of the optimizer: walk the generated template AST tree
  54101. * and detect sub-trees that are purely static, i.e. parts of
  54102. * the DOM that never needs to change.
  54103. *
  54104. * Once we detect these sub-trees, we can:
  54105. *
  54106. * 1. Hoist them into constants, so that we no longer need to
  54107. * create fresh nodes for them on each re-render;
  54108. * 2. Completely skip them in the patching process.
  54109. */
  54110. function optimize (root, options) {
  54111. if (!root) { return }
  54112. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  54113. isPlatformReservedTag = options.isReservedTag || no;
  54114. // first pass: mark all non-static nodes.
  54115. markStatic$1(root);
  54116. // second pass: mark static roots.
  54117. markStaticRoots(root, false);
  54118. }
  54119. function genStaticKeys$1 (keys) {
  54120. return makeMap(
  54121. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  54122. (keys ? ',' + keys : '')
  54123. )
  54124. }
  54125. function markStatic$1 (node) {
  54126. node.static = isStatic(node);
  54127. if (node.type === 1) {
  54128. // do not make component slot content static. this avoids
  54129. // 1. components not able to mutate slot nodes
  54130. // 2. static slot content fails for hot-reloading
  54131. if (
  54132. !isPlatformReservedTag(node.tag) &&
  54133. node.tag !== 'slot' &&
  54134. node.attrsMap['inline-template'] == null
  54135. ) {
  54136. return
  54137. }
  54138. for (var i = 0, l = node.children.length; i < l; i++) {
  54139. var child = node.children[i];
  54140. markStatic$1(child);
  54141. if (!child.static) {
  54142. node.static = false;
  54143. }
  54144. }
  54145. if (node.ifConditions) {
  54146. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54147. var block = node.ifConditions[i$1].block;
  54148. markStatic$1(block);
  54149. if (!block.static) {
  54150. node.static = false;
  54151. }
  54152. }
  54153. }
  54154. }
  54155. }
  54156. function markStaticRoots (node, isInFor) {
  54157. if (node.type === 1) {
  54158. if (node.static || node.once) {
  54159. node.staticInFor = isInFor;
  54160. }
  54161. // For a node to qualify as a static root, it should have children that
  54162. // are not just static text. Otherwise the cost of hoisting out will
  54163. // outweigh the benefits and it's better off to just always render it fresh.
  54164. if (node.static && node.children.length && !(
  54165. node.children.length === 1 &&
  54166. node.children[0].type === 3
  54167. )) {
  54168. node.staticRoot = true;
  54169. return
  54170. } else {
  54171. node.staticRoot = false;
  54172. }
  54173. if (node.children) {
  54174. for (var i = 0, l = node.children.length; i < l; i++) {
  54175. markStaticRoots(node.children[i], isInFor || !!node.for);
  54176. }
  54177. }
  54178. if (node.ifConditions) {
  54179. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54180. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  54181. }
  54182. }
  54183. }
  54184. }
  54185. function isStatic (node) {
  54186. if (node.type === 2) { // expression
  54187. return false
  54188. }
  54189. if (node.type === 3) { // text
  54190. return true
  54191. }
  54192. return !!(node.pre || (
  54193. !node.hasBindings && // no dynamic bindings
  54194. !node.if && !node.for && // not v-if or v-for or v-else
  54195. !isBuiltInTag(node.tag) && // not a built-in
  54196. isPlatformReservedTag(node.tag) && // not a component
  54197. !isDirectChildOfTemplateFor(node) &&
  54198. Object.keys(node).every(isStaticKey)
  54199. ))
  54200. }
  54201. function isDirectChildOfTemplateFor (node) {
  54202. while (node.parent) {
  54203. node = node.parent;
  54204. if (node.tag !== 'template') {
  54205. return false
  54206. }
  54207. if (node.for) {
  54208. return true
  54209. }
  54210. }
  54211. return false
  54212. }
  54213. /* */
  54214. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  54215. var fnInvokeRE = /\([^)]*?\);*$/;
  54216. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  54217. // KeyboardEvent.keyCode aliases
  54218. var keyCodes = {
  54219. esc: 27,
  54220. tab: 9,
  54221. enter: 13,
  54222. space: 32,
  54223. up: 38,
  54224. left: 37,
  54225. right: 39,
  54226. down: 40,
  54227. 'delete': [8, 46]
  54228. };
  54229. // KeyboardEvent.key aliases
  54230. var keyNames = {
  54231. // #7880: IE11 and Edge use `Esc` for Escape key name.
  54232. esc: ['Esc', 'Escape'],
  54233. tab: 'Tab',
  54234. enter: 'Enter',
  54235. // #9112: IE11 uses `Spacebar` for Space key name.
  54236. space: [' ', 'Spacebar'],
  54237. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  54238. up: ['Up', 'ArrowUp'],
  54239. left: ['Left', 'ArrowLeft'],
  54240. right: ['Right', 'ArrowRight'],
  54241. down: ['Down', 'ArrowDown'],
  54242. // #9112: IE11 uses `Del` for Delete key name.
  54243. 'delete': ['Backspace', 'Delete', 'Del']
  54244. };
  54245. // #4868: modifiers that prevent the execution of the listener
  54246. // need to explicitly return null so that we can determine whether to remove
  54247. // the listener for .once
  54248. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  54249. var modifierCode = {
  54250. stop: '$event.stopPropagation();',
  54251. prevent: '$event.preventDefault();',
  54252. self: genGuard("$event.target !== $event.currentTarget"),
  54253. ctrl: genGuard("!$event.ctrlKey"),
  54254. shift: genGuard("!$event.shiftKey"),
  54255. alt: genGuard("!$event.altKey"),
  54256. meta: genGuard("!$event.metaKey"),
  54257. left: genGuard("'button' in $event && $event.button !== 0"),
  54258. middle: genGuard("'button' in $event && $event.button !== 1"),
  54259. right: genGuard("'button' in $event && $event.button !== 2")
  54260. };
  54261. function genHandlers (
  54262. events,
  54263. isNative
  54264. ) {
  54265. var prefix = isNative ? 'nativeOn:' : 'on:';
  54266. var staticHandlers = "";
  54267. var dynamicHandlers = "";
  54268. for (var name in events) {
  54269. var handlerCode = genHandler(events[name]);
  54270. if (events[name] && events[name].dynamic) {
  54271. dynamicHandlers += name + "," + handlerCode + ",";
  54272. } else {
  54273. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  54274. }
  54275. }
  54276. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  54277. if (dynamicHandlers) {
  54278. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  54279. } else {
  54280. return prefix + staticHandlers
  54281. }
  54282. }
  54283. function genHandler (handler) {
  54284. if (!handler) {
  54285. return 'function(){}'
  54286. }
  54287. if (Array.isArray(handler)) {
  54288. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  54289. }
  54290. var isMethodPath = simplePathRE.test(handler.value);
  54291. var isFunctionExpression = fnExpRE.test(handler.value);
  54292. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  54293. if (!handler.modifiers) {
  54294. if (isMethodPath || isFunctionExpression) {
  54295. return handler.value
  54296. }
  54297. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  54298. } else {
  54299. var code = '';
  54300. var genModifierCode = '';
  54301. var keys = [];
  54302. for (var key in handler.modifiers) {
  54303. if (modifierCode[key]) {
  54304. genModifierCode += modifierCode[key];
  54305. // left/right
  54306. if (keyCodes[key]) {
  54307. keys.push(key);
  54308. }
  54309. } else if (key === 'exact') {
  54310. var modifiers = (handler.modifiers);
  54311. genModifierCode += genGuard(
  54312. ['ctrl', 'shift', 'alt', 'meta']
  54313. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  54314. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  54315. .join('||')
  54316. );
  54317. } else {
  54318. keys.push(key);
  54319. }
  54320. }
  54321. if (keys.length) {
  54322. code += genKeyFilter(keys);
  54323. }
  54324. // Make sure modifiers like prevent and stop get executed after key filtering
  54325. if (genModifierCode) {
  54326. code += genModifierCode;
  54327. }
  54328. var handlerCode = isMethodPath
  54329. ? ("return " + (handler.value) + "($event)")
  54330. : isFunctionExpression
  54331. ? ("return (" + (handler.value) + ")($event)")
  54332. : isFunctionInvocation
  54333. ? ("return " + (handler.value))
  54334. : handler.value;
  54335. return ("function($event){" + code + handlerCode + "}")
  54336. }
  54337. }
  54338. function genKeyFilter (keys) {
  54339. return (
  54340. // make sure the key filters only apply to KeyboardEvents
  54341. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  54342. // key events that do not have keyCode property...
  54343. "if(!$event.type.indexOf('key')&&" +
  54344. (keys.map(genFilterCode).join('&&')) + ")return null;"
  54345. )
  54346. }
  54347. function genFilterCode (key) {
  54348. var keyVal = parseInt(key, 10);
  54349. if (keyVal) {
  54350. return ("$event.keyCode!==" + keyVal)
  54351. }
  54352. var keyCode = keyCodes[key];
  54353. var keyName = keyNames[key];
  54354. return (
  54355. "_k($event.keyCode," +
  54356. (JSON.stringify(key)) + "," +
  54357. (JSON.stringify(keyCode)) + "," +
  54358. "$event.key," +
  54359. "" + (JSON.stringify(keyName)) +
  54360. ")"
  54361. )
  54362. }
  54363. /* */
  54364. function on (el, dir) {
  54365. if (dir.modifiers) {
  54366. warn("v-on without argument does not support modifiers.");
  54367. }
  54368. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  54369. }
  54370. /* */
  54371. function bind$1 (el, dir) {
  54372. el.wrapData = function (code) {
  54373. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  54374. };
  54375. }
  54376. /* */
  54377. var baseDirectives = {
  54378. on: on,
  54379. bind: bind$1,
  54380. cloak: noop
  54381. };
  54382. /* */
  54383. var CodegenState = function CodegenState (options) {
  54384. this.options = options;
  54385. this.warn = options.warn || baseWarn;
  54386. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  54387. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  54388. this.directives = extend(extend({}, baseDirectives), options.directives);
  54389. var isReservedTag = options.isReservedTag || no;
  54390. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  54391. this.onceId = 0;
  54392. this.staticRenderFns = [];
  54393. this.pre = false;
  54394. };
  54395. function generate (
  54396. ast,
  54397. options
  54398. ) {
  54399. var state = new CodegenState(options);
  54400. var code = ast ? genElement(ast, state) : '_c("div")';
  54401. return {
  54402. render: ("with(this){return " + code + "}"),
  54403. staticRenderFns: state.staticRenderFns
  54404. }
  54405. }
  54406. function genElement (el, state) {
  54407. if (el.parent) {
  54408. el.pre = el.pre || el.parent.pre;
  54409. }
  54410. if (el.staticRoot && !el.staticProcessed) {
  54411. return genStatic(el, state)
  54412. } else if (el.once && !el.onceProcessed) {
  54413. return genOnce(el, state)
  54414. } else if (el.for && !el.forProcessed) {
  54415. return genFor(el, state)
  54416. } else if (el.if && !el.ifProcessed) {
  54417. return genIf(el, state)
  54418. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  54419. return genChildren(el, state) || 'void 0'
  54420. } else if (el.tag === 'slot') {
  54421. return genSlot(el, state)
  54422. } else {
  54423. // component or element
  54424. var code;
  54425. if (el.component) {
  54426. code = genComponent(el.component, el, state);
  54427. } else {
  54428. var data;
  54429. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  54430. data = genData$2(el, state);
  54431. }
  54432. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54433. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  54434. }
  54435. // module transforms
  54436. for (var i = 0; i < state.transforms.length; i++) {
  54437. code = state.transforms[i](el, code);
  54438. }
  54439. return code
  54440. }
  54441. }
  54442. // hoist static sub-trees out
  54443. function genStatic (el, state) {
  54444. el.staticProcessed = true;
  54445. // Some elements (templates) need to behave differently inside of a v-pre
  54446. // node. All pre nodes are static roots, so we can use this as a location to
  54447. // wrap a state change and reset it upon exiting the pre node.
  54448. var originalPreState = state.pre;
  54449. if (el.pre) {
  54450. state.pre = el.pre;
  54451. }
  54452. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  54453. state.pre = originalPreState;
  54454. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  54455. }
  54456. // v-once
  54457. function genOnce (el, state) {
  54458. el.onceProcessed = true;
  54459. if (el.if && !el.ifProcessed) {
  54460. return genIf(el, state)
  54461. } else if (el.staticInFor) {
  54462. var key = '';
  54463. var parent = el.parent;
  54464. while (parent) {
  54465. if (parent.for) {
  54466. key = parent.key;
  54467. break
  54468. }
  54469. parent = parent.parent;
  54470. }
  54471. if (!key) {
  54472. state.warn(
  54473. "v-once can only be used inside v-for that is keyed. ",
  54474. el.rawAttrsMap['v-once']
  54475. );
  54476. return genElement(el, state)
  54477. }
  54478. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  54479. } else {
  54480. return genStatic(el, state)
  54481. }
  54482. }
  54483. function genIf (
  54484. el,
  54485. state,
  54486. altGen,
  54487. altEmpty
  54488. ) {
  54489. el.ifProcessed = true; // avoid recursion
  54490. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  54491. }
  54492. function genIfConditions (
  54493. conditions,
  54494. state,
  54495. altGen,
  54496. altEmpty
  54497. ) {
  54498. if (!conditions.length) {
  54499. return altEmpty || '_e()'
  54500. }
  54501. var condition = conditions.shift();
  54502. if (condition.exp) {
  54503. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  54504. } else {
  54505. return ("" + (genTernaryExp(condition.block)))
  54506. }
  54507. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  54508. function genTernaryExp (el) {
  54509. return altGen
  54510. ? altGen(el, state)
  54511. : el.once
  54512. ? genOnce(el, state)
  54513. : genElement(el, state)
  54514. }
  54515. }
  54516. function genFor (
  54517. el,
  54518. state,
  54519. altGen,
  54520. altHelper
  54521. ) {
  54522. var exp = el.for;
  54523. var alias = el.alias;
  54524. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54525. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54526. if (state.maybeComponent(el) &&
  54527. el.tag !== 'slot' &&
  54528. el.tag !== 'template' &&
  54529. !el.key
  54530. ) {
  54531. state.warn(
  54532. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54533. "v-for should have explicit keys. " +
  54534. "See https://vuejs.org/guide/list.html#key for more info.",
  54535. el.rawAttrsMap['v-for'],
  54536. true /* tip */
  54537. );
  54538. }
  54539. el.forProcessed = true; // avoid recursion
  54540. return (altHelper || '_l') + "((" + exp + ")," +
  54541. "function(" + alias + iterator1 + iterator2 + "){" +
  54542. "return " + ((altGen || genElement)(el, state)) +
  54543. '})'
  54544. }
  54545. function genData$2 (el, state) {
  54546. var data = '{';
  54547. // directives first.
  54548. // directives may mutate the el's other properties before they are generated.
  54549. var dirs = genDirectives(el, state);
  54550. if (dirs) { data += dirs + ','; }
  54551. // key
  54552. if (el.key) {
  54553. data += "key:" + (el.key) + ",";
  54554. }
  54555. // ref
  54556. if (el.ref) {
  54557. data += "ref:" + (el.ref) + ",";
  54558. }
  54559. if (el.refInFor) {
  54560. data += "refInFor:true,";
  54561. }
  54562. // pre
  54563. if (el.pre) {
  54564. data += "pre:true,";
  54565. }
  54566. // record original tag name for components using "is" attribute
  54567. if (el.component) {
  54568. data += "tag:\"" + (el.tag) + "\",";
  54569. }
  54570. // module data generation functions
  54571. for (var i = 0; i < state.dataGenFns.length; i++) {
  54572. data += state.dataGenFns[i](el);
  54573. }
  54574. // attributes
  54575. if (el.attrs) {
  54576. data += "attrs:" + (genProps(el.attrs)) + ",";
  54577. }
  54578. // DOM props
  54579. if (el.props) {
  54580. data += "domProps:" + (genProps(el.props)) + ",";
  54581. }
  54582. // event handlers
  54583. if (el.events) {
  54584. data += (genHandlers(el.events, false)) + ",";
  54585. }
  54586. if (el.nativeEvents) {
  54587. data += (genHandlers(el.nativeEvents, true)) + ",";
  54588. }
  54589. // slot target
  54590. // only for non-scoped slots
  54591. if (el.slotTarget && !el.slotScope) {
  54592. data += "slot:" + (el.slotTarget) + ",";
  54593. }
  54594. // scoped slots
  54595. if (el.scopedSlots) {
  54596. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54597. }
  54598. // component v-model
  54599. if (el.model) {
  54600. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54601. }
  54602. // inline-template
  54603. if (el.inlineTemplate) {
  54604. var inlineTemplate = genInlineTemplate(el, state);
  54605. if (inlineTemplate) {
  54606. data += inlineTemplate + ",";
  54607. }
  54608. }
  54609. data = data.replace(/,$/, '') + '}';
  54610. // v-bind dynamic argument wrap
  54611. // v-bind with dynamic arguments must be applied using the same v-bind object
  54612. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54613. if (el.dynamicAttrs) {
  54614. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54615. }
  54616. // v-bind data wrap
  54617. if (el.wrapData) {
  54618. data = el.wrapData(data);
  54619. }
  54620. // v-on data wrap
  54621. if (el.wrapListeners) {
  54622. data = el.wrapListeners(data);
  54623. }
  54624. return data
  54625. }
  54626. function genDirectives (el, state) {
  54627. var dirs = el.directives;
  54628. if (!dirs) { return }
  54629. var res = 'directives:[';
  54630. var hasRuntime = false;
  54631. var i, l, dir, needRuntime;
  54632. for (i = 0, l = dirs.length; i < l; i++) {
  54633. dir = dirs[i];
  54634. needRuntime = true;
  54635. var gen = state.directives[dir.name];
  54636. if (gen) {
  54637. // compile-time directive that manipulates AST.
  54638. // returns true if it also needs a runtime counterpart.
  54639. needRuntime = !!gen(el, dir, state.warn);
  54640. }
  54641. if (needRuntime) {
  54642. hasRuntime = true;
  54643. 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))) : '') + "},";
  54644. }
  54645. }
  54646. if (hasRuntime) {
  54647. return res.slice(0, -1) + ']'
  54648. }
  54649. }
  54650. function genInlineTemplate (el, state) {
  54651. var ast = el.children[0];
  54652. if (el.children.length !== 1 || ast.type !== 1) {
  54653. state.warn(
  54654. 'Inline-template components must have exactly one child element.',
  54655. { start: el.start }
  54656. );
  54657. }
  54658. if (ast && ast.type === 1) {
  54659. var inlineRenderFns = generate(ast, state.options);
  54660. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54661. }
  54662. }
  54663. function genScopedSlots (
  54664. el,
  54665. slots,
  54666. state
  54667. ) {
  54668. // by default scoped slots are considered "stable", this allows child
  54669. // components with only scoped slots to skip forced updates from parent.
  54670. // but in some cases we have to bail-out of this optimization
  54671. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54672. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54673. var slot = slots[key];
  54674. return (
  54675. slot.slotTargetDynamic ||
  54676. slot.if ||
  54677. slot.for ||
  54678. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54679. )
  54680. });
  54681. // #9534: if a component with scoped slots is inside a conditional branch,
  54682. // it's possible for the same component to be reused but with different
  54683. // compiled slot content. To avoid that, we generate a unique key based on
  54684. // the generated code of all the slot contents.
  54685. var needsKey = !!el.if;
  54686. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54687. // disconnected due to the intermediate scope variable)
  54688. // #9438, #9506
  54689. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54690. // and skip force updating ones that do not actually use scope variables.
  54691. if (!needsForceUpdate) {
  54692. var parent = el.parent;
  54693. while (parent) {
  54694. if (
  54695. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54696. parent.for
  54697. ) {
  54698. needsForceUpdate = true;
  54699. break
  54700. }
  54701. if (parent.if) {
  54702. needsKey = true;
  54703. }
  54704. parent = parent.parent;
  54705. }
  54706. }
  54707. var generatedSlots = Object.keys(slots)
  54708. .map(function (key) { return genScopedSlot(slots[key], state); })
  54709. .join(',');
  54710. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54711. }
  54712. function hash(str) {
  54713. var hash = 5381;
  54714. var i = str.length;
  54715. while(i) {
  54716. hash = (hash * 33) ^ str.charCodeAt(--i);
  54717. }
  54718. return hash >>> 0
  54719. }
  54720. function containsSlotChild (el) {
  54721. if (el.type === 1) {
  54722. if (el.tag === 'slot') {
  54723. return true
  54724. }
  54725. return el.children.some(containsSlotChild)
  54726. }
  54727. return false
  54728. }
  54729. function genScopedSlot (
  54730. el,
  54731. state
  54732. ) {
  54733. var isLegacySyntax = el.attrsMap['slot-scope'];
  54734. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54735. return genIf(el, state, genScopedSlot, "null")
  54736. }
  54737. if (el.for && !el.forProcessed) {
  54738. return genFor(el, state, genScopedSlot)
  54739. }
  54740. var slotScope = el.slotScope === emptySlotScopeToken
  54741. ? ""
  54742. : String(el.slotScope);
  54743. var fn = "function(" + slotScope + "){" +
  54744. "return " + (el.tag === 'template'
  54745. ? el.if && isLegacySyntax
  54746. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54747. : genChildren(el, state) || 'undefined'
  54748. : genElement(el, state)) + "}";
  54749. // reverse proxy v-slot without scope on this.$slots
  54750. var reverseProxy = slotScope ? "" : ",proxy:true";
  54751. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54752. }
  54753. function genChildren (
  54754. el,
  54755. state,
  54756. checkSkip,
  54757. altGenElement,
  54758. altGenNode
  54759. ) {
  54760. var children = el.children;
  54761. if (children.length) {
  54762. var el$1 = children[0];
  54763. // optimize single v-for
  54764. if (children.length === 1 &&
  54765. el$1.for &&
  54766. el$1.tag !== 'template' &&
  54767. el$1.tag !== 'slot'
  54768. ) {
  54769. var normalizationType = checkSkip
  54770. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54771. : "";
  54772. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54773. }
  54774. var normalizationType$1 = checkSkip
  54775. ? getNormalizationType(children, state.maybeComponent)
  54776. : 0;
  54777. var gen = altGenNode || genNode;
  54778. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  54779. }
  54780. }
  54781. // determine the normalization needed for the children array.
  54782. // 0: no normalization needed
  54783. // 1: simple normalization needed (possible 1-level deep nested array)
  54784. // 2: full normalization needed
  54785. function getNormalizationType (
  54786. children,
  54787. maybeComponent
  54788. ) {
  54789. var res = 0;
  54790. for (var i = 0; i < children.length; i++) {
  54791. var el = children[i];
  54792. if (el.type !== 1) {
  54793. continue
  54794. }
  54795. if (needsNormalization(el) ||
  54796. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  54797. res = 2;
  54798. break
  54799. }
  54800. if (maybeComponent(el) ||
  54801. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  54802. res = 1;
  54803. }
  54804. }
  54805. return res
  54806. }
  54807. function needsNormalization (el) {
  54808. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  54809. }
  54810. function genNode (node, state) {
  54811. if (node.type === 1) {
  54812. return genElement(node, state)
  54813. } else if (node.type === 3 && node.isComment) {
  54814. return genComment(node)
  54815. } else {
  54816. return genText(node)
  54817. }
  54818. }
  54819. function genText (text) {
  54820. return ("_v(" + (text.type === 2
  54821. ? text.expression // no need for () because already wrapped in _s()
  54822. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  54823. }
  54824. function genComment (comment) {
  54825. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  54826. }
  54827. function genSlot (el, state) {
  54828. var slotName = el.slotName || '"default"';
  54829. var children = genChildren(el, state);
  54830. var res = "_t(" + slotName + (children ? ("," + children) : '');
  54831. var attrs = el.attrs || el.dynamicAttrs
  54832. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  54833. // slot props are camelized
  54834. name: camelize(attr.name),
  54835. value: attr.value,
  54836. dynamic: attr.dynamic
  54837. }); }))
  54838. : null;
  54839. var bind$$1 = el.attrsMap['v-bind'];
  54840. if ((attrs || bind$$1) && !children) {
  54841. res += ",null";
  54842. }
  54843. if (attrs) {
  54844. res += "," + attrs;
  54845. }
  54846. if (bind$$1) {
  54847. res += (attrs ? '' : ',null') + "," + bind$$1;
  54848. }
  54849. return res + ')'
  54850. }
  54851. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  54852. function genComponent (
  54853. componentName,
  54854. el,
  54855. state
  54856. ) {
  54857. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54858. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  54859. }
  54860. function genProps (props) {
  54861. var staticProps = "";
  54862. var dynamicProps = "";
  54863. for (var i = 0; i < props.length; i++) {
  54864. var prop = props[i];
  54865. var value = transformSpecialNewlines(prop.value);
  54866. if (prop.dynamic) {
  54867. dynamicProps += (prop.name) + "," + value + ",";
  54868. } else {
  54869. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  54870. }
  54871. }
  54872. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  54873. if (dynamicProps) {
  54874. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  54875. } else {
  54876. return staticProps
  54877. }
  54878. }
  54879. // #3895, #4268
  54880. function transformSpecialNewlines (text) {
  54881. return text
  54882. .replace(/\u2028/g, '\\u2028')
  54883. .replace(/\u2029/g, '\\u2029')
  54884. }
  54885. /* */
  54886. // these keywords should not appear inside expressions, but operators like
  54887. // typeof, instanceof and in are allowed
  54888. var prohibitedKeywordRE = new RegExp('\\b' + (
  54889. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  54890. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  54891. 'extends,finally,continue,debugger,function,arguments'
  54892. ).split(',').join('\\b|\\b') + '\\b');
  54893. // these unary operators should not be used as property/method names
  54894. var unaryOperatorsRE = new RegExp('\\b' + (
  54895. 'delete,typeof,void'
  54896. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  54897. // strip strings in expressions
  54898. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  54899. // detect problematic expressions in a template
  54900. function detectErrors (ast, warn) {
  54901. if (ast) {
  54902. checkNode(ast, warn);
  54903. }
  54904. }
  54905. function checkNode (node, warn) {
  54906. if (node.type === 1) {
  54907. for (var name in node.attrsMap) {
  54908. if (dirRE.test(name)) {
  54909. var value = node.attrsMap[name];
  54910. if (value) {
  54911. var range = node.rawAttrsMap[name];
  54912. if (name === 'v-for') {
  54913. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  54914. } else if (name === 'v-slot' || name[0] === '#') {
  54915. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  54916. } else if (onRE.test(name)) {
  54917. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  54918. } else {
  54919. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  54920. }
  54921. }
  54922. }
  54923. }
  54924. if (node.children) {
  54925. for (var i = 0; i < node.children.length; i++) {
  54926. checkNode(node.children[i], warn);
  54927. }
  54928. }
  54929. } else if (node.type === 2) {
  54930. checkExpression(node.expression, node.text, warn, node);
  54931. }
  54932. }
  54933. function checkEvent (exp, text, warn, range) {
  54934. var stripped = exp.replace(stripStringRE, '');
  54935. var keywordMatch = stripped.match(unaryOperatorsRE);
  54936. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  54937. warn(
  54938. "avoid using JavaScript unary operator as property name: " +
  54939. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  54940. range
  54941. );
  54942. }
  54943. checkExpression(exp, text, warn, range);
  54944. }
  54945. function checkFor (node, text, warn, range) {
  54946. checkExpression(node.for || '', text, warn, range);
  54947. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  54948. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  54949. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  54950. }
  54951. function checkIdentifier (
  54952. ident,
  54953. type,
  54954. text,
  54955. warn,
  54956. range
  54957. ) {
  54958. if (typeof ident === 'string') {
  54959. try {
  54960. new Function(("var " + ident + "=_"));
  54961. } catch (e) {
  54962. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  54963. }
  54964. }
  54965. }
  54966. function checkExpression (exp, text, warn, range) {
  54967. try {
  54968. new Function(("return " + exp));
  54969. } catch (e) {
  54970. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  54971. if (keywordMatch) {
  54972. warn(
  54973. "avoid using JavaScript keyword as property name: " +
  54974. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  54975. range
  54976. );
  54977. } else {
  54978. warn(
  54979. "invalid expression: " + (e.message) + " in\n\n" +
  54980. " " + exp + "\n\n" +
  54981. " Raw expression: " + (text.trim()) + "\n",
  54982. range
  54983. );
  54984. }
  54985. }
  54986. }
  54987. function checkFunctionParameterExpression (exp, text, warn, range) {
  54988. try {
  54989. new Function(exp, '');
  54990. } catch (e) {
  54991. warn(
  54992. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  54993. " " + exp + "\n\n" +
  54994. " Raw expression: " + (text.trim()) + "\n",
  54995. range
  54996. );
  54997. }
  54998. }
  54999. /* */
  55000. var range = 2;
  55001. function generateCodeFrame (
  55002. source,
  55003. start,
  55004. end
  55005. ) {
  55006. if ( start === void 0 ) start = 0;
  55007. if ( end === void 0 ) end = source.length;
  55008. var lines = source.split(/\r?\n/);
  55009. var count = 0;
  55010. var res = [];
  55011. for (var i = 0; i < lines.length; i++) {
  55012. count += lines[i].length + 1;
  55013. if (count >= start) {
  55014. for (var j = i - range; j <= i + range || end > count; j++) {
  55015. if (j < 0 || j >= lines.length) { continue }
  55016. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  55017. var lineLength = lines[j].length;
  55018. if (j === i) {
  55019. // push underline
  55020. var pad = start - (count - lineLength) + 1;
  55021. var length = end > count ? lineLength - pad : end - start;
  55022. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  55023. } else if (j > i) {
  55024. if (end > count) {
  55025. var length$1 = Math.min(end - count, lineLength);
  55026. res.push(" | " + repeat$1("^", length$1));
  55027. }
  55028. count += lineLength + 1;
  55029. }
  55030. }
  55031. break
  55032. }
  55033. }
  55034. return res.join('\n')
  55035. }
  55036. function repeat$1 (str, n) {
  55037. var result = '';
  55038. if (n > 0) {
  55039. while (true) { // eslint-disable-line
  55040. if (n & 1) { result += str; }
  55041. n >>>= 1;
  55042. if (n <= 0) { break }
  55043. str += str;
  55044. }
  55045. }
  55046. return result
  55047. }
  55048. /* */
  55049. function createFunction (code, errors) {
  55050. try {
  55051. return new Function(code)
  55052. } catch (err) {
  55053. errors.push({ err: err, code: code });
  55054. return noop
  55055. }
  55056. }
  55057. function createCompileToFunctionFn (compile) {
  55058. var cache = Object.create(null);
  55059. return function compileToFunctions (
  55060. template,
  55061. options,
  55062. vm
  55063. ) {
  55064. options = extend({}, options);
  55065. var warn$$1 = options.warn || warn;
  55066. delete options.warn;
  55067. /* istanbul ignore if */
  55068. {
  55069. // detect possible CSP restriction
  55070. try {
  55071. new Function('return 1');
  55072. } catch (e) {
  55073. if (e.toString().match(/unsafe-eval|CSP/)) {
  55074. warn$$1(
  55075. 'It seems you are using the standalone build of Vue.js in an ' +
  55076. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  55077. 'The template compiler cannot work in this environment. Consider ' +
  55078. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  55079. 'templates into render functions.'
  55080. );
  55081. }
  55082. }
  55083. }
  55084. // check cache
  55085. var key = options.delimiters
  55086. ? String(options.delimiters) + template
  55087. : template;
  55088. if (cache[key]) {
  55089. return cache[key]
  55090. }
  55091. // compile
  55092. var compiled = compile(template, options);
  55093. // check compilation errors/tips
  55094. {
  55095. if (compiled.errors && compiled.errors.length) {
  55096. if (options.outputSourceRange) {
  55097. compiled.errors.forEach(function (e) {
  55098. warn$$1(
  55099. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  55100. generateCodeFrame(template, e.start, e.end),
  55101. vm
  55102. );
  55103. });
  55104. } else {
  55105. warn$$1(
  55106. "Error compiling template:\n\n" + template + "\n\n" +
  55107. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  55108. vm
  55109. );
  55110. }
  55111. }
  55112. if (compiled.tips && compiled.tips.length) {
  55113. if (options.outputSourceRange) {
  55114. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  55115. } else {
  55116. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  55117. }
  55118. }
  55119. }
  55120. // turn code into functions
  55121. var res = {};
  55122. var fnGenErrors = [];
  55123. res.render = createFunction(compiled.render, fnGenErrors);
  55124. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  55125. return createFunction(code, fnGenErrors)
  55126. });
  55127. // check function generation errors.
  55128. // this should only happen if there is a bug in the compiler itself.
  55129. // mostly for codegen development use
  55130. /* istanbul ignore if */
  55131. {
  55132. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  55133. warn$$1(
  55134. "Failed to generate render function:\n\n" +
  55135. fnGenErrors.map(function (ref) {
  55136. var err = ref.err;
  55137. var code = ref.code;
  55138. return ((err.toString()) + " in\n\n" + code + "\n");
  55139. }).join('\n'),
  55140. vm
  55141. );
  55142. }
  55143. }
  55144. return (cache[key] = res)
  55145. }
  55146. }
  55147. /* */
  55148. function createCompilerCreator (baseCompile) {
  55149. return function createCompiler (baseOptions) {
  55150. function compile (
  55151. template,
  55152. options
  55153. ) {
  55154. var finalOptions = Object.create(baseOptions);
  55155. var errors = [];
  55156. var tips = [];
  55157. var warn = function (msg, range, tip) {
  55158. (tip ? tips : errors).push(msg);
  55159. };
  55160. if (options) {
  55161. if (options.outputSourceRange) {
  55162. // $flow-disable-line
  55163. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  55164. warn = function (msg, range, tip) {
  55165. var data = { msg: msg };
  55166. if (range) {
  55167. if (range.start != null) {
  55168. data.start = range.start + leadingSpaceLength;
  55169. }
  55170. if (range.end != null) {
  55171. data.end = range.end + leadingSpaceLength;
  55172. }
  55173. }
  55174. (tip ? tips : errors).push(data);
  55175. };
  55176. }
  55177. // merge custom modules
  55178. if (options.modules) {
  55179. finalOptions.modules =
  55180. (baseOptions.modules || []).concat(options.modules);
  55181. }
  55182. // merge custom directives
  55183. if (options.directives) {
  55184. finalOptions.directives = extend(
  55185. Object.create(baseOptions.directives || null),
  55186. options.directives
  55187. );
  55188. }
  55189. // copy other options
  55190. for (var key in options) {
  55191. if (key !== 'modules' && key !== 'directives') {
  55192. finalOptions[key] = options[key];
  55193. }
  55194. }
  55195. }
  55196. finalOptions.warn = warn;
  55197. var compiled = baseCompile(template.trim(), finalOptions);
  55198. {
  55199. detectErrors(compiled.ast, warn);
  55200. }
  55201. compiled.errors = errors;
  55202. compiled.tips = tips;
  55203. return compiled
  55204. }
  55205. return {
  55206. compile: compile,
  55207. compileToFunctions: createCompileToFunctionFn(compile)
  55208. }
  55209. }
  55210. }
  55211. /* */
  55212. // `createCompilerCreator` allows creating compilers that use alternative
  55213. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  55214. // Here we just export a default compiler using the default parts.
  55215. var createCompiler = createCompilerCreator(function baseCompile (
  55216. template,
  55217. options
  55218. ) {
  55219. var ast = parse(template.trim(), options);
  55220. if (options.optimize !== false) {
  55221. optimize(ast, options);
  55222. }
  55223. var code = generate(ast, options);
  55224. return {
  55225. ast: ast,
  55226. render: code.render,
  55227. staticRenderFns: code.staticRenderFns
  55228. }
  55229. });
  55230. /* */
  55231. var ref$1 = createCompiler(baseOptions);
  55232. var compile = ref$1.compile;
  55233. var compileToFunctions = ref$1.compileToFunctions;
  55234. /* */
  55235. // check whether current browser encodes a char inside attribute values
  55236. var div;
  55237. function getShouldDecode (href) {
  55238. div = div || document.createElement('div');
  55239. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  55240. return div.innerHTML.indexOf('&#10;') > 0
  55241. }
  55242. // #3663: IE encodes newlines inside attribute values while other browsers don't
  55243. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  55244. // #6828: chrome encodes content in a[href]
  55245. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  55246. /* */
  55247. var idToTemplate = cached(function (id) {
  55248. var el = query(id);
  55249. return el && el.innerHTML
  55250. });
  55251. var mount = Vue.prototype.$mount;
  55252. Vue.prototype.$mount = function (
  55253. el,
  55254. hydrating
  55255. ) {
  55256. el = el && query(el);
  55257. /* istanbul ignore if */
  55258. if (el === document.body || el === document.documentElement) {
  55259. warn(
  55260. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  55261. );
  55262. return this
  55263. }
  55264. var options = this.$options;
  55265. // resolve template/el and convert to render function
  55266. if (!options.render) {
  55267. var template = options.template;
  55268. if (template) {
  55269. if (typeof template === 'string') {
  55270. if (template.charAt(0) === '#') {
  55271. template = idToTemplate(template);
  55272. /* istanbul ignore if */
  55273. if (!template) {
  55274. warn(
  55275. ("Template element not found or is empty: " + (options.template)),
  55276. this
  55277. );
  55278. }
  55279. }
  55280. } else if (template.nodeType) {
  55281. template = template.innerHTML;
  55282. } else {
  55283. {
  55284. warn('invalid template option:' + template, this);
  55285. }
  55286. return this
  55287. }
  55288. } else if (el) {
  55289. template = getOuterHTML(el);
  55290. }
  55291. if (template) {
  55292. /* istanbul ignore if */
  55293. if (config.performance && mark) {
  55294. mark('compile');
  55295. }
  55296. var ref = compileToFunctions(template, {
  55297. outputSourceRange: "development" !== 'production',
  55298. shouldDecodeNewlines: shouldDecodeNewlines,
  55299. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  55300. delimiters: options.delimiters,
  55301. comments: options.comments
  55302. }, this);
  55303. var render = ref.render;
  55304. var staticRenderFns = ref.staticRenderFns;
  55305. options.render = render;
  55306. options.staticRenderFns = staticRenderFns;
  55307. /* istanbul ignore if */
  55308. if (config.performance && mark) {
  55309. mark('compile end');
  55310. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  55311. }
  55312. }
  55313. }
  55314. return mount.call(this, el, hydrating)
  55315. };
  55316. /**
  55317. * Get outerHTML of elements, taking care
  55318. * of SVG elements in IE as well.
  55319. */
  55320. function getOuterHTML (el) {
  55321. if (el.outerHTML) {
  55322. return el.outerHTML
  55323. } else {
  55324. var container = document.createElement('div');
  55325. container.appendChild(el.cloneNode(true));
  55326. return container.innerHTML
  55327. }
  55328. }
  55329. Vue.compile = compileToFunctions;
  55330. module.exports = Vue;
  55331. /* 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))
  55332. /***/ }),
  55333. /***/ "./node_modules/vue/dist/vue.common.js":
  55334. /*!*********************************************!*\
  55335. !*** ./node_modules/vue/dist/vue.common.js ***!
  55336. \*********************************************/
  55337. /*! no static exports found */
  55338. /***/ (function(module, exports, __webpack_require__) {
  55339. if (false) {} else {
  55340. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  55341. }
  55342. /***/ }),
  55343. /***/ "./node_modules/webpack/buildin/global.js":
  55344. /*!***********************************!*\
  55345. !*** (webpack)/buildin/global.js ***!
  55346. \***********************************/
  55347. /*! no static exports found */
  55348. /***/ (function(module, exports) {
  55349. var g;
  55350. // This works in non-strict mode
  55351. g = (function() {
  55352. return this;
  55353. })();
  55354. try {
  55355. // This works if eval is allowed (see CSP)
  55356. g = g || new Function("return this")();
  55357. } catch (e) {
  55358. // This works if the window reference is available
  55359. if (typeof window === "object") g = window;
  55360. }
  55361. // g can still be undefined, but nothing to do about it...
  55362. // We return undefined, instead of nothing here, so it's
  55363. // easier to handle this case. if(!global) { ...}
  55364. module.exports = g;
  55365. /***/ }),
  55366. /***/ "./node_modules/webpack/buildin/module.js":
  55367. /*!***********************************!*\
  55368. !*** (webpack)/buildin/module.js ***!
  55369. \***********************************/
  55370. /*! no static exports found */
  55371. /***/ (function(module, exports) {
  55372. module.exports = function(module) {
  55373. if (!module.webpackPolyfill) {
  55374. module.deprecate = function() {};
  55375. module.paths = [];
  55376. // module.parent = undefined by default
  55377. if (!module.children) module.children = [];
  55378. Object.defineProperty(module, "loaded", {
  55379. enumerable: true,
  55380. get: function() {
  55381. return module.l;
  55382. }
  55383. });
  55384. Object.defineProperty(module, "id", {
  55385. enumerable: true,
  55386. get: function() {
  55387. return module.i;
  55388. }
  55389. });
  55390. module.webpackPolyfill = 1;
  55391. }
  55392. return module;
  55393. };
  55394. /***/ }),
  55395. /***/ "./resources/js/app.js":
  55396. /*!*****************************!*\
  55397. !*** ./resources/js/app.js ***!
  55398. \*****************************/
  55399. /*! no static exports found */
  55400. /***/ (function(module, exports, __webpack_require__) {
  55401. /**
  55402. * First we will load all of this project's JavaScript dependencies which
  55403. * includes Vue and other libraries. It is a great starting point when
  55404. * building robust, powerful web applications using Vue and Laravel.
  55405. */
  55406. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  55407. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  55408. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  55409. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  55410. /**
  55411. * The following block of code may be used to automatically register your
  55412. * Vue components. It will recursively scan this directory for the Vue
  55413. * components and automatically register them with their "basename".
  55414. *
  55415. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  55416. */
  55417. // const files = require.context('./', true, /\.vue$/i)
  55418. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  55419. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  55420. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  55421. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  55422. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  55423. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  55424. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  55425. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  55426. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  55427. Vue.component('credential-form-modal', __webpack_require__(/*! ./components/credential-form-modal.vue */ "./resources/js/components/credential-form-modal.vue")["default"]);
  55428. Vue.component('autocomplete-custom-dropdown', __webpack_require__(/*! ./components/autocomplete-custom-dropdown.vue */ "./resources/js/components/autocomplete-custom-dropdown.vue")["default"]);
  55429. Vue.component('credential-list', __webpack_require__(/*! ./components/credential-list.vue */ "./resources/js/components/credential-list.vue")["default"]);
  55430. /**
  55431. * Next, we will create a fresh Vue application instance and attach it to
  55432. * the page. Then, you may begin adding components to this application
  55433. * or customize the JavaScript scaffolding to fit your unique needs.
  55434. */
  55435. var app = new Vue({
  55436. el: '#app'
  55437. });
  55438. $(function () {
  55439. $('[data-toggle="tooltip"]').tooltip();
  55440. });
  55441. var clipboard = new Clipboard('.btn-clip');
  55442. clipboard.on('success', function (e) {
  55443. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  55444. position: "right",
  55445. className: 'success'
  55446. });
  55447. e.clearSelection();
  55448. });
  55449. /***/ }),
  55450. /***/ "./resources/js/bootstrap.js":
  55451. /*!***********************************!*\
  55452. !*** ./resources/js/bootstrap.js ***!
  55453. \***********************************/
  55454. /*! no exports provided */
  55455. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55456. "use strict";
  55457. __webpack_require__.r(__webpack_exports__);
  55458. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  55459. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  55460. /**
  55461. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  55462. * for JavaScript based Bootstrap features such as modals and tabs. This
  55463. * code may be modified to fit the specific needs of your application.
  55464. */
  55465. try {
  55466. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  55467. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  55468. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  55469. } catch (e) {}
  55470. /**
  55471. * We'll load the axios HTTP library which allows us to easily issue requests
  55472. * to our Laravel back-end. This library automatically handles sending the
  55473. * CSRF token as a header based on the value of the "XSRF" token cookie.
  55474. */
  55475. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  55476. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  55477. /**
  55478. * Echo exposes an expressive API for subscribing to channels and listening
  55479. * for events that are broadcast by Laravel. Echo and event broadcasting
  55480. * allows your team to easily build robust real-time web applications.
  55481. */
  55482. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  55483. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  55484. broadcaster: 'pusher',
  55485. key: "upccrt",
  55486. authEndpoint: '/broadcasting/auth',
  55487. wsHost: window.location.hostname,
  55488. wsPort: 6001,
  55489. disableStats: true
  55490. });
  55491. /***/ }),
  55492. /***/ "./resources/js/components/ExampleComponent.vue":
  55493. /*!******************************************************!*\
  55494. !*** ./resources/js/components/ExampleComponent.vue ***!
  55495. \******************************************************/
  55496. /*! exports provided: default */
  55497. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55498. "use strict";
  55499. __webpack_require__.r(__webpack_exports__);
  55500. /* 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&");
  55501. /* 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&");
  55502. /* 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");
  55503. /* normalize component */
  55504. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55505. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55506. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55507. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55508. false,
  55509. null,
  55510. null,
  55511. null
  55512. )
  55513. /* hot reload */
  55514. if (false) { var api; }
  55515. component.options.__file = "resources/js/components/ExampleComponent.vue"
  55516. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55517. /***/ }),
  55518. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  55519. /*!*******************************************************************************!*\
  55520. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55521. \*******************************************************************************/
  55522. /*! exports provided: default */
  55523. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55524. "use strict";
  55525. __webpack_require__.r(__webpack_exports__);
  55526. /* 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&");
  55527. /* 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"]);
  55528. /***/ }),
  55529. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55530. /*!*************************************************************************************!*\
  55531. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55532. \*************************************************************************************/
  55533. /*! exports provided: render, staticRenderFns */
  55534. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55535. "use strict";
  55536. __webpack_require__.r(__webpack_exports__);
  55537. /* 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&");
  55538. /* 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"]; });
  55539. /* 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"]; });
  55540. /***/ }),
  55541. /***/ "./resources/js/components/assetinfo.vue":
  55542. /*!***********************************************!*\
  55543. !*** ./resources/js/components/assetinfo.vue ***!
  55544. \***********************************************/
  55545. /*! exports provided: default */
  55546. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55547. "use strict";
  55548. __webpack_require__.r(__webpack_exports__);
  55549. /* 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&");
  55550. /* 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&");
  55551. /* 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");
  55552. /* normalize component */
  55553. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55554. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55555. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55556. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55557. false,
  55558. null,
  55559. null,
  55560. null
  55561. )
  55562. /* hot reload */
  55563. if (false) { var api; }
  55564. component.options.__file = "resources/js/components/assetinfo.vue"
  55565. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55566. /***/ }),
  55567. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55568. /*!************************************************************************!*\
  55569. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55570. \************************************************************************/
  55571. /*! exports provided: default */
  55572. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55573. "use strict";
  55574. __webpack_require__.r(__webpack_exports__);
  55575. /* 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&");
  55576. /* 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"]);
  55577. /***/ }),
  55578. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55579. /*!******************************************************************************!*\
  55580. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55581. \******************************************************************************/
  55582. /*! exports provided: render, staticRenderFns */
  55583. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55584. "use strict";
  55585. __webpack_require__.r(__webpack_exports__);
  55586. /* 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&");
  55587. /* 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"]; });
  55588. /* 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"]; });
  55589. /***/ }),
  55590. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue":
  55591. /*!******************************************************************!*\
  55592. !*** ./resources/js/components/autocomplete-custom-dropdown.vue ***!
  55593. \******************************************************************/
  55594. /*! exports provided: default */
  55595. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55596. "use strict";
  55597. __webpack_require__.r(__webpack_exports__);
  55598. /* 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&");
  55599. /* 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&");
  55600. /* 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");
  55601. /* normalize component */
  55602. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55603. _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55604. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"],
  55605. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55606. false,
  55607. null,
  55608. null,
  55609. null
  55610. )
  55611. /* hot reload */
  55612. if (false) { var api; }
  55613. component.options.__file = "resources/js/components/autocomplete-custom-dropdown.vue"
  55614. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55615. /***/ }),
  55616. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  55617. /*!*******************************************************************************************!*\
  55618. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  55619. \*******************************************************************************************/
  55620. /*! exports provided: default */
  55621. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55622. "use strict";
  55623. __webpack_require__.r(__webpack_exports__);
  55624. /* 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&");
  55625. /* 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"]);
  55626. /***/ }),
  55627. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  55628. /*!*************************************************************************************************!*\
  55629. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  55630. \*************************************************************************************************/
  55631. /*! exports provided: render, staticRenderFns */
  55632. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55633. "use strict";
  55634. __webpack_require__.r(__webpack_exports__);
  55635. /* 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&");
  55636. /* 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"]; });
  55637. /* 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"]; });
  55638. /***/ }),
  55639. /***/ "./resources/js/components/credential-form-modal.vue":
  55640. /*!***********************************************************!*\
  55641. !*** ./resources/js/components/credential-form-modal.vue ***!
  55642. \***********************************************************/
  55643. /*! exports provided: default */
  55644. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55645. "use strict";
  55646. __webpack_require__.r(__webpack_exports__);
  55647. /* 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&");
  55648. /* 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&");
  55649. /* 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");
  55650. /* normalize component */
  55651. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55652. _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55653. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"],
  55654. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55655. false,
  55656. null,
  55657. null,
  55658. null
  55659. )
  55660. /* hot reload */
  55661. if (false) { var api; }
  55662. component.options.__file = "resources/js/components/credential-form-modal.vue"
  55663. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55664. /***/ }),
  55665. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  55666. /*!************************************************************************************!*\
  55667. !*** ./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  55668. \************************************************************************************/
  55669. /*! exports provided: default */
  55670. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55671. "use strict";
  55672. __webpack_require__.r(__webpack_exports__);
  55673. /* 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&");
  55674. /* 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"]);
  55675. /***/ }),
  55676. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  55677. /*!******************************************************************************************!*\
  55678. !*** ./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  55679. \******************************************************************************************/
  55680. /*! exports provided: render, staticRenderFns */
  55681. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55682. "use strict";
  55683. __webpack_require__.r(__webpack_exports__);
  55684. /* 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&");
  55685. /* 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"]; });
  55686. /* 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"]; });
  55687. /***/ }),
  55688. /***/ "./resources/js/components/credential-list.vue":
  55689. /*!*****************************************************!*\
  55690. !*** ./resources/js/components/credential-list.vue ***!
  55691. \*****************************************************/
  55692. /*! exports provided: default */
  55693. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55694. "use strict";
  55695. __webpack_require__.r(__webpack_exports__);
  55696. /* 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&");
  55697. /* 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&");
  55698. /* 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");
  55699. /* normalize component */
  55700. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55701. _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55702. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55703. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55704. false,
  55705. null,
  55706. null,
  55707. null
  55708. )
  55709. /* hot reload */
  55710. if (false) { var api; }
  55711. component.options.__file = "resources/js/components/credential-list.vue"
  55712. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55713. /***/ }),
  55714. /***/ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  55715. /*!******************************************************************************!*\
  55716. !*** ./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  55717. \******************************************************************************/
  55718. /*! exports provided: default */
  55719. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55720. "use strict";
  55721. __webpack_require__.r(__webpack_exports__);
  55722. /* 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&");
  55723. /* 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"]);
  55724. /***/ }),
  55725. /***/ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  55726. /*!************************************************************************************!*\
  55727. !*** ./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  55728. \************************************************************************************/
  55729. /*! exports provided: render, staticRenderFns */
  55730. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55731. "use strict";
  55732. __webpack_require__.r(__webpack_exports__);
  55733. /* 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&");
  55734. /* 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"]; });
  55735. /* 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"]; });
  55736. /***/ }),
  55737. /***/ "./resources/js/components/credential.vue":
  55738. /*!************************************************!*\
  55739. !*** ./resources/js/components/credential.vue ***!
  55740. \************************************************/
  55741. /*! exports provided: default */
  55742. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55743. "use strict";
  55744. __webpack_require__.r(__webpack_exports__);
  55745. /* 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&");
  55746. /* 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&");
  55747. /* 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");
  55748. /* normalize component */
  55749. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55750. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55751. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  55752. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55753. false,
  55754. null,
  55755. null,
  55756. null
  55757. )
  55758. /* hot reload */
  55759. if (false) { var api; }
  55760. component.options.__file = "resources/js/components/credential.vue"
  55761. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55762. /***/ }),
  55763. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  55764. /*!*************************************************************************!*\
  55765. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  55766. \*************************************************************************/
  55767. /*! exports provided: default */
  55768. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55769. "use strict";
  55770. __webpack_require__.r(__webpack_exports__);
  55771. /* 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&");
  55772. /* 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"]);
  55773. /***/ }),
  55774. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  55775. /*!*******************************************************************************!*\
  55776. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  55777. \*******************************************************************************/
  55778. /*! exports provided: render, staticRenderFns */
  55779. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55780. "use strict";
  55781. __webpack_require__.r(__webpack_exports__);
  55782. /* 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&");
  55783. /* 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"]; });
  55784. /* 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"]; });
  55785. /***/ }),
  55786. /***/ "./resources/js/components/errorlist.vue":
  55787. /*!***********************************************!*\
  55788. !*** ./resources/js/components/errorlist.vue ***!
  55789. \***********************************************/
  55790. /*! exports provided: default */
  55791. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55792. "use strict";
  55793. __webpack_require__.r(__webpack_exports__);
  55794. /* 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&");
  55795. /* 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&");
  55796. /* 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");
  55797. /* normalize component */
  55798. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55799. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55800. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  55801. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55802. false,
  55803. null,
  55804. null,
  55805. null
  55806. )
  55807. /* hot reload */
  55808. if (false) { var api; }
  55809. component.options.__file = "resources/js/components/errorlist.vue"
  55810. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55811. /***/ }),
  55812. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  55813. /*!************************************************************************!*\
  55814. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  55815. \************************************************************************/
  55816. /*! exports provided: default */
  55817. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55818. "use strict";
  55819. __webpack_require__.r(__webpack_exports__);
  55820. /* 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&");
  55821. /* 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"]);
  55822. /***/ }),
  55823. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  55824. /*!******************************************************************************!*\
  55825. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  55826. \******************************************************************************/
  55827. /*! exports provided: render, staticRenderFns */
  55828. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55829. "use strict";
  55830. __webpack_require__.r(__webpack_exports__);
  55831. /* 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&");
  55832. /* 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"]; });
  55833. /* 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"]; });
  55834. /***/ }),
  55835. /***/ "./resources/js/components/modal.vue":
  55836. /*!*******************************************!*\
  55837. !*** ./resources/js/components/modal.vue ***!
  55838. \*******************************************/
  55839. /*! exports provided: default */
  55840. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55841. "use strict";
  55842. __webpack_require__.r(__webpack_exports__);
  55843. /* 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&");
  55844. /* 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");
  55845. var script = {}
  55846. /* normalize component */
  55847. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  55848. script,
  55849. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  55850. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55851. false,
  55852. null,
  55853. null,
  55854. null
  55855. )
  55856. /* hot reload */
  55857. if (false) { var api; }
  55858. component.options.__file = "resources/js/components/modal.vue"
  55859. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55860. /***/ }),
  55861. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  55862. /*!**************************************************************************!*\
  55863. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  55864. \**************************************************************************/
  55865. /*! exports provided: render, staticRenderFns */
  55866. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55867. "use strict";
  55868. __webpack_require__.r(__webpack_exports__);
  55869. /* 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&");
  55870. /* 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"]; });
  55871. /* 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"]; });
  55872. /***/ }),
  55873. /***/ "./resources/js/components/notes.vue":
  55874. /*!*******************************************!*\
  55875. !*** ./resources/js/components/notes.vue ***!
  55876. \*******************************************/
  55877. /*! exports provided: default */
  55878. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55879. "use strict";
  55880. __webpack_require__.r(__webpack_exports__);
  55881. /* 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&");
  55882. /* 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&");
  55883. /* 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");
  55884. /* normalize component */
  55885. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55886. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55887. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55888. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55889. false,
  55890. null,
  55891. null,
  55892. null
  55893. )
  55894. /* hot reload */
  55895. if (false) { var api; }
  55896. component.options.__file = "resources/js/components/notes.vue"
  55897. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55898. /***/ }),
  55899. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  55900. /*!********************************************************************!*\
  55901. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  55902. \********************************************************************/
  55903. /*! exports provided: default */
  55904. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55905. "use strict";
  55906. __webpack_require__.r(__webpack_exports__);
  55907. /* 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&");
  55908. /* 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"]);
  55909. /***/ }),
  55910. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  55911. /*!**************************************************************************!*\
  55912. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  55913. \**************************************************************************/
  55914. /*! exports provided: render, staticRenderFns */
  55915. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55916. "use strict";
  55917. __webpack_require__.r(__webpack_exports__);
  55918. /* 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&");
  55919. /* 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"]; });
  55920. /* 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"]; });
  55921. /***/ }),
  55922. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  55923. /*!*******************************************************!*\
  55924. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  55925. \*******************************************************/
  55926. /*! exports provided: default */
  55927. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55928. "use strict";
  55929. __webpack_require__.r(__webpack_exports__);
  55930. /* 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&");
  55931. /* 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&");
  55932. /* 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");
  55933. /* normalize component */
  55934. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55935. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55936. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  55937. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55938. false,
  55939. null,
  55940. null,
  55941. null
  55942. )
  55943. /* hot reload */
  55944. if (false) { var api; }
  55945. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  55946. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55947. /***/ }),
  55948. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  55949. /*!********************************************************************************!*\
  55950. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  55951. \********************************************************************************/
  55952. /*! exports provided: default */
  55953. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55954. "use strict";
  55955. __webpack_require__.r(__webpack_exports__);
  55956. /* 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&");
  55957. /* 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"]);
  55958. /***/ }),
  55959. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  55960. /*!**************************************************************************************!*\
  55961. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  55962. \**************************************************************************************/
  55963. /*! exports provided: render, staticRenderFns */
  55964. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55965. "use strict";
  55966. __webpack_require__.r(__webpack_exports__);
  55967. /* 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&");
  55968. /* 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"]; });
  55969. /* 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"]; });
  55970. /***/ }),
  55971. /***/ "./resources/js/components/woinfo.vue":
  55972. /*!********************************************!*\
  55973. !*** ./resources/js/components/woinfo.vue ***!
  55974. \********************************************/
  55975. /*! exports provided: default */
  55976. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55977. "use strict";
  55978. __webpack_require__.r(__webpack_exports__);
  55979. /* 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&");
  55980. /* 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&");
  55981. /* 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");
  55982. /* normalize component */
  55983. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55984. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55985. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  55986. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55987. false,
  55988. null,
  55989. null,
  55990. null
  55991. )
  55992. /* hot reload */
  55993. if (false) { var api; }
  55994. component.options.__file = "resources/js/components/woinfo.vue"
  55995. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55996. /***/ }),
  55997. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  55998. /*!*********************************************************************!*\
  55999. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  56000. \*********************************************************************/
  56001. /*! exports provided: default */
  56002. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56003. "use strict";
  56004. __webpack_require__.r(__webpack_exports__);
  56005. /* 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&");
  56006. /* 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"]);
  56007. /***/ }),
  56008. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  56009. /*!***************************************************************************!*\
  56010. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  56011. \***************************************************************************/
  56012. /*! exports provided: render, staticRenderFns */
  56013. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56014. "use strict";
  56015. __webpack_require__.r(__webpack_exports__);
  56016. /* 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&");
  56017. /* 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"]; });
  56018. /* 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"]; });
  56019. /***/ }),
  56020. /***/ "./resources/js/mixins/dateMixin.js":
  56021. /*!******************************************!*\
  56022. !*** ./resources/js/mixins/dateMixin.js ***!
  56023. \******************************************/
  56024. /*! exports provided: default */
  56025. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56026. "use strict";
  56027. __webpack_require__.r(__webpack_exports__);
  56028. /* harmony default export */ __webpack_exports__["default"] = ({
  56029. methods: {
  56030. treatAsUTC: function treatAsUTC(date) {
  56031. var result = new Date(date);
  56032. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  56033. return result;
  56034. },
  56035. daysSinceToday: function daysSinceToday(date) {
  56036. var currentDate = new Date();
  56037. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  56038. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  56039. },
  56040. getHRDate: function getHRDate(dateString) {
  56041. var date = new Date(dateString);
  56042. return date.toLocaleString('default', {
  56043. month: 'short',
  56044. day: 'numeric',
  56045. year: 'numeric',
  56046. hour: 'numeric',
  56047. minute: 'numeric'
  56048. });
  56049. },
  56050. isZero: function isZero(dateString) {
  56051. return dateString === '0000-00-00 00:00:00';
  56052. }
  56053. }
  56054. });
  56055. /***/ }),
  56056. /***/ "./resources/js/notify.min.js":
  56057. /*!************************************!*\
  56058. !*** ./resources/js/notify.min.js ***!
  56059. \************************************/
  56060. /*! no static exports found */
  56061. /***/ (function(module, exports, __webpack_require__) {
  56062. 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); }
  56063. (function (e) {
  56064. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  56065. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  56066. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  56067. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  56068. })(function (e) {
  56069. function A(t, n, i) {
  56070. typeof i == "string" && (i = {
  56071. className: i
  56072. }), 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);
  56073. }
  56074. var t = [].indexOf || function (e) {
  56075. for (var t = 0, n = this.length; t < n; t++) {
  56076. if (t in this && this[t] === e) return t;
  56077. }
  56078. return -1;
  56079. },
  56080. n = "notify",
  56081. r = n + "js",
  56082. i = n + "!blank",
  56083. s = {
  56084. t: "top",
  56085. m: "middle",
  56086. b: "bottom",
  56087. l: "left",
  56088. c: "center",
  56089. r: "right"
  56090. },
  56091. o = ["l", "c", "r"],
  56092. u = ["t", "m", "b"],
  56093. a = ["t", "b", "l", "r"],
  56094. f = {
  56095. t: "b",
  56096. m: null,
  56097. b: "t",
  56098. l: "r",
  56099. c: null,
  56100. r: "l"
  56101. },
  56102. l = function l(t) {
  56103. var n;
  56104. return n = [], e.each(t.split(/\W+/), function (e, t) {
  56105. var r;
  56106. r = t.toLowerCase().charAt(0);
  56107. if (s[r]) return n.push(r);
  56108. }), n;
  56109. },
  56110. c = {},
  56111. h = {
  56112. name: "core",
  56113. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  56114. 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}"
  56115. },
  56116. p = {
  56117. "border-radius": ["-webkit-", "-moz-"]
  56118. },
  56119. d = function d(e) {
  56120. return c[e];
  56121. },
  56122. v = function v(e) {
  56123. if (!e) throw "Missing Style name";
  56124. c[e] && delete c[e];
  56125. },
  56126. m = function m(t, i) {
  56127. if (!t) throw "Missing Style name";
  56128. if (!i) throw "Missing Style definition";
  56129. if (!i.html) throw "Missing Style HTML";
  56130. var s = c[t];
  56131. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  56132. var o = "";
  56133. i.classes && e.each(i.classes, function (t, n) {
  56134. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  56135. return p[t] && e.each(p[t], function (e, r) {
  56136. return o += " " + r + t + ": " + n + ";\n";
  56137. }), o += " " + t + ": " + n + ";\n";
  56138. }), o += "}\n";
  56139. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  56140. var u = {},
  56141. a = e(i.html);
  56142. y("html", a, u), y("text", a, u), i.fields = u;
  56143. },
  56144. g = function g(t) {
  56145. var n, r, i;
  56146. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  56147. try {
  56148. r.html(t);
  56149. } catch (s) {
  56150. r[0].styleSheet.cssText = t;
  56151. }
  56152. return r;
  56153. },
  56154. y = function y(t, n, r) {
  56155. var s;
  56156. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  56157. var n;
  56158. n = e(this).attr(s), n || (n = i), r[n] = t;
  56159. });
  56160. },
  56161. b = function b(e, t) {
  56162. return e.is(t) ? e : e.find(t);
  56163. },
  56164. w = {
  56165. clickToHide: !0,
  56166. autoHide: !0,
  56167. autoHideDelay: 5e3,
  56168. arrowShow: !0,
  56169. arrowSize: 5,
  56170. breakNewLines: !0,
  56171. elementPosition: "bottom",
  56172. globalPosition: "top right",
  56173. style: "bootstrap",
  56174. className: "error",
  56175. showAnimation: "slideDown",
  56176. showDuration: 400,
  56177. hideAnimation: "slideUp",
  56178. hideDuration: 200,
  56179. gap: 5
  56180. },
  56181. E = function E(t, n) {
  56182. var r;
  56183. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  56184. },
  56185. S = function S(t) {
  56186. return e.extend(w, t);
  56187. },
  56188. x = function x(t) {
  56189. return e("<" + t + "></" + t + ">");
  56190. },
  56191. T = {},
  56192. N = function N(t) {
  56193. var n;
  56194. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  56195. return e(r).attr("name") === t.attr("name");
  56196. }), t = n.first()), t;
  56197. },
  56198. C = function C(e, t, n) {
  56199. var r, i;
  56200. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  56201. if (isNaN(n)) return;
  56202. 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;
  56203. },
  56204. k = function k(e, t, n) {
  56205. if (e === "l" || e === "t") return 0;
  56206. if (e === "c" || e === "m") return n / 2 - t / 2;
  56207. if (e === "r" || e === "b") return n - t;
  56208. throw "Invalid alignment";
  56209. },
  56210. L = function L(e) {
  56211. return L.e = L.e || x("div"), L.e.text(e).html();
  56212. };
  56213. A.prototype.loadHTML = function () {
  56214. var t;
  56215. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  56216. }, A.prototype.show = function (e, t) {
  56217. var n, r, i, s, o;
  56218. r = function (n) {
  56219. return function () {
  56220. !e && !n.elem && n.destroy();
  56221. if (t) return t();
  56222. };
  56223. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  56224. 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 {
  56225. if (!!o || !!e) return r();
  56226. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  56227. }
  56228. return n.push(r), i[s].apply(i, n);
  56229. }, A.prototype.setGlobalPosition = function () {
  56230. var t = this.getPosition(),
  56231. n = t[0],
  56232. i = t[1],
  56233. o = s[n],
  56234. u = s[i],
  56235. a = n + "|" + i,
  56236. f = T[a];
  56237. if (!f || !document.body.contains(f[0])) {
  56238. f = T[a] = x("div");
  56239. var l = {};
  56240. 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);
  56241. }
  56242. return f.prepend(this.wrapper);
  56243. }, A.prototype.setElementPosition = function () {
  56244. 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;
  56245. 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"];
  56246. for (w = 0, S = B.length; w < S; w++) {
  56247. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  56248. }
  56249. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  56250. if (!this.options.arrowShow) this.arrow.hide();else {
  56251. 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";
  56252. for (E = 0, x = a.length; E < x; E++) {
  56253. D = a[E], P = s[D];
  56254. if (D === L) continue;
  56255. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  56256. }
  56257. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  56258. }
  56259. 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);
  56260. if (r) return this.arrow.removeAttr("style").css(r);
  56261. }, A.prototype.getPosition = function () {
  56262. var e, n, r, i, s, f, c, h;
  56263. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  56264. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  56265. 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";
  56266. return e.length === 2 && (e[2] = e[1]), e;
  56267. }, A.prototype.getStyle = function (e) {
  56268. var t;
  56269. e || (e = this.options.style), e || (e = "default"), t = c[e];
  56270. if (!t) throw "Missing style: " + e;
  56271. return t;
  56272. }, A.prototype.updateClasses = function () {
  56273. var t, n;
  56274. 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) {
  56275. return r + "-" + n.name + "-" + e;
  56276. }).join(" "), this.userContainer.attr("class", t);
  56277. }, A.prototype.run = function (t, n) {
  56278. var r, s, o, u, a;
  56279. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  56280. if (this.container && !t) {
  56281. this.show(!1);
  56282. return;
  56283. }
  56284. if (!this.container && !t) return;
  56285. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  56286. for (o in s) {
  56287. r = s[o], u = this.userFields[o];
  56288. if (!u) continue;
  56289. 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);
  56290. }
  56291. 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));
  56292. }, A.prototype.destroy = function () {
  56293. this.wrapper.data(r, null), this.wrapper.remove();
  56294. }, e[n] = function (t, r, i) {
  56295. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  56296. }, e.fn[n] = function (t, n) {
  56297. return e(this).each(function () {
  56298. var i = N(e(this)).data(r);
  56299. i && i.destroy();
  56300. var s = new A(e(this), t, n);
  56301. }), this;
  56302. }, e.extend(e[n], {
  56303. defaults: S,
  56304. addStyle: m,
  56305. removeStyle: v,
  56306. pluginOptions: w,
  56307. getStyle: d,
  56308. insertCSS: g
  56309. }), m("bootstrap", {
  56310. html: "<div>\n<span data-notify-text></span>\n</div>",
  56311. classes: {
  56312. base: {
  56313. "font-weight": "bold",
  56314. padding: "8px 15px 8px 14px",
  56315. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  56316. "background-color": "#fcf8e3",
  56317. border: "1px solid #fbeed5",
  56318. "border-radius": "4px",
  56319. "white-space": "nowrap",
  56320. "padding-left": "25px",
  56321. "background-repeat": "no-repeat",
  56322. "background-position": "3px 7px"
  56323. },
  56324. error: {
  56325. color: "#B94A48",
  56326. "background-color": "#F2DEDE",
  56327. "border-color": "#EED3D7",
  56328. "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=)"
  56329. },
  56330. success: {
  56331. color: "#468847",
  56332. "background-color": "#DFF0D8",
  56333. "border-color": "#D6E9C6",
  56334. "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==)"
  56335. },
  56336. info: {
  56337. color: "#3A87AD",
  56338. "background-color": "#D9EDF7",
  56339. "border-color": "#BCE8F1",
  56340. "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=)"
  56341. },
  56342. warn: {
  56343. color: "#C09853",
  56344. "background-color": "#FCF8E3",
  56345. "border-color": "#FBEED5",
  56346. "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)"
  56347. }
  56348. }
  56349. }), e(function () {
  56350. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  56351. e(this).trigger("notify-hide");
  56352. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  56353. var n = e(this).data(r);
  56354. n && n.show(!1);
  56355. });
  56356. });
  56357. });
  56358. /***/ }),
  56359. /***/ "./resources/sass/app.scss":
  56360. /*!*********************************!*\
  56361. !*** ./resources/sass/app.scss ***!
  56362. \*********************************/
  56363. /*! no static exports found */
  56364. /***/ (function(module, exports) {
  56365. // removed by extract-text-webpack-plugin
  56366. /***/ }),
  56367. /***/ 0:
  56368. /*!*************************************************************!*\
  56369. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  56370. \*************************************************************/
  56371. /*! no static exports found */
  56372. /***/ (function(module, exports, __webpack_require__) {
  56373. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  56374. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  56375. /***/ })
  56376. /******/ });